@krak-stack/registry 0.1.47 → 0.1.48

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @krak-stack/registry
2
2
 
3
+ ## 0.1.48
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix Effect Form image previews for newly selected and replacement files. Use full-width image attachment rows with consistently sized, bordered previews, truncated filenames, compact file type and size metadata, and replace/delete actions aligned to the right. Replace the refresh icon with upload icons for changing images and files.
8
+
3
9
  ## 0.1.47
4
10
 
5
11
  ### Patch Changes
@@ -170,7 +170,7 @@ import {
170
170
  useRef,
171
171
  useState
172
172
  } from "react";
173
- import { CloudUpload, FileIcon, FileUp, RefreshCw, Trash2 } from "lucide-react";
173
+ import { CloudUpload, FileIcon, FileUp, ImageUp, Trash2 } from "lucide-react";
174
174
  import { Schema } from "effect";
175
175
 
176
176
  // ../../src/components/ui/attachment.tsx
@@ -350,7 +350,7 @@ var formatBytes = (bytes, locale) => {
350
350
  }).format(value);
351
351
  };
352
352
  var fileDescription = (file, locale) => [
353
- file.type || file.name.split(".").pop()?.toUpperCase(),
353
+ (file.name.includes(".") ? file.name.split(".").pop()?.toUpperCase() : "") || file.type.split("/").pop()?.toUpperCase(),
354
354
  formatBytes(file.size, locale)
355
355
  ].filter(Boolean).join(" · ");
