@inera/ids-react 8.1.0 → 8.2.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/action-link/action-link.d.ts +6 -0
- package/components/action-link/action-link.js +9 -0
- package/components/form/checkbox/checkbox.js +3 -2
- package/components/form/datepicker/datepicker.d.ts +29 -0
- package/components/form/datepicker/datepicker.js +179 -0
- package/components/form/input/input.js +1 -1
- package/components/form/radio/radio.js +2 -1
- package/components/grid/container.d.ts +1 -0
- package/components/grid/container.js +8 -4
- package/components/navigation/content/navigation-content.js +1 -1
- package/components/notification/badge/notification-badge.js +1 -1
- package/components/popover/popover.js +1 -1
- package/components/stepper/step.js +1 -1
- package/components/tabs/tab.js +1 -1
- package/components/utils/hooks/useFocusTrap.js +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/package.json +2 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/action-link/action-link.css";
|
|
3
|
+
export interface IDSActionLinkProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
image?: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare function IDSActionLink({ image, children, className, ...props }: IDSActionLinkProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import '@inera/ids-design/components/action-link/action-link.css';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
|
|
5
|
+
function IDSActionLink({ image, children, className, ...props }) {
|
|
6
|
+
return (jsx("div", { className: clsx("ids-action-link", className), ...props, children: jsxs("div", { className: "ids-action-link__inner", children: [jsx("div", { className: "ids-action-link__image", children: image }), children, jsx("div", { className: "ids-action-link__icon", "aria-hidden": "true" })] }) }));
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export { IDSActionLink };
|
|
@@ -47,8 +47,9 @@ const IDSCheckbox = forwardRef(({ invalid = false, disabled = false, required =
|
|
|
47
47
|
}), "aria-invalid": isInvalid, disabled: disabled, "aria-disabled": disabled, required: !noValidation && required, "aria-required": !noValidation && required, ...props }), jsxs("div", { className: clsx("ids-label-tooltip-wrapper", {
|
|
48
48
|
"ids-label-tooltip-wrapper--block": block,
|
|
49
49
|
"ids-label-tooltip-wrapper--inline": tooltip
|
|
50
|
-
}), children: [jsx("label", { htmlFor: fieldId, className: clsx("ids-checkbox__label", {
|
|
51
|
-
"ids-label--clickable": disabled,
|
|
50
|
+
}), children: [jsx("label", { htmlFor: fieldId, className: clsx("ids-checkbox__label ids-label", {
|
|
51
|
+
"ids-label--clickable": !disabled,
|
|
52
|
+
"ids-label--disabled": disabled,
|
|
52
53
|
"ids-label--no-label": noLabel
|
|
53
54
|
}), children: !noLabel && children }), tooltip] })] }), isInvalid && errorMsg && (jsx(IDSErrorMessage, { id: errorMsgId, show: true, compact: true, children: errorMsg }))] }));
|
|
54
55
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Matcher, Modifiers } from "react-day-picker";
|
|
3
|
+
import "@inera/ids-design/components/form/datepicker/datepicker.css";
|
|
4
|
+
export interface IDSDatePickerProps extends React.HTMLAttributes<HTMLElement> {
|
|
5
|
+
label: string;
|
|
6
|
+
value?: string;
|
|
7
|
+
light?: boolean;
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
calendarHeader?: string;
|
|
10
|
+
defaultMonth?: Date;
|
|
11
|
+
startMonth?: Date;
|
|
12
|
+
endMonth?: Date;
|
|
13
|
+
srOpenText?: string;
|
|
14
|
+
srCloseText?: string;
|
|
15
|
+
focusedDay?: Date;
|
|
16
|
+
disabled?: boolean;
|
|
17
|
+
required?: boolean;
|
|
18
|
+
noValidation?: boolean;
|
|
19
|
+
errorMsg?: string;
|
|
20
|
+
missingDateErrorMsg?: string;
|
|
21
|
+
invalidDateErrorMsg?: string;
|
|
22
|
+
invalid?: boolean;
|
|
23
|
+
disableNavigation?: boolean;
|
|
24
|
+
modifiers?: Record<string, Matcher | Matcher[]>;
|
|
25
|
+
onOpen?: () => void;
|
|
26
|
+
onClose?: () => void;
|
|
27
|
+
onDayClick?: (date: Date, modifiers: Modifiers, e: React.MouseEvent) => void;
|
|
28
|
+
}
|
|
29
|
+
export declare function IDSDatePicker({ label, value, light, placeholder, errorMsg, missingDateErrorMsg, invalidDateErrorMsg, calendarHeader, srOpenText, srCloseText, defaultMonth, startMonth, endMonth, noValidation, disabled, required, invalid, disableNavigation, modifiers, focusedDay, onChange, onFocus, onBlur, onOpen, onClose, onDayClick, className, ...props }: IDSDatePickerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useRef, useState, useEffect } from 'react';
|
|
3
|
+
import { getWeek, format, isValid, subMonths, addMonths } from 'date-fns';
|
|
4
|
+
import { sv } from 'react-day-picker/locale';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { useElementId } from '../../utils/hooks/useElementId.js';
|
|
7
|
+
import { IDSErrorMessage } from '../error-message/error-message.js';
|
|
8
|
+
import { DayPicker, WeekNumberHeader, MonthsDropdown, YearsDropdown, useDayPicker, DropdownNav } from 'react-day-picker';
|
|
9
|
+
import { useFocusTrap } from '../../utils/hooks/useFocusTrap.js';
|
|
10
|
+
import { useAriaDescribedBy } from '../form-hooks/useAriaDescribedBy.js';
|
|
11
|
+
import '@inera/ids-design/components/form/datepicker/datepicker.css';
|
|
12
|
+
|
|
13
|
+
const locale = { locale: sv };
|
|
14
|
+
const createNewDate = (dateString) => {
|
|
15
|
+
return new Date(dateString + "T00:00:00Z");
|
|
16
|
+
};
|
|
17
|
+
const getSweMonth = (date) => {
|
|
18
|
+
return `${format(date, "MMMM", locale)}`;
|
|
19
|
+
};
|
|
20
|
+
const getSweYear = (date) => {
|
|
21
|
+
return `${format(date, "yyyy", locale)}`;
|
|
22
|
+
};
|
|
23
|
+
const getPrevMonthYear = (date) => {
|
|
24
|
+
return `${getSweMonth(subMonths(date, 1))} ${getSweYear(subMonths(date, 1))}`;
|
|
25
|
+
};
|
|
26
|
+
const getNextMonthYear = (date) => {
|
|
27
|
+
return `${getSweMonth(addMonths(date, 1))} ${getSweYear(addMonths(date, 1))}`;
|
|
28
|
+
};
|
|
29
|
+
function IDSDatePicker({ label, value = "", light = false, placeholder = "åååå/mm/dd", errorMsg = "", missingDateErrorMsg = "Datum saknas", invalidDateErrorMsg = "Ogiltigt datum", calendarHeader = "Välj datum", srOpenText = "Öppna kalendern", srCloseText = "Stäng kalendern", defaultMonth, startMonth = new Date(1900, 0, 1), endMonth = new Date(2050, 0, 1), noValidation = false, disabled = false, required = false, invalid = false, disableNavigation = false, modifiers, focusedDay, onChange, onFocus, onBlur, onOpen, onClose, onDayClick, className, ...props }) {
|
|
30
|
+
const shortWeek = "v.";
|
|
31
|
+
const inputRef = useRef(null);
|
|
32
|
+
const triggerRef = useRef(null);
|
|
33
|
+
const dialogRef = useRef(null);
|
|
34
|
+
const headerRef = useRef(null);
|
|
35
|
+
const prevMonthButtonRef = useRef(null);
|
|
36
|
+
const nextMonthButtonRef = useRef(null);
|
|
37
|
+
const dialogId = useElementId();
|
|
38
|
+
const headerId = useElementId();
|
|
39
|
+
const inputId = useElementId();
|
|
40
|
+
const errorMsgId = useElementId();
|
|
41
|
+
const [isDialogOpen, setIsDialogOpen] = useState(false);
|
|
42
|
+
const [inputValue, setInputValue] = useState(value);
|
|
43
|
+
const initialSelectedDate = !!value ? createNewDate(value) : undefined;
|
|
44
|
+
const [selectedDate, setSelectedDate] = useState(initialSelectedDate || defaultMonth);
|
|
45
|
+
const [month, setMonth] = useState(initialSelectedDate || defaultMonth || new Date());
|
|
46
|
+
const [hasDateError, setHasDateError] = useState(false);
|
|
47
|
+
const [hasMissingError, setHasMissingError] = useState(false);
|
|
48
|
+
const [isInvalid, setIsInvalid] = useState(invalid);
|
|
49
|
+
const showInvalidError = !!hasDateError && !!invalidDateErrorMsg;
|
|
50
|
+
const showMissingError = !!hasMissingError && !!missingDateErrorMsg;
|
|
51
|
+
const showError = !!invalid && !!errorMsg;
|
|
52
|
+
useAriaDescribedBy(inputRef, errorMsgId, isInvalid, (showError || showMissingError || showInvalidError) && !noValidation);
|
|
53
|
+
useFocusTrap(dialogRef.current, isDialogOpen);
|
|
54
|
+
const handleOpenDialog = (e) => {
|
|
55
|
+
e.preventDefault();
|
|
56
|
+
setIsDialogOpen(true);
|
|
57
|
+
onOpen?.();
|
|
58
|
+
};
|
|
59
|
+
const closeDialog = () => {
|
|
60
|
+
setIsDialogOpen(false);
|
|
61
|
+
triggerRef.current.focus();
|
|
62
|
+
onClose?.();
|
|
63
|
+
};
|
|
64
|
+
const handleDayPickerSelect = (date) => {
|
|
65
|
+
const dateString = format(date, "yyyy-MM-dd");
|
|
66
|
+
setHasMissingError(false);
|
|
67
|
+
setIsInvalid(false);
|
|
68
|
+
setHasDateError(false);
|
|
69
|
+
if (!date) {
|
|
70
|
+
setInputValue("");
|
|
71
|
+
setSelectedDate(undefined);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
setSelectedDate(date);
|
|
75
|
+
setInputValue(dateString);
|
|
76
|
+
}
|
|
77
|
+
requestAnimationFrame(() => {
|
|
78
|
+
if (inputRef.current) {
|
|
79
|
+
inputRef.current.reportValidity();
|
|
80
|
+
inputRef.current.dispatchEvent(new Event("input", { bubbles: true }));
|
|
81
|
+
inputRef.current.dispatchEvent(new Event("change", { bubbles: true }));
|
|
82
|
+
setHasMissingError(!noValidation && required && inputRef.current.validity.valueMissing);
|
|
83
|
+
setIsInvalid(!inputRef.current.validity.valid || invalid);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
emitValue(dateString, date);
|
|
87
|
+
closeDialog();
|
|
88
|
+
};
|
|
89
|
+
const handleInvalid = (e) => {
|
|
90
|
+
setHasMissingError(!noValidation && required && e.target.validity.valueMissing);
|
|
91
|
+
setIsInvalid(!e.target.validity.valid || invalid);
|
|
92
|
+
};
|
|
93
|
+
const handleInputChange = (e) => {
|
|
94
|
+
setHasMissingError(false);
|
|
95
|
+
setIsInvalid(false);
|
|
96
|
+
setHasDateError(false);
|
|
97
|
+
setInputValue(e.target.value);
|
|
98
|
+
const parsedDate = createNewDate(e.target.value);
|
|
99
|
+
if (isValid(parsedDate)) {
|
|
100
|
+
setSelectedDate(parsedDate);
|
|
101
|
+
setMonth(parsedDate);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
setSelectedDate(undefined);
|
|
105
|
+
}
|
|
106
|
+
emitValue(e.target.value, parsedDate);
|
|
107
|
+
};
|
|
108
|
+
const emitValue = (val, parsedDate) => {
|
|
109
|
+
const isMissing = required && !val;
|
|
110
|
+
const isValidDate = parsedDate instanceof Date && isValid(parsedDate);
|
|
111
|
+
const customEvent = new CustomEvent("change", {
|
|
112
|
+
detail: {
|
|
113
|
+
value: val,
|
|
114
|
+
valueAsDate: isValidDate ? createNewDate(val) : undefined,
|
|
115
|
+
invalidDate: !isValid(parsedDate),
|
|
116
|
+
missingDate: isMissing
|
|
117
|
+
},
|
|
118
|
+
bubbles: true
|
|
119
|
+
});
|
|
120
|
+
onChange?.(customEvent);
|
|
121
|
+
};
|
|
122
|
+
const handleBlur = () => {
|
|
123
|
+
setHasDateError(!noValidation && value.trim().length && !isValid(selectedDate));
|
|
124
|
+
};
|
|
125
|
+
function CustomNav(props) {
|
|
126
|
+
// Add the nav buttons after the dropdowns for correct tab order
|
|
127
|
+
const { children } = props;
|
|
128
|
+
const { goToMonth, previousMonth, nextMonth } = useDayPicker();
|
|
129
|
+
const currentMonth = "aktuell månad";
|
|
130
|
+
const goTo = "gå till";
|
|
131
|
+
const goToPrevMonth = () => {
|
|
132
|
+
previousMonth && goToMonth(previousMonth);
|
|
133
|
+
requestAnimationFrame(() => {
|
|
134
|
+
if (prevMonthButtonRef.current) {
|
|
135
|
+
prevMonthButtonRef.current.focus();
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
const goToNextMonth = () => {
|
|
140
|
+
nextMonth && goToMonth(nextMonth);
|
|
141
|
+
requestAnimationFrame(() => {
|
|
142
|
+
if (nextMonthButtonRef.current) {
|
|
143
|
+
nextMonthButtonRef.current.focus();
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
return (jsxs(DropdownNav, { className: "ids-datepicker__nav", ...props, children: [jsx("div", { className: "ids-datepicker__nav-dropdowns", children: children }), jsxs("div", { className: "ids-datepicker__nav-buttons", children: [jsx("button", { type: "button", ref: prevMonthButtonRef, className: "ids-datepicker__nav-prev", onClick: goToPrevMonth, disabled: !previousMonth || disableNavigation, "aria-label": `${currentMonth} ${getSweMonth(month)}. ${goTo} ${getPrevMonthYear(month)}` }), jsx("button", { type: "button", ref: nextMonthButtonRef, className: "ids-datepicker__nav-next", onClick: goToNextMonth, disabled: !nextMonth || disableNavigation, "aria-label": `${currentMonth} ${getSweMonth(month)}. ${goTo} ${getNextMonthYear(month)}` })] })] }));
|
|
148
|
+
}
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
const header = headerRef.current;
|
|
151
|
+
if (!header)
|
|
152
|
+
return;
|
|
153
|
+
header?.focus();
|
|
154
|
+
}, [isDialogOpen]);
|
|
155
|
+
return (jsxs("div", { className: clsx("ids-datepicker", { "ids-datepicker--invalid": !noValidation && (isInvalid || hasDateError) }, className), ...props, children: [isDialogOpen && jsx("div", { className: "ids-datepicker__overlay" }), jsx("label", { htmlFor: inputId, className: "ids-label", children: label }), jsxs("div", { className: "ids-datepicker__input-wrapper", children: [jsx("input", { className: clsx("ids-datepicker__input", { "ids-input--light": light }), ref: inputRef, style: { fontSize: "inherit" }, id: inputId, type: "text", value: inputValue, required: required, disabled: disabled, "aria-invalid": !noValidation && (isInvalid || hasDateError), placeholder: placeholder, onChange: handleInputChange, onInvalid: handleInvalid, onBlur: handleBlur }), jsx("button", { ref: triggerRef, className: "ids-datepicker__trigger", style: { fontSize: "inherit" }, disabled: disabled, onClick: handleOpenDialog, "aria-controls": "dialog", "aria-haspopup": "dialog", "aria-expanded": isDialogOpen, "aria-label": srOpenText }), jsxs("div", { className: clsx("ids-datepicker__dialog", { "ids-datepicker__dialog--show": isDialogOpen }), role: "dialog", ref: dialogRef, id: dialogId, "aria-modal": true, "aria-labelledby": headerId, children: [jsxs("div", { className: "ids-datepicker__dialog-bar", children: [jsx("div", { className: "ids-datepicker__dialog-header", id: headerId, ref: headerRef, tabIndex: -1, children: calendarHeader }), jsx("button", { className: "ids-datepicker__dialog-close-button", onClick: closeDialog, "aria-label": srCloseText })] }), jsx(DayPicker, { mode: "single", locale: sv, labels: {
|
|
156
|
+
labelWeekNumberHeader: () => "Veckonumer",
|
|
157
|
+
labelWeekNumber: (weekNumber) => `vecka`,
|
|
158
|
+
labelDayButton(date, modifiers, options, dateLib) {
|
|
159
|
+
const formattedDate = dateLib.format(date, "EEEE d MMMM yyyy", { locale: sv });
|
|
160
|
+
const weekNumber = getWeek(date, {
|
|
161
|
+
weekStartsOn: 1,
|
|
162
|
+
firstWeekContainsDate: 4
|
|
163
|
+
});
|
|
164
|
+
return `${formattedDate}, vecka ${weekNumber}`;
|
|
165
|
+
},
|
|
166
|
+
labelNext: () => "Nästa månad",
|
|
167
|
+
labelPrevious: () => "Föregående månad",
|
|
168
|
+
labelMonthDropdown: () => "Välj månad",
|
|
169
|
+
labelYearDropdown: () => "Välj år"
|
|
170
|
+
}, modifiers: modifiers, captionLayout: "dropdown", showWeekNumber: true, autoFocus: true, components: {
|
|
171
|
+
Nav: () => null,
|
|
172
|
+
DropdownNav: CustomNav,
|
|
173
|
+
WeekNumberHeader: props => (jsx(WeekNumberHeader, { ...props, className: "ids-datepicker__week-number-header", children: shortWeek })),
|
|
174
|
+
MonthsDropdown: props => (jsx(MonthsDropdown, { ...props, disabled: disableNavigation, className: "ids-datepicker__month-select" })),
|
|
175
|
+
YearsDropdown: props => (jsx(YearsDropdown, { ...props, disabled: disableNavigation, className: "ids-datepicker__year-select" }))
|
|
176
|
+
}, startMonth: startMonth, endMonth: endMonth, month: month, onMonthChange: setMonth, defaultMonth: defaultMonth, selected: selectedDate, onSelect: handleDayPickerSelect, onDayClick: onDayClick })] })] }), (showError || showInvalidError || showMissingError) && (jsxs(IDSErrorMessage, { id: errorMsgId, show: true, children: [showInvalidError && !showMissingError && invalidDateErrorMsg, showMissingError && missingDateErrorMsg, showError && errorMsg] }))] }));
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export { IDSDatePicker };
|
|
@@ -33,7 +33,7 @@ const IDSInput = forwardRef(({ label = "", type = "text", icon = "", hint = "",
|
|
|
33
33
|
"ids-label--disabled": disabled || readOnly,
|
|
34
34
|
"ids-hidden": type === "search" && !showSearchLabel
|
|
35
35
|
}), htmlFor: fieldId, children: label }), tooltip] }));
|
|
36
|
-
return (jsxs("div", { className: clsx("ids-input", { "ids-input--search": type === "search" }, className), children: [type === "search" ? (jsxs(Fragment, { children: [jsxs("div", { className: "ids-input__search-wrapper", children: [labelElement, inputElement] }), submitButton] })) : (jsxs(Fragment, { children: [labelElement, inputElement] })), hint && (jsx("div", { id: hintId, className: "ids-input__hint", children: hint })), isInvalid && errorMsg && (jsx(IDSErrorMessage, { id: errorMsgId, show: true, children: errorMsg }))] }));
|
|
36
|
+
return (jsxs("div", { className: "ids-input-component", children: [jsxs("div", { className: clsx("ids-input", { "ids-input--search": type === "search" }, className), children: [type === "search" ? (jsxs(Fragment, { children: [jsxs("div", { className: "ids-input__search-wrapper", children: [labelElement, inputElement] }), submitButton] })) : (jsxs(Fragment, { children: [labelElement, inputElement] })), hint && (jsx("div", { id: hintId, className: "ids-input__hint", children: hint }))] }), isInvalid && errorMsg && (jsx(IDSErrorMessage, { id: errorMsgId, show: true, children: errorMsg }))] }));
|
|
37
37
|
});
|
|
38
38
|
IDSInput.displayName = "IDSInput";
|
|
39
39
|
|
|
@@ -21,7 +21,8 @@ const IDSRadio = forwardRef(({ name = "", groupErrorMsgId = "", invalid = false,
|
|
|
21
21
|
}), disabled: disabled, "aria-disabled": disabled, "aria-invalid": isInvalid, name: name, onChange: onChange, ...props }), jsxs("div", { className: clsx("ids-label-tooltip-wrapper", {
|
|
22
22
|
"ids-label-tooltip-wrapper--inline": tooltip
|
|
23
23
|
}), children: [jsx("label", { htmlFor: fieldId, className: clsx("ids-radio__label ids-label", {
|
|
24
|
-
"ids-
|
|
24
|
+
"ids-label--clickable": !disabled,
|
|
25
|
+
"ids-label--disabled": disabled
|
|
25
26
|
}), children: children }), tooltip] })] }));
|
|
26
27
|
});
|
|
27
28
|
IDSRadio.displayName = "IDSRadio";
|
|
@@ -4,6 +4,7 @@ export interface IDSContainerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
4
4
|
width?: string;
|
|
5
5
|
maxWidth?: string;
|
|
6
6
|
gutterless?: boolean;
|
|
7
|
+
rowGap?: string;
|
|
7
8
|
children?: ReactNode;
|
|
8
9
|
}
|
|
9
10
|
export declare const IDSContainer: import("react").ForwardRefExoticComponent<IDSContainerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -3,10 +3,14 @@ import { forwardRef } from 'react';
|
|
|
3
3
|
import '@inera/ids-design/components/grid/container/container.css';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
|
|
6
|
-
const IDSContainer = forwardRef(({ gutterless = false, width, maxWidth, children, className, style, ...props }, ref) => {
|
|
7
|
-
const mergedStyle = {
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
const IDSContainer = forwardRef(({ gutterless = false, width, maxWidth, rowGap, children, className, style, ...props }, ref) => {
|
|
7
|
+
const mergedStyle = {
|
|
8
|
+
...style,
|
|
9
|
+
width: width ?? style?.width,
|
|
10
|
+
maxWidth: maxWidth ?? style?.maxWidth,
|
|
11
|
+
rowGap: rowGap ?? style?.rowGap
|
|
12
|
+
};
|
|
13
|
+
return (jsx("div", { ref: ref, className: clsx("ids-container", { "ids-container--gutterless": gutterless }, className), style: mergedStyle, ...props, children: children }));
|
|
10
14
|
});
|
|
11
15
|
IDSContainer.displayName = "IDSContainer";
|
|
12
16
|
|
|
@@ -9,7 +9,7 @@ function IDSNavigationContent({ headline = "", maxHeight = "", className, childr
|
|
|
9
9
|
return link;
|
|
10
10
|
return (jsx("div", { className: "ids-navigation-content__link-wrapper", children: link }, i));
|
|
11
11
|
});
|
|
12
|
-
return (jsxs("div", { className: clsx("ids-navigation-content", { "ids-navigation-content--scrollable": maxHeight }, className), ...props, children: [jsx("div", { className: "ids-navigation-content__border-top", children: jsx("div", { className: "ids-navigation-content__border-top-content" }) }), jsxs("nav", { className: "ids-navigation-content__inner", "aria-labelledby": "content-navigation-headline", id: "content-navigation-inner", children: [headline && (jsx("h2", { className: "ids-navigation-content__inner__headline", id: "content-navigation-headline", children: headline })), jsx("div", { className: "ids-navigation-content__links", style: { maxHeight: maxHeight || "
|
|
12
|
+
return (jsxs("div", { className: clsx("ids-navigation-content", { "ids-navigation-content--scrollable": maxHeight }, className), ...props, children: [jsx("div", { className: "ids-navigation-content__border-top", children: jsx("div", { className: "ids-navigation-content__border-top-content" }) }), jsxs("nav", { className: "ids-navigation-content__inner", "aria-labelledby": "content-navigation-headline", id: "content-navigation-inner", children: [headline && (jsx("h2", { className: "ids-navigation-content__inner__headline", id: "content-navigation-headline", children: headline })), jsx("div", { className: "ids-navigation-content__links", style: { maxHeight: maxHeight || "none" }, children: linkWrappers })] })] }));
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export { IDSNavigationContent };
|
|
@@ -3,7 +3,7 @@ import '@inera/ids-design/components/notification-badge/notification-badge.css';
|
|
|
3
3
|
import clsx from 'clsx';
|
|
4
4
|
|
|
5
5
|
function IDSNotificationBadge({ type = "primary", icon = "", onClick, className, children, ...props }) {
|
|
6
|
-
return (jsxs("div", { className: clsx("ids-notification-badge", `ids-notification-badge--${type}`, className), onClick: onClick, ...props, children: [icon && jsx("span", { className: `ids-icon-${icon}
|
|
6
|
+
return (jsxs("div", { className: clsx("ids-notification-badge", `ids-notification-badge--${type}`, className), onClick: onClick, ...props, children: [icon && jsx("span", { className: `ids-icon-${icon}`, "aria-hidden": "true" }), children] }));
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export { IDSNotificationBadge };
|
|
@@ -188,7 +188,7 @@ const IDSPopover = ({ position = "bottom", category = "", trigger, maxWidth = 26
|
|
|
188
188
|
const renderCaret = (pos) => {
|
|
189
189
|
return (jsxs("div", { className: `ids-popover-content__caret ids-popover-content__caret--${pos}`, children: [jsx("span", { className: `ids-popover-content__caret-body ids-popover-content__caret--${pos}` }), jsx("span", { className: `ids-popover-content__caret-border ids-popover-content__caret--${pos}` }), jsx("span", { className: `ids-popover-content__caret-shadow ids-popover-content__caret--${pos}` })] }));
|
|
190
190
|
};
|
|
191
|
-
return (jsxs("span", { className: clsx("ids-popover", className), ref: popoverRef, "data-popover-category": category, ...(isVisible
|
|
191
|
+
return (jsxs("span", { className: clsx("ids-popover", className), ref: popoverRef, "data-popover-category": category, ...(isVisible && { "data-show": "true" }), ...props, children: [jsx("span", { className: "ids-popover-trigger", "aria-haspopup": "dialog", onClick: togglePopover, onKeyDown: handleTriggerKeyDown, ref: triggerRef, children: trigger }), isVisible && (jsxs("div", { className: `ids-popover-content ${!noFocusTrap && "ids-focus-trap"}`, role: "tooltip", id: contentId, ref: popoverContentRef, style: popoverContentStyle, "data-position": position, children: [renderCaret(position), jsx("div", { className: "ids-popover-content__close-btn-wrapper", children: jsx("button", { "aria-label": srCloseText, className: "ids-popover-content__close-btn", onClick: closePopover }) }), jsx("div", { className: "ids-popover-content__content-wrapper", tabIndex: 0, ref: contentWrapperRef, style: popoverContentWrapperStyle, children: jsxs("div", { className: "ids-popover-content__content-wrapper-inner", children: [headline && jsx("div", { className: "ids-popover-content__headline", children: headline }), children] }) })] }))] }));
|
|
192
192
|
};
|
|
193
193
|
|
|
194
194
|
export { IDSPopover };
|
|
@@ -29,7 +29,7 @@ const IDSStep = ({ state = "", headline, label = "", stepNumber = "", srIndicato
|
|
|
29
29
|
return null;
|
|
30
30
|
return stepNumber;
|
|
31
31
|
};
|
|
32
|
-
return (jsxs("div", { className: clsx("ids-step", className), ...(last
|
|
32
|
+
return (jsxs("div", { className: clsx("ids-step", className), ...(last && { last }), ...props, children: [jsx("div", { role: "button", tabIndex: disabled ? -1 : 0, className: clsx("ids-step__button", {
|
|
33
33
|
"ids-step__button--disabled": disabled
|
|
34
34
|
}), "aria-expanded": expanded, onClick: toggleExpansion, onKeyDown: handleKeyPress, children: jsxs("div", { className: "ids-step__button-inner", children: [jsx("div", { className: "ids-step__indicator-wrapper", children: jsx("div", { "aria-label": srIndicatorText || stepNumber, role: "img", className: `ids-step__indicator ids-step__indicator--${state}`, children: renderStepIndicator() }) }), jsxs("div", { className: "ids-step__button-text", children: [jsxs("div", { className: "ids-step__headline-label", children: [label && jsx("div", { className: "ids-step__label", children: label }), headline && jsx("div", { className: "ids-step__headline", children: headline })] }), jsx("div", { className: clsx("ids-step__chevron", {
|
|
35
35
|
"ids-step__chevron--expanded": expanded
|
package/components/tabs/tab.js
CHANGED
|
@@ -13,7 +13,7 @@ const IDSTab = ({ label, index, id = "", panelId = "", selected = false, icon =
|
|
|
13
13
|
};
|
|
14
14
|
return (jsx("div", { id: id, ref: tabRef, role: "tab", tabIndex: 0, onClick: handleClick, onKeyDown: onKeyDown, className: clsx("ids-tab", {
|
|
15
15
|
"ids-tab--selected": selected
|
|
16
|
-
}, className), "aria-selected": selected, "aria-controls": panelId, ...props, children: jsxs("div", { className: "ids-tab__label", children: [icon && jsx("span", { className: `ids-icon-${icon} ids-icon--m`, "aria-hidden": "true" }), label, notification] }) }));
|
|
16
|
+
}, className), "aria-selected": selected, "aria-controls": panelId, ...props, children: jsxs("div", { className: "ids-tab__label", children: [icon && jsx("span", { className: `ids-tab-icon ids-icon-${icon} ids-icon--m`, "aria-hidden": "true" }), label, notification && jsx("span", { className: "ids-tab-extra", children: notification })] }) }));
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
export { IDSTab };
|
|
@@ -6,7 +6,7 @@ function useFocusTrap(container, active) {
|
|
|
6
6
|
return;
|
|
7
7
|
const focusableSelectors = [
|
|
8
8
|
"a[href]",
|
|
9
|
-
|
|
9
|
+
'button:not([disabled]):not([tabindex="-1"])',
|
|
10
10
|
"textarea:not([disabled])",
|
|
11
11
|
"input:not([disabled]):not([type='radio'])",
|
|
12
12
|
".ids-focus-anchor",
|
package/index.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export * from "./components/grid/container";
|
|
|
19
19
|
export * from "./components/grid/row";
|
|
20
20
|
export * from "./components/grid/column";
|
|
21
21
|
export * from "./components/accordion/accordion";
|
|
22
|
+
export * from "./components/action-link/action-link";
|
|
22
23
|
export * from "./components/alert/alert";
|
|
23
24
|
export * from "./components/global-alert/global-alert";
|
|
24
25
|
export * from "./components/mobile/menu/item/mobile-item";
|
|
@@ -35,6 +36,7 @@ export * from "./components/puff-list/puff-list-item/puff-list-item-header";
|
|
|
35
36
|
export * from "./components/puff-list/puff-list-item/puff-list-item-info";
|
|
36
37
|
export * from "./components/date-label/date-label";
|
|
37
38
|
export * from "./components/breadcrumbs/breadcrumbs";
|
|
39
|
+
export * from "./components/form/datepicker/datepicker";
|
|
38
40
|
export * from "./components/dialog/dialog";
|
|
39
41
|
export * from "./components/dropdown/dropdown";
|
|
40
42
|
export * from "./components/dropdown/dropdown-content-link";
|
package/index.js
CHANGED
|
@@ -19,6 +19,7 @@ export { IDSContainer } from './components/grid/container.js';
|
|
|
19
19
|
export { IDSRow } from './components/grid/row.js';
|
|
20
20
|
export { IDSColumn } from './components/grid/column.js';
|
|
21
21
|
export { IDSAccordion } from './components/accordion/accordion.js';
|
|
22
|
+
export { IDSActionLink } from './components/action-link/action-link.js';
|
|
22
23
|
export { IDSAlert } from './components/alert/alert.js';
|
|
23
24
|
export { IDSGlobalAlert } from './components/global-alert/global-alert.js';
|
|
24
25
|
export { IDSMobileMenuItem } from './components/mobile/menu/item/mobile-item.js';
|
|
@@ -35,6 +36,7 @@ export { IDSPuffListItemHeader } from './components/puff-list/puff-list-item/puf
|
|
|
35
36
|
export { IDSPuffListItemInfo } from './components/puff-list/puff-list-item/puff-list-item-info.js';
|
|
36
37
|
export { IDSDateLabel } from './components/date-label/date-label.js';
|
|
37
38
|
export { IDSBreadcrumbs } from './components/breadcrumbs/breadcrumbs.js';
|
|
39
|
+
export { IDSDatePicker } from './components/form/datepicker/datepicker.js';
|
|
38
40
|
export { IDSDialog } from './components/dialog/dialog.js';
|
|
39
41
|
export { IDSDropdown } from './components/dropdown/dropdown.js';
|
|
40
42
|
export { IDSDropdownContentLink } from './components/dropdown/dropdown-content-link.js';
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inera/ids-react",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"peerDependencies": {
|
|
6
6
|
"react": "*"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@inera/ids-design": "8.
|
|
9
|
+
"@inera/ids-design": "8.2.x",
|
|
10
10
|
"clsx": "*"
|
|
11
11
|
},
|
|
12
12
|
"types": "index.d.ts",
|