@holmdigital/components 1.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.
Files changed (43) hide show
  1. package/README.md +46 -0
  2. package/dist/Button/Button.js +117 -0
  3. package/dist/Button/Button.mjs +6 -0
  4. package/dist/Checkbox/Checkbox.js +82 -0
  5. package/dist/Checkbox/Checkbox.mjs +6 -0
  6. package/dist/Dialog/Dialog.js +129 -0
  7. package/dist/Dialog/Dialog.mjs +6 -0
  8. package/dist/FormField/FormField.js +110 -0
  9. package/dist/FormField/FormField.mjs +6 -0
  10. package/dist/Heading/Heading.js +48 -0
  11. package/dist/Heading/Heading.mjs +6 -0
  12. package/dist/Modal/Modal.js +146 -0
  13. package/dist/Modal/Modal.mjs +7 -0
  14. package/dist/NavigationMenu/NavigationMenu.js +141 -0
  15. package/dist/NavigationMenu/NavigationMenu.mjs +6 -0
  16. package/dist/RadioGroup/RadioGroup.js +103 -0
  17. package/dist/RadioGroup/RadioGroup.mjs +6 -0
  18. package/dist/Select/Select.js +157 -0
  19. package/dist/Select/Select.mjs +12 -0
  20. package/dist/SkipLink/SkipLink.js +59 -0
  21. package/dist/SkipLink/SkipLink.mjs +6 -0
  22. package/dist/Switch/Switch.js +82 -0
  23. package/dist/Switch/Switch.mjs +6 -0
  24. package/dist/Toast/Toast.js +123 -0
  25. package/dist/Toast/Toast.mjs +8 -0
  26. package/dist/Tooltip/Tooltip.js +121 -0
  27. package/dist/Tooltip/Tooltip.mjs +12 -0
  28. package/dist/chunk-2MJRKHPL.mjs +98 -0
  29. package/dist/chunk-5RKBS475.mjs +58 -0
  30. package/dist/chunk-C5M6C7KT.mjs +84 -0
  31. package/dist/chunk-GK4BYT56.mjs +117 -0
  32. package/dist/chunk-HALLFO25.mjs +22 -0
  33. package/dist/chunk-LZ42XDDI.mjs +105 -0
  34. package/dist/chunk-MKKQLWGK.mjs +35 -0
  35. package/dist/chunk-NDYRGXQ6.mjs +93 -0
  36. package/dist/chunk-NOE5QKC2.mjs +58 -0
  37. package/dist/chunk-PLT5CAFO.mjs +86 -0
  38. package/dist/chunk-V2JYAFB7.mjs +130 -0
  39. package/dist/chunk-W4ZHBRFT.mjs +14 -0
  40. package/dist/chunk-YMSNGQN6.mjs +79 -0
  41. package/dist/index.js +1256 -0
  42. package/dist/index.mjs +308 -0
  43. package/package.json +113 -0
