@inera/ids-react 6.2.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 +1 -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/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,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import "@inera/ids-design/components/accordion/accordion.css";
|
|
3
|
-
interface IDSAccordionProps {
|
|
3
|
+
interface IDSAccordionProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
headline: ReactNode;
|
|
5
5
|
headlineSize?: "m" | "s" | "xs";
|
|
6
6
|
level?: 1 | 2;
|
|
@@ -3,17 +3,14 @@ import { jsxs, jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import React__default, { useState, useRef, useEffect } from 'react';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import '@inera/ids-design/components/accordion/accordion.css';
|
|
6
|
+
import { useElementId } from '../utils/hooks/useElementId.js';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
const generateId = () => {
|
|
9
|
-
return `ids-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;
|
|
10
|
-
};
|
|
11
|
-
const IDSAccordion = ({ headline = "", level = 1, headlineSize = level === 2 ? "s" : "m", expanded = false, lean = false, onCollapsed, onExpanded, children }) => {
|
|
8
|
+
const IDSAccordion = ({ headline = "", level = 1, headlineSize = level === 2 ? "s" : "m", expanded = false, lean = false, onCollapsed, onExpanded, children, className, ...props }) => {
|
|
12
9
|
const [isExpanded, setIsExpanded] = useState(expanded);
|
|
13
10
|
const [isLean, setIsLean] = useState(lean);
|
|
14
11
|
const [insideIDSCard, setInsideIDSCard] = useState(false);
|
|
15
12
|
const [hasChildren, setHasChildren] = useState(false);
|
|
16
|
-
const contentId =
|
|
13
|
+
const contentId = useElementId();
|
|
17
14
|
const accordionRef = useRef(null);
|
|
18
15
|
useEffect(() => {
|
|
19
16
|
handleChildren();
|
|
@@ -69,7 +66,9 @@ const IDSAccordion = ({ headline = "", level = 1, headlineSize = level === 2 ? "
|
|
|
69
66
|
"ids-accordion--lean": lean || isLean,
|
|
70
67
|
"ids-accordion--has-children": hasChildren,
|
|
71
68
|
"ids-accordion--is-child": level === 2
|
|
72
|
-
}), children: [jsx("div", { className: `ids-accordion__button ids-accordion__button--${headlineSize}`, role: "button", tabIndex: 0, onClick: toggleExpansion, onKeyDown: onKeyPress, "aria-expanded": isExpanded, "aria-controls": contentId
|
|
69
|
+
}, className), ...props, children: [jsx("div", { className: `ids-accordion__button ids-accordion__button--${headlineSize}`, role: "button", tabIndex: 0, onClick: toggleExpansion, onKeyDown: onKeyPress, "aria-expanded": isExpanded, "aria-controls": contentId, children: jsx("div", { className: clsx("ids-accordion__headline", `ids-accordion__headline-${level}`, `ids-accordion__headline--${headlineSize}`, {
|
|
70
|
+
"ids-accordion__headline--expanded": isExpanded
|
|
71
|
+
}), children: headline }) }), jsx("div", { "aria-hidden": !isExpanded, id: contentId, className: "ids-accordion__content", children: React__default.Children.map(children, child => {
|
|
73
72
|
if (React__default.isValidElement(child)) {
|
|
74
73
|
return React__default.cloneElement(child, {
|
|
75
74
|
level: 2,
|
|
@@ -3,7 +3,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import { IDSAlertGlobal } from '../alert-global/alert-global.js';
|
|
5
5
|
|
|
6
|
-
const IDSAgent = ({ showText = "Visa mer", hideText = "Visa mindre", collapsed = false, onCollapsedChange, children,
|
|
6
|
+
const IDSAgent = ({ showText = "Visa mer", hideText = "Visa mindre", collapsed = false, onCollapsedChange, actions, headline, children, className, ...props }) => {
|
|
7
7
|
const [isCollapsed, setIsCollapsed] = useState(collapsed);
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
setIsCollapsed(collapsed);
|
|
@@ -12,7 +12,7 @@ const IDSAgent = ({ showText = "Visa mer", hideText = "Visa mindre", collapsed =
|
|
|
12
12
|
setIsCollapsed(!isCollapsed);
|
|
13
13
|
onCollapsedChange?.(!isCollapsed);
|
|
14
14
|
};
|
|
15
|
-
return (jsx(IDSAlertGlobal, { showText: showText, hideText: hideText, collapsed: isCollapsed, agent: true, actions: actions, headline: headline, noRole: true, onCollapsedChange: handleToggleCollapse, children: children }));
|
|
15
|
+
return (jsx(IDSAlertGlobal, { showText: showText, hideText: hideText, collapsed: isCollapsed, agent: true, actions: actions, headline: headline, noRole: true, onCollapsedChange: handleToggleCollapse, className: className, ...props, children: children }));
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export { IDSAgent };
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import '@inera/ids-design/components/alert/alert.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
|
|
6
|
-
const IDSAlert = ({ collapsable = false, ribbon = false, collapsed = false, dismissible = false, headline, compact = false, type = "info", srCloseText = "Stäng alert", srCollapseText = "Minimera alertmeddelande", srExpandText = "Expandera alertmeddelande", noRole = false, srIconTitle = "", onClose, onCollapsedChange, children }) => {
|
|
7
|
+
const IDSAlert = ({ collapsable = false, ribbon = false, collapsed = false, dismissible = false, headline, compact = false, type = "info", srCloseText = "Stäng alert", srCollapseText = "Minimera alertmeddelande", srExpandText = "Expandera alertmeddelande", noRole = false, srIconTitle = "", onClose, onCollapsedChange, className, children, ...props }) => {
|
|
7
8
|
const [isCollapsed, setIsCollapsed] = useState(collapsed);
|
|
8
9
|
useEffect(() => {
|
|
9
10
|
setIsCollapsed(collapsed);
|
|
@@ -16,7 +17,13 @@ const IDSAlert = ({ collapsable = false, ribbon = false, collapsed = false, dism
|
|
|
16
17
|
const handleClose = () => {
|
|
17
18
|
onClose?.();
|
|
18
19
|
};
|
|
19
|
-
return (jsx("div", { className:
|
|
20
|
+
return (jsx("div", { className: clsx("ids-alert", `ids-alert--${type}`, {
|
|
21
|
+
"ids-alert--collapsed": isCollapsed,
|
|
22
|
+
"ids-alert--ribbon": ribbon,
|
|
23
|
+
"ids-alert--compact": compact
|
|
24
|
+
}, className), role: !noRole ? "alert" : undefined, ...props, children: compact || ribbon ? (jsxs(Fragment, { children: [jsxs("div", { className: "ids-alert__content", children: [jsx("span", { className: "ids-alert__content-icon", title: srIconTitle }), jsx("span", { className: "ids-alert__content-text", children: children })] }), dismissible && (jsx("button", { className: "ids-alert__close", onClick: handleClose, "aria-label": srCloseText }))] })) : (jsxs(Fragment, { children: [jsxs("div", { className: "ids-alert__header", children: [jsxs("div", { className: "ids-alert__icon_and_text", children: [jsx("span", { className: "ids-alert__state-icon", title: srIconTitle }), jsx("div", { className: "ids-alert__headline", children: headline })] }), dismissible && (jsx("button", { className: "ids-alert__close", onClick: handleClose, "aria-label": srCloseText })), collapsable && !compact && !ribbon && (jsx("button", { className: clsx("ids-alert__expand", {
|
|
25
|
+
"ids-alert__expand--expanded": !isCollapsed
|
|
26
|
+
}), onClick: handleToggleCollapse, "aria-expanded": !isCollapsed, "aria-label": isCollapsed ? srExpandText : srCollapseText }))] }), !isCollapsed && jsx("div", { className: "ids-alert__content", children: children })] })) }));
|
|
20
27
|
};
|
|
21
28
|
|
|
22
29
|
export { IDSAlert };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import "@inera/ids-design/components/alert-global/alert-global.css";
|
|
3
|
-
interface IDSAlertGlobalProps {
|
|
3
|
+
interface IDSAlertGlobalProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
agent?: boolean;
|
|
5
5
|
showText?: string;
|
|
6
6
|
hideText?: string;
|
|
7
7
|
collapsed?: boolean;
|
|
8
8
|
noRole?: boolean;
|
|
9
9
|
onCollapsedChange?: (collapsed: boolean) => void;
|
|
10
|
-
icon?:
|
|
10
|
+
icon?: string;
|
|
11
11
|
children?: ReactNode;
|
|
12
12
|
actions?: ReactNode;
|
|
13
13
|
headline?: ReactNode;
|
|
@@ -3,12 +3,9 @@ import { jsx, jsxs } from 'react/jsx-runtime';
|
|
|
3
3
|
import { useState, useEffect } from 'react';
|
|
4
4
|
import '@inera/ids-design/components/alert-global/alert-global.css';
|
|
5
5
|
import clsx from 'clsx';
|
|
6
|
+
import { useElementId } from '../utils/hooks/useElementId.js';
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
const generateId = () => {
|
|
9
|
-
return `ids-${Math.random().toString(36).slice(2)}-${Math.random().toString(36).slice(2)}`;
|
|
10
|
-
};
|
|
11
|
-
const IDSAlertGlobal = ({ agent = false, showText = "Visa meddelande", hideText = "Dölj meddelande", collapsed = false, noRole = false, onCollapsedChange, icon, children, actions, headline }) => {
|
|
8
|
+
const IDSAlertGlobal = ({ agent = false, showText = "Visa meddelande", hideText = "Dölj meddelande", collapsed = false, noRole = false, onCollapsedChange, icon = "", actions, headline, children, className, ...props }) => {
|
|
12
9
|
const [isCollapsed, setIsCollapsed] = useState(collapsed);
|
|
13
10
|
useEffect(() => {
|
|
14
11
|
setIsCollapsed(collapsed);
|
|
@@ -17,11 +14,13 @@ const IDSAlertGlobal = ({ agent = false, showText = "Visa meddelande", hideText
|
|
|
17
14
|
setIsCollapsed(!isCollapsed);
|
|
18
15
|
onCollapsedChange?.(!isCollapsed);
|
|
19
16
|
};
|
|
20
|
-
const contentId =
|
|
17
|
+
const contentId = useElementId();
|
|
21
18
|
return (jsx("div", { role: noRole ? null : "alert", className: clsx("ids-alert-global", {
|
|
22
19
|
"ids-alert-global--collapsed": isCollapsed,
|
|
23
20
|
"ids-alert-global--agent": agent
|
|
24
|
-
}), children: jsxs("div", { className: "ids-alert-global__inner", children: [jsxs("div", { className: "ids-alert-global__header", children: [jsxs("div", { className:
|
|
21
|
+
}, className), ...props, children: jsxs("div", { className: "ids-alert-global__inner", children: [jsxs("div", { className: "ids-alert-global__header", children: [jsxs("div", { className: clsx("ids-alert-global__icon-headline", {
|
|
22
|
+
"ids-alert-global__icon-headline--agent": agent
|
|
23
|
+
}), children: [icon && (jsx("div", { className: "ids-alert-global__icon", children: jsx("span", { className: `ids-icon-${icon}` }) })), jsx("div", { className: "ids-alert-global__headline", children: headline })] }), jsx("button", { className: clsx("ids-alert-global__button", {
|
|
25
24
|
"ids-alert-global__button--expanded": !isCollapsed
|
|
26
25
|
}), "aria-controls": contentId, "aria-label": isCollapsed ? showText : hideText, "aria-expanded": !isCollapsed, onClick: handleToggleCollapse, children: jsx("span", { className: "ids-alert-global__button-text", children: !isCollapsed ? hideText : showText }) })] }), jsx("div", { id: contentId, className: "ids-alert-global__content", children: children }), jsx("div", { className: "ids-alert-global__sub-content", children: actions })] }) }));
|
|
27
26
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import "@inera/ids-design/components/badge/badge.css";
|
|
3
|
-
interface IDSBadgeProps {
|
|
4
|
-
type?: "primary" | "neutral" | "info" | "attention" | "success" | "error"
|
|
5
|
-
icon?:
|
|
3
|
+
interface IDSBadgeProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
type?: "primary" | "secondary" | "neutral" | "info" | "attention" | "success" | "error";
|
|
5
|
+
icon?: string;
|
|
6
|
+
oldIcon?: ReactNode;
|
|
6
7
|
children?: ReactNode;
|
|
7
8
|
}
|
|
8
9
|
export declare const IDSBadge: React.FC<IDSBadgeProps>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import '@inera/ids-design/components/badge/badge.css';
|
|
3
|
+
import clsx from 'clsx';
|
|
3
4
|
|
|
4
|
-
const IDSBadge = ({ type = "primary", icon, children }) => {
|
|
5
|
-
return (
|
|
5
|
+
const IDSBadge = ({ type = "primary", icon, oldIcon, children, className, ...props }) => {
|
|
6
|
+
return (jsx("div", { className: clsx(`ids-badge ids-badge--${type}`, className), ...props, children: jsxs("div", { className: "ids-badge__inner", children: [oldIcon, icon && jsx("span", { className: `ids-icon-${icon}` }), (icon || oldIcon) && children && jsx("span", { className: "ids-badge__icon" }), children] }) }));
|
|
6
7
|
};
|
|
7
8
|
|
|
8
9
|
export { IDSBadge };
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React, { ButtonHTMLAttributes, ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/box-link/box-link.css";
|
|
3
|
+
interface IDSBoxLinkProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
srButton?: string;
|
|
5
|
+
buttonIcon?: string;
|
|
6
|
+
onButtonClick?: () => void;
|
|
7
|
+
buttonProps?: ButtonHTMLAttributes<HTMLButtonElement>;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const IDSBoxLink: React.FC<IDSBoxLinkProps>;
|
|
11
|
+
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
import '
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import '@inera/ids-design/components/box-link/box-link.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
5
6
|
|
|
6
|
-
const IDSBoxLink =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
7
|
+
const IDSBoxLink = ({ srButton = "", buttonIcon = "", onButtonClick, children, className, buttonProps = {} }) => {
|
|
8
|
+
const boxLinkRef = useRef(null);
|
|
9
|
+
return (jsx("div", { className: clsx("ids-box-link", className), ref: boxLinkRef, children: jsxs("div", { className: "ids-box-link__inner", children: [jsx("span", { className: "ids-box-link__link", children: children }), !!onButtonClick && (jsx("div", { className: "ids-box-link__button", children: jsx("button", { className: `ids-icon-${buttonIcon}`, onClick: onButtonClick, "aria-label": srButton, ...buttonProps }) }))] }) }));
|
|
10
|
+
};
|
|
11
11
|
|
|
12
12
|
export { IDSBoxLink };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import "@inera/ids-design/components/breadcrumbs/breadcrumbs.css";
|
|
3
|
-
interface IDSBreadcrumbsProps {
|
|
3
|
+
interface IDSBreadcrumbsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
4
|
lead?: string;
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
mobileLink?: React.ReactElement<React.AnchorHTMLAttributes<HTMLAnchorElement> | React.LinkHTMLAttributes<HTMLLinkElement>>;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
3
|
import React__default from 'react';
|
|
3
4
|
import '@inera/ids-design/components/breadcrumbs/breadcrumbs.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
4
6
|
|
|
5
|
-
const IDSBreadcrumbs = ({ lead = "Du är här", mobileLink, children }) => {
|
|
7
|
+
const IDSBreadcrumbs = ({ lead = "Du är här", mobileLink, children, className, ...props }) => {
|
|
6
8
|
const getMobileLink = () => {
|
|
7
9
|
if (mobileLink) {
|
|
8
10
|
return React__default.cloneElement(mobileLink, { className: "ids-breadcrumbs__mobile-link" });
|
|
@@ -23,7 +25,7 @@ const IDSBreadcrumbs = ({ lead = "Du är här", mobileLink, children }) => {
|
|
|
23
25
|
}
|
|
24
26
|
});
|
|
25
27
|
};
|
|
26
|
-
return (jsxs("nav", { className: "ids-breadcrumbs", "aria-label": lead, children: [jsxs("ol", { className: "ids-breadcrumbs__desktop", children: [jsx("li", { className: "ids-breadcrumbs__lead", children: lead }), getLinks()] }), jsx("ol", { className: "ids-breadcrumbs__mobile", children: jsxs("li", { className: "ids-breadcrumbs__mobile-links", children: [jsx("span", { className: "ids-breadcrumbs__icon" }), getMobileLink()] }) })] }));
|
|
28
|
+
return (jsxs("nav", { className: clsx("ids-breadcrumbs", className), "aria-label": lead, ...props, children: [jsxs("ol", { className: "ids-breadcrumbs__desktop", children: [jsx("li", { className: "ids-breadcrumbs__lead", children: lead }), getLinks()] }), jsx("ol", { className: "ids-breadcrumbs__mobile", children: jsxs("li", { className: "ids-breadcrumbs__mobile-links", children: [jsx("span", { className: "ids-breadcrumbs__icon" }), getMobileLink()] }) })] }));
|
|
27
29
|
};
|
|
28
30
|
|
|
29
31
|
export { IDSBreadcrumbs };
|
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import React, { ReactNode, ButtonHTMLAttributes } from "react";
|
|
2
|
+
type ButtonSize = "s" | "m" | "l";
|
|
3
|
+
export interface IDSButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
4
|
+
active?: boolean;
|
|
5
|
+
block?: boolean;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
fab?: boolean;
|
|
8
|
+
iconButton?: boolean;
|
|
9
|
+
oldIcon?: ReactNode;
|
|
10
|
+
icon?: string;
|
|
11
|
+
mBlock?: boolean;
|
|
12
|
+
sBlock?: boolean;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
tertiary?: boolean;
|
|
15
|
+
secondary?: boolean;
|
|
16
|
+
size?: ButtonSize;
|
|
17
|
+
submit?: boolean;
|
|
18
|
+
toggle?: boolean;
|
|
19
|
+
focusAnchor?: boolean;
|
|
20
|
+
children?: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
export declare const IDSButton: React.ForwardRefExoticComponent<IDSButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
23
|
+
export {};
|
|
@@ -1,15 +1,98 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import React__default, { forwardRef, useState, useRef, useEffect } from 'react';
|
|
5
5
|
|
|
6
|
-
const IDSButton =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
const IDSButton = forwardRef(({ active = false, block = false, disabled = false, fab = false, iconButton = false, icon = "", oldIcon = false, mBlock = false, sBlock = false, loading = false, tertiary = false, secondary = false, size = "m", submit = false, toggle = false, focusAnchor = false, children, className, ...props }, ref) => {
|
|
7
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
8
|
+
const oldIconRef = useRef(null);
|
|
9
|
+
const handleMouseEnter = () => {
|
|
10
|
+
if (!disabled && oldIconRef.current) {
|
|
11
|
+
setIconHoveredAttributes(oldIconRef.current);
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
const handleMouseLeave = () => {
|
|
15
|
+
if (oldIconRef.current) {
|
|
16
|
+
setOldIconAttributes(oldIconRef.current);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const handleFocus = () => {
|
|
20
|
+
setIsFocused(true);
|
|
21
|
+
if (!disabled && oldIconRef.current) {
|
|
22
|
+
setIconHoveredAttributes(oldIconRef.current);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const handleBlur = () => {
|
|
26
|
+
setIsFocused(false);
|
|
27
|
+
};
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
if (oldIconRef.current) {
|
|
30
|
+
oldIconRef.current.setAttribute("size", "s");
|
|
31
|
+
if (!fab) {
|
|
32
|
+
setOldIconAttributes(oldIconRef.current);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, []);
|
|
36
|
+
const classNames = clsx("ids-button", size && `ids-button--${size}`, {
|
|
37
|
+
"ids-button--m-block": mBlock,
|
|
38
|
+
"ids-button--s-block": sBlock,
|
|
39
|
+
"ids-button--active": active || isFocused,
|
|
40
|
+
"ids-button--fab": fab,
|
|
41
|
+
"ids-button--icon": ((icon || oldIcon) && !children) || iconButton,
|
|
42
|
+
"ids-button--secondary": secondary,
|
|
43
|
+
"ids-button--tertiary": tertiary,
|
|
44
|
+
"ids-button--disabled": disabled,
|
|
45
|
+
"ids-button--block": block,
|
|
46
|
+
"ids-button--submit": submit,
|
|
47
|
+
"ids-button--loading": loading,
|
|
48
|
+
"ids-focus-anchor": focusAnchor
|
|
49
|
+
}, className);
|
|
50
|
+
const setOldIconAttributes = (iconComponent) => {
|
|
51
|
+
if (iconComponent && !fab) {
|
|
52
|
+
let color = "var(--IDS-BUTTON__ICON-COLOR)";
|
|
53
|
+
let color2 = "var(--IDS-BUTTON__ICON-COLOR-2)";
|
|
54
|
+
if (secondary) {
|
|
55
|
+
color = active
|
|
56
|
+
? "var(--IDS-BUTTON--SECONDARY-ACTIVE__ICON-COLOR)"
|
|
57
|
+
: "var(--IDS-BUTTON--SECONDARY__ICON-COLOR)";
|
|
58
|
+
color2 = active
|
|
59
|
+
? "var(--IDS-BUTTON--SECONDARY-ACTIVE__ICON-COLOR-2)"
|
|
60
|
+
: "var(--IDS-BUTTON--SECONDARY__ICON-COLOR-2)";
|
|
61
|
+
}
|
|
62
|
+
else if (tertiary) {
|
|
63
|
+
color = "var(--IDS-BUTTON--TERTIARY__ICON-COLOR)";
|
|
64
|
+
color2 = "var(--IDS-BUTTON--TERTIARY__ICON-COLOR-2)";
|
|
65
|
+
}
|
|
66
|
+
if (disabled) {
|
|
67
|
+
color = "var(--IDS-BUTTON--DISABLED__COLOR)";
|
|
68
|
+
color2 = "var(--IDS-BUTTON--DISABLED__COLOR)";
|
|
69
|
+
}
|
|
70
|
+
setOldIconColors(iconComponent, color, color2);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
const setIconHoveredAttributes = (iconComponent) => {
|
|
74
|
+
if (oldIcon && !fab) {
|
|
75
|
+
let color = "var(--IDS-BUTTON--ACTIVE__ICON-COLOR)";
|
|
76
|
+
let color2 = "var(--IDS-BUTTON--ACTIVE__ICON-COLOR-2)";
|
|
77
|
+
if (secondary) {
|
|
78
|
+
color = "var(--IDS-BUTTON--SECONDARY-ACTIVE__ICON-COLOR)";
|
|
79
|
+
color2 = "var(--IDS-BUTTON--SECONDARY-ACTIVE__ICON-COLOR-2)";
|
|
80
|
+
}
|
|
81
|
+
else if (tertiary) {
|
|
82
|
+
color = "var(--IDS-BUTTON--TERTIARY-ACTIVE__ICON-COLOR)";
|
|
83
|
+
color2 = "var(--IDS-BUTTON--TERTIARY-ACTIVE__ICON-COLOR-2)";
|
|
84
|
+
}
|
|
85
|
+
setOldIconColors(iconComponent, color, color2);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
const setOldIconColors = (iconComponent, color, color2) => {
|
|
89
|
+
iconComponent.setAttribute("color", color);
|
|
90
|
+
iconComponent.setAttribute("color2", color2);
|
|
91
|
+
};
|
|
92
|
+
const renderOldIcon = oldIcon && React__default.isValidElement(oldIcon)
|
|
93
|
+
? React__default.cloneElement(oldIcon, { ref: oldIconRef })
|
|
94
|
+
: oldIcon;
|
|
95
|
+
return (jsxs("button", { ref: ref, className: classNames, "aria-disabled": disabled || loading, "aria-pressed": toggle, tabIndex: !disabled && !loading ? 0 : -1, disabled: disabled, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onFocus: handleFocus, onBlur: handleBlur, ...props, children: [icon && jsx("span", { className: `ids-icon-${icon}` }), oldIcon && renderOldIcon, children] }));
|
|
13
96
|
});
|
|
14
97
|
|
|
15
98
|
export { IDSButton };
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/button-group/button-group.css";
|
|
3
|
+
type Justify = "start" | "center" | "end";
|
|
4
|
+
type Break = "s" | "m";
|
|
5
|
+
interface IDSButtonGroupProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
rtl?: boolean;
|
|
7
|
+
justify?: Justify;
|
|
8
|
+
unresponsive?: boolean;
|
|
9
|
+
break?: Break;
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const IDSButtonGroup: React.FC<IDSButtonGroupProps>;
|
|
13
|
+
export {};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
import '@inera/ids-
|
|
3
|
-
import
|
|
4
|
-
import { createComponent } from '@lit-labs/react';
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import '@inera/ids-design/components/button-group/button-group.css';
|
|
3
|
+
import clsx from 'clsx';
|
|
5
4
|
|
|
6
|
-
const IDSButtonGroup =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
});
|
|
5
|
+
const IDSButtonGroup = ({ rtl = false, justify = "start", unresponsive = false, break: breakpoint = "m", children, className, ...props }) => {
|
|
6
|
+
const classNames = clsx("ids-button-group", `ids-button-group--break-${breakpoint}`, `ids-button-group--${justify}`, {
|
|
7
|
+
"ids-button-group--rtl": rtl,
|
|
8
|
+
"ids-button-group--unresponsive": unresponsive
|
|
9
|
+
}, className);
|
|
10
|
+
return (jsx("div", { className: classNames, ...props, children: children }));
|
|
11
|
+
};
|
|
11
12
|
|
|
12
13
|
export { IDSButtonGroup };
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import "@inera/ids-design/components/card/card.css";
|
|
3
|
-
interface IDSCardProps {
|
|
4
|
-
|
|
3
|
+
interface IDSCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
focusCard?: boolean;
|
|
5
|
+
fill?: boolean;
|
|
5
6
|
borderTop?: number;
|
|
6
7
|
lean?: boolean;
|
|
7
8
|
hideOnM?: boolean;
|
|
8
9
|
hideOnS?: boolean;
|
|
9
|
-
|
|
10
|
+
cardLink?: ReactNode;
|
|
10
11
|
children?: ReactNode;
|
|
11
12
|
}
|
|
12
13
|
export declare const IDSCard: React.FC<IDSCardProps>;
|
package/components/card/card.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { isValidElement, cloneElement } from 'react';
|
|
2
3
|
import '@inera/ids-design/components/card/card.css';
|
|
4
|
+
import clsx from 'clsx';
|
|
3
5
|
|
|
4
|
-
const IDSCard = ({ fill =
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
6
|
+
const IDSCard = ({ focusCard = false, fill = false, borderTop = 0, lean = false, hideOnM = false, hideOnS = false, cardLink, children, className, ...props }) => {
|
|
7
|
+
const enhancedCardLink = isValidElement(cardLink)
|
|
8
|
+
? cloneElement(cardLink, {
|
|
9
|
+
className: clsx(cardLink.props.className, "ids-card--interactive-link")
|
|
10
|
+
})
|
|
11
|
+
: cardLink;
|
|
12
|
+
return (jsxs("div", { className: clsx("ids-card", !focusCard && borderTop && `ids-card--border-top-${borderTop}`, {
|
|
13
|
+
"ids-card--fill": fill,
|
|
14
|
+
"ids-card--focus-card": focusCard && !borderTop,
|
|
15
|
+
"ids-card--hide-on-m": hideOnM,
|
|
16
|
+
"ids-card--hide-on-s": hideOnS,
|
|
17
|
+
"ids-card--lean": lean,
|
|
18
|
+
"ids-card--interactive": !!cardLink
|
|
19
|
+
}, className), ...props, children: [borderTop > 0 && !focusCard && jsx("div", { className: "ids-card__border-top" }), jsx("div", { className: "ids-card__content", children: children }), enhancedCardLink] }));
|
|
12
20
|
};
|
|
13
21
|
|
|
14
22
|
export { IDSCard };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "@inera/ids-design/components/carousel/carousel-item.css";
|
|
3
|
+
interface IDSCarouselItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
headline?: string;
|
|
5
|
+
step?: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
export declare const IDSCarouselItem: React.FC<IDSCarouselItemProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React__default from 'react';
|
|
4
|
+
import '@inera/ids-design/components/carousel/carousel-item.css';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
|
|
7
|
+
const IDSCarouselItem = ({ headline, step, description, children, className }) => {
|
|
8
|
+
const isImageElement = (child) => {
|
|
9
|
+
return React__default.isValidElement(child) && child.type === "img";
|
|
10
|
+
};
|
|
11
|
+
const findCarouselImage = (children) => {
|
|
12
|
+
return children.find(isImageElement);
|
|
13
|
+
};
|
|
14
|
+
const getNonImageContent = (children) => {
|
|
15
|
+
return children.filter(child => !isImageElement(child));
|
|
16
|
+
};
|
|
17
|
+
const childrenArray = React__default.Children.toArray(children);
|
|
18
|
+
const image = findCarouselImage(childrenArray);
|
|
19
|
+
const otherContent = getNonImageContent(childrenArray);
|
|
20
|
+
const hasFooterContent = description || step;
|
|
21
|
+
return (jsxs("div", { className: clsx("ids-carousel-item", className), children: [jsx("div", { className: "ids-carousel-item__image", children: image }), jsxs("div", { className: "ids-carousel-item__content", children: [headline && jsx("h2", { className: "ids-carousel-item__headline", children: headline }), otherContent, hasFooterContent && (jsxs("div", { className: "ids-carousel-item__footer", children: [description && jsx("div", { className: "ids-carousel-item__description", children: description }), step && (jsx("div", { className: "ids-carousel-item__step", children: jsx("div", { className: "ids-tag", children: step }) }))] }))] })] }));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { IDSCarouselItem };
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "@inera/ids-design/components/carousel/carousel.css";
|
|
3
|
+
interface IDSCarouselProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
autoplay?: boolean;
|
|
5
|
+
autoplayDelay?: number;
|
|
6
|
+
srNextLabel?: string;
|
|
7
|
+
srPrevLabel?: string;
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export declare const IDSCarousel: React.FC<IDSCarouselProps>;
|
|
11
|
+
export {};
|