lesli_view 1.1.8 → 1.1.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b051ad8d3095e8165722cc17edad60a932ec8659035f8f656ebd7f324141fa4
4
- data.tar.gz: 3bf4566301ae1a9363232c2280dfe6c418763855dc83b1fd90ee3f3f4d00d31c
3
+ metadata.gz: edb630d55bcc137e78d6ded67e9c43534dc966b3dde2b423abeb7f0ced17bfda
4
+ data.tar.gz: 7a765dfa925102e73302573a5a4b24c9636f0d8b2c36e7604e2026c2de201a35
5
5
  SHA512:
6
- metadata.gz: bd7b0d475ec84ef1e892b2d4950481d734b4b70454884fa00b9b6dfe08afeb4c4060b02cb61ab21bb06ad2fa8bdb960c8d6b45ba0f7eb371b43dba6084765979
7
- data.tar.gz: 11d498c4f1f9097af302c6abf8adf8437cf81efaf2311a3e542052d6f3709995f8e68ecc881ccf02ba5756e639f813904ae81db47cc1c8145c108dff94a3c07a
6
+ metadata.gz: 822e78e8c68b2f14a41dabdd3614dc762c72ccc2fbc6dbb56a34f69787fcfebcc9efd2072571e67c734d1d93951838719770229d5c71d0c045122e1db1485aae
7
+ data.tar.gz: 4565ca2fddc93a89e72a9ae94b25b4fc62dafa4a1c2ce778cb36963eb5ef1f55c8b53bfa891b72df9b05cd36dfc8628ea8db16d35a9da5d42007e9d04f79e181
@@ -1404,6 +1404,111 @@ Building a better future, one line of code at a time.
1404
1404
  gap: calc(var(--spacing, 0.25rem) * 3);
1405
1405
  justify-self: flex-end;
1406
1406
  }