@@ -0,0 +1,146 @@
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/Modal/Modal.tsx
21
+ var Modal_exports = {};
22
+ __export(Modal_exports, {
23
+ Modal: () => Modal
24
+ });
25
+ module.exports = __toCommonJS(Modal_exports);
26
+ var import_react2 = require("react");
27
+
28
+ // src/Dialog/Dialog.tsx
29
+ var import_react = require("react");
30
+ var import_jsx_runtime = require("react/jsx-runtime");
31
+ var CloseIcon = () => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
32
+ "svg",
33
+ {
34
+ xmlns: "http://www.w3.org/2000/svg",
35
+ width: "24",
36
+ height: "24",
37
+ viewBox: "0 0 24 24",
38
+ fill: "none",
39
+ stroke: "currentColor",
40
+ strokeWidth: "2",
41
+ strokeLinecap: "round",
42
+ strokeLinejoin: "round",
43
+ className: "h-5 w-5",
44
+ children: [
45
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "M18 6 6 18" }),
46
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { d: "m6 6 12 12" })
47
+ ]
48
+ }
49
+ );
50
+ var Dialog = (0, import_react.forwardRef)(
51
+ ({ isOpen, onClose, title, children, variant = "default", description, className, ...props }, ref) => {
52
+ const dialogRef = (0, import_react.useRef)(null);
53
+ (0, import_react.useImperativeHandle)(ref, () => dialogRef.current);
54
+ (0, import_react.useEffect)(() => {
55
+ const dialog = dialogRef.current;
56
+ if (!dialog) return;
57
+ if (isOpen) {
58
+ if (!dialog.open) {
59
+ dialog.showModal();
60
+ document.body.style.overflow = "hidden";
61
+ }
62
+ } else {
63
+ if (dialog.open) {
64
+ dialog.close();
65
+ document.body.style.overflow = "";
66
+ }
67
+ }
68
+ }, [isOpen]);
69
+ (0, import_react.useEffect)(() => {
70
+ const dialog = dialogRef.current;
71
+ if (!dialog) return;
72
+ const handleClose = () => {
73
+ onClose();
74
+ document.body.style.overflow = "";
75
+ };
76
+ dialog.addEventListener("close", handleClose);
77
+ const handleBackdropClick = (e) => {
78
+ const rect = dialog.getBoundingClientRect();
79
+ const isInDialog = rect.top <= e.clientY && e.clientY <= rect.top + rect.height && rect.left <= e.clientX && e.clientX <= rect.left + rect.width;
80
+ if (!isInDialog) {
81
+ dialog.close();
82
+ }
83
+ };
84
+ dialog.addEventListener("click", handleBackdropClick);
85
+ return () => {
86
+ dialog.removeEventListener("close", handleClose);
87
+ dialog.removeEventListener("click", handleBackdropClick);
88
+ };
89
+ }, [onClose]);
90
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
91
+ "dialog",
92
+ {
93
+ ref: dialogRef,
94
+ className: `
95
+ backdrop:bg-slate-900/50 backdrop:backdrop-blur-sm
96
+ open:animate-in open:fade-in-0 open:zoom-in-95
97
+ bg-white rounded-xl shadow-2xl ring-1 ring-slate-900/5
98
+ w-full max-w-lg p-0
99
+ ${className || ""}
100
+ `,
101
+ "aria-labelledby": "dialog-title",
102
+ "aria-describedby": description ? "dialog-desc" : void 0,
103
+ ...props,
104
+ children: [
105
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between px-6 py-4 border-b border-slate-100", children: [
106
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { id: "dialog-title", className: `text-lg font-semibold ${variant === "alert" ? "text-red-600" : "text-slate-900"}`, children: title }),
107
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
108
+ "button",
109
+ {
110
+ onClick: () => {
111
+ dialogRef.current?.close();
112
+ },
113
+ className: "p-1 rounded-md text-slate-400 hover:text-slate-500 hover:bg-slate-100 focus:outline-none focus:ring-2 focus:ring-primary-500 transition-colors",
114
+ "aria-label": "Close dialog",
115
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CloseIcon, {})
116
+ }
117
+ )
118
+ ] }),
119
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "px-6 py-4", children: [
120
+ description && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { id: "dialog-desc", className: "text-sm text-slate-500 mb-4", children: description }),
121
+ children
122
+ ] })
123
+ ]
124
+ }
125
+ );
126
+ }
127
+ );
128
+ Dialog.displayName = "Dialog";
129
+
130
+ // src/Modal/Modal.tsx
131
+ var import_jsx_runtime2 = require("react/jsx-runtime");
132
+ var Modal = (0, import_react2.forwardRef)((props, ref) => {
133
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
134
+ Dialog,
135
+ {
136
+ ref,
137
+ ...props,
138
+ className: `max-w-2xl ${props.className || ""}`
139
+ }
140
+ );
141
+ });
142
+ Modal.displayName = "Modal";
143
+ // Annotate the CommonJS export names for ESM import in node:
144
+ 0 && (module.exports = {
145
+ Modal
146
+ });
@@ -0,0 +1,7 @@
1
+ import {
2
+ Modal
3
+ } from "../chunk-HALLFO25.mjs";
4
+ import "../chunk-LZ42XDDI.mjs";
5
+ export {
6
+ Modal
7
+ };
@@ -0,0 +1,141 @@
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/NavigationMenu/NavigationMenu.tsx
21
+ var NavigationMenu_exports = {};
22
+ __export(NavigationMenu_exports, {
23
+ NavigationMenu: () => NavigationMenu
24
+ });
25
+ module.exports = __toCommonJS(NavigationMenu_exports);
26
+ var import_react = require("react");
27
+ var import_jsx_runtime = require("react/jsx-runtime");
28
+ var NavigationMenu = (0, import_react.forwardRef)(
29
+ ({ items, className, "aria-label": ariaLabel = "Main Navigation" }, ref) => {
30
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
31
+ "nav",
32
+ {
33
+ ref,
34
+ className: `flex items-center ${className || ""}`,
35
+ "aria-label": ariaLabel,
36
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", { className: "flex flex-wrap gap-2 m-0 p-0 list-none", children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MenuItem, { item }, index)) })
37
+ }
38
+ );
39
+ }
40
+ );
41
+ NavigationMenu.displayName = "NavigationMenu";
42
+ var MenuItem = ({ item }) => {
43
+ const [isOpen, setIsOpen] = (0, import_react.useState)(false);
44
+ const containerRef = (0, import_react.useRef)(null);
45
+ const timeoutRef = (0, import_react.useRef)();
46
+ const hasChildren = item.children && item.children.length > 0;
47
+ (0, import_react.useEffect)(() => {
48
+ const handleClickOutside = (event) => {
49
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
50
+ setIsOpen(false);
51
+ }
52
+ };
53
+ if (isOpen) {
54
+ document.addEventListener("click", handleClickOutside);
55
+ }
56
+ return () => document.removeEventListener("click", handleClickOutside);
57
+ }, [isOpen]);
58
+ const handleKeyDown = (e) => {
59
+ if (e.key === "Escape" && isOpen) {
60
+ setIsOpen(false);
61
+ const trigger = containerRef.current?.querySelector("button");
62
+ trigger?.focus();
63
+ }
64
+ };
65
+ const handleMouseEnter = () => {
66
+ clearTimeout(timeoutRef.current);
67
+ setIsOpen(true);
68
+ };
69
+ const handleMouseLeave = () => {
70
+ timeoutRef.current = setTimeout(() => setIsOpen(false), 200);
71
+ };
72
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
73
+ "li",
74
+ {
75
+ ref: containerRef,
76
+ className: "relative group",
77
+ onKeyDown: handleKeyDown,
78
+ onMouseEnter: hasChildren ? handleMouseEnter : void 0,
79
+ onMouseLeave: hasChildren ? handleMouseLeave : void 0,
80
+ children: hasChildren ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
81
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
82
+ "button",
83
+ {
84
+ onClick: () => setIsOpen(!isOpen),
85
+ "aria-expanded": isOpen,
86
+ "aria-haspopup": "true",
87
+ className: `
88
+ flex items-center gap-1 px-4 py-2 rounded-md
89
+ text-slate-700 font-medium hover:bg-slate-100 focus:bg-slate-100
90
+ transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500
91
+ `,
92
+ children: [
93
+ item.label,
94
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
95
+ "svg",
96
+ {
97
+ className: `w-4 h-4 transition-transform ${isOpen ? "rotate-180" : ""}`,
98
+ fill: "none",
99
+ viewBox: "0 0 24 24",
100
+ stroke: "currentColor",
101
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" })
102
+ }
103
+ )
104
+ ]
105
+ }
106
+ ),
107
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
108
+ "ul",
109
+ {
110
+ className: `
111
+ absolute top-full left-0 mt-1 min-w-[200px]
112
+ bg-white border border-slate-200 rounded-lg shadow-xl
113
+ py-2 z-50
114
+ transform origin-top transition-all duration-200
115
+ ${isOpen ? "opacity-100 scale-100 visible" : "opacity-0 scale-95 invisible"}
116
+ `,
117
+ children: item.children?.map((child, idx) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
118
+ "a",
119
+ {
120
+ href: child.href,
121
+ className: "block px-4 py-2 text-slate-700 hover:bg-slate-50 hover:text-primary-600 focus:bg-slate-50 focus:text-primary-600 focus:outline-none",
122
+ children: child.label
123
+ }
124
+ ) }, idx))
125
+ }
126
+ )
127
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
128
+ "a",
129
+ {
130
+ href: item.href,
131
+ className: "block px-4 py-2 text-slate-700 font-medium rounded-md hover:bg-slate-100 focus:bg-slate-100 transition-colors focus:outline-none focus:ring-2 focus:ring-primary-500",
132
+ children: item.label
133
+ }
134
+ )
135
+ }
136
+ );
137
+ };
138
+ // Annotate the CommonJS export names for ESM import in node:
139
+ 0 && (module.exports = {
140
+ NavigationMenu
141
+ });
@@ -0,0 +1,6 @@
1
+ import {
2
+ NavigationMenu
3
+ } from "../chunk-GK4BYT56.mjs";
4
+ export {
5
+ NavigationMenu
6
+ };
@@ -0,0 +1,103 @@
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/RadioGroup/RadioGroup.tsx
21
+ var RadioGroup_exports = {};
22
+ __export(RadioGroup_exports, {
23
+ RadioGroup: () => RadioGroup
24
+ });
25
+ module.exports = __toCommonJS(RadioGroup_exports);
26
+ var import_react = require("react");
27
+ var import_jsx_runtime = require("react/jsx-runtime");
28
+ var RadioGroup = (0, import_react.forwardRef)(
29
+ ({ name, options, value, onChange, orientation = "vertical", className = "", label }, ref) => {
30
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
31
+ "div",
32
+ {
33
+ ref,
34
+ className: `${className}`,
35
+ role: "radiogroup",
36
+ "aria-labelledby": label ? `${name}-label` : void 0,
37
+ children: [
38
+ label && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { id: `${name}-label`, className: "text-sm font-medium text-slate-900 mb-2", children: label }),
39
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `flex ${orientation === "vertical" ? "flex-col space-y-3" : "flex-row space-x-6"}`, children: options.map((option) => {
40
+ const optionId = `${name}-${option.value}`;
41
+ const isChecked = value === option.value;
42
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center", children: [
43
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative flex items-center justify-center", children: [
44
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
45
+ "input",
46
+ {
47
+ id: optionId,
48
+ name,
49
+ type: "radio",
50
+ value: option.value,
51
+ checked: isChecked,
52
+ disabled: option.disabled,
53
+ onChange: (e) => {
54
+ if (e.target.checked) {
55
+ onChange?.(option.value);
56
+ }
57
+ },
58
+ className: "peer sr-only"
59
+ }
60
+ ),
61
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
62
+ "div",
63
+ {
64
+ className: `
65
+ h-5 w-5 rounded-full border border-slate-300 bg-white shadow-sm transition-all
66
+ peer-focus:ring-2 peer-focus:ring-primary-500 peer-focus:ring-offset-2
67
+ peer-checked:border-primary-600 peer-checked:bg-white
68
+ peer-disabled:cursor-not-allowed peer-disabled:opacity-50
69
+ hover:border-primary-400
70
+ `,
71
+ "aria-hidden": "true"
72
+ }
73
+ ),
74
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
75
+ "div",
76
+ {
77
+ className: `
78
+ absolute h-2.5 w-2.5 rounded-full bg-primary-600 transition-transform duration-200 scale-0
79
+ ${isChecked ? "scale-100" : ""}
80
+ `
81
+ }
82
+ )
83
+ ] }),
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
85
+ "label",
86
+ {
87
+ htmlFor: optionId,
88
+ className: `ml-3 text-sm font-medium ${option.disabled ? "text-slate-400" : "text-slate-700"} cursor-pointer select-none`,
89
+ children: option.label
90
+ }
91
+ )
92
+ ] }, option.value);
93
+ }) })
94
+ ]
95
+ }
96
+ );
97
+ }
98
+ );
99
+ RadioGroup.displayName = "RadioGroup";
100
+ // Annotate the CommonJS export names for ESM import in node:
101
+ 0 && (module.exports = {
102
+ RadioGroup
103
+ });
@@ -0,0 +1,6 @@
1
+ import {
2
+ RadioGroup
3
+ } from "../chunk-YMSNGQN6.mjs";
4
+ export {
5
+ RadioGroup
6
+ };
@@ -0,0 +1,157 @@
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/Select/Select.tsx
21
+ var Select_exports = {};
22
+ __export(Select_exports, {
23
+ Select: () => Select,
24
+ SelectContent: () => SelectContent,
25
+ SelectItem: () => SelectItem,
26
+ SelectTrigger: () => SelectTrigger
27
+ });
28
+ module.exports = __toCommonJS(Select_exports);
29
+ var import_react = require("react");
30
+ var import_lucide_react = require("lucide-react");
31
+ var import_jsx_runtime = require("react/jsx-runtime");
32
+ var SelectContext = (0, import_react.createContext)(void 0);
33
+ var Select = ({ value, onChange, children }) => {
34
+ const [isOpen, setIsOpen] = (0, import_react.useState)(false);
35
+ const [highlightedIndex, setHighlightedIndex] = (0, import_react.useState)(-1);
36
+ const optionsRef = (0, import_react.useRef)([]);
37
+ const containerRef = (0, import_react.useRef)(null);
38
+ (0, import_react.useEffect)(() => {
39
+ const handleClickOutside = (event) => {
40
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
41
+ setIsOpen(false);
42
+ }
43
+ };
44
+ document.addEventListener("mousedown", handleClickOutside);
45
+ return () => document.removeEventListener("mousedown", handleClickOutside);
46
+ }, []);
47
+ const handleKeyDown = (e) => {
48
+ if (!isOpen) {
49
+ if (e.key === "Enter" || e.key === " " || e.key === "ArrowDown") {
50
+ e.preventDefault();
51
+ setIsOpen(true);
52
+ setHighlightedIndex(0);
53
+ }
54
+ return;
55
+ }
56
+ switch (e.key) {
57
+ case "ArrowDown":
58
+ e.preventDefault();
59
+ setHighlightedIndex((prev) => Math.min(prev + 1, optionsRef.current.length - 1));
60
+ break;
61
+ case "ArrowUp":
62
+ e.preventDefault();
63
+ setHighlightedIndex((prev) => Math.max(prev - 1, 0));
64
+ break;
65
+ case "Enter":
66
+ case " ":
67
+ e.preventDefault();
68
+ if (highlightedIndex >= 0 && highlightedIndex < optionsRef.current.length) {
69
+ const option = optionsRef.current[highlightedIndex];
70
+ if (option) {
71
+ option.click();
72
+ }
73
+ }
74
+ break;
75
+ case "Escape":
76
+ e.preventDefault();
77
+ setIsOpen(false);
78
+ break;
79
+ }
80
+ };
81
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SelectContext.Provider, { value: { value, onChange, isOpen, setIsOpen, highlightedIndex, setHighlightedIndex, optionsRef }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
82
+ "div",
83
+ {
84
+ ref: containerRef,
85
+ className: "relative inline-block text-left w-full",
86
+ onKeyDown: handleKeyDown,
87
+ children
88
+ }
89
+ ) });
90
+ };
91
+ var SelectTrigger = ({ children, className = "", placeholder = "Select..." }) => {
92
+ const context = (0, import_react.useContext)(SelectContext);
93
+ if (!context) throw new Error("SelectTrigger must be used within Select");
94
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
95
+ "button",
96
+ {
97
+ type: "button",
98
+ onClick: () => context.setIsOpen(!context.isOpen),
99
+ "aria-haspopup": "listbox",
100
+ "aria-expanded": context.isOpen,
101
+ className: `flex items-center justify-between w-full px-4 py-2 text-sm bg-white border border-slate-300 rounded-md focus:outline-none focus:ring-2 focus:ring-slate-900 focus:border-transparent ${className}`,
102
+ children: [
103
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: context.value ? "text-slate-900" : "text-slate-500", children: children || placeholder }),
104
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ChevronDown, { className: "w-4 h-4 ml-2 opacity-50" })
105
+ ]
106
+ }
107
+ );
108
+ };
109
+ var SelectContent = ({ children }) => {
110
+ const context = (0, import_react.useContext)(SelectContext);
111
+ (0, import_react.useEffect)(() => {
112
+ if (context && context.isOpen) {
113
+ context.optionsRef.current = [];
114
+ }
115
+ }, [context?.isOpen]);
116
+ if (!context || !context.isOpen) return null;
117
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
118
+ "div",
119
+ {
120
+ className: "absolute z-10 w-full mt-1 bg-white border border-slate-200 rounded-md shadow-lg max-h-60 overflow-auto focus:outline-none",
121
+ role: "listbox",
122
+ children
123
+ }
124
+ );
125
+ };
126
+ var SelectItem = ({ value, children }) => {
127
+ const context = (0, import_react.useContext)(SelectContext);
128
+ if (!context) throw new Error("SelectItem must be used within Select");
129
+ const isSelected = context.value === value;
130
+ const index = context.optionsRef.current.length;
131
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
132
+ "div",
133
+ {
134
+ ref: (el) => {
135
+ context.optionsRef.current[index] = el;
136
+ },
137
+ role: "option",
138
+ "aria-selected": isSelected,
139
+ onClick: () => {
140
+ context.onChange(value);
141
+ context.setIsOpen(false);
142
+ },
143
+ className: `flex items-center justify-between px-4 py-2 text-sm cursor-pointer ${context.highlightedIndex === index ? "bg-slate-100" : ""} ${isSelected ? "bg-slate-50 text-slate-900 font-medium" : "text-slate-700"}`,
144
+ children: [
145
+ children,
146
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Check, { className: "w-4 h-4 text-slate-900" })
147
+ ]
148
+ }
149
+ );
150
+ };
151
+ // Annotate the CommonJS export names for ESM import in node:
152
+ 0 && (module.exports = {
153
+ Select,
154
+ SelectContent,
155
+ SelectItem,
156
+ SelectTrigger
157
+ });
@@ -0,0 +1,12 @@
1
+ import {
2
+ Select,
3
+ SelectContent,
4
+ SelectItem,
5
+ SelectTrigger
6
+ } from "../chunk-V2JYAFB7.mjs";
7
+ export {
8
+ Select,
9
+ SelectContent,
10
+ SelectItem,
11
+ SelectTrigger
12
+ };
@@ -0,0 +1,59 @@
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/SkipLink/SkipLink.tsx
21
+ var SkipLink_exports = {};
22
+ __export(SkipLink_exports, {
23
+ SkipLink: () => SkipLink
24
+ });
25
+ module.exports = __toCommonJS(SkipLink_exports);
26
+ var import_react = require("react");
27
+ var import_jsx_runtime = require("react/jsx-runtime");
28
+ var SkipLink = (0, import_react.forwardRef)(
29
+ ({ targetId = "main", className, style, children, ...props }, ref) => {
30
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
31
+ "a",
32
+ {
33
+ ref,
34
+ href: `#${targetId}`,
35
+ className: `
36
+ fixed top-4 left-4 z-50
37
+ px-4 py-3
38
+ bg-white text-slate-900 font-medium
39
+ rounded-md shadow-lg ring-2 ring-slate-900
40
+ transition-transform duration-200
41
+ -translate-y-[150%] focus:translate-y-0
42
+ ${className || ""}
43
+ `,
44
+ style: {
45
+ // Ensure it stays on top of everything
46
+ zIndex: 9999,
47
+ ...style
48
+ },
49
+ ...props,
50
+ children: children || "Hoppa till huvudinneh\xE5ll"
51
+ }
52
+ );
53
+ }
54
+ );
55
+ SkipLink.displayName = "SkipLink";
56
+ // Annotate the CommonJS export names for ESM import in node:
57
+ 0 && (module.exports = {
58
+ SkipLink
59
+ });
@@ -0,0 +1,6 @@
1
+ import {
2
+ SkipLink
3
+ } from "../chunk-MKKQLWGK.mjs";
4
+ export {
5
+ SkipLink
6
+ };