katalyst-koi 5.11.2 → 5.11.4

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: ea4f9e29a1eef22e9a178c663b56950384655fb7c91d27cccfbe406b1aaf7d93
4
- data.tar.gz: 7cd1ddf3134fdff40742dd19e0667a58060519ef1b21214003c1f5894dc10a52
3
+ metadata.gz: 211e9c496f7004d0732a7f00830d9d745708dfcdfc97a0c5335d1cd35676b121
4
+ data.tar.gz: 2962081c2b698644576c134cfd3cc34a3e5ecede627b27def1242a71c3d395e1
5
5
  SHA512:
6
- metadata.gz: a0ac94af56d9f31ba511cc25e747d3d72002c1b5997c0fa6094898d4b430810325c2b34efd3baf817ffe94797de4fc4ec2f7aa2ce6f9b60e4c0fd4375d9c1fde
7
- data.tar.gz: 1f74e303e8430572b1c5191ae303014f26bc7ea69a073483693f8a3c9945e640d7701ba4a6152f8d8d46383771b7f0d1fdea42dd622863e2a0cd444a1713a341
6
+ metadata.gz: 71f2e398beb2f61ea05031ffd1b55659a257ed36463c56c10cd895e071a50e08f2fdb556c3573fdf1e44eb1ad6e8f0c2409d762aa6fb4b9f17d98cf2babe3516
7
+ data.tar.gz: 147b0f64587328344df0cc2540f981a381436db06ef194cedfdd11506b007beba01624e88cb808be5340fc931becf76c48eab21a869243ff6bcd7465e4ebc588
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#000" d="M7.66.032c.225-.043.456-.043.681 0l.211.055c.203.067.379.163.504.227l.001-.001 5.756 2.919.002.002.01.005.316.168c.09.053.183.115.27.189l.087.078.126.14q.174.214.273.484h.002c.116.315.102.652.102.82v5.765c0 .168.012.497-.098.807a1.7 1.7 0 0 1-.399.627l-.01.011c-.22.217-.504.35-.66.43l-.019.009h-.002l-5.756 2.92-.002.002c-.126.063-.301.158-.503.224l-.209.055a1.8 1.8 0 0 1-.685 0c-.287-.055-.54-.193-.704-.275l-.01-.005-5.756-2.92-.002-.001-.01-.005c-.166-.085-.452-.218-.672-.436a1.7 1.7 0 0 1-.4-.626l-.002.002c-.116-.316-.101-.652-.101-.819V5.117c0-.17-.015-.5.097-.811H.1c.086-.24.225-.45.398-.623H.496l.01-.01h.001c.224-.222.519-.357.68-.44l.001-.001L6.944.312v.002c.17-.087.425-.227.714-.281zM2 10.937l.086.044.007.004 4.908 2.489v-4.86L2 6.077zm7-2.323v4.86l4.908-2.49.015-.007.077-.04v-4.86zM7.987 2.028l-.136.068v.001L3.21 4.449 8 6.879l4.79-2.43-4.638-2.352-.001-.001-.137-.07-.013-.006z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#000" d="M8 0c2.002 0 3.854.242 5.237.657.685.206 1.313.47 1.791.81.453.32.972.858.972 1.633v9.8c0 .772-.514 1.31-.967 1.632-.477.34-1.103.606-1.787.812C11.865 15.759 10.013 16 8 16s-3.865-.241-5.246-.656c-.684-.206-1.31-.471-1.787-.812C.514 14.21 0 13.672 0 12.9V3.1c0-.775.52-1.312.972-1.633.478-.34 1.105-.604 1.79-.81C4.147.242 5.999 0 8 0m6 10.18a9 9 0 0 1-.754.263c-1.381.415-3.233.657-5.246.657s-3.865-.242-5.246-.657A9 9 0 0 1 2 10.181v2.618c.024.024.063.06.128.105.228.162.622.35 1.201.524C4.476 13.772 6.124 14 8 14s3.524-.228 4.67-.572c.58-.174.974-.362 1.202-.524A1 1 0 0 0 14 12.8zm0-4.903a9 9 0 0 1-.763.266C11.854 5.958 10.002 6.2 8 6.2s-3.854-.242-5.237-.657A9 9 0 0 1 2 5.277V7.9c.024.024.064.06.128.105.228.162.622.35 1.201.524C4.476 8.873 6.124 9.1 8 9.1s3.524-.227 4.67-.572c.58-.174.974-.362 1.202-.524.064-.046.104-.08.128-.105zM8 2c-1.864 0-3.512.228-4.662.573-.581.175-.98.362-1.21.525l-.002.002q0 0 .003.002c.23.163.628.35 1.209.525C4.488 3.972 6.136 4.2 8 4.2s3.512-.228 4.662-.573c.581-.174.98-.362 1.21-.525l.001-.002-.002-.002c-.23-.163-.628-.35-1.209-.525C11.512 2.228 9.864 2 8 2"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#000" d="M10.667 6.476a4.19 4.19 0 1 0-8.38.001 4.19 4.19 0 0 0 8.38 0m2.286 0a6.48 6.48 0 0 1-1.163 3.698l3.875 3.875a1.143 1.143 0 1 1-1.616 1.616l-3.875-3.875a6.47 6.47 0 0 1-3.698 1.163 6.476 6.476 0 1 1 6.477-6.477"/></svg>
@@ -15,7 +15,7 @@
15
15
  max-width: unset;
