playbook_ui 15.5.0.pre.alpha.play265012854 → 15.5.0.pre.alpha.revert5553typeaheadfix12763
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/pb_kits/playbook/pb_background/_background.tsx +6 -6
- data/app/pb_kits/playbook/pb_background/background.test.js +1 -5
- data/app/pb_kits/playbook/pb_background/docs/_background_light.html.erb +1 -1
- data/app/pb_kits/playbook/pb_background/docs/_background_light.jsx +1 -0
- data/app/pb_kits/playbook/pb_background/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_bar_graph/_bar_graph.tsx +0 -6
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +0 -31
- data/app/pb_kits/playbook/pb_legend/_legend.tsx +1 -6
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +10 -44
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +4 -34
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +7 -16
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +2 -13
- data/dist/chunks/_typeahead-j69iQ_Qb.js +6 -0
- data/dist/chunks/vendor.js +2 -2
- data/dist/menu.yml +2 -3
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +3 -6
- data/app/pb_kits/playbook/pb_background/docs/_background_light.md +0 -1
- data/app/pb_kits/playbook/utilities/DEPRECATION_WARNINGS.md +0 -82
- data/app/pb_kits/playbook/utilities/deprecated.ts +0 -71
- data/dist/chunks/_typeahead-EauOtKPs.js +0 -6
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tracks which deprecated kits have already logged warnings in this session
|
|
3
|
-
* to ensure we only log once per page load per kit
|
|
4
|
-
*/
|
|
5
|
-
const warnedKits = new Set<string>();
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Logs a deprecation warning for a Playbook kit
|
|
9
|
-
* - Only logs once per kit per page load (prevents spam on re-renders)
|
|
10
|
-
* - Only logs in development mode (not in production or test environments)
|
|
11
|
-
*
|
|
12
|
-
* @param kitName - The name of the deprecated kit (e.g., 'BarGraph', 'RichTextEditor')
|
|
13
|
-
* @param message - Optional custom deprecation message. If not provided, uses a default message.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* // In your kit component:
|
|
17
|
-
* useEffect(() => {
|
|
18
|
-
* deprecatedKitWarning('BarGraph');
|
|
19
|
-
* }, []);
|
|
20
|
-
*/
|
|
21
|
-
export const deprecatedKitWarning = (
|
|
22
|
-
kitName: string,
|
|
23
|
-
message?: string
|
|
24
|
-
): void => {
|
|
25
|
-
// Skip in test environments (Jest sets NODE_ENV to 'test')
|
|
26
|
-
if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'test') {
|
|
27
|
-
return;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// Skip if production mode was set at build time
|
|
31
|
-
if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
// Skip if this looks like a production build (minified, no sourcemaps in browser)
|
|
36
|
-
// This helps catch cases where the package was built for production but consumed in dev
|
|
37
|
-
if (typeof window !== 'undefined') {
|
|
38
|
-
// Check for common production indicators
|
|
39
|
-
const isMinified = !new Error().stack?.includes('.ts:') && !new Error().stack?.includes('.tsx:');
|
|
40
|
-
// Allow warnings even in built packages when consumed locally (localhost)
|
|
41
|
-
const isLocalhost = window.location?.hostname === 'localhost' ||
|
|
42
|
-
window.location?.hostname === '127.0.0.1' ||
|
|
43
|
-
window.location?.hostname === '';
|
|
44
|
-
|
|
45
|
-
// Only skip if it's minified AND not on localhost
|
|
46
|
-
if (isMinified && !isLocalhost) {
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Only warn once per kit per page load
|
|
52
|
-
if (warnedKits.has(kitName)) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Mark this kit as warned
|
|
57
|
-
warnedKits.add(kitName);
|
|
58
|
-
|
|
59
|
-
// Log the warning
|
|
60
|
-
const defaultMessage = `[PLAYBOOK] The "${kitName}" kit is deprecated and will be removed in a future version. Please migrate to the recommended alternative.`;
|
|
61
|
-
|
|
62
|
-
console.warn(message || defaultMessage);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Resets the warned kits tracker (useful for testing)
|
|
67
|
-
* @internal
|
|
68
|
-
*/
|
|
69
|
-
export const resetDeprecationWarnings = (): void => {
|
|
70
|
-
warnedKits.clear();
|
|
71
|
-
};
|