@holmdigital/components 1.2.4 → 2.1.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/README.md +135 -60
- package/dist/AccessibilityStatement/AccessibilityStatement.d.mts +29 -0
- package/dist/AccessibilityStatement/AccessibilityStatement.d.ts +29 -0
- package/dist/AccessibilityStatement/AccessibilityStatement.js +483 -0
- package/dist/AccessibilityStatement/AccessibilityStatement.mjs +6 -0
- package/dist/Button/Button.js +1 -1
- package/dist/Button/Button.mjs +1 -1
- package/dist/Card/Card.d.mts +12 -0
- package/dist/Card/Card.d.ts +12 -0
- package/dist/Card/Card.js +81 -0
- package/dist/Card/Card.mjs +6 -0
- package/dist/Combobox/Combobox.d.mts +19 -0
- package/dist/Combobox/Combobox.d.ts +19 -0
- package/dist/Combobox/Combobox.js +271 -0
- package/dist/Combobox/Combobox.mjs +6 -0
- package/dist/DataTable/DataTable.d.mts +18 -0
- package/dist/DataTable/DataTable.d.ts +18 -0
- package/dist/DataTable/DataTable.js +125 -0
- package/dist/DataTable/DataTable.mjs +6 -0
- package/dist/DatePicker/DatePicker.d.mts +11 -0
- package/dist/DatePicker/DatePicker.d.ts +11 -0
- package/dist/DatePicker/DatePicker.js +110 -0
- package/dist/DatePicker/DatePicker.mjs +6 -0
- package/dist/ErrorSummary/ErrorSummary.d.mts +14 -0
- package/dist/ErrorSummary/ErrorSummary.d.ts +14 -0
- package/dist/ErrorSummary/ErrorSummary.js +119 -0
- package/dist/ErrorSummary/ErrorSummary.mjs +6 -0
- package/dist/LiveRegion/LiveRegion.d.mts +10 -0
- package/dist/LiveRegion/LiveRegion.d.ts +10 -0
- package/dist/LiveRegion/LiveRegion.js +69 -0
- package/dist/LiveRegion/LiveRegion.mjs +6 -0
- package/dist/Modal/Modal.d.mts +1 -2
- package/dist/Modal/Modal.d.ts +1 -2
- package/dist/MultiSelect/MultiSelect.d.mts +19 -0
- package/dist/MultiSelect/MultiSelect.d.ts +19 -0
- package/dist/MultiSelect/MultiSelect.js +263 -0
- package/dist/MultiSelect/MultiSelect.mjs +6 -0
- package/dist/Pagination/Pagination.d.mts +12 -0
- package/dist/Pagination/Pagination.d.ts +12 -0
- package/dist/Pagination/Pagination.js +149 -0
- package/dist/Pagination/Pagination.mjs +6 -0
- package/dist/Tooltip/Tooltip.d.mts +1 -1
- package/dist/Tooltip/Tooltip.d.ts +1 -1
- package/dist/Tooltip/Tooltip.js +1 -1
- package/dist/Tooltip/Tooltip.mjs +1 -1
- package/dist/TreeView/TreeView.d.mts +16 -0
- package/dist/TreeView/TreeView.d.ts +16 -0
- package/dist/TreeView/TreeView.js +250 -0
- package/dist/TreeView/TreeView.mjs +6 -0
- package/dist/chunk-4UONERC6.mjs +45 -0
- package/dist/chunk-57NZTQBX.mjs +86 -0
- package/dist/chunk-6REI7HHO.mjs +226 -0
- package/dist/chunk-EVNHLNS5.mjs +125 -0
- package/dist/chunk-HSUDZAQ6.mjs +101 -0
- package/dist/{chunk-C5M6C7KT.mjs → chunk-MCEJNWZT.mjs} +1 -1
- package/dist/{chunk-7V2LETZ6.mjs → chunk-MYXIUDCP.mjs} +1 -1
- package/dist/chunk-NECEXNCF.mjs +57 -0
- package/dist/chunk-OFTOD72G.mjs +462 -0
- package/dist/chunk-OMSIXECN.mjs +247 -0
- package/dist/chunk-P2IXX552.mjs +95 -0
- package/dist/chunk-VM3O36W4.mjs +239 -0
- package/dist/index.d.mts +42 -1
- package/dist/index.d.ts +42 -1
- package/dist/index.js +1873 -2
- package/dist/index.mjs +244 -6
- package/package.json +48 -6
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/ErrorSummary/ErrorSummary.tsx
|
|
21
|
+
var ErrorSummary_exports = {};
|
|
22
|
+
__export(ErrorSummary_exports, {
|
|
23
|
+
ErrorSummary: () => ErrorSummary
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(ErrorSummary_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var ErrorSummary = ({
|
|
29
|
+
errors,
|
|
30
|
+
title = "There is a problem",
|
|
31
|
+
focusOnMount = true,
|
|
32
|
+
className = ""
|
|
33
|
+
}) => {
|
|
34
|
+
const headingRef = (0, import_react.useRef)(null);
|
|
35
|
+
(0, import_react.useEffect)(() => {
|
|
36
|
+
if (focusOnMount && errors.length > 0 && headingRef.current) {
|
|
37
|
+
headingRef.current.focus();
|
|
38
|
+
}
|
|
39
|
+
}, [focusOnMount, errors]);
|
|
40
|
+
if (errors.length === 0) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const styles = {
|
|
44
|
+
container: {
|
|
45
|
+
border: "2px solid #dc2626",
|
|
46
|
+
// Red-600
|
|
47
|
+
borderRadius: "0.375rem",
|
|
48
|
+
padding: "1rem",
|
|
49
|
+
marginBottom: "1.5rem",
|
|
50
|
+
backgroundColor: "#fef2f2"
|
|
51
|
+
// Red-50
|
|
52
|
+
},
|
|
53
|
+
heading: {
|
|
54
|
+
color: "#991b1b",
|
|
55
|
+
// Red-800
|
|
56
|
+
fontWeight: "bold",
|
|
57
|
+
fontSize: "1.125rem",
|
|
58
|
+
marginBottom: "0.5rem",
|
|
59
|
+
outline: "none"
|
|
60
|
+
// Managed focus usually visually indicated by browser, but we can style if needed
|
|
61
|
+
},
|
|
62
|
+
list: {
|
|
63
|
+
listStyleType: "disc",
|
|
64
|
+
paddingLeft: "1.25rem",
|
|
65
|
+
margin: 0,
|
|
66
|
+
color: "#dc2626"
|
|
67
|
+
// Red-600
|
|
68
|
+
},
|
|
69
|
+
link: {
|
|
70
|
+
color: "#b91c1c",
|
|
71
|
+
// Red-700
|
|
72
|
+
textDecoration: "underline",
|
|
73
|
+
cursor: "pointer",
|
|
74
|
+
fontWeight: 500
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
78
|
+
"div",
|
|
79
|
+
{
|
|
80
|
+
className: `a11y-error-summary ${className}`,
|
|
81
|
+
role: "alert",
|
|
82
|
+
"aria-labelledby": "error-summary-title",
|
|
83
|
+
style: styles.container,
|
|
84
|
+
children: [
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
86
|
+
"h2",
|
|
87
|
+
{
|
|
88
|
+
id: "error-summary-title",
|
|
89
|
+
ref: headingRef,
|
|
90
|
+
tabIndex: -1,
|
|
91
|
+
style: styles.heading,
|
|
92
|
+
children: title
|
|
93
|
+
}
|
|
94
|
+
),
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { style: styles.list, children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { style: { marginBottom: "0.25rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
|
+
"a",
|
|
97
|
+
{
|
|
98
|
+
href: `#${error.id}`,
|
|
99
|
+
style: styles.link,
|
|
100
|
+
onClick: (e) => {
|
|
101
|
+
e.preventDefault();
|
|
102
|
+
const element = document.getElementById(error.id);
|
|
103
|
+
if (element) {
|
|
104
|
+
element.focus();
|
|
105
|
+
element.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
children: error.message
|
|
109
|
+
}
|
|
110
|
+
) }, index)) })
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
);
|
|
114
|
+
};
|
|
115
|
+
ErrorSummary.displayName = "ErrorSummary";
|
|
116
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
117
|
+
0 && (module.exports = {
|
|
118
|
+
ErrorSummary
|
|
119
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
type LiveRegionProps = {
|
|
4
|
+
message?: string;
|
|
5
|
+
ariaLive?: 'polite' | 'assertive';
|
|
6
|
+
clearAfter?: number;
|
|
7
|
+
};
|
|
8
|
+
declare const LiveRegion: React__default.FC<LiveRegionProps>;
|
|
9
|
+
|
|
10
|
+
export { LiveRegion, type LiveRegionProps };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
type LiveRegionProps = {
|
|
4
|
+
message?: string;
|
|
5
|
+
ariaLive?: 'polite' | 'assertive';
|
|
6
|
+
clearAfter?: number;
|
|
7
|
+
};
|
|
8
|
+
declare const LiveRegion: React__default.FC<LiveRegionProps>;
|
|
9
|
+
|
|
10
|
+
export { LiveRegion, type LiveRegionProps };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/LiveRegion/LiveRegion.tsx
|
|
21
|
+
var LiveRegion_exports = {};
|
|
22
|
+
__export(LiveRegion_exports, {
|
|
23
|
+
LiveRegion: () => LiveRegion
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(LiveRegion_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var LiveRegion = ({
|
|
29
|
+
message,
|
|
30
|
+
ariaLive = "polite",
|
|
31
|
+
clearAfter
|
|
32
|
+
}) => {
|
|
33
|
+
const [announcement, setAnnouncement] = (0, import_react.useState)("");
|
|
34
|
+
const timeoutRef = (0, import_react.useRef)();
|
|
35
|
+
(0, import_react.useEffect)(() => {
|
|
36
|
+
if (message) {
|
|
37
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
38
|
+
setAnnouncement(message);
|
|
39
|
+
if (clearAfter) {
|
|
40
|
+
timeoutRef.current = setTimeout(() => {
|
|
41
|
+
setAnnouncement("");
|
|
42
|
+
}, clearAfter);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}, [message, clearAfter]);
|
|
46
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
47
|
+
"div",
|
|
48
|
+
{
|
|
49
|
+
"aria-live": ariaLive,
|
|
50
|
+
"aria-atomic": "true",
|
|
51
|
+
style: {
|
|
52
|
+
position: "absolute",
|
|
53
|
+
width: 1,
|
|
54
|
+
height: 1,
|
|
55
|
+
padding: 0,
|
|
56
|
+
margin: -1,
|
|
57
|
+
overflow: "hidden",
|
|
58
|
+
clip: "rect(0, 0, 0, 0)",
|
|
59
|
+
whiteSpace: "nowrap",
|
|
60
|
+
border: 0
|
|
61
|
+
},
|
|
62
|
+
children: announcement
|
|
63
|
+
}
|
|
64
|
+
);
|
|
65
|
+
};
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
LiveRegion
|
|
69
|
+
});
|
package/dist/Modal/Modal.d.mts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DialogProps } from '../Dialog/Dialog.mjs';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
}
|
|
4
|
+
type ModalProps = Omit<DialogProps, 'variant'>;
|
|
6
5
|
declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDialogElement>>;
|
|
7
6
|
|
|
8
7
|
export { Modal, type ModalProps };
|
package/dist/Modal/Modal.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { DialogProps } from '../Dialog/Dialog.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
}
|
|
4
|
+
type ModalProps = Omit<DialogProps, 'variant'>;
|
|
6
5
|
declare const Modal: React.ForwardRefExoticComponent<ModalProps & React.RefAttributes<HTMLDialogElement>>;
|
|
7
6
|
|
|
8
7
|
export { Modal, type ModalProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
interface MultiSelectOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
interface MultiSelectProps {
|
|
8
|
+
label: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
options: MultiSelectOption[];
|
|
12
|
+
selected: string[];
|
|
13
|
+
onChange: (selected: string[]) => void;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const MultiSelect: React__default.FC<MultiSelectProps>;
|
|
18
|
+
|
|
19
|
+
export { MultiSelect, type MultiSelectOption, type MultiSelectProps };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
interface MultiSelectOption {
|
|
4
|
+
value: string;
|
|
5
|
+
label: string;
|
|
6
|
+
}
|
|
7
|
+
interface MultiSelectProps {
|
|
8
|
+
label: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
error?: string;
|
|
11
|
+
options: MultiSelectOption[];
|
|
12
|
+
selected: string[];
|
|
13
|
+
onChange: (selected: string[]) => void;
|
|
14
|
+
placeholder?: string;
|
|
15
|
+
className?: string;
|
|
16
|
+
}
|
|
17
|
+
declare const MultiSelect: React__default.FC<MultiSelectProps>;
|
|
18
|
+
|
|
19
|
+
export { MultiSelect, type MultiSelectOption, type MultiSelectProps };
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/MultiSelect/MultiSelect.tsx
|
|
21
|
+
var MultiSelect_exports = {};
|
|
22
|
+
__export(MultiSelect_exports, {
|
|
23
|
+
MultiSelect: () => MultiSelect
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(MultiSelect_exports);
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
28
|
+
var MultiSelect = ({
|
|
29
|
+
label,
|
|
30
|
+
description,
|
|
31
|
+
error,
|
|
32
|
+
options,
|
|
33
|
+
selected,
|
|
34
|
+
onChange,
|
|
35
|
+
placeholder = "Select items...",
|
|
36
|
+
className = ""
|
|
37
|
+
}) => {
|
|
38
|
+
const [isOpen, setIsOpen] = (0, import_react.useState)(false);
|
|
39
|
+
const [inputValue, setInputValue] = (0, import_react.useState)("");
|
|
40
|
+
const [focusedIndex, setFocusedIndex] = (0, import_react.useState)(-1);
|
|
41
|
+
const [activeTokenIndex] = (0, import_react.useState)(-1);
|
|
42
|
+
const inputRef = (0, import_react.useRef)(null);
|
|
43
|
+
const containerRef = (0, import_react.useRef)(null);
|
|
44
|
+
const id = (0, import_react.useId)();
|
|
45
|
+
const listboxId = `${id}-listbox`;
|
|
46
|
+
const labelId = `${id}-label`;
|
|
47
|
+
const descriptionId = `${id}-description`;
|
|
48
|
+
const errorId = `${id}-error`;
|
|
49
|
+
const availableOptions = options.filter(
|
|
50
|
+
(option) => !selected.includes(option.value) && option.label.toLowerCase().includes(inputValue.toLowerCase())
|
|
51
|
+
);
|
|
52
|
+
const handleSelect = (value) => {
|
|
53
|
+
onChange([...selected, value]);
|
|
54
|
+
setInputValue("");
|
|
55
|
+
setIsOpen(false);
|
|
56
|
+
setFocusedIndex(-1);
|
|
57
|
+
inputRef.current?.focus();
|
|
58
|
+
};
|
|
59
|
+
const handleRemove = (value) => {
|
|
60
|
+
onChange(selected.filter((v) => v !== value));
|
|
61
|
+
inputRef.current?.focus();
|
|
62
|
+
};
|
|
63
|
+
const handleKeyDown = (e) => {
|
|
64
|
+
if (activeTokenIndex !== -1) {
|
|
65
|
+
handleTokenNavigation(e);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
switch (e.key) {
|
|
69
|
+
case "ArrowDown":
|
|
70
|
+
e.preventDefault();
|
|
71
|
+
setIsOpen(true);
|
|
72
|
+
setFocusedIndex((prev) => prev < availableOptions.length - 1 ? prev + 1 : 0);
|
|
73
|
+
break;
|
|
74
|
+
case "ArrowUp":
|
|
75
|
+
e.preventDefault();
|
|
76
|
+
setIsOpen(true);
|
|
77
|
+
setFocusedIndex((prev) => prev > 0 ? prev - 1 : availableOptions.length - 1);
|
|
78
|
+
break;
|
|
79
|
+
case "Enter":
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
if (isOpen && focusedIndex >= 0) {
|
|
82
|
+
handleSelect(availableOptions[focusedIndex].value);
|
|
83
|
+
}
|
|
84
|
+
break;
|
|
85
|
+
case "Escape":
|
|
86
|
+
setIsOpen(false);
|
|
87
|
+
break;
|
|
88
|
+
case "Backspace":
|
|
89
|
+
if (inputValue === "" && selected.length > 0) {
|
|
90
|
+
handleRemove(selected[selected.length - 1]);
|
|
91
|
+
}
|
|
92
|
+
break;
|
|
93
|
+
case "ArrowLeft":
|
|
94
|
+
if (inputValue === "" && selected.length > 0) {
|
|
95
|
+
}
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
const handleTokenNavigation = (_e) => {
|
|
100
|
+
};
|
|
101
|
+
const styles = {
|
|
102
|
+
container: {
|
|
103
|
+
position: "relative",
|
|
104
|
+
marginBottom: "1rem",
|
|
105
|
+
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
106
|
+
},
|
|
107
|
+
label: {
|
|
108
|
+
display: "block",
|
|
109
|
+
fontWeight: 600,
|
|
110
|
+
marginBottom: "0.25rem",
|
|
111
|
+
color: "#1e293b"
|
|
112
|
+
},
|
|
113
|
+
description: {
|
|
114
|
+
fontSize: "0.875rem",
|
|
115
|
+
color: "#64748b",
|
|
116
|
+
marginBottom: "0.5rem"
|
|
117
|
+
},
|
|
118
|
+
error: {
|
|
119
|
+
fontSize: "0.875rem",
|
|
120
|
+
color: "#dc2626",
|
|
121
|
+
marginTop: "0.25rem"
|
|
122
|
+
},
|
|
123
|
+
inputWrapper: {
|
|
124
|
+
display: "flex",
|
|
125
|
+
flexWrap: "wrap",
|
|
126
|
+
gap: "0.5rem",
|
|
127
|
+
padding: "0.375rem",
|
|
128
|
+
border: `1px solid ${error ? "#dc2626" : "#cbd5e1"}`,
|
|
129
|
+
borderRadius: "0.375rem",
|
|
130
|
+
backgroundColor: "white",
|
|
131
|
+
minHeight: "2.5rem"
|
|
132
|
+
},
|
|
133
|
+
input: {
|
|
134
|
+
flex: 1,
|
|
135
|
+
minWidth: "120px",
|
|
136
|
+
border: "none",
|
|
137
|
+
outline: "none",
|
|
138
|
+
padding: "0.25rem",
|
|
139
|
+
fontSize: "1rem"
|
|
140
|
+
},
|
|
141
|
+
token: {
|
|
142
|
+
display: "inline-flex",
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
backgroundColor: "#e2e8f0",
|
|
145
|
+
border: "1px solid #cbd5e1",
|
|
146
|
+
borderRadius: "0.25rem",
|
|
147
|
+
padding: "0.125rem 0.5rem",
|
|
148
|
+
fontSize: "0.875rem",
|
|
149
|
+
color: "#0f172a"
|
|
150
|
+
},
|
|
151
|
+
removeButton: {
|
|
152
|
+
marginLeft: "0.25rem",
|
|
153
|
+
border: "none",
|
|
154
|
+
background: "none",
|
|
155
|
+
cursor: "pointer",
|
|
156
|
+
padding: "0 0.125rem",
|
|
157
|
+
fontSize: "1rem",
|
|
158
|
+
lineHeight: 1,
|
|
159
|
+
color: "#64748b"
|
|
160
|
+
},
|
|
161
|
+
listbox: {
|
|
162
|
+
position: "absolute",
|
|
163
|
+
top: "100%",
|
|
164
|
+
left: 0,
|
|
165
|
+
right: 0,
|
|
166
|
+
maxHeight: "200px",
|
|
167
|
+
overflowY: "auto",
|
|
168
|
+
border: "1px solid #cbd5e1",
|
|
169
|
+
borderRadius: "0.375rem",
|
|
170
|
+
backgroundColor: "white",
|
|
171
|
+
zIndex: 10,
|
|
172
|
+
marginTop: "0.25rem",
|
|
173
|
+
padding: 0,
|
|
174
|
+
listStyle: "none",
|
|
175
|
+
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
|
|
176
|
+
},
|
|
177
|
+
option: {
|
|
178
|
+
padding: "0.5rem 0.75rem",
|
|
179
|
+
cursor: "pointer"
|
|
180
|
+
},
|
|
181
|
+
activeOption: {
|
|
182
|
+
backgroundColor: "#e2e8f0",
|
|
183
|
+
color: "#0f172a"
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { ref: containerRef, className, style: styles.container, children: [
|
|
187
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { id: labelId, htmlFor: id, style: styles.label, children: label }),
|
|
188
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: descriptionId, style: styles.description, children: description }),
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: styles.inputWrapper, children: [
|
|
190
|
+
selected.map((value) => {
|
|
191
|
+
const option = options.find((o) => o.value === value);
|
|
192
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { style: styles.token, children: [
|
|
193
|
+
option?.label || value,
|
|
194
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
195
|
+
"button",
|
|
196
|
+
{
|
|
197
|
+
type: "button",
|
|
198
|
+
style: styles.removeButton,
|
|
199
|
+
onClick: () => handleRemove(value),
|
|
200
|
+
"aria-label": `Remove ${option?.label || value}`,
|
|
201
|
+
children: "\xD7"
|
|
202
|
+
}
|
|
203
|
+
)
|
|
204
|
+
] }, value);
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
207
|
+
"input",
|
|
208
|
+
{
|
|
209
|
+
ref: inputRef,
|
|
210
|
+
id,
|
|
211
|
+
type: "text",
|
|
212
|
+
role: "combobox",
|
|
213
|
+
"aria-autocomplete": "list",
|
|
214
|
+
"aria-expanded": isOpen,
|
|
215
|
+
"aria-haspopup": "listbox",
|
|
216
|
+
"aria-controls": listboxId,
|
|
217
|
+
"aria-activedescendant": focusedIndex >= 0 ? `${id}-option-${focusedIndex}` : void 0,
|
|
218
|
+
"aria-invalid": !!error,
|
|
219
|
+
value: inputValue,
|
|
220
|
+
onChange: (e) => {
|
|
221
|
+
setInputValue(e.target.value);
|
|
222
|
+
setIsOpen(true);
|
|
223
|
+
setFocusedIndex(-1);
|
|
224
|
+
},
|
|
225
|
+
onKeyDown: handleKeyDown,
|
|
226
|
+
onFocus: () => setIsOpen(true),
|
|
227
|
+
placeholder: selected.length === 0 ? placeholder : "",
|
|
228
|
+
style: styles.input
|
|
229
|
+
}
|
|
230
|
+
)
|
|
231
|
+
] }),
|
|
232
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: errorId, style: styles.error, role: "alert", children: error }),
|
|
233
|
+
isOpen && availableOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
234
|
+
"ul",
|
|
235
|
+
{
|
|
236
|
+
id: listboxId,
|
|
237
|
+
role: "listbox",
|
|
238
|
+
"aria-label": label,
|
|
239
|
+
style: styles.listbox,
|
|
240
|
+
children: availableOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
241
|
+
"li",
|
|
242
|
+
{
|
|
243
|
+
id: `${id}-option-${index}`,
|
|
244
|
+
role: "option",
|
|
245
|
+
"aria-selected": false,
|
|
246
|
+
onClick: () => handleSelect(option.value),
|
|
247
|
+
onMouseEnter: () => setFocusedIndex(index),
|
|
248
|
+
style: {
|
|
249
|
+
...styles.option,
|
|
250
|
+
...focusedIndex === index ? styles.activeOption : {}
|
|
251
|
+
},
|
|
252
|
+
children: option.label
|
|
253
|
+
},
|
|
254
|
+
option.value
|
|
255
|
+
))
|
|
256
|
+
}
|
|
257
|
+
)
|
|
258
|
+
] });
|
|
259
|
+
};
|
|
260
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
261
|
+
0 && (module.exports = {
|
|
262
|
+
MultiSelect
|
|
263
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
interface PaginationProps {
|
|
4
|
+
currentPage: number;
|
|
5
|
+
totalPages: number;
|
|
6
|
+
onPageChange: (page: number) => void;
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Pagination: React__default.FC<PaginationProps>;
|
|
11
|
+
|
|
12
|
+
export { Pagination, type PaginationProps };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
interface PaginationProps {
|
|
4
|
+
currentPage: number;
|
|
5
|
+
totalPages: number;
|
|
6
|
+
onPageChange: (page: number) => void;
|
|
7
|
+
ariaLabel?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const Pagination: React__default.FC<PaginationProps>;
|
|
11
|
+
|
|
12
|
+
export { Pagination, type PaginationProps };
|