keystone_ui 0.8.0 → 0.9.0
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 +4 -4
- data/app/components/keystone/ui/checkbox_row_component.html.erb +9 -0
- data/app/components/keystone/ui/checkbox_row_component.rb +46 -0
- data/app/helpers/keystone_ui_helper.rb +4 -0
- data/lib/keystone_ui/safelist.rb +1 -0
- data/lib/keystone_ui/version.rb +1 -1
- data/the_local/agents/keystone_ui-develop.md +5 -0
- data/the_local/interface.yml +3 -0
- metadata +3 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 01e2ba0387ee8dd44d772be3546d44dada399d754099e486b607a73056c85606
|
|
4
|
+
data.tar.gz: ea5acc7537974e4bd59f7415e267b0038148fecd0890dc0b91a86f1af9a3801d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1f7b432026de7ac8ededb44facb8488df5ded58f185b91b9981654c978d7a32ce567b43b5fe38359c036a1457092a633ca54e2b5a873654250aac36b99bd1a08
|
|
7
|
+
data.tar.gz: fb986e2fde289d1c0b969096a04a02be8664544fbe7046d93c358b8d054440da8eed66824e23a23644b02efb76e0d25c95647bf0b32d06582dd0a5b4a0fd5bb1
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<label class="<%= row_classes %>">
|
|
2
|
+
<input type="checkbox" name="<%= name %>" value="<%= value %>" <%= "checked" if checked? %> class="<%= input_classes %>">
|
|
3
|
+
<span>
|
|
4
|
+
<span class="<%= label_classes %>"><%= label %></span>
|
|
5
|
+
<% if hint? %>
|
|
6
|
+
<span class="<%= hint_classes %>"><%= hint %></span>
|
|
7
|
+
<% end %>
|
|
8
|
+
</span>
|
|
9
|
+
</label>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Keystone
|
|
4
|
+
module Ui
|
|
5
|
+
class CheckboxRowComponent < ViewComponent::Base
|
|
6
|
+
ROW_CLASSES = "flex items-start gap-3 py-3 cursor-pointer"
|
|
7
|
+
INPUT_CLASSES = "mt-0.5 size-4 shrink-0 rounded border-surface-300 text-accent-600 focus:ring-accent-500"
|
|
8
|
+
LABEL_CLASSES = "block text-sm font-medium text-surface-900"
|
|
9
|
+
HINT_CLASSES = "block mt-0.5 text-sm text-surface-500"
|
|
10
|
+
|
|
11
|
+
attr_reader :name, :value, :label, :hint
|
|
12
|
+
|
|
13
|
+
def initialize(name:, value:, label:, hint: nil, checked: false)
|
|
14
|
+
@name = name
|
|
15
|
+
@value = value
|
|
16
|
+
@label = label
|
|
17
|
+
@hint = hint
|
|
18
|
+
@checked = checked
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def checked?
|
|
22
|
+
@checked
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def hint?
|
|
26
|
+
!@hint.nil?
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def row_classes
|
|
30
|
+
ROW_CLASSES
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def input_classes
|
|
34
|
+
INPUT_CLASSES
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def label_classes
|
|
38
|
+
LABEL_CLASSES
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def hint_classes
|
|
42
|
+
HINT_CLASSES
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
@@ -153,6 +153,10 @@ module KeystoneUiHelper
|
|
|
153
153
|
render Keystone::Ui::RadioCardComponent.new(**args)
|
|
154
154
|
end
|
|
155
155
|
|
|
156
|
+
def ui_checkbox_row(**args)
|
|
157
|
+
render Keystone::Ui::CheckboxRowComponent.new(**args)
|
|
158
|
+
end
|
|
159
|
+
|
|
156
160
|
def ui_progress(**args)
|
|
157
161
|
render Keystone::Ui::ProgressComponent.new(**args)
|
|
158
162
|
end
|
data/lib/keystone_ui/safelist.rb
CHANGED
|
@@ -42,6 +42,7 @@ module Keystone
|
|
|
42
42
|
Keystone::Ui::ShowPageComponent,
|
|
43
43
|
Keystone::Ui::OptionCardComponent,
|
|
44
44
|
Keystone::Ui::RadioCardComponent,
|
|
45
|
+
Keystone::Ui::CheckboxRowComponent,
|
|
45
46
|
Keystone::Ui::ProgressComponent,
|
|
46
47
|
Keystone::Ui::ColorPickerComponent,
|
|
47
48
|
Keystone::Ui::MultiSelectComponent,
|
data/lib/keystone_ui/version.rb
CHANGED
|
@@ -117,6 +117,11 @@ one raises at render time.
|
|
|
117
117
|
hue/saturation panel and writes the hex into a hidden input named `name`.
|
|
118
118
|
- `ui_radio_card(name:, value:, label:, hint: nil, checked: false)` — a
|
|
119
119
|
selectable card backed by a real radio input; selection styling is pure CSS.
|
|
120
|
+
- `ui_checkbox_row(name:, value:, label:, hint: nil, checked: false)` — a real
|
|
121
|
+
checkbox with its label and optional hint inside one `<label>`, so a tap
|
|
122
|
+
anywhere on the row toggles the box. A checked row submits `value` under
|
|
123
|
+
`name`; give several rows the same array name, e.g. `"shown[]"`, to submit the
|
|
124
|
+
checked values as a list. An unchecked row submits nothing. No JavaScript.
|
|
120
125
|
- `ui_option_card(name:, value:, selected: false, input_data: {}, label_data: {})`
|
|
121
126
|
— takes a block. A radio whose visible body is whatever the block renders.
|
|
122
127
|
`input_data:`/`label_data:` become `data-*` attributes on the input and label.
|
data/the_local/interface.yml
CHANGED
|
@@ -41,6 +41,7 @@ develop:
|
|
|
41
41
|
- ui_bottom_nav_item
|
|
42
42
|
- ui_option_card
|
|
43
43
|
- ui_radio_card
|
|
44
|
+
- ui_checkbox_row
|
|
44
45
|
- ui_progress
|
|
45
46
|
- ui_settings_link
|
|
46
47
|
- ui_color_picker
|
|
@@ -68,6 +69,8 @@ sources:
|
|
|
68
69
|
- app/components/keystone/ui/card_component.rb
|
|
69
70
|
- app/components/keystone/ui/card_link_component.rb
|
|
70
71
|
- app/components/keystone/ui/chart_card_component.rb
|
|
72
|
+
- app/components/keystone/ui/checkbox_row_component.rb
|
|
73
|
+
- app/components/keystone/ui/checkbox_row_component.html.erb
|
|
71
74
|
- app/components/keystone/ui/code_component.rb
|
|
72
75
|
- app/components/keystone/ui/color_picker_component.rb
|
|
73
76
|
- app/components/keystone/ui/column_picker_component.rb
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: keystone_ui
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tyler Schneider
|
|
@@ -90,6 +90,8 @@ files:
|
|
|
90
90
|
- app/components/keystone/ui/card_link_component.rb
|
|
91
91
|
- app/components/keystone/ui/chart_card_component.html.erb
|
|
92
92
|
- app/components/keystone/ui/chart_card_component.rb
|
|
93
|
+
- app/components/keystone/ui/checkbox_row_component.html.erb
|
|
94
|
+
- app/components/keystone/ui/checkbox_row_component.rb
|
|
93
95
|
- app/components/keystone/ui/code_component.html.erb
|
|
94
96
|
- app/components/keystone/ui/code_component.rb
|
|
95
97
|
- app/components/keystone/ui/color_picker_component.html.erb
|