@inera/ids-react 6.1.0 → 7.0.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.d.ts +1 -1
- package/components/accordion/accordion.js +6 -7
- package/components/agent/agent.d.ts +1 -1
- package/components/agent/agent.js +2 -2
- package/components/alert/alert.d.ts +1 -1
- package/components/alert/alert.js +9 -2
- package/components/alert-global/alert-global.d.ts +2 -2
- package/components/alert-global/alert-global.js +6 -7
- package/components/badge/badge.d.ts +4 -3
- package/components/badge/badge.js +4 -3
- package/components/box-link/box-link.d.ts +11 -3
- package/components/box-link/box-link.js +9 -9
- package/components/breadcrumbs/breadcrumbs.d.ts +1 -1
- package/components/breadcrumbs/breadcrumbs.js +4 -2
- package/components/button/button.d.ts +23 -5
- package/components/button/button.js +94 -11
- package/components/button-group/button-group.d.ts +13 -3
- package/components/button-group/button-group.js +10 -9
- package/components/card/card.d.ts +4 -3
- package/components/card/card.js +16 -8
- package/components/carousel/carousel-item.d.ts +10 -0
- package/components/carousel/carousel-item.js +24 -0
- package/components/carousel/carousel.d.ts +11 -5
- package/components/carousel/carousel.js +167 -16
- package/components/date-label/date-label.d.ts +2 -2
- package/components/date-label/date-label.js +4 -40
- package/components/dialog/dialog.d.ts +23 -6
- package/components/dialog/dialog.js +75 -13
- package/components/dropdown/dropdown-content-link.d.ts +6 -0
- package/components/dropdown/dropdown-content-link.js +20 -0
- package/components/dropdown/dropdown.d.ts +16 -8
- package/components/dropdown/dropdown.js +72 -20
- package/components/footer-1177/footer-1177.d.ts +23 -3
- package/components/footer-1177/footer-1177.js +64 -9
- package/components/footer-1177-admin/footer-1177-admin.d.ts +21 -3
- package/components/footer-1177-admin/footer-1177-admin.js +63 -9
- package/components/footer-1177-pro/footer-1177-pro.d.ts +17 -3
- package/components/footer-1177-pro/footer-1177-pro.js +39 -9
- package/components/footer-inera/footer-inera.d.ts +23 -3
- package/components/footer-inera/footer-inera.js +64 -9
- package/components/footer-inera-admin/footer-inera-admin.d.ts +23 -3
- package/components/footer-inera-admin/footer-inera-admin.js +61 -9
- package/components/form/check-button/check-button.d.ts +7 -3
- package/components/form/check-button/check-button.js +8 -5
- package/components/form/checkbox/checkbox-group.d.ts +13 -3
- package/components/form/checkbox/checkbox-group.js +51 -9
- package/components/form/checkbox/checkbox.d.ts +17 -3
- package/components/form/checkbox/checkbox.js +50 -5
- package/components/form/error-message/error-message.d.ts +10 -0
- package/components/form/error-message/error-message.js +12 -0
- package/components/form/form-hooks/useAriaDescribedBy.d.ts +1 -0
- package/components/form/form-hooks/useAriaDescribedBy.js +26 -0
- package/components/form/form-hooks/useGroupValidity.d.ts +1 -0
- package/components/form/form-hooks/useGroupValidity.js +60 -0
- package/components/form/form-hooks/useInputValidity.d.ts +1 -0
- package/components/form/form-hooks/useInputValidity.js +27 -0
- package/components/form/input/input.d.ts +22 -3
- package/components/form/input/input.js +51 -9
- package/components/form/radio/radio-group.d.ts +13 -3
- package/components/form/radio/radio-group.js +28 -5
- package/components/form/radio/radio.d.ts +17 -3
- package/components/form/radio/radio.js +23 -9
- package/components/form/radio-button/radio-button-group.d.ts +9 -0
- package/components/form/radio-button/radio-button-group.js +22 -0
- package/components/form/radio-button/radio-button.d.ts +9 -0
- package/components/form/radio-button/radio-button.js +13 -0
- package/components/form/range/range.d.ts +16 -3
- package/components/form/range/range.js +29 -9
- package/components/form/select/select.d.ts +15 -3
- package/components/form/select/select.js +19 -9
- package/components/form/select-multiple/select-multiple.d.ts +18 -3
- package/components/form/select-multiple/select-multiple.js +60 -9
- package/components/form/spinner/spinner.d.ts +9 -3
- package/components/form/spinner/spinner.js +9 -9
- package/components/form/textarea/textarea.d.ts +18 -3
- package/components/form/textarea/textarea.js +26 -9
- package/components/form/time/time.d.ts +13 -3
- package/components/form/time/time.js +21 -9
- package/components/form/toggle/toggle.d.ts +8 -3
- package/components/form/toggle/toggle.js +10 -9
- package/components/grid/column.d.ts +16 -0
- package/components/grid/column.js +13 -0
- package/components/grid/container.d.ts +9 -0
- package/components/grid/container.js +24 -0
- package/components/grid/row.d.ts +9 -0
- package/components/grid/row.js +18 -0
- package/components/header-1177/header-1177-avatar.d.ts +10 -2
- package/components/header-1177/header-1177-avatar.js +30 -8
- package/components/header-1177/header-1177-item.d.ts +12 -2
- package/components/header-1177/header-1177-item.js +25 -8
- package/components/header-1177/header-1177-menu-mobile.d.ts +11 -0
- package/components/header-1177/header-1177-menu-mobile.js +42 -0
- package/components/header-1177/header-1177-nav-item-mobile.d.ts +11 -2
- package/components/header-1177/header-1177-nav-item-mobile.js +24 -8
- package/components/header-1177/header-1177-nav-item.d.ts +15 -2
- package/components/header-1177/header-1177-nav-item.js +22 -8
- package/components/header-1177/header-1177-nav.d.ts +8 -2
- package/components/header-1177/header-1177-nav.js +14 -8
- package/components/header-1177/header-1177.d.ts +22 -5
- package/components/header-1177/header-1177.js +41 -12
- package/components/header-1177-admin/header-1177-admin-avatar-mobile.d.ts +9 -2
- package/components/header-1177-admin/header-1177-admin-avatar-mobile.js +6 -8
- package/components/header-1177-admin/header-1177-admin-avatar.d.ts +10 -2
- package/components/header-1177-admin/header-1177-admin-avatar.js +31 -8
- package/components/header-1177-admin/header-1177-admin-item.d.ts +12 -2
- package/components/header-1177-admin/header-1177-admin-item.js +26 -8
- package/components/header-1177-admin/header-1177-admin-nav-item.d.ts +15 -2
- package/components/header-1177-admin/header-1177-admin-nav-item.js +24 -8
- package/components/header-1177-admin/header-1177-admin-nav.d.ts +7 -2
- package/components/header-1177-admin/header-1177-admin-nav.js +12 -8
- package/components/header-1177-admin/header-1177-admin.d.ts +22 -3
- package/components/header-1177-admin/header-1177-admin.js +26 -9
- package/components/header-1177-pro/header-1177-pro-avatar-mobile.d.ts +9 -2
- package/components/header-1177-pro/header-1177-pro-avatar-mobile.js +6 -8
- package/components/header-1177-pro/header-1177-pro-avatar.d.ts +10 -2
- package/components/header-1177-pro/header-1177-pro-avatar.js +31 -8
- package/components/header-1177-pro/header-1177-pro-item.d.ts +12 -2
- package/components/header-1177-pro/header-1177-pro-item.js +23 -8
- package/components/header-1177-pro/header-1177-pro-nav-item.d.ts +15 -2
- package/components/header-1177-pro/header-1177-pro-nav-item.js +33 -8
- package/components/header-1177-pro/header-1177-pro-nav-menu-mobile.d.ts +11 -5
- package/components/header-1177-pro/header-1177-pro-nav-menu-mobile.js +32 -12
- package/components/header-1177-pro/header-1177-pro-nav.d.ts +10 -2
- package/components/header-1177-pro/header-1177-pro-nav.js +27 -8
- package/components/header-1177-pro/header-1177-pro.d.ts +23 -5
- package/components/header-1177-pro/header-1177-pro.js +37 -12
- package/components/header-inera/header-inera-item.d.ts +13 -2
- package/components/header-inera/header-inera-item.js +24 -8
- package/components/header-inera/header-inera-nav-item.d.ts +15 -2
- package/components/header-inera/header-inera-nav-item.js +54 -8
- package/components/header-inera/header-inera-nav-mobile.d.ts +11 -5
- package/components/header-inera/header-inera-nav-mobile.js +44 -12
- package/components/header-inera/header-inera-nav.d.ts +7 -2
- package/components/header-inera/header-inera-nav.js +13 -8
- package/components/header-inera/header-inera.d.ts +16 -3
- package/components/header-inera/header-inera.js +16 -9
- package/components/header-inera-admin/header-inera-admin-avatar-mobile.d.ts +9 -2
- package/components/header-inera-admin/header-inera-admin-avatar-mobile.js +11 -8
- package/components/header-inera-admin/header-inera-admin-avatar.d.ts +12 -2
- package/components/header-inera-admin/header-inera-admin-avatar.js +32 -8
- package/components/header-inera-admin/header-inera-admin-item.d.ts +13 -2
- package/components/header-inera-admin/header-inera-admin-item.js +24 -8
- package/components/header-inera-admin/header-inera-admin-nav-item.d.ts +16 -2
- package/components/header-inera-admin/header-inera-admin-nav-item.js +54 -8
- package/components/header-inera-admin/header-inera-admin-nav-mobile.d.ts +12 -5
- package/components/header-inera-admin/header-inera-admin-nav-mobile.js +32 -12
- package/components/header-inera-admin/header-inera-admin-nav.d.ts +8 -2
- package/components/header-inera-admin/header-inera-admin-nav.js +13 -8
- package/components/header-inera-admin/header-inera-admin.d.ts +15 -3
- package/components/header-inera-admin/header-inera-admin.js +24 -9
- package/components/header-patient/header-patient.d.ts +13 -0
- package/components/header-patient/header-patient.js +21 -0
- package/components/link/link.d.ts +17 -3
- package/components/link/link.js +42 -9
- package/components/mobile/menu/item/mobile-item.d.ts +15 -4
- package/components/mobile/menu/item/mobile-item.js +58 -11
- package/components/mobile/menu/mobile-menu.d.ts +7 -3
- package/components/mobile/menu/mobile-menu.js +9 -9
- package/components/navigation/content/navigation-content.d.ts +7 -3
- package/components/navigation/content/navigation-content.js +18 -9
- package/components/navigation/local/navigation-local.d.ts +7 -3
- package/components/navigation/local/navigation-local.js +6 -9
- package/components/notification/badge/notification-badge.d.ts +4 -2
- package/components/notification/badge/notification-badge.js +4 -3
- package/components/pagination/data-pagination/data-pagination.d.ts +24 -3
- package/components/pagination/data-pagination/data-pagination.js +14 -9
- package/components/pagination/list-pagination/list-pagination.d.ts +19 -7
- package/components/pagination/list-pagination/list-pagination.js +51 -14
- package/components/popover/popover.d.ts +20 -5
- package/components/popover/popover.js +192 -16
- package/components/progressbar/progressbar.d.ts +2 -1
- package/components/progressbar/progressbar.js +4 -2
- package/components/puff-list/puff-list-item/puff-list-item-info.d.ts +7 -0
- package/components/puff-list/puff-list-item/puff-list-item-info.js +8 -0
- package/components/puff-list/puff-list-item/puff-list-item.d.ts +18 -3
- package/components/puff-list/puff-list-item/puff-list-item.js +58 -9
- package/components/puff-list/puff-list.d.ts +7 -3
- package/components/puff-list/puff-list.js +6 -9
- package/components/region-icon/region-icon.d.ts +12 -0
- package/components/region-icon/region-icon.js +25 -0
- package/components/side-menu/side-menu.d.ts +16 -6
- package/components/side-menu/side-menu.js +52 -13
- package/components/side-panel/side-panel.d.ts +21 -6
- package/components/side-panel/side-panel.js +74 -13
- package/components/stepper/step.d.ts +18 -0
- package/components/stepper/step.js +41 -0
- package/components/stepper/stepper.d.ts +9 -7
- package/components/stepper/stepper.js +21 -19
- package/components/tabs/tab-panel.d.ts +11 -0
- package/components/tabs/tab-panel.js +20 -0
- package/components/tabs/tab.d.ts +15 -0
- package/components/tabs/tab.js +19 -0
- package/components/tabs/tabs.d.ts +14 -9
- package/components/tabs/tabs.js +79 -25
- package/components/tag/tag.d.ts +5 -6
- package/components/tag/tag.js +9 -9
- package/components/tooltip/tooltip.d.ts +10 -3
- package/components/tooltip/tooltip.js +79 -9
- package/components/utils/contexts/HeaderContext.d.ts +9 -0
- package/components/utils/contexts/HeaderContext.js +7 -0
- package/components/utils/hooks/useElementId.d.ts +5 -0
- package/components/utils/hooks/useElementId.js +12 -0
- package/components/utils/hooks/useFocusTrap.d.ts +1 -0
- package/components/utils/hooks/useFocusTrap.js +44 -0
- package/components/utils/utils.d.ts +6 -0
- package/components/utils/utils.js +44 -0
- package/index.d.ts +15 -5
- package/index.js +20 -10
- package/license.md +6 -6
- package/package.json +2 -2
- package/components/form/errormessage/error-message.d.ts +0 -3
- package/components/form/errormessage/error-message.js +0 -12
- package/components/grid/grid.d.ts +0 -9
- package/components/grid/grid.js +0 -26
- package/components/header-1177/header-1177-nav-menu-mobile.d.ts +0 -5
- package/components/header-1177/header-1177-nav-menu-mobile.js +0 -15
- package/components/icon-region/icon-region.d.ts +0 -3
- package/components/icon-region/icon-region.js +0 -12
- package/components/puff-list/puff-list-item/puff-list-info/puff-list-item-info.d.ts +0 -3
- package/components/puff-list/puff-list-item/puff-list-info/puff-list-item-info.js +0 -12
|
@@ -1,3 +1,21 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React, { ReactElement, ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/footer-1177-admin/footer-1177-admin.css";
|
|
3
|
+
import { IDSLinkProps } from "../link/link";
|
|
4
|
+
interface IDSFooter1177AdminProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
serviceName?: string;
|
|
6
|
+
cols?: 1 | 2 | 3;
|
|
7
|
+
col1?: ReactElement<IDSLinkProps>[];
|
|
8
|
+
col2?: ReactElement<IDSLinkProps>[];
|
|
9
|
+
col3?: ReactElement<IDSLinkProps>[];
|
|
10
|
+
col1Size?: string;
|
|
11
|
+
col2Size?: string;
|
|
12
|
+
col3Size?: string;
|
|
13
|
+
subFooterLeft?: ReactNode;
|
|
14
|
+
subFooterRight?: ReactNode;
|
|
15
|
+
subFooterMobile?: ReactNode;
|
|
16
|
+
mobileMenu?: ReactNode;
|
|
17
|
+
mobileLinks?: ReactNode;
|
|
18
|
+
children?: ReactNode;
|
|
19
|
+
}
|
|
20
|
+
export declare const IDSFooter1177Admin: React.FC<IDSFooter1177AdminProps>;
|
|
21
|
+
export {};
|
|
@@ -1,12 +1,66 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import React__default, { useRef, useEffect } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import '@inera/ids-design/components/footer-1177-admin/footer-1177-admin.css';
|
|
5
6
|
|
|
6
|
-
const IDSFooter1177Admin =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const IDSFooter1177Admin = ({ serviceName = "", cols = 3, col1 = [], col2 = [], col3 = [], col1Size = "2", col2Size = "2", col3Size = "2", subFooterLeft, subFooterRight, subFooterMobile, mobileMenu, mobileLinks, children, className, ...props }) => {
|
|
8
|
+
const ref = useRef(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
}, [cols, col1Size, col2Size, col3Size]);
|
|
11
|
+
const getColumnWidth = (col) => {
|
|
12
|
+
const map = { 1: col1Size, 2: col2Size, 3: col3Size };
|
|
13
|
+
if (cols === 1)
|
|
14
|
+
return "ids-footer-1177-admin__col-size-6";
|
|
15
|
+
if (cols === 2)
|
|
16
|
+
return "ids-footer-1177-admin__col-size-3";
|
|
17
|
+
return `ids-footer-1177-admin__col-size-${map[col]}`;
|
|
18
|
+
};
|
|
19
|
+
const renderCol = (column) => {
|
|
20
|
+
return column?.map((link, idx) => {
|
|
21
|
+
if (React__default.isValidElement(link)) {
|
|
22
|
+
return React__default.cloneElement(link, {
|
|
23
|
+
key: `footer-link-${idx}`,
|
|
24
|
+
colorPreset: 1,
|
|
25
|
+
block: true
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
return link;
|
|
29
|
+
});
|
|
30
|
+
};
|
|
31
|
+
const renderCols = () => {
|
|
32
|
+
if (cols === 1) {
|
|
33
|
+
return (jsx("div", { className: clsx("ids-footer-1177-admin__link-col", "ids-footer-1177-admin__link-col--1", getColumnWidth(1)), children: renderCol(col1) }));
|
|
34
|
+
}
|
|
35
|
+
if (cols === 2) {
|
|
36
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: clsx("ids-footer-1177-admin__link-col", "ids-footer-1177-admin__link-col--2", getColumnWidth(1)), children: renderCol(col1) }), jsx("div", { className: clsx("ids-footer-1177-admin__link-col", "ids-footer-1177-admin__link-col--2", getColumnWidth(2)), children: renderCol(col2) })] }));
|
|
37
|
+
}
|
|
38
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: clsx("ids-footer-1177-admin__link-col", getColumnWidth(1)), children: renderCol(col1) }), jsx("div", { className: clsx("ids-footer-1177-admin__link-col", getColumnWidth(2)), children: renderCol(col2) }), jsx("div", { className: clsx("ids-footer-1177-admin__link-col", getColumnWidth(3)), children: renderCol(col3) })] }));
|
|
39
|
+
};
|
|
40
|
+
const renderLogo = () => (jsxs(Fragment, { children: [jsx("div", { className: "ids-footer-1177-admin__sub-footer-mobile-icon", children: jsx("div", { className: "ids-footer-1177-admin__sub-footer-mobile-service-name", children: serviceName }) }), jsx("div", { className: "ids-footer-1177-admin__sub-footer-mobile-text", children: subFooterMobile })] }));
|
|
41
|
+
const renderCookieLinks = (content, colorPreset) => {
|
|
42
|
+
const applyProps = (node, keyPrefix = "") => {
|
|
43
|
+
if (!node)
|
|
44
|
+
return null;
|
|
45
|
+
if (Array.isArray(node)) {
|
|
46
|
+
return node.map((child, idx) => applyProps(child, `${keyPrefix}-${idx}`));
|
|
47
|
+
}
|
|
48
|
+
if (React__default.isValidElement(node)) {
|
|
49
|
+
if (node.type === React__default.Fragment) {
|
|
50
|
+
return (jsx(React__default.Fragment, { children: applyProps(node.props.children, keyPrefix) }, keyPrefix));
|
|
51
|
+
}
|
|
52
|
+
return React__default.cloneElement(node, {
|
|
53
|
+
key: `footer-sub-footer-right-link-${keyPrefix}`,
|
|
54
|
+
colorPreset,
|
|
55
|
+
small: true,
|
|
56
|
+
...node.props
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return node;
|
|
60
|
+
};
|
|
61
|
+
return applyProps(content, "root");
|
|
62
|
+
};
|
|
63
|
+
return (jsxs("footer", { className: clsx("ids-footer-1177-admin", className), ref: ref, ...props, children: [jsx("div", { className: "ids-footer-1177-admin__inner-wrapper", children: jsxs("div", { className: "ids-footer-1177-admin__inner", children: [jsx("div", { className: "ids-footer-1177-admin__headline-row", children: jsx("h1", { className: "ids-footer-1177-admin__headline", children: serviceName }) }), jsxs("div", { className: "ids-footer-1177-admin__content", children: [jsx("div", { className: "ids-footer-1177-admin__text", children: children }), renderCols()] })] }) }), jsxs("div", { className: "ids-footer-1177-admin__sub-footer", children: [jsx("div", { className: "ids-footer-1177-admin__sub-footer-container", children: jsxs("div", { className: "ids-footer-1177-admin__sub-footer-row", children: [jsx("div", { className: "ids-footer-1177-admin__sub-footer-left", children: subFooterLeft }), jsx("div", { className: "ids-footer-1177-admin__sub-footer-right", children: renderCookieLinks(subFooterRight, 4) }), jsx("div", { className: "ids-footer-1177-admin__mobile-menu", children: mobileMenu }), jsx("div", { className: "ids-footer-1177-admin__mobile-links", children: renderCookieLinks(mobileLinks, 1) })] }) }), jsx("div", { className: "ids-footer-1177-admin__sub-footer-mobile", children: renderLogo() })] })] }));
|
|
64
|
+
};
|
|
11
65
|
|
|
12
66
|
export { IDSFooter1177Admin };
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React, { ReactElement, ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/footer-1177-pro/footer-1177-pro.css";
|
|
3
|
+
import { IDSLinkProps } from "../link/link";
|
|
4
|
+
interface IDSFooter1177ProProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
cols?: 1 | 2 | 3;
|
|
6
|
+
desktopCol1Headline?: ReactNode;
|
|
7
|
+
desktopCol2Headline?: ReactNode;
|
|
8
|
+
desktopCol3Headline?: ReactNode;
|
|
9
|
+
desktopCol1?: ReactElement<IDSLinkProps>[];
|
|
10
|
+
desktopCol2?: ReactElement<IDSLinkProps>[];
|
|
11
|
+
desktopCol3?: ReactElement<IDSLinkProps>[];
|
|
12
|
+
mobileMenu?: ReactNode;
|
|
13
|
+
bottomFooterHeadline?: string;
|
|
14
|
+
bottomFooterText?: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export declare const IDSFooter1177Pro: React.FC<IDSFooter1177ProProps>;
|
|
17
|
+
export {};
|
|
@@ -1,12 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import '@inera/ids-design/components/footer-1177-pro/footer-1177-pro.css';
|
|
5
6
|
|
|
6
|
-
const IDSFooter1177Pro =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
const IDSFooter1177Pro = ({ cols = 3, desktopCol1Headline = "", desktopCol2Headline = "", desktopCol3Headline = "", desktopCol1 = [], desktopCol2 = [], desktopCol3 = [], mobileMenu, bottomFooterHeadline = "", bottomFooterText, className, ...props }) => {
|
|
8
|
+
const renderCol = (column) => {
|
|
9
|
+
return column?.map((link, idx) => {
|
|
10
|
+
if (React__default.isValidElement(link)) {
|
|
11
|
+
return React__default.cloneElement(link, {
|
|
12
|
+
key: `footer-link-${idx}`,
|
|
13
|
+
colorPreset: 1,
|
|
14
|
+
block: true
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return link;
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
const renderCols = () => {
|
|
21
|
+
const colClasses = {
|
|
22
|
+
1: "ids-footer-1177-pro__desktop-col--1",
|
|
23
|
+
2: "ids-footer-1177-pro__desktop-col--2",
|
|
24
|
+
3: "ids-footer-1177-pro__desktop-col--3"
|
|
25
|
+
};
|
|
26
|
+
const baseClass = "ids-footer-1177-pro__desktop-col";
|
|
27
|
+
const columns = [];
|
|
28
|
+
if (cols >= 1) {
|
|
29
|
+
columns.push(jsxs("div", { className: clsx(baseClass, colClasses[cols]), children: [jsx("div", { className: "ids-footer-1177-pro__footer-headline", children: jsx("h2", { children: desktopCol1Headline }) }), renderCol(desktopCol1)] }, "col1"));
|
|
30
|
+
}
|
|
31
|
+
if (cols >= 2) {
|
|
32
|
+
columns.push(jsxs("div", { className: clsx(baseClass, colClasses[cols]), children: [jsx("div", { className: "ids-footer-1177-pro__footer-headline", children: jsx("h2", { children: desktopCol2Headline }) }), renderCol(desktopCol2)] }, "col2"));
|
|
33
|
+
}
|
|
34
|
+
if (cols === 3) {
|
|
35
|
+
columns.push(jsxs("div", { className: clsx(baseClass, colClasses[cols]), children: [jsx("div", { className: "ids-footer-1177-pro__footer-headline", children: jsx("h2", { children: desktopCol3Headline }) }), renderCol(desktopCol3)] }, "col3"));
|
|
36
|
+
}
|
|
37
|
+
return columns;
|
|
38
|
+
};
|
|
39
|
+
return (jsxs("footer", { className: clsx("ids-footer-1177-pro", className), ...props, children: [jsxs("div", { className: "ids-footer-1177-pro__top-footer", children: [jsx("div", { className: "ids-footer-1177-pro__desktop-content", children: renderCols() }), jsx("div", { className: "ids-footer-1177-pro__mobile-content", children: mobileMenu })] }), jsx("div", { className: "ids-footer-1177-pro__bottom-footer", children: jsxs("div", { className: "ids-footer-1177-pro__bottom-footer-inner", children: [jsx("div", { className: "ids-footer-1177-pro__bottom-footer-logo" }), jsx("div", { className: "ids-footer-1177-pro__bottom-footer-headline", children: jsx("h2", { children: bottomFooterHeadline }) }), jsx("div", { className: "ids-footer-1177-pro__bottom-footer-text", children: bottomFooterText })] }) })] }));
|
|
40
|
+
};
|
|
11
41
|
|
|
12
42
|
export { IDSFooter1177Pro };
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React, { ReactElement, ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/footer-inera/footer-inera.css";
|
|
3
|
+
import { IDSLinkProps } from "../link/link";
|
|
4
|
+
interface IDSFooterIneraProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
headline?: string;
|
|
6
|
+
srHeadline?: string;
|
|
7
|
+
subHeadline?: string;
|
|
8
|
+
cols?: 1 | 2 | 3;
|
|
9
|
+
col1?: ReactElement<IDSLinkProps>[];
|
|
10
|
+
col2?: ReactElement<IDSLinkProps>[];
|
|
11
|
+
col3?: ReactElement<IDSLinkProps>[];
|
|
12
|
+
col1Size?: string;
|
|
13
|
+
col2Size?: string;
|
|
14
|
+
col3Size?: string;
|
|
15
|
+
subFooterLeft?: ReactNode;
|
|
16
|
+
subFooterRight?: ReactNode;
|
|
17
|
+
mobileMenu?: ReactNode;
|
|
18
|
+
mobileLinks?: ReactNode;
|
|
19
|
+
subFooterMobile?: ReactNode;
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export declare const IDSFooterInera: React.FC<IDSFooterIneraProps>;
|
|
23
|
+
export {};
|
|
@@ -1,12 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import '@inera/ids-design/components/footer-inera/footer-inera.css';
|
|
5
6
|
|
|
6
|
-
const IDSFooterInera =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
7
|
+
const IDSFooterInera = ({ headline = "", srHeadline = "", subHeadline = "", cols = 3, col1 = [], col2 = [], col3 = [], col1Size, col2Size, col3Size, subFooterLeft, subFooterRight, mobileMenu, mobileLinks, subFooterMobile, children, className, ...props }) => {
|
|
8
|
+
const defaultCols = {
|
|
9
|
+
1: { col1Size: "6", col2Size: "6", col3Size: "6" },
|
|
10
|
+
2: { col1Size: "3", col2Size: "3", col3Size: "3" },
|
|
11
|
+
3: { col1Size: "2", col2Size: "2", col3Size: "2" }
|
|
12
|
+
};
|
|
13
|
+
const resolvedCol1 = col1Size ?? defaultCols[cols].col1Size;
|
|
14
|
+
const resolvedCol2 = col2Size ?? defaultCols[cols].col2Size;
|
|
15
|
+
const resolvedCol3 = col3Size ?? defaultCols[cols].col3Size;
|
|
16
|
+
const getColumnWidth = (col) => {
|
|
17
|
+
const val = col === 1 ? resolvedCol1 : col === 2 ? resolvedCol2 : resolvedCol3;
|
|
18
|
+
return `ids-footer-inera__col-size-${val}`;
|
|
19
|
+
};
|
|
20
|
+
const renderHeadlineElements = () => srHeadline ? (jsxs(Fragment, { children: [jsxs("h1", { className: "ids-footer-inera__headline--sr", children: [srHeadline, jsx("span", { className: "ids-footer-inera__headline--sub", children: subHeadline })] }), jsxs("h1", { "aria-hidden": "true", className: "ids-footer-inera__headline", children: [headline, jsx("span", { className: "ids-footer-inera__headline--sub", children: subHeadline })] })] })) : (jsxs("h1", { className: "ids-footer-inera__headline", children: [headline, jsx("span", { className: "ids-footer-inera__headline--sub", children: subHeadline })] }));
|
|
21
|
+
const renderCol = (column) => {
|
|
22
|
+
return column?.map((link, idx) => {
|
|
23
|
+
if (React__default.isValidElement(link)) {
|
|
24
|
+
return React__default.cloneElement(link, {
|
|
25
|
+
key: `footer-link-${idx}`,
|
|
26
|
+
light: true,
|
|
27
|
+
block: true
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
return link;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
const renderCols = () => {
|
|
34
|
+
if (cols === 1) {
|
|
35
|
+
return (jsx("div", { className: clsx("ids-footer-inera__link-col ids-footer-inera__link-col--1", getColumnWidth(1)), children: renderCol(col1) }));
|
|
36
|
+
}
|
|
37
|
+
else if (cols === 2) {
|
|
38
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: clsx("ids-footer-inera__link-col ids-footer-inera__link-col--1", getColumnWidth(1)), children: renderCol(col1) }), jsx("div", { className: clsx("ids-footer-inera__link-col ids-footer-inera__link-col--2", getColumnWidth(2)), children: renderCol(col2) })] }));
|
|
39
|
+
}
|
|
40
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: clsx("ids-footer-inera__link-col", getColumnWidth(1)), children: renderCol(col1) }), jsx("div", { className: clsx("ids-footer-inera__link-col", getColumnWidth(2)), children: renderCol(col2) }), jsx("div", { className: clsx("ids-footer-inera__link-col", getColumnWidth(3)), children: renderCol(col3) })] }));
|
|
41
|
+
};
|
|
42
|
+
const renderCookieLinks = (content) => {
|
|
43
|
+
const applyProps = (node, keyPrefix = "") => {
|
|
44
|
+
if (!node)
|
|
45
|
+
return null;
|
|
46
|
+
if (Array.isArray(node)) {
|
|
47
|
+
return node.map((child, idx) => applyProps(child, `${keyPrefix}-${idx}`));
|
|
48
|
+
}
|
|
49
|
+
if (React__default.isValidElement(node)) {
|
|
50
|
+
if (node.type === React__default.Fragment) {
|
|
51
|
+
return (jsx(React__default.Fragment, { children: applyProps(node.props.children, keyPrefix) }, keyPrefix));
|
|
52
|
+
}
|
|
53
|
+
return React__default.cloneElement(node, {
|
|
54
|
+
key: `footer-sub-footer-right-link-${keyPrefix}`,
|
|
55
|
+
colorPreset: 4,
|
|
56
|
+
small: true,
|
|
57
|
+
...node.props
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
return node;
|
|
61
|
+
};
|
|
62
|
+
return applyProps(content, "root");
|
|
63
|
+
};
|
|
64
|
+
return (jsxs("footer", { className: clsx("ids-footer-inera", className), ...props, children: [jsx("div", { className: "ids-footer-inera__inner-wrapper", children: jsxs("div", { className: "ids-footer-inera__inner", children: [jsx("div", { className: "ids-footer-inera__headline-row", children: renderHeadlineElements() }), jsxs("div", { className: "ids-footer-inera__content", children: [jsx("div", { className: "ids-footer-inera__text", children: children }), renderCols()] })] }) }), jsxs("div", { className: "ids-footer-inera__sub-footer", children: [jsx("div", { className: "ids-footer-inera__sub-footer-container", children: jsxs("div", { className: "ids-footer-inera__sub-footer-row", children: [jsx("div", { className: "ids-footer-inera__sub-footer-left", children: subFooterLeft }), jsx("div", { className: "ids-footer-inera__sub-footer-right", children: renderCookieLinks(subFooterRight) }), jsx("div", { className: "ids-footer-inera__mobile-menu", children: mobileMenu }), jsx("div", { className: "ids-footer-inera__mobile-links", children: renderCookieLinks(mobileLinks) })] }) }), jsx("div", { className: "ids-footer-inera__sub-footer-mobile", children: subFooterMobile })] })] }));
|
|
65
|
+
};
|
|
11
66
|
|
|
12
67
|
export { IDSFooterInera };
|
|
@@ -1,3 +1,23 @@
|
|
|
1
|
-
import "
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React, { ReactElement, ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/footer-inera-admin/footer-inera-admin.css";
|
|
3
|
+
import { IDSLinkProps } from "../link/link";
|
|
4
|
+
interface IDSFooterIneraAdminProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
headline?: string;
|
|
6
|
+
srHeadline?: string;
|
|
7
|
+
subHeadline?: string;
|
|
8
|
+
cols?: 1 | 2 | 3;
|
|
9
|
+
col1?: ReactElement<IDSLinkProps>[];
|
|
10
|
+
col2?: ReactElement<IDSLinkProps>[];
|
|
11
|
+
col3?: ReactElement<IDSLinkProps>[];
|
|
12
|
+
col1Size?: string;
|
|
13
|
+
col2Size?: string;
|
|
14
|
+
col3Size?: string;
|
|
15
|
+
subFooterLeft?: ReactNode;
|
|
16
|
+
subFooterRight?: ReactNode;
|
|
17
|
+
mobileMenu?: ReactNode;
|
|
18
|
+
mobileLinks?: ReactNode;
|
|
19
|
+
subFooterMobile?: ReactNode;
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export declare const IDSFooterIneraAdmin: React.FC<IDSFooterIneraAdminProps>;
|
|
23
|
+
export {};
|
|
@@ -1,12 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import
|
|
4
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import '@inera/ids-design/components/footer-inera-admin/footer-inera-admin.css';
|
|
5
6
|
|
|
6
|
-
const IDSFooterIneraAdmin =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
7
|
+
const IDSFooterIneraAdmin = ({ headline = "", srHeadline = "", subHeadline = "", cols = 3, col1 = [], col2 = [], col3 = [], col1Size, col2Size, col3Size, subFooterLeft, subFooterRight, mobileMenu, mobileLinks, subFooterMobile, children, className, ...props }) => {
|
|
8
|
+
const defaultSizes = {
|
|
9
|
+
1: { col1Size: "6", col2Size: "6", col3Size: "6" },
|
|
10
|
+
2: { col1Size: "3", col2Size: "3", col3Size: "3" },
|
|
11
|
+
3: { col1Size: "2", col2Size: "2", col3Size: "2" }
|
|
12
|
+
};
|
|
13
|
+
const resolvedCol1 = col1Size ?? defaultSizes[cols].col1Size;
|
|
14
|
+
const resolvedCol2 = col2Size ?? defaultSizes[cols].col2Size;
|
|
15
|
+
const resolvedCol3 = col3Size ?? defaultSizes[cols].col3Size;
|
|
16
|
+
const getColClass = (size) => `ids-footer-inera-admin__col-size-${size}`;
|
|
17
|
+
const renderHeadline = () => srHeadline ? (jsxs(Fragment, { children: [jsxs("h1", { className: "ids-footer-inera-admin__headline--sr", children: [srHeadline, jsx("span", { className: "ids-footer-inera-admin__headline--sub", children: subHeadline })] }), jsxs("h1", { "aria-hidden": "true", className: "ids-footer-inera-admin__headline", children: [headline, jsx("span", { className: "ids-footer-inera-admin__headline--sub", children: subHeadline })] })] })) : (jsxs("h1", { className: "ids-footer-inera-admin__headline", children: [headline, jsx("span", { className: "ids-footer-inera-admin__headline--sub", children: subHeadline })] }));
|
|
18
|
+
const renderCol = (column) => {
|
|
19
|
+
return column?.map((link, idx) => {
|
|
20
|
+
if (React__default.isValidElement(link)) {
|
|
21
|
+
return React__default.cloneElement(link, {
|
|
22
|
+
key: `footer-link-${idx}`,
|
|
23
|
+
colorPreset: 3,
|
|
24
|
+
block: true
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return link;
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const renderColumns = () => {
|
|
31
|
+
if (cols === 1) {
|
|
32
|
+
return (jsx("div", { className: clsx("ids-footer-inera-admin__link-col ids-footer-inera-admin__link-col--1", getColClass(resolvedCol1)), children: renderCol(col1) }));
|
|
33
|
+
}
|
|
34
|
+
if (cols === 2) {
|
|
35
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: clsx("ids-footer-inera-admin__link-col ids-footer-inera-admin__link-col--1", getColClass(resolvedCol1)), children: renderCol(col1) }), jsx("div", { className: clsx("ids-footer-inera-admin__link-col ids-footer-inera-admin__link-col--2", getColClass(resolvedCol2)), children: renderCol(col2) })] }));
|
|
36
|
+
}
|
|
37
|
+
return (jsxs(Fragment, { children: [jsx("div", { className: clsx("ids-footer-inera-admin__link-col", getColClass(resolvedCol1)), children: renderCol(col1) }), jsx("div", { className: clsx("ids-footer-inera-admin__link-col", getColClass(resolvedCol2)), children: renderCol(col2) }), jsx("div", { className: clsx("ids-footer-inera-admin__link-col", getColClass(resolvedCol3)), children: renderCol(col3) })] }));
|
|
38
|
+
};
|
|
39
|
+
const renderCookieLinks = (content) => {
|
|
40
|
+
const applyProps = (node, keyPrefix = "") => {
|
|
41
|
+
if (!node)
|
|
42
|
+
return null;
|
|
43
|
+
if (Array.isArray(node)) {
|
|
44
|
+
return node.map((child, idx) => applyProps(child, `${keyPrefix}-${idx}`));
|
|
45
|
+
}
|
|
46
|
+
if (React__default.isValidElement(node)) {
|
|
47
|
+
if (node.type === React__default.Fragment) {
|
|
48
|
+
return (jsx(React__default.Fragment, { children: applyProps(node.props.children, keyPrefix) }, keyPrefix));
|
|
49
|
+
}
|
|
50
|
+
return React__default.cloneElement(node, {
|
|
51
|
+
key: `footer-sub-footer-right-link-${keyPrefix}`,
|
|
52
|
+
colorPreset: 4,
|
|
53
|
+
small: true,
|
|
54
|
+
...node.props
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
return node;
|
|
58
|
+
};
|
|
59
|
+
return applyProps(content, "root");
|
|
60
|
+
};
|
|
61
|
+
return (jsxs("footer", { className: clsx("ids-footer-inera-admin", className), ...props, children: [jsx("div", { className: "ids-footer-inera-admin__inner-wrapper", children: jsxs("div", { className: "ids-footer-inera-admin__inner", children: [jsx("div", { className: "ids-footer-inera-admin__headline-row", children: renderHeadline() }), jsxs("div", { className: "ids-footer-inera-admin__content", children: [jsx("div", { className: "ids-footer-inera-admin__text", children: children }), renderColumns()] })] }) }), jsxs("div", { className: "ids-footer-inera-admin__sub-footer", children: [jsx("div", { className: "ids-footer-inera-admin__sub-footer-container", children: jsxs("div", { className: "ids-footer-inera-admin__sub-footer-row", children: [jsx("div", { className: "ids-footer-inera-admin__sub-footer-left", children: subFooterLeft }), jsx("div", { className: "ids-footer-inera-admin__sub-footer-right", children: renderCookieLinks(subFooterRight) }), jsx("div", { className: "ids-footer-inera-admin__mobile-menu", children: mobileMenu }), jsx("div", { className: "ids-footer-inera-admin__mobile-links", children: renderCookieLinks(mobileLinks) })] }) }), jsx("div", { className: "ids-footer-inera-admin__sub-footer-mobile", children: subFooterMobile })] })] }));
|
|
62
|
+
};
|
|
11
63
|
|
|
12
64
|
export { IDSFooterIneraAdmin };
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React, { ReactNode, InputHTMLAttributes } from "react";
|
|
2
|
+
interface IDSCheckButtonProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
disabled?: boolean;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare const IDSCheckButton: React.FC<IDSCheckButtonProps>;
|
|
7
|
+
export {};
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useElementId } from '../../utils/hooks/useElementId.js';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
5
|
|
|
6
|
-
const IDSCheckButton =
|
|
6
|
+
const IDSCheckButton = ({ disabled = false, id, children, className, ...props }) => {
|
|
7
|
+
const fieldId = useElementId(id);
|
|
8
|
+
return (jsxs("div", { className: clsx("ids-check-button", { "ids-check-button--disabled": disabled }, className), children: [jsx("input", { id: fieldId, className: "ids-check-button__input", type: "checkbox", disabled: disabled, ...props }), jsx("label", { htmlFor: fieldId, className: "ids-check-button__label", children: children })] }));
|
|
9
|
+
};
|
|
7
10
|
|
|
8
11
|
export { IDSCheckButton };
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import "
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React, { ReactNode, InputHTMLAttributes, SetStateAction, Dispatch } from "react";
|
|
2
|
+
interface IDSCheckboxGroupProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
legend?: string;
|
|
4
|
+
errorMsg?: string | ReactNode;
|
|
5
|
+
compact?: boolean;
|
|
6
|
+
tooltip?: ReactNode;
|
|
7
|
+
block?: boolean;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
onValidityChange?: (isValid: boolean) => void;
|
|
10
|
+
setCheckedBoxesCount?: Dispatch<SetStateAction<number>>;
|
|
11
|
+
}
|
|
12
|
+
export declare const IDSCheckboxGroup: React.FC<IDSCheckboxGroupProps>;
|
|
13
|
+
export {};
|
|
@@ -1,12 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React__default, { useRef, useEffect } from 'react';
|
|
4
|
+
import { IDSErrorMessage } from '../error-message/error-message.js';
|
|
5
|
+
import { useElementId } from '../../utils/hooks/useElementId.js';
|
|
6
|
+
import { useGroupValidity } from '../form-hooks/useGroupValidity.js';
|
|
7
|
+
import clsx from 'clsx';
|
|
5
8
|
|
|
6
|
-
const IDSCheckboxGroup =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const IDSCheckboxGroup = ({ legend = "", errorMsg = "", compact = false, block = false, tooltip, children, className, onValidityChange, setCheckedBoxesCount }) => {
|
|
10
|
+
const groupRef = useRef(null);
|
|
11
|
+
const isValid = useGroupValidity(groupRef, "checkbox");
|
|
12
|
+
const errorMsgId = useElementId();
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (onValidityChange) {
|
|
15
|
+
onValidityChange(isValid);
|
|
16
|
+
}
|
|
17
|
+
}, [isValid, onValidityChange]);
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
const checkboxes = groupRef.current?.querySelectorAll(`input[type="checkbox"]`);
|
|
20
|
+
if (!checkboxes.length)
|
|
21
|
+
return;
|
|
22
|
+
const count = () => {
|
|
23
|
+
const checkedCount = groupRef.current?.querySelectorAll('input[type="checkbox"]:checked')?.length ?? 0;
|
|
24
|
+
if (setCheckedBoxesCount) {
|
|
25
|
+
setCheckedBoxesCount(checkedCount);
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
count();
|
|
29
|
+
checkboxes.forEach(cb => {
|
|
30
|
+
cb.addEventListener("change", count);
|
|
31
|
+
});
|
|
32
|
+
return () => {
|
|
33
|
+
checkboxes.forEach(cb => {
|
|
34
|
+
cb.removeEventListener("change", count);
|
|
35
|
+
});
|
|
36
|
+
};
|
|
37
|
+
}, [groupRef]);
|
|
38
|
+
const clonedChildren = React__default.Children.map(children, child => {
|
|
39
|
+
if (React__default.isValidElement(child) &&
|
|
40
|
+
child.type.displayName === "IDSCheckbox") {
|
|
41
|
+
return React__default.cloneElement(child, {
|
|
42
|
+
key: child.props.id,
|
|
43
|
+
groupErrorMsgId: errorMsg && errorMsgId,
|
|
44
|
+
block: block
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return child;
|
|
48
|
+
});
|
|
49
|
+
return (jsxs("fieldset", { ref: groupRef, className: clsx("ids-form-group__fieldset", {
|
|
50
|
+
"ids-form-group__fieldset--compact": compact
|
|
51
|
+
}, className), children: [jsxs("legend", { children: [legend, tooltip] }), clonedChildren, !isValid && !!errorMsg && (jsx(IDSErrorMessage, { id: errorMsgId, show: true, compact: true, children: errorMsg }))] }));
|
|
52
|
+
};
|
|
11
53
|
|
|
12
54
|
export { IDSCheckboxGroup };
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React, { ReactNode, InputHTMLAttributes } from "react";
|
|
2
|
+
export interface IDSCheckboxProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
invalid?: boolean;
|
|
4
|
+
disabled?: boolean;
|
|
5
|
+
required?: boolean;
|
|
6
|
+
indeterminate?: boolean;
|
|
7
|
+
noLabel?: boolean;
|
|
8
|
+
noValidation?: boolean;
|
|
9
|
+
light?: boolean;
|
|
10
|
+
block?: boolean;
|
|
11
|
+
compact?: boolean;
|
|
12
|
+
errorMsg?: string | ReactNode;
|
|
13
|
+
groupErrorMsgId?: string;
|
|
14
|
+
tooltip?: ReactNode;
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export declare const IDSCheckbox: React.FC<IDSCheckboxProps>;
|
|
@@ -1,8 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef, useEffect } from 'react';
|
|
4
|
+
import { useElementId } from '../../utils/hooks/useElementId.js';
|
|
5
|
+
import { IDSErrorMessage } from '../error-message/error-message.js';
|
|
6
|
+
import { useAriaDescribedBy } from '../form-hooks/useAriaDescribedBy.js';
|
|
7
|
+
import { useInputValidity } from '../form-hooks/useInputValidity.js';
|
|
8
|
+
import clsx from 'clsx';
|
|
5
9
|
|
|
6
|
-
const IDSCheckbox =
|
|
10
|
+
const IDSCheckbox = ({ invalid = false, disabled = false, required = false, indeterminate = false, noValidation = false, noLabel = false, light = false, block = false, compact = false, errorMsg = "", groupErrorMsgId = "", tooltip, id, children, className, ...props }) => {
|
|
11
|
+
const fieldId = useElementId(id);
|
|
12
|
+
const errorMsgId = useElementId();
|
|
13
|
+
const checkboxRef = useRef(null);
|
|
14
|
+
const hasValidValue = useInputValidity(checkboxRef);
|
|
15
|
+
const isInvalid = (invalid || !hasValidValue) && !noValidation;
|
|
16
|
+
if (groupErrorMsgId) {
|
|
17
|
+
useAriaDescribedBy(checkboxRef, groupErrorMsgId, isInvalid, true);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
useAriaDescribedBy(checkboxRef, errorMsgId, isInvalid, !!errorMsg);
|
|
21
|
+
}
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (indeterminate) {
|
|
24
|
+
checkboxRef.current.indeterminate = indeterminate;
|
|
25
|
+
}
|
|
26
|
+
}, [checkboxRef, indeterminate]);
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (checkboxRef.current) {
|
|
29
|
+
const checkboxEl = checkboxRef.current;
|
|
30
|
+
const updateAriaChecked = () => {
|
|
31
|
+
checkboxEl.setAttribute("aria-checked", checkboxEl.indeterminate ? "mixed" : `${checkboxEl.checked}`);
|
|
32
|
+
};
|
|
33
|
+
updateAriaChecked();
|
|
34
|
+
checkboxEl.addEventListener("change", updateAriaChecked);
|
|
35
|
+
return () => {
|
|
36
|
+
checkboxEl.removeEventListener("change", updateAriaChecked);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}, [checkboxRef]);
|
|
40
|
+
return (jsxs("div", { className: clsx("ids-checkbox-component", className), style: { display: "flex", flexDirection: "column", gap: "0.5rem" }, children: [jsxs("div", { className: clsx("ids-checkbox", {
|
|
41
|
+
"ids-checkbox--light": light,
|
|
42
|
+
"ids-checkbox--block": block,
|
|
43
|
+
"ids-checkbox--compact": compact
|
|
44
|
+
}), children: [jsx("input", { id: fieldId, ref: checkboxRef, type: "checkbox", className: "ids-checkbox__input", "aria-invalid": isInvalid, disabled: disabled, "aria-disabled": disabled, required: required, "aria-required": required, ...props }), jsxs("div", { className: clsx("ids-label-tooltip-wrapper", {
|
|
45
|
+
"ids-label-tooltip-wrapper--block": block,
|
|
46
|
+
"ids-label-tooltip-wrapper--inline": tooltip
|
|
47
|
+
}), children: [jsx("label", { htmlFor: fieldId, className: clsx("ds-checkbox__label", {
|
|
48
|
+
"ids-label--clickable": disabled,
|
|
49
|
+
"ids-label--no-label": noLabel
|
|
50
|
+
}), children: !noLabel && children }), tooltip] })] }), isInvalid && errorMsg && (jsx(IDSErrorMessage, { id: errorMsgId, show: true, compact: true, children: errorMsg }))] }));
|
|
51
|
+
};
|
|
7
52
|
|
|
8
53
|
export { IDSCheckbox };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/form/error-message/error-message.css";
|
|
3
|
+
interface IDSErrorMessageProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
id?: string;
|
|
5
|
+
show?: boolean;
|
|
6
|
+
compact?: boolean;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const IDSErrorMessage: React.FC<IDSErrorMessageProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import '@inera/ids-design/components/form/error-message/error-message.css';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
6
|
+
const IDSErrorMessage = ({ show = false, compact = false, id, children, className, ...props }) => {
|
|
7
|
+
return (jsx("div", { id: id, style: { marginTop: compact && "0" }, className: clsx("ids-error-message", {
|
|
8
|
+
"ids-error-message--show": show
|
|
9
|
+
}, className), ...props, children: jsxs("span", { className: "ids-error-message__text", children: [" ", children, " "] }) }));
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export { IDSErrorMessage };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useAriaDescribedBy(ref: React.RefObject<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>, errorMsgId: string, invalid?: boolean, hasErrorMsg?: boolean, hasHint?: boolean, hintId?: string): void;
|