playbook_ui 15.5.0 → 15.6.0.pre.alpha.play265012865
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_advanced_table/_advanced_table.scss +96 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
- data/app/pb_kits/playbook/pb_background/_background.tsx +6 -6
- data/app/pb_kits/playbook/pb_background/background.test.js +5 -1
- 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 +0 -1
- data/app/pb_kits/playbook/pb_background/docs/_background_light.md +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 +6 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_compound_components.html.erb +31 -0
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +156 -6
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +8 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.jsx +180 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_dropzone.md +22 -0
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +3 -2
- data/app/pb_kits/playbook/pb_draggable/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +77 -1
- data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +4 -4
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +34 -22
- data/app/pb_kits/playbook/pb_home_address_street/city_emphasis.html.erb +16 -12
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_home_address_street/none_emphasis.html.erb +16 -12
- data/app/pb_kits/playbook/pb_home_address_street/street_emphasis.html.erb +16 -12
- data/app/pb_kits/playbook/pb_legend/_legend.tsx +7 -1
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +10 -0
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.tsx +66 -15
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.jsx +42 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/_multiple_users_with_tooltip.md +1 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_multiple_users/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_multiple_users/multiple_users.test.js +25 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +44 -10
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.html.erb +34 -4
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_validation.jsx +16 -7
- data/app/pb_kits/playbook/pb_table/styles/_vertical_border.scss +49 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +15 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -0
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +13 -2
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +6 -1
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +34 -7
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.html.erb +30 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.jsx +37 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_input_display.md +3 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +6 -1
- data/app/pb_kits/playbook/utilities/DEPRECATION_WARNINGS.md +82 -0
- data/app/pb_kits/playbook/utilities/deprecated.ts +65 -0
- data/dist/chunks/_typeahead-Mjy3POtc.js +6 -0
- data/dist/chunks/{lib-Dk4GKPut.js → lib-CgpqUb6l.js} +2 -2
- data/dist/chunks/vendor.js +2 -2
- data/dist/menu.yml +3 -2
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +2 -2
- metadata +14 -5
- data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +0 -58
- data/dist/chunks/_typeahead-Bx4QsIEU.js +0 -6
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<%
|
|
2
|
+
options = [
|
|
3
|
+
{ label: 'Orange', value: '#FFA500' },
|
|
4
|
+
{ label: 'Red', value: '#FF0000' },
|
|
5
|
+
{ label: 'Green', value: '#00FF00' },
|
|
6
|
+
{ label: 'Blue', value: '#0000FF' },
|
|
7
|
+
{ label: 'Yellow', value: '#FFFF00' },
|
|
8
|
+
{ label: 'Purple', value: '#800080' },
|
|
9
|
+
{ label: 'Cyan', value: '#00FFFF' },
|
|
10
|
+
{ label: 'Magenta', value: '#FF00FF' }
|
|
11
|
+
]
|
|
12
|
+
%>
|
|
13
|
+
|
|
14
|
+
<%= pb_rails("typeahead", props: {
|
|
15
|
+
id: "typeahead-input-display-none",
|
|
16
|
+
label: "With Input Display None",
|
|
17
|
+
options: options,
|
|
18
|
+
name: :foo,
|
|
19
|
+
input_display: "none",
|
|
20
|
+
})
|
|
21
|
+
%>
|
|
22
|
+
<br/>
|
|
23
|
+
<%= pb_rails("typeahead", props: {
|
|
24
|
+
id: "typeahead-input-display-pills",
|
|
25
|
+
label: "With Input Display Pills (Default)",
|
|
26
|
+
options: options,
|
|
27
|
+
name: :foo,
|
|
28
|
+
pills: true,
|
|
29
|
+
})
|
|
30
|
+
%>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import Typeahead from '../_typeahead'
|
|
4
|
+
|
|
5
|
+
const options = [
|
|
6
|
+
{ label: 'Orange', value: '#FFA500' },
|
|
7
|
+
{ label: 'Red', value: '#FF0000' },
|
|
8
|
+
{ label: 'Green', value: '#00FF00' },
|
|
9
|
+
{ label: 'Blue', value: '#0000FF' },
|
|
10
|
+
{ label: 'Yellow', value: '#FFFF00' },
|
|
11
|
+
{ label: 'Purple', value: '#800080' },
|
|
12
|
+
{ label: 'Cyan', value: '#00FFFF' },
|
|
13
|
+
{ label: 'Magenta', value: '#FF00FF' }
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
const TypeaheadInputDisplay = (props) => {
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
<Typeahead
|
|
20
|
+
inputDisplay="none"
|
|
21
|
+
isMulti
|
|
22
|
+
label="With Input Display None"
|
|
23
|
+
options={options}
|
|
24
|
+
{...props}
|
|
25
|
+
/>
|
|
26
|
+
<br/>
|
|
27
|
+
<Typeahead
|
|
28
|
+
isMulti
|
|
29
|
+
label="With Input Display Pills (Default)"
|
|
30
|
+
options={options}
|
|
31
|
+
{...props}
|
|
32
|
+
/>
|
|
33
|
+
</>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default TypeaheadInputDisplay
|
|
@@ -5,6 +5,7 @@ examples:
|
|
|
5
5
|
- typeahead_default_options: With Default Options
|
|
6
6
|
- typeahead_with_context: With Context
|
|
7
7
|
- typeahead_with_pills: With Pills
|
|
8
|
+
- typeahead_input_display: Input Display
|
|
8
9
|
- typeahead_without_pills: Without Pills (Single Select)
|
|
9
10
|
- typeahead_with_pills_async: With Pills (Async Data)
|
|
10
11
|
- typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
|
|
@@ -26,6 +27,7 @@ examples:
|
|
|
26
27
|
- typeahead_react_hook: React Hook
|
|
27
28
|
- typeahead_with_highlight: With Highlight
|
|
28
29
|
- typeahead_with_pills: With Pills
|
|
30
|
+
- typeahead_input_display: Input Display
|
|
29
31
|
- typeahead_with_pills_async: With Pills (Async Data)
|
|
30
32
|
- typeahead_with_pills_async_users: With Pills (Async Data w/ Users)
|
|
31
33
|
- typeahead_with_pills_async_custom_options: With Pills (Async Data w/ Custom Options)
|
|
@@ -17,4 +17,5 @@ export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
|
|
|
17
17
|
export { default as TypeaheadDisabled } from './_typeahead_disabled.jsx'
|
|
18
18
|
export { default as TypeaheadPreserveInput } from './_typeahead_preserve_input.jsx'
|
|
19
19
|
export { default as TypeaheadDefaultValue } from './_typeahead_default_value.jsx'
|
|
20
|
-
export { default as TypeaheadCustomOptions } from './_typeahead_custom_options.jsx'
|
|
20
|
+
export { default as TypeaheadCustomOptions } from './_typeahead_custom_options.jsx'
|
|
21
|
+
export { default as TypeaheadInputDisplay } from './_typeahead_input_display.jsx'
|
|
@@ -25,6 +25,10 @@ module Playbook
|
|
|
25
25
|
prop :is_multi, type: Playbook::Props::Boolean,
|
|
26
26
|
default: true
|
|
27
27
|
|
|
28
|
+
prop :input_display, type: Playbook::Props::Enum,
|
|
29
|
+
values: %w[none pills],
|
|
30
|
+
default: "pills"
|
|
31
|
+
|
|
28
32
|
prop :pills, type: Playbook::Props::Boolean,
|
|
29
33
|
default: false
|
|
30
34
|
|
|
@@ -78,7 +82,7 @@ module Playbook
|
|
|
78
82
|
end
|
|
79
83
|
|
|
80
84
|
def is_react?
|
|
81
|
-
pills || !is_multi || wrapped
|
|
85
|
+
pills || !is_multi || wrapped || input_display == "none"
|
|
82
86
|
end
|
|
83
87
|
|
|
84
88
|
def typeahead_react_options
|
|
@@ -91,6 +95,7 @@ module Playbook
|
|
|
91
95
|
id: id,
|
|
92
96
|
inline: inline,
|
|
93
97
|
isMulti: is_multi,
|
|
98
|
+
inputDisplay: input_display,
|
|
94
99
|
label: label,
|
|
95
100
|
marginBottom: margin_bottom,
|
|
96
101
|
multiKit: multi_kit,
|
|
@@ -0,0 +1,82 @@
|
|
|
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.
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
// In browser environments, check if we're on localhost/dev
|
|
31
|
+
if (typeof window !== 'undefined') {
|
|
32
|
+
const hostname = window.location?.hostname;
|
|
33
|
+
const isLocalDev = hostname === 'localhost' ||
|
|
34
|
+
hostname === '127.0.0.1' ||
|
|
35
|
+
hostname?.endsWith('.local') ||
|
|
36
|
+
hostname?.includes('local.') ||
|
|
37
|
+
!hostname; // file:// protocol
|
|
38
|
+
|
|
39
|
+
// Only show warnings in local development
|
|
40
|
+
if (!isLocalDev) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Only warn once per kit per page load
|
|
46
|
+
if (warnedKits.has(kitName)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Mark this kit as warned
|
|
51
|
+
warnedKits.add(kitName);
|
|
52
|
+
|
|
53
|
+
// Log the warning
|
|
54
|
+
const defaultMessage = `[PLAYBOOK] The "${kitName}" kit is deprecated and will be removed in a future version. Please migrate to the recommended alternative.`;
|
|
55
|
+
|
|
56
|
+
console.warn(message || defaultMessage);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Resets the warned kits tracker (useful for testing)
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
export const resetDeprecationWarnings = (): void => {
|
|
64
|
+
warnedKits.clear();
|
|
65
|
+
};
|