356
356
  var FilePicker = ({
@@ -564,40 +564,44 @@ var FilePicker = ({
564
564
  return /* @__PURE__ */ jsxs2(Fragment, {
565
565
  children: [
566
566
  /* @__PURE__ */ jsxs2(Attachment, {
567
- className: image ? "w-fit max-w-full" : "w-full",
568
- orientation: image ? "vertical" : "horizontal",
567
+ className: "w-full",
568
+ orientation: "horizontal",
569
569
  state: invalid ? "error" : "done",
570
570
  children: [
571
571
  /* @__PURE__ */ jsx5(AttachmentMedia, {
572
572
  variant: image ? "image" : "icon",
573
- className: image ? "aspect-auto w-full max-w-full [&_img]:aspect-auto! [&_img]:object-contain!" : undefined,
573
+ className: image ? "aspect-auto max-w-full border [&_img]:aspect-auto! [&_img]:object-contain!" : undefined,
574
+ style: image ? {
575
+ width: image.width,
576
+ aspectRatio: `${image.width} / ${image.height}`
577
+ } : undefined,
574
578
  children: image && imageUrl ? /* @__PURE__ */ jsx5("img", {
575
579
  src: imageUrl,
576
580
  alt: image.alt,
577
581
  width: image.width,
578
582
  height: image.height,
579
- className: "h-auto max-w-full object-contain",
580
- style: { maxHeight: image.height }
583
+ className: "size-full object-contain"
581
584
  }) : /* @__PURE__ */ jsx5(FileIcon, {})
582
585
  }),
583
586
  /* @__PURE__ */ jsxs2(AttachmentContent, {
584
- className: image ? "w-full" : undefined,
585
587
  children: [
586
588
  /* @__PURE__ */ jsx5(AttachmentTitle, {
587
- children: title
589
+ children: file?.name ?? title
588
590
  }),
589
591
  file ? /* @__PURE__ */ jsx5(AttachmentDescription, {
592
+ className: "break-words",
590
593
  children: fileDescription(file, locale)
591
594
  }) : null
592
595
  ]
593
596
  }),
594
597
  /* @__PURE__ */ jsxs2(AttachmentActions, {
598
+ className: "ml-auto gap-1",
595
599
  children: [
596
600
  /* @__PURE__ */ jsx5(AttachmentAction, {
597
601
  type: "button",
598
602
  "aria-label": labels.replaceFile,
599
603
  onClick: () => inputRef.current?.click(),
600
- children: /* @__PURE__ */ jsx5(RefreshCw, {})
604
+ children: image ? /* @__PURE__ */ jsx5(ImageUp, {}) : /* @__PURE__ */ jsx5(FileUp, {})
601
605
  }),
602
606
  canClear ? /* @__PURE__ */ jsx5(AttachmentAction, {
603
607
  type: "button",
@@ -2010,14 +2014,12 @@ var ImageField = ({ field, props }) => {
2010
2014
  onBlur: field.onBlur,
2011
2015
  canClear: Boolean(field.value),
2012
2016
  ...field.value instanceof File ? { file: field.value } : {},
2013
- ...imageUrl ? {
2014
- image: {
2015
- alt: props.label,
2016
- height: props.size.height,
2017
- src: imageUrl,
2018
- width: props.size.width
2019
- }
2020
- } : {},
2017
+ image: {
2018
+ alt: props.label,
2019
+ height: props.size.height,
2020
+ src: imageUrl,
2021
+ width: props.size.width
2022
+ },
2021
2023
  id: field.path,
2022
2024
  invalid,
2023
2025
  locale: props.locale,
@@ -5,7 +5,7 @@ import {
5
5
  useRef,
6
6
  useState
7
7
  } from "react";
8
- import { CloudUpload, FileIcon, FileUp, RefreshCw, Trash2 } from "lucide-react";
8
+ import { CloudUpload, FileIcon, FileUp, ImageUp, Trash2 } from "lucide-react";
9
9
  import { Schema } from "effect";
10
10
 
11
11
  // ../../src/components/ui/attachment.tsx
@@ -233,7 +233,7 @@ var formatBytes = (bytes, locale) => {
233
233
  }).format(value);
234
234
  };
235
235
  var fileDescription = (file, locale) => [
236
- file.type || file.name.split(".").pop()?.toUpperCase(),
236
+ (file.name.includes(".") ? file.name.split(".").pop()?.toUpperCase() : "") || file.type.split("/").pop()?.toUpperCase(),
237
237
  formatBytes(file.size, locale)
238
238
  ].filter(Boolean).join(" · ");
239
239
  var FilePicker = ({
@@ -447,40 +447,44 @@ var FilePicker = ({
447
447
  return /* @__PURE__ */ jsxs(Fragment, {
448
448
  children: [
449
449
  /* @__PURE__ */ jsxs(Attachment, {
450
- className: image ? "w-fit max-w-full" : "w-full",
451
- orientation: image ? "vertical" : "horizontal",
450
+ className: "w-full",
451
+ orientation: "horizontal",
452
452
  state: invalid ? "error" : "done",
453
453
  children: [
454
454
  /* @__PURE__ */ jsx4(AttachmentMedia, {
455
455
  variant: image ? "image" : "icon",
456
- className: image ? "aspect-auto w-full max-w-full [&_img]:aspect-auto! [&_img]:object-contain!" : undefined,
456
+ className: image ? "aspect-auto max-w-full border [&_img]:aspect-auto! [&_img]:object-contain!" : undefined,
457
+ style: image ? {
458
+ width: image.width,
459
+ aspectRatio: `${image.width} / ${image.height}`
460
+ } : undefined,
457
461
  children: image && imageUrl ? /* @__PURE__ */ jsx4("img", {
458
462
  src: imageUrl,
459
463
  alt: image.alt,
460
464
  width: image.width,
461
465
  height: image.height,
462
- className: "h-auto max-w-full object-contain",
463
- style: { maxHeight: image.height }
466
+ className: "size-full object-contain"
464
467
  }) : /* @__PURE__ */ jsx4(FileIcon, {})
465
468
  }),
466
469
  /* @__PURE__ */ jsxs(AttachmentContent, {
467
- className: image ? "w-full" : undefined,
468
470
  children: [
469
471
  /* @__PURE__ */ jsx4(AttachmentTitle, {
470
- children: title
472
+ children: file?.name ?? title
471
473
  }),
472
474
  file ? /* @__PURE__ */ jsx4(AttachmentDescription, {
475
+ className: "break-words",
473
476
  children: fileDescription(file, locale)
474
477
  }) : null
475
478
  ]
476
479
  }),
477
480
  /* @__PURE__ */ jsxs(AttachmentActions, {
481
+ className: "ml-auto gap-1",
478
482
  children: [
479
483
  /* @__PURE__ */ jsx4(AttachmentAction, {
480
484
  type: "button",
481
485
  "aria-label": labels.replaceFile,
482
486
  onClick: () => inputRef.current?.click(),
483
- children: /* @__PURE__ */ jsx4(RefreshCw, {})
487
+ children: image ? /* @__PURE__ */ jsx4(ImageUp, {}) : /* @__PURE__ */ jsx4(FileUp, {})
484
488
  }),
485
489
  canClear ? /* @__PURE__ */ jsx4(AttachmentAction, {
486
490
  type: "button",
@@ -328,7 +328,7 @@ import {
328
328
  useRef,
329
329
  useState
330
330
  } from "react";
331
- import { CloudUpload, FileIcon, FileUp, RefreshCw, Trash2 } from "lucide-react";
331
+ import { CloudUpload, FileIcon, FileUp, ImageUp, Trash2 } from "lucide-react";
332
332
  import { Schema } from "effect";
333
333
 
334
334
  // ../../src/components/ui/attachment.tsx
@@ -496,7 +496,7 @@ var formatBytes = (bytes, locale) => {
496
496
  }).format(value);
497
497
  };
498
498
  var fileDescription = (file, locale) => [
499
- file.type || file.name.split(".").pop()?.toUpperCase(),
499
+ (file.name.includes(".") ? file.name.split(".").pop()?.toUpperCase() : "") || file.type.split("/").pop()?.toUpperCase(),
500
500
  formatBytes(file.size, locale)
501
501
  ].filter(Boolean).join(" · ");
502
502
  var FilePicker = ({
@@ -710,40 +710,44 @@ var FilePicker = ({
710
710
  return /* @__PURE__ */ jsxs3(Fragment, {
711
711
  children: [
712
712
  /* @__PURE__ */ jsxs3(Attachment, {
713
- className: image ? "w-fit max-w-full" : "w-full",
714
- orientation: image ? "vertical" : "horizontal",
713
+ className: "w-full",
714
+ orientation: "horizontal",
715
715
  state: invalid ? "error" : "done",
716
716
  children: [
717
717
  /* @__PURE__ */ jsx7(AttachmentMedia, {
718
718
  variant: image ? "image" : "icon",
719
- className: image ? "aspect-auto w-full max-w-full [&_img]:aspect-auto! [&_img]:object-contain!" : undefined,
719
+ className: image ? "aspect-auto max-w-full border [&_img]:aspect-auto! [&_img]:object-contain!" : undefined,
720
+ style: image ? {
721
+ width: image.width,
722
+ aspectRatio: `${image.width} / ${image.height}`
723
+ } : undefined,
720
724
  children: image && imageUrl ? /* @__PURE__ */ jsx7("img", {
721
725
  src: imageUrl,
722
726
  alt: image.alt,
723
727
  width: image.width,
724
728
  height: image.height,
725
- className: "h-auto max-w-full object-contain",
726
- style: { maxHeight: image.height }
729
+ className: "size-full object-contain"
727
730
  }) : /* @__PURE__ */ jsx7(FileIcon, {})
728
731
  }),
729
732
  /* @__PURE__ */ jsxs3(AttachmentContent, {
730
- className: image ? "w-full" : undefined,
731
733
  children: [
732
734
  /* @__PURE__ */ jsx7(AttachmentTitle, {
733
- children: title
735
+ children: file?.name ?? title
734
736
  }),
735
737
  file ? /* @__PURE__ */ jsx7(AttachmentDescription, {
738
+ className: "break-words",
736
739
  children: fileDescription(file, locale)
737
740
  }) : null
738
741
  ]
739
742
  }),
740
743
  /* @__PURE__ */ jsxs3(AttachmentActions, {
744
+ className: "ml-auto gap-1",
741
745
  children: [
742
746
  /* @__PURE__ */ jsx7(AttachmentAction, {
743
747
  type: "button",
744
748
  "aria-label": labels.replaceFile,
745
749
  onClick: () => inputRef.current?.click(),
746
- children: /* @__PURE__ */ jsx7(RefreshCw, {})
750
+ children: image ? /* @__PURE__ */ jsx7(ImageUp, {}) : /* @__PURE__ */ jsx7(FileUp, {})
747
751
  }),
748
752
  canClear ? /* @__PURE__ */ jsx7(AttachmentAction, {
749
753
  type: "button",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@krak-stack/registry",
3
- "version": "0.1.47",
3
+ "version": "0.1.48",
4
4
  "description": "Tree-shakable KrakStack components and Effect services.",
5
5
  "license": "MIT",
6
6
  "repository": {