@arbeidstilsynet/design-react 0.0.17 → 0.1.1
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/dist/components/filepicker/filepicker.d.ts +2 -0
- package/dist/components/filepicker/filepicker.stories.d.ts +11 -0
- package/dist/components/filepicker/filepickerContext.d.ts +3 -0
- package/dist/components/filepicker/filepickerDropzone.d.ts +15 -0
- package/dist/components/filepicker/filepickerErrors.d.ts +5 -0
- package/dist/components/filepicker/filepickerFiles.d.ts +5 -0
- package/dist/components/filepicker/index.d.ts +34 -0
- package/dist/components/filepicker/types.d.ts +27 -0
- package/dist/components/filepicker/utils.d.ts +3 -0
- package/dist/components/index.d.ts +1 -1
- package/dist/digdir.d.ts +2 -0
- package/dist/index.cjs +459 -62
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js +468 -50
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +17 -0
- package/package.json +10 -6
- package/dist/components/temp-example/example.stories.d.ts +0 -6
- package/dist/components/temp-example/index.d.ts +0 -9
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
2
|
+
import require$$0, { createContext, use, Fragment } from "react";
|
|
3
|
+
import { CloudUpIcon, FileIcon, XMarkIcon } from "@navikt/aksel-icons";
|
|
4
|
+
import { useDropzone } from "react-dropzone";
|
|
5
|
+
import { Button, Spinner, Label, Alert, ValidationMessage } from "@digdir/designsystemet-react";
|
|
6
|
+
import { Alert as Alert2, Avatar, Badge, BadgePosition, Breadcrumbs, BreadcrumbsItem, BreadcrumbsLink, BreadcrumbsList, Button as Button2, Card, CardBlock, Checkbox, Chip, ChipButton, ChipCheckbox, ChipRadio, ChipRemovable, Combobox, ComboboxEmpty, ComboboxOption, Details, DetailsContent, DetailsSummary, Dialog, DialogBlock, DialogTrigger, DialogTriggerContext, Divider, Dropdown, DropdownButton, DropdownHeading, DropdownItem, DropdownList, DropdownTrigger, DropdownTriggerContext, EXPERIMENTAL_Suggestion, EXPERIMENTAL_SuggestionClear, EXPERIMENTAL_SuggestionEmpty, EXPERIMENTAL_SuggestionInput, EXPERIMENTAL_SuggestionList, EXPERIMENTAL_SuggestionOption, ErrorSummary, ErrorSummaryHeading, ErrorSummaryItem, ErrorSummaryLink, ErrorSummaryList, Field, FieldAffix, FieldAffixes, FieldCounter, FieldDescription, Fieldset, FieldsetDescription, FieldsetLegend, Heading, Input, Label as Label2, Link, List, ListItem, ListOrdered, ListUnordered, Pagination, PaginationButton, PaginationItem, PaginationList, Paragraph, Popover, PopoverTrigger, PopoverTriggerContext, Radio, RovingFocusItem, RovingFocusRoot, Search, SearchButton, SearchClear, SearchInput, Select, SelectOptgroup, SelectOption, Skeleton, SkipLink, Spinner as Spinner2, Switch, Table, TableBody, TableCell, TableFoot, TableHead, TableHeaderCell, TableRow, Tabs, TabsList, TabsPanel, TabsTab, Tag, Textarea, Textfield, ToggleGroup, ToggleGroupItem, Tooltip, ValidationMessage as ValidationMessage2, getNextFocusableValue, getPrevFocusableValue, omit, useCheckboxGroup, useDebounceCallback, useIsomorphicLayoutEffect, useMediaQuery, usePagination, useRadioGroup, useRovingFocus, useSynchronizedAnimation } from "@digdir/designsystemet-react";
|
|
5
7
|
var jsxRuntime = { exports: {} };
|
|
6
8
|
var reactJsxRuntime_production = {};
|
|
7
9
|
/**
|
|
@@ -382,58 +384,477 @@ function requireCompilerRuntime() {
|
|
|
382
384
|
return compilerRuntime.exports;
|
|
383
385
|
}
|
|
384
386
|
var compilerRuntimeExports = requireCompilerRuntime();
|
|
385
|
-
function
|
|
386
|
-
|
|
387
|
+
function clsx() {
|
|
388
|
+
for (var t, r = 0, e = "", n = arguments.length; r < n; r++) (t = arguments[r]) && "string" == typeof t && (e += (e && " ") + t);
|
|
389
|
+
return e;
|
|
390
|
+
}
|
|
391
|
+
const FilePickerContext = createContext({
|
|
392
|
+
files: [],
|
|
393
|
+
errors: null,
|
|
394
|
+
onAdd: () => {
|
|
395
|
+
throw new TypeError("FilePickerContext is missing");
|
|
396
|
+
},
|
|
397
|
+
onRemove: () => {
|
|
398
|
+
throw new TypeError("FilePickerContext is missing");
|
|
399
|
+
}
|
|
400
|
+
});
|
|
401
|
+
function FilePicker$1(t0) {
|
|
402
|
+
const $ = compilerRuntimeExports.c(28);
|
|
403
|
+
let children;
|
|
404
|
+
let className;
|
|
405
|
+
let errors;
|
|
406
|
+
let files;
|
|
407
|
+
let onAdd;
|
|
408
|
+
let onRemove;
|
|
409
|
+
let ref;
|
|
410
|
+
let rest;
|
|
411
|
+
let t1;
|
|
412
|
+
let t2;
|
|
413
|
+
if ($[0] !== t0) {
|
|
414
|
+
({
|
|
415
|
+
ref,
|
|
416
|
+
className,
|
|
417
|
+
children,
|
|
418
|
+
disabled: t1,
|
|
419
|
+
isWaiting: t2,
|
|
420
|
+
files,
|
|
421
|
+
errors,
|
|
422
|
+
onAdd,
|
|
423
|
+
onRemove,
|
|
424
|
+
...rest
|
|
425
|
+
} = t0);
|
|
426
|
+
$[0] = t0;
|
|
427
|
+
$[1] = children;
|
|
428
|
+
$[2] = className;
|
|
429
|
+
$[3] = errors;
|
|
430
|
+
$[4] = files;
|
|
431
|
+
$[5] = onAdd;
|
|
432
|
+
$[6] = onRemove;
|
|
433
|
+
$[7] = ref;
|
|
434
|
+
$[8] = rest;
|
|
435
|
+
$[9] = t1;
|
|
436
|
+
$[10] = t2;
|
|
437
|
+
} else {
|
|
438
|
+
children = $[1];
|
|
439
|
+
className = $[2];
|
|
440
|
+
errors = $[3];
|
|
441
|
+
files = $[4];
|
|
442
|
+
onAdd = $[5];
|
|
443
|
+
onRemove = $[6];
|
|
444
|
+
ref = $[7];
|
|
445
|
+
rest = $[8];
|
|
446
|
+
t1 = $[9];
|
|
447
|
+
t2 = $[10];
|
|
448
|
+
}
|
|
449
|
+
const disabled = t1 === void 0 ? false : t1;
|
|
450
|
+
const isWaiting = t2 === void 0 ? false : t2;
|
|
451
|
+
let t3;
|
|
452
|
+
if ($[11] !== className) {
|
|
453
|
+
t3 = clsx("at-filepicker", className);
|
|
454
|
+
$[11] = className;
|
|
455
|
+
$[12] = t3;
|
|
456
|
+
} else {
|
|
457
|
+
t3 = $[12];
|
|
458
|
+
}
|
|
459
|
+
let t4;
|
|
460
|
+
if ($[13] !== disabled || $[14] !== errors || $[15] !== files || $[16] !== isWaiting || $[17] !== onAdd || $[18] !== onRemove) {
|
|
461
|
+
t4 = {
|
|
462
|
+
files,
|
|
463
|
+
errors,
|
|
464
|
+
disabled,
|
|
465
|
+
isWaiting,
|
|
466
|
+
onAdd,
|
|
467
|
+
onRemove
|
|
468
|
+
};
|
|
469
|
+
$[13] = disabled;
|
|
470
|
+
$[14] = errors;
|
|
471
|
+
$[15] = files;
|
|
472
|
+
$[16] = isWaiting;
|
|
473
|
+
$[17] = onAdd;
|
|
474
|
+
$[18] = onRemove;
|
|
475
|
+
$[19] = t4;
|
|
476
|
+
} else {
|
|
477
|
+
t4 = $[19];
|
|
478
|
+
}
|
|
479
|
+
let t5;
|
|
480
|
+
if ($[20] !== children || $[21] !== t4) {
|
|
481
|
+
t5 = /* @__PURE__ */ jsxRuntimeExports.jsx(FilePickerContext, { value: t4, children });
|
|
482
|
+
$[20] = children;
|
|
483
|
+
$[21] = t4;
|
|
484
|
+
$[22] = t5;
|
|
485
|
+
} else {
|
|
486
|
+
t5 = $[22];
|
|
487
|
+
}
|
|
488
|
+
let t6;
|
|
489
|
+
if ($[23] !== ref || $[24] !== rest || $[25] !== t3 || $[26] !== t5) {
|
|
490
|
+
t6 = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, className: t3, ...rest, children: t5 });
|
|
491
|
+
$[23] = ref;
|
|
492
|
+
$[24] = rest;
|
|
493
|
+
$[25] = t3;
|
|
494
|
+
$[26] = t5;
|
|
495
|
+
$[27] = t6;
|
|
496
|
+
} else {
|
|
497
|
+
t6 = $[27];
|
|
498
|
+
}
|
|
499
|
+
return t6;
|
|
500
|
+
}
|
|
501
|
+
function DefaultLabel(t0) {
|
|
502
|
+
const $ = compilerRuntimeExports.c(10);
|
|
387
503
|
const {
|
|
388
|
-
|
|
389
|
-
heading: t1,
|
|
390
|
-
buttonVariant: t2
|
|
504
|
+
defaultLabelText
|
|
391
505
|
} = t0;
|
|
392
|
-
const
|
|
393
|
-
const
|
|
506
|
+
const text1 = defaultLabelText == null ? void 0 : defaultLabelText[0];
|
|
507
|
+
const text2 = defaultLabelText == null ? void 0 : defaultLabelText[1];
|
|
508
|
+
let t1;
|
|
509
|
+
let t2;
|
|
510
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
511
|
+
t1 = {
|
|
512
|
+
display: "flex",
|
|
513
|
+
flexFlow: "row"
|
|
514
|
+
};
|
|
515
|
+
t2 = /* @__PURE__ */ jsxRuntimeExports.jsx(CloudUpIcon, {});
|
|
516
|
+
$[0] = t1;
|
|
517
|
+
$[1] = t2;
|
|
518
|
+
} else {
|
|
519
|
+
t1 = $[0];
|
|
520
|
+
t2 = $[1];
|
|
521
|
+
}
|
|
394
522
|
let t3;
|
|
395
|
-
if ($[
|
|
396
|
-
t3 =
|
|
397
|
-
|
|
398
|
-
|
|
523
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
524
|
+
t3 = {
|
|
525
|
+
textDecoration: "underline"
|
|
526
|
+
};
|
|
527
|
+
$[2] = t3;
|
|
399
528
|
} else {
|
|
400
|
-
t3 = $[
|
|
529
|
+
t3 = $[2];
|
|
401
530
|
}
|
|
402
531
|
let t4;
|
|
403
|
-
if ($[
|
|
404
|
-
t4 = /* @__PURE__ */ jsxRuntimeExports.
|
|
405
|
-
|
|
532
|
+
if ($[3] !== text1) {
|
|
533
|
+
t4 = /* @__PURE__ */ jsxRuntimeExports.jsxs("span", { style: t1, children: [
|
|
534
|
+
t2,
|
|
535
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Label, { style: t3, children: text1 })
|
|
536
|
+
] });
|
|
537
|
+
$[3] = text1;
|
|
538
|
+
$[4] = t4;
|
|
406
539
|
} else {
|
|
407
|
-
t4 = $[
|
|
540
|
+
t4 = $[4];
|
|
408
541
|
}
|
|
409
542
|
let t5;
|
|
410
|
-
if ($[
|
|
411
|
-
t5 = /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
] }) });
|
|
415
|
-
$[3] = buttonVariant;
|
|
416
|
-
$[4] = onClick;
|
|
417
|
-
$[5] = t5;
|
|
543
|
+
if ($[5] !== text2) {
|
|
544
|
+
t5 = text2 && /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { children: text2 });
|
|
545
|
+
$[5] = text2;
|
|
546
|
+
$[6] = t5;
|
|
418
547
|
} else {
|
|
419
|
-
t5 = $[
|
|
548
|
+
t5 = $[6];
|
|
420
549
|
}
|
|
421
550
|
let t6;
|
|
422
|
-
if ($[
|
|
423
|
-
t6 = /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
424
|
-
|
|
551
|
+
if ($[7] !== t4 || $[8] !== t5) {
|
|
552
|
+
t6 = /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
553
|
+
t4,
|
|
425
554
|
t5
|
|
426
555
|
] });
|
|
427
|
-
$[
|
|
428
|
-
$[
|
|
429
|
-
$[
|
|
556
|
+
$[7] = t4;
|
|
557
|
+
$[8] = t5;
|
|
558
|
+
$[9] = t6;
|
|
430
559
|
} else {
|
|
431
|
-
t6 = $[
|
|
560
|
+
t6 = $[9];
|
|
432
561
|
}
|
|
433
562
|
return t6;
|
|
434
563
|
}
|
|
564
|
+
function FilePickerDropzone(t0) {
|
|
565
|
+
const $ = compilerRuntimeExports.c(36);
|
|
566
|
+
let className;
|
|
567
|
+
let label;
|
|
568
|
+
let rest;
|
|
569
|
+
let t1;
|
|
570
|
+
let t2;
|
|
571
|
+
if ($[0] !== t0) {
|
|
572
|
+
({
|
|
573
|
+
className,
|
|
574
|
+
label,
|
|
575
|
+
defaultLabelText: t1,
|
|
576
|
+
dropLabel: t2,
|
|
577
|
+
...rest
|
|
578
|
+
} = t0);
|
|
579
|
+
$[0] = t0;
|
|
580
|
+
$[1] = className;
|
|
581
|
+
$[2] = label;
|
|
582
|
+
$[3] = rest;
|
|
583
|
+
$[4] = t1;
|
|
584
|
+
$[5] = t2;
|
|
585
|
+
} else {
|
|
586
|
+
className = $[1];
|
|
587
|
+
label = $[2];
|
|
588
|
+
rest = $[3];
|
|
589
|
+
t1 = $[4];
|
|
590
|
+
t2 = $[5];
|
|
591
|
+
}
|
|
592
|
+
let t3;
|
|
593
|
+
if ($[6] !== t1) {
|
|
594
|
+
t3 = t1 === void 0 ? ["Last opp fil", "Filformater: pdf, txt og docx"] : t1;
|
|
595
|
+
$[6] = t1;
|
|
596
|
+
$[7] = t3;
|
|
597
|
+
} else {
|
|
598
|
+
t3 = $[7];
|
|
599
|
+
}
|
|
600
|
+
const defaultLabelText = t3;
|
|
601
|
+
const dropLabel = t2 === void 0 ? "Slipp for å legge til" : t2;
|
|
602
|
+
const {
|
|
603
|
+
onAdd,
|
|
604
|
+
disabled,
|
|
605
|
+
isWaiting
|
|
606
|
+
} = use(FilePickerContext);
|
|
607
|
+
let t4;
|
|
608
|
+
if ($[8] !== onAdd) {
|
|
609
|
+
t4 = (acceptedFiles) => {
|
|
610
|
+
onAdd(acceptedFiles);
|
|
611
|
+
};
|
|
612
|
+
$[8] = onAdd;
|
|
613
|
+
$[9] = t4;
|
|
614
|
+
} else {
|
|
615
|
+
t4 = $[9];
|
|
616
|
+
}
|
|
617
|
+
const onDrop = t4;
|
|
618
|
+
let t5;
|
|
619
|
+
if ($[10] !== onDrop) {
|
|
620
|
+
t5 = {
|
|
621
|
+
onDrop
|
|
622
|
+
};
|
|
623
|
+
$[10] = onDrop;
|
|
624
|
+
$[11] = t5;
|
|
625
|
+
} else {
|
|
626
|
+
t5 = $[11];
|
|
627
|
+
}
|
|
628
|
+
const {
|
|
629
|
+
getRootProps,
|
|
630
|
+
getInputProps,
|
|
631
|
+
isDragActive
|
|
632
|
+
} = useDropzone(t5);
|
|
633
|
+
let t6;
|
|
634
|
+
if ($[12] !== className) {
|
|
635
|
+
t6 = clsx("at-filepicker-dropzone", className);
|
|
636
|
+
$[12] = className;
|
|
637
|
+
$[13] = t6;
|
|
638
|
+
} else {
|
|
639
|
+
t6 = $[13];
|
|
640
|
+
}
|
|
641
|
+
const t7 = disabled || isWaiting;
|
|
642
|
+
let t8;
|
|
643
|
+
if ($[14] !== getRootProps || $[15] !== rest) {
|
|
644
|
+
t8 = getRootProps({
|
|
645
|
+
role: "button",
|
|
646
|
+
...rest
|
|
647
|
+
});
|
|
648
|
+
$[14] = getRootProps;
|
|
649
|
+
$[15] = rest;
|
|
650
|
+
$[16] = t8;
|
|
651
|
+
} else {
|
|
652
|
+
t8 = $[16];
|
|
653
|
+
}
|
|
654
|
+
let t9;
|
|
655
|
+
if ($[17] !== getInputProps) {
|
|
656
|
+
t9 = getInputProps();
|
|
657
|
+
$[17] = getInputProps;
|
|
658
|
+
$[18] = t9;
|
|
659
|
+
} else {
|
|
660
|
+
t9 = $[18];
|
|
661
|
+
}
|
|
662
|
+
let t10;
|
|
663
|
+
if ($[19] !== t9) {
|
|
664
|
+
t10 = /* @__PURE__ */ jsxRuntimeExports.jsx("input", { ...t9 });
|
|
665
|
+
$[19] = t9;
|
|
666
|
+
$[20] = t10;
|
|
667
|
+
} else {
|
|
668
|
+
t10 = $[20];
|
|
669
|
+
}
|
|
670
|
+
let t11;
|
|
671
|
+
if ($[21] !== isWaiting) {
|
|
672
|
+
t11 = isWaiting && /* @__PURE__ */ jsxRuntimeExports.jsx(Spinner, { "aria-label": "Processing files", "data-size": "lg" });
|
|
673
|
+
$[21] = isWaiting;
|
|
674
|
+
$[22] = t11;
|
|
675
|
+
} else {
|
|
676
|
+
t11 = $[22];
|
|
677
|
+
}
|
|
678
|
+
let t12;
|
|
679
|
+
if ($[23] !== defaultLabelText || $[24] !== dropLabel || $[25] !== isDragActive || $[26] !== isWaiting || $[27] !== label) {
|
|
680
|
+
t12 = !isWaiting && (isDragActive ? /* @__PURE__ */ jsxRuntimeExports.jsx(Label, { children: dropLabel }) : label ?? /* @__PURE__ */ jsxRuntimeExports.jsx(DefaultLabel, { defaultLabelText }));
|
|
681
|
+
$[23] = defaultLabelText;
|
|
682
|
+
$[24] = dropLabel;
|
|
683
|
+
$[25] = isDragActive;
|
|
684
|
+
$[26] = isWaiting;
|
|
685
|
+
$[27] = label;
|
|
686
|
+
$[28] = t12;
|
|
687
|
+
} else {
|
|
688
|
+
t12 = $[28];
|
|
689
|
+
}
|
|
690
|
+
let t13;
|
|
691
|
+
if ($[29] !== t10 || $[30] !== t11 || $[31] !== t12 || $[32] !== t6 || $[33] !== t7 || $[34] !== t8) {
|
|
692
|
+
t13 = /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { className: t6, disabled: t7, ...t8, children: [
|
|
693
|
+
t10,
|
|
694
|
+
t11,
|
|
695
|
+
t12
|
|
696
|
+
] });
|
|
697
|
+
$[29] = t10;
|
|
698
|
+
$[30] = t11;
|
|
699
|
+
$[31] = t12;
|
|
700
|
+
$[32] = t6;
|
|
701
|
+
$[33] = t7;
|
|
702
|
+
$[34] = t8;
|
|
703
|
+
$[35] = t13;
|
|
704
|
+
} else {
|
|
705
|
+
t13 = $[35];
|
|
706
|
+
}
|
|
707
|
+
return t13;
|
|
708
|
+
}
|
|
709
|
+
function FilePickerErrors(t0) {
|
|
710
|
+
const $ = compilerRuntimeExports.c(11);
|
|
711
|
+
let className;
|
|
712
|
+
let rest;
|
|
713
|
+
if ($[0] !== t0) {
|
|
714
|
+
({
|
|
715
|
+
className,
|
|
716
|
+
...rest
|
|
717
|
+
} = t0);
|
|
718
|
+
$[0] = t0;
|
|
719
|
+
$[1] = className;
|
|
720
|
+
$[2] = rest;
|
|
721
|
+
} else {
|
|
722
|
+
className = $[1];
|
|
723
|
+
rest = $[2];
|
|
724
|
+
}
|
|
725
|
+
const {
|
|
726
|
+
errors
|
|
727
|
+
} = use(FilePickerContext);
|
|
728
|
+
if (!(errors == null ? void 0 : errors.length)) {
|
|
729
|
+
return null;
|
|
730
|
+
}
|
|
731
|
+
let t1;
|
|
732
|
+
if ($[3] !== className) {
|
|
733
|
+
t1 = clsx("at-filepicker-errors", className);
|
|
734
|
+
$[3] = className;
|
|
735
|
+
$[4] = t1;
|
|
736
|
+
} else {
|
|
737
|
+
t1 = $[4];
|
|
738
|
+
}
|
|
739
|
+
let t2;
|
|
740
|
+
if ($[5] !== errors) {
|
|
741
|
+
t2 = errors.map(_temp);
|
|
742
|
+
$[5] = errors;
|
|
743
|
+
$[6] = t2;
|
|
744
|
+
} else {
|
|
745
|
+
t2 = $[6];
|
|
746
|
+
}
|
|
747
|
+
let t3;
|
|
748
|
+
if ($[7] !== rest || $[8] !== t1 || $[9] !== t2) {
|
|
749
|
+
t3 = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: t1, ...rest, children: t2 });
|
|
750
|
+
$[7] = rest;
|
|
751
|
+
$[8] = t1;
|
|
752
|
+
$[9] = t2;
|
|
753
|
+
$[10] = t3;
|
|
754
|
+
} else {
|
|
755
|
+
t3 = $[10];
|
|
756
|
+
}
|
|
757
|
+
return t3;
|
|
758
|
+
}
|
|
759
|
+
function _temp(error, index) {
|
|
760
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Alert, { role: "alert", "data-color": "danger", "data-size": "sm", children: error }, index);
|
|
761
|
+
}
|
|
762
|
+
function formatFileSize(bytes) {
|
|
763
|
+
if (bytes === 0) return "0 Bytes";
|
|
764
|
+
const k = 1024;
|
|
765
|
+
const sizes = ["Bytes", "KB", "MB", "GB"];
|
|
766
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
767
|
+
return parseFloat((bytes / Math.pow(k, i)).toFixed(1)) + " " + sizes[i];
|
|
768
|
+
}
|
|
769
|
+
function FilePickerFiles(t0) {
|
|
770
|
+
const $ = compilerRuntimeExports.c(16);
|
|
771
|
+
let className;
|
|
772
|
+
let rest;
|
|
773
|
+
if ($[0] !== t0) {
|
|
774
|
+
({
|
|
775
|
+
className,
|
|
776
|
+
...rest
|
|
777
|
+
} = t0);
|
|
778
|
+
$[0] = t0;
|
|
779
|
+
$[1] = className;
|
|
780
|
+
$[2] = rest;
|
|
781
|
+
} else {
|
|
782
|
+
className = $[1];
|
|
783
|
+
rest = $[2];
|
|
784
|
+
}
|
|
785
|
+
const {
|
|
786
|
+
files,
|
|
787
|
+
onRemove,
|
|
788
|
+
disabled
|
|
789
|
+
} = use(FilePickerContext);
|
|
790
|
+
if (!(files == null ? void 0 : files.length)) {
|
|
791
|
+
return null;
|
|
792
|
+
}
|
|
793
|
+
let t1;
|
|
794
|
+
if ($[3] !== className) {
|
|
795
|
+
t1 = clsx("at-filepicker-files", className);
|
|
796
|
+
$[3] = className;
|
|
797
|
+
$[4] = t1;
|
|
798
|
+
} else {
|
|
799
|
+
t1 = $[4];
|
|
800
|
+
}
|
|
801
|
+
let t2;
|
|
802
|
+
if ($[5] !== disabled || $[6] !== files || $[7] !== onRemove) {
|
|
803
|
+
let t32;
|
|
804
|
+
if ($[9] !== disabled || $[10] !== onRemove) {
|
|
805
|
+
t32 = (t4) => {
|
|
806
|
+
const {
|
|
807
|
+
id,
|
|
808
|
+
file,
|
|
809
|
+
error
|
|
810
|
+
} = t4;
|
|
811
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Fragment, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "at-filepicker-file", children: [
|
|
812
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(FileIcon, { "aria-hidden": "true", fontSize: "1.5em" }),
|
|
813
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "at-filepicker-file__content", children: [
|
|
814
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "at-filepicker-file__name", title: file.name, children: file.name }),
|
|
815
|
+
error && /* @__PURE__ */ jsxRuntimeExports.jsx(ValidationMessage, { className: "at-filepicker-file__error", "data-color": "danger", "data-size": "sm", title: error, children: error })
|
|
816
|
+
] }),
|
|
817
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs("span", { className: "at-filepicker-file__size", "data-size": "sm", children: [
|
|
818
|
+
"(",
|
|
819
|
+
formatFileSize(file.size),
|
|
820
|
+
")"
|
|
821
|
+
] }),
|
|
822
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(Button, { icon: true, variant: "tertiary", "data-size": "sm", onClick: () => onRemove(id), disabled, "aria-label": `Remove ${file.name}`, children: /* @__PURE__ */ jsxRuntimeExports.jsx(XMarkIcon, { "aria-hidden": true }) })
|
|
823
|
+
] }) }, id);
|
|
824
|
+
};
|
|
825
|
+
$[9] = disabled;
|
|
826
|
+
$[10] = onRemove;
|
|
827
|
+
$[11] = t32;
|
|
828
|
+
} else {
|
|
829
|
+
t32 = $[11];
|
|
830
|
+
}
|
|
831
|
+
t2 = files.map(t32);
|
|
832
|
+
$[5] = disabled;
|
|
833
|
+
$[6] = files;
|
|
834
|
+
$[7] = onRemove;
|
|
835
|
+
$[8] = t2;
|
|
836
|
+
} else {
|
|
837
|
+
t2 = $[8];
|
|
838
|
+
}
|
|
839
|
+
let t3;
|
|
840
|
+
if ($[12] !== rest || $[13] !== t1 || $[14] !== t2) {
|
|
841
|
+
t3 = /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: t1, ...rest, children: t2 });
|
|
842
|
+
$[12] = rest;
|
|
843
|
+
$[13] = t1;
|
|
844
|
+
$[14] = t2;
|
|
845
|
+
$[15] = t3;
|
|
846
|
+
} else {
|
|
847
|
+
t3 = $[15];
|
|
848
|
+
}
|
|
849
|
+
return t3;
|
|
850
|
+
}
|
|
851
|
+
const FilePicker = Object.assign(FilePicker$1, {
|
|
852
|
+
Dropzone: FilePickerDropzone,
|
|
853
|
+
Files: FilePickerFiles,
|
|
854
|
+
Errors: FilePickerErrors
|
|
855
|
+
});
|
|
435
856
|
export {
|
|
436
|
-
Alert,
|
|
857
|
+
Alert2 as Alert,
|
|
437
858
|
Avatar,
|
|
438
859
|
Badge,
|
|
439
860
|
BadgePosition,
|
|
@@ -442,7 +863,7 @@ export {
|
|
|
442
863
|
BreadcrumbsLink,
|
|
443
864
|
BreadcrumbsList,
|
|
444
865
|
Button2 as Button,
|
|
445
|
-
|
|
866
|
+
Card,
|
|
446
867
|
CardBlock,
|
|
447
868
|
Checkbox,
|
|
448
869
|
Chip,
|
|
@@ -453,7 +874,7 @@ export {
|
|
|
453
874
|
Combobox,
|
|
454
875
|
ComboboxEmpty,
|
|
455
876
|
ComboboxOption,
|
|
456
|
-
|
|
877
|
+
Details,
|
|
457
878
|
DetailsContent,
|
|
458
879
|
DetailsSummary,
|
|
459
880
|
Dialog,
|
|
@@ -468,13 +889,6 @@ export {
|
|
|
468
889
|
DropdownList,
|
|
469
890
|
DropdownTrigger,
|
|
470
891
|
DropdownTriggerContext,
|
|
471
|
-
EXPERIMENTAL_MultiSuggestion,
|
|
472
|
-
EXPERIMENTAL_MultiSuggestionChips,
|
|
473
|
-
EXPERIMENTAL_MultiSuggestionClear,
|
|
474
|
-
EXPERIMENTAL_MultiSuggestionEmpty,
|
|
475
|
-
EXPERIMENTAL_MultiSuggestionInput,
|
|
476
|
-
EXPERIMENTAL_MultiSuggestionList,
|
|
477
|
-
EXPERIMENTAL_MultiSuggestionOption,
|
|
478
892
|
EXPERIMENTAL_Suggestion,
|
|
479
893
|
EXPERIMENTAL_SuggestionClear,
|
|
480
894
|
EXPERIMENTAL_SuggestionEmpty,
|
|
@@ -494,9 +908,14 @@ export {
|
|
|
494
908
|
Fieldset,
|
|
495
909
|
FieldsetDescription,
|
|
496
910
|
FieldsetLegend,
|
|
497
|
-
|
|
911
|
+
FilePicker,
|
|
912
|
+
FilePickerContext,
|
|
913
|
+
FilePickerDropzone,
|
|
914
|
+
FilePickerErrors,
|
|
915
|
+
FilePickerFiles,
|
|
916
|
+
Heading,
|
|
498
917
|
Input,
|
|
499
|
-
Label,
|
|
918
|
+
Label2 as Label,
|
|
500
919
|
Link,
|
|
501
920
|
List,
|
|
502
921
|
ListItem,
|
|
@@ -522,7 +941,7 @@ export {
|
|
|
522
941
|
SelectOption,
|
|
523
942
|
Skeleton,
|
|
524
943
|
SkipLink,
|
|
525
|
-
Spinner,
|
|
944
|
+
Spinner2 as Spinner,
|
|
526
945
|
Switch,
|
|
527
946
|
Table,
|
|
528
947
|
TableBody,
|
|
@@ -536,13 +955,12 @@ export {
|
|
|
536
955
|
TabsPanel,
|
|
537
956
|
TabsTab,
|
|
538
957
|
Tag,
|
|
539
|
-
TempExample,
|
|
540
958
|
Textarea,
|
|
541
959
|
Textfield,
|
|
542
960
|
ToggleGroup,
|
|
543
961
|
ToggleGroupItem,
|
|
544
962
|
Tooltip,
|
|
545
|
-
ValidationMessage,
|
|
963
|
+
ValidationMessage2 as ValidationMessage,
|
|
546
964
|
getNextFocusableValue,
|
|
547
965
|
getPrevFocusableValue,
|
|
548
966
|
omit,
|