playbook_ui 16.2.0.pre.rc.2 → 16.2.0.pre.rc.3
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_checkbox/_checkbox.scss +1 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +0 -17
- data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +1 -10
- data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +0 -2
- data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_checkbox/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +11 -46
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +3 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +1 -3
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +4 -10
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +0 -9
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.html.erb +2 -7
- data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +0 -4
- data/app/pb_kits/playbook/pb_dropdown/index.js +73 -125
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +0 -16
- data/app/pb_kits/playbook/pb_dropdown/utilities/clickOutsideHelper.tsx +0 -6
- data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +3 -5
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +0 -7
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +549 -638
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +3 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +7 -4
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.test.jsx +4 -4
- data/app/pb_kits/playbook/pb_text_input/text_input.html.erb +10 -10
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +323 -410
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +21 -22
- data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -3
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -3
- data/dist/chunks/{_pb_line_graph-DuJNCf7N.js → _pb_line_graph-CG2X7d4a.js} +1 -1
- data/dist/chunks/_typeahead-DjDiMPdY.js +1 -0
- data/dist/chunks/{globalProps-Bc-FVsRt.js → globalProps-B_OY_vR9.js} +1 -1
- data/dist/chunks/lib-9vEH4omL.js +29 -0
- data/dist/chunks/vendor.js +2 -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/forms/builder/form_field_builder.rb +1 -1
- data/lib/playbook/forms/builder/typeahead_field.rb +1 -15
- data/lib/playbook/forms/builder.rb +2 -2
- data/lib/playbook/version.rb +1 -1
- metadata +5 -12
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.html.erb +0 -6
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.jsx +0 -17
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.md +0 -3
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.md +0 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.html.erb +0 -16
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.jsx +0 -23
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.md +0 -3
- data/dist/chunks/_typeahead-BKSzddAX.js +0 -1
- data/dist/chunks/lib-BwX82vim.js +0 -29
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 32329d30bbf7b450881c2b19834055c65a16a4cdea81592c6ef6da112fd9b59a
|
|
4
|
+
data.tar.gz: c576862ae25937f8c5ef5a06a2553884fccabb24260db9a6931f8a54312dab42
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 350cd02e41b535c9d5977c06e33a05cc4bfec6313c9cbd9dd55893ce6fb1cb8d07dcb532fd89a156da273294f69126f06f31a2920cf9825ef414185a94365f2b
|
|
7
|
+
data.tar.gz: a5c055399e9712400063347fb1c1413539b391ff588a1f4102b5cfe525a6e6c54fcb895825e7d460996940064be2ac4d68a904f867b05f7588f8b6bf573924b1
|
|
@@ -4,8 +4,6 @@ import Icon from '../pb_icon/_icon'
|
|
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
|
5
5
|
import classnames from 'classnames'
|
|
6
6
|
import { globalProps, GlobalProps } from '../utilities/globalProps'
|
|
7
|
-
import colors from '../tokens/exports/_colors.module.scss'
|
|
8
|
-
import spacing from '../tokens/exports/_spacing.module.scss'
|
|
9
7
|
|
|
10
8
|
type CheckboxProps = {
|
|
11
9
|
aria?: {[key: string]: string},
|
|
@@ -21,7 +19,6 @@ type CheckboxProps = {
|
|
|
21
19
|
indeterminate?: boolean,
|
|
22
20
|
name?: string,
|
|
23
21
|
onChange?: (event: React.FormEvent<HTMLInputElement>) => void,
|
|
24
|
-
requiredIndicator?: boolean,
|
|
25
22
|
tabIndex?: number,
|
|
26
23
|
text?: string,
|
|
27
24
|
value?: string,
|
|
@@ -42,7 +39,6 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
|
42
39
|
indeterminate = false,
|
|
43
40
|
name = '',
|
|
44
41
|
onChange = () => { void 0 },
|
|
45
|
-
requiredIndicator = false,
|
|
46
42
|
tabIndex,
|
|
47
43
|
text = '',
|
|
48
44
|
value = '',
|
|
@@ -128,20 +124,7 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
|
128
124
|
variant={null}
|
|
129
125
|
>
|
|
130
126
|
{text}
|
|
131
|
-
{requiredIndicator && (
|
|
132
|
-
<span
|
|
133
|
-
aria-hidden="true"
|
|
134
|
-
className="pb_required_indicator"
|
|
135
|
-
style={{
|
|
136
|
-
color: colors.error,
|
|
137
|
-
marginLeft: spacing.space_xs,
|
|
138
|
-
}}
|
|
139
|
-
>
|
|
140
|
-
{'*'}
|
|
141
|
-
</span>
|
|
142
|
-
)}
|
|
143
127
|
</Body>
|
|
144
|
-
|
|
145
128
|
</label>
|
|
146
129
|
)
|
|
147
130
|
})
|
|
@@ -5,15 +5,6 @@
|
|
|
5
5
|
<%= pb_rails("icon", props: { icon: "minus", classname: "indeterminate_icon hidden", fixed_width: true}) %>
|
|
6
6
|
</span>
|
|
7
7
|
<span class="pb_checkbox_label">
|
|
8
|
-
<%= pb_rails("body", props: { status: object.checkbox_label_status, dark: object.dark, margin_right: object.form_spacing ? "xs" : "" })
|
|
9
|
-
<%= object.text%>
|
|
10
|
-
<% if object.required_indicator %>
|
|
11
|
-
<span
|
|
12
|
-
class="pb_checkbox_required_indicator"
|
|
13
|
-
aria-hidden="true"
|
|
14
|
-
style="color: #DA0014;"
|
|
15
|
-
>*</span>
|
|
16
|
-
<% end %>
|
|
17
|
-
<% end %>
|
|
8
|
+
<%= pb_rails("body", props: { status: object.checkbox_label_status, text: object.text, dark: object.dark, margin_right: object.form_spacing ? "xs" : "" }) %>
|
|
18
9
|
</span>
|
|
19
10
|
<% end %>
|
|
@@ -23,8 +23,6 @@ module Playbook
|
|
|
23
23
|
prop :hidden_input, type: Playbook::Props::Boolean,
|
|
24
24
|
default: false
|
|
25
25
|
prop :hidden_value
|
|
26
|
-
prop :required_indicator, type: Playbook::Props::Boolean,
|
|
27
|
-
default: false
|
|
28
26
|
|
|
29
27
|
def classname
|
|
30
28
|
generate_classname("pb_checkbox_kit", checked_class) + error_class
|
|
@@ -8,7 +8,6 @@ examples:
|
|
|
8
8
|
- checkbox_indeterminate: Indeterminate Checkbox
|
|
9
9
|
- checkbox_disabled: Disabled Checkbox
|
|
10
10
|
- checkbox_form: Form and Hidden Input
|
|
11
|
-
# - checkbox_required_indicator: Required Indicator
|
|
12
11
|
|
|
13
12
|
react:
|
|
14
13
|
- checkbox_default: Default
|
|
@@ -18,7 +17,6 @@ examples:
|
|
|
18
17
|
- checkbox_error: Default w/ Error
|
|
19
18
|
- checkbox_indeterminate: Indeterminate Checkbox
|
|
20
19
|
- checkbox_disabled: Disabled Checkbox
|
|
21
|
-
# - checkbox_required_indicator: Required Indicator
|
|
22
20
|
|
|
23
21
|
swift:
|
|
24
22
|
- checkbox_default_swift: Default
|
|
@@ -5,4 +5,3 @@ export { default as CheckboxError } from './_checkbox_error.jsx'
|
|
|
5
5
|
export { default as CheckboxChecked } from './_checkbox_checked.jsx'
|
|
6
6
|
export { default as CheckboxIndeterminate } from './_checkbox_indeterminate.jsx'
|
|
7
7
|
export { default as CheckboxDisabled } from './_checkbox_disabled.jsx'
|
|
8
|
-
export { default as CheckboxRequiredIndicator } from './_checkbox_required_indicator.jsx'
|
|
@@ -119,16 +119,6 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
119
119
|
|
|
120
120
|
const [isDropDownClosed, setIsDropDownClosed, toggleDropdown] = useDropdown(isClosed);
|
|
121
121
|
|
|
122
|
-
// Use a suffix for the trigger ID to avoid conflict with the outer div's id
|
|
123
|
-
const sanitizeForId = (str: string) =>
|
|
124
|
-
str.toLowerCase().replace(/\s+/g, "_").replace(/[^a-z0-9_]/g, "");
|
|
125
|
-
const selectId = id
|
|
126
|
-
? `${id}_trigger`
|
|
127
|
-
: label
|
|
128
|
-
? sanitizeForId(label)
|
|
129
|
-
: undefined;
|
|
130
|
-
const errorId = error ? `${selectId}-error` : undefined;
|
|
131
|
-
|
|
132
122
|
const [filterItem, setFilterItem] = useState("");
|
|
133
123
|
const initialSelected = useMemo(() => {
|
|
134
124
|
// Handle quickpick variant with string defaultValue (e.g., "This Month")
|
|
@@ -161,19 +151,9 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
161
151
|
|
|
162
152
|
const dropdownRef = useRef(null);
|
|
163
153
|
const inputRef = useRef<HTMLInputElement>(null);
|
|
164
|
-
const inputWrapperRef = useRef
|
|
154
|
+
const inputWrapperRef = useRef(null);
|
|
165
155
|
const dropdownContainerRef = useRef(null);
|
|
166
156
|
|
|
167
|
-
const handleLabelClick = (e: React.MouseEvent) => {
|
|
168
|
-
e.stopPropagation();
|
|
169
|
-
if (selectId) {
|
|
170
|
-
const trigger = document.getElementById(selectId);
|
|
171
|
-
if (trigger) trigger.focus();
|
|
172
|
-
}
|
|
173
|
-
setIsInputFocused(true);
|
|
174
|
-
toggleDropdown();
|
|
175
|
-
};
|
|
176
|
-
|
|
177
157
|
const selectedArray = Array.isArray(selected)
|
|
178
158
|
? selected
|
|
179
159
|
: selected && Object.keys(selected).length
|
|
@@ -431,12 +411,9 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
431
411
|
autocomplete,
|
|
432
412
|
clearable,
|
|
433
413
|
dropdownContainerRef,
|
|
434
|
-
error,
|
|
435
|
-
errorId,
|
|
436
|
-
filterItem,
|
|
437
414
|
filteredOptions,
|
|
415
|
+
filterItem,
|
|
438
416
|
focusedOptionIndex,
|
|
439
|
-
label,
|
|
440
417
|
formPillProps,
|
|
441
418
|
handleBackspace,
|
|
442
419
|
handleChange,
|
|
@@ -446,7 +423,6 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
446
423
|
inputWrapperRef,
|
|
447
424
|
isDropDownClosed,
|
|
448
425
|
isInputFocused,
|
|
449
|
-
selectId,
|
|
450
426
|
multiSelect,
|
|
451
427
|
onSelect,
|
|
452
428
|
optionsWithBlankSelection,
|
|
@@ -458,20 +434,13 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
458
434
|
toggleDropdown
|
|
459
435
|
}}
|
|
460
436
|
>
|
|
461
|
-
{label &&
|
|
462
|
-
<
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
className="pb_dropdown_kit_label"
|
|
469
|
-
dark={dark}
|
|
470
|
-
marginBottom="xs"
|
|
471
|
-
text={label}
|
|
472
|
-
/>
|
|
473
|
-
</label>
|
|
474
|
-
)}
|
|
437
|
+
{label &&
|
|
438
|
+
<Caption
|
|
439
|
+
dark={dark}
|
|
440
|
+
marginBottom="xs"
|
|
441
|
+
text={label}
|
|
442
|
+
/>
|
|
443
|
+
}
|
|
475
444
|
<div className={`dropdown_wrapper ${error ? 'error' : ''}`}
|
|
476
445
|
onBlur={() => {
|
|
477
446
|
// Debounce to delay the execution to prevent jumpiness in Focus state
|
|
@@ -504,16 +473,12 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
504
473
|
</>
|
|
505
474
|
)}
|
|
506
475
|
|
|
507
|
-
{error &&
|
|
476
|
+
{error &&
|
|
508
477
|
<Body
|
|
509
|
-
aria={{ atomic: "true", live: "polite" }}
|
|
510
|
-
dark={dark}
|
|
511
|
-
htmlOptions={{ role: "alert" }}
|
|
512
|
-
id={errorId}
|
|
513
478
|
status="negative"
|
|
514
479
|
text={error}
|
|
515
480
|
/>
|
|
516
|
-
|
|
481
|
+
}
|
|
517
482
|
</div>
|
|
518
483
|
</DropdownContext.Provider>
|
|
519
484
|
</div>
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
<%
|
|
1
|
+
<%
|
|
2
2
|
options = [
|
|
3
3
|
{ label: 'United States', value: 'unitedStates', id: 'us' },
|
|
4
4
|
{ label: 'Canada', value: 'canada', id: 'ca' },
|
|
5
5
|
{ label: 'Pakistan', value: 'pakistan', id: 'pk' },
|
|
6
6
|
]
|
|
7
|
+
|
|
7
8
|
%>
|
|
8
9
|
|
|
9
|
-
<%= pb_rails("dropdown", props: {
|
|
10
|
-
id: "select_a_country",
|
|
11
|
-
label: "Select a Country",
|
|
12
|
-
options: options
|
|
13
|
-
}) %>
|
|
10
|
+
<%= pb_rails("dropdown", props: {options: options, label: "Select a Country"}) %>
|
|
@@ -1,3 +1 @@
|
|
|
1
|
-
The top-level Dropdown component optionally accepts any string through a `label` prop to produce a label above your trigger element.
|
|
2
|
-
|
|
3
|
-
Add an `id` to wire the label to the trigger so that clicking the label will move focus directly to the input, and open the drop-down.
|
|
1
|
+
The top-level Dropdown component optionally accepts any string through a `label` prop to produce a label above your trigger element.
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
<%= pb_content_tag do %>
|
|
2
2
|
<% if object.label.present? %>
|
|
3
|
-
|
|
4
|
-
<%= pb_rails("caption", props: { text: object.label, margin_bottom: "xs", classname: "pb_dropdown_kit_label", dark: object.dark }) %>
|
|
5
|
-
</label>
|
|
3
|
+
<%= pb_rails("caption", props: {text: object.label, margin_bottom:"xs"}) %>
|
|
6
4
|
<% end %>
|
|
7
5
|
<div class="dropdown_wrapper<%= error_class %>" style="position: relative">
|
|
8
6
|
<input
|
|
@@ -18,11 +16,9 @@
|
|
|
18
16
|
<% end %>
|
|
19
17
|
<% if content.present? %>
|
|
20
18
|
<%= content.presence %>
|
|
21
|
-
|
|
22
|
-
<%= pb_rails("body", props: { status: "negative", text: object.error, id: object.error_id, aria: { atomic: "true", live: "polite" }, html_options: { role: "alert" }, dark: object.dark }) %>
|
|
23
|
-
<% end %>
|
|
19
|
+
<%= pb_rails("body", props: { status: "negative", text: object.error }) %>
|
|
24
20
|
<% else %>
|
|
25
|
-
<%= pb_rails("dropdown/dropdown_trigger", props:
|
|
21
|
+
<%= pb_rails("dropdown/dropdown_trigger", props:{ autocomplete: object.autocomplete, multi_select:object.multi_select, placeholder: object.placeholder }) %>
|
|
26
22
|
<%= pb_rails("dropdown/dropdown_container", props: { searchbar: object.searchbar, constrain_height: object.constrain_height }) do %>
|
|
27
23
|
<% if options_with_blank.present? %>
|
|
28
24
|
<% options_with_blank.each do |option| %>
|
|
@@ -31,9 +27,7 @@
|
|
|
31
27
|
<% end %>
|
|
32
28
|
<% end %>
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
<%= pb_rails("body", props: { status: "negative", text: object.error, id: object.error_id, aria: { atomic: "true", live: "polite" }, html_options: { role: "alert" }, dark: object.dark }) %>
|
|
36
|
-
<% end %>
|
|
30
|
+
<%= pb_rails("body", props: { status: "negative", text: object.error }) %>
|
|
37
31
|
<% end %>
|
|
38
32
|
</div>
|
|
39
33
|
<% end %>
|
|
@@ -10,7 +10,6 @@ module Playbook
|
|
|
10
10
|
prop :label, type: Playbook::Props::String
|
|
11
11
|
prop :name, type: Playbook::Props::String
|
|
12
12
|
prop :error, type: Playbook::Props::String
|
|
13
|
-
prop :id, type: Playbook::Props::String
|
|
14
13
|
prop :required, type: Playbook::Props::Boolean,
|
|
15
14
|
default: false
|
|
16
15
|
prop :default_value
|
|
@@ -69,14 +68,6 @@ module Playbook
|
|
|
69
68
|
generate_classname("pb_dropdown", variant, separators_class)
|
|
70
69
|
end
|
|
71
70
|
|
|
72
|
-
def select_id
|
|
73
|
-
id.presence || (label.present? ? label.downcase.gsub(/\s+/, "_").gsub(/[^a-z0-9_]/, "") : nil)
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
def error_id
|
|
77
|
-
error.present? ? "#{select_id || 'dropdown_trigger'}-error" : nil
|
|
78
|
-
end
|
|
79
|
-
|
|
80
71
|
private
|
|
81
72
|
|
|
82
73
|
def error_class
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
<%= pb_content_tag do %>
|
|
2
2
|
<% if content.present? %>
|
|
3
|
-
<div style="display: inline-block" tabindex="0" data-dropdown
|
|
4
|
-
<% if object.label.present? %> aria-label="<%= [object.label, object.default_display_placeholder].join(', ') %>"<% end %>
|
|
5
|
-
<% if object.select_id.present? %> id="<%= object.select_id %>"<% end %>
|
|
6
|
-
<% if object.error_id.present? %> aria-describedby="<%= object.error_id %>"<% end %>
|
|
7
|
-
>
|
|
3
|
+
<div style="display: inline-block" tabindex="0" data-dropdown-custom-trigger>
|
|
8
4
|
<%= content.presence %>
|
|
9
5
|
</div>
|
|
10
6
|
<% else %>
|
|
@@ -13,11 +9,10 @@
|
|
|
13
9
|
border_radius:"lg",
|
|
14
10
|
classname: object.trigger_wrapper_classes,
|
|
15
11
|
cursor: object.autocomplete ? "text" : "pointer",
|
|
16
|
-
id: object.select_id,
|
|
17
12
|
justify: "between",
|
|
18
13
|
padding_x:"sm",
|
|
19
14
|
padding_y:"xs",
|
|
20
|
-
html_options: {
|
|
15
|
+
html_options: {tabindex:"0"}
|
|
21
16
|
}) do %>
|
|
22
17
|
<%= pb_rails("flex/flex_item", props: { fixed_size: object.multi_select ? "85%" : "" }) do %>
|
|
23
18
|
<%= pb_rails("flex", props: {align: "center"}) do %>
|
|
@@ -13,10 +13,6 @@ module Playbook
|
|
|
13
13
|
default: false
|
|
14
14
|
prop :multi_select, type: Playbook::Props::Boolean,
|
|
15
15
|
default: false
|
|
16
|
-
prop :select_id, type: Playbook::Props::String
|
|
17
|
-
prop :label, type: Playbook::Props::String
|
|
18
|
-
prop :error_id, type: Playbook::Props::String
|
|
19
|
-
prop :error, type: Playbook::Props::String
|
|
20
16
|
|
|
21
17
|
def data
|
|
22
18
|
Hash(prop(:data)).merge(dropdown_trigger: true, dropdown_placeholder: default_display_placeholder)
|