playbook_ui 15.6.0.pre.alpha.play265012865 → 15.6.0.pre.alpha.play265012993

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 (45) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +1 -1
  3. data/app/pb_kits/playbook/pb_card/docs/_card_header.md +1 -1
  4. data/app/pb_kits/playbook/pb_card/docs/_card_highlight.md +1 -1
  5. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +2 -2
  6. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleIcon.tsx +10 -8
  7. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_icons.jsx +0 -1
  8. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_state.jsx +0 -3
  9. data/app/pb_kits/playbook/pb_date_picker/date_picker.test.js +24 -0
  10. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +181 -3
  11. data/app/pb_kits/playbook/pb_distribution_bar/docs/_distribution_bar_custom_colors.md +1 -1
  12. data/app/pb_kits/playbook/pb_draggable/context/index.tsx +316 -15
  13. data/app/pb_kits/playbook/pb_draggable/context/types.ts +1 -1
  14. data/app/pb_kits/playbook/pb_legend/_legend.tsx +0 -1
  15. data/app/pb_kits/playbook/pb_legend/legend.html.erb +1 -0
  16. data/app/pb_kits/playbook/pb_radio/docs/_radio_error.md +1 -1
  17. data/app/pb_kits/playbook/pb_select/_select.tsx +8 -3
  18. data/app/pb_kits/playbook/pb_select/docs/_select_error.md +1 -1
  19. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.html.erb +16 -0
  20. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.jsx +30 -0
  21. data/app/pb_kits/playbook/pb_select/docs/_select_input_options.md +1 -0
  22. data/app/pb_kits/playbook/pb_select/docs/example.yml +2 -0
  23. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  24. data/app/pb_kits/playbook/pb_select/select.html.erb +2 -2
  25. data/app/pb_kits/playbook/pb_select/select.rb +3 -1
  26. data/app/pb_kits/playbook/pb_select/select.test.js +23 -0
  27. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_error.md +1 -1
  28. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_error.md +1 -1
  29. data/app/pb_kits/playbook/tokens/_colors.scss +2 -1
  30. data/app/pb_kits/playbook/utilities/deprecated.ts +11 -3
  31. data/dist/chunks/_typeahead-DMyvWpig.js +6 -0
  32. data/dist/chunks/lib-DDDLiZuu.js +29 -0
  33. data/dist/chunks/vendor.js +2 -2
  34. data/dist/playbook-rails-react-bindings.js +1 -1
  35. data/dist/playbook-rails.js +1 -1
  36. data/dist/playbook.css +1 -1
  37. data/lib/playbook/forms/builder/collection_select_field.rb +9 -1
  38. data/lib/playbook/forms/builder/select_field.rb +9 -1
  39. data/lib/playbook/forms/builder/time_zone_select_field.rb +9 -1
  40. data/lib/playbook/pb_kit_helper.rb +35 -0
  41. data/lib/playbook/version.rb +1 -1
  42. metadata +7 -5
  43. data/app/pb_kits/playbook/utilities/DEPRECATION_WARNINGS.md +0 -82
  44. data/dist/chunks/_typeahead-Mjy3POtc.js +0 -6
  45. data/dist/chunks/lib-CgpqUb6l.js +0 -29
@@ -4,10 +4,18 @@ module Playbook
4
4
  module Forms
5
5
  class Builder
6
6
  def collection_select(name, collection, value_method, text_method, options = {}, html_options = {}, props: {})
7
- props[:label] = @template.label(@object_name, name) if props[:label] == true
7
+ props[:input_options] ||= {}
8
+ props[:input_options][:id] ||= "#{@object_name}_#{name}"
9
+
10
+ props[:label] = @template.label(@object_name, name, for: props[:input_options][:id]) if props[:label] == true
11
+
8
12
  options[:skip_default_ids] = false unless options.key?(:skip_default_ids)
9
13
  options[:prompt] = props[:blank_selection] || ""
10
14
  html_options[:required] = "required" if props[:required]
15
+ html_options[:id] = props[:input_options][:id]
16
+ html_options[:class] = props[:input_options][:class] if props[:input_options][:class]
17
+ html_options[:data] = (html_options[:data] || {}).merge(props[:input_options][:data] || {})
18
+
11
19
  input = super(name, collection, value_method, text_method, options, html_options)
12
20
 
13
21
  @template.pb_rails("select", props: props) do
@@ -4,10 +4,18 @@ module Playbook
4
4
  module Forms
5
5
  class Builder
6
6
  def select(name, choices = nil, options = {}, html_options = {}, props: {}, &block)
7
- props[:label] = @template.label(@object_name, name) if props[:label] == true
7
+ props[:input_options] ||= {}
8
+ props[:input_options][:id] ||= "#{@object_name}_#{name}"
9
+
10
+ props[:label] = @template.label(@object_name, name, for: props[:input_options][:id]) if props[:label] == true
11
+
8
12
  options[:skip_default_ids] = false unless options.key?(:skip_default_ids)
