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