playbook_ui 12.31.0 → 12.32.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (25) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_button/docs/_button_hover.html.erb +3 -0
  3. data/app/pb_kits/playbook/pb_button/docs/example.yml +1 -0
  4. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -1
  5. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +37 -31
  6. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +28 -19
  7. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.html.erb +17 -0
  8. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.jsx +33 -0
  9. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.md +3 -0
  10. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
  11. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
  12. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.html.erb +8 -2
  13. data/app/pb_kits/playbook/pb_message/docs/_message_hover.html.erb +25 -0
  14. data/app/pb_kits/playbook/pb_message/docs/example.yml +1 -0
  15. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +1 -0
  16. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +12 -1
  17. data/app/pb_kits/playbook/utilities/_hover.scss +1 -1
  18. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
  19. data/dist/playbook-rails.js +4 -4
  20. data/lib/playbook/border_radius.rb +29 -0
  21. data/lib/playbook/classnames.rb +2 -0
  22. data/lib/playbook/hover.rb +60 -0
  23. data/lib/playbook/kit_base.rb +4 -0
  24. data/lib/playbook/version.rb +2 -2
  25. metadata +9 -2
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module BorderRadius
5
+ def self.included(base)
6
+ base.prop :border_radius
7
+ end
8
+
9
+ def border_radius_props
10
+ selected_props = border_radius_options.keys.select { |sk| try(sk) }
11
+ return nil unless selected_props.present?
12
+
13
+ selected_props.map do |k|
14
+ border_radius_value = send(k)
15
+ "border_radius_#{border_radius_value}" if border_radius_values.include? border_radius_value
16
+ end.compact.join(" ")
17
+ end
18
+
19
+ def border_radius_options
20
+ {
21
+ border_radius: "border_radius",
22
+ }
23
+ end
24
+
25
+ def border_radius_values
26
+ %w[none xs sm md lg xl rounded]
27
+ end
28
+ end
29
+ end
@@ -32,6 +32,8 @@ module Playbook
32
32
  flex_shrink_props,
33
33
  order_props,
34
34
  position_props,
35
+ hover_props,
36
+ border_radius_props,
35
37
  ].compact.join(" ")
36
38
  end
37
39
 
@@ -0,0 +1,60 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Playbook
4
+ module Hover
5
+ def self.included(base)
6
+ base.prop :hover
7
+ end
8
+
9
+ def hover_options
10
+ {
11
+ hover: "hover",
12
+ }
13
+ end
14
+
15
+ def hover_shadow_values
16
+ %w[deep deeper deepest]
17
+ end
18
+
19
+ def hover_scale_values
20
+ %w[sm md lg]
21
+ end
22
+
23
+ def hover_background_values
24
+ []
25
+ end
26
+
27
+ def hover_values
28
+ hover_options.keys.select { |sk| try(sk) }
29
+ end
30
+
31
+ def hover_attributes
32
+ %w[background shadow scale]
33
+ end
34
+
35
+ def hover_props
36
+ selected_props = hover_options.keys.select { |sk| try(sk) }
37
+ return nil unless selected_props.present?
38
+
39
+ responsive = selected_props.present? && try(selected_props.first).is_a?(::Hash)
40
+ css = ""
41
+ selected_props.each do |prop|
42
+ value = send(prop)
43
+ prefix = hover_options[prop]
44
+ if responsive
45
+ value.each do |key, val|
46
+ if key == :background
47
+ css += "#{prefix}_#{key}_#{val} " if hover_attributes.include?(key.to_s)
48
+ elsif hover_attributes.include?(key.to_s) && send("hover_#{key}_values").include?(val.to_s)
49
+ css += "#{prefix}_#{key}_#{val} "
50
+ end
51
+ end
52
+ elsif send("hover_#{prop}_values").include?(value)
53
+ css += "#{prefix}_#{value} "
54
+ end
55
+ end
56
+
57
+ css.strip unless css.blank?
58
+ end
59
+ end
60
+ end
@@ -20,6 +20,8 @@ require "playbook/flex_grow"
20
20
  require "playbook/flex_shrink"
21
21
  require "playbook/order"
22
22
  require "playbook/position"
23
+ require "playbook/hover"
24
+ require "playbook/border_radius"
23
25
 
24
26
  module Playbook
25
27
  class KitBase < ViewComponent::Base
@@ -45,6 +47,8 @@ module Playbook
45
47
  include Playbook::FlexShrink
46
48
  include Playbook::Order
47
49
  include Playbook::Position
50
+ include Playbook::Hover
51
+ include Playbook::BorderRadius
48
52
 
49
53
  prop :id
50
54
  prop :data, type: Playbook::Props::Hash, default: {}
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "12.30.1"
5
- VERSION = "12.31.0"
4
+ PREVIOUS_VERSION = "12.31.0"
5
+ VERSION = "12.32.0"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.31.0
4
+ version: 12.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-07-13 00:00:00.000000000 Z
12
+ date: 2023-07-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -429,6 +429,7 @@ files:
429
429
  - app/pb_kits/playbook/pb_button/docs/_button_full_width.html.erb
430
430
  - app/pb_kits/playbook/pb_button/docs/_button_full_width.jsx
431
431
  - app/pb_kits/playbook/pb_button/docs/_button_full_width.md
432
+ - app/pb_kits/playbook/pb_button/docs/_button_hover.html.erb
432
433
  - app/pb_kits/playbook/pb_button/docs/_button_hover.jsx
433
434
  - app/pb_kits/playbook/pb_button/docs/_button_icon_options.html.erb
434
435
  - app/pb_kits/playbook/pb_button/docs/_button_icon_options.jsx
@@ -970,6 +971,9 @@ files:
970
971
  - app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_description.md
971
972
  - app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.jsx
972
973
  - app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_auto_close.md
974
+ - app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.html.erb
975
+ - app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.jsx
976
+ - app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children.md
973
977
  - app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_close.html.erb
974
978
  - app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_close.jsx
975
979
  - app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_default.html.erb
@@ -1439,6 +1443,7 @@ files:
1439
1443
  - app/pb_kits/playbook/pb_message/docs/_message_default.html.erb
1440
1444
  - app/pb_kits/playbook/pb_message/docs/_message_default.jsx
1441
1445
  - app/pb_kits/playbook/pb_message/docs/_message_default.md
1446
+ - app/pb_kits/playbook/pb_message/docs/_message_hover.html.erb
1442
1447
  - app/pb_kits/playbook/pb_message/docs/_message_hover.jsx
1443
1448
  - app/pb_kits/playbook/pb_message/docs/_message_timestamp.html.erb
1444
1449
  - app/pb_kits/playbook/pb_message/docs/_message_timestamp.jsx
@@ -2481,6 +2486,7 @@ files:
2481
2486
  - lib/playbook/align_content.rb
2482
2487
  - lib/playbook/align_items.rb
2483
2488
  - lib/playbook/align_self.rb
2489
+ - lib/playbook/border_radius.rb
2484
2490
  - lib/playbook/classnames.rb
2485
2491
  - lib/playbook/cursor.rb
2486
2492
  - lib/playbook/display.rb
@@ -2501,6 +2507,7 @@ files:
2501
2507
  - lib/playbook/forms/builder/multi_level_select_field.rb
2502
2508
  - lib/playbook/forms/builder/select_field.rb
2503
2509
  - lib/playbook/forms/builder/typeahead_field.rb
2510
+ - lib/playbook/hover.rb
2504
2511
  - lib/playbook/justify_content.rb
2505
2512
  - lib/playbook/justify_self.rb
2506
2513
  - lib/playbook/kit_base.rb