9
13
  options[:prompt] = props[:blank_selection] || ""
10
14
  html_options[:required] = "required" if props[:required]
15
+ html_options[:id] = props[:input_options][:id]
16
+ html_options[:class] = props[:input_options][:class] if props[:input_options][:class]
17
+ html_options[:data] = (html_options[:data] || {}).merge(props[:input_options][:data] || {})
18
+
11
19
  input = super(name, choices, options, html_options, &block)
12
20
 
13
21
  @template.pb_rails("select", props: props) do
@@ -4,10 +4,18 @@ module Playbook
4
4
  module Forms
5
5
  class Builder
6
6
  def time_zone_select_field(name, choices = {}, options = {}, html_options = {}, props: {})
7
- props[:label] = @template.label(@object_name, name) if props[:label] == true
7
+ props[:input_options] ||= {}
8
+ props[:input_options][:id] ||= "#{@object_name}_#{name}"
9
+
10
+ props[:label] = @template.label(@object_name, name, for: props[:input_options][:id]) if props[:label] == true
11
+
8
12
  options[:skip_default_ids] = false unless options.key?(:skip_default_ids)
9
13
  options[:prompt] = props[:blank_selection] || ""
10
14
  html_options[:required] = "required" if props[:required]
15
+ html_options[:id] = props[:input_options][:id]
16
+ html_options[:class] = props[:input_options][:class] if props[:input_options][:class]
17
+ html_options[:data] = (html_options[:data] || {}).merge(props[:input_options][:data] || {})
18
+
11
19
  input = @template.time_zone_select(@object_name, name, choices, options, html_options)
12
20
 
13
21
  @template.pb_rails("select", props: props) do
@@ -13,5 +13,40 @@ module Playbook
13
13
  render kit.new(props, &block), &block
14
14
  end
15
15
  end
16
+
17
+ def deprecated_kit_warning(kit_name, message = nil)
18
+ # Skip in test and production environments
19
+ return "".html_safe if Rails.env.test? || Rails.env.production?
20
+
21
+ # Build the warning message
22
+ base_message = "PLAYBOOK DEPRECATION WARNING\\n ----------------------------\\n The \\\"#{kit_name}\\\" kit is deprecated and will be removed in a future version."
23
+
24
+ full_message = if message
25
+ "#{base_message} #{message}"
26
+ else
27
+ "#{base_message} Please migrate to the recommended alternative"
28
+ end
29
+
30
+ # Escape the message for JavaScript
31
+ escaped_message = full_message.gsub("'", "\\\\'").gsub("\n", "\\n")
32
+
33
+ # Return a self-executing script that checks if we're already warned
34
+ # Uses client-side tracking to ensure one warning per page load
35
+ # Only shows warnings on localhost (matching React behavior)
36
+ script = "<script type=\"text/javascript\">\n"
37
+ script += "(function() {\n"
38
+ script += " var hostname = window.location.hostname;\n"
39
+ script += " var isLocalDev = hostname === 'localhost' || hostname === '127.0.0.1' || hostname.endsWith('.local') || hostname.includes('local.') || !hostname;\n"
40
+ script += " if (!isLocalDev) return;\n"
41
+ script += " if (!window.__PB_WARNED_KITS__) window.__PB_WARNED_KITS__ = new Set();\n"
42
+ script += " if (!window.__PB_WARNED_KITS__.has('#{kit_name}')) {\n"
43
+ script += " window.__PB_WARNED_KITS__.add('#{kit_name}');\n"
44
+ script += " console.warn('#{escaped_message}');\n"
45
+ script += " }\n"
46
+ script += "})();\n"
47
+ script += "</script>"
48
+
49
+ script.html_safe
50
+ end
16
51
  end
17
52
  end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "15.6.0"
5
- VERSION = "15.6.0.pre.alpha.play265012865"
5
+ VERSION = "15.6.0.pre.alpha.play265012993"
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: 15.6.0.pre.alpha.play265012865
4
+ version: 15.6.0.pre.alpha.play265012993
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: 2025-12-05 00:00:00.000000000 Z
12
+ date: 2025-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -2935,6 +2935,9 @@ files:
2935
2935
  - app/pb_kits/playbook/pb_select/docs/_select_inline_compact.jsx
2936
2936
  - app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.html.erb
2937
2937
  - app/pb_kits/playbook/pb_select/docs/_select_inline_show_arrow.jsx
2938
+ - app/pb_kits/playbook/pb_select/docs/_select_input_options.html.erb
2939
+ - app/pb_kits/playbook/pb_select/docs/_select_input_options.jsx
2940
+ - app/pb_kits/playbook/pb_select/docs/_select_input_options.md
2938
2941
  - app/pb_kits/playbook/pb_select/docs/_select_multiple.html.erb