16
16
  outline: none;
17
17
  border-width: 2px;
18
- padding: 5px 2rem 5px 5px;
18
+ padding: 6px 2rem 6px 5px;
19
19
  font-size: var(--size-step-0);
20
20
  line-height: var(--leading-standard);
21
21
  }
@@ -27,7 +27,7 @@
27
27
  top: var(--space-3xs);
28
28
  right: var(--space-3xs);
29
29
  bottom: var(--space-3xs);
30
- max-height: 1.75rem;
30
+ max-height: 2rem;
31
31
  width: auto;
32
32
  min-width: 1.5rem;
33
33
  text-align: center;
@@ -73,29 +73,30 @@
73
73
  content: "";
74
74
  position: relative;
75
75
  display: inline-block;
76
- min-width: 14px;
76
+ min-width: 16px;
77
77
  min-height: 16px;
78
78
  margin-inline-end: 0.5rem;
79
+ top: 2px;
79
80
  }
80
81
 
81
82
  li.suggestion.attribute::before {
82
- background: url("data:image/svg+xml,%3Csvg width='14' height='16' viewBox='0 0 14 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M13 3.1C13 4.2598 10.3137 5.2 7 5.2C3.68629 5.2 1 4.2598 1 3.1M13 3.1C13 1.9402 10.3137 1 7 1C3.68629 1 1 1.9402 1 3.1M13 3.1V12.9C13 14.062 10.3333 15 7 15C3.66667 15 1 14.062 1 12.9V3.1M13 8C13 9.162 10.3333 10.1 7 10.1C3.66667 10.1 1 9.162 1 8' stroke='%23#{string.slice(meta.inspect($text-icon-color), 2)}' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A")
83
- no-repeat;
84
- top: 2px;
83
+ -webkit-mask: url("../../icons/database.svg") no-repeat;
84
+ mask: url("../../icons/database.svg") no-repeat;
85
+ background: var(--color-mid);
85
86
  }
86
87
 
87
88
  li.suggestion.database_value::before,
88
89
  li.suggestion.constant_value::before,
89
90
  li.suggestion.custom_value::before {
90
- background: url("data:image/svg+xml,%3Csvg width='14' height='16' viewBox='0 0 16 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14.6111 5.16702L7.99998 8.99998M7.99998 8.99998L1.38886 5.16702M7.99998 8.99998L8 16.711M15 12.2943V5.70573C15 5.42761 15 5.28856 14.9607 5.16453C14.926 5.05481 14.8692 4.9541 14.7942 4.86912C14.7094 4.77307 14.5929 4.70553 14.3599 4.57047L8.60436 1.23354C8.38378 1.10565 8.27348 1.04171 8.15668 1.01664C8.05331 0.994453 7.94669 0.994453 7.84332 1.01664C7.72652 1.04171 7.61623 1.10565 7.39564 1.23354L1.64009 4.57047C1.40713 4.70554 1.29064 4.77307 1.20583 4.86912C1.13079 4.9541 1.074 5.05481 1.03927 5.16453C1 5.28856 1 5.42762 1 5.70573V12.2943C1 12.5724 1 12.7114 1.03927 12.8355C1.074 12.9452 1.13079 13.0459 1.20583 13.1309C1.29064 13.2269 1.40713 13.2945 1.64009 13.4295L7.39564 16.7665C7.61623 16.8943 7.72652 16.9583 7.84332 16.9834C7.94669 17.0055 8.05331 17.0055 8.15668 16.9834C8.27348 16.9583 8.38377 16.8943 8.60436 16.7665L14.3599 13.4295C14.5929 13.2945 14.7094 13.2269 14.7942 13.1309C14.8692 13.0459 14.926 12.9452 14.9607 12.8355C15 12.7114 15 12.5724 15 12.2943Z' stroke='%23#{string.slice(meta.inspect($text-icon-color), 2)}' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A")
91
- no-repeat;
92
- top: 2px;
91
+ -webkit-mask: url("../../icons/cube.svg") no-repeat;
92
+ mask: url("../../icons/cube.svg") no-repeat;
93
+ background: var(--color-mid);
93
94
  }
94
95
 
