keystone_ui 0.84.0 → 0.85.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1d6aca33ab4bb957d295ce1adc465f61381cac1d772d3e885be8d52c4046dfe4
4
- data.tar.gz: 7e0e253257eacc75d574b4ae11f471e1340af12a446024e8b4c4063e42f8cd66
3
+ metadata.gz: 85457be1129db7d375f22f600c702f0c2d75c8d93e1dbb9443cbf6c59ab57294
4
+ data.tar.gz: 677ef89d8e94bf3fc4a8fd46df2ce7d7e99e91766bdc6ffee2bcc19c1c293e2f
5
5
  SHA512:
6
- metadata.gz: 929aa35425b706b9fc32da6ce3ed248ebead30afa1c3b1bce0abc68ab81e6a77ac00602ca29a93969e5413a622724fce2f2ed0523c9f95161ba32749e1f43d8f
7
- data.tar.gz: cdefad1999050ec571db3ab9d304801f3cccd493dd7ca11b98f2eb99648511d1a65aec869201fa262c81beb45deaf64c98322e0bff00d7df1092f193eaceae38
6
+ metadata.gz: bc60e2d038b07b075cef52782834681100eb2c3e7814e600f11db7f7e7d3045f3ece2067799039cc94e1a6eea2b88c43cee24c24238db589b67e1f399ddbedfe
7
+ data.tar.gz: 00432aab92887c8f5d5e2ad30f80cb9a3c3b2a05513987731058e6adfebee1c84ea454963c624e022585ee17af8e38f7dc7abc38d89bf1d20a5f861cf9e50ed8
@@ -3,13 +3,7 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class BadgeComponent < ViewComponent::Base
6
- VARIANT_CLASSES = {
7
- neutral: "ks-badge-neutral",
8
- success: "ks-badge-success",
9
- danger: "ks-badge-danger",
10
- warning: "ks-badge-warning",
11
- info: "ks-badge-info"
12
- }.freeze
6
+ VARIANT_CLASSES = States::NAMES.to_h { |state| [ state, "ks-badge-#{state}" ] }.freeze
13
7
 
14
8
  attr_reader :label
15
9
 
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Keystone
4
+ module Ui
5
+ module States
6
+ NAMES = %i[neutral success danger warning info].freeze
7
+ end
8
+ end
9
+ end
@@ -3,13 +3,7 @@
3
3
  module Keystone
4
4
  module Ui
5
5
  class StatusDotComponent < ViewComponent::Base
6
- STATE_CLASSES = {
7
- neutral: "ks-status-dot-neutral",
8
- success: "ks-status-dot-success",
9
- danger: "ks-status-dot-danger",
10
- warning: "ks-status-dot-warning",
11
- info: "ks-status-dot-info"
12
- }.freeze
6
+ STATE_CLASSES = States::NAMES.to_h { |state| [ state, "ks-status-dot-#{state}" ] }.freeze
13
7
 
14
8
  LABEL_CLASSES = "sr-only"
15
9
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module KeystoneUi
4
- VERSION = "0.84.0"
4
+ VERSION = "0.85.0"
5
5
  end
@@ -625,13 +625,15 @@ two exceptions: `ui_page`'s `padding:` treats any value other than `:none` as
625
625
  `full_size_url:`, tapping the picture opens that address in a new tab, so
626
626
  pass `src:` a smaller version and `full_size_url:` the original file. Ask
627
627
  the developer which version of an uploaded image each address points at.
628
- - `ui_badge(label:, variant: :neutral, class: nil)` — `variant:` is
629
- `:neutral` `:success` `:danger` `:warning` `:info`.
630
- - `ui_status_dot(state:, label:)` — `state:` is `:neutral` `:success`
631
- `:danger` `:warning` `:info`, and any other value raises `ArgumentError`
628
+ - `ui_badge(label:, variant: :neutral, class: nil)` — `variant:` is one of
629
+ the five states `:neutral` `:success` `:danger` `:warning` `:info`, and
630
+ any other value raises `KeyError` naming it when the badge is drawn.
631
+ - `ui_status_dot(state:, label:)` — `state:` is one of the same five states
632
+ a badge's `variant:` takes, and any other value raises `ArgumentError`
632
633
  naming it. `label:` is not shown on screen and is read out by screen
633
634
  readers, so pass words that say what the state means. The dot takes the
634
- colour of a `ui_badge` of the same name. Use it where a badge's words
635
+ colour of a `ui_badge` of the same state, so a record's state can be
636
+ passed to either one unchanged. Use it where a badge's words
635
637
  would crowd the row, such as beside a name in a list, and ask the
636
638
  developer which states a record has and what each one means.
637
639
  - `ui_alert(message:, type: :info, title: nil, dismissible: false, class: nil)`
@@ -130,11 +130,13 @@ One decision: is keystone_ui set up in the app?
130
130
  - **Action menus.** Each action is a label, an address and an HTTP method. A
131
131
  plain visit is a link, and any other method is a button, so an action that
132
132
  changes data is never a bare link. A delete asks for confirmation by default.
133
- - **Status states.** A badge and a status dot share five states: neutral,
134
- success, danger, warning and info. A badge shows its label as text. A status
135
- dot shows only its state's colour, for places with no room for text, and its label
136
- is read only by screen readers. A status dot raises `ArgumentError` on any
137
- other state.
133
+ - **Status states.** A badge and a status dot read one list of five states:
134
+ neutral, success, danger, warning and info. A state added to that list is
135
+ accepted by both, so the two never disagree about which states exist. A badge
136
+ shows its label as text. A status dot shows only its state's colour, for
137
+ places with no room for text, and its label is read only by screen readers.
138
+ Neither accepts a state outside the list: a status dot raises `ArgumentError`
139
+ naming the states it expects, and a badge raises `KeyError` when it renders.
138
140
  - **Text diffs.** A text diff compares two texts line by line and shows them
139
141
  side by side, stacked on a phone, in the code block's look. Lines the two
140
142
  share sit on the same row, a line only the first text has is marked removed
@@ -162,7 +162,7 @@ built on ViewComponent; hook it in before building any screen with those helpers
162
162
  @import "./look.css";
163
163
  ```
164
164
 
165
- Buttons, panels, cards, alerts, badges, form fields, the modal, the mobile
165
+ Buttons, panels, cards, alerts, badges, status dots, form fields, the modal, the mobile
166
166
  action menu, the action menu, the column picker, multi select, search select, copy button, theme toggle,
167
167
  checkbox row, radio card, option card, file upload and colour picker read
168
168
  these variables. So do the data display components: stat card, chart card,
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.84.0
4
+ version: 0.85.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyler Schneider
@@ -214,6 +214,7 @@ files:
214
214
  - app/components/keystone/ui/sortable_list_component.rb
215
215
  - app/components/keystone/ui/stat_card_component.html.erb
216
216
  - app/components/keystone/ui/stat_card_component.rb
217
+ - app/components/keystone/ui/states.rb
217
218
  - app/components/keystone/ui/status_dot_component.rb
218
219
  - app/components/keystone/ui/swipe_deck_component.html.erb
219
220
  - app/components/keystone/ui/swipe_deck_component.rb