1407
+ .lesli-image-upload {
1408
+ margin-bottom: calc(var(--spacing, 0.25rem) * 6);
1409
+ display: grid;
1410
+ min-width: 0px;
1411
+ gap: calc(var(--spacing, 0.25rem) * 3);
1412
+ }
1413
+ .lesli-image-upload-preview {
1414
+ display: flex;
1415
+ height: calc(var(--spacing, 0.25rem) * 28);
1416
+ width: calc(var(--spacing, 0.25rem) * 56);
1417
+ max-width: 100%;
1418
+ align-items: center;
1419
+ justify-content: center;
1420
+ border-radius: var(--radius-xl, 0.75rem);
1421
+ border-style: var(--tw-border-style);
1422
+ border-width: 1px;
1423
+ border-color: var(--lesli-color-neutral-200);
1424
+ background-color: var(--lesli-color-neutral-50);
1425
+ padding: calc(var(--spacing, 0.25rem) * 4);
1426
+ }
1427
+ .lesli-image-upload-preview img {
1428
+ height: 100%;
1429
+ width: 100%;
1430
+ object-fit: contain;
1431
+ }
1432
+ .lesli-image-upload-preview .material-symbols-outlined {
1433
+ font-size: var(--text-4xl, 2.25rem);
1434
+ line-height: var(--tw-leading, var(--text-4xl--line-height, calc(2.5 / 2.25)));
1435
+ color: var(--lesli-color-neutral-300);
1436
+ }
1437
+ .lesli-image-upload-input {
1438
+ display: block;
1439
+ width: 100%;
1440
+ max-width: var(--container-lg, 32rem);
1441
+ min-width: 0px;
1442
+ cursor: pointer;
1443
+ border-radius: var(--radius-xl, 0.75rem);
1444
+ border-style: var(--tw-border-style);
1445
+ border-width: 1px;
1446
+ border-color: var(--lesli-color-neutral-300);
1447
+ background-color: var(--color-white, #fff);
1448
+ padding: calc(var(--spacing, 0.25rem) * 2);
1449
+ font-size: var(--text-sm, 0.875rem);
1450
+ line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / 0.875)));
1451
+ color: var(--lesli-color-neutral-600);
1452
+ transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to, opacity, box-shadow, transform, translate, scale, rotate, filter, -webkit-backdrop-filter, backdrop-filter, display, content-visibility, overlay, pointer-events;
1453
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function, cubic-bezier(0.4, 0, 0.2, 1)));
1454
+ transition-duration: var(--tw-duration, var(--default-transition-duration, 150ms));
1455
+ &:focus-visible {
1456
+ border-color: var(--lesli-color-primary);
1457
+ }
1458
+ &:focus-visible {
1459
+ --tw-ring-shadow: var(--tw-ring-inset, ) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
1460
+ box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
1461
+ }
1462
+ &:focus-visible {
1463
+ --tw-ring-color: var(--lesli-color-primary);
1464
+ @supports (color: color-mix(in lab, red, red)) {
1465
+ --tw-ring-color: color-mix(in oklab, var(--lesli-color-primary) 10%, transparent);
1466
+ }
1467
+ }
1468
+ &:focus-visible {
1469
+ --tw-outline-style: none;
1470
+ outline-style: none;
1471
+ }
1472
+ }
1473
+ .lesli-image-upload-input::file-selector-button {
1474
+ margin-right: calc(var(--spacing, 0.25rem) * 3);
1475
+ cursor: pointer;
1476
+ border-radius: var(--radius-lg, 0.5rem);
1477
+ border-style: var(--tw-border-style);
1478
+ border-width: 0px;
1479
+ background-color: var(--lesli-color-primary-soft);
1480
+ padding-inline: calc(var(--spacing, 0.25rem) * 4);
1481
+ padding-block: calc(var(--spacing, 0.25rem) * 2);
1482
+ font-size: var(--text-sm, 0.875rem);
1483
+ line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / 0.875)));
1484
+ --tw-font-weight: var(--font-weight-medium, 500);
1485
+ font-weight: var(--font-weight-medium, 500);
1486
+ color: var(--lesli-color-primary-strong);
1487
+ transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
1488
+ transition-timing-function: var(--tw-ease, var(--default-transition-timing-function, cubic-bezier(0.4, 0, 0.2, 1)));
1489
+ transition-duration: var(--tw-duration, var(--default-transition-duration, 150ms));
1490
+ }
1491
+ .lesli-image-upload-input::file-selector-button:hover {
1492
+ background-color: var(--lesli-color-primary);
1493
+ color: var(--color-white, #fff);
1494
+ }
1495
+ .lesli-image-upload-input[aria-invalid="true"] {
1496
+ border-color: var(--lesli-color-danger-400);
1497
+ }
1498
+ .lesli-image-upload-help {
1499
+ font-size: var(--text-sm, 0.875rem);
1500
+ line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / 0.875)));
1501
+ --tw-leading: calc(var(--spacing, 0.25rem) * 5);
1502
+ line-height: calc(var(--spacing, 0.25rem) * 5);
1503
+ color: var(--lesli-color-neutral-500);
1504
+ }
1505
+ .lesli-image-upload-error {
1506
+ font-size: var(--text-sm, 0.875rem);
1507
+ line-height: var(--tw-leading, var(--text-sm--line-height, calc(1.25 / 0.875)));
1508
+ --tw-leading: calc(var(--spacing, 0.25rem) * 5);
1509
+ line-height: calc(var(--spacing, 0.25rem) * 5);
1510
+ color: var(--lesli-color-danger-700);
1511
+ }
1407
1512
  .lesli-panel {
1408
1513
  position: relative;
1409
1514
  z-index: 50;
@@ -3266,6 +3371,12 @@ Building a better future, one line of code at a time.
3266
3371
  & img {
3267
3372
  width: auto;
3268
3373
  }
3374
+ & img {
3375
+ max-width: calc(var(--spacing, 0.25rem) * 48);
3376
+ }
3377
+ & img {
3378
+ object-fit: contain;
3379
+ }
3269
3380
  }
