@inera/ids-react 9.2.1 → 9.3.0
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/components/accordion/accordion-base.d.ts +2 -1
- package/components/accordion/accordion-base.js +3 -4
- package/components/accordion/accordion.js +5 -2
- package/components/alert/alert-base.js +2 -2
- package/components/breadcrumbs/breadcrumbs.js +6 -1
- package/components/button/button.d.ts +1 -0
- package/components/button/button.js +2 -2
- package/components/button/control-button.d.ts +6 -0
- package/components/button/control-button.js +9 -0
- package/components/carousel/carousel.js +1 -1
- package/components/dialog/dialog-base.js +1 -1
- package/components/form/checkbox/checkbox-base.js +2 -3
- package/components/form/checkbox/checkbox-group-base.d.ts +2 -1
- package/components/form/checkbox/checkbox-group-base.js +3 -3
- package/components/form/checkbox/checkbox-group.d.ts +2 -1
- package/components/form/checkbox/checkbox-group.js +2 -2
- package/components/form/checkbox/checkbox.js +3 -4
- package/components/form/datepicker/datepicker.d.ts +3 -1
- package/components/form/datepicker/datepicker.js +142 -110
- package/components/form/form-hooks/useInputValidity.d.ts +1 -1
- package/components/form/form-hooks/useInputValidity.js +28 -12
- package/components/form/form-props/form-props.d.ts +1 -0
- package/components/form/input/input-base.d.ts +4 -2
- package/components/form/input/input-base.js +14 -9
- package/components/form/input/input.d.ts +3 -0
- package/components/form/input/input.js +1 -1
- package/components/form/radio/radio-base.js +1 -2
- package/components/form/radio/radio-group-base.d.ts +2 -1
- package/components/form/radio/radio-group-base.js +3 -3
- package/components/form/radio/radio-group.d.ts +2 -1
- package/components/form/radio/radio-group.js +2 -2
- package/components/form/range/range-base.d.ts +1 -1
- package/components/form/range/range-base.js +2 -2
- package/components/form/select/select-base.d.ts +3 -3
- package/components/form/select/select-base.js +3 -5
- package/components/form/select/select.d.ts +2 -2
- package/components/form/select/select.js +1 -1
- package/components/form/select-multiple/select-multiple-base.d.ts +1 -1
- package/components/form/select-multiple/select-multiple-base.js +2 -2
- package/components/form/textarea/textarea-base.d.ts +1 -1
- package/components/form/textarea/textarea-base.js +3 -5
- package/components/form/textarea/textarea.js +1 -1
- package/components/form/time/time-base.d.ts +1 -1
- package/components/form/time/time-base.js +2 -4
- package/components/form/time/time.js +4 -5
- package/components/header-1177/header-1177-region-picker-base.d.ts +3 -1
- package/components/header-1177/header-1177-region-picker-base.js +8 -3
- package/components/header-1177/header-1177-region-picker-mobile-base.d.ts +3 -1
- package/components/header-1177/header-1177-region-picker-mobile-base.js +8 -3
- package/components/header-1177/header-1177-region-picker-mobile.d.ts +2 -0
- package/components/header-1177/header-1177-region-picker.d.ts +2 -0
- package/components/header-1177-pro/header-1177-pro-region-picker-base.d.ts +3 -1
- package/components/header-1177-pro/header-1177-pro-region-picker-base.js +8 -3
- package/components/header-1177-pro/header-1177-pro-region-picker-mobile-base.d.ts +3 -1
- package/components/header-1177-pro/header-1177-pro-region-picker-mobile-base.js +8 -3
- package/components/header-1177-pro/header-1177-pro-region-picker-mobile.d.ts +3 -1
- package/components/header-1177-pro/header-1177-pro-region-picker-mobile.js +1 -1
- package/components/header-1177-pro/header-1177-pro-region-picker.d.ts +3 -1
- package/components/header-1177-pro/header-1177-pro-region-picker.js +1 -1
- package/components/popover/popover-content.js +1 -1
- package/components/popover/popover.d.ts +2 -1
- package/components/popover/popover.js +28 -14
- package/components/puff-list/puff-list-item-header.d.ts +1 -1
- package/components/puff-list/puff-list-item.d.ts +2 -1
- package/components/puff-list/puff-list-item.js +2 -2
- package/components/side-panel/side-panel-base.d.ts +1 -0
- package/components/side-panel/side-panel-base.js +4 -2
- package/components/side-panel/side-panel.d.ts +2 -1
- package/components/side-panel/side-panel.js +2 -2
- package/components/stepper/step-base.d.ts +1 -1
- package/components/stepper/step-base.js +1 -1
- package/components/stepper/step.d.ts +1 -1
- package/components/stepper/step.js +2 -11
- package/components/tag/tag.js +8 -2
- package/components/tooltip/tooltip-base.d.ts +1 -3
- package/components/tooltip/tooltip-base.js +14 -10
- package/components/tooltip/tooltip.js +1 -41
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/package.json +4 -3
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { CSSProperties } from "react";
|
|
2
|
-
import {
|
|
3
|
-
export interface IDSSelectBaseProps extends React.SelectHTMLAttributes<HTMLSelectElement>,
|
|
2
|
+
import { CommonFormPropsWithReadOnly } from "../form-props/form-props";
|
|
3
|
+
export interface IDSSelectBaseProps extends React.SelectHTMLAttributes<HTMLSelectElement>, CommonFormPropsWithReadOnly {
|
|
4
4
|
selectRef?: React.Ref<HTMLSelectElement>;
|
|
5
5
|
errorMsgId?: string;
|
|
6
6
|
style?: CSSProperties;
|
|
7
7
|
}
|
|
8
|
-
export declare function IDSSelectBase({ id, label, errorMsgId, errorMsg, invalid, disabled, required, light, focusAnchor, tooltip, children, className, selectRef, dataTestId, style, ...props }: IDSSelectBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function IDSSelectBase({ id, label, errorMsgId, errorMsg, invalid, readOnly, disabled, required, light, focusAnchor, tooltip, children, className, selectRef, dataTestId, style, subtitle, ...props }: IDSSelectBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export declare namespace IDSSelectBase {
|
|
10
10
|
var displayName: string;
|
|
11
11
|
}
|
|
@@ -3,7 +3,7 @@ import { useId } from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { IDSErrorMessage } from '../error-message/error-message.js';
|
|
5
5
|
|
|
6
|
-
function IDSSelectBase({ id, label, errorMsgId, errorMsg, invalid, disabled, required, light, focusAnchor, tooltip, children, className, selectRef, dataTestId, style, ...props }) {
|
|
6
|
+
function IDSSelectBase({ id, label, errorMsgId, errorMsg, invalid, readOnly, disabled, required, light, focusAnchor, tooltip, children, className, selectRef, dataTestId, style, subtitle, ...props }) {
|
|
7
7
|
const reactId = useId();
|
|
8
8
|
const selectId = id ?? `select-base-${reactId}`;
|
|
9
9
|
const baseErrorMsgId = errorMsgId ?? `select-base-error-${reactId}`;
|
|
@@ -12,12 +12,10 @@ function IDSSelectBase({ id, label, errorMsgId, errorMsg, invalid, disabled, req
|
|
|
12
12
|
if (showErrorMsg) {
|
|
13
13
|
ariaHandler["aria-describedby"] = baseErrorMsgId;
|
|
14
14
|
}
|
|
15
|
-
return (jsxs("div", { className: clsx("ids-select", className), "data-testid": dataTestId, style: style, children: [label && (jsxs("div", { className: "ids-label-wrapper ids-label-wrapper--margin-bottom", children: [jsx("label", { htmlFor: selectId, className: clsx("ids-
|
|
16
|
-
"ids-label--disabled": disabled
|
|
17
|
-
}), children: label }), tooltip && jsx("span", { className: "ids-label__tooltip", children: tooltip })] })), jsx("div", { className: "ids-select__wrapper", children: jsx("select", { id: selectId, ref: selectRef, className: clsx("ids-select__select", {
|
|
15
|
+
return (jsxs("div", { className: clsx("ids-select", className), "data-testid": dataTestId, style: style, children: [label && (jsxs("div", { className: "ids-label-wrapper ids-label-wrapper--margin-bottom", children: [jsx("label", { htmlFor: selectId, className: "ids-label", children: label }), tooltip && jsx("span", { className: "ids-label__tooltip", children: tooltip })] })), subtitle && jsx("div", { className: "ids-subtitle", children: subtitle }), jsx("div", { className: "ids-select__wrapper", children: jsx("select", { id: selectId, ref: selectRef, className: clsx("ids-select__select", {
|
|
18
16
|
"ids-input--light": light,
|
|
19
17
|
"ids-focus-anchor": focusAnchor
|
|
20
|
-
}), "aria-invalid": invalid, "aria-disabled":
|
|
18
|
+
}), "aria-invalid": invalid, "aria-disabled": readOnly, disabled: disabled, required: required, ...ariaHandler, ...props, children: children }) }), showErrorMsg && (jsx(IDSErrorMessage, { id: baseErrorMsgId, show: true, children: errorMsg }))] }));
|
|
21
19
|
}
|
|
22
20
|
IDSSelectBase.displayName = "IDSSelectBase";
|
|
23
21
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export interface IDSSelectProps extends React.SelectHTMLAttributes<HTMLSelectElement>,
|
|
1
|
+
import { CommonFormPropsWithReadOnly } from "../form-props/form-props";
|
|
2
|
+
export interface IDSSelectProps extends React.SelectHTMLAttributes<HTMLSelectElement>, CommonFormPropsWithReadOnly {
|
|
3
3
|
}
|
|
4
4
|
export declare const IDSSelect: import("react").ForwardRefExoticComponent<IDSSelectProps & import("react").RefAttributes<HTMLSelectElement>>;
|
|
@@ -7,7 +7,7 @@ import { IDSSelectBase } from './select-base.js';
|
|
|
7
7
|
const IDSSelect = forwardRef(({ invalid = false, noValidation = false, validationOnBlur = false, children, ...props }, ref) => {
|
|
8
8
|
const errorMsgId = `select-error-${useId()}`;
|
|
9
9
|
const selectRef = useRef(null);
|
|
10
|
-
const hasValidValue = useInputValidity(selectRef, validationOnBlur);
|
|
10
|
+
const hasValidValue = useInputValidity(selectRef, validationOnBlur, noValidation);
|
|
11
11
|
const computedInvalid = (invalid || !hasValidValue) && !noValidation;
|
|
12
12
|
// Merge forwarded + local ref
|
|
13
13
|
const mergedRef = (node) => {
|
|
@@ -14,7 +14,7 @@ export interface IDSSelectMultipleBaseProps extends React.InputHTMLAttributes<HT
|
|
|
14
14
|
client?: boolean;
|
|
15
15
|
style?: CSSProperties;
|
|
16
16
|
}
|
|
17
|
-
export declare function IDSSelectMultipleBase({ id, label, placeholder, numbCheckedBoxes, selectedLabel, selectedLabelPlural, expanded, maxHeight, tooltip, componentRef, buttonRef, invalid, disabled, readOnly, ariaDisabled, light, focusAnchor, className, children, style, onClick, client }: IDSSelectMultipleBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function IDSSelectMultipleBase({ id, label, placeholder, numbCheckedBoxes, selectedLabel, selectedLabelPlural, expanded, maxHeight, tooltip, subtitle, componentRef, buttonRef, invalid, disabled, readOnly, ariaDisabled, light, focusAnchor, className, children, style, onClick, client }: IDSSelectMultipleBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export declare namespace IDSSelectMultipleBase {
|
|
19
19
|
var displayName: string;
|
|
20
20
|
}
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { useId } from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
|
|
5
|
-
function IDSSelectMultipleBase({ id, label, placeholder, numbCheckedBoxes, selectedLabel = "vald", selectedLabelPlural = "valda", expanded, maxHeight = "", tooltip, componentRef, buttonRef, invalid, disabled, readOnly, ariaDisabled, light, focusAnchor, className, children, style, onClick, client = false }) {
|
|
5
|
+
function IDSSelectMultipleBase({ id, label, placeholder, numbCheckedBoxes, selectedLabel = "vald", selectedLabelPlural = "valda", expanded, maxHeight = "", tooltip, subtitle, componentRef, buttonRef, invalid, disabled, readOnly, ariaDisabled, light, focusAnchor, className, children, style, onClick, client = false }) {
|
|
6
6
|
const reactId = useId();
|
|
7
7
|
const labelId = `select-multiple-base-label-${reactId}`;
|
|
8
8
|
const dropdownId = `select-multiple-base-dropdown-${reactId}`;
|
|
@@ -16,7 +16,7 @@ function IDSSelectMultipleBase({ id, label, placeholder, numbCheckedBoxes, selec
|
|
|
16
16
|
onClick
|
|
17
17
|
}
|
|
18
18
|
: {};
|
|
19
|
-
return (jsxs("div", { className: clsx("ids-select-multiple", className), ref: componentRef, style: style, children: [label && (jsxs("div", { className: "ids-label-wrapper ids-label-wrapper--margin-bottom", children: [jsx("label", { id: labelId, className:
|
|
19
|
+
return (jsxs("div", { className: clsx("ids-select-multiple", className), ref: componentRef, style: style, children: [label && (jsxs("div", { className: "ids-label-wrapper ids-label-wrapper--margin-bottom", children: [jsx("label", { id: labelId, className: "ids-label", children: label }), tooltip && jsx("span", { className: "ids-label__tooltip", children: tooltip })] })), subtitle && jsx("div", { className: "ids-subtitle", children: subtitle }), jsx("div", { className: "ids-select-multiple__select-wrapper", children: jsx("button", { ref: buttonRef, id: id, "aria-labelledby": labelId, type: "button", "aria-haspopup": "dialog", "aria-controls": dropdownId, className: clsx("ids-select-multiple__select", {
|
|
20
20
|
"ids-input--light": light,
|
|
21
21
|
"ids-focus-anchor": focusAnchor
|
|
22
22
|
}), disabled: disabled, "aria-disabled": ariaDisabled || readOnly || undefined, "aria-expanded": expanded, "aria-invalid": invalid, ...clickHandler, children: displayedValue }) }), jsx("div", { className: "ids-select-multiple__dropdown-wrapper", id: dropdownId, children: jsx("div", { className: clsx("ids-select-multiple__dropdown", {
|
|
@@ -9,7 +9,7 @@ interface IDSTextareaBaseProps extends Omit<React.TextareaHTMLAttributes<HTMLTex
|
|
|
9
9
|
errorMsgId?: string;
|
|
10
10
|
style?: CSSProperties;
|
|
11
11
|
}
|
|
12
|
-
export declare function IDSTextareaBase({ id, label, hint, hintId, errorMsg, errorMsgId, invalid, required, disabled, readOnly, light, block, autoSize, noResize, focusAnchor, tooltip, textareaRef, dataTestId, className, style, ...props }: IDSTextareaBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function IDSTextareaBase({ id, label, subtitle, hint, hintId, errorMsg, errorMsgId, invalid, required, disabled, readOnly, light, block, autoSize, noResize, focusAnchor, tooltip, textareaRef, dataTestId, className, style, ...props }: IDSTextareaBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
13
13
|
export declare namespace IDSTextareaBase {
|
|
14
14
|
var displayName: string;
|
|
15
15
|
}
|
|
@@ -3,7 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { IDSErrorMessage } from '../error-message/error-message.js';
|
|
4
4
|
import { useId } from 'react';
|
|
5
5
|
|
|
6
|
-
function IDSTextareaBase({ id, label, hint, hintId, errorMsg, errorMsgId, invalid, required, disabled, readOnly, light, block, autoSize, noResize, focusAnchor, tooltip, textareaRef, dataTestId, className, style, ...props }) {
|
|
6
|
+
function IDSTextareaBase({ id, label, subtitle, hint, hintId, errorMsg, errorMsgId, invalid, required, disabled, readOnly, light, block, autoSize, noResize, focusAnchor, tooltip, textareaRef, dataTestId, className, style, ...props }) {
|
|
7
7
|
const reactId = useId();
|
|
8
8
|
const inputId = !!id ? id : `textarea-base-${reactId}`;
|
|
9
9
|
const baseHintId = !!hintId ? hintId : `textarea-base-hint-${reactId}`;
|
|
@@ -18,13 +18,11 @@ function IDSTextareaBase({ id, label, hint, hintId, errorMsg, errorMsgId, invali
|
|
|
18
18
|
"ids-textarea--block": block,
|
|
19
19
|
"ids-textarea--autosize": autoSize,
|
|
20
20
|
"ids-textarea--no-resize": noResize
|
|
21
|
-
}, className), "data-testid": dataTestId, style: style, children: [label && (jsxs("div", { className: "ids-label-wrapper ids-label-wrapper--margin-bottom", children: [jsx("label", { htmlFor: inputId, className: clsx("ids-
|
|
22
|
-
"ids-label--disabled": disabled || readOnly
|
|
23
|
-
}), children: label }), tooltip && jsx("span", { className: "ids-label__tooltip", children: tooltip })] })), jsx("textarea", { ref: textareaRef, id: inputId, className: clsx("ids-textarea__textarea", {
|
|
21
|
+
}, className), "data-testid": dataTestId, style: style, children: [label && (jsxs("div", { className: "ids-label-wrapper ids-label-wrapper--margin-bottom", children: [jsx("label", { htmlFor: inputId, className: "ids-label", children: label }), tooltip && jsx("span", { className: "ids-label__tooltip", children: tooltip })] })), subtitle && jsx("div", { className: "ids-subtitle", children: subtitle }), jsx("textarea", { ref: textareaRef, id: inputId, className: clsx("ids-textarea__textarea", {
|
|
24
22
|
"ids-input--light": light,
|
|
25
23
|
"ids-input--invalid": invalid,
|
|
26
24
|
"ids-focus-anchor": focusAnchor
|
|
27
|
-
}), style: { minWidth:
|
|
25
|
+
}), style: { minWidth: !!hint || (!!errorMsg && showErrorMsg) ? "100%" : "inherit" }, required: required, disabled: disabled, "aria-required": required, "aria-disabled": disabled, "aria-invalid": invalid, readOnly: readOnly, ...ariaHandler, ...props }), hint && (jsx("div", { id: baseHintId, className: "ids-input__hint", children: hint })), showErrorMsg && (jsx(IDSErrorMessage, { id: baseErrorMsgId, show: true, children: errorMsg }))] }));
|
|
28
26
|
}
|
|
29
27
|
IDSTextareaBase.displayName = "IDSTextareaBase";
|
|
30
28
|
|
|
@@ -6,7 +6,7 @@ import { IDSTextareaBase } from './textarea-base.js';
|
|
|
6
6
|
|
|
7
7
|
const IDSTextarea = forwardRef(({ invalid = false, noValidation = false, validationOnBlur = false, ...props }, ref) => {
|
|
8
8
|
const textareaRef = useRef(null);
|
|
9
|
-
const hasValidValue = useInputValidity(textareaRef, validationOnBlur);
|
|
9
|
+
const hasValidValue = useInputValidity(textareaRef, validationOnBlur, noValidation);
|
|
10
10
|
const computedInvalid = (invalid || !hasValidValue) && !noValidation;
|
|
11
11
|
// Merge forwarded + local ref
|
|
12
12
|
const mergedRef = (node) => {
|
|
@@ -5,7 +5,7 @@ export interface IDSTimeBaseProps extends React.InputHTMLAttributes<HTMLInputEle
|
|
|
5
5
|
errorMsgId?: string;
|
|
6
6
|
style?: CSSProperties;
|
|
7
7
|
}
|
|
8
|
-
export declare function IDSTimeBase({ id, label, tooltip, errorMsg, errorMsgId, disabled, invalid, required, light, focusAnchor, dataTestId, className, inputRef, style, ...props }: IDSTimeBaseProps & React.InputHTMLAttributes<HTMLInputElement>): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare function IDSTimeBase({ id, label, tooltip, errorMsg, errorMsgId, disabled, invalid, required, light, focusAnchor, dataTestId, className, inputRef, style, subtitle, ...props }: IDSTimeBaseProps & React.InputHTMLAttributes<HTMLInputElement>): import("react/jsx-runtime").JSX.Element;
|
|
9
9
|
export declare namespace IDSTimeBase {
|
|
10
10
|
var displayName: string;
|
|
11
11
|
}
|
|
@@ -3,7 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { IDSErrorMessage } from '../error-message/error-message.js';
|
|
4
4
|
import { useId } from 'react';
|
|
5
5
|
|
|
6
|
-
function IDSTimeBase({ id, label, tooltip, errorMsg, errorMsgId, disabled = false, invalid = false, required = false, light, focusAnchor, dataTestId, className, inputRef, style, ...props }) {
|
|
6
|
+
function IDSTimeBase({ id, label, tooltip, errorMsg, errorMsgId, disabled = false, invalid = false, required = false, light, focusAnchor, dataTestId, className, inputRef, style, subtitle, ...props }) {
|
|
7
7
|
const reactId = useId();
|
|
8
8
|
const inputId = id ?? `time-base-${reactId}`;
|
|
9
9
|
const baseErrorMsgId = errorMsgId ?? `time-base-error-${reactId}`;
|
|
@@ -12,9 +12,7 @@ function IDSTimeBase({ id, label, tooltip, errorMsg, errorMsgId, disabled = fals
|
|
|
12
12
|
if (showErrorMsg) {
|
|
13
13
|
ariaHandler["aria-describedby"] = baseErrorMsgId;
|
|
14
14
|
}
|
|
15
|
-
return (jsxs("div", { className: clsx("ids-time", className), "data-testid": dataTestId, style: style, children: [label && (jsxs("div", { className: "ids-label-wrapper ids-label-wrapper--margin-bottom", children: [jsx("label", { className: clsx("ids-
|
|
16
|
-
"ids-label--disabled": disabled
|
|
17
|
-
}), htmlFor: inputId, children: label }), tooltip && jsx("span", { className: "ids-label__tooltip", children: tooltip })] })), jsx("div", { className: "ids-time__input-wrapper", children: jsx("input", { ref: inputRef, id: inputId, type: "time", className: clsx("ids-time__input", {
|
|
15
|
+
return (jsxs("div", { className: clsx("ids-time", className), "data-testid": dataTestId, style: style, children: [label && (jsxs("div", { className: "ids-label-wrapper ids-label-wrapper--margin-bottom", children: [jsx("label", { className: "ids-label", htmlFor: inputId, children: label }), tooltip && jsx("span", { className: "ids-label__tooltip", children: tooltip })] })), subtitle && jsx("div", { className: "ids-subtitle", children: subtitle }), jsx("div", { className: "ids-time__input-wrapper", children: jsx("input", { ref: inputRef, id: inputId, type: "time", className: clsx("ids-time__input", {
|
|
18
16
|
"ids-input--light": light,
|
|
19
17
|
"ids-focus-anchor": focusAnchor
|
|
20
18
|
}), "aria-invalid": invalid, "aria-required": required, "aria-disabled": disabled, required: required, disabled: disabled, ...ariaHandler, ...props }) }), showErrorMsg && (jsx(IDSErrorMessage, { id: baseErrorMsgId, show: true, children: errorMsg }))] }));
|
|
@@ -4,11 +4,10 @@ import { forwardRef, useRef } from 'react';
|
|
|
4
4
|
import { useInputValidity } from '../form-hooks/useInputValidity.js';
|
|
5
5
|
import { IDSTimeBase } from './time-base.js';
|
|
6
6
|
|
|
7
|
-
const IDSTime = forwardRef(({ invalid = false, noValidation = false, validationOnBlur = false, ...props }, ref) => {
|
|
7
|
+
const IDSTime = forwardRef(({ invalid = false, noValidation = false, validationOnBlur = false, required = false, ...props }, ref) => {
|
|
8
8
|
const timeRef = useRef(null);
|
|
9
|
-
const hasValidValue = useInputValidity(timeRef, validationOnBlur);
|
|
10
|
-
const isInvalid = (invalid || !hasValidValue)
|
|
11
|
-
// Merge forwarded + local ref
|
|
9
|
+
const hasValidValue = useInputValidity(timeRef, validationOnBlur, noValidation);
|
|
10
|
+
const isInvalid = !noValidation && (invalid || !hasValidValue);
|
|
12
11
|
const mergedRef = (node) => {
|
|
13
12
|
timeRef.current = node;
|
|
14
13
|
if (typeof ref === "function")
|
|
@@ -16,7 +15,7 @@ const IDSTime = forwardRef(({ invalid = false, noValidation = false, validationO
|
|
|
16
15
|
else if (ref)
|
|
17
16
|
ref.current = node;
|
|
18
17
|
};
|
|
19
|
-
return jsx(IDSTimeBase, { invalid: isInvalid, inputRef: mergedRef, ...props });
|
|
18
|
+
return jsx(IDSTimeBase, { invalid: isInvalid, inputRef: mergedRef, required: noValidation ? false : required, ...props });
|
|
20
19
|
});
|
|
21
20
|
IDSTime.displayName = "IDSTime";
|
|
22
21
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
export interface IDSHeader1177RegionPickerBaseProps extends HTMLAttributes<HTMLElement> {
|
|
3
3
|
text?: string;
|
|
4
|
+
ariaLabel?: string;
|
|
5
|
+
ariaControls?: string;
|
|
4
6
|
expanded?: boolean;
|
|
5
7
|
hide?: boolean;
|
|
6
8
|
onToggle?: () => void;
|
|
7
9
|
client?: boolean;
|
|
8
10
|
}
|
|
9
|
-
export declare function IDSHeader1177RegionPickerBase({ text, expanded, hide, children, onToggle, client, ...props }: IDSHeader1177RegionPickerBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function IDSHeader1177RegionPickerBase({ text, ariaLabel, ariaControls, expanded, hide, children, onToggle, client, ...props }: IDSHeader1177RegionPickerBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export declare namespace IDSHeader1177RegionPickerBase {
|
|
11
13
|
var displayName: string;
|
|
12
14
|
}
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
|
|
5
|
-
function IDSHeader1177RegionPickerBase({ text = "Välj region", expanded = false, hide = false, children, onToggle, client = false, ...props }) {
|
|
5
|
+
function IDSHeader1177RegionPickerBase({ text = "Välj region", ariaLabel = "Välj region", ariaControls, expanded = false, hide = false, children, onToggle, client = false, ...props }) {
|
|
6
6
|
if (hide)
|
|
7
7
|
return null;
|
|
8
8
|
const hasChildren = React.Children.count(children) > 0;
|
|
@@ -11,11 +11,16 @@ function IDSHeader1177RegionPickerBase({ text = "Välj region", expanded = false
|
|
|
11
11
|
onClick: onToggle
|
|
12
12
|
}
|
|
13
13
|
: {};
|
|
14
|
+
const ariaHandler = ariaControls
|
|
15
|
+
? {
|
|
16
|
+
"aria-controls": ariaControls
|
|
17
|
+
}
|
|
18
|
+
: {};
|
|
14
19
|
return (jsxs("div", { className: clsx("ids-header-1177-region-picker", {
|
|
15
20
|
"ids-header-1177-region-picker--selected-region": hasChildren
|
|
16
|
-
}), ...props, children: [jsx("div", { className: "ids-header-1177-region-picker__region-icon", children: children }), jsx("div", { className: "ids-header-1177-region-picker__selector", children: jsx("button", { ...toggleHandler, className: clsx("ids-header-1177-region-picker__button", {
|
|
21
|
+
}), ...props, children: [jsx("div", { className: "ids-header-1177-region-picker__region-icon", children: children }), jsx("div", { className: "ids-header-1177-region-picker__selector", children: jsx("button", { ...toggleHandler, ...ariaHandler, className: clsx("ids-header-1177-region-picker__button", {
|
|
17
22
|
"ids-header-1177-region-picker__button--expanded": expanded
|
|
18
|
-
}), "aria-label":
|
|
23
|
+
}), "aria-expanded": expanded ? "true" : "false", "aria-label": ariaLabel, children: text }) })] }));
|
|
19
24
|
}
|
|
20
25
|
IDSHeader1177RegionPickerBase.displayName = "IDSHeader1177RegionPickerBase";
|
|
21
26
|
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
export interface IDSHeader1177RegionPickerMobileBaseProps extends HTMLAttributes<HTMLElement> {
|
|
3
3
|
text?: string;
|
|
4
|
+
ariaLabel?: string;
|
|
5
|
+
ariaControls?: string;
|
|
4
6
|
expanded?: boolean;
|
|
5
7
|
onToggle?: () => void;
|
|
6
8
|
hide?: boolean;
|
|
7
9
|
client?: boolean;
|
|
8
10
|
}
|
|
9
|
-
export declare function IDSHeader1177RegionPickerMobileBase({ text, expanded, children, onToggle, hide, client, ...props }: IDSHeader1177RegionPickerMobileBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function IDSHeader1177RegionPickerMobileBase({ text, ariaLabel, ariaControls, expanded, children, onToggle, hide, client, ...props }: IDSHeader1177RegionPickerMobileBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export declare namespace IDSHeader1177RegionPickerMobileBase {
|
|
11
13
|
var displayName: string;
|
|
12
14
|
}
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
|
|
5
|
-
function IDSHeader1177RegionPickerMobileBase({ text = "Välj region", expanded = false, children, onToggle, hide = false, client = false, ...props }) {
|
|
5
|
+
function IDSHeader1177RegionPickerMobileBase({ text = "Välj region", ariaLabel = "Välj region", ariaControls = "", expanded = false, children, onToggle, hide = false, client = false, ...props }) {
|
|
6
6
|
if (hide)
|
|
7
7
|
return null;
|
|
8
8
|
const hasChildren = React.Children.count(children) > 0;
|
|
@@ -11,11 +11,16 @@ function IDSHeader1177RegionPickerMobileBase({ text = "Välj region", expanded =
|
|
|
11
11
|
onClick: onToggle
|
|
12
12
|
}
|
|
13
13
|
: {};
|
|
14
|
+
const ariaHandler = ariaControls
|
|
15
|
+
? {
|
|
16
|
+
"aria-controls": ariaControls
|
|
17
|
+
}
|
|
18
|
+
: {};
|
|
14
19
|
return (jsx("div", { className: clsx("ids-header-1177-region-picker-mobile", {
|
|
15
20
|
"ids-header-1177-region-picker-mobile--selected-region": hasChildren
|
|
16
|
-
}), ...props, children: jsxs("button", { ...toggleHandler, className: clsx("ids-header-1177-region-picker-mobile__button", {
|
|
21
|
+
}), ...props, children: jsxs("button", { ...toggleHandler, ...ariaHandler, className: clsx("ids-header-1177-region-picker-mobile__button", {
|
|
17
22
|
"ids-header-1177-region-picker-mobile__button--expanded": expanded
|
|
18
|
-
}), "aria-label":
|
|
23
|
+
}), "aria-expanded": expanded ? "true" : "false", "aria-label": ariaLabel, children: [jsx("div", { className: "ids-header-1177-region-picker-mobile__region-icon", children: children }), jsx("span", { className: "ids-header-1177-region-picker-mobile__button-text", children: text })] }) }));
|
|
19
24
|
}
|
|
20
25
|
IDSHeader1177RegionPickerMobileBase.displayName = "IDSHeader1177RegionPickerMobileBase";
|
|
21
26
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
export interface IDSHeader1177RegionPickerMobileProps extends HTMLAttributes<HTMLElement> {
|
|
3
3
|
expanded?: boolean;
|
|
4
|
+
ariaLabel?: string;
|
|
5
|
+
ariaControls?: string;
|
|
4
6
|
onToggleRegion?: (isExpanded: boolean) => void;
|
|
5
7
|
}
|
|
6
8
|
export declare function IDSHeader1177RegionPickerMobile({ expanded, onToggleRegion, children, ...props }: IDSHeader1177RegionPickerMobileProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
export interface IDSHeader1177RegionPickerProps extends HTMLAttributes<HTMLElement> {
|
|
3
3
|
expanded?: boolean;
|
|
4
|
+
ariaLabel?: string;
|
|
5
|
+
ariaControls?: string;
|
|
4
6
|
onToggleRegion?: (isExpanded: boolean) => void;
|
|
5
7
|
}
|
|
6
8
|
export declare function IDSHeader1177RegionPicker({ expanded, onToggleRegion, children, ...props }: IDSHeader1177RegionPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
export interface IDSHeader1177ProRegionPickerBaseProps extends HTMLAttributes<HTMLElement> {
|
|
3
3
|
text?: string;
|
|
4
|
+
ariaControls?: string;
|
|
5
|
+
ariaLabel?: string;
|
|
4
6
|
expanded?: boolean;
|
|
5
7
|
hide?: boolean;
|
|
6
8
|
client?: boolean;
|
|
7
9
|
onToggleRegion?: () => void;
|
|
8
10
|
}
|
|
9
|
-
export declare function IDSHeader1177ProRegionPickerBase({ text, expanded, hide, children, client, onToggleRegion, ...props }: IDSHeader1177ProRegionPickerBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare function IDSHeader1177ProRegionPickerBase({ text, ariaLabel, ariaControls, expanded, hide, children, client, onToggleRegion, ...props }: IDSHeader1177ProRegionPickerBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export declare namespace IDSHeader1177ProRegionPickerBase {
|
|
11
13
|
var displayName: string;
|
|
12
14
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
|
|
4
|
-
function IDSHeader1177ProRegionPickerBase({ text = "Välj region", expanded, hide = false, children, client = false, onToggleRegion, ...props }) {
|
|
4
|
+
function IDSHeader1177ProRegionPickerBase({ text = "Välj region", ariaLabel = "Välj region", ariaControls, expanded, hide = false, children, client = false, onToggleRegion, ...props }) {
|
|
5
5
|
if (hide)
|
|
6
6
|
return null;
|
|
7
7
|
const toggleHandler = client && onToggleRegion
|
|
@@ -9,11 +9,16 @@ function IDSHeader1177ProRegionPickerBase({ text = "Välj region", expanded, hid
|
|
|
9
9
|
onClick: onToggleRegion
|
|
10
10
|
}
|
|
11
11
|
: {};
|
|
12
|
+
const ariaHandler = ariaControls
|
|
13
|
+
? {
|
|
14
|
+
"aria-controls": ariaControls
|
|
15
|
+
}
|
|
16
|
+
: {};
|
|
12
17
|
return (jsxs("div", { className: clsx("ids-header-1177-pro-region-picker", {
|
|
13
18
|
"ids-header-1177-pro-region-picker--selected-region": !!children
|
|
14
|
-
}), ...props, children: [jsx("div", { className: "ids-header-1177-pro-region-picker__region-icon", children: children }), jsx("div", { className: "ids-header-1177-pro-region-picker__selector", children: jsx("button", { type: "button", ...toggleHandler, className: clsx("ids-header-1177-pro-region-picker__button", {
|
|
19
|
+
}), ...props, children: [jsx("div", { className: "ids-header-1177-pro-region-picker__region-icon", children: children }), jsx("div", { className: "ids-header-1177-pro-region-picker__selector", children: jsx("button", { type: "button", ...toggleHandler, ...ariaHandler, className: clsx("ids-header-1177-pro-region-picker__button", {
|
|
15
20
|
"ids-header-1177-pro-region-picker__button--expanded": expanded
|
|
16
|
-
}), "aria-label":
|
|
21
|
+
}), "aria-expanded": expanded ? "true" : "false", "aria-label": ariaLabel, children: text }) })] }));
|
|
17
22
|
}
|
|
18
23
|
IDSHeader1177ProRegionPickerBase.displayName = "IDSHeader1177ProRegionPickerBase";
|
|
19
24
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
export interface IDSHeader1177ProRegionPickerMobileBaseProps extends HTMLAttributes<HTMLElement> {
|
|
3
3
|
text?: string;
|
|
4
|
+
ariaControls?: string;
|
|
5
|
+
ariaLabel?: string;
|
|
4
6
|
expanded?: boolean;
|
|
5
7
|
hide?: boolean;
|
|
6
8
|
client?: boolean;
|
|
7
9
|
unresponsive?: boolean;
|
|
8
10
|
onToggleRegion?: () => void;
|
|
9
11
|
}
|
|
10
|
-
export declare function IDSHeader1177ProRegionPickerMobileBase({ text, expanded, children, hide, client, unresponsive, onToggleRegion, ...props }: IDSHeader1177ProRegionPickerMobileBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function IDSHeader1177ProRegionPickerMobileBase({ text, ariaLabel, ariaControls, expanded, children, hide, client, unresponsive, onToggleRegion, ...props }: IDSHeader1177ProRegionPickerMobileBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
export declare namespace IDSHeader1177ProRegionPickerMobileBase {
|
|
12
14
|
var displayName: string;
|
|
13
15
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
|
|
4
|
-
function IDSHeader1177ProRegionPickerMobileBase({ text = "Välj region", expanded, children, hide = false, client = false, unresponsive = false, onToggleRegion, ...props }) {
|
|
4
|
+
function IDSHeader1177ProRegionPickerMobileBase({ text = "Välj region", ariaLabel = "Välj region", ariaControls, expanded, children, hide = false, client = false, unresponsive = false, onToggleRegion, ...props }) {
|
|
5
5
|
if (hide)
|
|
6
6
|
return null;
|
|
7
7
|
const toggleHandler = client && onToggleRegion
|
|
@@ -9,12 +9,17 @@ function IDSHeader1177ProRegionPickerMobileBase({ text = "Välj region", expande
|
|
|
9
9
|
onClick: onToggleRegion
|
|
10
10
|
}
|
|
11
11
|
: {};
|
|
12
|
+
const ariaHandler = ariaControls
|
|
13
|
+
? {
|
|
14
|
+
"aria-controls": ariaControls
|
|
15
|
+
}
|
|
16
|
+
: {};
|
|
12
17
|
return (jsx("div", { className: clsx("ids-header-1177-pro-region-picker-mobile", {
|
|
13
18
|
"ids-header-1177-pro-region-picker-mobile--selected-region": !!children,
|
|
14
19
|
"ids-header-1177-pro-region-picker-mobile--unresponsive": unresponsive
|
|
15
|
-
}), ...props, children: jsxs("button", { ...toggleHandler, className: clsx("ids-header-1177-pro-region-picker-mobile__button", {
|
|
20
|
+
}), ...props, children: jsxs("button", { ...toggleHandler, ...ariaHandler, className: clsx("ids-header-1177-pro-region-picker-mobile__button", {
|
|
16
21
|
"ids-header-1177-pro-region-picker-mobile__button--expanded": expanded
|
|
17
|
-
}), "aria-label":
|
|
22
|
+
}), "aria-expanded": expanded ? "true" : "false", "aria-label": ariaLabel, children: [jsx("div", { className: "ids-header-1177-pro-region-picker-mobile__region-icon", children: children }), jsx("span", { className: "ids-header-1177-pro-region-picker-mobile__button-text", children: text })] }) }));
|
|
18
23
|
}
|
|
19
24
|
IDSHeader1177ProRegionPickerMobileBase.displayName = "IDSHeader1177ProRegionPickerMobileBase";
|
|
20
25
|
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
export interface IDSHeader1177ProRegionPickerMobileProps extends HTMLAttributes<HTMLElement> {
|
|
3
3
|
text?: string;
|
|
4
|
+
ariaControls?: string;
|
|
5
|
+
ariaLabel?: string;
|
|
4
6
|
expanded?: boolean;
|
|
5
7
|
onToggleRegion?: (isExpanded: boolean) => void;
|
|
6
8
|
}
|
|
7
|
-
export declare function IDSHeader1177ProRegionPickerMobile({
|
|
9
|
+
export declare function IDSHeader1177ProRegionPickerMobile({ expanded, onToggleRegion, children, ...props }: IDSHeader1177ProRegionPickerMobileProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export declare namespace IDSHeader1177ProRegionPickerMobile {
|
|
9
11
|
var displayName: string;
|
|
10
12
|
}
|
|
@@ -4,7 +4,7 @@ import { useState } from 'react';
|
|
|
4
4
|
import { useHeaderContext } from '../utils/contexts/HeaderContext.js';
|
|
5
5
|
import { IDSHeader1177ProRegionPickerMobileBase } from './header-1177-pro-region-picker-mobile-base.js';
|
|
6
6
|
|
|
7
|
-
function IDSHeader1177ProRegionPickerMobile({
|
|
7
|
+
function IDSHeader1177ProRegionPickerMobile({ expanded = false, onToggleRegion, children, ...props }) {
|
|
8
8
|
const [isExpanded, setIsExpanded] = useState(expanded);
|
|
9
9
|
const headerContext = useHeaderContext();
|
|
10
10
|
if (headerContext?.hideRegionPicker)
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { HTMLAttributes } from "react";
|
|
2
2
|
export interface IDSHeader1177ProRegionPickerProps extends HTMLAttributes<HTMLElement> {
|
|
3
3
|
text?: string;
|
|
4
|
+
ariaControls?: string;
|
|
5
|
+
ariaLabel?: string;
|
|
4
6
|
expanded?: boolean;
|
|
5
7
|
onToggleRegion?: (isExpanded: boolean) => void;
|
|
6
8
|
}
|
|
7
|
-
export declare function IDSHeader1177ProRegionPicker({
|
|
9
|
+
export declare function IDSHeader1177ProRegionPicker({ expanded, onToggleRegion, children, ...props }: IDSHeader1177ProRegionPickerProps): import("react/jsx-runtime").JSX.Element;
|
|
8
10
|
export declare namespace IDSHeader1177ProRegionPicker {
|
|
9
11
|
var displayName: string;
|
|
10
12
|
}
|
|
@@ -4,7 +4,7 @@ import { useState } from 'react';
|
|
|
4
4
|
import { IDSHeader1177ProRegionPickerBase } from './header-1177-pro-region-picker-base.js';
|
|
5
5
|
import { useHeaderContext } from '../utils/contexts/HeaderContext.js';
|
|
6
6
|
|
|
7
|
-
function IDSHeader1177ProRegionPicker({
|
|
7
|
+
function IDSHeader1177ProRegionPicker({ expanded = false, onToggleRegion, children, ...props }) {
|
|
8
8
|
const [isExpanded, setIsExpanded] = useState(expanded);
|
|
9
9
|
const headerContext = useHeaderContext();
|
|
10
10
|
if (headerContext?.hideRegionPicker)
|
|
@@ -9,7 +9,7 @@ function IDSPopoverContent({ position = "bottom", caretPosition = "bottom", srCl
|
|
|
9
9
|
const renderCaret = (pos) => (jsxs("div", { className: `ids-popover-content__caret ids-popover-content__caret--${pos}`, children: [jsx("span", { className: `ids-popover-content__caret-body ids-popover-content__caret--${pos}` }), jsx("span", { className: `ids-popover-content__caret-border ids-popover-content__caret--${pos}` }), jsx("span", { className: `ids-popover-content__caret-shadow ids-popover-content__caret--${pos}` })] }));
|
|
10
10
|
return (jsxs("div", { ref: contentRef, style: style, className: clsx("ids-popover-content", `ids-popover-content--${position}`, {
|
|
11
11
|
"ids-focus-trap": !noFocusTrap
|
|
12
|
-
}), role: "tooltip", id: contentId, "data-position": position, children: [renderCaret(caretPosition), jsx("div", { className: "ids-popover-content__close-btn-wrapper", children: jsx("button", {
|
|
12
|
+
}), role: "tooltip", id: contentId, "data-position": position, children: [renderCaret(caretPosition), jsx("div", { className: "ids-popover-content__close-btn-wrapper", children: jsx("button", { className: "ids-popover-content__close-btn", "aria-label": srCloseText, ...closeHandler, ref: closeButtonRef }) }), jsx("div", { ref: scrollAreaRef, className: "ids-popover-content__content-wrapper", tabIndex: noScrollAreaFocus ? -1 : 0, style: contentScrollAreaStyle, children: jsxs("div", { className: "ids-popover-content__content-wrapper-inner", children: [!!headline && jsx("div", { className: "ids-popover-content__headline", children: headline }), children] }) })] }));
|
|
13
13
|
}
|
|
14
14
|
IDSPopoverContent.displayName = "IDSPopoverContent";
|
|
15
15
|
|
|
@@ -10,12 +10,13 @@ interface IDSPopoverProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
|
10
10
|
noFocusTrap?: boolean;
|
|
11
11
|
autoFocus?: boolean;
|
|
12
12
|
srCloseText?: string;
|
|
13
|
+
zIndex?: number;
|
|
13
14
|
noScrollAreaFocus?: boolean;
|
|
14
15
|
onVisibilityChange?: (isVisible: boolean) => void;
|
|
15
16
|
headline?: React.ReactNode;
|
|
16
17
|
children?: React.ReactNode;
|
|
17
18
|
}
|
|
18
|
-
export declare function IDSPopover({ position, category, trigger, maxWidth, maxHeight, show, noFocusTrap, autoFocus, noScrollAreaFocus, srCloseText, headline, children, className, onVisibilityChange, ...props }: IDSPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export declare function IDSPopover({ position, category, trigger, maxWidth, maxHeight, show, noFocusTrap, autoFocus, noScrollAreaFocus, srCloseText, zIndex, headline, children, className, onVisibilityChange, ...props }: IDSPopoverProps): import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
export declare namespace IDSPopover {
|
|
20
21
|
var displayName: string;
|
|
21
22
|
}
|
|
@@ -7,7 +7,7 @@ import { useFocusTrap } from '../utils/hooks/useFocusTrap.js';
|
|
|
7
7
|
import { IDSPopoverContent } from './popover-content.js';
|
|
8
8
|
import { useEsc } from '../utils/hooks/useEsc.js';
|
|
9
9
|
|
|
10
|
-
function IDSPopover({ position = "bottom", category = "", trigger, maxWidth = 260, maxHeight = 260, show = false, noFocusTrap = false, autoFocus = false, noScrollAreaFocus = false, srCloseText = "Stäng", headline, children, className, onVisibilityChange, ...props }) {
|
|
10
|
+
function IDSPopover({ position = "bottom", category = "", trigger, maxWidth = 260, maxHeight = 260, show = false, noFocusTrap = false, autoFocus = false, noScrollAreaFocus = false, srCloseText = "Stäng", zIndex = 9999, headline, children, className, onVisibilityChange, ...props }) {
|
|
11
11
|
const popoverRef = useRef(null);
|
|
12
12
|
const triggerRef = useRef(null);
|
|
13
13
|
const contentRef = useRef(null);
|
|
@@ -34,11 +34,6 @@ function IDSPopover({ position = "bottom", category = "", trigger, maxWidth = 26
|
|
|
34
34
|
setTimeout(() => requestAnimationFrame(() => setReady(true)), 100);
|
|
35
35
|
}
|
|
36
36
|
}, [isExpanded]);
|
|
37
|
-
useLayoutEffect(() => {
|
|
38
|
-
if (!ready)
|
|
39
|
-
return;
|
|
40
|
-
requestAnimationFrame(() => updatePosition());
|
|
41
|
-
}, [ready]);
|
|
42
37
|
const handleVisibilityChange = (visible) => {
|
|
43
38
|
setIsExpanded(visible);
|
|
44
39
|
onVisibilityChange?.(visible);
|
|
@@ -161,16 +156,35 @@ function IDSPopover({ position = "bottom", category = "", trigger, maxWidth = 26
|
|
|
161
156
|
});
|
|
162
157
|
}, [position]);
|
|
163
158
|
useLayoutEffect(() => {
|
|
164
|
-
if (!
|
|
159
|
+
if (!ready)
|
|
165
160
|
return;
|
|
166
|
-
updatePosition();
|
|
167
|
-
|
|
168
|
-
|
|
161
|
+
requestAnimationFrame(() => updatePosition());
|
|
162
|
+
}, [ready, updatePosition]);
|
|
163
|
+
useLayoutEffect(() => {
|
|
164
|
+
if (!isExpanded)
|
|
165
|
+
return;
|
|
166
|
+
const update = () => {
|
|
167
|
+
requestAnimationFrame(updatePosition);
|
|
168
|
+
};
|
|
169
|
+
update();
|
|
170
|
+
const observer = new ResizeObserver(update);
|
|
171
|
+
if (triggerRef.current)
|
|
172
|
+
observer.observe(triggerRef.current);
|
|
173
|
+
if (contentRef.current)
|
|
174
|
+
observer.observe(contentRef.current);
|
|
175
|
+
observer.observe(document.documentElement);
|
|
176
|
+
window.addEventListener("resize", update);
|
|
177
|
+
window.addEventListener("scroll", update, true);
|
|
178
|
+
window.visualViewport?.addEventListener("resize", update);
|
|
179
|
+
window.visualViewport?.addEventListener("scroll", update);
|
|
169
180
|
return () => {
|
|
170
|
-
|
|
171
|
-
window.removeEventListener("
|
|
181
|
+
observer.disconnect();
|
|
182
|
+
window.removeEventListener("resize", update);
|
|
183
|
+
window.removeEventListener("scroll", update, true);
|
|
184
|
+
window.visualViewport?.removeEventListener("resize", update);
|
|
185
|
+
window.visualViewport?.removeEventListener("scroll", update);
|
|
172
186
|
};
|
|
173
|
-
}, [isExpanded,
|
|
187
|
+
}, [isExpanded, updatePosition]);
|
|
174
188
|
return (jsxs("span", { "data-popover-category": category, ref: popoverRef, children: [jsx(IDSPopoverBase, { ...props, client: true, expanded: isExpanded, triggerRef: triggerRef, togglePopover: togglePopover, handleKeyPress: handleKeyPress, trigger: trigger, className: className }), mounted &&
|
|
175
189
|
isExpanded &&
|
|
176
190
|
createPortal(jsx(IDSPopoverContent, { client: true, headline: headline, contentRef: contentRef, scrollAreaRef: scrollAreaRef, noScrollAreaFocus: noScrollAreaFocus, caretPosition: position, srCloseText: srCloseText, closeButtonRef: closeButtonRef, closePopover: closePopover, contentScrollAreaStyle: {
|
|
@@ -181,7 +195,7 @@ function IDSPopover({ position = "bottom", category = "", trigger, maxWidth = 26
|
|
|
181
195
|
position: "absolute",
|
|
182
196
|
top: coords.top,
|
|
183
197
|
left: coords.left,
|
|
184
|
-
zIndex:
|
|
198
|
+
zIndex: zIndex
|
|
185
199
|
}, children: children }), document.body)] }));
|
|
186
200
|
}
|
|
187
201
|
IDSPopover.displayName = "IDSPopover";
|
|
@@ -9,8 +9,9 @@ export interface IDSPuffListItemProps extends React.HTMLAttributes<HTMLElement>
|
|
|
9
9
|
lean?: boolean;
|
|
10
10
|
dateLabel?: ReactNode;
|
|
11
11
|
extra?: ReactNode;
|
|
12
|
+
noListItem?: boolean;
|
|
12
13
|
}
|
|
13
|
-
export declare function IDSPuffListItem({ header, itemLink, date, dateTo, noContent, lean, dateLabel, extra, className, children, ...props }: IDSPuffListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function IDSPuffListItem({ header, itemLink, date, dateTo, noContent, lean, dateLabel, extra, noListItem, className, children, ...props }: IDSPuffListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export declare namespace IDSPuffListItem {
|
|
15
16
|
var displayName: string;
|
|
16
17
|
}
|
|
@@ -3,8 +3,8 @@ import { isValidElement, cloneElement } from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import '@inera/ids-design/components/puff-list/puff-list.css';
|
|
5
5
|
|
|
6
|
-
function IDSPuffListItem({ header, itemLink, date, dateTo, noContent = false, lean = false, dateLabel, extra, className, children, ...props }) {
|
|
7
|
-
const Tag = lean ? "div" : "li";
|
|
6
|
+
function IDSPuffListItem({ header, itemLink, date, dateTo, noContent = false, lean = false, dateLabel, extra, noListItem, className, children, ...props }) {
|
|
7
|
+
const Tag = noListItem || lean ? "div" : "li";
|
|
8
8
|
const content = (jsxs("div", { className: "ids-puff-list-item__inner", children: [dateLabel && jsx("div", { className: "ids-puff-list-item__date-label", children: dateLabel }), jsxs("div", { className: "ids-puff-list-item__content-wrapper", children: [jsxs("div", { className: "ids-puff-list-item__content", children: [!!date && date, !!date && !!dateTo && (jsxs(Fragment, { children: [jsx("span", { className: "ids-puff-list-item__date-spacer", children: "\u2015" }), dateTo] })), jsx("div", { className: "ids-puff-list-item-header", children: header }), !noContent && jsx("div", { className: "ids-puff-list-item__body", children: children })] }), extra && jsx("div", { className: "ids-puff-list-item__extra-content", children: extra })] })] }));
|
|
9
9
|
const wrappedContent = itemLink && isValidElement(itemLink)
|
|
10
10
|
? cloneElement(itemLink, {
|
|
@@ -18,6 +18,7 @@ export interface IDSSidePanelBaseProps extends React.HTMLAttributes<HTMLDivEleme
|
|
|
18
18
|
client?: boolean;
|
|
19
19
|
srClose?: string;
|
|
20
20
|
srOpen?: string;
|
|
21
|
+
noCloseButton?: boolean;
|
|
21
22
|
noScrollAreaFocus?: boolean;
|
|
22
23
|
hamburgerRef?: React.Ref<HTMLButtonElement>;
|
|
23
24
|
componentRef?: React.Ref<HTMLDivElement>;
|