95
96
  li.suggestion.search_value::before {
96
- background: url("data:image/svg+xml,%3Csvg width='14' height='16' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M21 21L15.0001 15M17 10C17 13.866 13.866 17 10 17C6.13401 17 3 13.866 3 10C3 6.13401 6.13401 3 10 3C13.866 3 17 6.13401 17 10Z' stroke='%23#{string.slice(meta.inspect($text-icon-color), 2)}' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E%0A")
97
- no-repeat;
98
- top: 2px;
97
+ -webkit-mask: url("../../icons/search.svg") no-repeat;
98
+ mask: url("../../icons/search.svg") no-repeat;
99
+ background: var(--color-mid);
99
100
  }
100
101
 
101
102
  li.suggestion.attribute::after {
@@ -114,7 +114,7 @@
114
114
  display: grid;
115
115
  grid-template-areas: "preview caption actions";
116
116
  grid-template-columns: auto 1fr auto;
117
- margin: 0 0 var(--flow-space) 0;
117
+ margin: unset;
118
118
  padding: var(--space-xs);
119
119
  grid-gap: var(--space-s);
120
120
  border: 1px solid var(--color-mid);
@@ -243,6 +243,12 @@ display, tab order, and accessibility tree. */
243
243
  }
244
244
  }
245
245
 
246
+ .govuk-file-upload-wrapper:has(input[type="file"][multiple]) {
247
+ .govuk-attachment + .govuk-attachment {
248
+ margin-block-start: var(--space-xs);
249
+ }
250
+ }
251
+
246
252
  /* Movement */
247
253
 
248
254
  .govuk-attachment {
@@ -31,7 +31,8 @@ module Koi
31
31
  ), &)
32
32
  end
33
33
 
34
- # Generates a column that renders an ActiveStorage attachment as a downloadable link.
34
+ # Generates a column that renders ActiveStorage attachments, from either
35
+ # has_one_attached or has_many_attached associations.
35
36
  #
36
37
  # @param column [Symbol] the column's name, called as a method on the record
37
38
  # @param label [String|nil] the label to use for the column header
@@ -5,9 +5,10 @@ module Koi
5
5
  module Cells
6
6
  # Shows an attachment
7
7
  #
8
- # The value is expected to be an ActiveStorage attachment
8
+ # The value is expected to be an ActiveStorage attachment, either
9
+ # singular (has_one_attached) or plural (has_many_attached).
9
10
  #
10
- # If it is representable, shows as a image tag using the specified variant.
11
+ # If it is representable, shows as an image tag using the specified variant.
11
12
  #
12
13
  # Otherwise shows as a link to download.
13
14
  class AttachmentComponent < Katalyst::Tables::CellComponent
@@ -18,21 +19,19 @@ module Koi
18
19
  end
19
20
 
20
21
  def rendered_value
21
- representation
22
+ safe_join(attachments.map { |attachment| representation(attachment) })
22
23
  end
23
24
 
24
- def representation
25
- if value.try(:variable?) && named_variant.present?
26
- image_tag(value.variant(@variant))
27
- elsif value.try(:attached?)
28
- filename.to_s
25
+ def representation(attachment = value.attachment)
26
+ if attachment&.variable? && named_variant.present?
27
+ image_tag(attachment.variant(@variant))
29
28
  else
30
- ""
29
+ attachment&.filename.to_s
31
30
  end
32
31
  end
33
32
 
34
33
  def filename
35
- value.blob.filename
34
+ value.attachment&.filename
36
35
  end
37
36
 
38
37
  # Utility for accessing the path Rails provides for retrieving the
@@ -46,6 +45,11 @@ module Koi
46
45
 
47
46
  private
48
47
 
48
+ # Attached::One and Attached::Many normalized to [ActiveStorage::Attachment]
49
+ def attachments
50
+ value.is_a?(ActiveStorage::Attached::Many) ? value.attachments : Array(value.attachment)
51
+ end
52
+
49
53
  def default_html_attributes
50
54
  { class: "type-attachment" }
51
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: katalyst-koi
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.11.2
4
+ version: 5.11.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Katalyst Interactive
@@ -309,7 +309,10 @@ files:
309
309
  - app/assets/images/koi/application/sort-descending.png
310
310
  - app/assets/images/koi/icons/add.svg
311
311
  - app/assets/images/koi/icons/close.svg
312
+ - app/assets/images/koi/icons/cube.svg
313
+ - app/assets/images/koi/icons/database.svg
312
314
  - app/assets/images/koi/icons/fingerprint.svg
315
+ - app/assets/images/koi/icons/search.svg
313
316
  - app/assets/images/koi/logo.svg
314
317
  - app/assets/stylesheets/koi/blocks/actions.css
315
318
  - app/assets/stylesheets/koi/blocks/application-header.css