@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
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
function useAriaDescribedBy(ref, errorMsgId, invalid, hasErrorMsg, hasHint, hintId) {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
const inputEl = ref.current;
|
|
6
|
+
if (!inputEl)
|
|
7
|
+
return;
|
|
8
|
+
if (hasErrorMsg || hasHint) {
|
|
9
|
+
if (invalid) {
|
|
10
|
+
if (hasErrorMsg) {
|
|
11
|
+
inputEl.setAttribute("aria-describedby", errorMsgId);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
if (hasHint) {
|
|
16
|
+
inputEl.setAttribute("aria-describedby", hintId);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
inputEl.removeAttribute("aria-describedby");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}, [ref, errorMsgId, invalid]);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export { useAriaDescribedBy };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useGroupValidity(ref: React.RefObject<HTMLFieldSetElement>, type: "checkbox" | "radio"): boolean;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useState, useRef, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
function useGroupValidity(ref, type) {
|
|
4
|
+
const [isValid, setIsValid] = useState(true);
|
|
5
|
+
const [hasInteracted, setHasInteracted] = useState(false);
|
|
6
|
+
const initialized = useRef(false);
|
|
7
|
+
useEffect(() => {
|
|
8
|
+
const fieldset = ref.current;
|
|
9
|
+
if (!fieldset)
|
|
10
|
+
return;
|
|
11
|
+
const inputs = fieldset.querySelectorAll(`input[type="${type}"]`);
|
|
12
|
+
if (!inputs.length)
|
|
13
|
+
return;
|
|
14
|
+
const validate = () => {
|
|
15
|
+
if (type === "checkbox") {
|
|
16
|
+
const validStates = Array.from(inputs).map(cb => cb.validity.valid);
|
|
17
|
+
setIsValid(!validStates.some(v => !v));
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
const isAnyChecked = Array.from(inputs).some(radio => radio.checked);
|
|
21
|
+
setIsValid(isAnyChecked);
|
|
22
|
+
if (isAnyChecked) {
|
|
23
|
+
Array.from(inputs).forEach(radio => radio.setAttribute("aria-invalid", "false"));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
if (!initialized.current) {
|
|
28
|
+
validate();
|
|
29
|
+
initialized.current = true;
|
|
30
|
+
}
|
|
31
|
+
const handleInteraction = () => {
|
|
32
|
+
setHasInteracted(true);
|
|
33
|
+
validate();
|
|
34
|
+
};
|
|
35
|
+
const handleChange = () => {
|
|
36
|
+
setHasInteracted(false);
|
|
37
|
+
validate();
|
|
38
|
+
};
|
|
39
|
+
inputs.forEach(cb => {
|
|
40
|
+
cb.addEventListener("invalid", handleInteraction);
|
|
41
|
+
cb.addEventListener("change", handleChange);
|
|
42
|
+
});
|
|
43
|
+
const form = fieldset.closest("form");
|
|
44
|
+
const handleSubmit = () => {
|
|
45
|
+
setHasInteracted(true);
|
|
46
|
+
validate();
|
|
47
|
+
};
|
|
48
|
+
form?.addEventListener("submit", handleSubmit);
|
|
49
|
+
return () => {
|
|
50
|
+
inputs.forEach(cb => {
|
|
51
|
+
cb.removeEventListener("invalid", handleInteraction);
|
|
52
|
+
cb.removeEventListener("change", handleChange);
|
|
53
|
+
});
|
|
54
|
+
form?.removeEventListener("submit", handleSubmit);
|
|
55
|
+
};
|
|
56
|
+
}, [ref]);
|
|
57
|
+
return isValid || !hasInteracted;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export { useGroupValidity };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useInputValidity(ref: React.RefObject<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
function useInputValidity(ref) {
|
|
4
|
+
const [isValid, setIsValid] = useState(true);
|
|
5
|
+
useEffect(() => {
|
|
6
|
+
const inputEl = ref.current;
|
|
7
|
+
if (!inputEl)
|
|
8
|
+
return;
|
|
9
|
+
const updateValidity = () => {
|
|
10
|
+
setIsValid(inputEl.validity.valid);
|
|
11
|
+
};
|
|
12
|
+
const form = inputEl.closest("form");
|
|
13
|
+
form?.addEventListener("submit", updateValidity);
|
|
14
|
+
inputEl.addEventListener("blur", updateValidity);
|
|
15
|
+
inputEl.addEventListener("change", updateValidity);
|
|
16
|
+
inputEl.addEventListener("invalid", updateValidity);
|
|
17
|
+
return () => {
|
|
18
|
+
form?.removeEventListener("submit", updateValidity);
|
|
19
|
+
inputEl.removeEventListener("blur", updateValidity);
|
|
20
|
+
inputEl.removeEventListener("change", updateValidity);
|
|
21
|
+
inputEl.removeEventListener("invalid", updateValidity);
|
|
22
|
+
};
|
|
23
|
+
}, [ref]);
|
|
24
|
+
return isValid;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export { useInputValidity };
|
|
@@ -1,3 +1,22 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React, { ReactNode, InputHTMLAttributes } from "react";
|
|
2
|
+
interface IDSInputProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
label: string;
|
|
4
|
+
type?: string;
|
|
5
|
+
icon?: string;
|
|
6
|
+
hint?: string | ReactNode;
|
|
7
|
+
showSearchLabel?: boolean;
|
|
8
|
+
errorMsg?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
invalid?: boolean;
|
|
11
|
+
required?: boolean;
|
|
12
|
+
noValidation?: boolean;
|
|
13
|
+
autoSize?: boolean;
|
|
14
|
+
block?: boolean;
|
|
15
|
+
light?: boolean;
|
|
16
|
+
readOnly?: boolean;
|
|
17
|
+
tooltip?: ReactNode;
|
|
18
|
+
submitButton?: ReactNode;
|
|
19
|
+
oldIcon?: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export declare const IDSInput: React.FC<IDSInputProps>;
|
|
22
|
+
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 { useElementId } from '../../utils/hooks/useElementId.js';
|
|
5
|
+
import { IDSErrorMessage } from '../error-message/error-message.js';
|
|
6
|
+
import { useInputValidity } from '../form-hooks/useInputValidity.js';
|
|
7
|
+
import { useAriaDescribedBy } from '../form-hooks/useAriaDescribedBy.js';
|
|
8
|
+
import clsx from 'clsx';
|
|
5
9
|
|
|
6
|
-
const IDSInput =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const IDSInput = ({ label = "", type = "text", icon = "", hint = "", showSearchLabel = false, errorMsg = "", disabled = false, invalid = false, required = false, noValidation = false, autoSize = false, block = false, light = false, readOnly = false, id, tooltip, submitButton, oldIcon, className, ...props }) => {
|
|
11
|
+
const fieldId = useElementId(id);
|
|
12
|
+
const errorMsgId = useElementId();
|
|
13
|
+
const hintId = useElementId();
|
|
14
|
+
const oldIconRef = useRef(null);
|
|
15
|
+
const inputRef = useRef(null);
|
|
16
|
+
const hasValidValue = useInputValidity(inputRef);
|
|
17
|
+
const isInvalid = (invalid || !hasValidValue) && !noValidation;
|
|
18
|
+
useAriaDescribedBy(inputRef, errorMsgId, isInvalid, !!errorMsg && !noValidation, !!hint, hintId);
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
if (oldIconRef.current) {
|
|
21
|
+
oldIconRef.current.setAttribute("size", "s");
|
|
22
|
+
setOldIconColor(oldIconRef.current);
|
|
23
|
+
}
|
|
24
|
+
}, [oldIconRef, isInvalid, disabled]);
|
|
25
|
+
const setOldIconColor = (iconComponent) => {
|
|
26
|
+
let color = "var(--IDS-ICON__COLOR)";
|
|
27
|
+
let color2 = "var(--IDS-ICON__COLOR-2)";
|
|
28
|
+
if (isInvalid) {
|
|
29
|
+
color = "var(--IDS-INPUT--INVALID__ICON-FILL)";
|
|
30
|
+
color2 = "var(--IDS-INPUT--INVALID__ICON-FILL)";
|
|
31
|
+
}
|
|
32
|
+
if (disabled) {
|
|
33
|
+
color = "var(--IDS-INPUT--DISABLED__ICON-FILL)";
|
|
34
|
+
color2 = "var(--IDS-INPUT--DISABLED__ICON-FILL)";
|
|
35
|
+
}
|
|
36
|
+
iconComponent.setAttribute("color", color);
|
|
37
|
+
iconComponent.setAttribute("color2", color2);
|
|
38
|
+
};
|
|
39
|
+
const renderOldIcon = oldIcon && React__default.isValidElement(oldIcon)
|
|
40
|
+
? React__default.cloneElement(oldIcon, { ref: oldIconRef })
|
|
41
|
+
: oldIcon;
|
|
42
|
+
return (jsxs("div", { className: clsx("ids-input-component", className), children: [jsxs("div", { className: "ids-label-tooltip-wrapper", children: [jsx("label", { className: clsx("ids-label", {
|
|
43
|
+
"ids-label--disabled": disabled || readOnly,
|
|
44
|
+
"ids-hidden": type === "search" && !showSearchLabel
|
|
45
|
+
}), "aria-hidden": "false", htmlFor: fieldId, children: label }), tooltip] }), jsxs("div", { className: "ids-input__wrapper", children: [jsxs("div", { className: clsx("ids-input__inner-wrapper", {
|
|
46
|
+
"ids-input--icon": icon,
|
|
47
|
+
"ids-input__inner-wrapper--search": type === "search"
|
|
48
|
+
}), children: [jsx("input", { ref: inputRef, id: fieldId, type: type, readOnly: readOnly, className: clsx("ids-input", {
|
|
49
|
+
"ids-input--light": light,
|
|
50
|
+
"ids-input--invalid": invalid
|
|
51
|
+
}), "aria-invalid": isInvalid, required: required, "aria-required": required, disabled: disabled, "aria-disabled": disabled, ...props }), type === "search" && jsx("span", { className: "ids-input__search-icon" }), icon && jsx("span", { className: `ids-input__icon ids-icon-${icon}` }), oldIcon && jsx("span", { className: "ids-input__icon", children: renderOldIcon })] }), submitButton] }), hint && (jsx("div", { id: hintId, className: "ids-input__hint", children: hint })), isInvalid && errorMsg && (jsx(IDSErrorMessage, { id: errorMsgId, show: true, children: errorMsg }))] }));
|
|
52
|
+
};
|
|
11
53
|
|
|
12
54
|
export { IDSInput };
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface IDSRadioGroupProps extends React.FieldsetHTMLAttributes<HTMLFieldSetElement> {
|
|
3
|
+
name: string;
|
|
4
|
+
legend?: string;
|
|
5
|
+
errorMsg?: string | ReactNode;
|
|
6
|
+
compact?: boolean;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
tooltip?: ReactNode;
|
|
9
|
+
children?: ReactNode;
|
|
10
|
+
onRadioChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
11
|
+
}
|
|
12
|
+
export declare const IDSRadioGroup: React.FC<IDSRadioGroupProps>;
|
|
13
|
+
export {};
|
|
@@ -1,8 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React__default, { useRef } 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 IDSRadioGroup =
|
|
9
|
+
const IDSRadioGroup = ({ name = "options", legend = "", errorMsg = "", compact = false, required = false, onRadioChange, tooltip, className, children }) => {
|
|
10
|
+
const groupRef = useRef(null);
|
|
11
|
+
const isValid = useGroupValidity(groupRef, "radio");
|
|
12
|
+
const errorMsgId = useElementId();
|
|
13
|
+
const clonedChildren = React__default.Children.map(children, child => {
|
|
14
|
+
if (React__default.isValidElement(child) && child.type.displayName === "IDSRadio") {
|
|
15
|
+
return React__default.cloneElement(child, {
|
|
16
|
+
key: child.props.id,
|
|
17
|
+
name,
|
|
18
|
+
required,
|
|
19
|
+
groupErrorMsgId: errorMsg && errorMsgId,
|
|
20
|
+
groupInvalid: !isValid,
|
|
21
|
+
onChange: onRadioChange
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
return child;
|
|
25
|
+
});
|
|
26
|
+
return (jsxs("fieldset", { ref: groupRef, "aria-required": required, className: clsx("ids-form-group__fieldset", {
|
|
27
|
+
"ids-form-group__fieldset--compact": compact
|
|
28
|
+
}, className), children: [jsxs("legend", { children: [legend, tooltip] }), clonedChildren, !isValid && !!errorMsg && (jsx(IDSErrorMessage, { id: errorMsgId, show: true, children: errorMsg }))] }));
|
|
29
|
+
};
|
|
7
30
|
|
|
8
31
|
export { IDSRadioGroup };
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React, { ReactNode, ChangeEvent, InputHTMLAttributes } from "react";
|
|
2
|
+
export interface IDSRadioProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
name?: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
groupErrorMsgId?: string;
|
|
6
|
+
invalid?: boolean;
|
|
7
|
+
groupInvalid?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
noLabel?: boolean;
|
|
10
|
+
noValidation?: boolean;
|
|
11
|
+
light?: boolean;
|
|
12
|
+
compact?: boolean;
|
|
13
|
+
tooltip?: ReactNode;
|
|
14
|
+
children?: ReactNode;
|
|
15
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare const IDSRadio: React.FC<IDSRadioProps>;
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { useElementId } from '../../utils/hooks/useElementId.js';
|
|
5
|
+
import { useInputValidity } from '../form-hooks/useInputValidity.js';
|
|
6
|
+
import { useAriaDescribedBy } from '../form-hooks/useAriaDescribedBy.js';
|
|
7
|
+
import clsx from 'clsx';
|
|
5
8
|
|
|
6
|
-
const IDSRadio =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
const IDSRadio = ({ name = "", groupErrorMsgId = "", invalid = false, groupInvalid = false, disabled = false, noValidation = false, light = false, compact = false, tooltip, id, children, className, onChange, ...props }) => {
|
|
10
|
+
const fieldId = useElementId(id);
|
|
11
|
+
const radioRef = useRef(null);
|
|
12
|
+
const hasValidValue = useInputValidity(radioRef);
|
|
13
|
+
const isInvalid = (invalid || groupInvalid || !hasValidValue) && !noValidation;
|
|
14
|
+
useAriaDescribedBy(radioRef, groupErrorMsgId, isInvalid, !!groupErrorMsgId);
|
|
15
|
+
return (jsxs("div", { className: clsx("ids-radio", {
|
|
16
|
+
"ids-radio--compact": compact
|
|
17
|
+
}, className), children: [jsx("input", { id: fieldId, ref: radioRef, type: "radio", className: clsx({
|
|
18
|
+
"ids-input--light": light
|
|
19
|
+
}), disabled: disabled, "aria-disabled": disabled, "aria-invalid": isInvalid, name: name, onChange: onChange, ...props }), jsxs("div", { className: clsx("ids-label-tooltip-wrapper", {
|
|
20
|
+
"ids-label-tooltip-wrapper--inline": tooltip
|
|
21
|
+
}), children: [jsx("label", { htmlFor: fieldId, className: clsx("ids-radio__label ids-label", {
|
|
22
|
+
"ids-input--clickable": !disabled
|
|
23
|
+
}), children: children }), tooltip] })] }));
|
|
24
|
+
};
|
|
11
25
|
|
|
12
26
|
export { IDSRadio };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ReactNode, InputHTMLAttributes } from "react";
|
|
2
|
+
interface IDSRadioButtonGroupProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
name: string;
|
|
4
|
+
legend?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const IDSRadioButtonGroup: React.FC<IDSRadioButtonGroupProps>;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import React__default, { useRef } from 'react';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
|
|
6
|
+
const IDSRadioButtonGroup = ({ name = "options", legend = "", onChange, className, children }) => {
|
|
7
|
+
const groupRef = useRef(null);
|
|
8
|
+
const clonedChildren = React__default.Children.map(children, child => {
|
|
9
|
+
if (React__default.isValidElement(child) && child.type.displayName === "IDSRadioButton") {
|
|
10
|
+
return React__default.cloneElement(child, {
|
|
11
|
+
key: child.props.id,
|
|
12
|
+
icon: child.props.icon,
|
|
13
|
+
name,
|
|
14
|
+
onChange
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return child;
|
|
18
|
+
});
|
|
19
|
+
return (jsxs("fieldset", { ref: groupRef, className: clsx("ids-form-group__fieldset", className), children: [jsx("legend", { children: legend && legend }), clonedChildren] }));
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export { IDSRadioButtonGroup };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ReactNode, InputHTMLAttributes } from "react";
|
|
2
|
+
export interface IDSRadioButtonProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
3
|
+
name?: string;
|
|
4
|
+
id?: string;
|
|
5
|
+
icon: string;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
onChange?: (e: React.ChangeEvent<HTMLInputElement>) => {};
|
|
8
|
+
}
|
|
9
|
+
export declare const IDSRadioButton: React.FC<IDSRadioButtonProps>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { useElementId } from '../../utils/hooks/useElementId.js';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
|
|
7
|
+
const IDSRadioButton = ({ name = "", icon = "user", id, children, onChange, className, ...props }) => {
|
|
8
|
+
const fieldId = useElementId(id);
|
|
9
|
+
const radioRef = useRef(null);
|
|
10
|
+
return (jsxs("div", { className: clsx("ids-radio-button", className), children: [jsx("input", { id: fieldId, ref: radioRef, type: "radio", className: "ids-radio-button__input", name: name, onChange: onChange, ...props }), jsx("label", { htmlFor: fieldId, className: `ids-radio-button__label ids-icon-${icon}`, children: children })] }));
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export { IDSRadioButton };
|
|
@@ -1,3 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React, { ReactNode, InputHTMLAttributes, ChangeEvent } from "react";
|
|
2
|
+
import "@inera/ids-design/components/form/range/range.css";
|
|
3
|
+
interface IDSRangeProps extends InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
label?: string;
|
|
5
|
+
value?: number;
|
|
6
|
+
showTicks?: boolean;
|
|
7
|
+
interval?: number;
|
|
8
|
+
min?: number;
|
|
9
|
+
max?: number;
|
|
10
|
+
step?: number;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
tooltip?: ReactNode;
|
|
13
|
+
onChange?: (e: ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare const IDSRange: React.FC<IDSRangeProps>;
|
|
16
|
+
export {};
|
|
@@ -1,12 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import { useElementId } from '../../utils/hooks/useElementId.js';
|
|
5
|
+
import '@inera/ids-design/components/form/range/range.css';
|
|
6
|
+
import clsx from 'clsx';
|
|
5
7
|
|
|
6
|
-
const IDSRange =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const IDSRange = ({ label = "", value = 0, showTicks = false, interval = 0, min = 0, max = 0, step = 0, disabled = false, tooltip, id, onChange, className, ...props }) => {
|
|
9
|
+
const [internalValue, setInternalValue] = useState(value);
|
|
10
|
+
const [ticks, setTicks] = useState([]);
|
|
11
|
+
const fieldId = useElementId(id);
|
|
12
|
+
const rangeRef = useRef(null);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (step > 0) {
|
|
15
|
+
const steps = [];
|
|
16
|
+
const increment = interval > 0 ? interval : step;
|
|
17
|
+
for (let i = min; i <= max; i += increment) {
|
|
18
|
+
steps.push(Math.floor(i));
|
|
19
|
+
}
|
|
20
|
+
setTicks(steps);
|
|
21
|
+
}
|
|
22
|
+
}, [min, max, step, interval, showTicks]);
|
|
23
|
+
const handleOnChange = (ev) => {
|
|
24
|
+
setInternalValue(+ev.target.value);
|
|
25
|
+
if (onChange) {
|
|
26
|
+
onChange(ev);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
return (jsxs("div", { className: clsx("ids-range", className), children: [jsxs("div", { className: "ids-label-tooltip-wrapper", children: [jsx("label", { htmlFor: fieldId, className: `ids-label ${disabled ? "ids-label--disabled" : ""}`, children: label }), tooltip] }), jsx("input", { id: fieldId, ref: rangeRef, type: "range", className: "ids-range__input", min: min, "aria-valuemin": min, max: max, "aria-valuemax": max, step: step, value: internalValue, "aria-valuenow": internalValue, disabled: disabled, style: { backgroundSize: ((internalValue - min) * 100) / (max - min) + "% 100%" }, onChange: handleOnChange, ...props }), showTicks && (jsx("div", { className: `ids-range-ticks ${disabled ? "ids-range-ticks--disabled" : ""}`, children: ticks.map(tick => (jsx("div", { className: "ids-range-tick", children: tick }, tick))) }))] }));
|
|
30
|
+
};
|
|
11
31
|
|
|
12
32
|
export { IDSRange };
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
interface IDSSelectProps extends React.SelectHTMLAttributes<HTMLSelectElement> {
|
|
3
|
+
label?: string;
|
|
4
|
+
srOf?: string;
|
|
5
|
+
errorMsg?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
required?: boolean;
|
|
8
|
+
invalid?: boolean;
|
|
9
|
+
light?: boolean;
|
|
10
|
+
noValidation?: boolean;
|
|
11
|
+
tooltip?: ReactNode;
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
}
|
|
14
|
+
export declare const IDSSelect: React.FC<IDSSelectProps>;
|
|
15
|
+
export {};
|
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useRef } from 'react';
|
|
4
|
+
import { useElementId } from '../../utils/hooks/useElementId.js';
|
|
5
|
+
import { IDSErrorMessage } from '../error-message/error-message.js';
|
|
6
|
+
import { useInputValidity } from '../form-hooks/useInputValidity.js';
|
|
7
|
+
import { useAriaDescribedBy } from '../form-hooks/useAriaDescribedBy.js';
|
|
8
|
+
import clsx from 'clsx';
|
|
5
9
|
|
|
6
|
-
const IDSSelect =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const IDSSelect = ({ label = "", srOf = "av", errorMsg = "", disabled = false, required = false, invalid = false, light = false, noValidation = false, tooltip, id, children, className, ...props }) => {
|
|
11
|
+
const fieldId = useElementId(id);
|
|
12
|
+
const errorMsgId = useElementId();
|
|
13
|
+
const selectRef = useRef(null);
|
|
14
|
+
const hasValidValue = useInputValidity(selectRef);
|
|
15
|
+
const isInvalid = (invalid || !hasValidValue) && !noValidation;
|
|
16
|
+
useAriaDescribedBy(selectRef, errorMsgId, isInvalid, !!errorMsg);
|
|
17
|
+
return (jsxs("div", { className: clsx("ids-select-component", className), children: [jsxs("div", { className: "ids-label-tooltip-wrapper", children: [jsx("label", { htmlFor: fieldId, className: "ids-label", children: label }), tooltip] }), jsx("div", { className: "ids-select-wrapper", children: jsx("select", { id: fieldId, ref: selectRef, className: clsx("ids-select", {
|
|
18
|
+
"ids-input--light": light
|
|
19
|
+
}), "aria-invalid": isInvalid, required: required, disabled: disabled, ...props, children: children }) }), isInvalid && errorMsg && (jsx(IDSErrorMessage, { id: errorMsgId, show: true, children: errorMsg }))] }));
|
|
20
|
+
};
|
|
11
21
|
|
|
12
22
|
export { IDSSelect };
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import "@inera/ids-design/components/form/select-multiple/select-multiple.css";
|
|
3
|
+
interface IDSSelectMultipleProps extends React.InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
label?: string;
|
|
5
|
+
selectedLabel?: string;
|
|
6
|
+
selectedLabelPlural?: string;
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
maxHeight?: string;
|
|
9
|
+
expanded?: boolean;
|
|
10
|
+
errorMsg?: string;
|
|
11
|
+
invalid?: boolean;
|
|
12
|
+
light?: boolean;
|
|
13
|
+
noValidation?: boolean;
|
|
14
|
+
tooltip?: ReactNode;
|
|
15
|
+
children?: ReactNode;
|
|
16
|
+
}
|
|
17
|
+
export declare const IDSSelectMultiple: React.FC<IDSSelectMultipleProps>;
|
|
18
|
+
export {};
|
|
@@ -1,12 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import '
|
|
4
|
-
import {
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState, useRef, useEffect } from 'react';
|
|
4
|
+
import { useElementId } from '../../utils/hooks/useElementId.js';
|
|
5
|
+
import { IDSCheckboxGroup } from '../checkbox/checkbox-group.js';
|
|
6
|
+
import { useAriaDescribedBy } from '../form-hooks/useAriaDescribedBy.js';
|
|
7
|
+
import '@inera/ids-design/components/form/select-multiple/select-multiple.css';
|
|
8
|
+
import clsx from 'clsx';
|
|
5
9
|
|
|
6
|
-
const IDSSelectMultiple =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
10
|
+
const IDSSelectMultiple = ({ label = "", selectedLabel = "vald", selectedLabelPlural = "valda", placeholder = "", maxHeight = "", expanded = false, errorMsg = "", invalid = false, light = false, noValidation = false, tooltip, id, children, className, ...props }) => {
|
|
11
|
+
const [checkboxListInvalid, setCheckboxListInvalid] = useState(false);
|
|
12
|
+
const [checkedBoxesCount, setCheckedBoxesCount] = useState(0);
|
|
13
|
+
const [value, setValue] = useState(placeholder);
|
|
14
|
+
const [isExpanded, setIsExpanded] = useState(expanded);
|
|
15
|
+
const labelId = useElementId("label-" + id);
|
|
16
|
+
const inputId = useElementId("input-" + id);
|
|
17
|
+
const errorMsgId = useElementId();
|
|
18
|
+
const selectMultipleRef = useRef(null);
|
|
19
|
+
useAriaDescribedBy(selectMultipleRef, errorMsgId, checkboxListInvalid, !!errorMsg);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
let inputValue = placeholder;
|
|
22
|
+
if (checkedBoxesCount === 1) {
|
|
23
|
+
inputValue = `${checkedBoxesCount} ${selectedLabel}`;
|
|
24
|
+
}
|
|
25
|
+
if (checkedBoxesCount > 1) {
|
|
26
|
+
inputValue = `${checkedBoxesCount} ${selectedLabelPlural}`;
|
|
27
|
+
}
|
|
28
|
+
setValue(inputValue);
|
|
29
|
+
}, [checkedBoxesCount]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
const handleInteractionOutside = (event) => {
|
|
32
|
+
const target = event.target;
|
|
33
|
+
if (selectMultipleRef.current) {
|
|
34
|
+
const root = selectMultipleRef.current.closest(".ids-select-multiple-component");
|
|
35
|
+
if (root && !root.contains(target)) {
|
|
36
|
+
setIsExpanded(false);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const handleKeyDown = (event) => {
|
|
41
|
+
if (event.key === "Escape" && isExpanded) {
|
|
42
|
+
setIsExpanded(false);
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
document.addEventListener("click", handleInteractionOutside);
|
|
46
|
+
document.addEventListener("focusin", handleInteractionOutside);
|
|
47
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
48
|
+
return () => {
|
|
49
|
+
document.removeEventListener("click", handleInteractionOutside);
|
|
50
|
+
document.removeEventListener("focusin", handleInteractionOutside);
|
|
51
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
52
|
+
};
|
|
53
|
+
}, [isExpanded]);
|
|
54
|
+
return (jsxs("div", { className: clsx("ids-select-multiple-component", className), children: [jsxs("div", { className: "ids-label-tooltip-wrapper", children: [jsx("label", { id: labelId, htmlFor: inputId, className: "ids-label", children: label }), tooltip] }), jsx("div", { className: "ids-select-multiple-wrapper", children: jsx("input", { id: inputId, "aria-labelledby": labelId, ref: selectMultipleRef, type: "button", className: clsx("ids-select-multiple__select", {
|
|
55
|
+
"ids-input--light": light
|
|
56
|
+
}), "aria-expanded": isExpanded, "aria-invalid": invalid || checkboxListInvalid, placeholder: placeholder, value: value, onClick: () => setIsExpanded(!isExpanded), ...props }) }), jsx("div", { className: "ids-select-multiple__dropdown__wrapper", children: jsx("div", { className: clsx("ids-select-multiple__dropdown", {
|
|
57
|
+
"ids-select-multiple__dropdown--show": isExpanded
|
|
58
|
+
}), children: jsx("div", { className: "ids-select-multiple__dropdown__inner", style: { maxHeight: maxHeight }, children: jsx(IDSCheckboxGroup, { block: true, errorMsg: errorMsg, setCheckedBoxesCount: setCheckedBoxesCount, onValidityChange: (isValid) => {
|
|
59
|
+
setCheckboxListInvalid(!isValid);
|
|
60
|
+
}, children: children }) }) }) })] }));
|
|
61
|
+
};
|
|
11
62
|
|
|
12
63
|
export { IDSSelectMultiple };
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import React from "react";
|
|
2
|
+
import "@inera/ids-design/components/form/spinner/spinner.css";
|
|
3
|
+
interface IDSSpinnerProps extends React.HTMLAttributes<HTMLElement> {
|
|
4
|
+
light?: boolean;
|
|
5
|
+
live?: "polite" | "assertive" | "off";
|
|
6
|
+
srText?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const IDSSpinner: React.FC<IDSSpinnerProps>;
|
|
9
|
+
export {};
|