2939
2942
  - app/pb_kits/playbook/pb_select/docs/_select_multiple.jsx
2940
2943
  - app/pb_kits/playbook/pb_select/docs/_select_multiple.md
@@ -3799,7 +3802,6 @@ files:
3799
3802
  - app/pb_kits/playbook/tokens/exports/_typography.module.scss
3800
3803
  - app/pb_kits/playbook/tokens/exports/exports.d.ts
3801
3804
  - app/pb_kits/playbook/tokens/index.scss
3802
- - app/pb_kits/playbook/utilities/DEPRECATION_WARNINGS.md
3803
3805
  - app/pb_kits/playbook/utilities/_background_colors.scss
3804
3806
  - app/pb_kits/playbook/utilities/_border_radius.scss
3805
3807
  - app/pb_kits/playbook/utilities/_colors.scss
@@ -3863,9 +3865,9 @@ files:
3863
3865
  - app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js
3864
3866
  - app/pb_kits/playbook/utilities/text.ts
3865
3867
  - app/pb_kits/playbook/utilities/validEmojiChecker.ts
3866
- - dist/chunks/_typeahead-Mjy3POtc.js
3868
+ - dist/chunks/_typeahead-DMyvWpig.js
3867
3869
  - dist/chunks/lazysizes-B7xYodB-.js
3868
- - dist/chunks/lib-CgpqUb6l.js
3870
+ - dist/chunks/lib-DDDLiZuu.js
3869
3871
  - dist/chunks/vendor.js
3870
3872
  - dist/menu.yml
3871
3873
  - dist/playbook-rails-react-bindings.js
@@ -1,82 +0,0 @@
1
- # Deprecation Warning System for React Kits
2
-
3
- ## Overview
4
-
5
- This system provides runtime console warnings when deprecated Playbook kits are used in development mode. It helps developers identify deprecated kit usage in Nitro, Tempo, Runway, and other apps without impacting production builds.
6
-
7
- ## How It Works
8
-
9
- ### Key Features
10
-
11
- ✅ **Once per page load**: Each deprecated kit logs exactly one warning per page load, preventing spam on re-renders
12
- ✅ **Dev mode only**: No warnings in production builds (`process.env.NODE_ENV === 'production'`)
13
- ✅ **Platform-specific**: Can warn only for React or Rails, or both
14
- ✅ **Customizable messages**: Default or custom deprecation messages
15
-
16
- ## Usage
17
-
18
- ### Step 1: Import the utility
19
-
20
- In your kit's main React component file (e.g., `_bar_graph.tsx`):
21
-
22
- ```tsx
23
- import { deprecatedKitWarning } from "../utilities/deprecated";
24
- ```
25
-
26
- ### Step 2: Add the warning in a useEffect hook
27
-
28
- Add a `useEffect` hook that calls the warning once when the component mounts:
29
-
30
- ```tsx
31
- const YourKit = (props: YourKitProps): React.ReactElement => {
32
-
33
- useEffect(() => {
34
- deprecatedKitWarning('YourKitName', 'Optional custom message');
35
- }, []); // Empty dependency array ensures it runs once
36
-
37
- // rest of component
38
- };
39
- ```
40
-
41
-
42
- ## API Reference
43
-
44
- ### `deprecatedKitWarning(kitName, message?)`
45
-
46
- **Parameters:**
47
- - `kitName` (string, required): Name of the deprecated kit (e.g., 'BarGraph')
48
- - `message` (string, optional): Custom deprecation message. If omitted, uses default.
49
-
50
- **Default message format:**
51
- ```
52
- [Playbook] The "{kitName}" kit is deprecated and will be removed in a future version. Please migrate to the recommended alternative.
53
- ```
54
-
55
- **Behavior:**
56
- - Only logs in development mode (`process.env.NODE_ENV !== 'production'`)
57
- - Tracks warned kits in a Set to prevent duplicate warnings
58
- - Silent in production builds
59
-
60
-
61
- ## Best Practices
62
-
63
- ### 1. Place the warning early in the component lifecycle
64
- ```tsx
65
- useEffect(() => {
66
- deprecatedKitWarning('YourKit');
67
- }, []); // Run once on mount
68
- ```
69
-
70
- ### 2. Provide helpful migration messages
71
- ```tsx
72
- deprecatedKitWarning(
73
- 'BarGraph',
74
- '[Playbook] The "BarGraph" kit is deprecated. Please use "PbBarGraph" instead.'
75
- );
76
- ```
77
-
78
- ### 3. Check menu.yml before applying
79
- Always verify the kit's status in `playbook-website/config/menu.yml` to ensure it's actually deprecated for React.
80
-
81
- ### 4. Don't over-warn
82
- The utility handles deduplication, but keep it to one `deprecatedKitWarning` call per kit component.