phlex_kit 0.10.0 → 0.11.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.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/phlex_kit/phlex_kit.css +1 -0
  3. data/app/components/phlex_kit/accordion/accordion.css +7 -0
  4. data/app/components/phlex_kit/alert_dialog/alert_dialog_controller.js +3 -0
  5. data/app/components/phlex_kit/attachment/attachment_group.rb +6 -1
  6. data/app/components/phlex_kit/attachment/attachment_trigger.rb +5 -0
  7. data/app/components/phlex_kit/avatar/avatar_badge.rb +9 -2
  8. data/app/components/phlex_kit/badge/badge.css +1 -1
  9. data/app/components/phlex_kit/bubble/bubble.rb +4 -6
  10. data/app/components/phlex_kit/bubble/bubble_reactions.rb +4 -6
  11. data/app/components/phlex_kit/calendar/calendar_controller.js +33 -9
  12. data/app/components/phlex_kit/carousel/carousel.rb +3 -2
  13. data/app/components/phlex_kit/carousel/carousel_controller.js +23 -2
  14. data/app/components/phlex_kit/chart/chart.rb +8 -2
  15. data/app/components/phlex_kit/clipboard/clipboard_controller.js +9 -2
  16. data/app/components/phlex_kit/clipboard/clipboard_trigger.rb +1 -1
  17. data/app/components/phlex_kit/codeblock/codeblock.rb +7 -1
  18. data/app/components/phlex_kit/collapsible/collapsible.rb +4 -1
  19. data/app/components/phlex_kit/combobox/combobox_badge_trigger.rb +6 -2
  20. data/app/components/phlex_kit/combobox/combobox_controller.js +15 -1
  21. data/app/components/phlex_kit/combobox/combobox_input_trigger.rb +4 -1
  22. data/app/components/phlex_kit/combobox/combobox_list.rb +6 -2
  23. data/app/components/phlex_kit/combobox/combobox_toggle_all_checkbox.rb +4 -0
  24. data/app/components/phlex_kit/command/command_controller.js +6 -1
  25. data/app/components/phlex_kit/command/command_item.rb +4 -0
  26. data/app/components/phlex_kit/command/command_list.rb +6 -2
  27. data/app/components/phlex_kit/context_menu/context_menu_controller.js +25 -0
  28. data/app/components/phlex_kit/context_menu/context_menu_sub.rb +3 -1
  29. data/app/components/phlex_kit/context_menu/context_menu_sub_trigger.rb +3 -1
  30. data/app/components/phlex_kit/data_table/data_table.css +0 -10
  31. data/app/components/phlex_kit/data_table/data_table_column_toggle.rb +4 -1
  32. data/app/components/phlex_kit/data_table/data_table_controller.js +4 -0
  33. data/app/components/phlex_kit/date_picker/date_picker.rb +6 -0
  34. data/app/components/phlex_kit/dialog/dialog.css +3 -1
  35. data/app/components/phlex_kit/dialog/dialog_content.rb +1 -1
  36. data/app/components/phlex_kit/dialog/dialog_controller.js +13 -2
  37. data/app/components/phlex_kit/dropdown_menu/dropdown_menu.css +5 -2
  38. data/app/components/phlex_kit/dropdown_menu/dropdown_menu_controller.js +27 -0
  39. data/app/components/phlex_kit/dropdown_menu/dropdown_menu_sub.rb +3 -1
  40. data/app/components/phlex_kit/dropdown_menu/dropdown_menu_sub_trigger.rb +3 -1
  41. data/app/components/phlex_kit/field/field_separator.rb +1 -1
  42. data/app/components/phlex_kit/form_field/form_field_controller.js +22 -1
  43. data/app/components/phlex_kit/form_field/form_field_hint.rb +6 -2
  44. data/app/components/phlex_kit/hover_card/hover_card.css +4 -2
  45. data/app/components/phlex_kit/icon/icon.css +9 -0
  46. data/app/components/phlex_kit/icon/icon.rb +7 -1
  47. data/app/components/phlex_kit/input_group/input_group.css +0 -1
  48. data/app/components/phlex_kit/marker/marker.rb +9 -2
  49. data/app/components/phlex_kit/masked_input/masked_input_controller.js +20 -14
  50. data/app/components/phlex_kit/menubar/menubar_controller.js +6 -0
  51. data/app/components/phlex_kit/message/message.rb +5 -0
  52. data/app/components/phlex_kit/message_scroller/message_scroller_controller.js +3 -0
  53. data/app/components/phlex_kit/native_select/native_select.rb +12 -3
  54. data/app/components/phlex_kit/navigation_menu/navigation_menu.rb +4 -1
  55. data/app/components/phlex_kit/pagination/pagination.rb +10 -2
  56. data/app/components/phlex_kit/pagination/pagination_next.rb +3 -1
  57. data/app/components/phlex_kit/pagination/pagination_previous.rb +3 -1
  58. data/app/components/phlex_kit/popover/popover_controller.js +23 -1
  59. data/app/components/phlex_kit/progress/progress.css +8 -0
  60. data/app/components/phlex_kit/progress/progress.rb +14 -5
  61. data/app/components/phlex_kit/resizable/resizable_controller.js +3 -0
  62. data/app/components/phlex_kit/scroll_area/scroll_area.rb +5 -2
  63. data/app/components/phlex_kit/select/select.css +5 -2
  64. data/app/components/phlex_kit/select/select_controller.js +27 -4
  65. data/app/components/phlex_kit/separator/separator.rb +5 -1
  66. data/app/components/phlex_kit/sheet/sheet.css +4 -2
  67. data/app/components/phlex_kit/sheet/sheet_content_controller.js +4 -0
  68. data/app/components/phlex_kit/sheet/sheet_controller.js +15 -0
  69. data/app/components/phlex_kit/sidebar/sidebar_menu_button.rb +9 -1
  70. data/app/components/phlex_kit/sidebar/sidebar_menu_sub_button.rb +8 -1
  71. data/app/components/phlex_kit/slider/slider.css +15 -0
  72. data/app/components/phlex_kit/switch/switch.css +5 -0
  73. data/app/components/phlex_kit/table/table.css +2 -1
  74. data/app/components/phlex_kit/table/table.rb +5 -2
  75. data/app/components/phlex_kit/tabs/tabs_content.rb +4 -2
  76. data/app/components/phlex_kit/tabs/tabs_list.rb +7 -2
  77. data/app/components/phlex_kit/tabs/tabs_trigger.rb +11 -2
  78. data/app/components/phlex_kit/theme_toggle/theme_toggle_controller.js +14 -0
  79. data/app/components/phlex_kit/toast/toast.css +2 -1
  80. data/app/components/phlex_kit/toast/toast_action.rb +4 -1
  81. data/app/components/phlex_kit/toast/toast_controller.js +7 -4
  82. data/app/components/phlex_kit/toast/toast_region.rb +19 -9
  83. data/app/components/phlex_kit/toast/toaster_controller.js +15 -7
  84. data/app/components/phlex_kit/toggle_group/toggle_group.rb +1 -1
  85. data/app/components/phlex_kit/toggle_group/toggle_group_controller.js +5 -1
  86. data/app/components/phlex_kit/toggle_group/toggle_group_item.rb +9 -1
  87. data/app/components/phlex_kit/tooltip/tooltip.css +5 -1
  88. data/app/components/phlex_kit/tooltip/tooltip_controller.js +7 -1
  89. data/app/components/phlex_kit/typography/heading.rb +7 -1
  90. data/app/components/phlex_kit/typography/list.rb +22 -0
  91. data/app/components/phlex_kit/typography/text.rb +7 -1
  92. data/lib/phlex_kit/base_component.rb +13 -0
  93. data/lib/phlex_kit/version.rb +1 -1
  94. metadata +3 -1
