@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
package/dist/index.js
CHANGED
|
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AccessibilityStatement: () => AccessibilityStatement,
|
|
33
34
|
Accordion: () => Accordion,
|
|
34
35
|
AccordionContent: () => AccordionContent,
|
|
35
36
|
AccordionItem: () => AccordionItem,
|
|
@@ -37,17 +38,28 @@ __export(index_exports, {
|
|
|
37
38
|
BreadcrumbItem: () => BreadcrumbItem,
|
|
38
39
|
Breadcrumbs: () => Breadcrumbs,
|
|
39
40
|
Button: () => Button,
|
|
41
|
+
Card: () => Card,
|
|
40
42
|
Checkbox: () => Checkbox,
|
|
43
|
+
Combobox: () => Combobox,
|
|
44
|
+
DataTable: () => DataTable,
|
|
45
|
+
DatePicker: () => DatePicker,
|
|
41
46
|
Dialog: () => Dialog,
|
|
47
|
+
ErrorSummary: () => ErrorSummary,
|
|
42
48
|
FormField: () => FormField,
|
|
43
49
|
Heading: () => Heading,
|
|
50
|
+
HelpText: () => HelpText,
|
|
51
|
+
LiveRegion: () => LiveRegion,
|
|
44
52
|
Modal: () => Modal,
|
|
53
|
+
MultiSelect: () => MultiSelect,
|
|
45
54
|
NavigationMenu: () => NavigationMenu,
|
|
55
|
+
Pagination: () => Pagination,
|
|
56
|
+
ProgressBar: () => ProgressBar,
|
|
46
57
|
RadioGroup: () => RadioGroup,
|
|
47
58
|
Select: () => Select,
|
|
48
59
|
SelectContent: () => SelectContent,
|
|
49
60
|
SelectItem: () => SelectItem,
|
|
50
61
|
SelectTrigger: () => SelectTrigger,
|
|
62
|
+
Skeleton: () => Skeleton,
|
|
51
63
|
SkipLink: () => SkipLink,
|
|
52
64
|
Switch: () => Switch,
|
|
53
65
|
TabTrigger: () => TabTrigger,
|
|
@@ -59,6 +71,7 @@ __export(index_exports, {
|
|
|
59
71
|
TooltipContent: () => TooltipContent,
|
|
60
72
|
TooltipProvider: () => TooltipProvider,
|
|
61
73
|
TooltipTrigger: () => TooltipTrigger,
|
|
74
|
+
TreeView: () => TreeView,
|
|
62
75
|
useToast: () => useToast
|
|
63
76
|
});
|
|
64
77
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -142,7 +155,7 @@ var Button = (0, import_react.forwardRef)(
|
|
|
142
155
|
disabled: disabled || isLoading,
|
|
143
156
|
"aria-busy": isLoading,
|
|
144
157
|
tabIndex: props.tabIndex,
|
|
145
|
-
|
|
158
|
+
className,
|
|
146
159
|
children: [
|
|
147
160
|
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { "aria-hidden": "true", style: { marginRight: "8px" }, children: "\u23F3" }) : null,
|
|
148
161
|
children
|
|
@@ -1158,7 +1171,7 @@ var Tooltip = ({ children }) => {
|
|
|
1158
1171
|
const id = (0, import_react14.useRef)(`tooltip-${Math.random().toString(36).substr(2, 9)}`).current;
|
|
1159
1172
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TooltipContext.Provider, { value: { open, setOpen, id }, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("div", { className: "relative inline-block group", onMouseLeave: () => setOpen(false), children }) });
|
|
1160
1173
|
};
|
|
1161
|
-
var TooltipTrigger = ({ children, asChild = false, ...props }) => {
|
|
1174
|
+
var TooltipTrigger = ({ children, asChild: _asChild = false, ...props }) => {
|
|
1162
1175
|
const context = (0, import_react14.useContext)(TooltipContext);
|
|
1163
1176
|
if (!context) throw new Error("TooltipTrigger must be used within Tooltip");
|
|
1164
1177
|
const { setOpen, id } = context;
|
|
@@ -1233,8 +1246,1854 @@ var Heading = import_react15.default.forwardRef(
|
|
|
1233
1246
|
}
|
|
1234
1247
|
);
|
|
1235
1248
|
Heading.displayName = "Heading";
|
|
1249
|
+
|
|
1250
|
+
// src/AccessibilityStatement/AccessibilityStatement.tsx
|
|
1251
|
+
var import_standards = require("@holmdigital/standards");
|
|
1252
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
1253
|
+
var TEMPLATES = {
|
|
1254
|
+
sv: {
|
|
1255
|
+
title: "Tillg\xE4nglighet f\xF6r {<webbplats>}",
|
|
1256
|
+
intro: "{<organisation>} st\xE5r bakom den h\xE4r webbplatsen. Vi vill att s\xE5 m\xE5nga som m\xF6jligt ska kunna anv\xE4nda den. Det h\xE4r dokumentet beskriver hur {<webbplats>} uppfyller lagen om tillg\xE4nglighet till digital offentlig service, eventuella k\xE4nda tillg\xE4nglighetsproblem och hur du kan rapportera brister till oss s\xE5 att vi kan \xE5tg\xE4rda dem.",
|
|
1257
|
+
sections: [
|
|
1258
|
+
{ id: "how-accessible", title: "Hur tillg\xE4nglig \xE4r webbplatsen?", content: "{Vi har inga k\xE4nda brister i tillg\xE4ngligheten f\xF6r den h\xE4r webbplatsen./Vi \xE4r medvetna om att delar av webbplatsen inte \xE4r helt tillg\xE4ngliga. Se avsnittet om inneh\xE5ll som inte \xE4r tillg\xE4ngligt nedan f\xF6r mer information./Vi \xE4r medvetna om att delar av webbplatsen inte \xE4r helt tillg\xE4ngliga. Se avsnittet om inneh\xE5ll som inte \xE4r tillg\xE4ngligt nedan f\xF6r mer information.}" },
|
|
1259
|
+
{ id: "what-to-do", title: "Vad kan du g\xF6ra om du inte kan anv\xE4nda delar av webbplatsen?", content: "Om du beh\xF6ver inneh\xE5ll fr\xE5n {<webbplats>} som inte \xE4r tillg\xE4ngligt f\xF6r dig, men som \xE4r undantaget fr\xE5n lagens till\xE4mpningsomr\xE5de enligt beskrivning nedan, kan du meddela oss.\n\n[Svarstiden \xE4r normalt {<svarstid>}.]\n\n[Du kan ocks\xE5 kontakta oss p\xE5 f\xF6ljande s\xE4tt:\n\n* skicka e-post till {<e-postadress>}\n* ring {<telefonnummer>}]" },
|
|
1260
|
+
{ id: "reporting", title: "Rapportera brister i webbplatsens tillg\xE4nglighet", content: "Vi str\xE4var hela tiden efter att f\xF6rb\xE4ttra webbplatsens tillg\xE4nglighet. Om du uppt\xE4cker problem som inte \xE4r beskrivna p\xE5 den h\xE4r sidan, eller om du anser att vi inte uppfyller lagens krav, meddela oss s\xE5 att vi f\xE5r veta att problemet finns." },
|
|
1261
|
+
{ id: "enforcement", title: "Tillsyn", content: "{<enforcement_body>} har ansvaret f\xF6r tillsyn \xF6ver lagen om tillg\xE4nglighet till digital offentlig service. Du kan anm\xE4la till {<enforcement_body>} om du tycker att v\xE5r digitala service har brister i tillg\xE4nglighet.\n\nDu kan ocks\xE5 anm\xE4la till {<enforcement_body>} om du tycker att v\xE5r bed\xF6mning av vad som \xE4r osk\xE4ligt betungande ska granskas, om du tycker att v\xE5r tillg\xE4nglighetsredog\xF6relse har brister eller om du tycker att vi inte har hanterat din beg\xE4ran om tillg\xE4ngligg\xF6rande korrekt." },
|
|
1262
|
+
{ id: "technical", title: "Teknisk information om webbplatsens tillg\xE4nglighet", content: "{Den h\xE4r webbplatsen \xE4r helt f\xF6renlig med lagen om tillg\xE4nglighet till digital offentlig service./Den h\xE4r webbplatsen \xE4r delvis f\xF6renlig med lagen om tillg\xE4nglighet till digital offentlig service, p\xE5 grund av de brister som beskrivs nedan./Den h\xE4r webbplatsen \xE4r inte f\xF6renlig med lagen om tillg\xE4nglighet till digital offentlig service. Otillg\xE4ngliga delar beskrivs nedan.}" },
|
|
1263
|
+
{ id: "non-accessible", title: "Inneh\xE5ll som inte \xE4r tillg\xE4ngligt", content: "Det inneh\xE5ll som beskrivs nedan \xE4r p\xE5 ett eller annat s\xE4tt inte helt tillg\xE4ngligt.\n\n[\n### Bristande f\xF6renlighet med lagkraven\n{<brister>}\n]" },
|
|
1264
|
+
{ id: "testing", title: "Hur vi testat webbplatsen", content: "{Vi har gjort en sj\xE4lvskattning (intern testning) av {<webbplats>}./{<extern akt\xF6r>} har gjort en oberoende granskning av {<webbplats>}./Vi har uppskattat tillg\xE4ngligheten utan granskning.}\n\nSenaste bed\xF6mningen gjordes den {<bed\xF6mningsdatum>}.\n\n[Granskningsmetod: {<metod>}]\n\nWebbplatsen publicerades den {<publiceringsdatum>}.\n\nRedog\xF6relsen uppdaterades senast den {<uppdateringsdatum>}." }
|
|
1265
|
+
]
|
|
1266
|
+
},
|
|
1267
|
+
en: {
|
|
1268
|
+
title: "Accessibility of {<website>}",
|
|
1269
|
+
intro: "This website is run by {<organisation>}. We want as many people as possible to be able to use it, and this document describes how {<website>} complies with the accessibility regulations, any known accessibility issues, and how you can report problems so that we can fix them.",
|
|
1270
|
+
sections: [
|
|
1271
|
+
{ id: "how-accessible", title: "How accessible is the website?", content: "{There are no known accessibility issues with this website./We know some parts of this website aren\u2019t fully accessible. See the section on non-accessible content below for more information./We know some parts of this website aren\u2019t fully accessible. See the section on non-accessible content below for more information.}" },
|
|
1272
|
+
{ id: "what-to-do", title: "What to do if you can\u2019t access parts of this website?", content: "If you need content from this website that is not accessible for you, but is not within the scope of the accessibility regulations as described below, please contact us.\n\n[Our normal response time is {<response time>}.]\n\n[You can also contact us in the following ways:\n\n* email {<email address>}\n* call {<telephone number>}]" },
|
|
1273
|
+
{ id: "reporting", title: "Reporting accessibility problems with this website", content: "We\u2019re always looking to improve the accessibility of this website. If you find any problems that aren\u2019t listed on this page or if we\u2019re not meeting the requirements of the accessibility regulations, contact us and let us know about the problem." },
|
|
1274
|
+
{ id: "enforcement", title: "Enforcement procedure", content: "The {<enforcement_body>} is responsible for enforcing the web accessibility regulations. If you experience accessibility issues on our website, you can submit a complaint to {<enforcement_body>}.\n\nYou can also submit a complaint to {<enforcement_body>} if you think that our assessment of what constitutes a disproportionate burden should be reviewed, if you think that our accessibility statement is inadequate, or it you think that your request for excluded content in an accessible format has not been handled correctly." },
|
|
1275
|
+
{ id: "technical", title: "Technical information about this website\u2019s accessibility", content: "{This website is fully compliant with the accessibility regulations./This website is partially compliant with the accessibility regulations, due to the non-compliances listed below./This website is not compliant with the accessibility regulations. The non-accessible sections are listed below.}" },
|
|
1276
|
+
{ id: "non-accessible", title: "Non-accessible content", content: "The content described below is, in one way or another, not fully accessible.\n\n[\n### Non-compliance with the accessibility regulations\n\n{<issues>}\n]" },
|
|
1277
|
+
{ id: "testing", title: "How we tested this website", content: "{We have performed a self-assessment (internal testing) of {<website>}./{<third party>} has tested {<website>}./We have estimated the accessibility without testing.}\n\nThe last assessment was made on {<assessment date>}.\n\n[Assessment method: {<method>}]\n\nThe website was published on {<publish date>}.\n\nThe statement was last updated on {<update date>}." }
|
|
1278
|
+
]
|
|
1279
|
+
},
|
|
1280
|
+
no: {
|
|
1281
|
+
title: "Tilgjengelighet for {<nettsted>}",
|
|
1282
|
+
intro: "{<organisasjon>} st\xE5r bak dette nettstedet. Vi \xF8nsker at flest mulig skal kunne bruke det. Dette dokumentet beskriver hvordan {<nettsted>} oppfyller lov om universell utforming av IKT-l\xF8sninger, eventuelle kjente tilgjengelighetsproblemer og hvordan du kan rapportere mangler til oss slik at vi kan utbedre dem.",
|
|
1283
|
+
sections: [
|
|
1284
|
+
{ id: "how-accessible", title: "Hvor tilgjengelig er nettstedet?", content: "{Vi har ingen kjente mangler i tilgjengeligheten for dette nettstedet./Vi er klar over at deler av nettstedet ikke er fullt ut tilgjengelig. See avsnittet om innhold som ikke er tilgjengelig nedenfor for mer informasjon./Vi er klar over at deler av nettstedet ikke er fullt ut tilgjengelig. See avsnittet om innhold som ikke er tilgjengelig nedenfor for mer informasjon.}" },
|
|
1285
|
+
{ id: "what-to-do", title: "Hva kan du gj\xF8re hvis du ikke kan bruke deler av nettstedet?", content: "Hvis du trenger innhold fra {<nettsted>} som ikke er tilgjengelig for deg, men som er unntatt fra lovens anvendelsesomr\xE5de som beskrevet nedenfor, kan du melde fra til oss.\n\n[Svartiden er normalt {<svartid>}.]\n\n[Du kan ogs\xE5 kontakte oss p\xE5 f\xF8lgende m\xE5ter:\n\n* send e-post til {<e-postadresse>}\n* ring {<telefonnummer>}]" },
|
|
1286
|
+
{ id: "reporting", title: "Rapporter mangler ved nettstedets tilgjengelighet", content: "Vi jobber kontinuerlig med \xE5 forbedre nettstedets tilgjengelighet. Hvis du oppdager problemer som ikke er beskrevet p\xE5 denne siden, eller hvis du mener at vi ikke oppfyller lovens krav, meld fra til oss slik at vi f\xE5r vite om problemet." },
|
|
1287
|
+
{ id: "enforcement", title: "Tillsyn", content: "{<enforcement_body>} har ansvaret for tilsyn med lov om universell utforming av IKT-l\xF8sninger. Du kan klage til {<enforcement_body>} hvis du mener at v\xE5r digitale tjeneste har mangler i tilgjengelighet.\n\nDu kan ogs\xE5 klage til {<enforcement_body>} hvis du mener at v\xE5r vurdering av hva som er uforholdsmessig byrdefullt b\xF8r overproves, hvis du mener at v\xE5r tilgjengelighetserkl\xE6ring har mangler eller hvis du mener at vi ikke har h\xE5ndtert din foresp\xF8rsel om tilgjengeliggj\xF8ring korrekt." },
|
|
1288
|
+
{ id: "technical", title: "Teknisk informasjon om nettstedets tilgjengelighet", content: "{Dette nettstedet er helt i samsvar med lov om universell utforming av IKT-l\xF8sninger./Dette nettstedet er delvis i samsvar med lov om universell utforming av IKT-l\xF8sninger, p\xE5 grunn av manglene beskrevet nedenfor./Dette nettstedet er ikke i samsvar med lov om universell utforming av IKT-l\xF8sninger. Utilgjengelige deler er beskrevet nedenfor.}" },
|
|
1289
|
+
{ id: "non-accessible", title: "Innhold som ikke er tilgjengelig", content: "Innholdet som er beskrevet nedenfor er p\xE5 en eller annen m\xE5te ikke fullt ut tilgjengelig.\n\n[\n### Manglende samsvar med lovkravene\n{<mangler>}\n]" },
|
|
1290
|
+
{ id: "testing", title: "Hvordan vi har testet nettstedet", content: "{Vi har gjort en egenevaluering (intern testing) av {<nettsted>}./{<ekstern aktor>} har gjort en uavhengig revisjon av {<nettsted>}./Vi har ansl\xE5tt tilgjengeligheten uten testing.}\n\nSiste vurdering ble gjort den {<vurderingsdato>}.\n\n[Vurderingsmetode: {<metode>}]\n\nNettstedet ble publisert den {<publiseringsdato>}.\n\nErkl\xE6ringen ble sist oppdatert den {<oppdateringsdato>}." }
|
|
1291
|
+
]
|
|
1292
|
+
}
|
|
1293
|
+
};
|
|
1294
|
+
var formatDiggDate = (date, locale) => {
|
|
1295
|
+
const localeMap = {
|
|
1296
|
+
sv: "sv-SE",
|
|
1297
|
+
no: "no-NO",
|
|
1298
|
+
nb: "no-NO",
|
|
1299
|
+
da: "da-DK",
|
|
1300
|
+
fi: "fi-FI",
|
|
1301
|
+
nl: "nl-NL",
|
|
1302
|
+
de: "de-DE",
|
|
1303
|
+
fr: "fr-FR",
|
|
1304
|
+
es: "es-ES"
|
|
1305
|
+
};
|
|
1306
|
+
return date.toLocaleDateString(localeMap[locale] || "en-US", {
|
|
1307
|
+
year: "numeric",
|
|
1308
|
+
month: "long",
|
|
1309
|
+
day: "numeric"
|
|
1310
|
+
});
|
|
1311
|
+
};
|
|
1312
|
+
var AccessibilityStatement = ({
|
|
1313
|
+
country,
|
|
1314
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1315
|
+
sector: _sector,
|
|
1316
|
+
organizationName,
|
|
1317
|
+
websiteUrl: _websiteUrl,
|
|
1318
|
+
complianceLevel,
|
|
1319
|
+
lastReviewDate,
|
|
1320
|
+
contactEmail,
|
|
1321
|
+
assessmentDate,
|
|
1322
|
+
evaluationMethod,
|
|
1323
|
+
generatorTool,
|
|
1324
|
+
logoUrl,
|
|
1325
|
+
nonComplianceItems = [],
|
|
1326
|
+
locale = "en",
|
|
1327
|
+
className = "",
|
|
1328
|
+
phoneNumber,
|
|
1329
|
+
responseTime,
|
|
1330
|
+
badgeUrl,
|
|
1331
|
+
publishDate
|
|
1332
|
+
}) => {
|
|
1333
|
+
const lang = locale === "sv" ? "sv" : "en";
|
|
1334
|
+
const template = TEMPLATES[lang] || TEMPLATES.en;
|
|
1335
|
+
const d = (date) => formatDiggDate(date, locale);
|
|
1336
|
+
const enforcementBody = import_standards.ENFORCEMENT_BODIES[country] || import_standards.ENFORCEMENT_BODIES.EU;
|
|
1337
|
+
const replacements = {
|
|
1338
|
+
"{<webbplats>}": organizationName,
|
|
1339
|
+
// Or websiteUrl, but usually org/site name
|
|
1340
|
+
"{<website>}": organizationName,
|
|
1341
|
+
"{<organisation>}": organizationName,
|
|
1342
|
+
"{<e-postadress>}": contactEmail,
|
|
1343
|
+
"{<email address>}": contactEmail,
|
|
1344
|
+
"{<telefonnummer>}": phoneNumber || "",
|
|
1345
|
+
"{<telephone number>}": phoneNumber || "",
|
|
1346
|
+
"{<svarstid>}": responseTime || "",
|
|
1347
|
+
"{<response time>}": responseTime || "",
|
|
1348
|
+
"{<bed\xF6mningsdatum>}": assessmentDate ? d(assessmentDate) : d(lastReviewDate),
|
|
1349
|
+
"{<assessment date>}": assessmentDate ? d(assessmentDate) : d(lastReviewDate),
|
|
1350
|
+
"{<uppdateringsdatum>}": d(lastReviewDate),
|
|
1351
|
+
"{<update date>}": d(lastReviewDate),
|
|
1352
|
+
"{<publiceringsdatum>}": publishDate ? d(publishDate) : "2024-01-01",
|
|
1353
|
+
// Default to a realistic value if unknown
|
|
1354
|
+
"{<publish date>}": publishDate ? d(publishDate) : "2024-01-01",
|
|
1355
|
+
"{<metod>}": evaluationMethod || "Automated Scan",
|
|
1356
|
+
"{<method>}": evaluationMethod || "Automated Scan",
|
|
1357
|
+
"{<extern akt\xF6r>}": generatorTool?.name || "HolmDigital Engine",
|
|
1358
|
+
"{<third party>}": generatorTool?.name || "HolmDigital Engine",
|
|
1359
|
+
"{<enforcement_body>}": enforcementBody
|
|
1360
|
+
};
|
|
1361
|
+
let issuesContent = "";
|
|
1362
|
+
if (nonComplianceItems.length > 0) {
|
|
1363
|
+
issuesContent = nonComplianceItems.map((item) => `* ${item}`).join("\n");
|
|
1364
|
+
} else {
|
|
1365
|
+
issuesContent = lang === "sv" ? "Inga k\xE4nda brister." : lang === "no" ? "Ingen kjente mangler." : "No known issues.";
|
|
1366
|
+
}
|
|
1367
|
+
replacements["{<brister>}"] = issuesContent;
|
|
1368
|
+
replacements["{<issues>}"] = issuesContent;
|
|
1369
|
+
replacements["{<mangler>}"] = issuesContent;
|
|
1370
|
+
replacements["{<nettsted>}"] = organizationName;
|
|
1371
|
+
replacements["{<organisasjon>}"] = organizationName;
|
|
1372
|
+
replacements["{<svartid>}"] = responseTime || "";
|
|
1373
|
+
replacements["{<vurderingsdato>}"] = assessmentDate ? d(assessmentDate) : d(lastReviewDate);
|
|
1374
|
+
replacements["{<publiseringsdatum>}"] = publishDate ? d(publishDate) : "2024-01-01";
|
|
1375
|
+
replacements["{<ekstern aktor>}"] = generatorTool?.name || "HolmDigital Engine";
|
|
1376
|
+
const renderTemplate = (tmpl) => {
|
|
1377
|
+
let text = tmpl;
|
|
1378
|
+
text = text.replace(/\[([\s\S]*?)\]/g, (_match, content) => {
|
|
1379
|
+
if (content.includes("{<svarstid>}") || content.includes("{<response time>}")) {
|
|
1380
|
+
return responseTime ? content : "";
|
|
1381
|
+
}
|
|
1382
|
+
if (content.includes("{<telefonnummer>}") || content.includes("{<telephone number>}")) {
|
|
1383
|
+
return phoneNumber ? content : "";
|
|
1384
|
+
}
|
|
1385
|
+
if (content.includes("{<brister>}") || content.includes("{<issues>}")) {
|
|
1386
|
+
return complianceLevel !== "full" ? content : "";
|
|
1387
|
+
}
|
|
1388
|
+
return "\n" + content.trim() + "\n";
|
|
1389
|
+
});
|
|
1390
|
+
for (const [key, value] of Object.entries(replacements)) {
|
|
1391
|
+
text = text.replaceAll(key, value);
|
|
1392
|
+
}
|
|
1393
|
+
text = text.replace(/\{([^{}]*?)\}/g, (_match, content) => {
|
|
1394
|
+
const parts = content.split("/");
|
|
1395
|
+
if (parts.length >= 2) {
|
|
1396
|
+
let idx = 0;
|
|
1397
|
+
if (complianceLevel === "partial") idx = 1;
|
|
1398
|
+
if (complianceLevel === "non-compliant") idx = parts.length > 2 ? 2 : 1;
|
|
1399
|
+
return parts[idx].trim();
|
|
1400
|
+
}
|
|
1401
|
+
return _match;
|
|
1402
|
+
});
|
|
1403
|
+
return text;
|
|
1404
|
+
};
|
|
1405
|
+
const renderSections = (sections) => {
|
|
1406
|
+
return sections.map((section, i) => {
|
|
1407
|
+
const content = renderTemplate(section.content);
|
|
1408
|
+
const trimmed = content.trim();
|
|
1409
|
+
if (!trimmed) return null;
|
|
1410
|
+
let IconNode = null;
|
|
1411
|
+
if (section.id === "how-accessible" || trimmed.includes("Hur tillg\xE4nglig") || trimmed.includes("How accessible") || trimmed.includes("Hvor tilgjengelig") || trimmed.includes("Hvor tilg\xE6ngeligt") || trimmed.includes("Kuinka saavutettava") || trimmed.includes("Hoe toegankelijk") || trimmed.includes("Stand der Vereinbarkeit") || trimmed.includes("\xC9tat de conformit\xE9") || trimmed.includes("Situaci\xF3n de cumplimiento")) {
|
|
1412
|
+
IconNode = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IconWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(EyeIcon, {}) });
|
|
1413
|
+
} else if (section.id === "what-to-do" || trimmed.includes("Vad kan du g\xF6ra") || trimmed.includes("What to do") || trimmed.includes("Hva kan du gj\xF8re") || trimmed.includes("Hvad kan du g\xF8re") || trimmed.includes("Mit\xE4 voit tehd\xE4") || trimmed.includes("Wat kunt u doen") || trimmed.includes("Nicht barrierefreie Inhalte") || trimmed.includes("Contenus non accessibles") || trimmed.includes("Contenido no accesible")) {
|
|
1414
|
+
IconNode = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IconWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(HelpCircleIcon, {}) });
|
|
1415
|
+
} else if (section.id === "reporting" || trimmed.includes("Rapporter brister") || trimmed.includes("Reporting accessibility") || trimmed.includes("Rapporter mangler") || trimmed.includes("Anna palautetta") || trimmed.includes("Meld toegankelijkheidsproblemen") || trimmed.includes("Feedback und Kontaktangaben") || trimmed.includes("Retour d'information") || trimmed.includes("Mecanismo de comunicaci\xF3n")) {
|
|
1416
|
+
IconNode = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IconWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(AlertOctagonIcon, {}) });
|
|
1417
|
+
} else if (section.id === "enforcement" || trimmed.includes("Tillsyn") || trimmed.includes("Enforcement procedure") || trimmed.includes("Tilsyn") || trimmed.includes("H\xE5ndh\xE6velsesprocedure") || trimmed.includes("T\xE4yt\xE4nt\xF6\xF6npanomenettely") || trimmed.includes("Handhavingsprocedure") || trimmed.includes("Durchsetzungsverfahren") || trimmed.includes("Voies de recours") || trimmed.includes("Procedimiento de aplicaci\xF3n")) {
|
|
1418
|
+
IconNode = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IconWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(GavelIcon, {}) });
|
|
1419
|
+
} else if (section.id === "technical" || trimmed.includes("Teknisk information") || trimmed.includes("Technical information")) {
|
|
1420
|
+
IconNode = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IconWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CpuIcon, {}) });
|
|
1421
|
+
} else if (section.id === "testing" || trimmed.includes("Hur vi testat") || trimmed.includes("How we tested") || trimmed.includes("Hvordan vi har testet") || trimmed.includes("Kuinka olemme testanneet") || trimmed.includes("Hoe wij de website hebben getest") || trimmed.includes("Erstellung dieser Erkl\xE4rung") || trimmed.includes("\xC9tablissement de cette d\xE9claration") || trimmed.includes("Preparaci\xF3n de la presente declaraci\xF3n")) {
|
|
1422
|
+
IconNode = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(IconWrapper, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CheckCircleIcon, {}) });
|
|
1423
|
+
}
|
|
1424
|
+
const blocks = trimmed.split("\n\n").map((block, bi) => {
|
|
1425
|
+
const blockTrimmed = block.trim();
|
|
1426
|
+
if (!blockTrimmed) return null;
|
|
1427
|
+
if (blockTrimmed.startsWith("## ")) {
|
|
1428
|
+
const title = blockTrimmed.replace("## ", "");
|
|
1429
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("h2", { style: styles.sectionTitle, children: [
|
|
1430
|
+
IconNode,
|
|
1431
|
+
title
|
|
1432
|
+
] }, `${i}-${bi}`);
|
|
1433
|
+
}
|
|
1434
|
+
if (blockTrimmed.startsWith("### ")) {
|
|
1435
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h3", { style: { ...styles.sectionTitle, fontSize: "1.4rem" }, children: blockTrimmed.replace("### ", "") }, `${i}-${bi}`);
|
|
1436
|
+
}
|
|
1437
|
+
if (blockTrimmed.includes("* ") || blockTrimmed.includes("\u2022 ")) {
|
|
1438
|
+
const lines = blockTrimmed.split("\n");
|
|
1439
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("ul", { style: styles.list, children: lines.map((line, li) => {
|
|
1440
|
+
const cleanLine = line.trim().replace(/^[*-•]\s*/, "");
|
|
1441
|
+
if (!cleanLine) return null;
|
|
1442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("li", { style: styles.listItem, children: [
|
|
1443
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: styles.listBullet }),
|
|
1444
|
+
cleanLine
|
|
1445
|
+
] }, li);
|
|
1446
|
+
}) }, `${i}-${bi}`);
|
|
1447
|
+
}
|
|
1448
|
+
const isCardSection = blockTrimmed.includes("e-post") || blockTrimmed.includes("email") || blockTrimmed.includes("ring ") || blockTrimmed.includes("call ");
|
|
1449
|
+
if (isCardSection) {
|
|
1450
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: styles.card, children: blockTrimmed }, `${i}-${bi}`);
|
|
1451
|
+
}
|
|
1452
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { style: styles.paragraph, children: blockTrimmed }, `${i}-${bi}`);
|
|
1453
|
+
});
|
|
1454
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("section", { style: styles.section, children: blocks }, i);
|
|
1455
|
+
});
|
|
1456
|
+
};
|
|
1457
|
+
const statementTools = (0, import_standards.getStatementToolsByCountry)(country);
|
|
1458
|
+
const usedTool = generatorTool || statementTools.find((t) => t.recommended) || statementTools[0];
|
|
1459
|
+
const styles = {
|
|
1460
|
+
page: {
|
|
1461
|
+
fontFamily: '"Inter", system-ui, -apple-system, sans-serif',
|
|
1462
|
+
color: "#334155",
|
|
1463
|
+
// Slate 700
|
|
1464
|
+
lineHeight: 1.6,
|
|
1465
|
+
maxWidth: "100%"
|
|
1466
|
+
},
|
|
1467
|
+
header: {
|
|
1468
|
+
display: "flex",
|
|
1469
|
+
justifyContent: "space-between",
|
|
1470
|
+
alignItems: "center",
|
|
1471
|
+
marginBottom: "4.5rem",
|
|
1472
|
+
paddingBottom: "2rem",
|
|
1473
|
+
borderBottom: "1px solid #f1f5f9"
|
|
1474
|
+
},
|
|
1475
|
+
logoContainer: {
|
|
1476
|
+
display: "flex",
|
|
1477
|
+
alignItems: "center",
|
|
1478
|
+
textDecoration: "none",
|
|
1479
|
+
marginRight: "1.5rem"
|
|
1480
|
+
},
|
|
1481
|
+
divider: {
|
|
1482
|
+
height: "2.5rem",
|
|
1483
|
+
width: "1px",
|
|
1484
|
+
backgroundColor: "#e2e8f0",
|
|
1485
|
+
marginRight: "1.5rem",
|
|
1486
|
+
display: "block"
|
|
1487
|
+
},
|
|
1488
|
+
websiteContainer: {
|
|
1489
|
+
display: "flex",
|
|
1490
|
+
alignItems: "center",
|
|
1491
|
+
gap: "0.75rem",
|
|
1492
|
+
textDecoration: "none",
|
|
1493
|
+
color: "#475569",
|
|
1494
|
+
// Slate 600
|
|
1495
|
+
fontWeight: 600,
|
|
1496
|
+
fontSize: "1rem",
|
|
1497
|
+
padding: "0.5rem 1rem",
|
|
1498
|
+
backgroundColor: "#f8fafc",
|
|
1499
|
+
borderRadius: "0.75rem",
|
|
1500
|
+
border: "1px solid #f1f5f9"
|
|
1501
|
+
},
|
|
1502
|
+
container: {
|
|
1503
|
+
maxWidth: "900px",
|
|
1504
|
+
margin: "2rem auto",
|
|
1505
|
+
padding: "4.5rem",
|
|
1506
|
+
backgroundColor: "#ffffff",
|
|
1507
|
+
borderRadius: "24px",
|
|
1508
|
+
boxShadow: "0 25px 50px -12px rgb(0 0 0 / 0.05)",
|
|
1509
|
+
border: "1px solid #f1f5f9",
|
|
1510
|
+
fontFamily: '"Inter", system-ui, -apple-system, sans-serif',
|
|
1511
|
+
color: "#1e293b",
|
|
1512
|
+
// Slate 800
|
|
1513
|
+
lineHeight: 1.75,
|
|
1514
|
+
fontSize: "1.125rem"
|
|
1515
|
+
},
|
|
1516
|
+
mainHeading: {
|
|
1517
|
+
fontSize: "3rem",
|
|
1518
|
+
fontWeight: 900,
|
|
1519
|
+
color: "#082f49",
|
|
1520
|
+
// Primary 950
|
|
1521
|
+
marginTop: "0",
|
|
1522
|
+
marginBottom: "1rem",
|
|
1523
|
+
letterSpacing: "-0.04em",
|
|
1524
|
+
lineHeight: 1.1
|
|
1525
|
+
},
|
|
1526
|
+
metaData: {
|
|
1527
|
+
color: "#64748b",
|
|
1528
|
+
// Slate 500
|
|
1529
|
+
fontSize: "0.925rem",
|
|
1530
|
+
marginBottom: "4rem",
|
|
1531
|
+
fontWeight: 500,
|
|
1532
|
+
display: "flex",
|
|
1533
|
+
gap: "1.5rem"
|
|
1534
|
+
},
|
|
1535
|
+
section: {
|
|
1536
|
+
marginBottom: "4.5rem"
|
|
1537
|
+
},
|
|
1538
|
+
sectionTitle: {
|
|
1539
|
+
fontSize: "1.75rem",
|
|
1540
|
+
fontWeight: 800,
|
|
1541
|
+
color: "#082f49",
|
|
1542
|
+
// Primary 950
|
|
1543
|
+
marginBottom: "1.5rem",
|
|
1544
|
+
marginTop: 0,
|
|
1545
|
+
letterSpacing: "-0.025em",
|
|
1546
|
+
display: "flex",
|
|
1547
|
+
alignItems: "center",
|
|
1548
|
+
gap: "0.75rem"
|
|
1549
|
+
},
|
|
1550
|
+
card: {
|
|
1551
|
+
padding: "2.5rem",
|
|
1552
|
+
backgroundColor: "#f0f9ff",
|
|
1553
|
+
// Primary 50
|
|
1554
|
+
borderRadius: "1.5rem",
|
|
1555
|
+
border: "1px solid #e0f2fe",
|
|
1556
|
+
marginBottom: "2.5rem"
|
|
1557
|
+
},
|
|
1558
|
+
paragraph: {
|
|
1559
|
+
marginBottom: "1.5rem",
|
|
1560
|
+
maxWidth: "65ch",
|
|
1561
|
+
whiteSpace: "pre-line"
|
|
1562
|
+
},
|
|
1563
|
+
link: {
|
|
1564
|
+
color: "#0284c7",
|
|
1565
|
+
// Primary 600
|
|
1566
|
+
textDecoration: "none",
|
|
1567
|
+
fontWeight: 600,
|
|
1568
|
+
borderBottom: "2px solid #e0f2fe",
|
|
1569
|
+
transition: "border-color 0.2s",
|
|
1570
|
+
cursor: "pointer"
|
|
1571
|
+
},
|
|
1572
|
+
list: {
|
|
1573
|
+
listStyleType: "none",
|
|
1574
|
+
paddingLeft: 0,
|
|
1575
|
+
marginBottom: "1.5rem"
|
|
1576
|
+
},
|
|
1577
|
+
listItem: {
|
|
1578
|
+
marginBottom: "0.75rem",
|
|
1579
|
+
paddingLeft: "1.75rem",
|
|
1580
|
+
position: "relative",
|
|
1581
|
+
display: "block"
|
|
1582
|
+
},
|
|
1583
|
+
listBullet: {
|
|
1584
|
+
position: "absolute",
|
|
1585
|
+
left: 0,
|
|
1586
|
+
top: "0.6em",
|
|
1587
|
+
width: "0.5rem",
|
|
1588
|
+
height: "0.5rem",
|
|
1589
|
+
borderRadius: "50%",
|
|
1590
|
+
backgroundColor: "#0ea5e9"
|
|
1591
|
+
// Primary 500
|
|
1592
|
+
},
|
|
1593
|
+
statusBadge: {
|
|
1594
|
+
display: "inline-flex",
|
|
1595
|
+
alignItems: "center",
|
|
1596
|
+
padding: "0.375rem 1rem",
|
|
1597
|
+
borderRadius: "9999px",
|
|
1598
|
+
fontSize: "0.875rem",
|
|
1599
|
+
fontWeight: 700,
|
|
1600
|
+
backgroundColor: complianceLevel === "full" ? "#dcfce7" : complianceLevel === "partial" ? "#fef9c3" : "#fee2e2",
|
|
1601
|
+
color: complianceLevel === "full" ? "#166534" : complianceLevel === "partial" ? "#854d0e" : "#991b1b",
|
|
1602
|
+
boxShadow: `0 4px 6px -1px ${complianceLevel === "full" ? "rgba(34, 197, 94, 0.1)" : complianceLevel === "partial" ? "rgba(234, 179, 8, 0.1)" : "rgba(239, 68, 68, 0.1)"}`,
|
|
1603
|
+
border: `1px solid ${complianceLevel === "full" ? "#bbf7d0" : complianceLevel === "partial" ? "#fef08a" : "#fecaca"}`,
|
|
1604
|
+
marginLeft: "0.5rem"
|
|
1605
|
+
},
|
|
1606
|
+
iconWrapper: {
|
|
1607
|
+
display: "flex",
|
|
1608
|
+
alignItems: "center",
|
|
1609
|
+
justifyContent: "center",
|
|
1610
|
+
width: "2.5rem",
|
|
1611
|
+
height: "2.5rem",
|
|
1612
|
+
borderRadius: "0.75rem",
|
|
1613
|
+
backgroundColor: "#ffffff",
|
|
1614
|
+
boxShadow: "0 1px 2px 0 rgba(0, 0, 0, 0.05)",
|
|
1615
|
+
border: "1px solid #f1f5f9",
|
|
1616
|
+
color: "#0284c7"
|
|
1617
|
+
}
|
|
1618
|
+
};
|
|
1619
|
+
const Logo = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", "aria-hidden": "true", children: [
|
|
1620
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { width: "32", height: "32", rx: "6", fill: "#0F172A" }),
|
|
1621
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M16 8L24 16L16 24L8 16L16 8Z", fill: "#38BDF8" }),
|
|
1622
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M16 12L20 16L16 20L12 16L16 12Z", fill: "#0F172A" })
|
|
1623
|
+
] });
|
|
1624
|
+
const IconWrapper = ({ children }) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: styles.iconWrapper, children });
|
|
1625
|
+
const EyeIcon = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1626
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M2 12s3-7 10-7 10 7 10 7-3 7-10 7-10-7-10-7Z" }),
|
|
1627
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("circle", { cx: "12", cy: "12", r: "3" })
|
|
1628
|
+
] });
|
|
1629
|
+
const HelpCircleIcon = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1630
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1631
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
|
|
1632
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
|
|
1633
|
+
] });
|
|
1634
|
+
const AlertOctagonIcon = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1635
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("polygon", { points: "7.86 2 16.14 2 22 7.86 22 16.14 16.14 22 7.86 22 2 16.14 2 7.86 7.86 2" }),
|
|
1636
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
1637
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
1638
|
+
] });
|
|
1639
|
+
const GavelIcon = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1640
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "m14 13-5 5 2 2 5-5-2-2Z" }),
|
|
1641
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "m3 21 2-2 5-5-2-2-5 5-2 2Z" }),
|
|
1642
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "m15 6 5 5-11 11-5-5L15 6Z" }),
|
|
1643
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M13 2 18 7" })
|
|
1644
|
+
] });
|
|
1645
|
+
const CpuIcon = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1646
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "4", y: "4", width: "16", height: "16", rx: "2" }),
|
|
1647
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("rect", { x: "9", y: "9", width: "6", height: "6" }),
|
|
1648
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M15 2v2" }),
|
|
1649
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M15 20v2" }),
|
|
1650
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M2 15h2" }),
|
|
1651
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M2 9h2" }),
|
|
1652
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M20 15h2" }),
|
|
1653
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M20 9h2" }),
|
|
1654
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M9 2v2" }),
|
|
1655
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M9 20v2" })
|
|
1656
|
+
] });
|
|
1657
|
+
const CheckCircleIcon = () => /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
1658
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M22 11.08V12a10 10 0 1 1-5.93-9.14" }),
|
|
1659
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("polyline", { points: "22 4 12 14.01 9 11.01" })
|
|
1660
|
+
] });
|
|
1661
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(
|
|
1662
|
+
"main",
|
|
1663
|
+
{
|
|
1664
|
+
role: "main",
|
|
1665
|
+
className,
|
|
1666
|
+
style: styles.container,
|
|
1667
|
+
"aria-labelledby": "a11y-statement-title",
|
|
1668
|
+
children: [
|
|
1669
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("header", { style: styles.header, children: [
|
|
1670
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { style: { display: "flex", alignItems: "center" }, children: [
|
|
1671
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("a", { href: "https://holmdigital.se", style: styles.logoContainer, target: "_blank", rel: "noreferrer", children: logoUrl ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: logoUrl, alt: "Holm Digital", style: { height: "3rem", width: "auto" } }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_jsx_runtime16.Fragment, { children: [
|
|
1672
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Logo, {}),
|
|
1673
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { marginLeft: "0.75rem", fontWeight: 700, fontSize: "1.25rem", color: "#0c4a6e" }, children: "HolmDigital" })
|
|
1674
|
+
] }) }),
|
|
1675
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: styles.divider, "aria-hidden": "true" }),
|
|
1676
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("a", { href: "https://holmdigital.se", style: styles.websiteContainer, target: "_blank", rel: "noreferrer", children: [
|
|
1677
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { backgroundColor: "#f1f5f9", padding: "0.25rem", borderRadius: "0.375rem", display: "flex" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", style: { color: "#64748b" }, "aria-hidden": "true", children: [
|
|
1678
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
|
|
1679
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("line", { x1: "2", y1: "12", x2: "22", y2: "12" }),
|
|
1680
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1 4-10z" })
|
|
1681
|
+
] }) }),
|
|
1682
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("span", { children: [
|
|
1683
|
+
"holmdigital",
|
|
1684
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("span", { style: { color: "#0284c7" }, children: ".se" })
|
|
1685
|
+
] })
|
|
1686
|
+
] })
|
|
1687
|
+
] }),
|
|
1688
|
+
badgeUrl && /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("div", { style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("img", { src: badgeUrl, alt: "Accessibility Badge", style: { height: "1.5rem", width: "auto" } }) })
|
|
1689
|
+
] }),
|
|
1690
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "statement-content", children: [
|
|
1691
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("h1", { id: "a11y-statement-title", style: styles.mainHeading, children: renderTemplate(template.title) }),
|
|
1692
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("p", { style: styles.paragraph, children: renderTemplate(template.intro) }),
|
|
1693
|
+
renderSections(template.sections)
|
|
1694
|
+
] }),
|
|
1695
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("footer", { style: { marginTop: "3rem", borderTop: "1px solid #e2e8f0", paddingTop: "1.5rem", fontSize: "0.875rem", color: "#64748b" }, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("p", { children: [
|
|
1696
|
+
lang === "sv" ? "Genererad med hj\xE4lp av" : "Generated using",
|
|
1697
|
+
" ",
|
|
1698
|
+
/* @__PURE__ */ (0, import_jsx_runtime16.jsx)("a", { href: usedTool?.url || "https://holmdigital.se", style: styles.link, target: "_blank", rel: "noopener noreferrer", children: usedTool?.name || "HolmDigital Engine" })
|
|
1699
|
+
] }) })
|
|
1700
|
+
]
|
|
1701
|
+
}
|
|
1702
|
+
);
|
|
1703
|
+
};
|
|
1704
|
+
AccessibilityStatement.displayName = "AccessibilityStatement";
|
|
1705
|
+
|
|
1706
|
+
// src/ErrorSummary/ErrorSummary.tsx
|
|
1707
|
+
var import_react16 = require("react");
|
|
1708
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
1709
|
+
var ErrorSummary = ({
|
|
1710
|
+
errors,
|
|
1711
|
+
title = "There is a problem",
|
|
1712
|
+
focusOnMount = true,
|
|
1713
|
+
className = ""
|
|
1714
|
+
}) => {
|
|
1715
|
+
const headingRef = (0, import_react16.useRef)(null);
|
|
1716
|
+
(0, import_react16.useEffect)(() => {
|
|
1717
|
+
if (focusOnMount && errors.length > 0 && headingRef.current) {
|
|
1718
|
+
headingRef.current.focus();
|
|
1719
|
+
}
|
|
1720
|
+
}, [focusOnMount, errors]);
|
|
1721
|
+
if (errors.length === 0) {
|
|
1722
|
+
return null;
|
|
1723
|
+
}
|
|
1724
|
+
const styles = {
|
|
1725
|
+
container: {
|
|
1726
|
+
border: "2px solid #dc2626",
|
|
1727
|
+
// Red-600
|
|
1728
|
+
borderRadius: "0.375rem",
|
|
1729
|
+
padding: "1rem",
|
|
1730
|
+
marginBottom: "1.5rem",
|
|
1731
|
+
backgroundColor: "#fef2f2"
|
|
1732
|
+
// Red-50
|
|
1733
|
+
},
|
|
1734
|
+
heading: {
|
|
1735
|
+
color: "#991b1b",
|
|
1736
|
+
// Red-800
|
|
1737
|
+
fontWeight: "bold",
|
|
1738
|
+
fontSize: "1.125rem",
|
|
1739
|
+
marginBottom: "0.5rem",
|
|
1740
|
+
outline: "none"
|
|
1741
|
+
// Managed focus usually visually indicated by browser, but we can style if needed
|
|
1742
|
+
},
|
|
1743
|
+
list: {
|
|
1744
|
+
listStyleType: "disc",
|
|
1745
|
+
paddingLeft: "1.25rem",
|
|
1746
|
+
margin: 0,
|
|
1747
|
+
color: "#dc2626"
|
|
1748
|
+
// Red-600
|
|
1749
|
+
},
|
|
1750
|
+
link: {
|
|
1751
|
+
color: "#b91c1c",
|
|
1752
|
+
// Red-700
|
|
1753
|
+
textDecoration: "underline",
|
|
1754
|
+
cursor: "pointer",
|
|
1755
|
+
fontWeight: 500
|
|
1756
|
+
}
|
|
1757
|
+
};
|
|
1758
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
1759
|
+
"div",
|
|
1760
|
+
{
|
|
1761
|
+
className: `a11y-error-summary ${className}`,
|
|
1762
|
+
role: "alert",
|
|
1763
|
+
"aria-labelledby": "error-summary-title",
|
|
1764
|
+
style: styles.container,
|
|
1765
|
+
children: [
|
|
1766
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1767
|
+
"h2",
|
|
1768
|
+
{
|
|
1769
|
+
id: "error-summary-title",
|
|
1770
|
+
ref: headingRef,
|
|
1771
|
+
tabIndex: -1,
|
|
1772
|
+
style: styles.heading,
|
|
1773
|
+
children: title
|
|
1774
|
+
}
|
|
1775
|
+
),
|
|
1776
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("ul", { style: styles.list, children: errors.map((error, index) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("li", { style: { marginBottom: "0.25rem" }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
|
1777
|
+
"a",
|
|
1778
|
+
{
|
|
1779
|
+
href: `#${error.id}`,
|
|
1780
|
+
style: styles.link,
|
|
1781
|
+
onClick: (e) => {
|
|
1782
|
+
e.preventDefault();
|
|
1783
|
+
const element = document.getElementById(error.id);
|
|
1784
|
+
if (element) {
|
|
1785
|
+
element.focus();
|
|
1786
|
+
element.scrollIntoView({ behavior: "smooth", block: "center" });
|
|
1787
|
+
}
|
|
1788
|
+
},
|
|
1789
|
+
children: error.message
|
|
1790
|
+
}
|
|
1791
|
+
) }, index)) })
|
|
1792
|
+
]
|
|
1793
|
+
}
|
|
1794
|
+
);
|
|
1795
|
+
};
|
|
1796
|
+
ErrorSummary.displayName = "ErrorSummary";
|
|
1797
|
+
|
|
1798
|
+
// src/Combobox/Combobox.tsx
|
|
1799
|
+
var import_react17 = require("react");
|
|
1800
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
1801
|
+
var Combobox = ({
|
|
1802
|
+
label,
|
|
1803
|
+
description,
|
|
1804
|
+
error,
|
|
1805
|
+
options,
|
|
1806
|
+
onChange,
|
|
1807
|
+
value,
|
|
1808
|
+
placeholder = "Type to search...",
|
|
1809
|
+
className = ""
|
|
1810
|
+
}) => {
|
|
1811
|
+
const [isOpen, setIsOpen] = (0, import_react17.useState)(false);
|
|
1812
|
+
const [inputValue, setInputValue] = (0, import_react17.useState)("");
|
|
1813
|
+
const [focusedIndex, setFocusedIndex] = (0, import_react17.useState)(-1);
|
|
1814
|
+
const inputRef = (0, import_react17.useRef)(null);
|
|
1815
|
+
const listboxRef = (0, import_react17.useRef)(null);
|
|
1816
|
+
const containerRef = (0, import_react17.useRef)(null);
|
|
1817
|
+
const id = (0, import_react17.useId)();
|
|
1818
|
+
const listboxId = `${id}-listbox`;
|
|
1819
|
+
const labelId = `${id}-label`;
|
|
1820
|
+
const descriptionId = `${id}-description`;
|
|
1821
|
+
const errorId = `${id}-error`;
|
|
1822
|
+
const filteredOptions = options.filter(
|
|
1823
|
+
(option) => option.label.toLowerCase().includes(inputValue.toLowerCase())
|
|
1824
|
+
);
|
|
1825
|
+
(0, import_react17.useEffect)(() => {
|
|
1826
|
+
if (value) {
|
|
1827
|
+
const selectedOption = options.find((o) => o.value === value);
|
|
1828
|
+
if (selectedOption) {
|
|
1829
|
+
setInputValue(selectedOption.label);
|
|
1830
|
+
}
|
|
1831
|
+
} else {
|
|
1832
|
+
setInputValue("");
|
|
1833
|
+
}
|
|
1834
|
+
}, [value, options]);
|
|
1835
|
+
(0, import_react17.useEffect)(() => {
|
|
1836
|
+
const handleClickOutside = (event) => {
|
|
1837
|
+
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
1838
|
+
setIsOpen(false);
|
|
1839
|
+
setFocusedIndex(-1);
|
|
1840
|
+
if (value) {
|
|
1841
|
+
const selectedOption = options.find((o) => o.value === value);
|
|
1842
|
+
if (selectedOption) setInputValue(selectedOption.label);
|
|
1843
|
+
} else {
|
|
1844
|
+
setInputValue("");
|
|
1845
|
+
}
|
|
1846
|
+
}
|
|
1847
|
+
};
|
|
1848
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
1849
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1850
|
+
}, [value, options]);
|
|
1851
|
+
const handleInputChange = (e) => {
|
|
1852
|
+
setInputValue(e.target.value);
|
|
1853
|
+
setIsOpen(true);
|
|
1854
|
+
setFocusedIndex(-1);
|
|
1855
|
+
if (e.target.value === "") {
|
|
1856
|
+
onChange(null);
|
|
1857
|
+
}
|
|
1858
|
+
};
|
|
1859
|
+
const handleOptionSelect = (option) => {
|
|
1860
|
+
onChange(option.value);
|
|
1861
|
+
setInputValue(option.label);
|
|
1862
|
+
setIsOpen(false);
|
|
1863
|
+
setFocusedIndex(-1);
|
|
1864
|
+
};
|
|
1865
|
+
const handleKeyDown = (e) => {
|
|
1866
|
+
if (!isOpen && (e.key === "ArrowDown" || e.key === "ArrowUp")) {
|
|
1867
|
+
setIsOpen(true);
|
|
1868
|
+
return;
|
|
1869
|
+
}
|
|
1870
|
+
switch (e.key) {
|
|
1871
|
+
case "ArrowDown":
|
|
1872
|
+
e.preventDefault();
|
|
1873
|
+
setFocusedIndex(
|
|
1874
|
+
(prev) => prev < filteredOptions.length - 1 ? prev + 1 : 0
|
|
1875
|
+
);
|
|
1876
|
+
break;
|
|
1877
|
+
case "ArrowUp":
|
|
1878
|
+
e.preventDefault();
|
|
1879
|
+
setFocusedIndex(
|
|
1880
|
+
(prev) => prev > 0 ? prev - 1 : filteredOptions.length - 1
|
|
1881
|
+
);
|
|
1882
|
+
break;
|
|
1883
|
+
case "Enter":
|
|
1884
|
+
e.preventDefault();
|
|
1885
|
+
if (isOpen && focusedIndex >= 0) {
|
|
1886
|
+
handleOptionSelect(filteredOptions[focusedIndex]);
|
|
1887
|
+
}
|
|
1888
|
+
break;
|
|
1889
|
+
case "Escape":
|
|
1890
|
+
e.preventDefault();
|
|
1891
|
+
setIsOpen(false);
|
|
1892
|
+
setFocusedIndex(-1);
|
|
1893
|
+
if (value) {
|
|
1894
|
+
const selectedOption = options.find((o) => o.value === value);
|
|
1895
|
+
if (selectedOption) setInputValue(selectedOption.label);
|
|
1896
|
+
} else {
|
|
1897
|
+
setInputValue("");
|
|
1898
|
+
}
|
|
1899
|
+
break;
|
|
1900
|
+
case "Tab":
|
|
1901
|
+
setIsOpen(false);
|
|
1902
|
+
break;
|
|
1903
|
+
}
|
|
1904
|
+
};
|
|
1905
|
+
const styles = {
|
|
1906
|
+
container: {
|
|
1907
|
+
position: "relative",
|
|
1908
|
+
marginBottom: "1rem",
|
|
1909
|
+
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
1910
|
+
},
|
|
1911
|
+
label: {
|
|
1912
|
+
display: "block",
|
|
1913
|
+
fontWeight: 600,
|
|
1914
|
+
marginBottom: "0.25rem",
|
|
1915
|
+
color: "#1e293b"
|
|
1916
|
+
},
|
|
1917
|
+
description: {
|
|
1918
|
+
fontSize: "0.875rem",
|
|
1919
|
+
color: "#64748b",
|
|
1920
|
+
marginBottom: "0.5rem"
|
|
1921
|
+
},
|
|
1922
|
+
error: {
|
|
1923
|
+
fontSize: "0.875rem",
|
|
1924
|
+
color: "#dc2626",
|
|
1925
|
+
marginTop: "0.25rem"
|
|
1926
|
+
},
|
|
1927
|
+
input: {
|
|
1928
|
+
width: "100%",
|
|
1929
|
+
padding: "0.5rem 0.75rem",
|
|
1930
|
+
fontSize: "1rem",
|
|
1931
|
+
border: `1px solid ${error ? "#dc2626" : "#cbd5e1"}`,
|
|
1932
|
+
borderRadius: "0.375rem",
|
|
1933
|
+
outline: "none",
|
|
1934
|
+
boxSizing: "border-box"
|
|
1935
|
+
},
|
|
1936
|
+
listbox: {
|
|
1937
|
+
position: "absolute",
|
|
1938
|
+
top: "100%",
|
|
1939
|
+
left: 0,
|
|
1940
|
+
right: 0,
|
|
1941
|
+
maxHeight: "200px",
|
|
1942
|
+
overflowY: "auto",
|
|
1943
|
+
border: "1px solid #cbd5e1",
|
|
1944
|
+
borderRadius: "0.375rem",
|
|
1945
|
+
backgroundColor: "white",
|
|
1946
|
+
zIndex: 10,
|
|
1947
|
+
marginTop: "0.25rem",
|
|
1948
|
+
padding: 0,
|
|
1949
|
+
listStyle: "none",
|
|
1950
|
+
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
|
|
1951
|
+
},
|
|
1952
|
+
option: {
|
|
1953
|
+
padding: "0.5rem 0.75rem",
|
|
1954
|
+
cursor: "pointer"
|
|
1955
|
+
},
|
|
1956
|
+
activeOption: {
|
|
1957
|
+
backgroundColor: "#e2e8f0",
|
|
1958
|
+
color: "#0f172a"
|
|
1959
|
+
},
|
|
1960
|
+
noResults: {
|
|
1961
|
+
padding: "0.5rem 0.75rem",
|
|
1962
|
+
color: "#64748b",
|
|
1963
|
+
fontStyle: "italic"
|
|
1964
|
+
}
|
|
1965
|
+
};
|
|
1966
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { ref: containerRef, className, style: styles.container, children: [
|
|
1967
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1968
|
+
"label",
|
|
1969
|
+
{
|
|
1970
|
+
id: labelId,
|
|
1971
|
+
htmlFor: id,
|
|
1972
|
+
style: styles.label,
|
|
1973
|
+
children: label
|
|
1974
|
+
}
|
|
1975
|
+
),
|
|
1976
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { id: descriptionId, style: styles.description, children: description }),
|
|
1977
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
1978
|
+
"input",
|
|
1979
|
+
{
|
|
1980
|
+
ref: inputRef,
|
|
1981
|
+
id,
|
|
1982
|
+
type: "text",
|
|
1983
|
+
role: "combobox",
|
|
1984
|
+
"aria-autocomplete": "list",
|
|
1985
|
+
"aria-expanded": isOpen,
|
|
1986
|
+
"aria-haspopup": "listbox",
|
|
1987
|
+
"aria-controls": listboxId,
|
|
1988
|
+
"aria-activedescendant": focusedIndex >= 0 ? `${id}-option-${focusedIndex}` : void 0,
|
|
1989
|
+
"aria-invalid": !!error,
|
|
1990
|
+
"aria-describedby": [
|
|
1991
|
+
description ? descriptionId : null,
|
|
1992
|
+
error ? errorId : null
|
|
1993
|
+
].filter(Boolean).join(" ") || void 0,
|
|
1994
|
+
value: inputValue,
|
|
1995
|
+
onChange: handleInputChange,
|
|
1996
|
+
onKeyDown: handleKeyDown,
|
|
1997
|
+
placeholder,
|
|
1998
|
+
style: {
|
|
1999
|
+
...styles.input,
|
|
2000
|
+
...isOpen ? { borderColor: "#3b82f6", ring: "2px solid #93c5fd" } : {}
|
|
2001
|
+
}
|
|
2002
|
+
}
|
|
2003
|
+
),
|
|
2004
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { id: errorId, style: styles.error, role: "alert", children: error }),
|
|
2005
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2006
|
+
"ul",
|
|
2007
|
+
{
|
|
2008
|
+
ref: listboxRef,
|
|
2009
|
+
id: listboxId,
|
|
2010
|
+
role: "listbox",
|
|
2011
|
+
"aria-label": label,
|
|
2012
|
+
style: styles.listbox,
|
|
2013
|
+
children: filteredOptions.length > 0 ? filteredOptions.map((option, index) => {
|
|
2014
|
+
const isSelected = value === option.value;
|
|
2015
|
+
const isFocused = focusedIndex === index;
|
|
2016
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2017
|
+
"li",
|
|
2018
|
+
{
|
|
2019
|
+
id: `${id}-option-${index}`,
|
|
2020
|
+
role: "option",
|
|
2021
|
+
"aria-selected": isSelected,
|
|
2022
|
+
onClick: () => handleOptionSelect(option),
|
|
2023
|
+
onMouseEnter: () => setFocusedIndex(index),
|
|
2024
|
+
style: {
|
|
2025
|
+
...styles.option,
|
|
2026
|
+
...isFocused ? styles.activeOption : {},
|
|
2027
|
+
...isSelected ? { fontWeight: "bold" } : {}
|
|
2028
|
+
},
|
|
2029
|
+
children: [
|
|
2030
|
+
option.label,
|
|
2031
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { "aria-hidden": "true", style: { float: "right" }, children: "\u2713" })
|
|
2032
|
+
]
|
|
2033
|
+
},
|
|
2034
|
+
option.value
|
|
2035
|
+
);
|
|
2036
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("li", { style: styles.noResults, children: "No results found" })
|
|
2037
|
+
}
|
|
2038
|
+
)
|
|
2039
|
+
] });
|
|
2040
|
+
};
|
|
2041
|
+
|
|
2042
|
+
// src/DatePicker/DatePicker.tsx
|
|
2043
|
+
var import_react18 = require("react");
|
|
2044
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2045
|
+
var DatePicker = (0, import_react18.forwardRef)(({
|
|
2046
|
+
label,
|
|
2047
|
+
description,
|
|
2048
|
+
error,
|
|
2049
|
+
className = "",
|
|
2050
|
+
style,
|
|
2051
|
+
id: providedId,
|
|
2052
|
+
...props
|
|
2053
|
+
}, ref) => {
|
|
2054
|
+
const generatedId = (0, import_react18.useId)();
|
|
2055
|
+
const id = providedId || generatedId;
|
|
2056
|
+
const descriptionId = `${id}-description`;
|
|
2057
|
+
const errorId = `${id}-error`;
|
|
2058
|
+
const styles = {
|
|
2059
|
+
container: {
|
|
2060
|
+
marginBottom: "1rem",
|
|
2061
|
+
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
2062
|
+
},
|
|
2063
|
+
label: {
|
|
2064
|
+
display: "block",
|
|
2065
|
+
fontWeight: 600,
|
|
2066
|
+
marginBottom: "0.25rem",
|
|
2067
|
+
color: "#1e293b"
|
|
2068
|
+
},
|
|
2069
|
+
description: {
|
|
2070
|
+
fontSize: "0.875rem",
|
|
2071
|
+
color: "#64748b",
|
|
2072
|
+
marginBottom: "0.5rem"
|
|
2073
|
+
},
|
|
2074
|
+
error: {
|
|
2075
|
+
fontSize: "0.875rem",
|
|
2076
|
+
color: "#dc2626",
|
|
2077
|
+
marginTop: "0.25rem"
|
|
2078
|
+
},
|
|
2079
|
+
input: {
|
|
2080
|
+
display: "block",
|
|
2081
|
+
width: "100%",
|
|
2082
|
+
padding: "0.5rem 0.75rem",
|
|
2083
|
+
fontSize: "1rem",
|
|
2084
|
+
lineHeight: 1.5,
|
|
2085
|
+
color: "#0f172a",
|
|
2086
|
+
backgroundColor: "#ffffff",
|
|
2087
|
+
border: `1px solid ${error ? "#dc2626" : "#cbd5e1"}`,
|
|
2088
|
+
borderRadius: "0.375rem",
|
|
2089
|
+
outline: "none",
|
|
2090
|
+
boxSizing: "border-box",
|
|
2091
|
+
minHeight: "2.5rem"
|
|
2092
|
+
// Ensure touch target size
|
|
2093
|
+
}
|
|
2094
|
+
};
|
|
2095
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className, style: { ...styles.container, ...style }, children: [
|
|
2096
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2097
|
+
"label",
|
|
2098
|
+
{
|
|
2099
|
+
htmlFor: id,
|
|
2100
|
+
style: styles.label,
|
|
2101
|
+
children: label
|
|
2102
|
+
}
|
|
2103
|
+
),
|
|
2104
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { id: descriptionId, style: styles.description, children: description }),
|
|
2105
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2106
|
+
"input",
|
|
2107
|
+
{
|
|
2108
|
+
ref,
|
|
2109
|
+
id,
|
|
2110
|
+
type: "date",
|
|
2111
|
+
"aria-invalid": !!error,
|
|
2112
|
+
"aria-describedby": [
|
|
2113
|
+
description ? descriptionId : null,
|
|
2114
|
+
error ? errorId : null
|
|
2115
|
+
].filter(Boolean).join(" ") || void 0,
|
|
2116
|
+
style: styles.input,
|
|
2117
|
+
...props
|
|
2118
|
+
}
|
|
2119
|
+
),
|
|
2120
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { id: errorId, style: styles.error, role: "alert", children: error })
|
|
2121
|
+
] });
|
|
2122
|
+
});
|
|
2123
|
+
DatePicker.displayName = "DatePicker";
|
|
2124
|
+
|
|
2125
|
+
// src/MultiSelect/MultiSelect.tsx
|
|
2126
|
+
var import_react19 = require("react");
|
|
2127
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2128
|
+
var MultiSelect = ({
|
|
2129
|
+
label,
|
|
2130
|
+
description,
|
|
2131
|
+
error,
|
|
2132
|
+
options,
|
|
2133
|
+
selected,
|
|
2134
|
+
onChange,
|
|
2135
|
+
placeholder = "Select items...",
|
|
2136
|
+
className = ""
|
|
2137
|
+
}) => {
|
|
2138
|
+
const [isOpen, setIsOpen] = (0, import_react19.useState)(false);
|
|
2139
|
+
const [inputValue, setInputValue] = (0, import_react19.useState)("");
|
|
2140
|
+
const [focusedIndex, setFocusedIndex] = (0, import_react19.useState)(-1);
|
|
2141
|
+
const [activeTokenIndex] = (0, import_react19.useState)(-1);
|
|
2142
|
+
const inputRef = (0, import_react19.useRef)(null);
|
|
2143
|
+
const containerRef = (0, import_react19.useRef)(null);
|
|
2144
|
+
const id = (0, import_react19.useId)();
|
|
2145
|
+
const listboxId = `${id}-listbox`;
|
|
2146
|
+
const labelId = `${id}-label`;
|
|
2147
|
+
const descriptionId = `${id}-description`;
|
|
2148
|
+
const errorId = `${id}-error`;
|
|
2149
|
+
const availableOptions = options.filter(
|
|
2150
|
+
(option) => !selected.includes(option.value) && option.label.toLowerCase().includes(inputValue.toLowerCase())
|
|
2151
|
+
);
|
|
2152
|
+
const handleSelect = (value) => {
|
|
2153
|
+
onChange([...selected, value]);
|
|
2154
|
+
setInputValue("");
|
|
2155
|
+
setIsOpen(false);
|
|
2156
|
+
setFocusedIndex(-1);
|
|
2157
|
+
inputRef.current?.focus();
|
|
2158
|
+
};
|
|
2159
|
+
const handleRemove = (value) => {
|
|
2160
|
+
onChange(selected.filter((v) => v !== value));
|
|
2161
|
+
inputRef.current?.focus();
|
|
2162
|
+
};
|
|
2163
|
+
const handleKeyDown = (e) => {
|
|
2164
|
+
if (activeTokenIndex !== -1) {
|
|
2165
|
+
handleTokenNavigation(e);
|
|
2166
|
+
return;
|
|
2167
|
+
}
|
|
2168
|
+
switch (e.key) {
|
|
2169
|
+
case "ArrowDown":
|
|
2170
|
+
e.preventDefault();
|
|
2171
|
+
setIsOpen(true);
|
|
2172
|
+
setFocusedIndex((prev) => prev < availableOptions.length - 1 ? prev + 1 : 0);
|
|
2173
|
+
break;
|
|
2174
|
+
case "ArrowUp":
|
|
2175
|
+
e.preventDefault();
|
|
2176
|
+
setIsOpen(true);
|
|
2177
|
+
setFocusedIndex((prev) => prev > 0 ? prev - 1 : availableOptions.length - 1);
|
|
2178
|
+
break;
|
|
2179
|
+
case "Enter":
|
|
2180
|
+
e.preventDefault();
|
|
2181
|
+
if (isOpen && focusedIndex >= 0) {
|
|
2182
|
+
handleSelect(availableOptions[focusedIndex].value);
|
|
2183
|
+
}
|
|
2184
|
+
break;
|
|
2185
|
+
case "Escape":
|
|
2186
|
+
setIsOpen(false);
|
|
2187
|
+
break;
|
|
2188
|
+
case "Backspace":
|
|
2189
|
+
if (inputValue === "" && selected.length > 0) {
|
|
2190
|
+
handleRemove(selected[selected.length - 1]);
|
|
2191
|
+
}
|
|
2192
|
+
break;
|
|
2193
|
+
case "ArrowLeft":
|
|
2194
|
+
if (inputValue === "" && selected.length > 0) {
|
|
2195
|
+
}
|
|
2196
|
+
break;
|
|
2197
|
+
}
|
|
2198
|
+
};
|
|
2199
|
+
const handleTokenNavigation = (_e) => {
|
|
2200
|
+
};
|
|
2201
|
+
const styles = {
|
|
2202
|
+
container: {
|
|
2203
|
+
position: "relative",
|
|
2204
|
+
marginBottom: "1rem",
|
|
2205
|
+
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
2206
|
+
},
|
|
2207
|
+
label: {
|
|
2208
|
+
display: "block",
|
|
2209
|
+
fontWeight: 600,
|
|
2210
|
+
marginBottom: "0.25rem",
|
|
2211
|
+
color: "#1e293b"
|
|
2212
|
+
},
|
|
2213
|
+
description: {
|
|
2214
|
+
fontSize: "0.875rem",
|
|
2215
|
+
color: "#64748b",
|
|
2216
|
+
marginBottom: "0.5rem"
|
|
2217
|
+
},
|
|
2218
|
+
error: {
|
|
2219
|
+
fontSize: "0.875rem",
|
|
2220
|
+
color: "#dc2626",
|
|
2221
|
+
marginTop: "0.25rem"
|
|
2222
|
+
},
|
|
2223
|
+
inputWrapper: {
|
|
2224
|
+
display: "flex",
|
|
2225
|
+
flexWrap: "wrap",
|
|
2226
|
+
gap: "0.5rem",
|
|
2227
|
+
padding: "0.375rem",
|
|
2228
|
+
border: `1px solid ${error ? "#dc2626" : "#cbd5e1"}`,
|
|
2229
|
+
borderRadius: "0.375rem",
|
|
2230
|
+
backgroundColor: "white",
|
|
2231
|
+
minHeight: "2.5rem"
|
|
2232
|
+
},
|
|
2233
|
+
input: {
|
|
2234
|
+
flex: 1,
|
|
2235
|
+
minWidth: "120px",
|
|
2236
|
+
border: "none",
|
|
2237
|
+
outline: "none",
|
|
2238
|
+
padding: "0.25rem",
|
|
2239
|
+
fontSize: "1rem"
|
|
2240
|
+
},
|
|
2241
|
+
token: {
|
|
2242
|
+
display: "inline-flex",
|
|
2243
|
+
alignItems: "center",
|
|
2244
|
+
backgroundColor: "#e2e8f0",
|
|
2245
|
+
border: "1px solid #cbd5e1",
|
|
2246
|
+
borderRadius: "0.25rem",
|
|
2247
|
+
padding: "0.125rem 0.5rem",
|
|
2248
|
+
fontSize: "0.875rem",
|
|
2249
|
+
color: "#0f172a"
|
|
2250
|
+
},
|
|
2251
|
+
removeButton: {
|
|
2252
|
+
marginLeft: "0.25rem",
|
|
2253
|
+
border: "none",
|
|
2254
|
+
background: "none",
|
|
2255
|
+
cursor: "pointer",
|
|
2256
|
+
padding: "0 0.125rem",
|
|
2257
|
+
fontSize: "1rem",
|
|
2258
|
+
lineHeight: 1,
|
|
2259
|
+
color: "#64748b"
|
|
2260
|
+
},
|
|
2261
|
+
listbox: {
|
|
2262
|
+
position: "absolute",
|
|
2263
|
+
top: "100%",
|
|
2264
|
+
left: 0,
|
|
2265
|
+
right: 0,
|
|
2266
|
+
maxHeight: "200px",
|
|
2267
|
+
overflowY: "auto",
|
|
2268
|
+
border: "1px solid #cbd5e1",
|
|
2269
|
+
borderRadius: "0.375rem",
|
|
2270
|
+
backgroundColor: "white",
|
|
2271
|
+
zIndex: 10,
|
|
2272
|
+
marginTop: "0.25rem",
|
|
2273
|
+
padding: 0,
|
|
2274
|
+
listStyle: "none",
|
|
2275
|
+
boxShadow: "0 4px 6px -1px rgb(0 0 0 / 0.1)"
|
|
2276
|
+
},
|
|
2277
|
+
option: {
|
|
2278
|
+
padding: "0.5rem 0.75rem",
|
|
2279
|
+
cursor: "pointer"
|
|
2280
|
+
},
|
|
2281
|
+
activeOption: {
|
|
2282
|
+
backgroundColor: "#e2e8f0",
|
|
2283
|
+
color: "#0f172a"
|
|
2284
|
+
}
|
|
2285
|
+
};
|
|
2286
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { ref: containerRef, className, style: styles.container, children: [
|
|
2287
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("label", { id: labelId, htmlFor: id, style: styles.label, children: label }),
|
|
2288
|
+
description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { id: descriptionId, style: styles.description, children: description }),
|
|
2289
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { style: styles.inputWrapper, children: [
|
|
2290
|
+
selected.map((value) => {
|
|
2291
|
+
const option = options.find((o) => o.value === value);
|
|
2292
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("span", { style: styles.token, children: [
|
|
2293
|
+
option?.label || value,
|
|
2294
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2295
|
+
"button",
|
|
2296
|
+
{
|
|
2297
|
+
type: "button",
|
|
2298
|
+
style: styles.removeButton,
|
|
2299
|
+
onClick: () => handleRemove(value),
|
|
2300
|
+
"aria-label": `Remove ${option?.label || value}`,
|
|
2301
|
+
children: "\xD7"
|
|
2302
|
+
}
|
|
2303
|
+
)
|
|
2304
|
+
] }, value);
|
|
2305
|
+
}),
|
|
2306
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2307
|
+
"input",
|
|
2308
|
+
{
|
|
2309
|
+
ref: inputRef,
|
|
2310
|
+
id,
|
|
2311
|
+
type: "text",
|
|
2312
|
+
role: "combobox",
|
|
2313
|
+
"aria-autocomplete": "list",
|
|
2314
|
+
"aria-expanded": isOpen,
|
|
2315
|
+
"aria-haspopup": "listbox",
|
|
2316
|
+
"aria-controls": listboxId,
|
|
2317
|
+
"aria-activedescendant": focusedIndex >= 0 ? `${id}-option-${focusedIndex}` : void 0,
|
|
2318
|
+
"aria-invalid": !!error,
|
|
2319
|
+
value: inputValue,
|
|
2320
|
+
onChange: (e) => {
|
|
2321
|
+
setInputValue(e.target.value);
|
|
2322
|
+
setIsOpen(true);
|
|
2323
|
+
setFocusedIndex(-1);
|
|
2324
|
+
},
|
|
2325
|
+
onKeyDown: handleKeyDown,
|
|
2326
|
+
onFocus: () => setIsOpen(true),
|
|
2327
|
+
placeholder: selected.length === 0 ? placeholder : "",
|
|
2328
|
+
style: styles.input
|
|
2329
|
+
}
|
|
2330
|
+
)
|
|
2331
|
+
] }),
|
|
2332
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { id: errorId, style: styles.error, role: "alert", children: error }),
|
|
2333
|
+
isOpen && availableOptions.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2334
|
+
"ul",
|
|
2335
|
+
{
|
|
2336
|
+
id: listboxId,
|
|
2337
|
+
role: "listbox",
|
|
2338
|
+
"aria-label": label,
|
|
2339
|
+
style: styles.listbox,
|
|
2340
|
+
children: availableOptions.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2341
|
+
"li",
|
|
2342
|
+
{
|
|
2343
|
+
id: `${id}-option-${index}`,
|
|
2344
|
+
role: "option",
|
|
2345
|
+
"aria-selected": false,
|
|
2346
|
+
onClick: () => handleSelect(option.value),
|
|
2347
|
+
onMouseEnter: () => setFocusedIndex(index),
|
|
2348
|
+
style: {
|
|
2349
|
+
...styles.option,
|
|
2350
|
+
...focusedIndex === index ? styles.activeOption : {}
|
|
2351
|
+
},
|
|
2352
|
+
children: option.label
|
|
2353
|
+
},
|
|
2354
|
+
option.value
|
|
2355
|
+
))
|
|
2356
|
+
}
|
|
2357
|
+
)
|
|
2358
|
+
] });
|
|
2359
|
+
};
|
|
2360
|
+
|
|
2361
|
+
// src/DataTable/DataTable.tsx
|
|
2362
|
+
var import_react20 = require("react");
|
|
2363
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
2364
|
+
function DataTable({
|
|
2365
|
+
data,
|
|
2366
|
+
columns,
|
|
2367
|
+
caption,
|
|
2368
|
+
className = ""
|
|
2369
|
+
}) {
|
|
2370
|
+
const [sortConfig, setSortConfig] = (0, import_react20.useState)({ key: null, direction: "ascending" });
|
|
2371
|
+
const handleSort = (key) => {
|
|
2372
|
+
let direction = "ascending";
|
|
2373
|
+
if (sortConfig.key === key && sortConfig.direction === "ascending") {
|
|
2374
|
+
direction = "descending";
|
|
2375
|
+
}
|
|
2376
|
+
setSortConfig({ key, direction });
|
|
2377
|
+
};
|
|
2378
|
+
const sortedData = (0, import_react20.useMemo)(() => {
|
|
2379
|
+
if (!sortConfig.key) return data;
|
|
2380
|
+
return [...data].sort((a, b) => {
|
|
2381
|
+
const aValue = a[sortConfig.key];
|
|
2382
|
+
const bValue = b[sortConfig.key];
|
|
2383
|
+
if (aValue < bValue) {
|
|
2384
|
+
return sortConfig.direction === "ascending" ? -1 : 1;
|
|
2385
|
+
}
|
|
2386
|
+
if (aValue > bValue) {
|
|
2387
|
+
return sortConfig.direction === "ascending" ? 1 : -1;
|
|
2388
|
+
}
|
|
2389
|
+
return 0;
|
|
2390
|
+
});
|
|
2391
|
+
}, [data, sortConfig]);
|
|
2392
|
+
const styles = {
|
|
2393
|
+
table: {
|
|
2394
|
+
width: "100%",
|
|
2395
|
+
borderCollapse: "collapse",
|
|
2396
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2397
|
+
marginBottom: "1rem"
|
|
2398
|
+
},
|
|
2399
|
+
caption: {
|
|
2400
|
+
textAlign: "left",
|
|
2401
|
+
fontWeight: "bold",
|
|
2402
|
+
fontSize: "1.25rem",
|
|
2403
|
+
marginBottom: "0.75rem",
|
|
2404
|
+
color: "#1e293b"
|
|
2405
|
+
},
|
|
2406
|
+
th: {
|
|
2407
|
+
textAlign: "left",
|
|
2408
|
+
borderBottom: "2px solid #e2e8f0",
|
|
2409
|
+
padding: "0.75rem",
|
|
2410
|
+
fontWeight: 600,
|
|
2411
|
+
color: "#475569",
|
|
2412
|
+
backgroundColor: "#f8fafc"
|
|
2413
|
+
},
|
|
2414
|
+
td: {
|
|
2415
|
+
padding: "0.75rem",
|
|
2416
|
+
borderBottom: "1px solid #e2e8f0",
|
|
2417
|
+
color: "#334155"
|
|
2418
|
+
},
|
|
2419
|
+
sortButton: {
|
|
2420
|
+
background: "none",
|
|
2421
|
+
border: "none",
|
|
2422
|
+
font: "inherit",
|
|
2423
|
+
fontWeight: 600,
|
|
2424
|
+
cursor: "pointer",
|
|
2425
|
+
padding: 0,
|
|
2426
|
+
display: "inline-flex",
|
|
2427
|
+
alignItems: "center",
|
|
2428
|
+
gap: "0.5rem",
|
|
2429
|
+
color: "inherit"
|
|
2430
|
+
}
|
|
2431
|
+
};
|
|
2432
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className, style: { overflowX: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("table", { style: styles.table, children: [
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("caption", { style: styles.caption, children: caption }),
|
|
2434
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: columns.map((column, index) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
2435
|
+
"th",
|
|
2436
|
+
{
|
|
2437
|
+
scope: "col",
|
|
2438
|
+
"aria-sort": sortConfig.key === column.accessor ? sortConfig.direction : void 0,
|
|
2439
|
+
style: styles.th,
|
|
2440
|
+
children: column.sortable ? /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(
|
|
2441
|
+
"button",
|
|
2442
|
+
{
|
|
2443
|
+
type: "button",
|
|
2444
|
+
onClick: () => handleSort(column.accessor),
|
|
2445
|
+
style: styles.sortButton,
|
|
2446
|
+
children: [
|
|
2447
|
+
column.header,
|
|
2448
|
+
sortConfig.key === column.accessor ? /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": "true", children: sortConfig.direction === "ascending" ? "\u25B2" : "\u25BC" }) : /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("span", { "aria-hidden": "true", style: { opacity: 0.3 }, children: "\u2195" })
|
|
2449
|
+
]
|
|
2450
|
+
}
|
|
2451
|
+
) : column.header
|
|
2452
|
+
},
|
|
2453
|
+
index
|
|
2454
|
+
)) }) }),
|
|
2455
|
+
/* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tbody", { children: sortedData.map((row, rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("tr", { children: columns.map((column, colIndex) => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("td", { style: styles.td, children: column.render ? column.render(row) : String(row[column.accessor]) }, colIndex)) }, rowIndex)) })
|
|
2456
|
+
] }) });
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
// src/Pagination/Pagination.tsx
|
|
2460
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
2461
|
+
var Pagination = ({
|
|
2462
|
+
currentPage,
|
|
2463
|
+
totalPages,
|
|
2464
|
+
onPageChange,
|
|
2465
|
+
ariaLabel = "Pagination",
|
|
2466
|
+
className = ""
|
|
2467
|
+
}) => {
|
|
2468
|
+
if (totalPages <= 1) return null;
|
|
2469
|
+
const getPageNumbers = () => {
|
|
2470
|
+
const pages2 = [];
|
|
2471
|
+
pages2.push(1);
|
|
2472
|
+
const start = Math.max(2, currentPage - 1);
|
|
2473
|
+
const end = Math.min(totalPages - 1, currentPage + 1);
|
|
2474
|
+
if (start > 2) pages2.push("...");
|
|
2475
|
+
for (let i = start; i <= end; i++) {
|
|
2476
|
+
pages2.push(i);
|
|
2477
|
+
}
|
|
2478
|
+
if (end < totalPages - 1) pages2.push("...");
|
|
2479
|
+
if (totalPages > 1) {
|
|
2480
|
+
pages2.push(totalPages);
|
|
2481
|
+
}
|
|
2482
|
+
return Array.from(new Set(pages2));
|
|
2483
|
+
};
|
|
2484
|
+
const pages = getPageNumbers();
|
|
2485
|
+
const styles = {
|
|
2486
|
+
nav: {
|
|
2487
|
+
display: "flex",
|
|
2488
|
+
justifyContent: "center",
|
|
2489
|
+
marginTop: "1.5rem",
|
|
2490
|
+
marginBottom: "1.5rem",
|
|
2491
|
+
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
2492
|
+
},
|
|
2493
|
+
list: {
|
|
2494
|
+
display: "flex",
|
|
2495
|
+
listStyle: "none",
|
|
2496
|
+
padding: 0,
|
|
2497
|
+
margin: 0,
|
|
2498
|
+
gap: "0.5rem",
|
|
2499
|
+
alignItems: "center"
|
|
2500
|
+
},
|
|
2501
|
+
button: {
|
|
2502
|
+
minWidth: "2.5rem",
|
|
2503
|
+
height: "2.5rem",
|
|
2504
|
+
display: "flex",
|
|
2505
|
+
alignItems: "center",
|
|
2506
|
+
justifyContent: "center",
|
|
2507
|
+
border: "1px solid #cbd5e1",
|
|
2508
|
+
backgroundColor: "white",
|
|
2509
|
+
borderRadius: "0.375rem",
|
|
2510
|
+
cursor: "pointer",
|
|
2511
|
+
fontSize: "1rem",
|
|
2512
|
+
color: "#1e293b",
|
|
2513
|
+
padding: "0 0.75rem",
|
|
2514
|
+
transition: "all 0.2s"
|
|
2515
|
+
},
|
|
2516
|
+
activeButton: {
|
|
2517
|
+
backgroundColor: "#2563eb",
|
|
2518
|
+
// Blue-600
|
|
2519
|
+
color: "white",
|
|
2520
|
+
borderColor: "#2563eb",
|
|
2521
|
+
fontWeight: "bold"
|
|
2522
|
+
},
|
|
2523
|
+
disabledButton: {
|
|
2524
|
+
opacity: 0.5,
|
|
2525
|
+
cursor: "not-allowed",
|
|
2526
|
+
backgroundColor: "#f1f5f9"
|
|
2527
|
+
},
|
|
2528
|
+
ellipsis: {
|
|
2529
|
+
color: "#64748b",
|
|
2530
|
+
padding: "0 0.5rem"
|
|
2531
|
+
}
|
|
2532
|
+
};
|
|
2533
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("nav", { "aria-label": ariaLabel, className, style: styles.nav, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("ul", { style: styles.list, children: [
|
|
2534
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2535
|
+
"button",
|
|
2536
|
+
{
|
|
2537
|
+
type: "button",
|
|
2538
|
+
onClick: () => onPageChange(currentPage - 1),
|
|
2539
|
+
disabled: currentPage === 1,
|
|
2540
|
+
"aria-disabled": currentPage === 1,
|
|
2541
|
+
"aria-label": "Previous page",
|
|
2542
|
+
style: {
|
|
2543
|
+
...styles.button,
|
|
2544
|
+
...currentPage === 1 ? styles.disabledButton : {}
|
|
2545
|
+
},
|
|
2546
|
+
children: "\u2190"
|
|
2547
|
+
}
|
|
2548
|
+
) }),
|
|
2549
|
+
pages.map((page, index) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { children: page === "..." ? /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("span", { style: styles.ellipsis, children: "\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2550
|
+
"button",
|
|
2551
|
+
{
|
|
2552
|
+
type: "button",
|
|
2553
|
+
onClick: () => onPageChange(page),
|
|
2554
|
+
"aria-current": currentPage === page ? "page" : void 0,
|
|
2555
|
+
"aria-label": `Page ${page}`,
|
|
2556
|
+
style: {
|
|
2557
|
+
...styles.button,
|
|
2558
|
+
...currentPage === page ? styles.activeButton : {}
|
|
2559
|
+
},
|
|
2560
|
+
children: page
|
|
2561
|
+
}
|
|
2562
|
+
) }, `${page}-${index}`)),
|
|
2563
|
+
/* @__PURE__ */ (0, import_jsx_runtime22.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
2564
|
+
"button",
|
|
2565
|
+
{
|
|
2566
|
+
type: "button",
|
|
2567
|
+
onClick: () => onPageChange(currentPage + 1),
|
|
2568
|
+
disabled: currentPage === totalPages,
|
|
2569
|
+
"aria-disabled": currentPage === totalPages,
|
|
2570
|
+
"aria-label": "Next page",
|
|
2571
|
+
style: {
|
|
2572
|
+
...styles.button,
|
|
2573
|
+
...currentPage === totalPages ? styles.disabledButton : {}
|
|
2574
|
+
},
|
|
2575
|
+
children: "\u2192"
|
|
2576
|
+
}
|
|
2577
|
+
) })
|
|
2578
|
+
] }) });
|
|
2579
|
+
};
|
|
2580
|
+
|
|
2581
|
+
// src/Card/Card.tsx
|
|
2582
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
2583
|
+
var Card = ({
|
|
2584
|
+
title,
|
|
2585
|
+
href,
|
|
2586
|
+
children,
|
|
2587
|
+
className = "",
|
|
2588
|
+
as: Component = "div"
|
|
2589
|
+
}) => {
|
|
2590
|
+
const styles = {
|
|
2591
|
+
card: {
|
|
2592
|
+
position: "relative",
|
|
2593
|
+
border: "1px solid #cbd5e1",
|
|
2594
|
+
borderRadius: "0.5rem",
|
|
2595
|
+
padding: "1.5rem",
|
|
2596
|
+
backgroundColor: "white",
|
|
2597
|
+
boxShadow: "0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1)",
|
|
2598
|
+
transition: "box-shadow 0.2s, transform 0.2s",
|
|
2599
|
+
fontFamily: "system-ui, -apple-system, sans-serif"
|
|
2600
|
+
},
|
|
2601
|
+
title: {
|
|
2602
|
+
marginTop: 0,
|
|
2603
|
+
marginBottom: "0.75rem",
|
|
2604
|
+
fontSize: "1.25rem",
|
|
2605
|
+
fontWeight: 600,
|
|
2606
|
+
color: "#1e293b"
|
|
2607
|
+
},
|
|
2608
|
+
link: {
|
|
2609
|
+
textDecoration: "none",
|
|
2610
|
+
color: "inherit"
|
|
2611
|
+
},
|
|
2612
|
+
stretchedLink: {
|
|
2613
|
+
position: "absolute",
|
|
2614
|
+
top: 0,
|
|
2615
|
+
right: 0,
|
|
2616
|
+
bottom: 0,
|
|
2617
|
+
left: 0,
|
|
2618
|
+
zIndex: 1,
|
|
2619
|
+
content: "''"
|
|
2620
|
+
},
|
|
2621
|
+
content: {
|
|
2622
|
+
color: "#475569",
|
|
2623
|
+
lineHeight: 1.5
|
|
2624
|
+
}
|
|
2625
|
+
};
|
|
2626
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Component, { className, style: styles.card, children: [
|
|
2627
|
+
title && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("h3", { style: styles.title, children: href ? /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("a", { href, style: styles.link, children: [
|
|
2628
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { style: styles.stretchedLink, "aria-hidden": "true" }),
|
|
2629
|
+
title
|
|
2630
|
+
] }) : title }),
|
|
2631
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { style: styles.content, children })
|
|
2632
|
+
] });
|
|
2633
|
+
};
|
|
2634
|
+
|
|
2635
|
+
// src/TreeView/TreeView.tsx
|
|
2636
|
+
var import_react21 = require("react");
|
|
2637
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
2638
|
+
var TreeView = ({
|
|
2639
|
+
data,
|
|
2640
|
+
ariaLabel = "Tree View",
|
|
2641
|
+
className = "",
|
|
2642
|
+
onSelect
|
|
2643
|
+
}) => {
|
|
2644
|
+
const [expandedIds, setExpandedIds] = (0, import_react21.useState)(/* @__PURE__ */ new Set());
|
|
2645
|
+
const [selectedId, setSelectedId] = (0, import_react21.useState)(null);
|
|
2646
|
+
const [focusedId, setFocusedId] = (0, import_react21.useState)(data.length > 0 ? data[0].id : null);
|
|
2647
|
+
const nodeRefs = (0, import_react21.useRef)(/* @__PURE__ */ new Map());
|
|
2648
|
+
const toggleExpand = (nodeId) => {
|
|
2649
|
+
const newExpanded = new Set(expandedIds);
|
|
2650
|
+
if (newExpanded.has(nodeId)) {
|
|
2651
|
+
newExpanded.delete(nodeId);
|
|
2652
|
+
} else {
|
|
2653
|
+
newExpanded.add(nodeId);
|
|
2654
|
+
}
|
|
2655
|
+
setExpandedIds(newExpanded);
|
|
2656
|
+
};
|
|
2657
|
+
const getVisibleNodes = (nodes) => {
|
|
2658
|
+
let visible = [];
|
|
2659
|
+
for (const node of nodes) {
|
|
2660
|
+
visible.push(node);
|
|
2661
|
+
if (node.children && expandedIds.has(node.id)) {
|
|
2662
|
+
visible = visible.concat(getVisibleNodes(node.children));
|
|
2663
|
+
}
|
|
2664
|
+
}
|
|
2665
|
+
return visible;
|
|
2666
|
+
};
|
|
2667
|
+
const handleKeyDown = (e, node) => {
|
|
2668
|
+
const visibleNodes = getVisibleNodes(data);
|
|
2669
|
+
const currentIndex = visibleNodes.findIndex((n) => n.id === node.id);
|
|
2670
|
+
switch (e.key) {
|
|
2671
|
+
case "ArrowDown": {
|
|
2672
|
+
e.preventDefault();
|
|
2673
|
+
if (currentIndex < visibleNodes.length - 1) {
|
|
2674
|
+
const nextNode = visibleNodes[currentIndex + 1];
|
|
2675
|
+
setFocusedId(nextNode.id);
|
|
2676
|
+
}
|
|
2677
|
+
break;
|
|
2678
|
+
}
|
|
2679
|
+
case "ArrowUp": {
|
|
2680
|
+
e.preventDefault();
|
|
2681
|
+
if (currentIndex > 0) {
|
|
2682
|
+
const prevNode = visibleNodes[currentIndex - 1];
|
|
2683
|
+
setFocusedId(prevNode.id);
|
|
2684
|
+
}
|
|
2685
|
+
break;
|
|
2686
|
+
}
|
|
2687
|
+
case "ArrowRight": {
|
|
2688
|
+
e.preventDefault();
|
|
2689
|
+
if (node.children && !expandedIds.has(node.id)) {
|
|
2690
|
+
toggleExpand(node.id);
|
|
2691
|
+
} else if (node.children && expandedIds.has(node.id)) {
|
|
2692
|
+
if (currentIndex < visibleNodes.length - 1) {
|
|
2693
|
+
setFocusedId(visibleNodes[currentIndex + 1].id);
|
|
2694
|
+
}
|
|
2695
|
+
}
|
|
2696
|
+
break;
|
|
2697
|
+
}
|
|
2698
|
+
case "ArrowLeft": {
|
|
2699
|
+
e.preventDefault();
|
|
2700
|
+
if (node.children && expandedIds.has(node.id)) {
|
|
2701
|
+
toggleExpand(node.id);
|
|
2702
|
+
} else {
|
|
2703
|
+
const parent = findParent(data, node.id);
|
|
2704
|
+
if (parent) {
|
|
2705
|
+
setFocusedId(parent.id);
|
|
2706
|
+
}
|
|
2707
|
+
}
|
|
2708
|
+
break;
|
|
2709
|
+
}
|
|
2710
|
+
case "Home": {
|
|
2711
|
+
e.preventDefault();
|
|
2712
|
+
if (visibleNodes.length > 0) {
|
|
2713
|
+
setFocusedId(visibleNodes[0].id);
|
|
2714
|
+
}
|
|
2715
|
+
break;
|
|
2716
|
+
}
|
|
2717
|
+
case "End": {
|
|
2718
|
+
e.preventDefault();
|
|
2719
|
+
if (visibleNodes.length > 0) {
|
|
2720
|
+
setFocusedId(visibleNodes[visibleNodes.length - 1].id);
|
|
2721
|
+
}
|
|
2722
|
+
break;
|
|
2723
|
+
}
|
|
2724
|
+
case "Enter":
|
|
2725
|
+
case " ": {
|
|
2726
|
+
e.preventDefault();
|
|
2727
|
+
if (onSelect) onSelect(node);
|
|
2728
|
+
setSelectedId(node.id);
|
|
2729
|
+
if (node.children) {
|
|
2730
|
+
toggleExpand(node.id);
|
|
2731
|
+
}
|
|
2732
|
+
break;
|
|
2733
|
+
}
|
|
2734
|
+
}
|
|
2735
|
+
};
|
|
2736
|
+
const findParent = (nodes, childId, parent = null) => {
|
|
2737
|
+
for (const node of nodes) {
|
|
2738
|
+
if (node.id === childId) return parent;
|
|
2739
|
+
if (node.children) {
|
|
2740
|
+
const found = findParent(node.children, childId, node);
|
|
2741
|
+
if (found) return found;
|
|
2742
|
+
}
|
|
2743
|
+
}
|
|
2744
|
+
return null;
|
|
2745
|
+
};
|
|
2746
|
+
(0, import_react21.useEffect)(() => {
|
|
2747
|
+
if (focusedId) {
|
|
2748
|
+
const el = nodeRefs.current.get(focusedId);
|
|
2749
|
+
if (el) el.focus();
|
|
2750
|
+
}
|
|
2751
|
+
}, [focusedId]);
|
|
2752
|
+
const renderTree = (nodes, level = 1) => {
|
|
2753
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { role: "group", style: { paddingLeft: level > 1 ? "1.5rem" : 0, listStyle: "none", margin: 0 }, children: nodes.map((node) => {
|
|
2754
|
+
const isExpanded = expandedIds.has(node.id);
|
|
2755
|
+
const hasChildren = node.children && node.children.length > 0;
|
|
2756
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { role: "none", children: [
|
|
2757
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2758
|
+
"div",
|
|
2759
|
+
{
|
|
2760
|
+
ref: (el) => {
|
|
2761
|
+
if (el) nodeRefs.current.set(node.id, el);
|
|
2762
|
+
else nodeRefs.current.delete(node.id);
|
|
2763
|
+
},
|
|
2764
|
+
role: "treeitem",
|
|
2765
|
+
"aria-expanded": hasChildren ? isExpanded : void 0,
|
|
2766
|
+
"aria-selected": selectedId === node.id,
|
|
2767
|
+
"aria-level": level,
|
|
2768
|
+
tabIndex: focusedId === node.id ? 0 : -1,
|
|
2769
|
+
onClick: () => {
|
|
2770
|
+
setFocusedId(node.id);
|
|
2771
|
+
setSelectedId(node.id);
|
|
2772
|
+
if (hasChildren) toggleExpand(node.id);
|
|
2773
|
+
if (onSelect) onSelect(node);
|
|
2774
|
+
},
|
|
2775
|
+
onKeyDown: (e) => handleKeyDown(e, node),
|
|
2776
|
+
style: {
|
|
2777
|
+
cursor: "pointer",
|
|
2778
|
+
padding: "0.25rem 0.5rem",
|
|
2779
|
+
borderRadius: "0.25rem",
|
|
2780
|
+
outline: "none",
|
|
2781
|
+
backgroundColor: selectedId === node.id ? "#e0f2fe" : "transparent",
|
|
2782
|
+
// Sky-100
|
|
2783
|
+
color: selectedId === node.id ? "#0369a1" : "inherit",
|
|
2784
|
+
// Sky-700
|
|
2785
|
+
border: focusedId === node.id ? "1px solid #0ea5e9" : "1px solid transparent",
|
|
2786
|
+
// Sky-500
|
|
2787
|
+
display: "flex",
|
|
2788
|
+
alignItems: "center",
|
|
2789
|
+
gap: "0.5rem"
|
|
2790
|
+
},
|
|
2791
|
+
children: [
|
|
2792
|
+
hasChildren && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "0.75rem", color: "#94a3b8" }, children: isExpanded ? "\u25BC" : "\u25B6" }),
|
|
2793
|
+
!hasChildren && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { width: "0.75rem" } }),
|
|
2794
|
+
node.label
|
|
2795
|
+
]
|
|
2796
|
+
}
|
|
2797
|
+
),
|
|
2798
|
+
hasChildren && isExpanded && renderTree(node.children, level + 1)
|
|
2799
|
+
] }, node.id);
|
|
2800
|
+
}) });
|
|
2801
|
+
};
|
|
2802
|
+
const styles = {
|
|
2803
|
+
container: {
|
|
2804
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
2805
|
+
border: "1px solid #cbd5e1",
|
|
2806
|
+
borderRadius: "0.375rem",
|
|
2807
|
+
padding: "1rem",
|
|
2808
|
+
backgroundColor: "white"
|
|
2809
|
+
}
|
|
2810
|
+
};
|
|
2811
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className, style: styles.container, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("ul", { role: "tree", "aria-label": ariaLabel, style: { listStyle: "none", padding: 0, margin: 0 }, children: data.map((node) => {
|
|
2812
|
+
const isExpanded = expandedIds.has(node.id);
|
|
2813
|
+
const hasChildren = node.children && node.children.length > 0;
|
|
2814
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("li", { role: "none", children: [
|
|
2815
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
2816
|
+
"div",
|
|
2817
|
+
{
|
|
2818
|
+
ref: (el) => {
|
|
2819
|
+
if (el) nodeRefs.current.set(node.id, el);
|
|
2820
|
+
else nodeRefs.current.delete(node.id);
|
|
2821
|
+
},
|
|
2822
|
+
role: "treeitem",
|
|
2823
|
+
"aria-expanded": hasChildren ? isExpanded : void 0,
|
|
2824
|
+
"aria-selected": selectedId === node.id,
|
|
2825
|
+
"aria-level": 1,
|
|
2826
|
+
tabIndex: focusedId === node.id ? 0 : -1,
|
|
2827
|
+
onClick: () => {
|
|
2828
|
+
setFocusedId(node.id);
|
|
2829
|
+
setSelectedId(node.id);
|
|
2830
|
+
if (hasChildren) toggleExpand(node.id);
|
|
2831
|
+
if (onSelect) onSelect(node);
|
|
2832
|
+
},
|
|
2833
|
+
onKeyDown: (e) => handleKeyDown(e, node),
|
|
2834
|
+
style: {
|
|
2835
|
+
cursor: "pointer",
|
|
2836
|
+
padding: "0.25rem 0.5rem",
|
|
2837
|
+
borderRadius: "0.25rem",
|
|
2838
|
+
outline: "none",
|
|
2839
|
+
backgroundColor: selectedId === node.id ? "#e0f2fe" : "transparent",
|
|
2840
|
+
color: selectedId === node.id ? "#0369a1" : "inherit",
|
|
2841
|
+
border: focusedId === node.id ? "1px solid #0ea5e9" : "1px solid transparent",
|
|
2842
|
+
display: "flex",
|
|
2843
|
+
alignItems: "center",
|
|
2844
|
+
gap: "0.5rem"
|
|
2845
|
+
},
|
|
2846
|
+
children: [
|
|
2847
|
+
hasChildren && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { fontSize: "0.75rem", color: "#94a3b8" }, children: isExpanded ? "\u25BC" : "\u25B6" }),
|
|
2848
|
+
!hasChildren && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { style: { width: "0.75rem" } }),
|
|
2849
|
+
node.label
|
|
2850
|
+
]
|
|
2851
|
+
}
|
|
2852
|
+
),
|
|
2853
|
+
hasChildren && isExpanded && renderTree(node.children, 2)
|
|
2854
|
+
] }, node.id);
|
|
2855
|
+
}) }) });
|
|
2856
|
+
};
|
|
2857
|
+
|
|
2858
|
+
// src/LiveRegion/LiveRegion.tsx
|
|
2859
|
+
var import_react22 = require("react");
|
|
2860
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
2861
|
+
var LiveRegion = ({
|
|
2862
|
+
message,
|
|
2863
|
+
ariaLive = "polite",
|
|
2864
|
+
clearAfter
|
|
2865
|
+
}) => {
|
|
2866
|
+
const [announcement, setAnnouncement] = (0, import_react22.useState)("");
|
|
2867
|
+
const timeoutRef = (0, import_react22.useRef)();
|
|
2868
|
+
(0, import_react22.useEffect)(() => {
|
|
2869
|
+
if (message) {
|
|
2870
|
+
if (timeoutRef.current) clearTimeout(timeoutRef.current);
|
|
2871
|
+
setAnnouncement(message);
|
|
2872
|
+
if (clearAfter) {
|
|
2873
|
+
timeoutRef.current = setTimeout(() => {
|
|
2874
|
+
setAnnouncement("");
|
|
2875
|
+
}, clearAfter);
|
|
2876
|
+
}
|
|
2877
|
+
}
|
|
2878
|
+
}, [message, clearAfter]);
|
|
2879
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
2880
|
+
"div",
|
|
2881
|
+
{
|
|
2882
|
+
"aria-live": ariaLive,
|
|
2883
|
+
"aria-atomic": "true",
|
|
2884
|
+
style: {
|
|
2885
|
+
position: "absolute",
|
|
2886
|
+
width: 1,
|
|
2887
|
+
height: 1,
|
|
2888
|
+
padding: 0,
|
|
2889
|
+
margin: -1,
|
|
2890
|
+
overflow: "hidden",
|
|
2891
|
+
clip: "rect(0, 0, 0, 0)",
|
|
2892
|
+
whiteSpace: "nowrap",
|
|
2893
|
+
border: 0
|
|
2894
|
+
},
|
|
2895
|
+
children: announcement
|
|
2896
|
+
}
|
|
2897
|
+
);
|
|
2898
|
+
};
|
|
2899
|
+
|
|
2900
|
+
// src/ProgressBar/ProgressBar.tsx
|
|
2901
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
2902
|
+
var ProgressBar = ({
|
|
2903
|
+
value,
|
|
2904
|
+
min = 0,
|
|
2905
|
+
max = 100,
|
|
2906
|
+
label,
|
|
2907
|
+
showValueLabel = false,
|
|
2908
|
+
valueText,
|
|
2909
|
+
variant = "primary",
|
|
2910
|
+
className = ""
|
|
2911
|
+
}) => {
|
|
2912
|
+
const clampedValue = Math.min(Math.max(value, min), max);
|
|
2913
|
+
const percentage = Math.round((clampedValue - min) / (max - min) * 100);
|
|
2914
|
+
const getVariantColor = () => {
|
|
2915
|
+
switch (variant) {
|
|
2916
|
+
case "success":
|
|
2917
|
+
return "#10B981";
|
|
2918
|
+
// Green
|
|
2919
|
+
case "warning":
|
|
2920
|
+
return "#F59E0B";
|
|
2921
|
+
// Amber
|
|
2922
|
+
case "danger":
|
|
2923
|
+
return "#EF4444";
|
|
2924
|
+
// Red
|
|
2925
|
+
default:
|
|
2926
|
+
return "#2563EB";
|
|
2927
|
+
}
|
|
2928
|
+
};
|
|
2929
|
+
const styles = {
|
|
2930
|
+
container: {
|
|
2931
|
+
width: "100%",
|
|
2932
|
+
backgroundColor: "#E5E7EB",
|
|
2933
|
+
// Gray-200
|
|
2934
|
+
borderRadius: "9999px",
|
|
2935
|
+
height: "1rem",
|
|
2936
|
+
overflow: "hidden",
|
|
2937
|
+
position: "relative"
|
|
2938
|
+
},
|
|
2939
|
+
bar: {
|
|
2940
|
+
height: "100%",
|
|
2941
|
+
backgroundColor: getVariantColor(),
|
|
2942
|
+
width: `${percentage}%`,
|
|
2943
|
+
transition: "width 0.3s ease-in-out",
|
|
2944
|
+
borderRadius: "9999px"
|
|
2945
|
+
},
|
|
2946
|
+
labelFn: {
|
|
2947
|
+
fontSize: "0.875rem",
|
|
2948
|
+
color: "#374151",
|
|
2949
|
+
marginBottom: "0.25rem",
|
|
2950
|
+
display: "flex",
|
|
2951
|
+
justifyContent: "space-between"
|
|
2952
|
+
}
|
|
2953
|
+
};
|
|
2954
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: `hd-progress-root ${className}`, children: [
|
|
2955
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { style: styles.labelFn, id: `progress-label-${label.replace(/\s+/g, "-")}`, children: [
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "hd-progress-label-text", children: label }),
|
|
2957
|
+
showValueLabel && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { children: [
|
|
2958
|
+
percentage,
|
|
2959
|
+
"%"
|
|
2960
|
+
] })
|
|
2961
|
+
] }),
|
|
2962
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
2963
|
+
"div",
|
|
2964
|
+
{
|
|
2965
|
+
role: "progressbar",
|
|
2966
|
+
"aria-valuenow": clampedValue,
|
|
2967
|
+
"aria-valuemin": min,
|
|
2968
|
+
"aria-valuemax": max,
|
|
2969
|
+
"aria-label": label,
|
|
2970
|
+
"aria-valuetext": valueText,
|
|
2971
|
+
style: styles.container,
|
|
2972
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { style: styles.bar })
|
|
2973
|
+
}
|
|
2974
|
+
)
|
|
2975
|
+
] });
|
|
2976
|
+
};
|
|
2977
|
+
|
|
2978
|
+
// src/Skeleton/Skeleton.tsx
|
|
2979
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
2980
|
+
var Skeleton = ({
|
|
2981
|
+
variant = "text",
|
|
2982
|
+
width,
|
|
2983
|
+
height,
|
|
2984
|
+
animation = "pulse",
|
|
2985
|
+
className = ""
|
|
2986
|
+
}) => {
|
|
2987
|
+
const baseStyle = {
|
|
2988
|
+
backgroundColor: "#E5E7EB",
|
|
2989
|
+
// Gray-200
|
|
2990
|
+
borderRadius: variant === "circular" ? "50%" : "4px",
|
|
2991
|
+
display: "inline-block",
|
|
2992
|
+
width: width ?? (variant === "text" ? "100%" : void 0),
|
|
2993
|
+
height: height ?? (variant === "text" ? "1em" : void 0)
|
|
2994
|
+
};
|
|
2995
|
+
const getAnimationClass = () => {
|
|
2996
|
+
switch (animation) {
|
|
2997
|
+
case "pulse":
|
|
2998
|
+
return "hd-skeleton-pulse";
|
|
2999
|
+
case "wave":
|
|
3000
|
+
return "hd-skeleton-wave";
|
|
3001
|
+
default:
|
|
3002
|
+
return "";
|
|
3003
|
+
}
|
|
3004
|
+
};
|
|
3005
|
+
const styles = `
|
|
3006
|
+
@keyframes hd-pulse {
|
|
3007
|
+
0%, 100% { opacity: 1; }
|
|
3008
|
+
50% { opacity: .5; }
|
|
3009
|
+
}
|
|
3010
|
+
@keyframes hd-wave {
|
|
3011
|
+
0% { transform: translateX(-100%); }
|
|
3012
|
+
100% { transform: translateX(100%); }
|
|
3013
|
+
}
|
|
3014
|
+
.hd-skeleton-pulse {
|
|
3015
|
+
animation: hd-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
|
|
3016
|
+
}
|
|
3017
|
+
.hd-skeleton-wave {
|
|
3018
|
+
position: relative;
|
|
3019
|
+
overflow: hidden;
|
|
3020
|
+
}
|
|
3021
|
+
.hd-skeleton-wave::after {
|
|
3022
|
+
content: "";
|
|
3023
|
+
position: absolute;
|
|
3024
|
+
top: 0;
|
|
3025
|
+
left: 0;
|
|
3026
|
+
right: 0;
|
|
3027
|
+
bottom: 0;
|
|
3028
|
+
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.5), transparent);
|
|
3029
|
+
animation: hd-wave 1.6s linear infinite;
|
|
3030
|
+
}
|
|
3031
|
+
`;
|
|
3032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
3033
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("style", { children: styles }),
|
|
3034
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
3035
|
+
"span",
|
|
3036
|
+
{
|
|
3037
|
+
className: `hd-skeleton ${getAnimationClass()} ${className}`,
|
|
3038
|
+
style: baseStyle,
|
|
3039
|
+
"aria-hidden": "true"
|
|
3040
|
+
}
|
|
3041
|
+
)
|
|
3042
|
+
] });
|
|
3043
|
+
};
|
|
3044
|
+
|
|
3045
|
+
// src/HelpText/HelpText.tsx
|
|
3046
|
+
var import_lucide_react4 = require("lucide-react");
|
|
3047
|
+
var import_jsx_runtime28 = require("react/jsx-runtime");
|
|
3048
|
+
var HelpText = ({
|
|
3049
|
+
id,
|
|
3050
|
+
children,
|
|
3051
|
+
variant = "default",
|
|
3052
|
+
showIcon = false,
|
|
3053
|
+
className = ""
|
|
3054
|
+
}) => {
|
|
3055
|
+
const getColor = () => {
|
|
3056
|
+
switch (variant) {
|
|
3057
|
+
case "error":
|
|
3058
|
+
return "#EF4444";
|
|
3059
|
+
// Red-500
|
|
3060
|
+
case "valid":
|
|
3061
|
+
return "#10B981";
|
|
3062
|
+
// Green-500
|
|
3063
|
+
default:
|
|
3064
|
+
return "#6B7280";
|
|
3065
|
+
}
|
|
3066
|
+
};
|
|
3067
|
+
const style = {
|
|
3068
|
+
fontSize: "0.875rem",
|
|
3069
|
+
marginTop: "0.25rem",
|
|
3070
|
+
color: getColor(),
|
|
3071
|
+
display: "flex",
|
|
3072
|
+
alignItems: "center",
|
|
3073
|
+
gap: "0.25rem"
|
|
3074
|
+
};
|
|
3075
|
+
const Icon = () => {
|
|
3076
|
+
if (!showIcon) return null;
|
|
3077
|
+
if (variant === "error") return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react4.AlertCircle, { size: 14 });
|
|
3078
|
+
if (variant === "default") return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_lucide_react4.Info, { size: 14 });
|
|
3079
|
+
return null;
|
|
3080
|
+
};
|
|
3081
|
+
return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
|
|
3082
|
+
"div",
|
|
3083
|
+
{
|
|
3084
|
+
id,
|
|
3085
|
+
className: `hd-help-text ${className}`,
|
|
3086
|
+
style,
|
|
3087
|
+
children: [
|
|
3088
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Icon, {}),
|
|
3089
|
+
/* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { children })
|
|
3090
|
+
]
|
|
3091
|
+
}
|
|
3092
|
+
);
|
|
3093
|
+
};
|
|
1236
3094
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1237
3095
|
0 && (module.exports = {
|
|
3096
|
+
AccessibilityStatement,
|
|
1238
3097
|
Accordion,
|
|
1239
3098
|
AccordionContent,
|
|
1240
3099
|
AccordionItem,
|
|
@@ -1242,17 +3101,28 @@ Heading.displayName = "Heading";
|
|
|
1242
3101
|
BreadcrumbItem,
|
|
1243
3102
|
Breadcrumbs,
|
|
1244
3103
|
Button,
|
|
3104
|
+
Card,
|
|
1245
3105
|
Checkbox,
|
|
3106
|
+
Combobox,
|
|
3107
|
+
DataTable,
|
|
3108
|
+
DatePicker,
|
|
1246
3109
|
Dialog,
|
|
3110
|
+
ErrorSummary,
|
|
1247
3111
|
FormField,
|
|
1248
3112
|
Heading,
|
|
3113
|
+
HelpText,
|
|
3114
|
+
LiveRegion,
|
|
1249
3115
|
Modal,
|
|
3116
|
+
MultiSelect,
|
|
1250
3117
|
NavigationMenu,
|
|
3118
|
+
Pagination,
|
|
3119
|
+
ProgressBar,
|
|
1251
3120
|
RadioGroup,
|
|
1252
3121
|
Select,
|
|
1253
3122
|
SelectContent,
|
|
1254
3123
|
SelectItem,
|
|
1255
3124
|
SelectTrigger,
|
|
3125
|
+
Skeleton,
|
|
1256
3126
|
SkipLink,
|
|
1257
3127
|
Switch,
|
|
1258
3128
|
TabTrigger,
|
|
@@ -1264,5 +3134,6 @@ Heading.displayName = "Heading";
|
|
|
1264
3134
|
TooltipContent,
|
|
1265
3135
|
TooltipProvider,
|
|
1266
3136
|
TooltipTrigger,
|
|
3137
|
+
TreeView,
|
|
1267
3138
|
useToast
|
|
1268
3139
|
});
|