@reykjavik/hanna-react 0.10.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +795 -0
- package/README.md +69 -0
- package/lib/AccordionList.cjs +91 -0
- package/lib/AccordionList.mjs +69 -0
- package/lib/ActionCards.cjs +57 -0
- package/lib/ActionCards.mjs +35 -0
- package/lib/Alert.cjs +159 -0
- package/lib/Alert.mjs +139 -0
- package/lib/ArticleCarousel/_ArticleCarouselCard.cjs +75 -0
- package/lib/ArticleCarousel/_ArticleCarouselCard.mjs +51 -0
- package/lib/ArticleCarousel.cjs +43 -0
- package/lib/ArticleCarousel.mjs +21 -0
- package/lib/ArticleMeta.cjs +46 -0
- package/lib/ArticleMeta.mjs +22 -0
- package/lib/Attention.cjs +33 -0
- package/lib/Attention.mjs +9 -0
- package/lib/BasicTable.cjs +72 -0
- package/lib/BasicTable.mjs +50 -0
- package/lib/Bling.cjs +76 -0
- package/lib/Bling.mjs +52 -0
- package/lib/BlockBreak.cjs +32 -0
- package/lib/BlockBreak.mjs +8 -0
- package/lib/BlockQuote.cjs +47 -0
- package/lib/BlockQuote.mjs +25 -0
- package/lib/BreadCrumbs.cjs +67 -0
- package/lib/BreadCrumbs.mjs +43 -0
- package/lib/ButtonBack.cjs +47 -0
- package/lib/ButtonBack.mjs +25 -0
- package/lib/ButtonBar.cjs +45 -0
- package/lib/ButtonBar.mjs +18 -0
- package/lib/ButtonPrimary.cjs +47 -0
- package/lib/ButtonPrimary.mjs +25 -0
- package/lib/ButtonSecondary.cjs +47 -0
- package/lib/ButtonSecondary.mjs +25 -0
- package/lib/ButtonTertiary.cjs +64 -0
- package/lib/ButtonTertiary.mjs +42 -0
- package/lib/Carousel.cjs +52 -0
- package/lib/Carousel.mjs +30 -0
- package/lib/CarouselStepper.cjs +51 -0
- package/lib/CarouselStepper.mjs +29 -0
- package/lib/CenterColumn.cjs +40 -0
- package/lib/CenterColumn.mjs +16 -0
- package/lib/Checkbox.cjs +52 -0
- package/lib/Checkbox.mjs +30 -0
- package/lib/CheckboxButtonsGroup.cjs +65 -0
- package/lib/CheckboxButtonsGroup.mjs +43 -0
- package/lib/CheckboxGroup.cjs +55 -0
- package/lib/CheckboxGroup.mjs +33 -0
- package/lib/CityBlock.cjs +49 -0
- package/lib/CityBlock.mjs +25 -0
- package/lib/ContactBubble.cjs +200 -0
- package/lib/ContactBubble.mjs +173 -0
- package/lib/ContentArticle.cjs +63 -0
- package/lib/ContentArticle.mjs +41 -0
- package/lib/ContentImage.cjs +58 -0
- package/lib/ContentImage.mjs +36 -0
- package/lib/Datepicker.cjs +164 -0
- package/lib/Datepicker.mjs +142 -0
- package/lib/ExtraLinks.cjs +96 -0
- package/lib/ExtraLinks.mjs +74 -0
- package/lib/FeatureList.cjs +53 -0
- package/lib/FeatureList.mjs +29 -0
- package/lib/FieldGroup.cjs +40 -0
- package/lib/FieldGroup.mjs +16 -0
- package/lib/FileInput.cjs +256 -0
- package/lib/FileInput.mjs +234 -0
- package/lib/Foonote.cjs +30 -0
- package/lib/Foonote.mjs +6 -0
- package/lib/FooterBadges.cjs +49 -0
- package/lib/FooterBadges.mjs +25 -0
- package/lib/FooterInfo.cjs +47 -0
- package/lib/FooterInfo.mjs +23 -0
- package/lib/Footnote.cjs +32 -0
- package/lib/Footnote.mjs +8 -0
- package/lib/Form.cjs +56 -0
- package/lib/Form.mjs +34 -0
- package/lib/FormField.cjs +153 -0
- package/lib/FormField.mjs +131 -0
- package/lib/Gallery/_GalleryItem.cjs +83 -0
- package/lib/Gallery/_GalleryItem.mjs +61 -0
- package/lib/Gallery/_GalleryModal.cjs +104 -0
- package/lib/Gallery/_GalleryModal.mjs +82 -0
- package/lib/Gallery/_GalleryModalContext.cjs +30 -0
- package/lib/Gallery/_GalleryModalContext.mjs +6 -0
- package/lib/Gallery/_GalleryModalItem.cjs +59 -0
- package/lib/Gallery/_GalleryModalItem.mjs +36 -0
- package/lib/Gallery.cjs +79 -0
- package/lib/Gallery.mjs +57 -0
- package/lib/GridBlocks.cjs +81 -0
- package/lib/GridBlocks.mjs +59 -0
- package/lib/Heading.cjs +45 -0
- package/lib/Heading.mjs +21 -0
- package/lib/HeroBlock.cjs +74 -0
- package/lib/HeroBlock.mjs +52 -0
- package/lib/IframeBlock.cjs +48 -0
- package/lib/IframeBlock.mjs +24 -0
- package/lib/Illustration.cjs +51 -0
- package/lib/Illustration.mjs +31 -0
- package/lib/ImageCards.cjs +72 -0
- package/lib/ImageCards.mjs +52 -0
- package/lib/InfoBlock.cjs +51 -0
- package/lib/InfoBlock.mjs +27 -0
- package/lib/InfoHero.cjs +150 -0
- package/lib/InfoHero.mjs +128 -0
- package/lib/IslandBlock.cjs +63 -0
- package/lib/IslandBlock.mjs +41 -0
- package/lib/IslandPageBlock.cjs +49 -0
- package/lib/IslandPageBlock.mjs +25 -0
- package/lib/LabeledTextBlock.cjs +60 -0
- package/lib/LabeledTextBlock.mjs +38 -0
- package/lib/Layout.cjs +113 -0
- package/lib/Layout.mjs +87 -0
- package/lib/MainMenu/_Auxiliary.cjs +54 -0
- package/lib/MainMenu/_Auxiliary.mjs +28 -0
- package/lib/MainMenu/_PrimaryPanel.cjs +74 -0
- package/lib/MainMenu/_PrimaryPanel.mjs +48 -0
- package/lib/MainMenu.cjs +209 -0
- package/lib/MainMenu.mjs +187 -0
- package/lib/MiniMetrics.cjs +56 -0
- package/lib/MiniMetrics.mjs +34 -0
- package/lib/Modal.cjs +70 -0
- package/lib/Modal.mjs +48 -0
- package/lib/NameCard.cjs +115 -0
- package/lib/NameCard.mjs +91 -0
- package/lib/NameCards.cjs +52 -0
- package/lib/NameCards.mjs +30 -0
- package/lib/NewsHero.cjs +136 -0
- package/lib/NewsHero.mjs +114 -0
- package/lib/PageFilter.cjs +48 -0
- package/lib/PageFilter.mjs +24 -0
- package/lib/PageHeading.cjs +42 -0
- package/lib/PageHeading.mjs +18 -0
- package/lib/ProcessOverview.cjs +52 -0
- package/lib/ProcessOverview.mjs +28 -0
- package/lib/PullQuote.cjs +47 -0
- package/lib/PullQuote.mjs +25 -0
- package/lib/RadioButtonsGroup.cjs +64 -0
- package/lib/RadioButtonsGroup.mjs +42 -0
- package/lib/RadioGroup.cjs +58 -0
- package/lib/RadioGroup.mjs +36 -0
- package/lib/RelatedLinks.cjs +61 -0
- package/lib/RelatedLinks.mjs +37 -0
- package/lib/RowBlock.cjs +39 -0
- package/lib/RowBlock.mjs +15 -0
- package/lib/RowBlockColumn.cjs +40 -0
- package/lib/RowBlockColumn.mjs +16 -0
- package/lib/SearchInput.cjs +136 -0
- package/lib/SearchInput.mjs +114 -0
- package/lib/SearchResults/_SearchResultsItem.cjs +54 -0
- package/lib/SearchResults/_SearchResultsItem.mjs +30 -0
- package/lib/SearchResults.cjs +172 -0
- package/lib/SearchResults.mjs +150 -0
- package/lib/SeenEffect.cjs +66 -0
- package/lib/SeenEffect.mjs +44 -0
- package/lib/Selectbox.cjs +144 -0
- package/lib/Selectbox.mjs +122 -0
- package/lib/ShareButtons.cjs +101 -0
- package/lib/ShareButtons.mjs +83 -0
- package/lib/Sharpie.cjs +51 -0
- package/lib/Sharpie.mjs +27 -0
- package/lib/SiteSearchAutocomplete.cjs +150 -0
- package/lib/SiteSearchAutocomplete.mjs +126 -0
- package/lib/SiteSearchCurtain.cjs +78 -0
- package/lib/SiteSearchCurtain.mjs +56 -0
- package/lib/SiteSearchInput.cjs +119 -0
- package/lib/SiteSearchInput.mjs +97 -0
- package/lib/Skeleton.cjs +63 -0
- package/lib/Skeleton.mjs +39 -0
- package/lib/SubHeading.cjs +43 -0
- package/lib/SubHeading.mjs +19 -0
- package/lib/Tabs.cjs +166 -0
- package/lib/Tabs.mjs +144 -0
- package/lib/TagPill.cjs +113 -0
- package/lib/TagPill.mjs +91 -0
- package/lib/TextBlock.cjs +45 -0
- package/lib/TextBlock.mjs +21 -0
- package/lib/TextButton.cjs +55 -0
- package/lib/TextButton.mjs +33 -0
- package/lib/TextInput.cjs +136 -0
- package/lib/TextInput.mjs +114 -0
- package/lib/VSpacer.cjs +70 -0
- package/lib/VSpacer.mjs +46 -0
- package/lib/VerticalTabsTOC.cjs +123 -0
- package/lib/VerticalTabsTOC.mjs +101 -0
- package/lib/WizardLayout.cjs +79 -0
- package/lib/WizardLayout.mjs +55 -0
- package/lib/WizardLayoutClose.cjs +47 -0
- package/lib/WizardLayoutClose.mjs +25 -0
- package/lib/WizardStepper.cjs +55 -0
- package/lib/WizardStepper.mjs +31 -0
- package/lib/_abstract/Button.cjs +114 -0
- package/lib/_abstract/Button.mjs +92 -0
- package/lib/_abstract/CardList.cjs +100 -0
- package/lib/_abstract/CardList.mjs +76 -0
- package/lib/_abstract/Image.cjs +75 -0
- package/lib/_abstract/Image.mjs +51 -0
- package/lib/_abstract/Link.cjs +37 -0
- package/lib/_abstract/Link.mjs +10 -0
- package/lib/_abstract/TogglerGroup.cjs +92 -0
- package/lib/_abstract/TogglerGroup.mjs +70 -0
- package/lib/_abstract/TogglerGroupField.cjs +121 -0
- package/lib/_abstract/TogglerGroupField.mjs +99 -0
- package/lib/_abstract/TogglerInput.cjs +105 -0
- package/lib/_abstract/TogglerInput.mjs +83 -0
- package/lib/_abstract/_AbstractCarousel.cjs +170 -0
- package/lib/_abstract/_AbstractCarousel.mjs +152 -0
- package/lib/_abstract/_Blings.cjs +47 -0
- package/lib/_abstract/_Blings.mjs +23 -0
- package/lib/_abstract/_Block.cjs +73 -0
- package/lib/_abstract/_Block.mjs +51 -0
- package/lib/_abstract/_Quote.cjs +43 -0
- package/lib/_abstract/_Quote.mjs +17 -0
- package/lib/_abstract/breakOnNL.cjs +30 -0
- package/lib/_abstract/breakOnNL.mjs +6 -0
- package/lib/assets.cjs +77 -0
- package/lib/assets.mjs +53 -0
- package/lib/constants.cjs +49 -0
- package/lib/constants.mjs +24 -0
- package/lib/focus-visible.cjs +1 -0
- package/lib/focus-visible.mjs +1 -0
- package/lib/utils/config.cjs +27 -0
- package/lib/utils/config.mjs +4 -0
- package/lib/utils/detectEdgeScroll.cjs +95 -0
- package/lib/utils/detectEdgeScroll.mjs +71 -0
- package/lib/utils/env.cjs +31 -0
- package/lib/utils/env.mjs +5 -0
- package/lib/utils/seenEffect.cjs +93 -0
- package/lib/utils/seenEffect.mjs +65 -0
- package/lib/utils/useFormatMonitor.cjs +29 -0
- package/lib/utils/useFormatMonitor.mjs +6 -0
- package/lib/utils/useGetSVGtext.cjs +44 -0
- package/lib/utils/useGetSVGtext.mjs +21 -0
- package/lib/utils/useMenuToggling.cjs +83 -0
- package/lib/utils/useMenuToggling.mjs +60 -0
- package/lib/utils/useScrollbarWidthCSSVar.cjs +32 -0
- package/lib/utils/useScrollbarWidthCSSVar.mjs +6 -0
- package/lib/utils.cjs +18 -0
- package/lib/utils.mjs +2 -0
- package/package.json +491 -0
- package/types/AccordionList.d.ts +17 -0
- package/types/ActionCards.d.ts +5 -0
- package/types/Alert.d.ts +49 -0
- package/types/ArticleCarousel/_ArticleCarouselCard.d.ts +27 -0
- package/types/ArticleCarousel.d.ts +12 -0
- package/types/ArticleMeta.d.ts +9 -0
- package/types/Attention.d.ts +7 -0
- package/types/BasicTable.d.ts +12 -0
- package/types/Bling.d.ts +81 -0
- package/types/BlockBreak.d.ts +2 -0
- package/types/BlockQuote.d.ts +4 -0
- package/types/BreadCrumbs.d.ts +11 -0
- package/types/ButtonBack.d.ts +7 -0
- package/types/ButtonBar.d.ts +16 -0
- package/types/ButtonPrimary.d.ts +7 -0
- package/types/ButtonSecondary.d.ts +7 -0
- package/types/ButtonTertiary.d.ts +12 -0
- package/types/Carousel.d.ts +4 -0
- package/types/CarouselStepper.d.ts +4 -0
- package/types/CenterColumn.d.ts +7 -0
- package/types/Checkbox.d.ts +4 -0
- package/types/CheckboxButtonsGroup.d.ts +11 -0
- package/types/CheckboxGroup.d.ts +9 -0
- package/types/CityBlock.d.ts +23 -0
- package/types/ContactBubble.d.ts +58 -0
- package/types/ContentArticle.d.ts +15 -0
- package/types/ContentImage.d.ts +8 -0
- package/types/Datepicker.d.ts +39 -0
- package/types/ExtraLinks.d.ts +18 -0
- package/types/FeatureList.d.ts +12 -0
- package/types/FieldGroup.d.ts +9 -0
- package/types/FileInput.d.ts +17 -0
- package/types/Foonote.d.ts +12 -0
- package/types/FooterBadges.d.ts +9 -0
- package/types/FooterInfo.d.ts +18 -0
- package/types/Footnote.d.ts +6 -0
- package/types/Form.d.ts +7 -0
- package/types/FormField.d.ts +65 -0
- package/types/Gallery/_GalleryItem.d.ts +8 -0
- package/types/Gallery/_GalleryModal.d.ts +6 -0
- package/types/Gallery/_GalleryModalContext.d.ts +9 -0
- package/types/Gallery/_GalleryModalItem.d.ts +3 -0
- package/types/Gallery.d.ts +17 -0
- package/types/GridBlocks.d.ts +26 -0
- package/types/Heading.d.ts +16 -0
- package/types/HeroBlock.d.ts +19 -0
- package/types/IframeBlock.d.ts +23 -0
- package/types/Illustration.d.ts +13 -0
- package/types/ImageCards.d.ts +8 -0
- package/types/InfoBlock.d.ts +17 -0
- package/types/InfoHero.d.ts +17 -0
- package/types/IslandBlock.d.ts +25 -0
- package/types/IslandPageBlock.d.ts +24 -0
- package/types/LabeledTextBlock.d.ts +11 -0
- package/types/Layout.d.ts +33 -0
- package/types/MainMenu/_Auxiliary.d.ts +6 -0
- package/types/MainMenu/_PrimaryPanel.d.ts +13 -0
- package/types/MainMenu.d.ts +48 -0
- package/types/MiniMetrics.d.ts +8 -0
- package/types/Modal.d.ts +10 -0
- package/types/NameCard.d.ts +64 -0
- package/types/NameCards.d.ts +6 -0
- package/types/NewsHero.d.ts +14 -0
- package/types/PageFilter.d.ts +17 -0
- package/types/PageHeading.d.ts +10 -0
- package/types/ProcessOverview.d.ts +13 -0
- package/types/PullQuote.d.ts +4 -0
- package/types/RadioButtonsGroup.d.ts +11 -0
- package/types/RadioGroup.d.ts +13 -0
- package/types/RelatedLinks.d.ts +20 -0
- package/types/RowBlock.d.ts +12 -0
- package/types/RowBlockColumn.d.ts +8 -0
- package/types/SearchInput.d.ts +18 -0
- package/types/SearchResults/_SearchResultsItem.d.ts +18 -0
- package/types/SearchResults.d.ts +33 -0
- package/types/SeenEffect.d.ts +4 -0
- package/types/Selectbox.d.ts +8 -0
- package/types/ShareButtons.d.ts +9 -0
- package/types/Sharpie.d.ts +23 -0
- package/types/SiteSearchAutocomplete.d.ts +40 -0
- package/types/SiteSearchCurtain.d.ts +6 -0
- package/types/SiteSearchInput.d.ts +24 -0
- package/types/Skeleton.d.ts +25 -0
- package/types/SubHeading.d.ts +10 -0
- package/types/Tabs.d.ts +35 -0
- package/types/TagPill.d.ts +27 -0
- package/types/TextBlock.d.ts +15 -0
- package/types/TextButton.d.ts +9 -0
- package/types/TextInput.d.ts +16 -0
- package/types/VSpacer.d.ts +24 -0
- package/types/VerticalTabsTOC.d.ts +14 -0
- package/types/WizardLayout.d.ts +15 -0
- package/types/WizardLayoutClose.d.ts +3 -0
- package/types/WizardStepper.d.ts +36 -0
- package/types/_abstract/Button.d.ts +40 -0
- package/types/_abstract/CardList.d.ts +29 -0
- package/types/_abstract/Image.d.ts +32 -0
- package/types/_abstract/Link.d.ts +27 -0
- package/types/_abstract/TogglerGroup.d.ts +31 -0
- package/types/_abstract/TogglerGroupField.d.ts +17 -0
- package/types/_abstract/TogglerInput.d.ts +22 -0
- package/types/_abstract/_AbstractCarousel.d.ts +25 -0
- package/types/_abstract/_Blings.d.ts +11 -0
- package/types/_abstract/_Block.d.ts +22 -0
- package/types/_abstract/_Quote.d.ts +9 -0
- package/types/_abstract/breakOnNL.d.ts +2 -0
- package/types/assets.d.ts +42 -0
- package/types/constants.d.ts +39 -0
- package/types/focus-visible.d.ts +1 -0
- package/types/utils/config.d.ts +2 -0
- package/types/utils/detectEdgeScroll.d.ts +52 -0
- package/types/utils/env.d.ts +1 -0
- package/types/utils/seenEffect.d.ts +28 -0
- package/types/utils/useFormatMonitor.d.ts +38 -0
- package/types/utils/useGetSVGtext.d.ts +6 -0
- package/types/utils/useMenuToggling.d.ts +8 -0
- package/types/utils/useScrollbarWidthCSSVar.d.ts +1 -0
- package/types/utils.d.ts +2 -0
package/lib/Skeleton.mjs
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import range from "@hugsmidjan/qj/range";
|
|
3
|
+
import getBemClass from "@hugsmidjan/react/utils/getBemClass";
|
|
4
|
+
const makeRenderSkeleton = (props) => (key) => /* @__PURE__ */ React.createElement("span", {
|
|
5
|
+
key,
|
|
6
|
+
className: getBemClass("Skeleton", [
|
|
7
|
+
props.text && "text",
|
|
8
|
+
props.height && "height--" + props.height,
|
|
9
|
+
props.gap && "gap--" + props.gap
|
|
10
|
+
])
|
|
11
|
+
});
|
|
12
|
+
const minmax = (num = 0, max = 100, min = 1) => {
|
|
13
|
+
num = Math.min(Math.max(Math.round(num), min), max);
|
|
14
|
+
return num > min ? num : void 0;
|
|
15
|
+
};
|
|
16
|
+
const Skeleton = (props) => {
|
|
17
|
+
const height = minmax(props.height, 40);
|
|
18
|
+
const renderSkeleton = makeRenderSkeleton({
|
|
19
|
+
height,
|
|
20
|
+
text: props.text,
|
|
21
|
+
gap: minmax(props.gap, 5, 0)
|
|
22
|
+
});
|
|
23
|
+
const items = minmax(props.items, 20) || 1;
|
|
24
|
+
if (items > 1) {
|
|
25
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, range(1, items).map(renderSkeleton));
|
|
26
|
+
}
|
|
27
|
+
return renderSkeleton();
|
|
28
|
+
};
|
|
29
|
+
var Skeleton_default = Skeleton;
|
|
30
|
+
Skeleton.block = (height) => /* @__PURE__ */ React.createElement(Skeleton, {
|
|
31
|
+
height
|
|
32
|
+
});
|
|
33
|
+
Skeleton.text = (height) => /* @__PURE__ */ React.createElement(Skeleton, {
|
|
34
|
+
text: true,
|
|
35
|
+
height
|
|
36
|
+
});
|
|
37
|
+
export {
|
|
38
|
+
Skeleton_default as default
|
|
39
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var SubHeading_exports = {};
|
|
22
|
+
__export(SubHeading_exports, {
|
|
23
|
+
default: () => SubHeading_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(SubHeading_exports);
|
|
26
|
+
var import_react = __toESM(require("react"));
|
|
27
|
+
var import_getBemClass = __toESM(require("@hugsmidjan/react/utils/getBemClass"));
|
|
28
|
+
var import_seenEffect = require("./utils/seenEffect");
|
|
29
|
+
const SubHeading = (props) => {
|
|
30
|
+
const { small, Tag = "h2", children, align, wide, startSeen } = props;
|
|
31
|
+
const [ref] = (0, import_seenEffect.useSeenEffect)(startSeen);
|
|
32
|
+
return /* @__PURE__ */ import_react.default.createElement(Tag, {
|
|
33
|
+
className: (0, import_getBemClass.default)("SubHeading", [
|
|
34
|
+
small && "small",
|
|
35
|
+
align === "right" && "align--" + align,
|
|
36
|
+
!align && wide && "wide"
|
|
37
|
+
]),
|
|
38
|
+
ref
|
|
39
|
+
}, children);
|
|
40
|
+
};
|
|
41
|
+
var SubHeading_default = SubHeading;
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import getBemClass from "@hugsmidjan/react/utils/getBemClass";
|
|
3
|
+
import { useSeenEffect } from "./utils/seenEffect";
|
|
4
|
+
const SubHeading = (props) => {
|
|
5
|
+
const { small, Tag = "h2", children, align, wide, startSeen } = props;
|
|
6
|
+
const [ref] = useSeenEffect(startSeen);
|
|
7
|
+
return /* @__PURE__ */ React.createElement(Tag, {
|
|
8
|
+
className: getBemClass("SubHeading", [
|
|
9
|
+
small && "small",
|
|
10
|
+
align === "right" && "align--" + align,
|
|
11
|
+
!align && wide && "wide"
|
|
12
|
+
]),
|
|
13
|
+
ref
|
|
14
|
+
}, children);
|
|
15
|
+
};
|
|
16
|
+
var SubHeading_default = SubHeading;
|
|
17
|
+
export {
|
|
18
|
+
SubHeading_default as default
|
|
19
|
+
};
|
package/lib/Tabs.cjs
ADDED
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
37
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
+
var Tabs_exports = {};
|
|
39
|
+
__export(Tabs_exports, {
|
|
40
|
+
default: () => Tabs_default
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(Tabs_exports);
|
|
43
|
+
var import_react = __toESM(require("react"));
|
|
44
|
+
var import_frag = require("@hugsmidjan/qj/frag");
|
|
45
|
+
var import_hooks = require("@hugsmidjan/react/hooks");
|
|
46
|
+
var import_getBemClass = __toESM(require("@hugsmidjan/react/utils/getBemClass"));
|
|
47
|
+
var import_seenEffect = require("./utils/seenEffect");
|
|
48
|
+
const navKeyEffects = {
|
|
49
|
+
ArrowUp: -1,
|
|
50
|
+
ArrowLeft: -1,
|
|
51
|
+
ArrowDown: 1,
|
|
52
|
+
ArrowRight: 1
|
|
53
|
+
};
|
|
54
|
+
const renderTab = (tabProps, index, listProps) => {
|
|
55
|
+
const { label, badge, href, type, longLabel } = tabProps;
|
|
56
|
+
const {
|
|
57
|
+
activeIdx,
|
|
58
|
+
activateTab,
|
|
59
|
+
focusedIdx,
|
|
60
|
+
setFocusedIdx,
|
|
61
|
+
tabRole,
|
|
62
|
+
listAriaControls,
|
|
63
|
+
isBrowser
|
|
64
|
+
} = listProps;
|
|
65
|
+
const handleClick = isBrowser && ((e) => {
|
|
66
|
+
e.preventDefault();
|
|
67
|
+
activateTab(index);
|
|
68
|
+
e.currentTarget.focus();
|
|
69
|
+
});
|
|
70
|
+
const handleFocus = isBrowser && (() => setFocusedIdx(index));
|
|
71
|
+
const isActive = activeIdx === index || void 0;
|
|
72
|
+
const Tag = href && !tabRole ? "a" : "button";
|
|
73
|
+
const tagProps = Tag === "button" ? {
|
|
74
|
+
role: tabRole,
|
|
75
|
+
type: type || "button",
|
|
76
|
+
tabIndex: tabRole ? focusedIdx === index ? 0 : -1 : void 0,
|
|
77
|
+
"aria-controls": tabProps["aria-controls"] || tabRole && (0, import_frag.getFrag)(href) || listAriaControls
|
|
78
|
+
} : { href };
|
|
79
|
+
return [
|
|
80
|
+
/* @__PURE__ */ import_react.default.createElement(Tag, __spreadProps(__spreadValues({
|
|
81
|
+
key: index,
|
|
82
|
+
className: "Tabs__tab",
|
|
83
|
+
"data-active": isActive
|
|
84
|
+
}, tagProps), {
|
|
85
|
+
onClick: handleClick,
|
|
86
|
+
onFocus: handleFocus,
|
|
87
|
+
"aria-label": longLabel,
|
|
88
|
+
title: longLabel
|
|
89
|
+
}), label, " ", badge != null && /* @__PURE__ */ import_react.default.createElement("small", {
|
|
90
|
+
className: "Tabs__tab__badge"
|
|
91
|
+
}, "(", badge, ")")),
|
|
92
|
+
" "
|
|
93
|
+
];
|
|
94
|
+
};
|
|
95
|
+
const Tabs = (props) => {
|
|
96
|
+
const {
|
|
97
|
+
tabs,
|
|
98
|
+
role,
|
|
99
|
+
"aria-label": ariaLabel,
|
|
100
|
+
"aria-labelledby": ariaLabelledBy,
|
|
101
|
+
"aria-controls": listAriaControls,
|
|
102
|
+
id,
|
|
103
|
+
activeIdx,
|
|
104
|
+
onSetActive,
|
|
105
|
+
activateOnFocus,
|
|
106
|
+
ssr,
|
|
107
|
+
startSeen,
|
|
108
|
+
vertical,
|
|
109
|
+
subTabs
|
|
110
|
+
} = props;
|
|
111
|
+
const isBrowser = (0, import_hooks.useIsBrowserSide)(ssr);
|
|
112
|
+
const [focusedIdx, setFocusedIdx] = (0, import_react.useState)(activeIdx || 0);
|
|
113
|
+
const tabRole = isBrowser && role === "tablist" ? "tab" : void 0;
|
|
114
|
+
const activateTab = (index) => {
|
|
115
|
+
const tab = tabs[index];
|
|
116
|
+
if (index === activeIdx || !tab) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const ret = tab.onActivated && tab.onActivated.call(null);
|
|
120
|
+
if (onSetActive && ret !== false) {
|
|
121
|
+
onSetActive(index, tab);
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const handleKeydown = tabRole && ((e) => {
|
|
125
|
+
var _a;
|
|
126
|
+
const delta = navKeyEffects[e.key];
|
|
127
|
+
if (delta) {
|
|
128
|
+
e.stopPropagation();
|
|
129
|
+
let nextIdx = (focusedIdx || 0) + delta;
|
|
130
|
+
const maxIdx = tabs.length - 1;
|
|
131
|
+
nextIdx = nextIdx < 0 ? maxIdx : nextIdx > maxIdx ? 0 : nextIdx;
|
|
132
|
+
(_a = e.currentTarget.querySelectorAll(".Tabs__tab")[nextIdx]) == null ? void 0 : _a.focus();
|
|
133
|
+
activateOnFocus && activateTab(nextIdx);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const [ref] = (0, import_seenEffect.useSeenEffect)(startSeen);
|
|
137
|
+
const listProps = {
|
|
138
|
+
activeIdx,
|
|
139
|
+
activateTab,
|
|
140
|
+
focusedIdx,
|
|
141
|
+
setFocusedIdx,
|
|
142
|
+
tabRole,
|
|
143
|
+
listAriaControls,
|
|
144
|
+
isBrowser
|
|
145
|
+
};
|
|
146
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
147
|
+
className: (0, import_getBemClass.default)("Tabs", vertical && "vertical"),
|
|
148
|
+
role: tabRole && role,
|
|
149
|
+
id,
|
|
150
|
+
"aria-label": ariaLabel,
|
|
151
|
+
"aria-labelledby": ariaLabelledBy,
|
|
152
|
+
onKeyDown: handleKeydown,
|
|
153
|
+
"data-sprinkled": isBrowser,
|
|
154
|
+
ref
|
|
155
|
+
}, tabs.map((tabProps, index) => renderTab(tabProps, index, listProps)), subTabs && /* @__PURE__ */ import_react.default.createElement(Tabs, __spreadProps(__spreadValues({}, subTabs), {
|
|
156
|
+
role: "role" in subTabs ? subTabs.role : role,
|
|
157
|
+
activateOnFocus: subTabs.activateOnFocus ?? activateOnFocus,
|
|
158
|
+
ssr: subTabs.ssr ?? ssr,
|
|
159
|
+
startSeen: true,
|
|
160
|
+
vertical: void 0,
|
|
161
|
+
subTabs: void 0
|
|
162
|
+
})));
|
|
163
|
+
};
|
|
164
|
+
var Tabs_default = Tabs;
|
|
165
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
166
|
+
0 && (module.exports = {});
|
package/lib/Tabs.mjs
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import React, { useState } from "react";
|
|
21
|
+
import { getFrag } from "@hugsmidjan/qj/frag";
|
|
22
|
+
import { useIsBrowserSide } from "@hugsmidjan/react/hooks";
|
|
23
|
+
import getBemClass from "@hugsmidjan/react/utils/getBemClass";
|
|
24
|
+
import { useSeenEffect } from "./utils/seenEffect";
|
|
25
|
+
const navKeyEffects = {
|
|
26
|
+
ArrowUp: -1,
|
|
27
|
+
ArrowLeft: -1,
|
|
28
|
+
ArrowDown: 1,
|
|
29
|
+
ArrowRight: 1
|
|
30
|
+
};
|
|
31
|
+
const renderTab = (tabProps, index, listProps) => {
|
|
32
|
+
const { label, badge, href, type, longLabel } = tabProps;
|
|
33
|
+
const {
|
|
34
|
+
activeIdx,
|
|
35
|
+
activateTab,
|
|
36
|
+
focusedIdx,
|
|
37
|
+
setFocusedIdx,
|
|
38
|
+
tabRole,
|
|
39
|
+
listAriaControls,
|
|
40
|
+
isBrowser
|
|
41
|
+
} = listProps;
|
|
42
|
+
const handleClick = isBrowser && ((e) => {
|
|
43
|
+
e.preventDefault();
|
|
44
|
+
activateTab(index);
|
|
45
|
+
e.currentTarget.focus();
|
|
46
|
+
});
|
|
47
|
+
const handleFocus = isBrowser && (() => setFocusedIdx(index));
|
|
48
|
+
const isActive = activeIdx === index || void 0;
|
|
49
|
+
const Tag = href && !tabRole ? "a" : "button";
|
|
50
|
+
const tagProps = Tag === "button" ? {
|
|
51
|
+
role: tabRole,
|
|
52
|
+
type: type || "button",
|
|
53
|
+
tabIndex: tabRole ? focusedIdx === index ? 0 : -1 : void 0,
|
|
54
|
+
"aria-controls": tabProps["aria-controls"] || tabRole && getFrag(href) || listAriaControls
|
|
55
|
+
} : { href };
|
|
56
|
+
return [
|
|
57
|
+
/* @__PURE__ */ React.createElement(Tag, __spreadProps(__spreadValues({
|
|
58
|
+
key: index,
|
|
59
|
+
className: "Tabs__tab",
|
|
60
|
+
"data-active": isActive
|
|
61
|
+
}, tagProps), {
|
|
62
|
+
onClick: handleClick,
|
|
63
|
+
onFocus: handleFocus,
|
|
64
|
+
"aria-label": longLabel,
|
|
65
|
+
title: longLabel
|
|
66
|
+
}), label, " ", badge != null && /* @__PURE__ */ React.createElement("small", {
|
|
67
|
+
className: "Tabs__tab__badge"
|
|
68
|
+
}, "(", badge, ")")),
|
|
69
|
+
" "
|
|
70
|
+
];
|
|
71
|
+
};
|
|
72
|
+
const Tabs = (props) => {
|
|
73
|
+
const {
|
|
74
|
+
tabs,
|
|
75
|
+
role,
|
|
76
|
+
"aria-label": ariaLabel,
|
|
77
|
+
"aria-labelledby": ariaLabelledBy,
|
|
78
|
+
"aria-controls": listAriaControls,
|
|
79
|
+
id,
|
|
80
|
+
activeIdx,
|
|
81
|
+
onSetActive,
|
|
82
|
+
activateOnFocus,
|
|
83
|
+
ssr,
|
|
84
|
+
startSeen,
|
|
85
|
+
vertical,
|
|
86
|
+
subTabs
|
|
87
|
+
} = props;
|
|
88
|
+
const isBrowser = useIsBrowserSide(ssr);
|
|
89
|
+
const [focusedIdx, setFocusedIdx] = useState(activeIdx || 0);
|
|
90
|
+
const tabRole = isBrowser && role === "tablist" ? "tab" : void 0;
|
|
91
|
+
const activateTab = (index) => {
|
|
92
|
+
const tab = tabs[index];
|
|
93
|
+
if (index === activeIdx || !tab) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
const ret = tab.onActivated && tab.onActivated.call(null);
|
|
97
|
+
if (onSetActive && ret !== false) {
|
|
98
|
+
onSetActive(index, tab);
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
const handleKeydown = tabRole && ((e) => {
|
|
102
|
+
var _a;
|
|
103
|
+
const delta = navKeyEffects[e.key];
|
|
104
|
+
if (delta) {
|
|
105
|
+
e.stopPropagation();
|
|
106
|
+
let nextIdx = (focusedIdx || 0) + delta;
|
|
107
|
+
const maxIdx = tabs.length - 1;
|
|
108
|
+
nextIdx = nextIdx < 0 ? maxIdx : nextIdx > maxIdx ? 0 : nextIdx;
|
|
109
|
+
(_a = e.currentTarget.querySelectorAll(".Tabs__tab")[nextIdx]) == null ? void 0 : _a.focus();
|
|
110
|
+
activateOnFocus && activateTab(nextIdx);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
const [ref] = useSeenEffect(startSeen);
|
|
114
|
+
const listProps = {
|
|
115
|
+
activeIdx,
|
|
116
|
+
activateTab,
|
|
117
|
+
focusedIdx,
|
|
118
|
+
setFocusedIdx,
|
|
119
|
+
tabRole,
|
|
120
|
+
listAriaControls,
|
|
121
|
+
isBrowser
|
|
122
|
+
};
|
|
123
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
124
|
+
className: getBemClass("Tabs", vertical && "vertical"),
|
|
125
|
+
role: tabRole && role,
|
|
126
|
+
id,
|
|
127
|
+
"aria-label": ariaLabel,
|
|
128
|
+
"aria-labelledby": ariaLabelledBy,
|
|
129
|
+
onKeyDown: handleKeydown,
|
|
130
|
+
"data-sprinkled": isBrowser,
|
|
131
|
+
ref
|
|
132
|
+
}, tabs.map((tabProps, index) => renderTab(tabProps, index, listProps)), subTabs && /* @__PURE__ */ React.createElement(Tabs, __spreadProps(__spreadValues({}, subTabs), {
|
|
133
|
+
role: "role" in subTabs ? subTabs.role : role,
|
|
134
|
+
activateOnFocus: subTabs.activateOnFocus ?? activateOnFocus,
|
|
135
|
+
ssr: subTabs.ssr ?? ssr,
|
|
136
|
+
startSeen: true,
|
|
137
|
+
vertical: void 0,
|
|
138
|
+
subTabs: void 0
|
|
139
|
+
})));
|
|
140
|
+
};
|
|
141
|
+
var Tabs_default = Tabs;
|
|
142
|
+
export {
|
|
143
|
+
Tabs_default as default
|
|
144
|
+
};
|
package/lib/TagPill.cjs
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __objRest = (source, exclude) => {
|
|
25
|
+
var target = {};
|
|
26
|
+
for (var prop in source)
|
|
27
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
if (source != null && __getOwnPropSymbols)
|
|
30
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
31
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
32
|
+
target[prop] = source[prop];
|
|
33
|
+
}
|
|
34
|
+
return target;
|
|
35
|
+
};
|
|
36
|
+
var __export = (target, all) => {
|
|
37
|
+
for (var name in all)
|
|
38
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
39
|
+
};
|
|
40
|
+
var __copyProps = (to, from, except, desc) => {
|
|
41
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
42
|
+
for (let key of __getOwnPropNames(from))
|
|
43
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
44
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
45
|
+
}
|
|
46
|
+
return to;
|
|
47
|
+
};
|
|
48
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
49
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
50
|
+
var TagPill_exports = {};
|
|
51
|
+
__export(TagPill_exports, {
|
|
52
|
+
default: () => TagPill_default
|
|
53
|
+
});
|
|
54
|
+
module.exports = __toCommonJS(TagPill_exports);
|
|
55
|
+
var import_react = __toESM(require("react"));
|
|
56
|
+
var import_getBemClass = __toESM(require("@hugsmidjan/react/utils/getBemClass"));
|
|
57
|
+
var import_Button = __toESM(require("./_abstract/Button"));
|
|
58
|
+
const colors = {
|
|
59
|
+
normal: "",
|
|
60
|
+
green: "color--green",
|
|
61
|
+
yellow: "color--yellow",
|
|
62
|
+
orange: "color--orange",
|
|
63
|
+
red: "color--red"
|
|
64
|
+
};
|
|
65
|
+
const TagPill = (props) => {
|
|
66
|
+
const _a = props, {
|
|
67
|
+
modifier,
|
|
68
|
+
large,
|
|
69
|
+
removable,
|
|
70
|
+
onRemove,
|
|
71
|
+
children,
|
|
72
|
+
color = "normal",
|
|
73
|
+
label = children,
|
|
74
|
+
removeLabel = "x",
|
|
75
|
+
removeLabelLong = removeLabel
|
|
76
|
+
} = _a, buttonProps = __objRest(_a, [
|
|
77
|
+
"modifier",
|
|
78
|
+
"large",
|
|
79
|
+
"removable",
|
|
80
|
+
"onRemove",
|
|
81
|
+
"children",
|
|
82
|
+
"color",
|
|
83
|
+
"label",
|
|
84
|
+
"removeLabel",
|
|
85
|
+
"removeLabelLong"
|
|
86
|
+
]);
|
|
87
|
+
const isStatic = !("href" in props || "type" in props || props.onClick);
|
|
88
|
+
process.env.NODE_ENV !== "production" && removable && isStatic && !onRemove && console.warn("static (non-button) `TagPill`s must not be removable");
|
|
89
|
+
const modifiers = [modifier, large && "large", colors[color]];
|
|
90
|
+
const removeBtn = removable && /* @__PURE__ */ import_react.default.createElement("button", {
|
|
91
|
+
className: "TagPill__remove",
|
|
92
|
+
onClick: onRemove && (() => onRemove()),
|
|
93
|
+
"aria-label": removeLabelLong,
|
|
94
|
+
type: "button"
|
|
95
|
+
}, removeLabel);
|
|
96
|
+
return isStatic ? /* @__PURE__ */ import_react.default.createElement("span", {
|
|
97
|
+
className: (0, import_getBemClass.default)("TagPill", modifiers)
|
|
98
|
+
}, label, " ", removeBtn) : onRemove ? /* @__PURE__ */ import_react.default.createElement("span", {
|
|
99
|
+
className: (0, import_getBemClass.default)("TagPill", modifiers)
|
|
100
|
+
}, /* @__PURE__ */ import_react.default.createElement(import_Button.default, __spreadValues({
|
|
101
|
+
bem: "TagPill__button"
|
|
102
|
+
}, buttonProps), label), " ", removeBtn) : /* @__PURE__ */ import_react.default.createElement(import_Button.default, __spreadProps(__spreadValues({
|
|
103
|
+
bem: "TagPill"
|
|
104
|
+
}, buttonProps), {
|
|
105
|
+
modifier: modifiers
|
|
106
|
+
}), label, " ", removable && /* @__PURE__ */ import_react.default.createElement("span", {
|
|
107
|
+
className: "TagPill__remove",
|
|
108
|
+
"aria-label": removeLabelLong
|
|
109
|
+
}, removeLabel));
|
|
110
|
+
};
|
|
111
|
+
var TagPill_default = TagPill;
|
|
112
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
113
|
+
0 && (module.exports = {});
|
package/lib/TagPill.mjs
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
import React from "react";
|
|
33
|
+
import getBemClass from "@hugsmidjan/react/utils/getBemClass";
|
|
34
|
+
import Button from "./_abstract/Button";
|
|
35
|
+
const colors = {
|
|
36
|
+
normal: "",
|
|
37
|
+
green: "color--green",
|
|
38
|
+
yellow: "color--yellow",
|
|
39
|
+
orange: "color--orange",
|
|
40
|
+
red: "color--red"
|
|
41
|
+
};
|
|
42
|
+
const TagPill = (props) => {
|
|
43
|
+
const _a = props, {
|
|
44
|
+
modifier,
|
|
45
|
+
large,
|
|
46
|
+
removable,
|
|
47
|
+
onRemove,
|
|
48
|
+
children,
|
|
49
|
+
color = "normal",
|
|
50
|
+
label = children,
|
|
51
|
+
removeLabel = "x",
|
|
52
|
+
removeLabelLong = removeLabel
|
|
53
|
+
} = _a, buttonProps = __objRest(_a, [
|
|
54
|
+
"modifier",
|
|
55
|
+
"large",
|
|
56
|
+
"removable",
|
|
57
|
+
"onRemove",
|
|
58
|
+
"children",
|
|
59
|
+
"color",
|
|
60
|
+
"label",
|
|
61
|
+
"removeLabel",
|
|
62
|
+
"removeLabelLong"
|
|
63
|
+
]);
|
|
64
|
+
const isStatic = !("href" in props || "type" in props || props.onClick);
|
|
65
|
+
process.env.NODE_ENV !== "production" && removable && isStatic && !onRemove && console.warn("static (non-button) `TagPill`s must not be removable");
|
|
66
|
+
const modifiers = [modifier, large && "large", colors[color]];
|
|
67
|
+
const removeBtn = removable && /* @__PURE__ */ React.createElement("button", {
|
|
68
|
+
className: "TagPill__remove",
|
|
69
|
+
onClick: onRemove && (() => onRemove()),
|
|
70
|
+
"aria-label": removeLabelLong,
|
|
71
|
+
type: "button"
|
|
72
|
+
}, removeLabel);
|
|
73
|
+
return isStatic ? /* @__PURE__ */ React.createElement("span", {
|
|
74
|
+
className: getBemClass("TagPill", modifiers)
|
|
75
|
+
}, label, " ", removeBtn) : onRemove ? /* @__PURE__ */ React.createElement("span", {
|
|
76
|
+
className: getBemClass("TagPill", modifiers)
|
|
77
|
+
}, /* @__PURE__ */ React.createElement(Button, __spreadValues({
|
|
78
|
+
bem: "TagPill__button"
|
|
79
|
+
}, buttonProps), label), " ", removeBtn) : /* @__PURE__ */ React.createElement(Button, __spreadProps(__spreadValues({
|
|
80
|
+
bem: "TagPill"
|
|
81
|
+
}, buttonProps), {
|
|
82
|
+
modifier: modifiers
|
|
83
|
+
}), label, " ", removable && /* @__PURE__ */ React.createElement("span", {
|
|
84
|
+
className: "TagPill__remove",
|
|
85
|
+
"aria-label": removeLabelLong
|
|
86
|
+
}, removeLabel));
|
|
87
|
+
};
|
|
88
|
+
var TagPill_default = TagPill;
|
|
89
|
+
export {
|
|
90
|
+
TagPill_default as default
|
|
91
|
+
};
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
var TextBlock_exports = {};
|
|
22
|
+
__export(TextBlock_exports, {
|
|
23
|
+
default: () => TextBlock_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(TextBlock_exports);
|
|
26
|
+
var import_react = __toESM(require("react"));
|
|
27
|
+
var import_getBemClass = __toESM(require("@hugsmidjan/react/utils/getBemClass"));
|
|
28
|
+
var import_seenEffect = require("./utils/seenEffect");
|
|
29
|
+
const TextBlock = (props) => {
|
|
30
|
+
const { children, align, labelled, wide, small, startSeen } = props;
|
|
31
|
+
const rightAligned = align === "right" || labelled;
|
|
32
|
+
const [ref] = (0, import_seenEffect.useSeenEffect)(startSeen);
|
|
33
|
+
return /* @__PURE__ */ import_react.default.createElement("div", {
|
|
34
|
+
className: (0, import_getBemClass.default)("TextBlock", [
|
|
35
|
+
labelled && "labelled",
|
|
36
|
+
rightAligned && "align--right",
|
|
37
|
+
wide && !rightAligned && "wide",
|
|
38
|
+
small && !labelled && "small"
|
|
39
|
+
]),
|
|
40
|
+
ref
|
|
41
|
+
}, children);
|
|
42
|
+
};
|
|
43
|
+
var TextBlock_default = TextBlock;
|
|
44
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
45
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import getBemClass from "@hugsmidjan/react/utils/getBemClass";
|
|
3
|
+
import { useSeenEffect } from "./utils/seenEffect";
|
|
4
|
+
const TextBlock = (props) => {
|
|
5
|
+
const { children, align, labelled, wide, small, startSeen } = props;
|
|
6
|
+
const rightAligned = align === "right" || labelled;
|
|
7
|
+
const [ref] = useSeenEffect(startSeen);
|
|
8
|
+
return /* @__PURE__ */ React.createElement("div", {
|
|
9
|
+
className: getBemClass("TextBlock", [
|
|
10
|
+
labelled && "labelled",
|
|
11
|
+
rightAligned && "align--right",
|
|
12
|
+
wide && !rightAligned && "wide",
|
|
13
|
+
small && !labelled && "small"
|
|
14
|
+
]),
|
|
15
|
+
ref
|
|
16
|
+
}, children);
|
|
17
|
+
};
|
|
18
|
+
var TextBlock_default = TextBlock;
|
|
19
|
+
export {
|
|
20
|
+
TextBlock_default as default
|
|
21
|
+
};
|