3270
3381
  .lesli-application-header-actions {
3271
3382
  display: flex;
@@ -0,0 +1,41 @@
1
+ @layer components {
2
+ .lesli-image-upload {
3
+ @apply mb-6 grid min-w-0 gap-3;
4
+ }
5
+
6
+ .lesli-image-upload-preview {
7
+ @apply flex h-28 w-56 max-w-full items-center justify-center rounded-xl border border-neutral-200 bg-neutral-50 p-4;
8
+ }
9
+
10
+ .lesli-image-upload-preview img {
11
+ @apply h-full w-full object-contain;
12
+ }
13
+
14
+ .lesli-image-upload-preview .material-symbols-outlined {
15
+ @apply text-4xl text-neutral-300;
16
+ }
17
+
18
+ .lesli-image-upload-input {
19
+ @apply block w-full min-w-0 max-w-lg cursor-pointer rounded-xl border border-neutral-300 bg-white p-2 text-sm text-neutral-600 transition focus-visible:border-primary focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-primary/10;
20
+ }
21
+
22
+ .lesli-image-upload-input::file-selector-button {
23
+ @apply mr-3 cursor-pointer rounded-lg border-0 bg-primary-soft px-4 py-2 text-sm font-medium text-primary-strong transition-colors;
24
+ }
25
+
26
+ .lesli-image-upload-input::file-selector-button:hover {
27
+ @apply bg-primary text-white;
28
+ }
29
+
30
+ .lesli-image-upload-input[aria-invalid="true"] {
31
+ @apply border-danger-400;
32
+ }
33
+
34
+ .lesli-image-upload-help {
35
+ @apply text-sm leading-5 text-neutral-500;
36
+ }
37
+
38
+ .lesli-image-upload-error {
39
+ @apply text-sm leading-5 text-danger-700;
40
+ }
41
+ }
@@ -0,0 +1,22 @@
1
+ <div class="lesli-image-upload" x-data="{ preview: null }">
2
+ <%= form.label(attribute, label) %>
3
+ <div class="lesli-image-upload-preview">
4
+ <% if image.attached? && image.blob.persisted? %>
5
+ <%= image_tag(helpers.main_app.rails_blob_path(image, only_path: true), alt: label, "x-show": "!preview") %>
6
+ <% else %>
7
+ <span class="material-symbols-outlined" x-show="!preview" aria-hidden="true">image</span>
8
+ <% end %>
9
+ <img x-show="preview" x-cloak :src="preview" alt="<%= label %>">
10
+ </div>
11
+ <%= form.file_field(attribute, accept: "image/jpeg,image/png,image/webp",
12
+ class: "lesli-image-upload-input",
13
+ aria: { describedby: form.field_id(attribute, :help), invalid: form.object.errors[attribute].any? },
14
+ "x-on:change": "const file = $event.target.files[0]; preview = null; if (file) { const reader = new FileReader(); reader.onload = () => preview = reader.result; reader.readAsDataURL(file); }") %>
15
+ <p class="lesli-image-upload-help" id="<%= form.field_id(attribute, :help) %>"><%= help %></p>
16
+ <% form.object.errors.full_messages_for(attribute).each do |message| %>
17
+ <p class="lesli-image-upload-error" role="alert"><%= message %></p>
18
+ <% end %>
19
+ <% if image.attached? %>
20
+ <%= form.field_control_checkbox(remove_attribute, label: remove_label) %>
21
+ <% end %>
22
+ </div>
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module LesliView
4
+ module Components
5
+ # Presentation only: the owning resource handles validation and persistence.
6
+ class ImageUpload < ViewComponent::Base
7
+ attr_reader :form, :attribute, :label, :help, :remove_label, :remove_attribute
8
+
9
+ def initialize(form:, attribute:, label:, help:, remove_label:, remove_attribute:)
10
+ @form = form
11
+ @attribute = attribute
12
+ @label = label
13
+ @help = help
14
+ @remove_label = remove_label
15
+ @remove_attribute = remove_attribute
16
+ end
17
+
18
+ def image
19
+ form.object.public_send(attribute)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -12,7 +12,7 @@
12
12
  }
13
13
 
14
14
  .lesli-application-header-logo {
15
- @apply flex items-center [&_img]:h-12 [&_img]:w-auto;
15
+ @apply flex items-center [&_img]:h-12 [&_img]:w-auto [&_img]:max-w-48 [&_img]:object-contain;
16
16
  }
17
17
 
18
18
  .lesli-application-header-actions {
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LesliView
4
- VERSION = "1.1.8"
5
- BUILD = "1795131729"
4
+ VERSION = "1.1.9"
5
+ BUILD = "1796008291"
6
6
  end
data/lib/lesli_view.rb CHANGED
@@ -18,6 +18,7 @@ require "lesli_view/charts/bar"
18
18
  require "lesli_view/components/tabs"
19
19
  require "lesli_view/components/panel"
20
20
  require "lesli_view/components/header"
21
+ require "lesli_view/components/image_upload"
21
22
  require "lesli_view/components/toolbar"
22
23
  require "lesli_view/components/timeline"
23
24
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lesli_view
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.8
4
+ version: 1.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Lesli Development Team
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-11-19 00:00:00.000000000 Z
11
+ date: 2026-11-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: view_component
@@ -58,6 +58,9 @@ files:
58
58
  - lib/lesli_view/components/header.rb
59
59
  - lib/lesli_view/components/header/header.css
60
60
  - lib/lesli_view/components/header/header.html.erb
61
+ - lib/lesli_view/components/image_upload.rb
62
+ - lib/lesli_view/components/image_upload/image_upload.css
63
+ - lib/lesli_view/components/image_upload/image_upload.html.erb
61
64
  - lib/lesli_view/components/panel.rb
62
65
  - lib/lesli_view/components/panel/panel.css
63
66
  - lib/lesli_view/components/panel/panel.html.erb