app_rail-steps 0.2.2 → 0.2.5

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: 1e76006e6ef3b5fafdaa50fc32aaeaab212bf70dfee24cfb6f905cdef1be3039
4
- data.tar.gz: c2e413b573460f167e06e83f4882c56d0001fbef9e8cac3b3751cd89477586ac
3
+ metadata.gz: ca74f487f4684642560554261e441d4df0b2eed0ada21e69ed2ac9c71f739fc8
4
+ data.tar.gz: cd1aca03335d201619cf3fb4470ec3725d63dbdb626e0d48ede2658f4302bbe1
5
5
  SHA512:
6
- metadata.gz: 00c80403094689ce0fa611e24e12b870f484297387c048a6ca28a525dff8cc27118991c955589a9deb4c84cddfaab774a74ccf8b992d7637ae4b13ffa4d042ea
7
- data.tar.gz: 5b91a19cf979b9caf5dcd0ad1c43d816ef1a75b29617dd04c3b4770575b4ffe8c804b146d0741314749c84536ba5b6780953f48a3b968d864d8d13f0d5a69f91
6
+ metadata.gz: a7679afece3e67d9b261b928885644484fe4af7e66cc9d91c7d5761262f257414919c2d9a18c3284967d7a3e5881715ca15d8e8701ac7c644d650e844ce03155
7
+ data.tar.gz: b09961425c5d21e7c134368c745e0cee24eee31fcf6c35eb2d693481bee6585671465cb1b55f845ecdf00d9bd5750269ea2ff4b02b933e1f3703084218672b41
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- app_rail-steps (0.2.2)
4
+ app_rail-steps (0.2.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -0,0 +1,93 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AppRail
4
+ module Steps
5
+ module Core
6
+ module Stack
7
+ CONTENT_MODE_OPTIONS = %i[scale_aspect_fill scale_aspect_fit].freeze
8
+
9
+ def ar_core_stack_text(text:, label: nil)
10
+ { type: :text, label: label, text: text.to_s }.compact
11
+ end
12
+
13
+ def ar_core_stack_image(preview_url:, attachment_url:, content_mode: :scale_aspect_fill)
14
+ validate_content_mode!(content_mode)
15
+
16
+ { type: :image, contentMode: camelcase_converter(content_mode.to_s, first_letter: :lower),
17
+ previewURL: preview_url, url: attachment_url }
18
+ end
19
+
20
+ def ar_core_stack_unsplash_image(image_url)
21
+ if image_url.start_with? "https://unsplash.com/photos"
22
+ unsplash_id = image_url.split("/").last
23
+ image_url = "https://source.unsplash.com/#{unsplash_id}/800x600"
24
+ end
25
+
26
+ { type: :image, previewURL: image_url, url: image_url }.compact
27
+ end
28
+
29
+ def ar_core_stack_video(preview_url:, attachment_url:)
30
+ { type: :video, previewURL: preview_url, url: attachment_url }
31
+ end
32
+
33
+ def ar_core_stack_button(label:, style: :primary, on_success: :forward, sf_symbol_name: nil, material_icon_name: nil)
34
+ validate_on_success!(on_success)
35
+ validate_button_style!(style)
36
+
37
+ { type: :button, label: label, style: style, onSuccess: on_success, sfSymbolName: sf_symbol_name,
38
+ materialIconName: material_icon_name }.compact
39
+ end
40
+
41
+ def ar_core_stack_delete_button(url:, label: "Delete", method: :delete, style: :danger, on_success: :backward)
42
+ validate_on_success!(on_success)
43
+ validate_button_style!(style)
44
+
45
+ { type: :button, label: label, url: url, method: method, style: style, onSuccess: on_success,
46
+ sfSymbolName: "trash", materialIconName: "delete" }.compact
47
+ end
48
+
49
+ def ar_core_stack_url_button(url:, label:, method: :put, style: :primary, confirm_title: nil, confirm_text: nil, on_success: :reload, sf_symbol_name: nil, material_icon_name: nil)
50
+ validate_on_success!(on_success)
51
+ validate_button_style!(style)
52
+
53
+ { type: :button, label: label, url: url, method: method, style: style, confirmTitle: confirm_title,
54
+ confirmText: confirm_text, onSuccess: on_success, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
55
+ end
56
+ alias ar_core_stack_button_for_url ar_core_stack_url_button
57
+
58
+ def ar_core_stack_system_url_button(label:, apple_system_url: nil, android_deep_link: nil, style: :primary, sf_symbol_name: nil, material_icon_name: nil)
59
+ validate_button_style!(style)
60
+ raise "Invalid android_deep_link" if android_deep_link && !android_deep_link.start_with?("http")
61
+
62
+ { type: :button, label: label, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link,
63
+ style: style, sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
64
+ end
65
+ alias ar_core_stack_button_for_system_url ar_core_stack_system_url_button
66
+
67
+ def ar_core_stack_link_button(label:, link_id:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil)
68
+ validate_on_success!(on_success)
69
+ validate_button_style!(style)
70
+
71
+ { type: :button, label: label, linkId: link_id, style: style, onSuccess: on_success,
72
+ sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
73
+ end
74
+
75
+ # Remove this method once V1 is no longer being used
76
+ def ar_core_stack_modal_workflow_button(label:, modal_workflow_name:, style: :primary, on_success: :none, sf_symbol_name: nil, material_icon_name: nil)
77
+ validate_on_success!(on_success)
78
+ validate_button_style!(style)
79
+
80
+ { type: :button, label: label, modalWorkflow: modal_workflow_name, style: style, onSuccess: on_success,
81
+ sfSymbolName: sf_symbol_name, materialIconName: material_icon_name }.compact
82
+ end
83
+ alias ar_core_stack_button_for_modal_workflow ar_core_stack_modal_workflow_button
84
+
85
+ private
86
+
87
+ def validate_content_mode!(on_success)
88
+ raise "Unknown content_mode" unless CONTENT_MODE_OPTIONS.include?(on_success)
89
+ end
90
+ end
91
+ end
92
+ end
93
+ end
@@ -0,0 +1,79 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AppRail
4
+ module Steps
5
+ module CoreForms
6
+ module Form
7
+ def ar_core_forms_form_section(label:, id:)
8
+ raise "Missing label" if label.nil?
9
+ raise "Missing id" if id.nil?
10
+
11
+ { item_type: :section, id: id, label: label }
12
+ end
13
+
14
+ def ar_core_forms_form_multiple_selection(label:, multiple_selection_options:, id:, selection_type: :single, optional: false, show_other_option: false)
15
+ raise "Missing label" if label.nil?
16
+ raise "Missing id" if id.nil?
17
+ raise "Missing multiple selection options" if multiple_selection_options.nil?
18
+
19
+ { item_type: :multiple_selection, id: id, label: label,
20
+ multiple_selection_options: multiple_selection_options, selection_type: selection_type, optional: optional, show_other_option: show_other_option }
21
+ end
22
+
23
+ def ar_core_forms_form_multiple_selection_options(text:, hint: nil, is_pre_selected: false)
24
+ raise "Missing text" if text.nil?
25
+
26
+ { text: text, hint: hint, isPreSelected: is_pre_selected }
27
+ end
28
+
29
+ def ar_core_forms_form_number(label:, id:, placeholder: nil, optional: false, symbol_position: :leading, default_text_answer: nil, hint: nil)
30
+ raise "Missing label" if label.nil?
31
+ raise "Missing id" if id.nil?
32
+
33
+ { item_type: :number, number_type: :number, id: id, label: label,
34
+ placeholder: placeholder, optional: optional, symbol_position: symbol_position, default_text_answer: default_text_answer, hint: hint }
35
+ end
36
+
37
+ def ar_core_forms_form_text(label:, id:, placeholder: nil, optional: false, multiline: false, default_text_answer: nil, hint: nil)
38
+ raise "Missing label" if label.nil?
39
+ raise "Missing id" if id.nil?
40
+
41
+ { item_type: :text, id: id, label: label, placeholder: placeholder,
42
+ optional: optional, multiline: multiline, default_text_answer: default_text_answer, hint: hint }
43
+ end
44
+
45
+ def ar_core_forms_form_date(label:, id:, optional: false, default_text_answer: nil)
46
+ raise "Missing label" if label.nil?
47
+ raise "Missing id" if id.nil?
48
+
49
+ { item_type: :date, date_type: :calendar, id: id, label: label, optional: optional,
50
+ default_text_answer: default_text_answer }
51
+ end
52
+
53
+ def ar_core_forms_form_time(label:, id:, optional: false, default_text_answer: nil)
54
+ raise "Missing label" if label.nil?
55
+ raise "Missing id" if id.nil?
56
+
57
+ { item_type: :time, id: id, label: label, optional: optional,
58
+ default_text_answer: default_text_answer }
59
+ end
60
+
61
+ def ar_core_forms_form_email(label:, id:, placeholder: nil, optional: false, default_text_answer: nil)
62
+ raise "Missing label" if label.nil?
63
+ raise "Missing id" if id.nil?
64
+
65
+ { item_type: :email, id: id, label: label, placeholder: placeholder,
66
+ optional: optional, default_text_answer: default_text_answer }
67
+ end
68
+
69
+ def ar_core_forms_form_password(label:, id:, placeholder: nil, optional: false, default_text_answer: nil, hint: nil)
70
+ raise "Missing label" if label.nil?
71
+ raise "Missing id" if id.nil?
72
+
73
+ { item_type: :secure, id: id, label: label, placeholder: placeholder,
74
+ optional: optional, default_text_answer: default_text_answer, hint: hint }
75
+ end
76
+ end
77
+ end
78
+ end
79
+ end
@@ -1,13 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require_relative "core/list"
4
+ require_relative "core/stack"
5
+ require_relative "core_forms/form"
4
6
  require_relative "maps/map"
7
+ require_relative "styled_content/grid"
8
+ require_relative "styled_content/stack"
5
9
 
6
10
  module AppRail
7
11
  module Steps
8
12
  module Displayable
9
13
  include Steps::Core::List
14
+ include Steps::Core::Stack
15
+ include Steps::CoreForms::Form
10
16
  include Steps::Maps::Map
17
+ include Steps::StyledContent::Grid
18
+ include Steps::StyledContent::Stack
11
19
 
12
20
  BUTTON_STYLES = %i[primary outline danger textOnly].freeze
13
21
  ON_SUCCESS_OPTIONS = %i[none reload backward forward].freeze
@@ -5,7 +5,8 @@ module AppRail
5
5
  module Maps
6
6
  module Map
7
7
  def ar_maps_map_item(text:, latitude:, longitude:, id: self.id, detail_text: nil)
8
- { id: id.to_s, text: text, latitude: latitude.to_f, longitude: longitude.to_f, detailText: detail_text }.compact
8
+ { id: id.to_s, text: text, latitude: latitude.to_f, longitude: longitude.to_f,
9
+ detailText: detail_text }.compact
9
10
  end
10
11
  end
11
12
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AppRail
4
+ module Steps
5
+ module StyledContent
6
+ module Grid
7
+ def ar_styled_content_grid_large_section(id:, text:)
8
+ raise "Missing id" if id.nil?
9
+ raise "Missing text" if text.nil?
10
+
11
+ { id: id, text: text, type: :largeSection }
12
+ end
13
+
14
+ def ar_styled_content_grid_small_section(id:, text:)
15
+ raise "Missing id" if id.nil?
16
+ raise "Missing text" if text.nil?
17
+
18
+ { id: id, text: text, type: :smallSection }
19
+ end
20
+
21
+ def ar_styled_content_grid_item(text:, id: self.id, detail_text: nil, preview_url: nil)
22
+ raise "Missing id" if id.nil?
23
+ raise "Missing text" if text.nil?
24
+
25
+ { id: id, text: text, type: :item, detailText: detail_text, imageURL: preview_url }.compact
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AppRail
4
+ module Steps
5
+ module StyledContent
6
+ module Stack
7
+ def ar_styled_content_stack_title(title:)
8
+ raise "Missing title" if title.nil?
9
+
10
+ { id: id, title: title, type: :title }
11
+ end
12
+
13
+ def ar_styled_content_stack_text(text:)
14
+ raise "Missing text" if text.nil?
15
+
16
+ { text: text, type: :text }
17
+ end
18
+
19
+ def ar_styled_content_stack_list_item(text:, detail_text: nil, preview_url: nil)
20
+ raise "Missing text" if text.nil?
21
+
22
+ { text: text, detailText: detail_text, type: :listItem, imageURL: preview_url }.compact
23
+ end
24
+
25
+ # Remove `modal_workflow_name` argument once V1 is no longer being used
26
+ def ar_styled_content_stack_button(label:, url: nil, method: :nil, on_success: :none, style: :primary, modal_workflow_name: nil, link_id: nil, link_url: nil, sf_symbol_name: nil, apple_system_url: nil, android_deep_link: nil, confirm_title: nil, confirm_text: nil, share_text: nil, share_image_url: nil)
27
+ raise "Missing label" if label.nil?
28
+
29
+ validate_on_success!(on_success)
30
+ validate_button_style!(style)
31
+
32
+ { type: :button, label: label, url: url, method: method, onSuccess: on_success, style: style,
33
+ modalWorkflow: modal_workflow_name, linkId: link_id, linkURL: link_url, sfSymbolName: sf_symbol_name, appleSystemURL: apple_system_url, androidDeepLink: android_deep_link, confirmTitle: confirm_title, confirmText: confirm_text, shareText: share_text, shareImageURL: share_image_url }.compact
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AppRail
4
4
  module Steps
5
- VERSION = "0.2.2"
5
+ VERSION = "0.2.5"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: app_rail-steps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brooke-Smith
@@ -28,8 +28,12 @@ files:
28
28
  - app_rail-steps.gemspec
29
29
  - lib/app_rail/steps.rb
30
30
  - lib/app_rail/steps/core/list.rb
31
+ - lib/app_rail/steps/core/stack.rb
32
+ - lib/app_rail/steps/core_forms/form.rb
31
33
  - lib/app_rail/steps/displayable.rb
32
34
  - lib/app_rail/steps/maps/map.rb
35
+ - lib/app_rail/steps/styled_content/grid.rb
36
+ - lib/app_rail/steps/styled_content/stack.rb
33
37
  - lib/app_rail/steps/version.rb
34
38
  homepage: https://github.com/FutureWorkshops/app_rail-steps
35
39
  licenses: