playbook_ui 14.13.0.pre.alpha.PBNTR457formtimezoneselect6219 → 14.13.0.pre.alpha.PBNTR5596029
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/_playbook.scss +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -3
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +5 -6
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +1 -8
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +1 -3
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +66 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.tsx +98 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +28 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.rb +42 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.html.erb +19 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.jsx +26 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.html.erb +10 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.jsx +17 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_on_click.jsx +19 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_onclick.html.erb +16 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.html.erb +35 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.jsx +42 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_tooltip.html.erb +13 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/example.yml +15 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/docs/index.js +4 -0
- data/app/pb_kits/playbook/pb_avatar_action_button/pb_avatar_action_button.test.js +31 -0
- data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +8 -17
- data/app/pb_kits/playbook/pb_checkbox/checkbox.test.js +0 -16
- data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_checkbox/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +1 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb +2 -2
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md +1 -4
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.jsx +0 -1
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +0 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +0 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.html.erb +2 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.rb +0 -3
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +6 -1
- data/app/pb_kits/playbook/pb_nav/item.html.erb +19 -7
- data/app/pb_kits/playbook/pb_nav/nav.html.erb +8 -3
- data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +6 -1
- data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +0 -4
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_overlay/subcomponents/_overlay_token.tsx +10 -48
- data/app/pb_kits/playbook/pb_popover/popover.html.erb +6 -1
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.scss +1 -6
- data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +5 -7
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.html.erb +0 -1
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.jsx +0 -7
- data/app/pb_kits/playbook/pb_progress_pills/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_progress_pills/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_progress_pills/progress_pills.html.erb +7 -2
- data/app/pb_kits/playbook/pb_progress_pills/progress_pills.rb +0 -6
- data/app/pb_kits/playbook/pb_progress_pills/progress_pills.test.js +1 -26
- data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +5 -1
- data/app/pb_kits/playbook/pb_progress_step/progress_step.html.erb +5 -1
- data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +5 -1
- data/app/pb_kits/playbook/pb_radio/radio.html.erb +11 -6
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.jsx +1 -1
- data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -5
- data/app/pb_kits/playbook/pb_table/docs/index.js +1 -3
- data/app/pb_kits/playbook/pb_table/index.ts +9 -41
- data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +0 -4
- data/app/pb_kits/playbook/pb_table/table_body.html.erb +7 -13
- data/app/pb_kits/playbook/pb_table/table_body.rb +0 -2
- data/app/pb_kits/playbook/pb_table/table_row.html.erb +7 -14
- data/app/pb_kits/playbook/pb_table/table_row.rb +1 -14
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +0 -14
- data/app/pb_kits/playbook/pb_text_input/index.js +0 -9
- data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -5
- data/dist/chunks/{_typeahead-PqkcDf1H.js → _typeahead-TUUtEUg8.js} +3 -3
- data/dist/chunks/_weekday_stacked--GSH9pBR.js +45 -0
- data/dist/chunks/{lib-D3us1bGD.js → lib-DjpLC8uO.js} +2 -2
- data/dist/chunks/{pb_form_validation-BpihMSOQ.js → pb_form_validation-S56UaHZl.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +7 -0
- data/dist/playbook-doc.js +1 -1
- 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.rb +0 -1
- data/lib/playbook/version.rb +1 -1
- metadata +23 -32
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_custom_cell.jsx +0 -75
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +0 -33
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +0 -3
- data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +0 -58
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +0 -64
- data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +0 -1
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_react_hook.jsx +0 -69
- data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_react_hook.md +0 -1
- data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.html.erb +0 -27
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.jsx +0 -37
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional_react.md +0 -1
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_default.md +0 -1
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width.html.erb +0 -1
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width.jsx +0 -18
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width_rails.md +0 -1
- data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width_react.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.html.erb +0 -47
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.jsx +0 -88
- data/app/pb_kits/playbook/pb_table/docs/_table_with_clickable_rows.md +0 -1
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.html.erb +0 -51
- data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click_rails.md +0 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +0 -96
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.jsx +0 -101
- data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.md +0 -1
- data/dist/chunks/_weekday_stacked-C7J0S4f7.js +0 -45
- data/lib/playbook/forms/builder/time_zone_select_field.rb +0 -19
- /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible_with_custom_click_react.md → _table_with_collapsible_with_custom_click.md} +0 -0
@@ -10,4 +10,3 @@ export { default as BarGraphStacked } from './_bar_graph_stacked.jsx'
|
|
10
10
|
export { default as BarGraphNegativeNumbers } from './_bar_graph_negative_numbers.jsx'
|
11
11
|
export { default as BarGraphSecondaryYAxis } from './_bar_graph_secondary_y_axis.jsx'
|
12
12
|
export { default as BarGraphHorizontal } from './_bar_graph_horizontal.jsx'
|
13
|
-
export { default as BarGraphPbStyles } from './_bar_graph_pb_styles.jsx'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useEffect, useRef
|
1
|
+
import React, { useEffect, useRef } from 'react'
|
2
2
|
import Body from '../pb_body/_body'
|
3
3
|
import Icon from '../pb_icon/_icon'
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
|
@@ -24,7 +24,7 @@ type CheckboxProps = {
|
|
24
24
|
value?: string,
|
25
25
|
} & GlobalProps
|
26
26
|
|
27
|
-
const Checkbox =
|
27
|
+
const Checkbox = (props: CheckboxProps): React.ReactElement => {
|
28
28
|
const {
|
29
29
|
aria = {},
|
30
30
|
checked = false,
|
@@ -44,15 +44,7 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
44
44
|
value = '',
|
45
45
|
} = props
|
46
46
|
|
47
|
-
const
|
48
|
-
const setRefs = (el: HTMLInputElement) => {
|
49
|
-
internalRef.current = el
|
50
|
-
if (typeof ref === 'function') {
|
51
|
-
ref(el)
|
52
|
-
} else if (ref) {
|
53
|
-
(ref as React.MutableRefObject<HTMLInputElement | null>).current = el
|
54
|
-
}
|
55
|
-
}
|
47
|
+
const checkRef = useRef(null)
|
56
48
|
const ariaProps = buildAriaProps(aria)
|
57
49
|
const dataProps = buildDataProps(data)
|
58
50
|
const htmlProps = buildHtmlProps(htmlOptions)
|
@@ -64,9 +56,9 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
64
56
|
)
|
65
57
|
|
66
58
|
useEffect(() => {
|
67
|
-
if (
|
68
|
-
|
69
|
-
|
59
|
+
if (checkRef.current) {
|
60
|
+
checkRef.current.checked = checked
|
61
|
+
checkRef.current.indeterminate = indeterminate
|
70
62
|
}
|
71
63
|
}, [indeterminate, checked])
|
72
64
|
|
@@ -80,7 +72,7 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
80
72
|
disabled={disabled}
|
81
73
|
name={name}
|
82
74
|
onChange={onChange}
|
83
|
-
ref={
|
75
|
+
ref={checkRef}
|
84
76
|
tabIndex={tabIndex}
|
85
77
|
type="checkbox"
|
86
78
|
value={value}
|
@@ -127,7 +119,6 @@ const Checkbox = forwardRef<HTMLInputElement, CheckboxProps>((props, ref) => {
|
|
127
119
|
</Body>
|
128
120
|
</label>
|
129
121
|
)
|
130
|
-
}
|
122
|
+
}
|
131
123
|
|
132
|
-
Checkbox.displayName = "Checkbox"
|
133
124
|
export default Checkbox
|
@@ -106,19 +106,3 @@ test('has disabled attribute', () => {
|
|
106
106
|
const input = kit.querySelector('input')
|
107
107
|
expect(input).toHaveAttribute('disabled')
|
108
108
|
})
|
109
|
-
|
110
|
-
test('has ref in the input element', () => {
|
111
|
-
const ref = React.createRef()
|
112
|
-
render(
|
113
|
-
<Checkbox
|
114
|
-
data={{ testid: testId }}
|
115
|
-
name="checkbox-name"
|
116
|
-
ref={ref}
|
117
|
-
text="Checkbox"
|
118
|
-
value="check-box value"
|
119
|
-
/>
|
120
|
-
)
|
121
|
-
|
122
|
-
expect(ref.current).not.toBeNull()
|
123
|
-
expect(ref.current?.tagName).toBe('INPUT')
|
124
|
-
})
|
@@ -11,7 +11,6 @@ examples:
|
|
11
11
|
react:
|
12
12
|
- checkbox_default: Default
|
13
13
|
- checkbox_checked: Load as checked
|
14
|
-
- checkbox_react_hook: React Hook Form
|
15
14
|
- checkbox_custom: Custom Checkbox
|
16
15
|
- checkbox_error: Default w/ Error
|
17
16
|
- checkbox_indeterminate: Indeterminate Checkbox
|
@@ -22,4 +21,4 @@ examples:
|
|
22
21
|
- checkbox_error_swift: Default w/ Error
|
23
22
|
- checkbox_indeterminate_swift: Indeterminate Checkbox
|
24
23
|
- checkbox_props_swift: ""
|
25
|
-
|
24
|
+
|
@@ -1,6 +1,5 @@
|
|
1
1
|
export { default as CheckboxDefault } from './_checkbox_default.jsx'
|
2
2
|
export { default as CheckboxCustom } from './_checkbox_custom.jsx'
|
3
|
-
export { default as CheckboxReactHook } from './_checkbox_react_hook.jsx'
|
4
3
|
export { default as CheckboxError } from './_checkbox_error.jsx'
|
5
4
|
export { default as CheckboxChecked } from './_checkbox_checked.jsx'
|
6
5
|
export { default as CheckboxIndeterminate } from './_checkbox_indeterminate.jsx'
|
@@ -29,7 +29,6 @@ type DatePickerProps = {
|
|
29
29
|
hideLabel?: boolean,
|
30
30
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
31
31
|
id?: string,
|
32
|
-
initializeOnce?: boolean,
|
33
32
|
inLine?: boolean,
|
34
33
|
inputAria?: { [key: string]: string },
|
35
34
|
inputData?: { [key: string]: string },
|
@@ -74,7 +73,6 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
74
73
|
hideLabel = false,
|
75
74
|
htmlOptions = {},
|
76
75
|
id,
|
77
|
-
initializeOnce = false,
|
78
76
|
inLine = false,
|
79
77
|
inputAria = {},
|
80
78
|
inputData = {},
|
@@ -136,7 +134,7 @@ useEffect(() => {
|
|
136
134
|
yearRange,
|
137
135
|
required: false,
|
138
136
|
}, scrollContainer)
|
139
|
-
}
|
137
|
+
})
|
140
138
|
const filteredProps = {...props}
|
141
139
|
if (filteredProps.marginBottom === undefined) {
|
142
140
|
filteredProps.marginBottom = "sm"
|
@@ -43,9 +43,9 @@
|
|
43
43
|
<% end %>
|
44
44
|
<% end %>
|
45
45
|
|
46
|
-
<%= pb_rails("
|
46
|
+
<%= pb_rails("draggable/draggable_container", props: {tag:"tbody"}) do %>
|
47
47
|
<% initial_items.each do |item| %>
|
48
|
-
<%= pb_rails("
|
48
|
+
<%= pb_rails("draggable/draggable_item", props:{drag_id: item[:id], tag:"tr"}) do %>
|
49
49
|
<%= pb_rails("table/table_cell", props: { text: item[:id]}) %>
|
50
50
|
<%= pb_rails("table/table_cell") do %>
|
51
51
|
<%= pb_rails("flex", props:{align:"center"}) do %>
|
@@ -1,4 +1 @@
|
|
1
|
-
The draggable kit can also be used in conjunction with the table kit to create draggable table rows. To do this
|
2
|
-
|
3
|
-
- use the `draggable_container` prop on the table/table_body to designate it as the Draggable Container
|
4
|
-
- use the `draggable_item` prop on the table/table_row to designate it as the Draggable Item. Make sure to also pass id to the `drag_id` prop here.
|
1
|
+
The draggable kit can also be used in conjunction with the table kit to create draggable table rows. To do this, make use of the `tag` prop on the draggable_container to set it to 'tbody' and the same prop on the draggable_item to set that to 'tr'. This will create the functionality seen here.
|
@@ -4,8 +4,8 @@ examples:
|
|
4
4
|
- draggable_with_list: Draggable with List Kit
|
5
5
|
- draggable_with_selectable_list: Draggable with SelectableList Kit
|
6
6
|
- draggable_with_cards: Draggable with Cards
|
7
|
-
- draggable_with_table_react: Draggable with Table
|
8
7
|
- draggable_multiple_containers: Dragging Across Multiple Containers
|
8
|
+
- draggable_with_table_react: Draggable with Table
|
9
9
|
|
10
10
|
rails:
|
11
11
|
- draggable_default_rails: Default
|
@@ -46,7 +46,6 @@
|
|
46
46
|
%>
|
47
47
|
<%= form.date_picker :example_date_picker_1, props: { label: true } %>
|
48
48
|
<%= form.star_rating_field :example_star_rating, props: { variant: "interactive", label: true } %>
|
49
|
-
<%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true } %>
|
50
49
|
|
51
50
|
<%= form.actions do |action| %>
|
52
51
|
<%= action.submit %>
|
@@ -37,7 +37,6 @@
|
|
37
37
|
<%= form.check_box :example_checkbox, props: { text: "Example Checkbox", label: true, required: true } %>
|
38
38
|
<%= form.date_picker :example_date_picker_2, props: { label: true, required: true } %>
|
39
39
|
<%= form.star_rating_field :example_star_rating_validation, props: { variant: "interactive", label: true, required: true } %>
|
40
|
-
<%= form.time_zone_select_field :example_time_zone_select, ActiveSupport::TimeZone.us_zones, { default: "Eastern Time (US & Canada)" }, props: { label: true, blank_selection: "Select a Time Zone...", required: true } %>
|
41
40
|
|
42
41
|
<%= form.actions do |action| %>
|
43
42
|
<%= action.submit %>
|
@@ -14,9 +14,6 @@ module Playbook
|
|
14
14
|
prop :variant, type: Playbook::Props::Enum,
|
15
15
|
values: %w[default link],
|
16
16
|
default: "default"
|
17
|
-
prop :size, type: Playbook::Props::Enum,
|
18
|
-
values: %w[1x 2x 3x 4x 5x 6x 7x 8x 9x 10x xs sm lg],
|
19
|
-
default: "2x"
|
20
17
|
def classname
|
21
18
|
generate_classname("pb_icon_button_kit", variant)
|
22
19
|
end
|
@@ -1,9 +1,15 @@
|
|
1
1
|
<% if object.collapsible %>
|
2
2
|
<%= pb_rails("collapsible", props: { name: "collapsible-nav-example", classname: object.collapsible_nav_classname }) do %>
|
3
3
|
<%= pb_rails("collapsible/collapsible_main", props: { name: "default-collapsible-nav", icon: object.collapsible_icons, size: "xs", dark: object.dark, classname:object.margin_classes }) do %>
|
4
|
-
<%=
|
5
|
-
|
6
|
-
|
4
|
+
<%= content_tag(object.tag,
|
5
|
+
aria: object.aria,
|
6
|
+
class: object.classname,
|
7
|
+
data: object.data,
|
8
|
+
dark: object.dark,
|
9
|
+
id: object.id,
|
10
|
+
href: object.link && object.link,
|
11
|
+
target: object.link && object.target,
|
12
|
+
**combined_html_options
|
7
13
|
) do %>
|
8
14
|
<% if object.image_url %>
|
9
15
|
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper_collapsible" }) %>
|
@@ -14,16 +20,22 @@
|
|
14
20
|
<span class="pb_nav_list_item_text_collapsible">
|
15
21
|
<%= object.text %>
|
16
22
|
</span>
|
17
|
-
<% end %>
|
23
|
+
<% end %>
|
18
24
|
<% end %>
|
19
25
|
<%= pb_rails("collapsible/collapsible_content", props: {collapsed: object.collapsed}) do %>
|
20
26
|
<%= content.presence %>
|
21
27
|
<% end %>
|
22
28
|
<% end %>
|
23
29
|
<% else %>
|
24
|
-
<%=
|
25
|
-
|
26
|
-
|
30
|
+
<%= content_tag(object.tag,
|
31
|
+
aria: object.aria,
|
32
|
+
class: object.classname,
|
33
|
+
**combined_html_options,
|
34
|
+
data: object.data,
|
35
|
+
dark: object.dark,
|
36
|
+
id: object.id,
|
37
|
+
href: object.link && object.link,
|
38
|
+
target: object.link && object.target
|
27
39
|
) do %>
|
28
40
|
<% if object.image_url %>
|
29
41
|
<%= pb_rails("image", props: { url: object.image_url, classname: "pb_nav_img_wrapper" }) %>
|
@@ -1,7 +1,12 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:nav,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<% if object.title %>
|
3
|
-
<%=
|
4
|
-
<%=
|
8
|
+
<%= content_tag(:div, class: "pb_nav_list_title") do %>
|
9
|
+
<%= content_tag(:a, class: "pb_nav_list_item_link_text", href: object.link) do %>
|
5
10
|
<%= pb_rails("caption", props: { text: object.title, dark: dark }) %>
|
6
11
|
<% end %>
|
7
12
|
<% end %>
|
@@ -8,7 +8,6 @@ import OverlayToken from './subcomponents/_overlay_token'
|
|
8
8
|
export type OverlayChildrenProps = {
|
9
9
|
children: React.ReactNode[] | React.ReactNode,
|
10
10
|
color: "card_light" | "bg_light" | "card_dark" | "bg_dark",
|
11
|
-
dynamic?: boolean,
|
12
11
|
position: string,
|
13
12
|
size: string,
|
14
13
|
}
|
@@ -19,7 +18,6 @@ type OverlayProps = {
|
|
19
18
|
children: React.ReactNode[] | React.ReactNode,
|
20
19
|
color: "card_light" | "bg_light" | "card_dark" | "bg_dark",
|
21
20
|
data?: { [key: string]: string },
|
22
|
-
dynamic?: false,
|
23
21
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) },
|
24
22
|
id?: string,
|
25
23
|
layout: { [key: string]: string },
|
@@ -32,7 +30,6 @@ const Overlay = (props: OverlayProps) => {
|
|
32
30
|
children,
|
33
31
|
color = "card_light",
|
34
32
|
data = {},
|
35
|
-
dynamic = false,
|
36
33
|
htmlOptions = {},
|
37
34
|
id,
|
38
35
|
layout = { "bottom": "full" },
|
@@ -72,7 +69,6 @@ const Overlay = (props: OverlayProps) => {
|
|
72
69
|
}) : OverlayToken({
|
73
70
|
children,
|
74
71
|
color,
|
75
|
-
dynamic: dynamic,
|
76
72
|
position: getPosition(),
|
77
73
|
size: getSize()
|
78
74
|
})
|
@@ -1,4 +1,3 @@
|
|
1
1
|
export { default as OverlayDefault } from './_overlay_default.jsx'
|
2
2
|
export { default as OverlayMultiDirectional } from './_overlay_multi_directional.jsx'
|
3
3
|
export { default as OverlayToggle } from './_overlay_toggle.jsx'
|
4
|
-
export { default as OverlayVerticalDynamicMultiDirectional } from './_overlay_vertical_dynamic_multi_directional.jsx'
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import React
|
2
|
-
import { OverlayChildrenProps } from '../_overlay'
|
1
|
+
import React from 'react'
|
2
|
+
import { OverlayChildrenProps } from '../_overlay'
|
3
3
|
|
4
4
|
const previousOverlayDirectionMap: { [key: string]: string } = {
|
5
5
|
"x": "left",
|
@@ -15,40 +15,11 @@ const OverlayToken = (props: OverlayChildrenProps) => {
|
|
15
15
|
const {
|
16
16
|
children,
|
17
17
|
color,
|
18
|
-
dynamic,
|
19
18
|
position,
|
20
19
|
size,
|
21
20
|
} = props
|
22
21
|
|
23
|
-
const
|
24
|
-
const [isAtStart, setIsAtStart] = useState(true);
|
25
|
-
const [isAtEnd, setIsAtEnd] = useState(false);
|
26
|
-
|
27
|
-
|
28
|
-
const handleScroll = () => {
|
29
|
-
const container = scrollContainerRef.current;
|
30
|
-
if (container) {
|
31
|
-
const { scrollLeft, scrollWidth, clientWidth } = container;
|
32
|
-
const atStart = scrollLeft === 0;
|
33
|
-
const atEnd = scrollLeft + clientWidth >= scrollWidth - 1;
|
34
|
-
|
35
|
-
setIsAtStart(atStart);
|
36
|
-
setIsAtEnd(atEnd);
|
37
|
-
}
|
38
|
-
};
|
39
|
-
|
40
|
-
useEffect(() => {
|
41
|
-
const container = scrollContainerRef.current;
|
42
|
-
if (container) {
|
43
|
-
container.addEventListener('scroll', handleScroll);
|
44
|
-
handleScroll();
|
45
|
-
return () => {
|
46
|
-
container.removeEventListener('scroll', handleScroll);
|
47
|
-
};
|
48
|
-
}
|
49
|
-
}, []);
|
50
|
-
|
51
|
-
const hasSubsequentOverlay = position === "x" || position === "y";
|
22
|
+
const hasSubsequentOverlay = position === "x" || position === "y"
|
52
23
|
|
53
24
|
const getPreviousOverlayDirection = () => {
|
54
25
|
return hasSubsequentOverlay ? previousOverlayDirectionMap[position] : position
|
@@ -63,24 +34,15 @@ const OverlayToken = (props: OverlayChildrenProps) => {
|
|
63
34
|
|
64
35
|
return (
|
65
36
|
<>
|
66
|
-
<div className={
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
}}
|
73
|
-
>
|
74
|
-
{children}
|
75
|
-
</div>
|
76
|
-
:
|
77
|
-
children
|
78
|
-
}
|
79
|
-
{hasSubsequentOverlay &&
|
80
|
-
<div className={dynamic ? isAtEnd ? '' : subsequentOverlayClassName : subsequentOverlayClassName} />
|
37
|
+
<div className={previousOverlayClassName} />
|
38
|
+
|
39
|
+
{children}
|
40
|
+
|
41
|
+
{ hasSubsequentOverlay &&
|
42
|
+
<div className={subsequentOverlayClassName} />
|
81
43
|
}
|
82
44
|
</>
|
83
45
|
)
|
84
46
|
}
|
85
47
|
|
86
|
-
export default OverlayToken
|
48
|
+
export default OverlayToken
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
<div class="pb_popover_tooltip hide" id="<%= object.tooltip_id %>" role="tooltip" style="<%= object.z_index_helper %>">
|
3
8
|
<div class="pb_popover_body <%= object.width_height_class_helper %> <%= object.popover_spacing_helper %>" style="<%= object.width_height_helper %>">
|
4
9
|
<%= content.presence %>
|
@@ -3,8 +3,7 @@
|
|
3
3
|
@import "../tokens/border_radius";
|
4
4
|
|
5
5
|
@mixin pb_progress_pill {
|
6
|
-
width:
|
7
|
-
max-width: 45px;
|
6
|
+
width: 45px;
|
8
7
|
height: 4px;
|
9
8
|
border-radius: $border_rad_light;
|
10
9
|
margin-right: $space_xs;
|
@@ -28,10 +27,6 @@
|
|
28
27
|
[class*=pb_progress_pill] {
|
29
28
|
@include pb_progress_pill;
|
30
29
|
|
31
|
-
&.full_width_pill {
|
32
|
-
max-width: none;
|
33
|
-
}
|
34
|
-
|
35
30
|
&[class*=_inactive] {
|
36
31
|
background-color: $border_light;
|
37
32
|
&.dark {
|
@@ -13,7 +13,6 @@ type ProgressPillsProps = {
|
|
13
13
|
className?: string,
|
14
14
|
data?: { [key: string]: string },
|
15
15
|
dark?: boolean,
|
16
|
-
fullWidthPill?: boolean,
|
17
16
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
18
17
|
id?: string,
|
19
18
|
steps?: number,
|
@@ -21,19 +20,19 @@ type ProgressPillsProps = {
|
|
21
20
|
value?: string,
|
22
21
|
}
|
23
22
|
|
24
|
-
const ProgressPill = ({ active, dark, steps: step
|
23
|
+
const ProgressPill = ({ active, dark, steps: step }: ProgressPillsProps) => (
|
25
24
|
<div
|
26
25
|
className={`pb_progress_pill${step <= active ? '_active' : '_inactive'}${dark ? ' dark' : ''
|
27
|
-
}
|
26
|
+
}`}
|
28
27
|
key={step}
|
29
28
|
/>
|
30
29
|
)
|
31
30
|
|
32
|
-
const showSteps = (steps: number, active: number, dark: boolean
|
31
|
+
const showSteps = (steps: number, active: number, dark: boolean) => {
|
33
32
|
const items = []
|
34
33
|
|
35
34
|
for (let step = 1; step <= steps; step++) {
|
36
|
-
items.push(ProgressPill({ steps: step, active, dark
|
35
|
+
items.push(ProgressPill({ steps: step, active, dark }))
|
37
36
|
}
|
38
37
|
|
39
38
|
return items
|
@@ -45,7 +44,6 @@ const ProgressPills = (props: ProgressPillsProps) => {
|
|
45
44
|
aria = { hidden: 'true' },
|
46
45
|
className,
|
47
46
|
data = {},
|
48
|
-
fullWidthPill = false,
|
49
47
|
htmlOptions = {},
|
50
48
|
id,
|
51
49
|
steps = 3,
|
@@ -81,7 +79,7 @@ const ProgressPills = (props: ProgressPillsProps) => {
|
|
81
79
|
text={value}
|
82
80
|
/>
|
83
81
|
</div>}
|
84
|
-
<div className="progress_pills">{showSteps(steps, active, dark
|
82
|
+
<div className="progress_pills">{showSteps(steps, active, dark)}</div>
|
85
83
|
</div>
|
86
84
|
)
|
87
85
|
}
|
@@ -3,11 +3,9 @@ examples:
|
|
3
3
|
rails:
|
4
4
|
- progress_pills_default: Default
|
5
5
|
- progress_pills_status: Status
|
6
|
-
- progress_pills_full_width: Full Container Width
|
7
6
|
|
8
7
|
|
9
8
|
|
10
9
|
react:
|
11
10
|
- progress_pills_default: Default
|
12
11
|
- progress_pills_status: Status
|
13
|
-
- progress_pills_full_width: Full Container Width
|
@@ -1,4 +1,9 @@
|
|
1
|
-
<%=
|
1
|
+
<%= content_tag(:div,
|
2
|
+
aria: object.aria_attributes,
|
3
|
+
id: object.id,
|
4
|
+
data: object.data,
|
5
|
+
class: object.classname,
|
6
|
+
**combined_html_options) do %>
|
2
7
|
|
3
8
|
<div class="progress_pills_status">
|
4
9
|
<% object.with_status do |status| %>
|
@@ -9,7 +14,7 @@
|
|
9
14
|
|
10
15
|
<div class="progress_pills">
|
11
16
|
<% object.each_step do |step| %>
|
12
|
-
<span class="pb_progress_pill<%= object.active_step(step) %><%= object.
|
17
|
+
<span class="pb_progress_pill<%= object.active_step(step) %><%= object.dark_pill %>"></span>
|
13
18
|
<% end %>
|
14
19
|
</div>
|
15
20
|
|
@@ -9,8 +9,6 @@ module Playbook
|
|
9
9
|
prop :steps, type: Playbook::Props::Number,
|
10
10
|
default: 3
|
11
11
|
prop :title
|
12
|
-
prop :full_width_pill, type: Playbook::Props::Boolean,
|
13
|
-
default: false
|
14
12
|
|
15
13
|
def classname
|
16
14
|
generate_classname("pb_progress_pills_kit")
|
@@ -28,10 +26,6 @@ module Playbook
|
|
28
26
|
step <= active ? "_active" : "_inactive"
|
29
27
|
end
|
30
28
|
|
31
|
-
def make_full_width
|
32
|
-
full_width_pill ? " full_width_pill" : nil
|
33
|
-
end
|
34
|
-
|
35
29
|
def aria_attributes
|
36
30
|
return aria if aria.present?
|
37
31
|
|
@@ -23,20 +23,6 @@ const ProgressPillsDefault = () => {
|
|
23
23
|
)
|
24
24
|
}
|
25
25
|
|
26
|
-
const ProgressPillsFullWidth = () => {
|
27
|
-
return (
|
28
|
-
<ProgressPills
|
29
|
-
active={2}
|
30
|
-
aria={{ label: ariaLabel }}
|
31
|
-
data={{ testid: testId }}
|
32
|
-
fullWidthPill
|
33
|
-
steps={3}
|
34
|
-
title={title}
|
35
|
-
value={value}
|
36
|
-
/>
|
37
|
-
)
|
38
|
-
}
|
39
|
-
|
40
26
|
test('should pass data prop', () => {
|
41
27
|
render(<ProgressPillsDefault />)
|
42
28
|
const kit = screen.getByTestId(testId)
|
@@ -65,15 +51,4 @@ test('should render value', () => {
|
|
65
51
|
render(<ProgressPillsDefault />)
|
66
52
|
const kit = screen.getByText(value)
|
67
53
|
expect(kit).toBeInTheDocument()
|
68
|
-
})
|
69
|
-
|
70
|
-
test('should apply fullWidthPill styling when fullWidthPill prop is true', () => {
|
71
|
-
render(<ProgressPillsFullWidth />)
|
72
|
-
const container = screen.getByTestId(testId)
|
73
|
-
const pillElements = container.querySelectorAll('.full_width_pill')
|
74
|
-
|
75
|
-
expect(pillElements.length).toBeGreaterThan(0)
|
76
|
-
pillElements.forEach((pill) => {
|
77
|
-
expect(pill).toHaveClass('full_width_pill')
|
78
|
-
})
|
79
|
-
})
|
54
|
+
})
|