@igne-agency/react-web-ui 0.4.0 → 0.6.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/dist/base.css +3 -0
- package/dist/components/accordion/accordion.css +21 -21
- package/dist/components/accordion/accordion.d.ts +17 -4
- package/dist/components/accordion/accordion.js +83 -36
- package/dist/components/accordion/accordion.module.js +6 -6
- package/dist/components/attachment-tile/attachment-preview.d.ts +56 -13
- package/dist/components/attachment-tile/attachment-preview.js +388 -119
- package/dist/components/attachment-tile/attachment-tile.css +31 -25
- package/dist/components/attachment-tile/attachment-tile.d.ts +32 -10
- package/dist/components/attachment-tile/attachment-tile.js +160 -43
- package/dist/components/attachment-tile/attachment-tile.module.js +8 -8
- package/dist/components/attachment-tile/index.d.ts +1 -1
- package/dist/components/avatar/avatar.css +9 -9
- package/dist/components/avatar/avatar.d.ts +50 -5
- package/dist/components/avatar/avatar.js +178 -64
- package/dist/components/avatar/avatar.module.js +3 -3
- package/dist/components/avatar-group/avatar-group-context.d.ts +2 -4
- package/dist/components/avatar-group/avatar-group-context.js +2 -2
- package/dist/components/avatar-group/avatar-group.css +26 -20
- package/dist/components/avatar-group/avatar-group.d.ts +85 -27
- package/dist/components/avatar-group/avatar-group.js +400 -246
- package/dist/components/avatar-group/avatar-group.module.js +8 -8
- package/dist/components/breadcrumbs/breadcrumbs.css +12 -12
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +69 -23
- package/dist/components/breadcrumbs/breadcrumbs.js +299 -248
- package/dist/components/breadcrumbs/breadcrumbs.module.js +8 -8
- package/dist/components/button/button.css +29 -31
- package/dist/components/button/button.d.ts +20 -16
- package/dist/components/button/button.js +140 -145
- package/dist/components/button/button.module.js +1 -1
- package/dist/components/button/index.js +1 -1
- package/dist/components/checkbox-field/checkbox-field.js +63 -49
- package/dist/components/checkbox-field/checkbox.css +105 -56
- package/dist/components/checkbox-field/checkbox.d.ts +3 -2
- package/dist/components/checkbox-field/checkbox.js +12 -9
- package/dist/components/checkbox-field/checkbox.module.js +4 -4
- package/dist/components/checkbox-group-field/checkbox-group-field.js +78 -72
- package/dist/components/checkbox-group-field/checkbox-group.css +14 -10
- package/dist/components/checkbox-group-field/checkbox-group.d.ts +2 -2
- package/dist/components/checkbox-group-field/checkbox-group.js +2 -2
- package/dist/components/checkbox-group-field/checkbox-group.module.js +2 -2
- package/dist/components/collapsible/collapsible.css +20 -20
- package/dist/components/collapsible/collapsible.d.ts +17 -4
- package/dist/components/collapsible/collapsible.js +83 -36
- package/dist/components/collapsible/collapsible.module.js +5 -5
- package/dist/components/combobox-field/combobox-field.js +206 -158
- package/dist/components/combobox-field/combobox.css +492 -277
- package/dist/components/combobox-field/combobox.d.ts +148 -39
- package/dist/components/combobox-field/combobox.js +506 -206
- package/dist/components/combobox-field/combobox.module.js +21 -21
- package/dist/components/combobox-field/value-state-view.css +5 -5
- package/dist/components/combobox-field/value-state-view.module.js +4 -4
- package/dist/components/composer/composer-attachments.d.ts +30 -11
- package/dist/components/composer/composer-attachments.js +45 -40
- package/dist/components/composer/composer-editor.css +40 -35
- package/dist/components/composer/composer-editor.d.ts +14 -4
- package/dist/components/composer/composer-editor.js +134 -44
- package/dist/components/composer/composer-editor.module.js +5 -5
- package/dist/components/composer/composer.css +22 -22
- package/dist/components/composer/composer.d.ts +13 -2
- package/dist/components/composer/composer.js +78 -63
- package/dist/components/composer/composer.module.js +5 -5
- package/dist/components/composer/index.d.ts +2 -2
- package/dist/components/composer/mention-text.css +5 -5
- package/dist/components/composer/mention-text.module.js +1 -1
- package/dist/components/confirm-dialog/confirm-dialog.css +29 -29
- package/dist/components/confirm-dialog/confirm-dialog.d.ts +57 -3
- package/dist/components/confirm-dialog/confirm-dialog.js +266 -108
- package/dist/components/confirm-dialog/confirm-dialog.module.js +5 -5
- package/dist/components/conversation/conversation.css +52 -52
- package/dist/components/conversation/conversation.d.ts +43 -18
- package/dist/components/conversation/conversation.js +120 -78
- package/dist/components/conversation/conversation.module.js +15 -15
- package/dist/components/date-field/date-field.d.ts +1 -1
- package/dist/components/date-field/date-field.js +202 -100
- package/dist/components/date-field/date-input.d.ts +73 -37
- package/dist/components/date-field/date-input.js +72 -45
- package/dist/components/date-field/index.d.ts +1 -1
- package/dist/components/date-range-field/date-range-field.d.ts +1 -1
- package/dist/components/date-range-field/date-range-field.js +219 -107
- package/dist/components/date-range-field/date-range-input.d.ts +84 -40
- package/dist/components/date-range-field/date-range-input.js +83 -48
- package/dist/components/dialog/dialog.css +32 -32
- package/dist/components/dialog/dialog.d.ts +8 -7
- package/dist/components/dialog/dialog.js +8 -26
- package/dist/components/dialog/dialog.module.js +6 -6
- package/dist/components/divider/divider.css +6 -6
- package/dist/components/divider/divider.d.ts +36 -2
- package/dist/components/divider/divider.js +195 -29
- package/dist/components/divider/divider.module.js +3 -3
- package/dist/components/drawer/drawer.css +55 -56
- package/dist/components/drawer/drawer.d.ts +8 -7
- package/dist/components/drawer/drawer.js +8 -26
- package/dist/components/drawer/drawer.module.js +6 -6
- package/dist/components/field/field.css +34 -24
- package/dist/components/field/field.d.ts +60 -37
- package/dist/components/field/field.js +242 -157
- package/dist/components/field/field.module.js +12 -10
- package/dist/components/field/input-parts.d.ts +11 -13
- package/dist/components/field/input-parts.js +23 -42
- package/dist/components/field-placeholder/field-placeholder.css +6 -6
- package/dist/components/field-placeholder/field-placeholder.module.js +4 -4
- package/dist/components/fieldset/field-group.d.ts +1 -1
- package/dist/components/fieldset/field-group.js +48 -42
- package/dist/components/fieldset/fieldset-root.d.ts +1 -1
- package/dist/components/fieldset/fieldset-root.js +19 -17
- package/dist/components/fieldset/fieldset.d.ts +2 -2
- package/dist/components/fieldset/fieldset.js +2 -2
- package/dist/components/file-field/file-field.css +126 -60
- package/dist/components/file-field/file-field.js +201 -109
- package/dist/components/file-field/file-field.module.js +4 -4
- package/dist/components/file-field/file-input.d.ts +66 -40
- package/dist/components/file-field/file-input.js +188 -132
- package/dist/components/filter-bar/filter-bar.css +8 -8
- package/dist/components/filter-bar/filter-bar.d.ts +12 -3
- package/dist/components/filter-bar/filter-bar.js +23 -25
- package/dist/components/filter-bar/filter-bar.module.js +5 -5
- package/dist/components/form/form.d.ts +19 -7
- package/dist/components/form/form.js +80 -29
- package/dist/components/icon/icon.css +2 -2
- package/dist/components/icon/icon.module.js +1 -1
- package/dist/components/link/link.css +6 -5
- package/dist/components/link/link.module.js +1 -1
- package/dist/components/menu/menu.css +52 -47
- package/dist/components/menu/menu.d.ts +32 -25
- package/dist/components/menu/menu.js +75 -124
- package/dist/components/menu/menu.module.js +8 -8
- package/dist/components/nav/nav-context.d.ts +1 -1
- package/dist/components/nav/nav-item-view.d.ts +10 -13
- package/dist/components/nav/nav-item-view.js +42 -54
- package/dist/components/nav/nav.css +150 -119
- package/dist/components/nav/nav.d.ts +61 -17
- package/dist/components/nav/nav.js +271 -176
- package/dist/components/nav/nav.module.js +17 -15
- package/dist/components/number-field/number-field.css +153 -64
- package/dist/components/number-field/number-field.d.ts +2 -2
- package/dist/components/number-field/number-field.js +112 -91
- package/dist/components/number-field/number-field.module.js +6 -6
- package/dist/components/number-field/number-input.d.ts +43 -23
- package/dist/components/number-field/number-input.js +179 -125
- package/dist/components/otp-field/otp-field.css +153 -60
- package/dist/components/otp-field/otp-field.d.ts +2 -2
- package/dist/components/otp-field/otp-field.js +62 -46
- package/dist/components/otp-field/otp-field.module.js +4 -4
- package/dist/components/otp-field/otp-input.d.ts +8 -6
- package/dist/components/otp-field/otp-input.js +92 -92
- package/dist/components/pagination/pagination.d.ts +46 -15
- package/dist/components/pagination/pagination.js +217 -224
- package/dist/components/password-field/password-field.css +23 -23
- package/dist/components/password-field/password-field.js +107 -85
- package/dist/components/password-field/password-field.module.js +8 -8
- package/dist/components/password-field/password-strength.d.ts +107 -3
- package/dist/components/password-field/password-strength.js +569 -92
- package/dist/components/photo-field/photo-field.js +137 -112
- package/dist/components/photo-field/photo-input.css +67 -44
- package/dist/components/photo-field/photo-input.d.ts +59 -15
- package/dist/components/photo-field/photo-input.js +173 -86
- package/dist/components/photo-field/photo-input.module.js +10 -8
- package/dist/components/popover/popover.css +41 -41
- package/dist/components/popover/popover.d.ts +66 -25
- package/dist/components/popover/popover.js +332 -217
- package/dist/components/popover/popover.module.js +15 -19
- package/dist/components/radio-group-field/radio-group-field.js +80 -71
- package/dist/components/radio-group-field/radio-group.css +112 -60
- package/dist/components/radio-group-field/radio-group.d.ts +19 -3
- package/dist/components/radio-group-field/radio-group.js +66 -23
- package/dist/components/radio-group-field/radio-group.module.js +4 -4
- package/dist/components/segmented-control-field/segmented-control-field.d.ts +1 -1
- package/dist/components/segmented-control-field/segmented-control-field.js +111 -96
- package/dist/components/segmented-control-field/segmented-control.css +132 -79
- package/dist/components/segmented-control-field/segmented-control.d.ts +39 -15
- package/dist/components/segmented-control-field/segmented-control.js +124 -41
- package/dist/components/segmented-control-field/segmented-control.module.js +4 -4
- package/dist/components/select-field/select.css +214 -101
- package/dist/components/select-field/select.d.ts +43 -11
- package/dist/components/select-field/select.js +194 -109
- package/dist/components/select-field/select.module.js +14 -14
- package/dist/components/skeleton/skeleton.css +4 -4
- package/dist/components/skeleton/skeleton.module.js +3 -3
- package/dist/components/stale/stale.css +15 -15
- package/dist/components/stale/stale.d.ts +27 -3
- package/dist/components/stale/stale.js +147 -66
- package/dist/components/stale/stale.module.js +6 -6
- package/dist/components/status-message/status-message.css +22 -22
- package/dist/components/status-message/status-message.module.js +6 -6
- package/dist/components/switch-field/switch-field.js +77 -57
- package/dist/components/switch-field/switch.css +112 -63
- package/dist/components/switch-field/switch.d.ts +20 -3
- package/dist/components/switch-field/switch.js +70 -27
- package/dist/components/switch-field/switch.module.js +4 -4
- package/dist/components/tabs/tabs.css +32 -32
- package/dist/components/tabs/tabs.d.ts +21 -7
- package/dist/components/tabs/tabs.js +73 -14
- package/dist/components/tabs/tabs.module.js +7 -7
- package/dist/components/tag/tag.css +84 -84
- package/dist/components/tag/tag.module.js +3 -3
- package/dist/components/tag-group/tag-group.css +94 -94
- package/dist/components/tag-group/tag-group.module.js +4 -4
- package/dist/components/text-field/text-field.css +159 -82
- package/dist/components/text-field/text-field.d.ts +1 -1
- package/dist/components/text-field/text-field.js +139 -110
- package/dist/components/text-field/text-field.module.js +9 -9
- package/dist/components/text-field/text-input.d.ts +81 -45
- package/dist/components/text-field/text-input.js +366 -217
- package/dist/components/textarea-field/textarea-field.css +7 -2
- package/dist/components/textarea-field/textarea-field.js +72 -56
- package/dist/components/textarea-field/textarea-field.module.js +2 -2
- package/dist/components/time-field/time-field.js +153 -60
- package/dist/components/time-field/time-input.d.ts +21 -10
- package/dist/components/time-field/time-input.js +22 -11
- package/dist/components/toast/toast-provider.css +34 -31
- package/dist/components/toast/toast-provider.d.ts +63 -14
- package/dist/components/toast/toast-provider.js +174 -111
- package/dist/components/toast/toast-provider.module.js +7 -7
- package/dist/components/toggle-group-field/toggle-group-field.d.ts +1 -1
- package/dist/components/toggle-group-field/toggle-group-field.js +95 -89
- package/dist/components/toggle-group-field/toggle-group.css +117 -67
- package/dist/components/toggle-group-field/toggle-group.d.ts +2 -2
- package/dist/components/toggle-group-field/toggle-group.js +2 -2
- package/dist/components/toggle-group-field/toggle-group.module.js +2 -2
- package/dist/components/tooltip/tooltip.css +4 -4
- package/dist/components/tooltip/tooltip.module.js +1 -1
- package/dist/data-table/data-table-content.js +6 -5
- package/dist/data-table/data-table-parts.d.ts +41 -13
- package/dist/data-table/data-table-parts.js +213 -172
- package/dist/data-table/data-table-selection.d.ts +105 -3
- package/dist/data-table/data-table-selection.js +654 -145
- package/dist/data-table/data-table.css +125 -128
- package/dist/data-table/data-table.d.ts +21 -26
- package/dist/data-table/data-table.js +20 -23
- package/dist/data-table/data-table.module.js +32 -34
- package/dist/data-table/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/lib/calendar/calendar-navigation.d.ts +39 -5
- package/dist/lib/calendar/calendar-navigation.js +185 -118
- package/dist/lib/calendar/calendar-parts.d.ts +143 -0
- package/dist/lib/calendar/calendar-parts.js +540 -0
- package/dist/lib/calendar/calendar-prefab.d.ts +52 -0
- package/dist/lib/calendar/calendar-prefab.js +311 -0
- package/dist/lib/calendar/calendar-year.d.ts +3 -1
- package/dist/lib/calendar/calendar-year.js +139 -131
- package/dist/lib/calendar/temporal.css +325 -232
- package/dist/lib/calendar/temporal.d.ts +67 -82
- package/dist/lib/calendar/temporal.js +258 -569
- package/dist/lib/calendar/temporal.module.js +38 -38
- package/dist/lib/forms/use-connected-field.d.ts +1 -1
- package/dist/lib/forms/use-connected-field.js +1 -1
- package/dist/lib/render-as.d.ts +13 -0
- package/dist/lib/render-as.js +46 -0
- package/dist/terrazzo/index.d.ts +4 -3
- package/dist/terrazzo/index.js +17 -6
- package/dist/tokens.css +28 -4
- package/package.json +2 -2
- package/tokens/dark.tokens.json +6 -0
- package/tokens/sys.tokens.json +7 -0
- package/dist/components/button/close-button.d.ts +0 -16
- package/dist/components/button/close-button.js +0 -30
|
@@ -3,6 +3,11 @@ import { formatBytes } from "../../lib/format-bytes.js";
|
|
|
3
3
|
import { Field } from "../field/field.js";
|
|
4
4
|
import { useFieldState } from "../field/use-field-state.js";
|
|
5
5
|
import { useLocale } from "../locale-provider/locale-provider.js";
|
|
6
|
+
import { AttachmentTile } from "../attachment-tile/attachment-tile.js";
|
|
7
|
+
import { useAttachmentPreview } from "../attachment-tile/attachment-preview.js";
|
|
8
|
+
import { Button as Button$1, IconButton } from "../button/button.js";
|
|
9
|
+
import { Spinner } from "../spinner/spinner.js";
|
|
10
|
+
import { Tooltip } from "../tooltip/tooltip.js";
|
|
6
11
|
import { FileInput } from "./file-input.js";
|
|
7
12
|
import { isOversized, oversizedFiles } from "./file-size.js";
|
|
8
13
|
import { isAccepted, wrongTypeFiles } from "./file-type.js";
|
|
@@ -11,6 +16,97 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
11
16
|
import { useRef } from "react";
|
|
12
17
|
import { isFileDropItem } from "react-aria-components";
|
|
13
18
|
// src/components/file-field/file-field.tsx
|
|
19
|
+
var StagedFile = (t0) => {
|
|
20
|
+
const $ = c(24);
|
|
21
|
+
const { id, file, hint, invalid, disabled, icon, removeLabel, removeIcon } = t0;
|
|
22
|
+
const preview = useAttachmentPreview(file);
|
|
23
|
+
let t1;
|
|
24
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
25
|
+
t1 = /* @__PURE__ */ jsx(AttachmentTile.Image, {});
|
|
26
|
+
$[0] = t1;
|
|
27
|
+
} else t1 = $[0];
|
|
28
|
+
let t2;
|
|
29
|
+
if ($[1] !== icon) {
|
|
30
|
+
t2 = /* @__PURE__ */ jsx(AttachmentTile.Icon, { children: icon });
|
|
31
|
+
$[1] = icon;
|
|
32
|
+
$[2] = t2;
|
|
33
|
+
} else t2 = $[2];
|
|
34
|
+
let t3;
|
|
35
|
+
let t4;
|
|
36
|
+
let t5;
|
|
37
|
+
if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
|
|
38
|
+
t3 = /* @__PURE__ */ jsx(AttachmentTile.Extension, {});
|
|
39
|
+
t4 = /* @__PURE__ */ jsx(AttachmentTile.Skeleton, {});
|
|
40
|
+
t5 = /* @__PURE__ */ jsx(AttachmentTile.Name, {});
|
|
41
|
+
$[3] = t3;
|
|
42
|
+
$[4] = t4;
|
|
43
|
+
$[5] = t5;
|
|
44
|
+
} else {
|
|
45
|
+
t3 = $[3];
|
|
46
|
+
t4 = $[4];
|
|
47
|
+
t5 = $[5];
|
|
48
|
+
}
|
|
49
|
+
let t6;
|
|
50
|
+
if ($[6] !== file.name || $[7] !== preview.pending || $[8] !== preview.src || $[9] !== t2) {
|
|
51
|
+
t6 = /* @__PURE__ */ jsxs(AttachmentTile.Preview, {
|
|
52
|
+
name: file.name,
|
|
53
|
+
src: preview.src,
|
|
54
|
+
pending: preview.pending,
|
|
55
|
+
children: [
|
|
56
|
+
t1,
|
|
57
|
+
t2,
|
|
58
|
+
t3,
|
|
59
|
+
t4,
|
|
60
|
+
t5
|
|
61
|
+
]
|
|
62
|
+
});
|
|
63
|
+
$[6] = file.name;
|
|
64
|
+
$[7] = preview.pending;
|
|
65
|
+
$[8] = preview.src;
|
|
66
|
+
$[9] = t2;
|
|
67
|
+
$[10] = t6;
|
|
68
|
+
} else t6 = $[10];
|
|
69
|
+
let t7;
|
|
70
|
+
if ($[11] !== hint || $[12] !== t6) {
|
|
71
|
+
t7 = /* @__PURE__ */ jsx(Tooltip, {
|
|
72
|
+
content: hint,
|
|
73
|
+
children: t6
|
|
74
|
+
});
|
|
75
|
+
$[11] = hint;
|
|
76
|
+
$[12] = t6;
|
|
77
|
+
$[13] = t7;
|
|
78
|
+
} else t7 = $[13];
|
|
79
|
+
let t8;
|
|
80
|
+
if ($[14] !== removeIcon || $[15] !== removeLabel) {
|
|
81
|
+
t8 = removeLabel === void 0 ? null : /* @__PURE__ */ jsx(AttachmentTile.Corner, { children: /* @__PURE__ */ jsx(AttachmentTile.Remove, { render: /* @__PURE__ */ jsx(IconButton, {
|
|
82
|
+
variant: "tertiary",
|
|
83
|
+
size: "sm",
|
|
84
|
+
label: removeLabel,
|
|
85
|
+
children: removeIcon
|
|
86
|
+
}) }) });
|
|
87
|
+
$[14] = removeIcon;
|
|
88
|
+
$[15] = removeLabel;
|
|
89
|
+
$[16] = t8;
|
|
90
|
+
} else t8 = $[16];
|
|
91
|
+
let t9;
|
|
92
|
+
if ($[17] !== disabled || $[18] !== file.name || $[19] !== id || $[20] !== invalid || $[21] !== t7 || $[22] !== t8) {
|
|
93
|
+
t9 = /* @__PURE__ */ jsxs(FileInput.Item, {
|
|
94
|
+
id,
|
|
95
|
+
textValue: file.name,
|
|
96
|
+
invalid,
|
|
97
|
+
disabled,
|
|
98
|
+
children: [t7, t8]
|
|
99
|
+
});
|
|
100
|
+
$[17] = disabled;
|
|
101
|
+
$[18] = file.name;
|
|
102
|
+
$[19] = id;
|
|
103
|
+
$[20] = invalid;
|
|
104
|
+
$[21] = t7;
|
|
105
|
+
$[22] = t8;
|
|
106
|
+
$[23] = t9;
|
|
107
|
+
} else t9 = $[23];
|
|
108
|
+
return t9;
|
|
109
|
+
};
|
|
14
110
|
/**
|
|
15
111
|
* A labelled drop target holding the staged files as removable tiles, with a
|
|
16
112
|
* file picker button. Files over `maxFileSize` or of a type outside `accept`
|
|
@@ -37,7 +133,7 @@ import { isFileDropItem } from "react-aria-components";
|
|
|
37
133
|
* />
|
|
38
134
|
*/
|
|
39
135
|
var FileField = (t0) => {
|
|
40
|
-
const $ = c(
|
|
136
|
+
const $ = c(91);
|
|
41
137
|
const { label, description, errors, requiredness, optionalLabel, dirty, touched, pending, value, onValueChange, onBlur, maxFileSize, accept, multiple, disabled, readOnly, dropTargetLabel, dropHint, dropIcon, chooseLabel, chooseIcon, filesLabel, removeLabel, removeIcon, fileIcon, fileHint, tooLargeError, wrongTypeError, className } = t0;
|
|
42
138
|
const locale = useLocale();
|
|
43
139
|
const ids = Field.useIds();
|
|
@@ -132,83 +228,79 @@ var FileField = (t0) => {
|
|
|
132
228
|
} else t6 = $[31];
|
|
133
229
|
const remove = t6;
|
|
134
230
|
let t7;
|
|
135
|
-
if ($[32] !==
|
|
136
|
-
t7 =
|
|
137
|
-
removeLabel,
|
|
138
|
-
removeIcon
|
|
139
|
-
};
|
|
140
|
-
$[32] = readOnly;
|
|
141
|
-
$[33] = removeIcon;
|
|
142
|
-
$[34] = removeLabel;
|
|
143
|
-
$[35] = t7;
|
|
144
|
-
} else t7 = $[35];
|
|
145
|
-
const removal = t7;
|
|
146
|
-
let t8;
|
|
147
|
-
if ($[36] !== accept || $[37] !== fieldState.disabled || $[38] !== fileHint || $[39] !== fileIcon || $[40] !== filesLabel || $[41] !== locale || $[42] !== maxFileSize || $[43] !== readOnly || $[44] !== removal || $[45] !== remove || $[46] !== value) {
|
|
148
|
-
t8 = value.length === 0 ? null : /* @__PURE__ */ jsx(FileInput.List, {
|
|
231
|
+
if ($[32] !== accept || $[33] !== fieldState.disabled || $[34] !== fileHint || $[35] !== fileIcon || $[36] !== filesLabel || $[37] !== locale || $[38] !== maxFileSize || $[39] !== readOnly || $[40] !== remove || $[41] !== removeIcon || $[42] !== removeLabel || $[43] !== value) {
|
|
232
|
+
t7 = value.length === 0 ? null : /* @__PURE__ */ jsx(FileInput.List, {
|
|
149
233
|
label: filesLabel,
|
|
150
234
|
onRemove: readOnly === true ? void 0 : remove,
|
|
151
|
-
children: value.map((file_3, index_1) => /* @__PURE__ */ jsx(
|
|
235
|
+
children: value.map((file_3, index_1) => /* @__PURE__ */ jsx(StagedFile, {
|
|
152
236
|
id: keyOf(file_3, index_1),
|
|
153
237
|
file: file_3,
|
|
154
238
|
hint: fileHint(file_3.name, formatBytes(file_3.size, locale)),
|
|
155
239
|
invalid: isOversized(file_3, maxFileSize) || !isAccepted(file_3, accept ?? []),
|
|
156
240
|
disabled: fieldState.disabled,
|
|
157
241
|
icon: fileIcon,
|
|
158
|
-
|
|
242
|
+
removeLabel: readOnly === true ? void 0 : removeLabel,
|
|
243
|
+
removeIcon
|
|
159
244
|
}, keyOf(file_3, index_1)))
|
|
160
245
|
});
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
163
|
-
$[
|
|
164
|
-
$[
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
169
|
-
$[
|
|
170
|
-
$[
|
|
171
|
-
$[
|
|
172
|
-
$[
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
246
|
+
$[32] = accept;
|
|
247
|
+
$[33] = fieldState.disabled;
|
|
248
|
+
$[34] = fileHint;
|
|
249
|
+
$[35] = fileIcon;
|
|
250
|
+
$[36] = filesLabel;
|
|
251
|
+
$[37] = locale;
|
|
252
|
+
$[38] = maxFileSize;
|
|
253
|
+
$[39] = readOnly;
|
|
254
|
+
$[40] = remove;
|
|
255
|
+
$[41] = removeIcon;
|
|
256
|
+
$[42] = removeLabel;
|
|
257
|
+
$[43] = value;
|
|
258
|
+
$[44] = t7;
|
|
259
|
+
} else t7 = $[44];
|
|
260
|
+
const tiles = t7;
|
|
261
|
+
let t8;
|
|
262
|
+
if ($[45] !== onBlur) {
|
|
263
|
+
t8 = (event) => {
|
|
178
264
|
if (!(event.relatedTarget instanceof Node && event.currentTarget.contains(event.relatedTarget))) onBlur?.();
|
|
179
265
|
};
|
|
180
|
-
$[
|
|
181
|
-
$[
|
|
182
|
-
} else
|
|
266
|
+
$[45] = onBlur;
|
|
267
|
+
$[46] = t8;
|
|
268
|
+
} else t8 = $[46];
|
|
269
|
+
let t9;
|
|
270
|
+
if ($[47] !== optionalLabel) {
|
|
271
|
+
t9 = /* @__PURE__ */ jsx(Field.Requiredness, { optionalLabel });
|
|
272
|
+
$[47] = optionalLabel;
|
|
273
|
+
$[48] = t9;
|
|
274
|
+
} else t9 = $[48];
|
|
183
275
|
let t10;
|
|
184
|
-
if ($[
|
|
185
|
-
t10 = /* @__PURE__ */
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
});
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
|
|
194
|
-
} else t10 = $[53];
|
|
276
|
+
if ($[49] !== label || $[50] !== t9) {
|
|
277
|
+
t10 = /* @__PURE__ */ jsxs(FileInput.Legend, { children: [
|
|
278
|
+
label,
|
|
279
|
+
" ",
|
|
280
|
+
t9
|
|
281
|
+
] });
|
|
282
|
+
$[49] = label;
|
|
283
|
+
$[50] = t9;
|
|
284
|
+
$[51] = t10;
|
|
285
|
+
} else t10 = $[51];
|
|
195
286
|
const t11 = readOnly === true ? _temp2 : void 0;
|
|
196
287
|
let t12;
|
|
197
|
-
if ($[
|
|
288
|
+
if ($[52] !== add) {
|
|
198
289
|
t12 = async (event_0) => {
|
|
199
290
|
add(await Promise.all(event_0.items.filter(isFileDropItem).map(_temp3)));
|
|
200
291
|
};
|
|
201
|
-
$[
|
|
202
|
-
$[
|
|
203
|
-
} else t12 = $[
|
|
292
|
+
$[52] = add;
|
|
293
|
+
$[53] = t12;
|
|
294
|
+
} else t12 = $[53];
|
|
204
295
|
let t13;
|
|
205
|
-
if ($[
|
|
206
|
-
t13 = readOnly === true ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
296
|
+
if ($[54] !== accept || $[55] !== add || $[56] !== chooseIcon || $[57] !== chooseLabel || $[58] !== describedBy || $[59] !== dropHint || $[60] !== dropIcon || $[61] !== field.disabled || $[62] !== field.invalid || $[63] !== multiple || $[64] !== readOnly) {
|
|
297
|
+
t13 = readOnly === true ? null : /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(FileInput.Hint, { children: [/* @__PURE__ */ jsx(FileInput.HintIcon, { children: dropIcon }), dropHint] }), /* @__PURE__ */ jsx(FileInput.Trigger, {
|
|
298
|
+
render: /* @__PURE__ */ jsx(Button$1, {
|
|
299
|
+
variant: "secondary",
|
|
300
|
+
size: "sm",
|
|
301
|
+
icon: chooseIcon,
|
|
302
|
+
children: chooseLabel
|
|
303
|
+
}),
|
|
212
304
|
disabled: field.disabled,
|
|
213
305
|
describedBy,
|
|
214
306
|
buttonRef: triggerRef,
|
|
@@ -217,27 +309,27 @@ var FileField = (t0) => {
|
|
|
217
309
|
acceptedFileTypes: accept,
|
|
218
310
|
onSelect: (files) => add(files === null ? [] : [...files])
|
|
219
311
|
})] });
|
|
220
|
-
$[
|
|
221
|
-
$[
|
|
222
|
-
$[
|
|
223
|
-
$[
|
|
224
|
-
$[
|
|
225
|
-
$[
|
|
226
|
-
$[
|
|
227
|
-
$[
|
|
228
|
-
$[
|
|
229
|
-
$[
|
|
230
|
-
$[
|
|
231
|
-
$[
|
|
232
|
-
} else t13 = $[
|
|
312
|
+
$[54] = accept;
|
|
313
|
+
$[55] = add;
|
|
314
|
+
$[56] = chooseIcon;
|
|
315
|
+
$[57] = chooseLabel;
|
|
316
|
+
$[58] = describedBy;
|
|
317
|
+
$[59] = dropHint;
|
|
318
|
+
$[60] = dropIcon;
|
|
319
|
+
$[61] = field.disabled;
|
|
320
|
+
$[62] = field.invalid;
|
|
321
|
+
$[63] = multiple;
|
|
322
|
+
$[64] = readOnly;
|
|
323
|
+
$[65] = t13;
|
|
324
|
+
} else t13 = $[65];
|
|
233
325
|
let t14;
|
|
234
|
-
if ($[
|
|
235
|
-
t14 = field.phase !== "fresh" && /* @__PURE__ */ jsx(FileInput.Pending, {});
|
|
236
|
-
$[
|
|
237
|
-
$[
|
|
238
|
-
} else t14 = $[
|
|
326
|
+
if ($[66] !== field.phase) {
|
|
327
|
+
t14 = field.phase !== "fresh" && /* @__PURE__ */ jsx(FileInput.Pending, { children: /* @__PURE__ */ jsx(Spinner, { size: 1 }) });
|
|
328
|
+
$[66] = field.phase;
|
|
329
|
+
$[67] = t14;
|
|
330
|
+
} else t14 = $[67];
|
|
239
331
|
let t15;
|
|
240
|
-
if ($[
|
|
332
|
+
if ($[68] !== dropTargetLabel || $[69] !== field.disabled || $[70] !== fieldState || $[71] !== t11 || $[72] !== t12 || $[73] !== t13 || $[74] !== t14 || $[75] !== tiles) {
|
|
241
333
|
t15 = /* @__PURE__ */ jsxs(FileInput.DropTarget, {
|
|
242
334
|
"aria-label": dropTargetLabel,
|
|
243
335
|
state: fieldState,
|
|
@@ -250,43 +342,43 @@ var FileField = (t0) => {
|
|
|
250
342
|
t14
|
|
251
343
|
]
|
|
252
344
|
});
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
255
|
-
$[
|
|
256
|
-
$[
|
|
257
|
-
$[
|
|
258
|
-
$[
|
|
259
|
-
$[
|
|
260
|
-
$[
|
|
261
|
-
$[
|
|
262
|
-
} else t15 = $[
|
|
345
|
+
$[68] = dropTargetLabel;
|
|
346
|
+
$[69] = field.disabled;
|
|
347
|
+
$[70] = fieldState;
|
|
348
|
+
$[71] = t11;
|
|
349
|
+
$[72] = t12;
|
|
350
|
+
$[73] = t13;
|
|
351
|
+
$[74] = t14;
|
|
352
|
+
$[75] = tiles;
|
|
353
|
+
$[76] = t15;
|
|
354
|
+
} else t15 = $[76];
|
|
263
355
|
let t16;
|
|
264
|
-
if ($[
|
|
356
|
+
if ($[77] !== description || $[78] !== ids.descriptionId) {
|
|
265
357
|
t16 = /* @__PURE__ */ jsx(FileInput.Description, {
|
|
266
358
|
id: ids.descriptionId,
|
|
267
359
|
children: description
|
|
268
360
|
});
|
|
269
|
-
$[
|
|
270
|
-
$[
|
|
271
|
-
$[
|
|
272
|
-
} else t16 = $[
|
|
361
|
+
$[77] = description;
|
|
362
|
+
$[78] = ids.descriptionId;
|
|
363
|
+
$[79] = t16;
|
|
364
|
+
} else t16 = $[79];
|
|
273
365
|
let t17;
|
|
274
|
-
if ($[
|
|
366
|
+
if ($[80] !== ids.errorId || $[81] !== messages) {
|
|
275
367
|
t17 = /* @__PURE__ */ jsx(FileInput.Error, {
|
|
276
368
|
id: ids.errorId,
|
|
277
369
|
children: messages
|
|
278
370
|
});
|
|
279
|
-
$[
|
|
280
|
-
$[
|
|
281
|
-
$[
|
|
282
|
-
} else t17 = $[
|
|
371
|
+
$[80] = ids.errorId;
|
|
372
|
+
$[81] = messages;
|
|
373
|
+
$[82] = t17;
|
|
374
|
+
} else t17 = $[82];
|
|
283
375
|
let t18;
|
|
284
|
-
if ($[
|
|
376
|
+
if ($[83] !== className || $[84] !== fieldState || $[85] !== t10 || $[86] !== t15 || $[87] !== t16 || $[88] !== t17 || $[89] !== t8) {
|
|
285
377
|
t18 = /* @__PURE__ */ jsxs(FileInput.Root, {
|
|
286
378
|
state: fieldState,
|
|
287
379
|
disabled: fieldState.disabled,
|
|
288
380
|
className,
|
|
289
|
-
onBlur:
|
|
381
|
+
onBlur: t8,
|
|
290
382
|
children: [
|
|
291
383
|
t10,
|
|
292
384
|
t15,
|
|
@@ -294,15 +386,15 @@ var FileField = (t0) => {
|
|
|
294
386
|
t17
|
|
295
387
|
]
|
|
296
388
|
});
|
|
297
|
-
$[
|
|
298
|
-
$[
|
|
299
|
-
$[
|
|
300
|
-
$[
|
|
301
|
-
$[
|
|
302
|
-
$[
|
|
303
|
-
$[
|
|
304
|
-
$[
|
|
305
|
-
} else t18 = $[
|
|
389
|
+
$[83] = className;
|
|
390
|
+
$[84] = fieldState;
|
|
391
|
+
$[85] = t10;
|
|
392
|
+
$[86] = t15;
|
|
393
|
+
$[87] = t16;
|
|
394
|
+
$[88] = t17;
|
|
395
|
+
$[89] = t8;
|
|
396
|
+
$[90] = t18;
|
|
397
|
+
} else t18 = $[90];
|
|
306
398
|
return t18;
|
|
307
399
|
};
|
|
308
400
|
function _temp(file_1, index) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import './file-field.css';// src/components/file-field/file-field.module.scss
|
|
2
|
-
var dropTarget = "
|
|
3
|
-
var hint = "
|
|
4
|
-
var hintIcon = "
|
|
5
|
-
var list = "
|
|
2
|
+
var dropTarget = "_dropTarget_1rv6d_3";
|
|
3
|
+
var hint = "_hint_1rv6d_148";
|
|
4
|
+
var hintIcon = "_hintIcon_1rv6d_158";
|
|
5
|
+
var list = "_list_1rv6d_162";
|
|
6
6
|
var file_field_module_default = {
|
|
7
7
|
dropTarget,
|
|
8
8
|
hint,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { ComponentProps, ReactNode, Ref } from "react";
|
|
2
|
+
import type { useRender } from "@base-ui/react/use-render";
|
|
2
3
|
import { type DropZoneProps as AriaDropZoneProps, type FileTriggerProps as AriaFileTriggerProps, type Key } from "react-aria-components";
|
|
4
|
+
import { type AttachmentTileRootProps } from "../attachment-tile/index.ts";
|
|
3
5
|
import { Field, type FieldLabelProps, type FieldRootProps, type FieldState } from "../field/index.ts";
|
|
4
|
-
export type FileInputRootProps = FieldRootProps & Readonly<{
|
|
6
|
+
export type FileInputRootProps = Omit<FieldRootProps, "requiredness"> & Readonly<{
|
|
5
7
|
/** The states projected onto the field as `data-*` attributes. */
|
|
6
8
|
state?: FieldState;
|
|
7
9
|
}>;
|
|
@@ -18,15 +20,28 @@ export type FileInputDropTargetProps = Omit<AriaDropZoneProps, "className" | "ar
|
|
|
18
20
|
}>;
|
|
19
21
|
/** The area files are dropped on, holding the hint, the picker button and the staged files. */
|
|
20
22
|
declare const FileInputDropTarget: ({ state, className, ...props }: FileInputDropTargetProps) => ReactNode;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
/**
|
|
24
|
+
* The prompt inside the drop target, holding its text and an optional
|
|
25
|
+
* `HintIcon` above it.
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* <FileInput.Hint>
|
|
29
|
+
* <FileInput.HintIcon><UploadFileIcon /></FileInput.HintIcon>
|
|
30
|
+
* Drag files here
|
|
31
|
+
* </FileInput.Hint>
|
|
32
|
+
*/
|
|
33
|
+
declare const FileInputHint: ({ className, ...props }: ComponentProps<"p">) => ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* The glyph above the prompt, such as an upload icon. Renders nothing without
|
|
36
|
+
* children.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* <FileInput.HintIcon><UploadFileIcon /></FileInput.HintIcon>
|
|
40
|
+
*/
|
|
41
|
+
declare const FileInputHintIcon: ({ className, children, ...props }: ComponentProps<"span">) => ReactNode;
|
|
27
42
|
export type FileInputTriggerProps = Omit<AriaFileTriggerProps, "children"> & Readonly<{
|
|
28
|
-
/**
|
|
29
|
-
|
|
43
|
+
/** The button to render, such as `<Button variant="secondary" size="sm">Choose files</Button>`. */
|
|
44
|
+
render: useRender.RenderProp;
|
|
30
45
|
disabled?: boolean;
|
|
31
46
|
/** Ids of the description and error text, chained onto the button. */
|
|
32
47
|
describedBy?: string;
|
|
@@ -34,11 +49,18 @@ export type FileInputTriggerProps = Omit<AriaFileTriggerProps, "children"> & Rea
|
|
|
34
49
|
buttonRef?: Ref<HTMLButtonElement>;
|
|
35
50
|
/** Marks the picker button as the field's invalid control. */
|
|
36
51
|
invalid?: boolean;
|
|
37
|
-
/** Drawn before the button's label, such as an attach icon. */
|
|
38
|
-
icon?: ReactNode;
|
|
39
52
|
}>;
|
|
40
|
-
/**
|
|
41
|
-
|
|
53
|
+
/**
|
|
54
|
+
* The button that opens the file dialog. It renders whichever button it is
|
|
55
|
+
* given.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* <FileInput.Trigger
|
|
59
|
+
* onSelect={onSelect}
|
|
60
|
+
* render={<Button variant="secondary" size="sm" icon={<AttachFileIcon />}>Choose files</Button>}
|
|
61
|
+
* />
|
|
62
|
+
*/
|
|
63
|
+
declare const FileInputTrigger: ({ render, disabled, describedBy, buttonRef, invalid, ...props }: FileInputTriggerProps) => ReactNode;
|
|
42
64
|
export type FileInputListProps = Readonly<{
|
|
43
65
|
/** Accessible name for the group of tiles. */
|
|
44
66
|
label: string;
|
|
@@ -49,36 +71,29 @@ export type FileInputListProps = Readonly<{
|
|
|
49
71
|
}>;
|
|
50
72
|
/** The staged files, as a group of removable tiles. */
|
|
51
73
|
declare const FileInputList: ({ label, onRemove, children, className, }: FileInputListProps) => ReactNode;
|
|
52
|
-
|
|
53
|
-
export type FileInputItemRemoval = Readonly<{
|
|
54
|
-
/** Accessible name for the remove button. */
|
|
55
|
-
removeLabel: string;
|
|
56
|
-
/** The remove button's icon, such as a cross. */
|
|
57
|
-
removeIcon: ReactNode;
|
|
58
|
-
}> | Readonly<{
|
|
59
|
-
removeLabel?: undefined;
|
|
60
|
-
removeIcon?: undefined;
|
|
61
|
-
}>;
|
|
62
|
-
export type FileInputItemProps = Readonly<{
|
|
74
|
+
export type FileInputItemProps = Omit<AttachmentTileRootProps, "render" | "id"> & Readonly<{
|
|
63
75
|
/** Key the surrounding list removes this file by. */
|
|
64
76
|
id: string;
|
|
65
|
-
file
|
|
66
|
-
|
|
67
|
-
hint: string;
|
|
68
|
-
/** Marks the tile as rejected, such as over the size limit. */
|
|
69
|
-
invalid?: boolean;
|
|
77
|
+
/** The file's name, which the tile is read and typed to as. */
|
|
78
|
+
textValue: string;
|
|
70
79
|
disabled?: boolean;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
}>;
|
|
81
|
+
/**
|
|
82
|
+
* One staged file's tile in the `List`, holding `AttachmentTile`'s parts.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* <FileInput.Item id={id} textValue={file.name}>
|
|
86
|
+
* <AttachmentTile.Preview name={file.name} src={src}>…</AttachmentTile.Preview>
|
|
87
|
+
* </FileInput.Item>
|
|
88
|
+
*/
|
|
89
|
+
declare const FileInputItem: ({ id, textValue, disabled, ...props }: FileInputItemProps) => ReactNode;
|
|
76
90
|
/** The parts of a file input. */
|
|
77
91
|
export type FileInputParts = Readonly<{
|
|
78
92
|
Root: typeof FileInputRoot;
|
|
79
93
|
Legend: typeof FileInputLegend;
|
|
80
94
|
DropTarget: typeof FileInputDropTarget;
|
|
81
95
|
Hint: typeof FileInputHint;
|
|
96
|
+
HintIcon: typeof FileInputHintIcon;
|
|
82
97
|
Trigger: typeof FileInputTrigger;
|
|
83
98
|
Pending: typeof Field.Pending;
|
|
84
99
|
List: typeof FileInputList;
|
|
@@ -88,18 +103,29 @@ export type FileInputParts = Readonly<{
|
|
|
88
103
|
}>;
|
|
89
104
|
/**
|
|
90
105
|
* The styled parts of a file input: the field frame around react-aria's
|
|
91
|
-
* `DropZone` and `FileTrigger`, plus the staged files as removable
|
|
92
|
-
* `AttachmentTile`s. The `Root` is a fieldset named by its `Legend`. For the
|
|
106
|
+
* `DropZone` and `FileTrigger`, plus the staged files as removable tiles built
|
|
107
|
+
* from `AttachmentTile`'s parts. The `Root` is a fieldset named by its `Legend`. For the
|
|
93
108
|
* ordinary case, use `FileField`.
|
|
94
109
|
*
|
|
95
110
|
* @example
|
|
96
111
|
* <FileInput.Root state={{ requiredness: "optional" }}>
|
|
97
|
-
* <FileInput.Legend optionalLabel="optional"
|
|
112
|
+
* <FileInput.Legend>Attachments <Field.Requiredness optionalLabel="optional" /></FileInput.Legend>
|
|
98
113
|
* <FileInput.DropTarget aria-label="Drop zone for attachments" onDrop={onDrop}>
|
|
99
|
-
* <FileInput.Hint
|
|
100
|
-
*
|
|
114
|
+
* <FileInput.Hint>
|
|
115
|
+
* <FileInput.HintIcon><UploadFileIcon /></FileInput.HintIcon>
|
|
116
|
+
* Drag files here
|
|
117
|
+
* </FileInput.Hint>
|
|
118
|
+
* <FileInput.Trigger
|
|
119
|
+
* onSelect={onSelect}
|
|
120
|
+
* render={<Button variant="secondary" size="sm" icon={<AttachFileIcon />}>Choose files</Button>}
|
|
121
|
+
* />
|
|
101
122
|
* <FileInput.List label="Files for attachments" onRemove={onRemove}>
|
|
102
|
-
* <FileInput.Item id={id}
|
|
123
|
+
* <FileInput.Item id={id} textValue={file.name}>
|
|
124
|
+
* <AttachmentTile.Preview name={file.name} src={undefined}>
|
|
125
|
+
* <AttachmentTile.Extension />
|
|
126
|
+
* <AttachmentTile.Name />
|
|
127
|
+
* </AttachmentTile.Preview>
|
|
128
|
+
* </FileInput.Item>
|
|
103
129
|
* </FileInput.List>
|
|
104
130
|
* </FileInput.DropTarget>
|
|
105
131
|
* </FileInput.Root>
|