@@ -8,6 +8,9 @@ module PhlexKit
8
8
  # ruby_ui's level → default size mapping (h1 is big, h4 smaller); 5/6
9
9
  # extend the scale downward — HTML has h1–h6, so all six must map.
10
10
  LEVEL_SIZE = { "1" => "7", "2" => "6", "3" => "5", "4" => "4", "5" => "3", "6" => "2" }.freeze
11
+ # `as:` is dispatched dynamically (send) — whitelist so it can't reach
12
+ # arbitrary (including private) methods. Mirrors Separator/Marker.
13
+ AS_TAGS = %i[h1 h2 h3 h4 h5 h6 p span div].freeze
11
14
 
12
15
  # level: defaults to 1 so `Heading.new` is identical to `Heading.new(level: 1)`
13
16
  # (a nil default used to render h1 with the level-6 size — self-disagreeing).
@@ -18,7 +21,10 @@ module PhlexKit
18
21
  raise ArgumentError, "Invalid heading level: #{level.inspect} — valid: 1–6"
19
22
  end
20
23
  @level = level
21
- @as = as
24
+ @as = as&.to_sym
25
+ if @as && !AS_TAGS.include?(@as)
26
+ raise ArgumentError, "unknown Heading as: #{@as.inspect} (use one of #{AS_TAGS.join(", ")})"
27
+ end
22
28
  @size = size
