@igne-agency/react-web-ui 0.5.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/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/tokens.css +6 -3
- package/package.json +1 -1
- 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
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { useBusyPhase } from "../../lib/hooks/use-busy-phase.js";
|
|
2
|
+
import { useRequiredContext } from "../../lib/use-required-context.js";
|
|
2
3
|
import { Skeleton } from "../skeleton/skeleton.js";
|
|
3
|
-
import { Tooltip } from "../tooltip/tooltip.js";
|
|
4
4
|
import attachment_tile_module_default from "./attachment-tile.module.js";
|
|
5
5
|
import { c } from "react/compiler-runtime";
|
|
6
|
+
import { useRender } from "@base-ui/react/use-render";
|
|
6
7
|
import { clsx } from "clsx";
|
|
7
|
-
import {
|
|
8
|
-
import { useEffect, useState } from "react";
|
|
8
|
+
import { jsx } from "react/jsx-runtime";
|
|
9
|
+
import { createContext, useEffect, useState } from "react";
|
|
9
10
|
// src/components/attachment-tile/attachment-preview.tsx
|
|
10
11
|
var extensionOf = (name) => {
|
|
11
12
|
const dot = name.lastIndexOf(".");
|
|
@@ -64,152 +65,420 @@ var useAttachmentPreview = (blob) => {
|
|
|
64
65
|
} else t3 = $[5];
|
|
65
66
|
return t3;
|
|
66
67
|
};
|
|
68
|
+
var PreviewContext = createContext(null);
|
|
69
|
+
var usePreview = () => {
|
|
70
|
+
return useRequiredContext(PreviewContext, "AttachmentTile preview parts must be rendered within <AttachmentTile.Preview>.");
|
|
71
|
+
};
|
|
72
|
+
var useFallbackShown = () => {
|
|
73
|
+
const { image, pending } = usePreview();
|
|
74
|
+
return image === void 0 && !pending;
|
|
75
|
+
};
|
|
67
76
|
/**
|
|
68
|
-
* The inside of an attachment tile
|
|
69
|
-
* `
|
|
70
|
-
*
|
|
71
|
-
* load falls back to the extension.
|
|
77
|
+
* The inside of an attachment tile, holding the `Image`, `Icon`, `Extension`,
|
|
78
|
+
* `Skeleton` and `Name` that read its file. A source that fails to load falls
|
|
79
|
+
* back to the icon and the extension.
|
|
72
80
|
*
|
|
73
81
|
* @example
|
|
74
|
-
* <AttachmentTile.Preview name="nota.pdf"
|
|
82
|
+
* <AttachmentTile.Preview name="nota.pdf" src={undefined}>
|
|
83
|
+
* <AttachmentTile.Image />
|
|
84
|
+
* <AttachmentTile.Extension />
|
|
85
|
+
* <AttachmentTile.Name />
|
|
86
|
+
* </AttachmentTile.Preview>
|
|
75
87
|
*/
|
|
76
88
|
var AttachmentPreview = (t0) => {
|
|
77
|
-
const $ = c(
|
|
89
|
+
const $ = c(22);
|
|
78
90
|
let className;
|
|
79
|
-
let hint;
|
|
80
|
-
let icon;
|
|
81
91
|
let name;
|
|
82
92
|
let props;
|
|
83
93
|
let src;
|
|
84
94
|
let t1;
|
|
85
95
|
if ($[0] !== t0) {
|
|
86
|
-
({name,
|
|
96
|
+
({name, src, pending: t1, className, ...props} = t0);
|
|
87
97
|
$[0] = t0;
|
|
88
98
|
$[1] = className;
|
|
89
|
-
$[2] =
|
|
90
|
-
$[3] =
|
|
91
|
-
$[4] =
|
|
92
|
-
$[5] =
|
|
93
|
-
$[6] = src;
|
|
94
|
-
$[7] = t1;
|
|
99
|
+
$[2] = name;
|
|
100
|
+
$[3] = props;
|
|
101
|
+
$[4] = src;
|
|
102
|
+
$[5] = t1;
|
|
95
103
|
} else {
|
|
96
104
|
className = $[1];
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
src = $[6];
|
|
102
|
-
t1 = $[7];
|
|
105
|
+
name = $[2];
|
|
106
|
+
props = $[3];
|
|
107
|
+
src = $[4];
|
|
108
|
+
t1 = $[5];
|
|
103
109
|
}
|
|
104
110
|
const pending = t1 === void 0 ? false : t1;
|
|
105
111
|
const [loadedSrc, setLoadedSrc] = useState();
|
|
106
112
|
const [brokenSrc, setBrokenSrc] = useState();
|
|
107
|
-
let t2;
|
|
108
|
-
if ($[8] !== name) {
|
|
109
|
-
t2 = extensionOf(name);
|
|
110
|
-
$[8] = name;
|
|
111
|
-
$[9] = t2;
|
|
112
|
-
} else t2 = $[9];
|
|
113
|
-
const extension = t2;
|
|
114
113
|
const image = src === brokenSrc ? void 0 : src;
|
|
115
|
-
const
|
|
114
|
+
const t2 = pending || image !== void 0 && image !== loadedSrc;
|
|
115
|
+
let t3;
|
|
116
|
+
if ($[6] !== t2) {
|
|
117
|
+
t3 = { busy: t2 };
|
|
118
|
+
$[6] = t2;
|
|
119
|
+
$[7] = t3;
|
|
120
|
+
} else t3 = $[7];
|
|
121
|
+
const busy = useBusyPhase(t3) !== "fresh";
|
|
116
122
|
let t4;
|
|
117
|
-
if ($[10] !==
|
|
118
|
-
t4 = {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
+
if ($[8] !== busy || $[9] !== image || $[10] !== name || $[11] !== pending) {
|
|
124
|
+
t4 = {
|
|
125
|
+
name,
|
|
126
|
+
image,
|
|
127
|
+
pending,
|
|
128
|
+
busy,
|
|
129
|
+
onLoaded: setLoadedSrc,
|
|
130
|
+
onBroken: setBrokenSrc
|
|
131
|
+
};
|
|
132
|
+
$[8] = busy;
|
|
133
|
+
$[9] = image;
|
|
134
|
+
$[10] = name;
|
|
135
|
+
$[11] = pending;
|
|
136
|
+
$[12] = t4;
|
|
137
|
+
} else t4 = $[12];
|
|
123
138
|
let t5;
|
|
124
|
-
if ($[
|
|
125
|
-
t5 = (
|
|
139
|
+
if ($[13] !== className) {
|
|
140
|
+
t5 = clsx(attachment_tile_module_default.preview, className);
|
|
141
|
+
$[13] = className;
|
|
142
|
+
$[14] = t5;
|
|
143
|
+
} else t5 = $[14];
|
|
144
|
+
const t6 = busy || void 0;
|
|
145
|
+
let t7;
|
|
146
|
+
if ($[15] !== props || $[16] !== t5 || $[17] !== t6) {
|
|
147
|
+
t7 = /* @__PURE__ */ jsx("span", {
|
|
148
|
+
...props,
|
|
149
|
+
className: t5,
|
|
150
|
+
"aria-busy": t6
|
|
151
|
+
});
|
|
152
|
+
$[15] = props;
|
|
153
|
+
$[16] = t5;
|
|
154
|
+
$[17] = t6;
|
|
155
|
+
$[18] = t7;
|
|
156
|
+
} else t7 = $[18];
|
|
157
|
+
let t8;
|
|
158
|
+
if ($[19] !== t4 || $[20] !== t7) {
|
|
159
|
+
t8 = /* @__PURE__ */ jsx(PreviewContext, {
|
|
160
|
+
value: t4,
|
|
161
|
+
children: t7
|
|
162
|
+
});
|
|
163
|
+
$[19] = t4;
|
|
164
|
+
$[20] = t7;
|
|
165
|
+
$[21] = t8;
|
|
166
|
+
} else t8 = $[21];
|
|
167
|
+
return t8;
|
|
168
|
+
};
|
|
169
|
+
/**
|
|
170
|
+
* The image, once there is a source that loads. Renders nothing otherwise.
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* <AttachmentTile.Image />
|
|
174
|
+
*/
|
|
175
|
+
var AttachmentImage = (t0) => {
|
|
176
|
+
const $ = c(31);
|
|
177
|
+
let className;
|
|
178
|
+
let props;
|
|
179
|
+
let ref;
|
|
180
|
+
let render;
|
|
181
|
+
if ($[0] !== t0) {
|
|
182
|
+
({className, render, ref, ...props} = t0);
|
|
183
|
+
$[0] = t0;
|
|
184
|
+
$[1] = className;
|
|
185
|
+
$[2] = props;
|
|
186
|
+
$[3] = ref;
|
|
187
|
+
$[4] = render;
|
|
188
|
+
} else {
|
|
189
|
+
className = $[1];
|
|
190
|
+
props = $[2];
|
|
191
|
+
ref = $[3];
|
|
192
|
+
render = $[4];
|
|
193
|
+
}
|
|
194
|
+
const { image, onLoaded, onBroken } = usePreview();
|
|
195
|
+
let t1;
|
|
196
|
+
if ($[5] !== image || $[6] !== onBroken || $[7] !== onLoaded) {
|
|
197
|
+
t1 = (node) => {
|
|
126
198
|
if (image === void 0 || !node?.complete) return;
|
|
127
199
|
if (node.naturalWidth === 0) {
|
|
128
|
-
|
|
200
|
+
onBroken(image);
|
|
129
201
|
return;
|
|
130
202
|
}
|
|
131
|
-
|
|
203
|
+
onLoaded(image);
|
|
132
204
|
};
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
|
|
136
|
-
|
|
205
|
+
$[5] = image;
|
|
206
|
+
$[6] = onBroken;
|
|
207
|
+
$[7] = onLoaded;
|
|
208
|
+
$[8] = t1;
|
|
209
|
+
} else t1 = $[8];
|
|
210
|
+
const settleAlreadyDecoded = t1;
|
|
211
|
+
let t2;
|
|
212
|
+
if ($[9] !== ref || $[10] !== settleAlreadyDecoded) {
|
|
213
|
+
t2 = ref === void 0 ? settleAlreadyDecoded : [ref, settleAlreadyDecoded];
|
|
214
|
+
$[9] = ref;
|
|
215
|
+
$[10] = settleAlreadyDecoded;
|
|
216
|
+
$[11] = t2;
|
|
217
|
+
} else t2 = $[11];
|
|
218
|
+
const t3 = image !== void 0;
|
|
219
|
+
let t4;
|
|
220
|
+
if ($[12] !== className) {
|
|
221
|
+
t4 = clsx(attachment_tile_module_default.image, className);
|
|
222
|
+
$[12] = className;
|
|
223
|
+
$[13] = t4;
|
|
224
|
+
} else t4 = $[13];
|
|
225
|
+
let t5;
|
|
226
|
+
if ($[14] !== image || $[15] !== onLoaded) {
|
|
227
|
+
t5 = () => {
|
|
228
|
+
if (image !== void 0) onLoaded(image);
|
|
229
|
+
};
|
|
230
|
+
$[14] = image;
|
|
231
|
+
$[15] = onLoaded;
|
|
232
|
+
$[16] = t5;
|
|
233
|
+
} else t5 = $[16];
|
|
137
234
|
let t6;
|
|
138
|
-
if ($[
|
|
139
|
-
t6 =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
children: icon
|
|
150
|
-
}), extension === "" ? null : /* @__PURE__ */ jsx("span", {
|
|
151
|
-
className: attachment_tile_module_default.extension,
|
|
152
|
-
children: extension
|
|
153
|
-
})] }) : /* @__PURE__ */ jsx("img", {
|
|
154
|
-
ref: settleAlreadyDecoded,
|
|
155
|
-
src: image,
|
|
235
|
+
if ($[17] !== image || $[18] !== onBroken) {
|
|
236
|
+
t6 = () => {
|
|
237
|
+
if (image !== void 0) onBroken(image);
|
|
238
|
+
};
|
|
239
|
+
$[17] = image;
|
|
240
|
+
$[18] = onBroken;
|
|
241
|
+
$[19] = t6;
|
|
242
|
+
} else t6 = $[19];
|
|
243
|
+
let t7;
|
|
244
|
+
if ($[20] !== image || $[21] !== props || $[22] !== t4 || $[23] !== t5 || $[24] !== t6) {
|
|
245
|
+
t7 = {
|
|
156
246
|
alt: "",
|
|
157
|
-
className: attachment_tile_module_default.image,
|
|
158
|
-
onLoad: () => setLoadedSrc(image),
|
|
159
|
-
onError: () => setBrokenSrc(image)
|
|
160
|
-
});
|
|
161
|
-
$[16] = extension;
|
|
162
|
-
$[17] = icon;
|
|
163
|
-
$[18] = image;
|
|
164
|
-
$[19] = pending;
|
|
165
|
-
$[20] = settleAlreadyDecoded;
|
|
166
|
-
$[21] = t8;
|
|
167
|
-
} else t8 = $[21];
|
|
168
|
-
let t9;
|
|
169
|
-
if ($[22] !== busy) {
|
|
170
|
-
t9 = busy ? /* @__PURE__ */ jsx(Skeleton, { className: attachment_tile_module_default.imageSkeleton }) : null;
|
|
171
|
-
$[22] = busy;
|
|
172
|
-
$[23] = t9;
|
|
173
|
-
} else t9 = $[23];
|
|
174
|
-
let t10;
|
|
175
|
-
if ($[24] !== name) {
|
|
176
|
-
t10 = /* @__PURE__ */ jsx("span", {
|
|
177
|
-
className: attachment_tile_module_default.name,
|
|
178
|
-
children: name
|
|
179
|
-
});
|
|
180
|
-
$[24] = name;
|
|
181
|
-
$[25] = t10;
|
|
182
|
-
} else t10 = $[25];
|
|
183
|
-
let t11;
|
|
184
|
-
if ($[26] !== props || $[27] !== t10 || $[28] !== t6 || $[29] !== t7 || $[30] !== t8 || $[31] !== t9) {
|
|
185
|
-
t11 = /* @__PURE__ */ jsxs("span", {
|
|
186
247
|
...props,
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
248
|
+
src: image,
|
|
249
|
+
className: t4,
|
|
250
|
+
onLoad: t5,
|
|
251
|
+
onError: t6
|
|
252
|
+
};
|
|
253
|
+
$[20] = image;
|
|
254
|
+
$[21] = props;
|
|
255
|
+
$[22] = t4;
|
|
256
|
+
$[23] = t5;
|
|
257
|
+
$[24] = t6;
|
|
258
|
+
$[25] = t7;
|
|
259
|
+
} else t7 = $[25];
|
|
260
|
+
let t8;
|
|
261
|
+
if ($[26] !== render || $[27] !== t2 || $[28] !== t3 || $[29] !== t7) {
|
|
262
|
+
t8 = {
|
|
263
|
+
defaultTagName: "img",
|
|
264
|
+
render,
|
|
265
|
+
ref: t2,
|
|
266
|
+
enabled: t3,
|
|
267
|
+
props: t7
|
|
268
|
+
};
|
|
269
|
+
$[26] = render;
|
|
270
|
+
$[27] = t2;
|
|
271
|
+
$[28] = t3;
|
|
198
272
|
$[29] = t7;
|
|
199
273
|
$[30] = t8;
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
274
|
+
} else t8 = $[30];
|
|
275
|
+
return useRender(t8);
|
|
276
|
+
};
|
|
277
|
+
/**
|
|
278
|
+
* A file-type glyph where there is no image, such as a document icon. Renders
|
|
279
|
+
* nothing without children.
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* <AttachmentTile.Icon><DescriptionIcon /></AttachmentTile.Icon>
|
|
283
|
+
*/
|
|
284
|
+
var AttachmentIcon = (t0) => {
|
|
285
|
+
const $ = c(17);
|
|
286
|
+
let children;
|
|
287
|
+
let className;
|
|
288
|
+
let props;
|
|
289
|
+
let ref;
|
|
290
|
+
let render;
|
|
291
|
+
if ($[0] !== t0) {
|
|
292
|
+
({className, render, ref, children, ...props} = t0);
|
|
293
|
+
$[0] = t0;
|
|
294
|
+
$[1] = children;
|
|
295
|
+
$[2] = className;
|
|
296
|
+
$[3] = props;
|
|
297
|
+
$[4] = ref;
|
|
298
|
+
$[5] = render;
|
|
299
|
+
} else {
|
|
300
|
+
children = $[1];
|
|
301
|
+
className = $[2];
|
|
302
|
+
props = $[3];
|
|
303
|
+
ref = $[4];
|
|
304
|
+
render = $[5];
|
|
305
|
+
}
|
|
306
|
+
const t1 = useFallbackShown() && children !== void 0 && children !== null && children !== false;
|
|
307
|
+
let t2;
|
|
308
|
+
if ($[6] !== className) {
|
|
309
|
+
t2 = clsx(attachment_tile_module_default.icon, className);
|
|
310
|
+
$[6] = className;
|
|
311
|
+
$[7] = t2;
|
|
312
|
+
} else t2 = $[7];
|
|
313
|
+
let t3;
|
|
314
|
+
if ($[8] !== children || $[9] !== props || $[10] !== t2) {
|
|
315
|
+
t3 = {
|
|
316
|
+
"aria-hidden": true,
|
|
317
|
+
...props,
|
|
318
|
+
className: t2,
|
|
319
|
+
children
|
|
320
|
+
};
|
|
321
|
+
$[8] = children;
|
|
322
|
+
$[9] = props;
|
|
323
|
+
$[10] = t2;
|
|
324
|
+
$[11] = t3;
|
|
325
|
+
} else t3 = $[11];
|
|
326
|
+
let t4;
|
|
327
|
+
if ($[12] !== ref || $[13] !== render || $[14] !== t1 || $[15] !== t3) {
|
|
328
|
+
t4 = {
|
|
329
|
+
defaultTagName: "span",
|
|
330
|
+
render,
|
|
331
|
+
ref,
|
|
332
|
+
enabled: t1,
|
|
333
|
+
props: t3
|
|
334
|
+
};
|
|
335
|
+
$[12] = ref;
|
|
336
|
+
$[13] = render;
|
|
337
|
+
$[14] = t1;
|
|
338
|
+
$[15] = t3;
|
|
339
|
+
$[16] = t4;
|
|
340
|
+
} else t4 = $[16];
|
|
341
|
+
return useRender(t4);
|
|
342
|
+
};
|
|
343
|
+
/**
|
|
344
|
+
* The file's extension where there is no image, such as "pdf". Renders
|
|
345
|
+
* nothing for a name without one.
|
|
346
|
+
*
|
|
347
|
+
* @example
|
|
348
|
+
* <AttachmentTile.Extension />
|
|
349
|
+
*/
|
|
350
|
+
var AttachmentExtension = (t0) => {
|
|
351
|
+
const $ = c(18);
|
|
352
|
+
let className;
|
|
353
|
+
let props;
|
|
354
|
+
let ref;
|
|
355
|
+
let render;
|
|
356
|
+
if ($[0] !== t0) {
|
|
357
|
+
({className, render, ref, ...props} = t0);
|
|
358
|
+
$[0] = t0;
|
|
359
|
+
$[1] = className;
|
|
360
|
+
$[2] = props;
|
|
361
|
+
$[3] = ref;
|
|
362
|
+
$[4] = render;
|
|
363
|
+
} else {
|
|
364
|
+
className = $[1];
|
|
365
|
+
props = $[2];
|
|
366
|
+
ref = $[3];
|
|
367
|
+
render = $[4];
|
|
368
|
+
}
|
|
369
|
+
const { name } = usePreview();
|
|
370
|
+
const shown = useFallbackShown();
|
|
371
|
+
let t1;
|
|
372
|
+
if ($[5] !== name) {
|
|
373
|
+
t1 = extensionOf(name);
|
|
374
|
+
$[5] = name;
|
|
375
|
+
$[6] = t1;
|
|
376
|
+
} else t1 = $[6];
|
|
377
|
+
const extension = t1;
|
|
378
|
+
const t2 = shown && extension !== "";
|
|
379
|
+
let t3;
|
|
380
|
+
if ($[7] !== className) {
|
|
381
|
+
t3 = clsx(attachment_tile_module_default.extension, className);
|
|
382
|
+
$[7] = className;
|
|
383
|
+
$[8] = t3;
|
|
384
|
+
} else t3 = $[8];
|
|
385
|
+
let t4;
|
|
386
|
+
if ($[9] !== extension || $[10] !== props || $[11] !== t3) {
|
|
387
|
+
t4 = {
|
|
388
|
+
...props,
|
|
389
|
+
className: t3,
|
|
390
|
+
children: extension
|
|
391
|
+
};
|
|
392
|
+
$[9] = extension;
|
|
393
|
+
$[10] = props;
|
|
394
|
+
$[11] = t3;
|
|
395
|
+
$[12] = t4;
|
|
396
|
+
} else t4 = $[12];
|
|
397
|
+
let t5;
|
|
398
|
+
if ($[13] !== ref || $[14] !== render || $[15] !== t2 || $[16] !== t4) {
|
|
399
|
+
t5 = {
|
|
400
|
+
defaultTagName: "span",
|
|
401
|
+
render,
|
|
402
|
+
ref,
|
|
403
|
+
enabled: t2,
|
|
404
|
+
props: t4
|
|
405
|
+
};
|
|
406
|
+
$[13] = ref;
|
|
407
|
+
$[14] = render;
|
|
408
|
+
$[15] = t2;
|
|
409
|
+
$[16] = t4;
|
|
410
|
+
$[17] = t5;
|
|
411
|
+
} else t5 = $[17];
|
|
412
|
+
return useRender(t5);
|
|
413
|
+
};
|
|
414
|
+
/**
|
|
415
|
+
* The placeholder while the image is still on its way. Renders nothing once it
|
|
416
|
+
* has arrived.
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* <AttachmentTile.Skeleton />
|
|
420
|
+
*/
|
|
421
|
+
var AttachmentSkeleton = (t0) => {
|
|
422
|
+
const { className } = t0;
|
|
423
|
+
return usePreview().busy ? /* @__PURE__ */ jsx(Skeleton, { className: clsx(attachment_tile_module_default.imageSkeleton, className) }) : null;
|
|
424
|
+
};
|
|
425
|
+
/**
|
|
426
|
+
* The file's name, for assistive tech only.
|
|
427
|
+
*
|
|
428
|
+
* @example
|
|
429
|
+
* <AttachmentTile.Name />
|
|
430
|
+
*/
|
|
431
|
+
var AttachmentName = (t0) => {
|
|
432
|
+
const $ = c(15);
|
|
433
|
+
let className;
|
|
434
|
+
let props;
|
|
435
|
+
let ref;
|
|
436
|
+
let render;
|
|
437
|
+
if ($[0] !== t0) {
|
|
438
|
+
({className, render, ref, ...props} = t0);
|
|
439
|
+
$[0] = t0;
|
|
440
|
+
$[1] = className;
|
|
441
|
+
$[2] = props;
|
|
442
|
+
$[3] = ref;
|
|
443
|
+
$[4] = render;
|
|
444
|
+
} else {
|
|
445
|
+
className = $[1];
|
|
446
|
+
props = $[2];
|
|
447
|
+
ref = $[3];
|
|
448
|
+
render = $[4];
|
|
449
|
+
}
|
|
450
|
+
const { name } = usePreview();
|
|
451
|
+
let t1;
|
|
452
|
+
if ($[5] !== className) {
|
|
453
|
+
t1 = clsx(attachment_tile_module_default.name, className);
|
|
454
|
+
$[5] = className;
|
|
455
|
+
$[6] = t1;
|
|
456
|
+
} else t1 = $[6];
|
|
457
|
+
let t2;
|
|
458
|
+
if ($[7] !== name || $[8] !== props || $[9] !== t1) {
|
|
459
|
+
t2 = {
|
|
460
|
+
...props,
|
|
461
|
+
className: t1,
|
|
462
|
+
children: name
|
|
463
|
+
};
|
|
464
|
+
$[7] = name;
|
|
465
|
+
$[8] = props;
|
|
466
|
+
$[9] = t1;
|
|
467
|
+
$[10] = t2;
|
|
468
|
+
} else t2 = $[10];
|
|
469
|
+
let t3;
|
|
470
|
+
if ($[11] !== ref || $[12] !== render || $[13] !== t2) {
|
|
471
|
+
t3 = {
|
|
472
|
+
defaultTagName: "span",
|
|
473
|
+
render,
|
|
474
|
+
ref,
|
|
475
|
+
props: t2
|
|
476
|
+
};
|
|
477
|
+
$[11] = ref;
|
|
478
|
+
$[12] = render;
|
|
479
|
+
$[13] = t2;
|
|
480
|
+
$[14] = t3;
|
|
481
|
+
} else t3 = $[14];
|
|
482
|
+
return useRender(t3);
|
|
214
483
|
};
|
|
215
|
-
export { AttachmentPreview, useAttachmentPreview };
|
|
484
|
+
export { AttachmentExtension, AttachmentIcon, AttachmentImage, AttachmentName, AttachmentPreview, AttachmentSkeleton, useAttachmentPreview };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
@layer kit.reset, kit.base, kit.components;
|
|
2
2
|
@layer kit.components {
|
|
3
|
-
.
|
|
3
|
+
._tile_1h7zv_3 {
|
|
4
4
|
--_tile-size: var(--attachment-tile-size, 5rem);
|
|
5
|
-
--_tile-border-width:
|
|
5
|
+
--_tile-border-width: var(
|
|
6
|
+
--attachment-tile-border-width,
|
|
7
|
+
1px
|
|
8
|
+
);
|
|
6
9
|
--_tile-radius: var(
|
|
7
10
|
--attachment-tile-radius,
|
|
8
11
|
var(--sys-radius-sm)
|
|
@@ -14,74 +17,77 @@
|
|
|
14
17
|
box-sizing: border-box;
|
|
15
18
|
inline-size: var(--_tile-size);
|
|
16
19
|
block-size: var(--_tile-size);
|
|
17
|
-
border: var(--_tile-border-width) solid transparent;
|
|
20
|
+
border: var(--_tile-border-width) solid var(--attachment-tile-border, transparent);
|
|
18
21
|
border-radius: var(--_tile-radius);
|
|
19
22
|
background: var(--attachment-tile-bg, var(--sys-color-surface-highest));
|
|
20
23
|
color: var(--attachment-tile-fg, var(--sys-color-text-muted));
|
|
21
24
|
cursor: default;
|
|
22
25
|
}
|
|
23
|
-
.
|
|
26
|
+
._tile_1h7zv_3 {
|
|
24
27
|
outline: 0 solid var(--sys-color-focus-ring);
|
|
25
28
|
outline-offset: var(--sys-focus-ring-offset);
|
|
26
29
|
}
|
|
27
|
-
.
|
|
30
|
+
._tile_1h7zv_3:focus-visible {
|
|
28
31
|
outline-width: var(--sys-focus-ring-width);
|
|
29
32
|
}
|
|
30
|
-
.
|
|
33
|
+
._tile_1h7zv_3[data-focus-visible] {
|
|
31
34
|
outline-width: var(--sys-focus-ring-width);
|
|
32
35
|
}
|
|
33
|
-
.
|
|
34
|
-
border-color: var(--sys-color-error-border);
|
|
35
|
-
background: var(--sys-color-error-bg);
|
|
36
|
-
color: var(--sys-color-error-fg);
|
|
36
|
+
._tile_1h7zv_3[data-invalid] {
|
|
37
|
+
border-color: var(--attachment-tile-invalid-border, var(--sys-color-error-border));
|
|
38
|
+
background: var(--attachment-tile-invalid-bg, var(--sys-color-error-bg));
|
|
39
|
+
color: var(--attachment-tile-invalid-fg, var(--sys-color-error-fg));
|
|
37
40
|
}
|
|
38
|
-
.
|
|
41
|
+
._tile_1h7zv_3:any-link {
|
|
39
42
|
display: block;
|
|
40
43
|
color: var(--attachment-tile-fg, var(--sys-color-text-muted));
|
|
41
44
|
text-decoration: none;
|
|
42
45
|
cursor: pointer;
|
|
43
46
|
}
|
|
44
|
-
.
|
|
47
|
+
._tile_1h7zv_3:any-link:hover {
|
|
45
48
|
border-color: var(--attachment-tile-hover-border, var(--sys-color-primary));
|
|
46
49
|
color: var(--attachment-tile-fg, var(--sys-color-text-muted));
|
|
47
50
|
}
|
|
48
|
-
.
|
|
51
|
+
._preview_1h7zv_51 {
|
|
49
52
|
display: flex;
|
|
50
53
|
flex-direction: column;
|
|
51
54
|
align-items: center;
|
|
52
55
|
justify-content: center;
|
|
53
|
-
gap: var(--sys-unit-2);
|
|
56
|
+
gap: var(--attachment-tile-gap, var(--sys-unit-2));
|
|
54
57
|
position: absolute;
|
|
55
58
|
inset: 0;
|
|
56
59
|
overflow: hidden;
|
|
57
60
|
border-radius: var(--_tile-inner-radius);
|
|
58
61
|
}
|
|
59
|
-
.
|
|
62
|
+
._image_1h7zv_62 {
|
|
60
63
|
inline-size: 100%;
|
|
61
64
|
block-size: 100%;
|
|
62
65
|
object-fit: cover;
|
|
63
66
|
}
|
|
64
|
-
.
|
|
65
|
-
--skeleton-bg: var(
|
|
67
|
+
._imageSkeleton_1h7zv_67 {
|
|
68
|
+
--skeleton-bg: var(
|
|
69
|
+
--attachment-tile-skeleton-bg,
|
|
70
|
+
var(--sys-color-outline)
|
|
71
|
+
);
|
|
66
72
|
position: absolute;
|
|
67
73
|
inset: 0;
|
|
68
74
|
border-radius: var(--_tile-inner-radius);
|
|
69
75
|
block-size: auto;
|
|
70
76
|
}
|
|
71
|
-
.
|
|
77
|
+
._icon_1h7zv_77 {
|
|
72
78
|
display: inline-flex;
|
|
73
79
|
font-size: var(--attachment-tile-icon-size, 1.5em);
|
|
74
80
|
}
|
|
75
|
-
.
|
|
81
|
+
._icon_1h7zv_77 > svg {
|
|
76
82
|
inline-size: 1em;
|
|
77
83
|
block-size: 1em;
|
|
78
84
|
fill: currentcolor;
|
|
79
85
|
}
|
|
80
|
-
.
|
|
81
|
-
font: var(--sys-font-label-small);
|
|
86
|
+
._extension_1h7zv_86 {
|
|
87
|
+
font: var(--attachment-tile-extension-font, var(--sys-font-label-small));
|
|
82
88
|
text-transform: uppercase;
|
|
83
89
|
}
|
|
84
|
-
.
|
|
90
|
+
._name_1h7zv_90 {
|
|
85
91
|
position: absolute;
|
|
86
92
|
overflow: hidden;
|
|
87
93
|
clip-path: inset(50%);
|
|
@@ -89,13 +95,13 @@
|
|
|
89
95
|
block-size: 1px;
|
|
90
96
|
white-space: nowrap;
|
|
91
97
|
}
|
|
92
|
-
.
|
|
98
|
+
._remove_1h7zv_98 {
|
|
93
99
|
display: grid;
|
|
94
100
|
place-items: center;
|
|
95
101
|
position: absolute;
|
|
96
102
|
inset-block-start: calc(-1 * var(--sys-unit-2));
|
|
97
103
|
inset-inline-end: calc(-1 * var(--sys-unit-2));
|
|
98
|
-
border-radius: var(--sys-radius-circle);
|
|
99
|
-
background: var(--sys-color-surface);
|
|
104
|
+
border-radius: var(--attachment-tile-remove-radius, var(--sys-radius-circle));
|
|
105
|
+
background: var(--attachment-tile-remove-bg, var(--sys-color-surface));
|
|
100
106
|
}
|
|
101
107
|
}
|