@reykjavik/hanna-react 0.10.93 → 0.10.95
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.d.ts +2 -3
- package/AccordionList.js +3 -3
- package/Alert.d.ts +2 -3
- package/Alert.js +2 -2
- package/ArticleCarousel/_ArticleCarouselCard.js +2 -2
- package/ArticleCarousel.d.ts +2 -3
- package/ArticleMeta.js +2 -2
- package/Attention.js +2 -2
- package/BasicTable.js +2 -2
- package/BgBox.js +2 -2
- package/Bling.js +2 -2
- package/ButtonBar.js +2 -2
- package/CHANGELOG.md +14 -1
- package/ContactBubble.d.ts +2 -3
- package/ContactBubble.js +2 -2
- package/Datepicker.js +2 -2
- package/ExtraLinks.js +3 -3
- package/FieldGroup.js +2 -2
- package/FileInput.js +3 -3
- package/FooterInfo.d.ts +2 -2
- package/FooterInfo.js +3 -3
- package/Form.js +2 -2
- package/FormField.d.ts +2 -3
- package/FormField.js +2 -2
- package/Gallery.d.ts +2 -3
- package/GridBlocks.js +2 -2
- package/Heading.js +2 -2
- package/IframeBlock.js +2 -2
- package/ImageCards.js +2 -2
- package/InfoHero.js +2 -2
- package/LabeledTextBlock.js +2 -2
- package/Layout.d.ts +3 -6
- package/Layout.js +7 -13
- package/MainMenu/_PrimaryPanel.js +2 -2
- package/MainMenu.d.ts +2 -3
- package/MainMenu.js +3 -3
- package/Multiselect.js +5 -5
- package/NameCard.js +2 -2
- package/NewsHero.js +2 -2
- package/PageFilter.js +2 -2
- package/PageHeading.js +2 -2
- package/Picture.js +2 -2
- package/ProcessOverview.js +2 -2
- package/ReadSpeakerPlayer.js +2 -2
- package/RowBlock.d.ts +2 -2
- package/RowBlock.js +2 -2
- package/RowBlockColumn.js +2 -2
- package/SearchInput.js +2 -2
- package/SearchResults.js +2 -2
- package/Selectbox.js +2 -2
- package/ShareButtons.d.ts +2 -3
- package/Sharpie.js +2 -2
- package/SiteSearchAutocomplete.d.ts +1 -1
- package/SiteSearchCurtain.js +2 -2
- package/SiteSearchInput.d.ts +2 -3
- package/Skeleton.js +2 -2
- package/SubHeading.js +2 -2
- package/Tabs.d.ts +2 -3
- package/Tabs.js +2 -2
- package/TagPill.js +3 -3
- package/TextBlock.js +2 -2
- package/TextInput.js +2 -2
- package/Tooltip.js +2 -2
- package/VSpacer.js +2 -2
- package/WizardLayout.d.ts +2 -3
- package/WizardLayout.js +2 -2
- package/WizardStepper.js +3 -3
- package/_abstract/_AbstractCarousel.d.ts +3 -4
- package/_abstract/_AbstractCarousel.js +2 -2
- package/_abstract/_Block.d.ts +2 -2
- package/_abstract/_Block.js +2 -2
- package/_abstract/_Button.d.ts +3 -3
- package/_abstract/_Button.js +2 -2
- package/_abstract/_Image.js +3 -3
- package/_abstract/_TogglerGroup.js +2 -2
- package/_abstract/_TogglerGroupField.d.ts +2 -2
- package/_abstract/_TogglerGroupField.js +2 -2
- package/_abstract/_TogglerInput.d.ts +2 -2
- package/_abstract/_TogglerInput.js +2 -2
- package/_mixed_export_resolution_/ReactDropzone.d.ts +3 -3
- package/_mixed_export_resolution_/ReactDropzone.js +3 -3
- package/esm/AccordionList.d.ts +2 -3
- package/esm/AccordionList.js +3 -3
- package/esm/Alert.d.ts +2 -3
- package/esm/Alert.js +2 -2
- package/esm/ArticleCarousel/_ArticleCarouselCard.js +2 -2
- package/esm/ArticleCarousel.d.ts +2 -3
- package/esm/ArticleMeta.js +2 -2
- package/esm/Attention.js +2 -2
- package/esm/BasicTable.js +2 -2
- package/esm/BgBox.js +2 -2
- package/esm/Bling.js +2 -2
- package/esm/ButtonBar.js +2 -2
- package/esm/ContactBubble.d.ts +2 -3
- package/esm/ContactBubble.js +2 -2
- package/esm/Datepicker.js +2 -2
- package/esm/ExtraLinks.js +3 -3
- package/esm/FieldGroup.js +2 -2
- package/esm/FileInput.js +3 -3
- package/esm/FooterInfo.d.ts +2 -2
- package/esm/FooterInfo.js +3 -3
- package/esm/Form.js +2 -2
- package/esm/FormField.d.ts +2 -3
- package/esm/FormField.js +2 -2
- package/esm/Gallery.d.ts +2 -3
- package/esm/GridBlocks.js +2 -2
- package/esm/Heading.js +2 -2
- package/esm/IframeBlock.js +2 -2
- package/esm/ImageCards.js +2 -2
- package/esm/InfoHero.js +2 -2
- package/esm/LabeledTextBlock.js +2 -2
- package/esm/Layout.d.ts +3 -6
- package/esm/Layout.js +7 -13
- package/esm/MainMenu/_PrimaryPanel.js +2 -2
- package/esm/MainMenu.d.ts +2 -3
- package/esm/MainMenu.js +3 -3
- package/esm/Multiselect.js +5 -5
- package/esm/NameCard.js +2 -2
- package/esm/NewsHero.js +2 -2
- package/esm/PageFilter.js +2 -2
- package/esm/PageHeading.js +2 -2
- package/esm/Picture.js +2 -2
- package/esm/ProcessOverview.js +2 -2
- package/esm/ReadSpeakerPlayer.js +2 -2
- package/esm/RowBlock.d.ts +2 -2
- package/esm/RowBlock.js +2 -2
- package/esm/RowBlockColumn.js +2 -2
- package/esm/SearchInput.js +2 -2
- package/esm/SearchResults.js +2 -2
- package/esm/Selectbox.js +2 -2
- package/esm/ShareButtons.d.ts +2 -3
- package/esm/Sharpie.js +2 -2
- package/esm/SiteSearchAutocomplete.d.ts +1 -1
- package/esm/SiteSearchCurtain.js +2 -2
- package/esm/SiteSearchInput.d.ts +2 -3
- package/esm/Skeleton.js +2 -2
- package/esm/SubHeading.js +2 -2
- package/esm/Tabs.d.ts +2 -3
- package/esm/Tabs.js +2 -2
- package/esm/TagPill.js +3 -3
- package/esm/TextBlock.js +2 -2
- package/esm/TextInput.js +2 -2
- package/esm/Tooltip.js +2 -2
- package/esm/VSpacer.js +2 -2
- package/esm/WizardLayout.d.ts +2 -3
- package/esm/WizardLayout.js +2 -2
- package/esm/WizardStepper.js +3 -3
- package/esm/_abstract/_AbstractCarousel.d.ts +3 -4
- package/esm/_abstract/_AbstractCarousel.js +2 -2
- package/esm/_abstract/_Block.d.ts +2 -2
- package/esm/_abstract/_Block.js +2 -2
- package/esm/_abstract/_Button.d.ts +3 -3
- package/esm/_abstract/_Button.js +2 -2
- package/esm/_abstract/_Image.js +3 -3
- package/esm/_abstract/_TogglerGroup.js +2 -2
- package/esm/_abstract/_TogglerGroupField.d.ts +2 -2
- package/esm/_abstract/_TogglerGroupField.js +2 -2
- package/esm/_abstract/_TogglerInput.d.ts +2 -2
- package/esm/_abstract/_TogglerInput.js +2 -2
- package/esm/_mixed_export_resolution_/ReactDropzone.d.ts +3 -3
- package/esm/_mixed_export_resolution_/ReactDropzone.js +3 -3
- package/esm/utils/HannaUIState.d.ts +3 -4
- package/esm/utils/config.d.ts +11 -1
- package/esm/utils/config.js +1 -0
- package/esm/utils/types.d.ts +12 -0
- package/esm/utils/types.js +1 -0
- package/esm/utils/useGetSVGtext.d.ts +1 -1
- package/esm/utils/useGetSVGtext.js +2 -2
- package/esm/utils/useMenuToggling.d.ts +2 -0
- package/esm/utils/useMenuToggling.js +31 -21
- package/esm/utils.d.ts +2 -1
- package/esm/utils.js +2 -1
- package/package.json +5 -4
- package/utils/HannaUIState.d.ts +3 -4
- package/utils/config.d.ts +11 -1
- package/utils/config.js +1 -0
- package/utils/types.d.ts +12 -0
- package/utils/types.js +2 -0
- package/utils/useGetSVGtext.d.ts +1 -1
- package/utils/useGetSVGtext.js +2 -2
- package/utils/useMenuToggling.d.ts +2 -0
- package/utils/useMenuToggling.js +31 -21
- package/utils.d.ts +2 -1
- package/utils.js +5 -1
package/esm/RowBlock.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
3
2
|
import { SeenProp } from './utils/seenEffect.js';
|
|
3
|
+
import { BemModifierProps } from './utils/types.js';
|
|
4
4
|
export type RowBlockProps = {
|
|
5
5
|
/** Float the first RowBlockColumn to the right on larger screens. */
|
|
6
6
|
right?: boolean;
|
|
7
7
|
/** Custom **additional** class-name */
|
|
8
8
|
className?: string;
|
|
9
9
|
children: ReactNode;
|
|
10
|
-
} &
|
|
10
|
+
} & BemModifierProps & SeenProp;
|
|
11
11
|
export declare const RowBlock: (props: RowBlockProps) => JSX.Element;
|
|
12
12
|
export default RowBlock;
|
package/esm/RowBlock.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
import { useSeenEffect } from './utils/seenEffect.js';
|
|
4
4
|
export const RowBlock = (props) => {
|
|
5
5
|
const { right, modifier, className, children, startSeen } = props;
|
|
6
6
|
const [ref] = useSeenEffect(startSeen);
|
|
7
|
-
return (React.createElement("div", { className:
|
|
7
|
+
return (React.createElement("div", { className: modifiedClass('RowBlock', [modifier, right && 'align--right'], className), ref: ref }, children));
|
|
8
8
|
};
|
|
9
9
|
export default RowBlock;
|
package/esm/RowBlockColumn.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
export const RowBlockColumn = (props) => {
|
|
4
4
|
const { background, narrow, children } = props;
|
|
5
|
-
return (React.createElement("div", { className:
|
|
5
|
+
return (React.createElement("div", { className: modifiedClass('RowBlockColumn', [
|
|
6
6
|
narrow && 'narrow',
|
|
7
7
|
background && 'background',
|
|
8
8
|
background === 'primary' && 'background--primary',
|
package/esm/SearchInput.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
4
4
|
import FormField from './FormField.js';
|
|
5
5
|
export const SearchInput = (props) => {
|
|
6
6
|
var _a;
|
|
@@ -15,7 +15,7 @@ export const SearchInput = (props) => {
|
|
|
15
15
|
setHasValue(!!e.target.value);
|
|
16
16
|
onChange && onChange(e);
|
|
17
17
|
};
|
|
18
|
-
return (React.createElement(FormField, { className:
|
|
18
|
+
return (React.createElement(FormField, { className: modifiedClass('SearchInput', [], className), ssr: ssr, small: small, label: label, empty: empty, filled: filled, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps, addFocusProps) => (React.createElement("div", Object.assign({ className: className.input }, addFocusProps()),
|
|
19
19
|
React.createElement("input", Object.assign({ className: "SearchInput__input", onChange: _onChange }, inputProps, inputElementProps, { ref: props.inputRef })),
|
|
20
20
|
' ',
|
|
21
21
|
onButtonClick && (React.createElement("button", { className: "SearchInput__button", type: "button", onClick: onButtonClick, title: buttonText, ref: props.buttonRef, disabled: disabled || readOnly }, buttonText)))) }));
|
package/esm/SearchResults.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useRef } from 'react';
|
|
2
2
|
import { useInView } from 'react-intersection-observer';
|
|
3
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
4
|
import { prettyNum } from '@hugsmidjan/qj/prettyNum';
|
|
4
5
|
import range from '@hugsmidjan/qj/range';
|
|
5
6
|
import { useDomid } from '@hugsmidjan/react/hooks';
|
|
6
|
-
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
7
7
|
import { getTexts } from '@reykjavik/hanna-utils/i18n';
|
|
8
8
|
import { SearchResultsItem, } from './SearchResults/_SearchResultsItem.js';
|
|
9
9
|
import Alert from './Alert.js';
|
|
@@ -97,7 +97,7 @@ export const SearchResults = (props) => {
|
|
|
97
97
|
const { filters, activeFilterIdx, setFilter, status, errorText } = props;
|
|
98
98
|
const texts = getTexts(props, defaultTexts);
|
|
99
99
|
const domid = useDomid();
|
|
100
|
-
return (React.createElement("div", { className:
|
|
100
|
+
return (React.createElement("div", { className: modifiedClass('SearchResults', status !== 'results' && status) },
|
|
101
101
|
renderTitle(props, texts),
|
|
102
102
|
React.createElement(SearchResults_Tabs, { domid: domid, filters: filters, activeIdx: activeFilterIdx, setFilter: setFilter, lang: texts.lang }),
|
|
103
103
|
React.createElement("div", { className: "SearchResults__results", id: domid },
|
package/esm/Selectbox.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
4
|
import _Selectbox from '@hugsmidjan/react/Selectbox';
|
|
4
|
-
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
5
5
|
import FormField from './FormField.js';
|
|
6
6
|
const getValue = (opt) => {
|
|
7
7
|
const val = typeof opt === 'object' ? opt.value : opt;
|
|
@@ -32,7 +32,7 @@ export const Selectbox = (props) => {
|
|
|
32
32
|
setIsEmpty(!((_a = selectElm.selectedOptions[0]) === null || _a === void 0 ? void 0 : _a.text));
|
|
33
33
|
onChange && onChange(e);
|
|
34
34
|
};
|
|
35
|
-
return (React.createElement(FormField, { className:
|
|
35
|
+
return (React.createElement(FormField, { className: modifiedClass('Selectbox', null, className), ssr: ssr, small: small, label: label, empty: isEmpty, filled: isFilled, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps, addFocusProps) => (React.createElement(_Selectbox, Object.assign({ bem: className.input, ssr: ssr, onChange: _onChange }, inputProps, addFocusProps(selectProps), { selectRef: selectRef }))) }));
|
|
36
36
|
};
|
|
37
37
|
// /** @deprecated Use named export instead (The default export will be removed in v0.11+) */
|
|
38
38
|
// const SelectboxDefault = Selectbox;
|
package/esm/ShareButtons.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { ShareButtonI18n, ShareButtonPlatforms } from '@reykjavik/hanna-utils/shareButtonsUtils';
|
|
2
|
-
import {
|
|
2
|
+
import { SSRSupportProps } from './utils.js';
|
|
3
3
|
export type ShareButtonsProps = {
|
|
4
|
-
ssr?: SSRSupport;
|
|
5
4
|
texts?: Readonly<ShareButtonI18n>;
|
|
6
5
|
lang?: string;
|
|
7
|
-
} & Partial<Record<ShareButtonPlatforms, boolean>>;
|
|
6
|
+
} & SSRSupportProps & Partial<Record<ShareButtonPlatforms, boolean>>;
|
|
8
7
|
export declare const ShareButtons: (props: ShareButtonsProps) => JSX.Element | null;
|
|
9
8
|
export default ShareButtons;
|
package/esm/Sharpie.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
const colors = {
|
|
4
4
|
green: 1,
|
|
5
5
|
red: 1,
|
|
@@ -17,6 +17,6 @@ export const Sharpie = (props) => {
|
|
|
17
17
|
const { color, tag, children } = props;
|
|
18
18
|
const colorModifier = colors[color] ? color : 'green';
|
|
19
19
|
const Tag = tag && tags[tag] ? tag : 'span';
|
|
20
|
-
return React.createElement(Tag, { className:
|
|
20
|
+
return React.createElement(Tag, { className: modifiedClass('Sharpie', colorModifier) }, children);
|
|
21
21
|
};
|
|
22
22
|
export default Sharpie;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import Autosuggest, { RenderSuggestion } from 'react-autosuggest';
|
|
3
|
-
import { BemProps } from '@hugsmidjan/react/types';
|
|
4
3
|
import { DefaultTexts } from '@reykjavik/hanna-utils/i18n';
|
|
4
|
+
import { BemProps } from './utils/types.js';
|
|
5
5
|
export type SiteSearchACI18n = {
|
|
6
6
|
lang?: string;
|
|
7
7
|
/** Label for the autocomplete's combobox container div */
|
package/esm/SiteSearchCurtain.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
2
3
|
import { useLaggedState } from '@hugsmidjan/react/hooks';
|
|
3
|
-
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
4
4
|
import { isPreact } from './utils/env.js';
|
|
5
5
|
export const SiteSearchCurtain = (props) => {
|
|
6
6
|
const [focused, setFocused] = useLaggedState(false);
|
|
@@ -23,6 +23,6 @@ export const SiteSearchCurtain = (props) => {
|
|
|
23
23
|
setFocused(false, 100);
|
|
24
24
|
}
|
|
25
25
|
};
|
|
26
|
-
return (React.createElement("div", Object.assign({ className:
|
|
26
|
+
return (React.createElement("div", Object.assign({ className: modifiedClass('SiteSearchCurtain', [focused && 'focused']), onFocus: focusHandler, onBlur: blurHandler }, (isPreact && { onfocusin: focusHandler, onfocusout: blurHandler })), props.children));
|
|
27
27
|
};
|
|
28
28
|
export default SiteSearchCurtain;
|
package/esm/SiteSearchInput.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { FormFieldWrappingProps } from './FormField.js';
|
|
3
|
-
import {
|
|
3
|
+
import { SSRSupportProps } from './utils.js';
|
|
4
4
|
type InputElmProps = Omit<JSX.IntrinsicElements['input'], 'className' | 'type' | 'disabled' | 'readOnly' | 'required' | 'onSubmit'>;
|
|
5
5
|
type WrappingProps = Pick<FormFieldWrappingProps, 'id' | 'label'>;
|
|
6
6
|
export type SiteSearchInputProps = {
|
|
@@ -18,7 +18,6 @@ export type SiteSearchInputProps = {
|
|
|
18
18
|
onButtonClick?: () => boolean | void;
|
|
19
19
|
buttonText?: string;
|
|
20
20
|
children?: never;
|
|
21
|
-
|
|
22
|
-
} & WrappingProps & InputElmProps;
|
|
21
|
+
} & SSRSupportProps & WrappingProps & InputElmProps;
|
|
23
22
|
export declare const SiteSearchInput: React.ForwardRefExoticComponent<Pick<SiteSearchInputProps, "form" | "label" | "slot" | "style" | "title" | "key" | "list" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "step" | "value" | "pattern" | "name" | "autoFocus" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "size" | "src" | "multiple" | "alt" | "ssr" | "accept" | "autoComplete" | "capture" | "checked" | "crossOrigin" | "enterKeyHint" | "height" | "max" | "maxLength" | "min" | "minLength" | "width" | "onButtonClick" | "buttonText"> & React.RefAttributes<HTMLInputElement>>;
|
|
24
23
|
export default SiteSearchInput;
|
package/esm/Skeleton.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
2
3
|
import range from '@hugsmidjan/qj/range';
|
|
3
|
-
|
|
4
|
-
const makeRenderSkeleton = (props) => (key) => (React.createElement("span", { key: key, className: getBemClass('Skeleton', [
|
|
4
|
+
const makeRenderSkeleton = (props) => (key) => (React.createElement("span", { key: key, className: modifiedClass('Skeleton', [
|
|
5
5
|
props.text && 'text',
|
|
6
6
|
props.height && 'height--' + props.height,
|
|
7
7
|
props.gap && 'gap--' + props.gap,
|
package/esm/SubHeading.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
import { useSeenEffect } from './utils/seenEffect.js';
|
|
4
4
|
export const SubHeading = (props) => {
|
|
5
5
|
const { small, Tag = 'h2', children, align, wide, startSeen } = props;
|
|
6
6
|
const [ref] = useSeenEffect(startSeen);
|
|
7
|
-
return (React.createElement(Tag, { className:
|
|
7
|
+
return (React.createElement(Tag, { className: modifiedClass('SubHeading', [
|
|
8
8
|
small && 'small',
|
|
9
9
|
align === 'right' && 'align--' + align,
|
|
10
10
|
!align && wide && 'wide',
|
package/esm/Tabs.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SeenProp } from './utils/seenEffect.js';
|
|
2
|
-
import {
|
|
2
|
+
import { SSRSupportProps } from './utils.js';
|
|
3
3
|
export type TabItemProps = {
|
|
4
4
|
label: string;
|
|
5
5
|
badge?: string | number;
|
|
@@ -22,8 +22,7 @@ type BaseTabsProps<T extends TabItemProps = TabItemProps> = {
|
|
|
22
22
|
role?: 'tablist' | 'toc';
|
|
23
23
|
'aria-controls'?: string;
|
|
24
24
|
activateOnFocus?: boolean;
|
|
25
|
-
|
|
26
|
-
};
|
|
25
|
+
} & SSRSupportProps;
|
|
27
26
|
export type TabsProps<T extends TabItemProps = TabItemProps> = BaseTabsProps<T> & {
|
|
28
27
|
vertical?: boolean;
|
|
29
28
|
/** Optional <Tabs/> block connected to the currently active tab */
|
package/esm/Tabs.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useState } from 'react';
|
|
2
2
|
import { getFrag } from '@hugsmidjan/qj/frag';
|
|
3
|
-
import
|
|
3
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
4
4
|
import { useSeenEffect } from './utils/seenEffect.js';
|
|
5
5
|
import { useIsBrowserSide } from './utils.js';
|
|
6
6
|
const navKeyEffects = {
|
|
@@ -85,7 +85,7 @@ export const Tabs = (props) => {
|
|
|
85
85
|
listAriaControls,
|
|
86
86
|
isBrowser,
|
|
87
87
|
};
|
|
88
|
-
return (React.createElement("div", { className:
|
|
88
|
+
return (React.createElement("div", { className: modifiedClass('Tabs', vertical && 'vertical'), role: tabRole && role, id: id, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, onKeyDown: handleKeydown, "data-sprinkled": isBrowser, ref: ref },
|
|
89
89
|
tabs.map((tabProps, index) => renderTab(tabProps, index, listProps)),
|
|
90
90
|
subTabs && (React.createElement(Tabs, Object.assign({}, subTabs, { role: 'role' in subTabs ? subTabs.role : role, activateOnFocus: (_a = subTabs.activateOnFocus) !== null && _a !== void 0 ? _a : activateOnFocus, ssr: (_b = subTabs.ssr) !== null && _b !== void 0 ? _b : ssr, startSeen: true,
|
|
91
91
|
// just to be sure
|
package/esm/TagPill.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
4
4
|
import { Button } from './_abstract/_Button.js';
|
|
5
5
|
const colors = {
|
|
6
6
|
normal: '',
|
|
@@ -20,10 +20,10 @@ export const TagPill = (props) => {
|
|
|
20
20
|
'must have an `onRemove` handler defined');
|
|
21
21
|
const modifiers = [modifier, large && 'large', colors[color]];
|
|
22
22
|
const removeBtn = removable && (React.createElement("button", { className: "TagPill__remove", onClick: onRemove && (() => onRemove()), "aria-label": removeLabelLong, type: "button" }, removeLabel));
|
|
23
|
-
return isStatic ? (React.createElement("span", Object.assign({ className:
|
|
23
|
+
return isStatic ? (React.createElement("span", Object.assign({ className: modifiedClass('TagPill', modifiers) }, buttonProps),
|
|
24
24
|
label,
|
|
25
25
|
" ",
|
|
26
|
-
removeBtn)) : onRemove ? (React.createElement("span", { className:
|
|
26
|
+
removeBtn)) : onRemove ? (React.createElement("span", { className: modifiedClass('TagPill', modifiers) },
|
|
27
27
|
React.createElement(Button, Object.assign({ bem: "TagPill__button" }, buttonProps), label),
|
|
28
28
|
' ',
|
|
29
29
|
removeBtn)) : (React.createElement(Button, Object.assign({ bem: "TagPill" }, buttonProps, { modifier: modifiers }),
|
package/esm/TextBlock.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
import { useSeenEffect } from './utils/seenEffect.js';
|
|
4
4
|
export const TextBlock = (props) => {
|
|
5
5
|
const { children, align, labelled, wide, small, startSeen } = props;
|
|
6
6
|
const rightAligned = align === 'right' || labelled;
|
|
7
7
|
const [ref] = useSeenEffect(startSeen);
|
|
8
|
-
return (React.createElement("div", { className:
|
|
8
|
+
return (React.createElement("div", { className: modifiedClass('TextBlock', [
|
|
9
9
|
labelled && 'labelled',
|
|
10
10
|
rightAligned && 'align--right',
|
|
11
11
|
wide && !rightAligned && 'wide',
|
package/esm/TextInput.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
4
4
|
import FormField from './FormField.js';
|
|
5
5
|
export const TextInput = (props) => {
|
|
6
6
|
var _a;
|
|
@@ -27,6 +27,6 @@ export const TextInput = (props) => {
|
|
|
27
27
|
setHasValue(true);
|
|
28
28
|
}
|
|
29
29
|
}, []);
|
|
30
|
-
return (React.createElement(FormField, { className:
|
|
30
|
+
return (React.createElement(FormField, { className: modifiedClass('TextInput', modifiers, className), ssr: ssr, small: small, label: label, empty: empty, filled: filled, assistText: assistText, hideLabel: hideLabel, disabled: disabled, readOnly: readOnly, invalid: invalid, errorMessage: errorMessage, required: required, reqText: reqText, id: id, renderInput: (className, inputProps, addFocusProps) => multiline ? (React.createElement("textarea", Object.assign({ className: className.input, onChange: _onChange }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) : (React.createElement("input", Object.assign({ className: className.input, onChange: _onChange, type: type }, inputProps, addFocusProps(inputElementProps), { ref: inputRef }))) }));
|
|
31
31
|
};
|
|
32
32
|
export default TextInput;
|
package/esm/Tooltip.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useRef } from 'react';
|
|
2
2
|
import { arrow as arrowPlugin, autoUpdate, flip, offset, shift, useFloating, } from '@floating-ui/react';
|
|
3
3
|
import { useCallbackOnEsc, useLaggedState } from '@hugsmidjan/react/hooks';
|
|
4
|
-
import
|
|
4
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
5
5
|
const getSide = (placement) => placement.split('-')[0];
|
|
6
6
|
export const Tooltip = (props) => {
|
|
7
7
|
const { text, label, iconOnly } = props;
|
|
@@ -50,7 +50,7 @@ export const Tooltip = (props) => {
|
|
|
50
50
|
'--tooltip-arrow-pos-x': `${arrowX}px`,
|
|
51
51
|
'--tooltip-arrow-pos-y': `${arrowY}px`,
|
|
52
52
|
} },
|
|
53
|
-
React.createElement("summary", { className:
|
|
53
|
+
React.createElement("summary", { className: modifiedClass('Tooltip__trigger', iconOnly && 'icononly'), ref: reference }, label),
|
|
54
54
|
React.createElement("div", { className: "Tooltip__content", onClick: (e) => e.stopPropagation(), ref: floating },
|
|
55
55
|
x !== null && (React.createElement("div", { "data-floating-ui-hack-plz-ignore": "", style: { position: 'absolute', display: 'none' }, ref: arrowRef })),
|
|
56
56
|
text)));
|
package/esm/VSpacer.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
const sizes = {
|
|
4
4
|
none: 'none',
|
|
5
5
|
small: 'small',
|
|
@@ -31,7 +31,7 @@ export const VSpacer = (props) => {
|
|
|
31
31
|
bottomVal = undefined;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
const className =
|
|
34
|
+
const className = modifiedClass('VSpacer', [
|
|
35
35
|
sizeVal,
|
|
36
36
|
topVal && 'top--' + topVal,
|
|
37
37
|
bottomVal && 'bottom--' + bottomVal,
|
package/esm/WizardLayout.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import type { HannaColorTheme } from '@reykjavik/hanna-css';
|
|
3
|
-
import {
|
|
3
|
+
import { SSRSupportProps } from './utils.js';
|
|
4
4
|
type WizardLayoutProps = {
|
|
5
5
|
wizardStepper?: ReactNode | false;
|
|
6
6
|
wizardFooter?: ReactNode | false;
|
|
@@ -8,8 +8,7 @@ type WizardLayoutProps = {
|
|
|
8
8
|
siteName?: string;
|
|
9
9
|
logoLink?: string;
|
|
10
10
|
globalAlerts?: ReactNode;
|
|
11
|
-
ssr?: SSRSupport;
|
|
12
11
|
children?: ReactNode;
|
|
13
|
-
};
|
|
12
|
+
} & SSRSupportProps;
|
|
14
13
|
export declare const WizardLayout: (props: WizardLayoutProps) => JSX.Element;
|
|
15
14
|
export default WizardLayout;
|
package/esm/WizardLayout.js
CHANGED
|
@@ -8,7 +8,7 @@ export const WizardLayout = (props) => {
|
|
|
8
8
|
useScrollbarWidthCSSVar();
|
|
9
9
|
const {
|
|
10
10
|
// ssr,
|
|
11
|
-
wizardStepper, wizardFooter, children, colorTheme, logoLink = '/', siteName = '
|
|
11
|
+
wizardStepper, wizardFooter, children, colorTheme, logoLink = '/', siteName = '', globalAlerts, } = props;
|
|
12
12
|
const isBrowser = useIsBrowserSide( /* ssr */);
|
|
13
13
|
return (React.createElement("div", { className: "WizardLayout", "data-sprinkled": isBrowser, "data-color-theme": colorTheme },
|
|
14
14
|
globalAlerts && (React.createElement("div", { className: "WizardLayout__alerts", role: "alert" }, globalAlerts)),
|
|
@@ -16,7 +16,7 @@ export const WizardLayout = (props) => {
|
|
|
16
16
|
React.createElement("div", { className: "WizardLayout__header", role: "banner" },
|
|
17
17
|
React.createElement(Link, { className: "WizardLayout__header__logo", href: logoLink },
|
|
18
18
|
' ',
|
|
19
|
-
React.createElement(Image, { className: undefined, inline: true, src: getAssetUrl('reykjavik-logo.svg') }),
|
|
19
|
+
React.createElement(Image, { className: undefined, inline: true, src: getAssetUrl('reykjavik-logo.svg'), altText: "Reykjav\u00EDk" }),
|
|
20
20
|
' ',
|
|
21
21
|
siteName,
|
|
22
22
|
' '),
|
package/esm/WizardStepper.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
export const WizardStepper = (props) => {
|
|
4
4
|
const { steps, activeStep = -1, allowForwardSkip, disableBacktrack, onClick } = props;
|
|
5
|
-
return (React.createElement("div", { className:
|
|
5
|
+
return (React.createElement("div", { className: modifiedClass('WizardStepper', activeStep === -1 && 'preview') }, steps.map((step, i) => {
|
|
6
6
|
const { clickable, done, neutral } = step;
|
|
7
7
|
const label = step.label || '…';
|
|
8
|
-
const stepClass =
|
|
8
|
+
const stepClass = modifiedClass('WizardStepper__step', [
|
|
9
9
|
(done || (done == null && i < activeStep)) && 'done',
|
|
10
10
|
neutral && 'neutral',
|
|
11
11
|
]);
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
|
-
import { BemProps } from '@hugsmidjan/react/types';
|
|
3
2
|
import { EitherObj } from '@reykjavik/hanna-utils';
|
|
4
|
-
import {
|
|
3
|
+
import { SSRSupportProps } from '../utils.js';
|
|
5
4
|
import { SeenProp } from '../utils/seenEffect.js';
|
|
5
|
+
import { BemProps } from '../utils/types.js';
|
|
6
6
|
export type CarouselProps<I extends Record<string, unknown> = {}, P extends Record<string, unknown> | undefined = {}> = {
|
|
7
7
|
className?: string;
|
|
8
|
-
ssr?: SSRSupport;
|
|
9
8
|
/** @deprecated Ingored because never used (Will be removed in v0.11) */
|
|
10
9
|
scrollRight?: boolean;
|
|
11
|
-
} & EitherObj<{
|
|
10
|
+
} & SSRSupportProps & EitherObj<{
|
|
12
11
|
items: Array<I>;
|
|
13
12
|
Component: (props: P extends undefined ? I : I & P) => ReactElement | null;
|
|
14
13
|
ComponentProps?: P;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React, { useEffect, useMemo, useRef, useState, } from 'react';
|
|
2
2
|
import A from '@hugsmidjan/qj/A';
|
|
3
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
4
|
import debounce from '@hugsmidjan/qj/debounce';
|
|
4
5
|
import { focusElm } from '@hugsmidjan/qj/focusElm';
|
|
5
6
|
import throttle from '@hugsmidjan/qj/throttle';
|
|
6
|
-
import getBemClass from '@hugsmidjan/react/utils/getBemClass';
|
|
7
7
|
import { notNully } from '@reykjavik/hanna-utils';
|
|
8
8
|
import CarouselStepper from '../CarouselStepper.js';
|
|
9
9
|
import { useIsBrowserSide } from '../utils.js';
|
|
@@ -92,7 +92,7 @@ export const AbstractCarousel = (props) => {
|
|
|
92
92
|
items.map((item, i) => (
|
|
93
93
|
// @ts-expect-error (Can't be arsed...)
|
|
94
94
|
React.createElement(Component, Object.assign({ key: i }, ComponentProps, item))))));
|
|
95
|
-
return (React.createElement("div", { className:
|
|
95
|
+
return (React.createElement("div", { className: modifiedClass(bem, modifier, props.className), ref: outerRef, "data-sprinkled": isBrowser },
|
|
96
96
|
title && React.createElement("h2", { className: bem + '__title' }, title),
|
|
97
97
|
isBrowser ? (React.createElement("div", { className: bem + '__itemlist-wrapper' },
|
|
98
98
|
itemList,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
2
1
|
import { SeenProp } from '../utils/seenEffect.js';
|
|
2
|
+
import { BemModifierProps } from '../utils/types.js';
|
|
3
3
|
import { ButtonProps } from './_Button.js';
|
|
4
4
|
import { ImageProps } from './_Image.js';
|
|
5
5
|
export type BlockItem = {
|
|
@@ -15,7 +15,7 @@ export type ContentBlock = {
|
|
|
15
15
|
content: Array<BlockItem>;
|
|
16
16
|
image?: undefined;
|
|
17
17
|
} & SeenProp;
|
|
18
|
-
export type BlockProps =
|
|
18
|
+
export type BlockProps = BemModifierProps & (ContentBlock | ContentImageBlock);
|
|
19
19
|
export declare const Block: (props: BlockProps & {
|
|
20
20
|
bem: string;
|
|
21
21
|
}) => JSX.Element;
|
package/esm/_abstract/_Block.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
import { useSeenEffect } from '../utils/seenEffect.js';
|
|
4
4
|
import { Button } from './_Button.js';
|
|
5
5
|
import { Image } from './_Image.js';
|
|
@@ -7,7 +7,7 @@ export const Block = (props) => {
|
|
|
7
7
|
const { image, modifier, bem, content, startSeen } = props;
|
|
8
8
|
const [ref] = useSeenEffect(startSeen);
|
|
9
9
|
const contentItems = Array.isArray(content) ? content : [content];
|
|
10
|
-
return (React.createElement("div", { className:
|
|
10
|
+
return (React.createElement("div", { className: modifiedClass(bem, modifier), ref: ref },
|
|
11
11
|
contentItems.map(({ title, summary, buttons = [] }, i) => {
|
|
12
12
|
const hasSummary = summary && (typeof summary !== 'string' || !!summary.trim());
|
|
13
13
|
return (React.createElement("div", { key: i, className: `${bem}__content` },
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { BemModifierProps, BemProps } from '../utils/types.js';
|
|
3
3
|
type ButtonElmProps = {
|
|
4
4
|
href?: never;
|
|
5
|
-
} &
|
|
5
|
+
} & BemModifierProps & Omit<JSX.IntrinsicElements['button'], 'className' | 'style'>;
|
|
6
6
|
type AnchorElmProps = {
|
|
7
7
|
href: string;
|
|
8
8
|
type?: never;
|
|
9
9
|
name?: never;
|
|
10
10
|
value?: never;
|
|
11
|
-
} &
|
|
11
|
+
} & BemModifierProps & Omit<JSX.IntrinsicElements['a'], 'className' | 'style'>;
|
|
12
12
|
export type ButtonProps = {
|
|
13
13
|
/** Label takes preference over `children` */
|
|
14
14
|
label?: string | JSX.Element;
|
package/esm/_abstract/_Button.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
4
4
|
import { Link } from './_Link.js';
|
|
5
5
|
// ---------------------------------------------------------------------------
|
|
6
6
|
const sizes = {
|
|
@@ -25,7 +25,7 @@ const icons = {
|
|
|
25
25
|
export const Button = (props) => {
|
|
26
26
|
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"]);
|
|
27
27
|
const className = bem &&
|
|
28
|
-
|
|
28
|
+
modifiedClass(bem, [modifier, variants[variant], sizes[size], navigationFlags[icon]]);
|
|
29
29
|
const iconProp = icons[icon] && { 'data-icon': icons[icon] };
|
|
30
30
|
if (buttonProps.href != null) {
|
|
31
31
|
return (React.createElement(Link, Object.assign({ className: className }, buttonProps, { style: undefined }, iconProp), label));
|
package/esm/_abstract/_Image.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
3
3
|
import { useGetSVGtext } from '../utils/useGetSVGtext.js';
|
|
4
4
|
// eslint-disable-next-line complexity
|
|
5
5
|
export const Image = (props) => {
|
|
@@ -7,9 +7,9 @@ export const Image = (props) => {
|
|
|
7
7
|
const _src = (sources.length && preloadSrc) || src;
|
|
8
8
|
const imageSrc = _src || (sources[0] != null ? sources[0].srcset.split(' ')[0] : undefined);
|
|
9
9
|
const imgLoading = preloadSrc ? 'eager' : 'lazy';
|
|
10
|
-
const inlineSvg = useGetSVGtext(inline ? imageSrc : undefined);
|
|
10
|
+
const inlineSvg = useGetSVGtext(inline ? imageSrc : undefined, altText);
|
|
11
11
|
if (!imageSrc) {
|
|
12
|
-
return placeholder ? (React.createElement("span", { className: className &&
|
|
12
|
+
return placeholder ? (React.createElement("span", { className: className && modifiedClass(className, 'missing') }, placeholder !== true && placeholder())) : null;
|
|
13
13
|
}
|
|
14
14
|
if (inline && inlineSvg) {
|
|
15
15
|
const __html = inlineSvg.imageSrc === imageSrc ? inlineSvg.code : '';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from 'react';
|
|
2
2
|
import { useDomid } from '@hugsmidjan/react/hooks';
|
|
3
|
-
import
|
|
3
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
4
4
|
import { useMixedControlState } from '../utils.js';
|
|
5
5
|
export const TogglerGroup = (props) => {
|
|
6
6
|
const {
|
|
@@ -14,7 +14,7 @@ export const TogglerGroup = (props) => {
|
|
|
14
14
|
? _options.map((option) => ({ value: option }))
|
|
15
15
|
: _options;
|
|
16
16
|
}, [props.options]);
|
|
17
|
-
return (React.createElement("ul", { className:
|
|
17
|
+
return (React.createElement("ul", { className: modifiedClass(bem, null, className), role: "group", "aria-labelledby": props['aria-labelledby'], "aria-describedby": props['aria-describedby'], "aria-required": props.required }, options.map((option, i) => {
|
|
18
18
|
const isDisabled = option.disabled != null
|
|
19
19
|
? option.disabled
|
|
20
20
|
: disabled && typeof disabled !== 'boolean'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import { BemPropsModifier } from '@hugsmidjan/react/types';
|
|
3
2
|
import { FormFieldGroupWrappingProps } from '../FormField.js';
|
|
3
|
+
import { BemModifierProps } from '../utils/types.js';
|
|
4
4
|
import { TogglerGroupOption, TogglerGroupOptions, TogglerGroupProps } from './_TogglerGroup.js';
|
|
5
5
|
import { TogglerInputProps } from './_TogglerInput.js';
|
|
6
6
|
export type TogglerGroupFieldProps<T = 'default'> = {
|
|
@@ -12,7 +12,7 @@ type _TogglerGroupFieldProps = {
|
|
|
12
12
|
value?: string | ReadonlyArray<string>;
|
|
13
13
|
defaultValue?: string | ReadonlyArray<string>;
|
|
14
14
|
bem: string;
|
|
15
|
-
} &
|
|
15
|
+
} & BemModifierProps;
|
|
16
16
|
export type TogglerGroupFieldOption<T = 'default'> = TogglerGroupOption<T>;
|
|
17
17
|
export type TogglerGroupFieldOptions<T = 'default'> = TogglerGroupOptions<T>;
|
|
18
18
|
export declare const TogglerGroupField: (props: TogglerGroupFieldProps & _TogglerGroupFieldProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __rest } from "tslib";
|
|
2
2
|
import React, { useMemo } from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { modifiedClass } from '@hugsmidjan/qj/classUtils';
|
|
4
4
|
import FormField from '../FormField.js';
|
|
5
5
|
import { TogglerGroup, } from './_TogglerGroup.js';
|
|
6
6
|
export const TogglerGroupField = (props) => {
|
|
@@ -11,7 +11,7 @@ export const TogglerGroupField = (props) => {
|
|
|
11
11
|
: typeof defaultValue === 'string'
|
|
12
12
|
? [defaultValue]
|
|
13
13
|
: defaultValue, [defaultValue]);
|
|
14
|
-
return (React.createElement(FormField, { className:
|
|
14
|
+
return (React.createElement(FormField, { className: modifiedClass(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) => {
|
|
15
15
|
return (React.createElement(TogglerGroup, Object.assign({ bem: className.options }, inputProps, togglerGroupProps, { disabled: disabled, value: _value, defaultValue: _defaultValue, Toggler: Toggler })));
|
|
16
16
|
} }));
|
|
17
17
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BemModifierProps } from '../utils/types.js';
|
|
2
2
|
export type TogglerInputProps = {
|
|
3
3
|
label: string | JSX.Element;
|
|
4
4
|
children?: never;
|
|
@@ -15,7 +15,7 @@ export type TogglerInputProps = {
|
|
|
15
15
|
Wrapper?: 'div' | 'li';
|
|
16
16
|
wrapperProps?: JSX.IntrinsicElements['div'];
|
|
17
17
|
inputProps?: JSX.IntrinsicElements['input'];
|
|
18
|
-
} &
|
|
18
|
+
} & BemModifierProps & Omit<JSX.IntrinsicElements['input'], 'type'>;
|
|
19
19
|
type _TogglerInputProps = {
|
|
20
20
|
bem: string;
|
|
21
21
|
type: 'radio' | 'checkbox';
|