23
29
  @attrs = attrs
24
30
  end
@@ -0,0 +1,22 @@
1
+ module PhlexKit
2
+ # Prose list, ported from shadcn/ui's typography "list" style (ruby_ui's
3
+ # TypographyList). Renders a ul (or ol via as:) with the .pk-list styling
4
+ # that previously shipped as an orphaned utility class. Children are plain
5
+ # <li>s.
6
+ class List < BaseComponent
7
+ # `as:` is dispatched dynamically (send) — whitelist like Separator.
8
+ AS_TAGS = %i[ul ol].freeze
9
+
10
+ def initialize(as: :ul, **attrs)
11
+ @as = as.to_sym
12
+ unless AS_TAGS.include?(@as)
13
+ raise ArgumentError, "unknown List as: #{@as.inspect} (use one of #{AS_TAGS.join(", ")})"
14
+ end
15
+ @attrs = attrs
16
+ end
17
+
18
+ def view_template(&)
19
+ send(@as, **mix({ class: "pk-list" }, @attrs), &)
20
+ end
21
+ end
22
+ end
@@ -27,9 +27,15 @@ module PhlexKit
27
27
  bold: "pk-text-bold",
28
28
  muted: "pk-text-muted"
29
29
  }.freeze
30
+ # `as:` is dispatched dynamically (send) — whitelist so it can't reach
31
+ # arbitrary (including private) methods. Mirrors Separator/Marker.
32
+ AS_TAGS = %i[p span div label small strong em].freeze
30
33
 
31
34
  def initialize(as: :p, size: "3", weight: :regular, **attrs)
32
- @as = as
35
+ @as = as.to_sym
36
+ unless AS_TAGS.include?(@as)
37
+ raise ArgumentError, "unknown Text as: #{@as.inspect} (use one of #{AS_TAGS.join(", ")})"
38
+ end
33
39
  @size = size.to_s
34
40
  @weight = weight.to_sym
35
41
  @attrs = attrs
@@ -30,5 +30,18 @@ module PhlexKit
30
30
  "valid: #{map.keys.map(&:inspect).join(", ")}"
31
31
  end
32
32
  end
33
+
34
+ # True when the caller supplied an accessible name in @attrs — via the
35
+ # aria: hash or flat aria_label/aria-label(ledby) keys. Components with a
36
+ # generated default label must skip it then: `mix` merges duplicate string
37
+ # attrs ("pagination Résultats") instead of overriding.
38
+ def aria_labelled?
39
+ aria = @attrs[:aria] || @attrs["aria"]
40
+ if aria.is_a?(Hash)
41
+ return true if %i[label labelledby].any? { |k| aria[k] || aria[k.to_s] }
42
+ end
43
+ [ :aria_label, "aria_label", "aria-label",
44
+ :aria_labelledby, "aria_labelledby", "aria-labelledby" ].any? { |k| @attrs[k] }
45
+ end
33
46
  end
34
47
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PhlexKit
4
- VERSION = "0.10.0"
4
+ VERSION = "0.11.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phlex_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Kennedy
@@ -373,6 +373,7 @@ files:
373
373
  - app/components/phlex_kit/hover_card/hover_card_content.rb
374
374
  - app/components/phlex_kit/hover_card/hover_card_controller.js
375
375
  - app/components/phlex_kit/hover_card/hover_card_trigger.rb
376
+ - app/components/phlex_kit/icon/icon.css
376
377
  - app/components/phlex_kit/icon/icon.rb
377
378
  - app/components/phlex_kit/input/input.css
378
379
  - app/components/phlex_kit/input/input.rb
@@ -587,6 +588,7 @@ files:
587
588
  - app/components/phlex_kit/typography/heading.rb
588
589
  - app/components/phlex_kit/typography/inline_code.rb
589
590
  - app/components/phlex_kit/typography/inline_link.rb
591
+ - app/components/phlex_kit/typography/list.rb
590
592
  - app/components/phlex_kit/typography/text.rb
591
593
  - app/components/phlex_kit/typography/typography.css
592
594
  - app/javascript/phlex_kit/controllers/index.js