openproject-primer_view_components 0.41.0 → 0.41.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 14593fb2905980052a721c86d1b8b52a0f111166b477860d3edf7bf28310aa48
4
- data.tar.gz: '0838140880dbe21f751bb20d65694d038e13f8af131196cb5bda047e49661b94'
3
+ metadata.gz: a378c7a5a9aa4f33d427d21fddb301b0dbe46e538447ee4376907a43a0c8a235
4
+ data.tar.gz: 13380df59b216e1a5cb953ef4c68e4101e03d1b99f3f2b81c0f0d727e90db3b2
5
5
  SHA512:
6
- metadata.gz: e8d58bdd1701157d8a20e140b681a7e23f381a23c98bf03024ba53cb40689fbe76af9d6b08cef6c721710c5c819aa9c397c667d570598d4c0fd546d87b13f582
7
- data.tar.gz: e87fac40947b33003faf5a91d9945ffa1527afe6f93b0c48fa0441b3af6b3a4aac09d2c6ec362599d70e4d3133b264e391d44746dfbfda32cebe3b2b1a977e26
6
+ metadata.gz: 420aa7dd1d778a2769be9ca66c2741b736154d55b1d8ebdddc3d1dac2f58e3285d78ad8593397de3d405a3adf714390c48392732176ee5165585db1ab1bfc73f
7
+ data.tar.gz: 176fb4d46710b64a9fcef77cb53cb7d3934267298b9a2219c38a84f9d16d11717a43b9efb96344a0f2db3225811faf3853edda2a427d7e34648e5b280507d330
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.41.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#159](https://github.com/opf/primer_view_components/pull/159) [`f2517d6`](https://github.com/opf/primer_view_components/commit/f2517d65708cff07bef5714e1af28c15fc49915e) Thanks [@oliverguenther](https://github.com/oliverguenther)! - Allow input_width on text_area
8
+
3
9
  ## 0.41.0
4
10
 
5
11
  ### Minor Changes
@@ -10,8 +10,14 @@ module Primer
10
10
  @input = input
11
11
  @input.add_input_classes("FormControl-input", "FormControl-textarea")
12
12
 
13
+ wrap_classes = [
14
+ "FormControl-input-wrap",
15
+ ]
16
+
17
+ wrap_classes << Primer::Forms::Dsl::Input::INPUT_WIDTH_MAPPINGS[@input.input_width] if @input.input_width
18
+
13
19
  @field_wrap_arguments = {
14
- class: class_names("FormControl-input-wrap"),
20
+ class: class_names(wrap_classes),
15
21
  hidden: @input.hidden?
16
22
  }
17
23
  end
@@ -6,7 +6,7 @@ module Primer
6
6
  module VERSION
7
7
  MAJOR = 0
8
8
  MINOR = 41
9
- PATCH = 0
9
+ PATCH = 1
10
10
 
11
11
  STRING = [MAJOR, MINOR, PATCH].join(".")
12
12
  end
@@ -16,6 +16,7 @@ module Primer
16
16
  # @param disabled toggle
17
17
  # @param invalid toggle
18
18
  # @param validation_message text
19
+ # @param input_width [Symbol] select [auto, small, medium, large, xlarge, xxlarge]
19
20
  def playground(
20
21
  name: "my-text-area",
21
22
  id: "my-text-area",
@@ -26,7 +27,8 @@ module Primer
26
27
  full_width: true,
27
28
  disabled: false,
28
29
  invalid: false,
29
- validation_message: nil
30
+ validation_message: nil,
31
+ input_width: nil
30
32
  )
31
33
  system_arguments = {
32
34
  name: name,
@@ -38,7 +40,8 @@ module Primer
38
40
  full_width: full_width,
39
41
  disabled: disabled,
40
42
  invalid: invalid,
41
- validation_message: validation_message
43
+ validation_message: validation_message,
44
+ input_width: input_width
42
45
  }
43
46
 
44
47
  render(Primer::Alpha::TextArea.new(**system_arguments))
@@ -1,5 +1,37 @@
1
- <!-- Look at the "Assets" tab for the definition of the `CustomWidthFieldsForm` -->
1
+ <%
2
+ custom_width_form = Class.new(ApplicationForm) do
3
+ form do |f|
4
+ f.text_field(
5
+ name: :ultimate_answer,
6
+ label: "Ultimate answer",
7
+ required: true,
8
+ caption: "The answer to life, the universe, and everything",
9
+ input_width: :medium
10
+ )
11
+
12
+ f.select_list(
13
+ name: "cities",
14
+ label: "Cool cities",
15
+ caption: "Select your favorite!",
16
+ include_blank: true,
17
+ input_width: :small
18
+ ) do |city_list|
19
+ city_list.option(label: "Lopez Island", value: "lopez_island")
20
+ city_list.option(label: "Bellevue", value: "bellevue")
21
+ city_list.option(label: "Seattle", value: "seattle")
22
+ end
23
+
24
+ f.text_field(
25
+ name: :lots_of_text,
26
+ label: "Lots of text",
27
+ required: true,
28
+ caption: "What else do you need?",
29
+ input_width: :small
30
+ )
31
+ end
32
+ end
33
+ %>
2
34
 
3
35
  <%= primer_form_with(url: "/foo") do |f| %>
4
- <%= render(CustomWidthFieldsForm.new(f)) %>
36
+ <%= render(custom_width_form.new(f)) %>
5
37
  <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openproject-primer_view_components
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.41.0
4
+ version: 0.41.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - GitHub Open Source
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-08-06 00:00:00.000000000 Z
12
+ date: 2024-08-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionview
@@ -568,7 +568,6 @@ files:
568
568
  - app/forms/check_box_group_form.rb
569
569
  - app/forms/check_box_with_nested_form.rb
570
570
  - app/forms/composed_form.rb
571
- - app/forms/custom_width_fields_form.rb
572
571
  - app/forms/example_toggle_switch_form.rb
573
572
  - app/forms/example_toggle_switch_form/example_field_caption.html.erb
574
573
  - app/forms/first_name_form.rb
@@ -1,26 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :nodoc:
4
- class CustomWidthFieldsForm < ApplicationForm
5
- form do |f|
6
- f.text_field(
7
- name: :ultimate_answer,
8
- label: "Ultimate answer",
9
- required: true,
10
- caption: "The answer to life, the universe, and everything",
11
- input_width: :medium
12
- )
13
-
14
- f.select_list(
15
- name: "cities",
16
- label: "Cool cities",
17
- caption: "Select your favorite!",
18
- include_blank: true,
19
- input_width: :small
20
- ) do |city_list|
21
- city_list.option(label: "Lopez Island", value: "lopez_island")
22
- city_list.option(label: "Bellevue", value: "bellevue")
23
- city_list.option(label: "Seattle", value: "seattle")
24
- end
25
- end
26
- end