@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
|
@@ -9,12 +9,13 @@ interface IDSAccordionBaseProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
9
9
|
headlineSize?: "m" | "s" | "xs";
|
|
10
10
|
lean?: boolean;
|
|
11
11
|
noBorder?: boolean;
|
|
12
|
+
hasChildren?: boolean;
|
|
12
13
|
children?: ReactNode;
|
|
13
14
|
onToggleAccordion?: () => void;
|
|
14
15
|
client?: boolean;
|
|
15
16
|
accordionRef?: React.Ref<HTMLDivElement>;
|
|
16
17
|
}
|
|
17
|
-
export declare function IDSAccordionBase({ headline, subtitle, expanded, level, headlineSize, lean, noBorder, onToggleAccordion, client, children, className, accordionRef, ...props }: IDSAccordionBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export declare function IDSAccordionBase({ headline, subtitle, expanded, level, headlineSize, lean, noBorder, onToggleAccordion, client, hasChildren, children, className, accordionRef, ...props }: IDSAccordionBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
18
19
|
export declare namespace IDSAccordionBase {
|
|
19
20
|
var displayName: string;
|
|
20
21
|
}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import
|
|
3
|
+
import { useId } from 'react';
|
|
4
4
|
import '@inera/ids-design/components/accordion/accordion.css';
|
|
5
5
|
|
|
6
|
-
function IDSAccordionBase({ headline, subtitle, expanded = false, level = 1, headlineSize = "m", lean = false, noBorder, onToggleAccordion, client = false, children, className, accordionRef, ...props }) {
|
|
6
|
+
function IDSAccordionBase({ headline, subtitle, expanded = false, level = 1, headlineSize = "m", lean = false, noBorder, onToggleAccordion, client = false, hasChildren = false, children, className, accordionRef, ...props }) {
|
|
7
7
|
const reactId = useId();
|
|
8
8
|
const headerId = `accordion-header-${reactId}`;
|
|
9
9
|
const contentId = `accordion-content-${reactId}`;
|
|
10
|
-
const hasChildren = !!React.Children.toArray(children).length;
|
|
11
10
|
const handleKeyDown = (e) => {
|
|
12
11
|
if (!onToggleAccordion)
|
|
13
12
|
return;
|
|
@@ -52,7 +51,7 @@ function IDSAccordionBase({ headline, subtitle, expanded = false, level = 1, hea
|
|
|
52
51
|
"ids-accordion--lean": lean,
|
|
53
52
|
"ids-accordion--has-children": !!hasChildren,
|
|
54
53
|
"ids-accordion--is-child": level === 2
|
|
55
|
-
}, className), children: [jsx("
|
|
54
|
+
}, className), children: [jsx("button", { className: clsx("ids-accordion__button", `ids-accordion__button--${headlineSize}`), type: "button", "data-accordion-header": true, "aria-expanded": expanded, "aria-controls": contentId, ...toggleHandlers, children: jsxs("div", { id: headerId, className: clsx("ids-accordion__headline", `ids-accordion__headline-${level}`, `ids-accordion__headline--${headlineSize}`, expanded && "ids-accordion__headline--expanded"), children: [headline, !!subtitle && jsx("div", { className: "ids-accordion__subtitle", children: subtitle })] }) }), jsx("div", { "aria-hidden": !expanded, id: contentId, "aria-labelledby": headerId, role: "region", className: "ids-accordion__content", children: jsx("div", { "data-accordion-root": true, children: children }) })] }));
|
|
56
55
|
}
|
|
57
56
|
IDSAccordionBase.displayName = "IDSAccordionBase";
|
|
58
57
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
import { useState, useRef, useEffect } from 'react';
|
|
3
|
+
import React, { useState, useRef, useEffect } from 'react';
|
|
4
4
|
import { IDSAccordionBase } from './accordion-base.js';
|
|
5
5
|
|
|
6
6
|
function IDSAccordion({ headline, subtitle, accordions, level = 1, headlineSize = level === 2 ? "s" : "m", expanded, defaultExpanded = false, lean = false, noBorder = false, onCollapsed, onExpanded, onExpandedChange, children, ...props }) {
|
|
@@ -9,6 +9,9 @@ function IDSAccordion({ headline, subtitle, accordions, level = 1, headlineSize
|
|
|
9
9
|
const [isLean, setIsLean] = useState(lean);
|
|
10
10
|
const accordionRef = useRef(null);
|
|
11
11
|
const isExpanded = isControlled ? expanded : internalExpanded;
|
|
12
|
+
const hasChildren = React.Children.toArray(children).some((child) => {
|
|
13
|
+
return React.isValidElement(child) && child.type === IDSAccordion;
|
|
14
|
+
});
|
|
12
15
|
useEffect(() => {
|
|
13
16
|
if (level === 1 && accordionRef.current?.closest(".ids-card") && !accordions) {
|
|
14
17
|
setIsLean(true);
|
|
@@ -25,7 +28,7 @@ function IDSAccordion({ headline, subtitle, accordions, level = 1, headlineSize
|
|
|
25
28
|
else
|
|
26
29
|
onCollapsed?.();
|
|
27
30
|
};
|
|
28
|
-
return (jsx(IDSAccordionBase, { ...props, client: true, accordionRef: accordionRef, headline: headline, subtitle: subtitle, level: level, headlineSize: headlineSize, expanded: isExpanded, lean: isLean, noBorder: noBorder, onToggleAccordion: toggleExpanded, children: children }));
|
|
31
|
+
return (jsx(IDSAccordionBase, { ...props, client: true, accordionRef: accordionRef, headline: headline, subtitle: subtitle, level: level, headlineSize: headlineSize, hasChildren: hasChildren, expanded: isExpanded, lean: isLean, noBorder: noBorder, onToggleAccordion: toggleExpanded, children: children }));
|
|
29
32
|
}
|
|
30
33
|
IDSAccordion.displayName = "IDSAccordion";
|
|
31
34
|
|
|
@@ -21,9 +21,9 @@ function IDSAlertBase({ collapsible = false, ribbon = false, collapsed = false,
|
|
|
21
21
|
"ids-alert--ribbon": ribbon,
|
|
22
22
|
"ids-alert--compact": compact,
|
|
23
23
|
"ids-alert--dismissible": dismissible
|
|
24
|
-
}, className), children: compact || ribbon ? (jsxs(Fragment, { children: [jsxs("div", { className: "ids-alert__content", children: [jsx("span", { className: "ids-alert__content-icon", "aria-hidden": "true" }), jsx("span", { className: "ids-alert__content-text", children: children })] }), dismissible && (jsx("
|
|
24
|
+
}, className), children: compact || ribbon ? (jsxs(Fragment, { children: [jsxs("div", { className: "ids-alert__content", children: [jsx("span", { className: "ids-alert__content-icon", "aria-hidden": "true" }), jsx("span", { className: "ids-alert__content-text", children: children })] }), dismissible && (jsx("div", { className: "ids-alert__button", children: jsx("button", { className: "ids-alert__close", "aria-label": srCloseText, ...closeHandler }) }))] })) : (jsxs(Fragment, { children: [jsxs("div", { className: "ids-alert__header", children: [collapsible && !compact && !ribbon && (jsx("button", { type: "button", className: clsx("ids-alert__expand-button", {
|
|
25
25
|
"ids-alert__expand-button--expanded": !collapsed
|
|
26
|
-
}), ...toggleHandler, "aria-controls": contentId, "aria-expanded": !collapsed, children: jsxs("div", { className: "ids-alert__icon_and_text", children: [jsx("span", { className: "ids-alert__state-icon", "aria-hidden": "true" }), jsx("div", { className: "ids-alert__headline", children: collapsableHeadline }), jsx("span", { className: "ids-alert__sr-only", children: collapsed ? srExpandText : srCollapseText })] }) })), !collapsible && (jsxs("div", { className: "ids-alert__icon_and_text", children: [jsx("span", { className: "ids-alert__state-icon", "aria-hidden": "true" }), jsx("div", { className: "ids-alert__headline", children: headline })] })), dismissible && !collapsible && (jsx("
|
|
26
|
+
}), ...toggleHandler, "aria-controls": contentId, "aria-expanded": !collapsed, children: jsxs("div", { className: "ids-alert__icon_and_text", children: [jsx("span", { className: "ids-alert__state-icon", "aria-hidden": "true" }), jsx("div", { className: "ids-alert__headline", children: collapsableHeadline }), jsx("span", { className: "ids-alert__sr-only", children: collapsed ? srExpandText : srCollapseText })] }) })), !collapsible && (jsxs("div", { className: "ids-alert__icon_and_text", children: [jsx("span", { className: "ids-alert__state-icon", "aria-hidden": "true" }), jsx("div", { className: "ids-alert__headline", children: headline })] })), dismissible && !collapsible && (jsx("div", { className: "ids-alert__button", children: jsx("button", { className: "ids-alert__close", "aria-label": srCloseText, ...closeHandler }) }))] }), jsx("div", { id: contentId, children: !collapsed && jsx("div", { className: "ids-alert__content", children: children }) })] })) }));
|
|
27
27
|
}
|
|
28
28
|
IDSAlertBase.displayName = "IDSAlertBase";
|
|
29
29
|
|
|
@@ -37,7 +37,12 @@ function IDSBreadcrumbs({ lead = "Du är här", mobileLink, children, className,
|
|
|
37
37
|
return links.flatMap((child, index) => {
|
|
38
38
|
const isLast = index === links.length - 1;
|
|
39
39
|
if (isLast) {
|
|
40
|
-
|
|
40
|
+
const currentChild = React.isValidElement(child)
|
|
41
|
+
? React.cloneElement(child, {
|
|
42
|
+
"aria-current": "page"
|
|
43
|
+
})
|
|
44
|
+
: child;
|
|
45
|
+
return (jsx("li", { className: "ids-breadcrumbs__crumb ids-breadcrumbs__crumb--current", "data-crumb": true, children: currentChild }, index));
|
|
41
46
|
}
|
|
42
47
|
else {
|
|
43
48
|
return (jsxs("li", { className: "ids-breadcrumbs__crumb", "data-crumb": true, children: [child, jsx("span", { className: "ids-breadcrumbs__crumb__separator", "aria-hidden": "true", children: "/" })] }, index));
|
|
@@ -3,7 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
4
|
import { IDSSpinner } from '../form/spinner/spinner.js';
|
|
5
5
|
|
|
6
|
-
const IDSButton = forwardRef(({ active = false, block = false, disabled = false, fab = false, iconButton = false, icon = "", mBlock = false, sBlock = false, loading = false, tertiary = false, secondary = false, size = "m", submit = false, toggle = false, focusAnchor = false, children, className, ...props }, ref) => {
|
|
6
|
+
const IDSButton = forwardRef(({ active = false, block = false, disabled = false, fab = false, iconButton = false, icon = "", endIcon = "", mBlock = false, sBlock = false, loading = false, tertiary = false, secondary = false, size = "m", submit = false, toggle = false, focusAnchor = false, children, className, ...props }, ref) => {
|
|
7
7
|
let classNames;
|
|
8
8
|
if (fab) {
|
|
9
9
|
classNames = clsx("ids-button", {
|
|
@@ -26,7 +26,7 @@ const IDSButton = forwardRef(({ active = false, block = false, disabled = false,
|
|
|
26
26
|
"ids-focus-anchor": focusAnchor
|
|
27
27
|
}, className);
|
|
28
28
|
}
|
|
29
|
-
return (jsxs("button", { ...props, ref: ref, className: classNames, "aria-disabled": disabled || loading, ...(toggle ? { "aria-pressed": active } : {}), tabIndex: !disabled && !loading ? 0 : -1, disabled: disabled, children: [icon && jsx("span", { className: `ids-icon-${icon}
|
|
29
|
+
return (jsxs("button", { ...props, ref: ref, className: classNames, "aria-disabled": disabled || loading, ...(toggle ? { "aria-pressed": active } : {}), tabIndex: !disabled && !loading ? 0 : -1, disabled: disabled, children: [icon && jsx("span", { className: `ids-icon-${icon}`, "aria-hidden": "true" }), loading && jsx(IDSSpinner, { variant: !secondary && !tertiary ? "3" : "2" }), !loading && children, endIcon && jsx("span", { className: `ids-icon-${endIcon}` })] }));
|
|
30
30
|
});
|
|
31
31
|
IDSButton.displayName = "IDSButton";
|
|
32
32
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from "react";
|
|
2
|
+
export interface IDSControlButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
3
|
+
icon: string;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare const IDSControlButton: import("react").ForwardRefExoticComponent<IDSControlButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { forwardRef } from 'react';
|
|
3
|
+
|
|
4
|
+
const IDSControlButton = forwardRef(({ disabled = false, icon, className, ...props }, ref) => {
|
|
5
|
+
return (jsx("button", { className: "ids-control-button", ...props, ref: ref, "aria-disabled": disabled, disabled: disabled, children: jsx("span", { className: `ids-icon-${icon}`, "aria-hidden": "true" }) }));
|
|
6
|
+
});
|
|
7
|
+
IDSControlButton.displayName = "IDSControlButton";
|
|
8
|
+
|
|
9
|
+
export { IDSControlButton };
|
|
@@ -23,7 +23,7 @@ function IDSCarousel({ srNextLabel = "Nästa", srPrevLabel = "Föregående", cla
|
|
|
23
23
|
// Validate slide count
|
|
24
24
|
useEffect(() => {
|
|
25
25
|
if (slideCount < 3) {
|
|
26
|
-
console.warn("Carousel requires at least
|
|
26
|
+
console.warn("Carousel requires at least 4 carousel-items");
|
|
27
27
|
}
|
|
28
28
|
}, [slideCount]);
|
|
29
29
|
// Initial setup
|
|
@@ -20,7 +20,7 @@ const IDSDialogBase = forwardRef(({ show = false, width, maxWidth, height, headl
|
|
|
20
20
|
"ids-dialog--hidden": !show,
|
|
21
21
|
"ids-focus-trap": !noFocusTrap,
|
|
22
22
|
"ids-dialog--dismissible": !!dismissible
|
|
23
|
-
}, className), ref: ref, role: "dialog", "aria-modal": "true", "aria-labelledby": headline ? headlineId : undefined, style: { width, maxWidth, height, maxHeight: height || undefined }, children: [dismissible && (jsx("div", { className: "ids-dialog__dismissible", children: jsx("button", { "aria-label": srClose, ...closeHandler
|
|
23
|
+
}, className), ref: ref, role: "dialog", "aria-modal": "true", "aria-labelledby": headline ? headlineId : undefined, style: { width, maxWidth, height, maxHeight: height || undefined }, children: [dismissible && (jsx("div", { className: "ids-dialog__dismissible", children: jsx("button", { className: "ids-dialog__close-button", "aria-label": srClose, ...closeHandler }) })), jsxs("div", { ref: scrollAreaRef, className: clsx("ids-dialog__body", {
|
|
24
24
|
"ids-dialog__body--scroll-area-focus": !noScrollAreaFocus
|
|
25
25
|
}), tabIndex: noScrollAreaFocus ? -1 : 0, children: [jsx("div", { className: "ids-dialog__body-headline", id: headlineId, children: headline }), jsx("div", { className: "ids-dialog__body-content", children: children }), actions && jsx("div", { className: "ids-dialog__footer", children: actions })] })] })] }));
|
|
26
26
|
});
|
|
@@ -16,13 +16,12 @@ function IDSCheckboxBase({ invalid, disabled, required, indeterminate, light, bl
|
|
|
16
16
|
return (jsxs("div", { className: clsx("ids-checkbox-component", className), style: { display: "inline-flex", flexDirection: "column", gap: showErrorMsg ? "0.5rem" : "" }, "data-testid": dataTestId, children: [jsxs("div", { className: clsx("ids-checkbox", {
|
|
17
17
|
"ids-checkbox--light": light,
|
|
18
18
|
"ids-checkbox--block": block
|
|
19
|
-
}),
|
|
19
|
+
}), children: [jsx("input", { id: inputId, ref: inputRef, type: "checkbox", className: clsx("ids-checkbox__input", {
|
|
20
20
|
"ids-focus-anchor": focusAnchor
|
|
21
21
|
}), "aria-invalid": invalid, disabled: disabled, required: required, ...ariaErrorHandler, ...ariaCheckedHandler, ...props }), !!children && (jsxs("div", { className: clsx("ids-label-wrapper", {
|
|
22
22
|
"ids-label-wrapper--block": block
|
|
23
23
|
}), children: [jsx("label", { htmlFor: inputId, className: clsx("ids-checkbox__label ids-label", {
|
|
24
|
-
"ids-label--clickable": !disabled
|
|
25
|
-
"ids-label--disabled": disabled
|
|
24
|
+
"ids-label--clickable": !disabled
|
|
26
25
|
}), children: children }), tooltip && jsx("span", { className: "ids-label__tooltip", children: tooltip })] }))] }), showErrorMsg && (jsx(IDSErrorMessage, { id: baseErrorMsgId, show: true, children: errorMsg }))] }));
|
|
27
26
|
}
|
|
28
27
|
IDSCheckboxBase.displayName = "IDSCheckboxBase";
|
|
@@ -9,8 +9,9 @@ export interface IDSCheckboxGroupBaseProps extends InputHTMLAttributes<HTMLField
|
|
|
9
9
|
invalid?: boolean;
|
|
10
10
|
errorMsgId?: string;
|
|
11
11
|
groupRef?: React.Ref<HTMLFieldSetElement>;
|
|
12
|
+
subtitle?: string | ReactNode;
|
|
12
13
|
}
|
|
13
|
-
export declare function IDSCheckboxGroupBase({ legend, errorMsg, compact, hideLegend, tooltip, children, className, invalid, errorMsgId, groupRef, ...props }: IDSCheckboxGroupBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare function IDSCheckboxGroupBase({ legend, errorMsg, subtitle, compact, hideLegend, tooltip, children, className, invalid, errorMsgId, groupRef, ...props }: IDSCheckboxGroupBaseProps): import("react/jsx-runtime").JSX.Element;
|
|
14
15
|
export declare namespace IDSCheckboxGroupBase {
|
|
15
16
|
var displayName: string;
|
|
16
17
|
}
|
|
@@ -3,13 +3,13 @@ import { useId } from 'react';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
import { IDSErrorMessage } from '../error-message/error-message.js';
|
|
5
5
|
|
|
6
|
-
function IDSCheckboxGroupBase({ legend, errorMsg = "", compact = false, hideLegend, tooltip, children, className, invalid = false, errorMsgId, groupRef, ...props }) {
|
|
6
|
+
function IDSCheckboxGroupBase({ legend, errorMsg = "", subtitle, compact = false, hideLegend, tooltip, children, className, invalid = false, errorMsgId, groupRef, ...props }) {
|
|
7
7
|
const baseErrorMsgId = errorMsgId ?? `checkbox-group-base-error-${useId()}`;
|
|
8
8
|
return (jsxs("fieldset", { ref: groupRef, "aria-describedby": invalid && errorMsg ? baseErrorMsgId : undefined, className: clsx("ids-form-group__fieldset", {
|
|
9
9
|
"ids-form-group__fieldset--compact": compact
|
|
10
|
-
}, className), ...props, children: [legend && (
|
|
10
|
+
}, className), ...props, children: [legend && (jsxs("div", { className: clsx("ids-label-wrapper", {
|
|
11
11
|
"ids-label-wrapper--sr-only": hideLegend
|
|
12
|
-
}, className), children: jsxs("legend", { children: [legend, tooltip && jsx("span", { className: "ids-legend__tooltip", children: tooltip })] }) })), children, invalid && !!errorMsg && (jsx(IDSErrorMessage, { id: baseErrorMsgId, show: true, compact: true, style: { marginTop: compact ? "0.75rem" : "auto" }, children: errorMsg }))] }));
|
|
12
|
+
}, className), children: [jsxs("legend", { children: [legend, tooltip && jsx("span", { className: "ids-legend__tooltip", children: tooltip })] }), subtitle && jsx("div", { className: "ids-subtitle ids-subtitle--group", children: subtitle })] })), children, invalid && !!errorMsg && (jsx(IDSErrorMessage, { id: baseErrorMsgId, show: true, compact: true, style: { marginTop: compact ? "0.75rem" : "auto" }, children: errorMsg }))] }));
|
|
13
13
|
}
|
|
14
14
|
IDSCheckboxGroupBase.displayName = "IDSCheckboxGroupBase";
|
|
15
15
|
|
|
@@ -8,10 +8,11 @@ export interface IDSCheckboxGroupProps extends InputHTMLAttributes<HTMLFieldSetE
|
|
|
8
8
|
tooltip?: ReactNode;
|
|
9
9
|
block?: boolean;
|
|
10
10
|
noValidation?: boolean;
|
|
11
|
+
subtitle?: string | ReactNode;
|
|
11
12
|
children?: ReactNode;
|
|
12
13
|
onValidityChange?: (isValid: boolean) => void;
|
|
13
14
|
}
|
|
14
|
-
export declare function IDSCheckboxGroup({ errorMsg, block, invalid, noValidation, onValidityChange, children, ...props }: IDSCheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function IDSCheckboxGroup({ errorMsg, block, invalid, subtitle, noValidation, onValidityChange, children, ...props }: IDSCheckboxGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export declare namespace IDSCheckboxGroup {
|
|
16
17
|
var displayName: string;
|
|
17
18
|
}
|
|
@@ -5,7 +5,7 @@ import { IDSCheckboxGroupBase } from './checkbox-group-base.js';
|
|
|
5
5
|
import { IDSCheckbox } from './checkbox.js';
|
|
6
6
|
import { useGroupValidity } from '../form-hooks/useGroupValidity.js';
|
|
7
7
|
|
|
8
|
-
function IDSCheckboxGroup({ errorMsg = "", block, invalid, noValidation = false, onValidityChange, children, ...props }) {
|
|
8
|
+
function IDSCheckboxGroup({ errorMsg = "", block, invalid, subtitle, noValidation = false, onValidityChange, children, ...props }) {
|
|
9
9
|
const groupRef = useRef(null);
|
|
10
10
|
const errorMsgId = useId();
|
|
11
11
|
const { isValid, hasInteracted } = useGroupValidity(groupRef, "checkbox", () => {
|
|
@@ -34,7 +34,7 @@ function IDSCheckboxGroup({ errorMsg = "", block, invalid, noValidation = false,
|
|
|
34
34
|
}
|
|
35
35
|
return child;
|
|
36
36
|
});
|
|
37
|
-
return (jsx(IDSCheckboxGroupBase, { ...props, groupRef: groupRef, invalid: groupInvalid || invalid, errorMsgId: errorMsgId, errorMsg: !noValidation && errorMsg, children: clonedChildren }));
|
|
37
|
+
return (jsx(IDSCheckboxGroupBase, { ...props, groupRef: groupRef, invalid: groupInvalid || invalid, errorMsgId: errorMsgId, errorMsg: !noValidation && errorMsg, subtitle: subtitle, children: clonedChildren }));
|
|
38
38
|
}
|
|
39
39
|
IDSCheckboxGroup.displayName = "IDSCheckboxGroup";
|
|
40
40
|
|
|
@@ -4,10 +4,9 @@ import { forwardRef, useRef, useEffect } from 'react';
|
|
|
4
4
|
import { IDSCheckboxBase } from './checkbox-base.js';
|
|
5
5
|
import { useInputValidity } from '../form-hooks/useInputValidity.js';
|
|
6
6
|
|
|
7
|
-
const IDSCheckbox = forwardRef(({ invalid = false, noValidation = false, indeterminate = false, children, ...props }, ref) => {
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const hasValidValue = useInputValidity(checkboxRef);
|
|
7
|
+
const IDSCheckbox = forwardRef(({ invalid = false, noValidation = false, indeterminate = false, validationOnBlur = false, children, ...props }, ref) => {
|
|
8
|
+
const checkboxRef = useRef(null);
|
|
9
|
+
const hasValidValue = useInputValidity(checkboxRef, validationOnBlur, noValidation);
|
|
11
10
|
const computedInvalid = (invalid || !hasValidValue) && !noValidation;
|
|
12
11
|
// Merge forwarded + local ref
|
|
13
12
|
const mergedRef = (node) => {
|
|
@@ -21,13 +21,15 @@ export interface IDSDatePickerProps extends Omit<React.InputHTMLAttributes<HTMLI
|
|
|
21
21
|
invalidDateErrorMsg?: string;
|
|
22
22
|
disableNavigation?: boolean;
|
|
23
23
|
noValidation?: boolean;
|
|
24
|
+
readOnly?: boolean;
|
|
25
|
+
dataTestId?: string;
|
|
24
26
|
modifiers?: Record<string, Matcher | Matcher[]>;
|
|
25
27
|
onChange?: (event: IDSDatePickerChangeEvent) => void;
|
|
26
28
|
onOpen?: () => void;
|
|
27
29
|
onClose?: () => void;
|
|
28
30
|
onDayClick?: (date: Date, modifiers: Modifiers, e: React.MouseEvent) => void;
|
|
29
31
|
}
|
|
30
|
-
export declare function IDSDatePicker({ label, id, value, light, placeholder, errorMsg, missingDateErrorMsg, invalidDateErrorMsg, calendarHeader, srOpenText, srCloseText, validationOnBlur, defaultMonth, startMonth, endMonth, noValidation, disabled, required, invalid, tooltip, disableNavigation, modifiers, focusedDay, onChange, onFocus, onBlur, onOpen, onClose, onDayClick, className, ...props }: IDSDatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
32
|
+
export declare function IDSDatePicker({ label, id, value, light, placeholder, subtitle, dataTestId, errorMsg, missingDateErrorMsg, invalidDateErrorMsg, calendarHeader, srOpenText, srCloseText, validationOnBlur, defaultMonth, startMonth, endMonth, noValidation, disabled, required, invalid, readOnly, tooltip, disableNavigation, modifiers, focusedDay, onChange, onFocus, onBlur, onOpen, onClose, onDayClick, className, ...props }: IDSDatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
31
33
|
export declare namespace IDSDatePicker {
|
|
32
34
|
var displayName: string;
|
|
33
35
|
}
|