@app-studio/web 0.9.28 → 0.9.30

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.
@@ -4012,13 +4012,13 @@
4012
4012
  textProps
4013
4013
  }), progress < 100 && (icon || /*#__PURE__*/React__default.createElement(UploadIcon, Object.assign({
4014
4014
  widthHeight: 32
4015
- }, iconProps))), !selectedFile && text && renderText({
4015
+ }, iconProps))), !isLoading && !selectedFile && text && renderText({
4016
4016
  text,
4017
4017
  textProps
4018
4018
  }), isLoading && renderProgress({
4019
4019
  progress,
4020
4020
  progressProps
4021
- }), errorMessage && renderError({
4021
+ }), !isLoading && errorMessage && renderError({
4022
4022
  errorMessage,
4023
4023
  errorMessageProps
4024
4024
  }), /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
@@ -17151,6 +17151,139 @@
17151
17151
  };
17152
17152
  FormikUploader.displayName = 'FormikUploader';
17153
17153
 
17154
+ var AttachmentPreview = _ref => {
17155
+ var {
17156
+ files,
17157
+ onRemove,
17158
+ maxHeight = '120px',
17159
+ views = {}
17160
+ } = _ref;
17161
+ if (files.length === 0) {
17162
+ return null;
17163
+ }
17164
+ var formatFileSize = React.useCallback(bytes => {
17165
+ if (bytes < 1024) return bytes + " B";
17166
+ if (bytes < 1024 * 1024) return (bytes / 1024).toFixed(1) + " KB";
17167
+ return (bytes / (1024 * 1024)).toFixed(1) + " MB";
17168
+ }, []);
17169
+ return /*#__PURE__*/React__default.createElement(appStudio.View, Object.assign({
17170
+ display: "flex",
17171
+ flexWrap: "wrap",
17172
+ gap: "6px",
17173
+ padding: "8px 0",
17174
+ maxHeight: maxHeight,
17175
+ overflowY: "auto"
17176
+ }, views == null ? void 0 : views.container), files.map((file, index) => {
17177
+ var previewUrl = file.url || '';
17178
+ var isImage = file.type.startsWith('image/');
17179
+ var isVideo = file.type.startsWith('video/');
17180
+ var isAudio = file.type.startsWith('audio/');
17181
+ return /*#__PURE__*/React__default.createElement(appStudio.Vertical, Object.assign({
17182
+ key: index,
17183
+ alignItems: "center",
17184
+ gap: "6px",
17185
+ padding: "4px 8px",
17186
+ borderRadius: "6px",
17187
+ backgroundColor: "color.gray.100",
17188
+ position: "relative",
17189
+ animate: {
17190
+ from: {
17191
+ opacity: 0,
17192
+ scale: 0.9
17193
+ },
17194
+ to: {
17195
+ opacity: 1,
17196
+ scale: 1
17197
+ }
17198
+ },
17199
+ animationDuration: 0.2
17200
+ }, views == null ? void 0 : views.item), /*#__PURE__*/React__default.createElement(HoverCard, null, /*#__PURE__*/React__default.createElement(HoverCard.Trigger, null, /*#__PURE__*/React__default.createElement(appStudio.View, {
17201
+ position: "relative"
17202
+ }, isImage && previewUrl && (/*#__PURE__*/React__default.createElement(appStudio.Image, {
17203
+ src: previewUrl,
17204
+ alt: file.name,
17205
+ width: "60px",
17206
+ height: "60px",
17207
+ objectFit: "cover",
17208
+ borderRadius: "4px"
17209
+ })), isVideo && previewUrl && (/*#__PURE__*/React__default.createElement(appStudio.View, {
17210
+ as: "video",
17211
+ src: previewUrl,
17212
+ alt: file.name,
17213
+ controls: false,
17214
+ muted: true,
17215
+ width: "60px",
17216
+ height: "60px",
17217
+ objectFit: "cover",
17218
+ borderRadius: "4px"
17219
+ })), isAudio && (/*#__PURE__*/React__default.createElement(appStudio.Center, {
17220
+ width: "60px",
17221
+ height: "60px",
17222
+ backgroundColor: "color.gray.200",
17223
+ borderRadius: "4px"
17224
+ }, /*#__PURE__*/React__default.createElement(AudioIcon, {
17225
+ widthHeight: 24,
17226
+ color: "color.black"
17227
+ }))), !isImage && !isVideo && !isAudio && (/*#__PURE__*/React__default.createElement(appStudio.Center, {
17228
+ width: "60px",
17229
+ height: "60px",
17230
+ backgroundColor: "color.gray.200",
17231
+ borderRadius: "4px"
17232
+ }, /*#__PURE__*/React__default.createElement(FileIcon, {
17233
+ widthHeight: 24,
17234
+ color: "color.black"
17235
+ }))), onRemove && (/*#__PURE__*/React__default.createElement(appStudio.Button, {
17236
+ position: "absolute",
17237
+ top: "-4px",
17238
+ right: "-4px",
17239
+ width: "20px",
17240
+ height: "20px",
17241
+ minWidth: "20px",
17242
+ minHeight: "20px",
17243
+ borderRadius: "50%",
17244
+ backgroundColor: "color.red.500",
17245
+ color: "white",
17246
+ fontSize: 14,
17247
+ fontWeight: "bold",
17248
+ padding: 0,
17249
+ display: "flex",
17250
+ alignItems: "center",
17251
+ justifyContent: "center",
17252
+ cursor: "pointer",
17253
+ border: "2px solid white",
17254
+ _hover: {
17255
+ backgroundColor: 'color.red.600'
17256
+ },
17257
+ onClick: e => {
17258
+ e.stopPropagation();
17259
+ onRemove(index);
17260
+ },
17261
+ "aria-label": "Remove " + file.name
17262
+ }, "\u00D7")))), /*#__PURE__*/React__default.createElement(HoverCard.Content, null, isImage && previewUrl && (/*#__PURE__*/React__default.createElement(appStudio.Image, {
17263
+ src: previewUrl,
17264
+ alt: file.name,
17265
+ maxWidth: "300px"
17266
+ })), isVideo && previewUrl && (/*#__PURE__*/React__default.createElement(appStudio.View, {
17267
+ as: "video",
17268
+ src: previewUrl,
17269
+ controls: true,
17270
+ maxWidth: "300px"
17271
+ })), isAudio && previewUrl && (/*#__PURE__*/React__default.createElement(appStudio.View, {
17272
+ as: "audio",
17273
+ src: previewUrl,
17274
+ controls: true,
17275
+ width: '100%'
17276
+ })), /*#__PURE__*/React__default.createElement(Text, Object.assign({
17277
+ marginTop: "4px",
17278
+ truncateText: true,
17279
+ textOverflow: "ellipsis",
17280
+ overflow: "hidden",
17281
+ width: '100%',
17282
+ fontSize: 12
17283
+ }, views == null ? void 0 : views.name), file.name, " (", formatFileSize(file.size), ")"))));
17284
+ }));
17285
+ };
17286
+
17154
17287
  var SliderComponent$1 = props => {
17155
17288
  // Get state and handlers from the custom hook
17156
17289
  var sliderState = useSliderState(props);
@@ -35630,6 +35763,7 @@
35630
35763
  exports.ArrowIcon = ArrowIcon;
35631
35764
  exports.AspectRatio = AspectRatio;
35632
35765
  exports.AttachmentIcon = AttachmentIcon;
35766
+ exports.AttachmentPreview = AttachmentPreview;
35633
35767
  exports.AudioIcon = AudioIcon;
35634
35768
  exports.AudioInput = AudioInput;
35635
35769
  exports.AudioWaveform = AudioWaveform;