@inera/ids-react 7.1.1 → 7.2.1
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.
|
@@ -51,7 +51,6 @@ const IDSDialog = ({ show = false, srClose = "Stäng", dismissible = false, auto
|
|
|
51
51
|
const focusable = bodyRef.current?.querySelector(".ids-focus-anchor") ||
|
|
52
52
|
bodyRef.current?.querySelector("h1, h2, h3, [tabindex]:not([tabindex='-1']), button:not([disabled]), a, input:not([disabled]), textarea:not([disabled])") ||
|
|
53
53
|
dialogRef.current?.querySelector("button.ids-dialog__header__button");
|
|
54
|
-
console.log("focusable", focusable);
|
|
55
54
|
focusable?.focus();
|
|
56
55
|
});
|
|
57
56
|
}
|
|
@@ -5,23 +5,19 @@ import '@inera/ids-design/components/header-inera-admin/header-inera-admin.css';
|
|
|
5
5
|
import clsx from 'clsx';
|
|
6
6
|
import { HeaderProvider } from '../utils/contexts/HeaderContext.js';
|
|
7
7
|
|
|
8
|
-
const IDSHeaderIneraAdmin = ({ brandText = "", fluid = false, unresponsive = false, items, avatar, skipToContent, brandLink, serviceName = "EN TJÄNST FRÅN INERA", mobileMenu, className, children }) => {
|
|
8
|
+
const IDSHeaderIneraAdmin = ({ brandText = "", fluid = false, unresponsive = false, showLogo = false, items, avatar, skipToContent, brandLink, serviceName = "EN TJÄNST FRÅN INERA", mobileMenu, className, children }) => {
|
|
9
9
|
const renderBrandText = () => {
|
|
10
10
|
if (brandLink && isValidElement(brandLink)) {
|
|
11
|
-
return (jsx("span", { className: "ids-header-inera-admin__brand-
|
|
12
|
-
...brandLink.props
|
|
13
|
-
children: brandText
|
|
11
|
+
return (jsx("span", { className: "ids-header-inera-admin__brand-link", children: cloneElement(brandLink, {
|
|
12
|
+
...brandLink.props
|
|
14
13
|
}) }));
|
|
15
14
|
}
|
|
16
|
-
if (brandText) {
|
|
17
|
-
return jsx("h1", { className: "ids-header-inera-admin__brand-text", children: brandText });
|
|
18
|
-
}
|
|
19
15
|
return null;
|
|
20
16
|
};
|
|
21
17
|
return (jsx(HeaderProvider, { value: { unresponsive, fluid, hideRegionPicker: true, regionPickerText: "" }, children: jsxs("header", { className: clsx("ids-header-inera-admin", {
|
|
22
18
|
"ids-header-inera-admin--unresponsive": unresponsive,
|
|
23
19
|
"ids-header-inera-admin--fluid": fluid
|
|
24
|
-
}, className), children: [skipToContent &&
|
|
20
|
+
}, className), children: [skipToContent && jsx("div", { className: "ids-header-inera-admin__skip-to-content", children: skipToContent }), jsxs("div", { className: "ids-header-inera-admin__inner", children: [jsx("div", { className: "ids-header-inera-admin__service-wrapper", children: jsxs("div", { className: "ids-header-inera-admin__brand", children: [showLogo && jsx("div", { className: "ids-header-inera-admin__logo", "aria-label": "Logotyp inera" }), jsxs("div", { className: "ids-header-inera-admin__brand-inner", children: [renderBrandText(), jsx("h1", { className: "ids-header-inera-admin__brand-text", children: brandText }), jsx("h2", { className: "ids-header-inera-admin__service-name", children: serviceName })] })] }) }), jsxs("div", { className: "ids-header-inera-admin__items", children: [items, " ", avatar, " ", mobileMenu] })] }), children] }) }));
|
|
25
21
|
};
|
|
26
22
|
|
|
27
23
|
export { IDSHeaderIneraAdmin };
|
|
@@ -3,6 +3,7 @@ import "@inera/ids-design/components/tabs/tabs.css";
|
|
|
3
3
|
import { IDSTabProps } from "./tab";
|
|
4
4
|
interface IDSTabsProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
5
|
unresponsive?: boolean;
|
|
6
|
+
light?: boolean;
|
|
6
7
|
compact?: boolean;
|
|
7
8
|
breakpoint?: "m" | "s";
|
|
8
9
|
selectLabel?: string;
|
package/components/tabs/tabs.js
CHANGED
|
@@ -6,7 +6,7 @@ import '@inera/ids-design/components/tabs/tabs.css';
|
|
|
6
6
|
import { useElementId } from '../utils/hooks/useElementId.js';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
|
|
9
|
-
const IDSTabs = ({ unresponsive = false, compact = false, breakpoint = "m", selectLabel = "", tabs = [], children, className, onTabChange }) => {
|
|
9
|
+
const IDSTabs = ({ unresponsive = false, light = false, compact = false, breakpoint = "m", selectLabel = "", tabs = [], children, className, onTabChange }) => {
|
|
10
10
|
const tabsId = useElementId();
|
|
11
11
|
const initialSelectedIndex = tabs.findIndex(tab => React__default.isValidElement(tab) && tab.props.selected === true);
|
|
12
12
|
const [activeTab, setActiveTab] = useState(initialSelectedIndex !== -1 ? initialSelectedIndex : 0);
|
|
@@ -68,14 +68,28 @@ const IDSTabs = ({ unresponsive = false, compact = false, breakpoint = "m", sele
|
|
|
68
68
|
handleSelect(index);
|
|
69
69
|
};
|
|
70
70
|
const renderTabOptions = () => tabs?.map((tab, i) => {
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
if (!React__default.isValidElement(tab))
|
|
72
|
+
return null;
|
|
73
|
+
const { label, notification } = tab.props;
|
|
74
|
+
let notificationText = "";
|
|
75
|
+
if (typeof notification === "string" || typeof notification === "number") {
|
|
76
|
+
notificationText = String(notification);
|
|
77
|
+
}
|
|
78
|
+
else if (React__default.isValidElement(notification)) {
|
|
79
|
+
const badge = notification;
|
|
80
|
+
const childTexts = React__default.Children.toArray(badge.props.children)
|
|
81
|
+
.map(child => (typeof child === "string" || typeof child === "number" ? child : ""))
|
|
82
|
+
.join("");
|
|
83
|
+
notificationText = childTexts.trim();
|
|
84
|
+
}
|
|
85
|
+
const optionLabel = notificationText ? `${label} (${notificationText})` : label;
|
|
86
|
+
return (jsx("option", { value: i, children: optionLabel }, i));
|
|
73
87
|
});
|
|
74
88
|
return (jsxs("div", { className: clsx("ids-tabs", {
|
|
75
89
|
"ids-tabs--unresponsive": unresponsive,
|
|
76
90
|
"ids-tabs--responsive-on-m": responsiveOnM,
|
|
77
91
|
"ids-tabs--responsive-on-s": responsiveOnS
|
|
78
|
-
}, className), children: [jsx("div", { className: "ids-tabs__select", children: jsx(IDSSelect, { label: selectLabel, onChange: tabChangedFromSelect, value: activeTab, children: renderTabOptions() }) }), jsx("div", { className: "ids-tabs__tabs", role: "tablist", children: enhancedTabs }), jsx("div", { className: "ids-tabs__panels", children: enhancedTabPanels })] }));
|
|
92
|
+
}, className), children: [jsx("div", { className: "ids-tabs__select", children: jsx(IDSSelect, { label: selectLabel, onChange: tabChangedFromSelect, value: activeTab, light: light, children: renderTabOptions() }) }), jsx("div", { className: "ids-tabs__tabs", role: "tablist", children: enhancedTabs }), jsx("div", { className: "ids-tabs__panels", children: enhancedTabPanels })] }));
|
|
79
93
|
};
|
|
80
94
|
|
|
81
95
|
export { IDSTabs };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inera/ids-react",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"react": "*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@inera/ids-core": "7.
|
|
9
|
+
"@inera/ids-core": "7.2.x",
|
|
10
10
|
"@lit-labs/react": "^1.1.0",
|
|
11
11
|
"clsx": "*"
|
|
12
12
|
},
|