playbook_ui 13.30.0 → 13.31.0.pre.alpha.PLAY10863202
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/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +59 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.md +6 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +4 -4
- data/app/pb_kits/playbook/pb_background/background.html.erb +2 -11
- data/app/pb_kits/playbook/pb_body/body.html.erb +1 -6
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumb_item.html.erb +1 -6
- data/app/pb_kits/playbook/pb_bread_crumbs/bread_crumbs.html.erb +1 -6
- data/app/pb_kits/playbook/pb_caption/caption.html.erb +1 -6
- data/app/pb_kits/playbook/pb_card/_card.tsx +4 -3
- data/app/pb_kits/playbook/pb_card/card.html.erb +1 -7
- data/app/pb_kits/playbook/pb_collapsible/index.js +6 -1
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_default_swift.md +33 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/_date_time_stacked_props_swift.md +18 -0
- data/app/pb_kits/playbook/pb_date_time_stacked/docs/example.yml +6 -1
- data/app/pb_kits/playbook/pb_date_year_stacked/docs/_date_year_stacked_default.jsx +4 -1
- data/app/pb_kits/playbook/pb_detail/detail.html.erb +1 -6
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +1 -6
- data/app/pb_kits/playbook/pb_dialog/dialog_body.html.erb +1 -6
- data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +2 -5
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -6
- data/app/pb_kits/playbook/pb_draggable/_draggable.scss +2 -4
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +84 -50
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +31 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +15 -19
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +5 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers.jsx +5 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.jsx +11 -4
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.md +8 -2
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.jsx +2 -2
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +5 -1
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.jsx +6 -4
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.md +5 -0
- data/app/pb_kits/playbook/pb_draggable/draggable.test.jsx +142 -15
- data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +6 -5
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +18 -0
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +228 -218
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.html.erb +9 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_error.jsx +34 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +16 -12
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +9 -0
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +17 -2
- data/app/pb_kits/playbook/pb_dropdown/index.js +33 -4
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.tsx +9 -3
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_custom_icon.html.erb +32 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_custom_icon.jsx +48 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.rb +16 -11
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/fixed_confirmation_toast.test.js +72 -0
- data/app/pb_kits/playbook/pb_flex/flex.html.erb +1 -5
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +9 -0
- data/app/pb_kits/playbook/pb_hashtag/hashtag.html.erb +1 -6
- data/app/pb_kits/playbook/pb_highlight/highlight.html.erb +1 -5
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.html.erb +1 -5
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +37 -6
- data/app/pb_kits/playbook/pb_icon/docs/_icon_default.html.erb +1 -1
- data/app/pb_kits/playbook/pb_icon/docs/_icon_default.jsx +2 -3
- data/app/pb_kits/playbook/pb_icon/icon.rb +21 -1
- data/app/pb_kits/playbook/pb_icon/icon_aliases.json +39 -0
- data/app/pb_kits/playbook/pb_list/_list.tsx +4 -4
- data/app/pb_kits/playbook/pb_list/_list_item.tsx +7 -3
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.jsx +1 -0
- data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav.md +3 -1
- data/app/pb_kits/playbook/pb_nav/item.html.erb +1 -1
- data/app/pb_kits/playbook/pb_nav/item.rb +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.html.erb +24 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_default.md +4 -4
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_multi_directional.html.erb +11 -0
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +4 -0
- data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +27 -0
- data/app/pb_kits/playbook/pb_overlay/overlay.rb +110 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +8 -23
- data/app/pb_kits/playbook/pb_selectable_list/_item.tsx +7 -3
- data/app/pb_kits/playbook/pb_selectable_list/_selectable_list.tsx +3 -3
- data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/index.ts +4 -4
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_cell.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/table.test.js +2 -0
- data/app/pb_kits/playbook/pb_table/table_header.html.erb +16 -2
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +45 -27
- data/app/pb_kits/playbook/pb_textarea/index.tsx +3 -3
- data/app/pb_kits/playbook/pb_time/_time.tsx +3 -3
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +12 -11
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +9 -7
- data/app/pb_kits/playbook/pb_title/_title.tsx +2 -1
- data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +10 -10
- data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +3 -3
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +3 -4
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +2 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +5 -4
- data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +12 -4
- data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +11 -7
- data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +8 -3
- data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +6 -1
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +26 -21
- data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +21 -6
- data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +13 -6
- data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +7 -3
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +2 -0
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_highlight.jsx +7 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/index.ts +33 -33
- data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +6 -6
- data/app/pb_kits/playbook/pb_user_badge/badges/million-dollar.tsx +236 -235
- data/app/pb_kits/playbook/pb_user_badge/badges/veteran.tsx +1 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +68 -63
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +2 -2
- data/app/pb_kits/playbook/utilities/globalProps.ts +1 -0
- data/dist/menu.yml +566 -472
- data/dist/playbook-rails.js +7 -7
- data/lib/playbook/version.rb +2 -2
- metadata +21 -5
@@ -11,6 +11,7 @@ type ListItemProps = {
|
|
11
11
|
children: React.ReactNode[] | React.ReactNode,
|
12
12
|
className?: string,
|
13
13
|
data?: Record<string, unknown>,
|
14
|
+
dragId?: string,
|
14
15
|
dragHandle?: boolean,
|
15
16
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
16
17
|
id?: string,
|
@@ -23,7 +24,8 @@ const ListItem = (props: ListItemProps) => {
|
|
23
24
|
children,
|
24
25
|
className,
|
25
26
|
data = {},
|
26
|
-
|
27
|
+
enableDrag,
|
28
|
+
dragId,
|
27
29
|
dragHandle = true,
|
28
30
|
htmlOptions = {},
|
29
31
|
id,
|
@@ -42,8 +44,10 @@ const ListItem = (props: ListItemProps) => {
|
|
42
44
|
return (
|
43
45
|
<>
|
44
46
|
{
|
45
|
-
|
46
|
-
<Draggable.Item
|
47
|
+
enableDrag ? (
|
48
|
+
<Draggable.Item
|
49
|
+
dragId={dragId}
|
50
|
+
>
|
47
51
|
<li
|
48
52
|
{...ariaProps}
|
49
53
|
{...dataProps}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<%= pb_rails("nav", props: { variant: "bold" }) do %>
|
2
|
-
<%= pb_rails("nav/item", props: { text: "Overview", link: "#", collapsible: true, icon_left:"city" }) do %>
|
2
|
+
<%= pb_rails("nav/item", props: { text: "Overview", link: "#", collapsible: true, icon_left:"city", collapsed: false }) do %>
|
3
3
|
<%= pb_rails("nav", props: { variant: "bold" }) do %>
|
4
4
|
<%= pb_rails("nav/item", props: { text: "City", link: "#" }) %>
|
5
5
|
<%= pb_rails("nav/item", props: { text: "People", link: "#" }) %>
|
@@ -1 +1,3 @@
|
|
1
|
-
The `collapsible` prop allows users to create a nested, collapsible nav. Pass `collapsible` to any NavItem and pass that navItem any number of NavItems as children to create a collapsible nav.
|
1
|
+
The `collapsible` prop allows users to create a nested, collapsible nav. Pass `collapsible` to any NavItem and pass that navItem any number of NavItems as children to create a collapsible nav.
|
2
|
+
|
3
|
+
The optional `collapsed` prop can also be used to set the default state for the collapsed nav on first render of the page. `collapsed` takes a boolean value that is set to true (meaning nav is collapsed) by default. Set it to false as shown here to have the nav open on first render.
|
@@ -12,6 +12,7 @@ module Playbook
|
|
12
12
|
default: "regular"
|
13
13
|
prop :highlighted_border, type: Playbook::Props::Boolean, default: true
|
14
14
|
prop :collapsible, type: Playbook::Props::Boolean, default: false
|
15
|
+
prop :collapsed, type: Playbook::Props::Boolean, default: true
|
15
16
|
prop :link
|
16
17
|
prop :text
|
17
18
|
prop :collapsible_trail, type: Playbook::Props::Boolean, default: false
|
@@ -0,0 +1,24 @@
|
|
1
|
+
<%= pb_rails("overlay") do %>
|
2
|
+
<%= pb_rails("table", props: { size: "sm" }) do %>
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th>Column 1</th>
|
6
|
+
<th>Column 2</th>
|
7
|
+
<th>Column 3</th>
|
8
|
+
<th>Column 4</th>
|
9
|
+
<th>Column 5</th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tbody>
|
13
|
+
<% 7.times do %>
|
14
|
+
<tr>
|
15
|
+
<td>Value 1</td>
|
16
|
+
<td>Value 2</td>
|
17
|
+
<td>Value 3</td>
|
18
|
+
<td>Value 4</td>
|
19
|
+
<td>Value 5</td>
|
20
|
+
</tr>
|
21
|
+
<% end %>
|
22
|
+
</tbody>
|
23
|
+
<% end %>
|
24
|
+
<% end %>
|
@@ -1,7 +1,7 @@
|
|
1
|
-
Overlays
|
1
|
+
Overlays optionally accept a `color`, which sets the "start" (opaque) color of a gradient mask. Because this overlay is intended to reveal underlying content, the "end" color is fixed to transparent.
|
2
2
|
|
3
|
-
The optional `layout` prop accepts
|
3
|
+
The optional `layout` prop accepts the `position` and `size` of the overlay as a key:value pair.
|
4
4
|
|
5
|
-
The `position` key accepts `
|
5
|
+
The `position` key accepts `bottom` (default), `top`, `y` (for both top and bottom) `right`, `left`, or `x` (for both left and right), which sets the side(s) where the `color` overlay starts. The direction of the overlay is always toward the opposite side of the position. For example, the default position of `bottom` starts the overlay on the bottom edge of your container and extends it toward the opposite side: the top.
|
6
6
|
|
7
|
-
The `size` value accepts our [spacing tokens](https://playbook.powerapp.cloud/visual_guidelines/spacing) or a percentage value as a string, and literally translates to how much of the container is covered by the overlay
|
7
|
+
The `size` value is `full` (100%) by default, but accepts our [spacing tokens](https://playbook.powerapp.cloud/visual_guidelines/spacing) or a percentage value as a string, and literally translates to how much of the container is covered by the overlay(s).
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%= pb_rails("overlay", props: { layout: { "x": "xl" }, color: "card_light" }) do %>
|
2
|
+
<%= pb_rails("flex", props: { column_gap: "lg", orientation: "row", overflow_x: "auto" }) do %>
|
3
|
+
<% 15.times do %>
|
4
|
+
<%= pb_rails("flex/flex_item") do %>
|
5
|
+
<%= pb_rails("card") do %>
|
6
|
+
Card content
|
7
|
+
<% end %>
|
8
|
+
<% end %>
|
9
|
+
<% end %>
|
10
|
+
<% end %>
|
11
|
+
<% end %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<%= pb_content_tag(:div,
|
2
|
+
aria: object.aria,
|
3
|
+
class: object.classname,
|
4
|
+
data: object.data,
|
5
|
+
id: object.id,
|
6
|
+
**combined_html_options) do %>
|
7
|
+
<% if is_size_percentage %>
|
8
|
+
<div class="overlay_linear_gradient"
|
9
|
+
style="background: <%= previous_overlay %>"></div>
|
10
|
+
|
11
|
+
<%= content.presence %>
|
12
|
+
|
13
|
+
<% if has_subsequent_overlay %>
|
14
|
+
<div class="overlay_linear_gradient"
|
15
|
+
style="background: <%= subsequent_overlay %>"></div>
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<% else %>
|
19
|
+
<div class="<%= previous_overlay_class_name %>"></div>
|
20
|
+
|
21
|
+
<%= content.presence %>
|
22
|
+
|
23
|
+
<% if has_subsequent_overlay %>
|
24
|
+
<div class="<%= subsequent_overlay_class_name %>"></div>
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Playbook
|
4
|
+
module PbOverlay
|
5
|
+
class Overlay < Playbook::KitBase
|
6
|
+
prop :color, type: Playbook::Props::Enum,
|
7
|
+
values: %w[card_light bg_light card_dark bg_dark],
|
8
|
+
default: "card_light"
|
9
|
+
prop :layout, type: Playbook::Props::HashProp,
|
10
|
+
default: { "bottom": "full" }
|
11
|
+
|
12
|
+
def classname
|
13
|
+
generate_classname("pb_overlay")
|
14
|
+
end
|
15
|
+
|
16
|
+
def position
|
17
|
+
layout.keys[0]
|
18
|
+
end
|
19
|
+
|
20
|
+
def size
|
21
|
+
layout.values[0]
|
22
|
+
end
|
23
|
+
|
24
|
+
def is_size_percentage
|
25
|
+
size.include?("%")
|
26
|
+
end
|
27
|
+
|
28
|
+
def previous_overlay
|
29
|
+
"linear-gradient(#{previous_overlay_direction}, #{color_map[color.to_sym]} 0%, transparent #{size})"
|
30
|
+
end
|
31
|
+
|
32
|
+
def subsequent_overlay
|
33
|
+
"linear-gradient(#{subsequent_overlay_direction}, #{color_map[color.to_sym]} 0%, transparent #{size})"
|
34
|
+
end
|
35
|
+
|
36
|
+
def previous_overlay_class_name
|
37
|
+
"overlay_#{color}_#{previous_overlay_direction_token}_#{size}"
|
38
|
+
end
|
39
|
+
|
40
|
+
def subsequent_overlay_class_name
|
41
|
+
"overlay_#{color}_#{subsequent_overlay_direction_token}_#{size}"
|
42
|
+
end
|
43
|
+
|
44
|
+
def previous_overlay_direction
|
45
|
+
previous_overlay_direction_map[position.to_sym]
|
46
|
+
end
|
47
|
+
|
48
|
+
def subsequent_overlay_direction
|
49
|
+
subsequent_overlay_direction_map[position.to_sym]
|
50
|
+
end
|
51
|
+
|
52
|
+
def previous_overlay_direction_token
|
53
|
+
has_subsequent_overlay ? previous_overlay_direction_map_token[position.to_sym] : position
|
54
|
+
end
|
55
|
+
|
56
|
+
def subsequent_overlay_direction_token
|
57
|
+
has_subsequent_overlay ? subsequent_overlay_direction_map_token[position.to_sym] : position
|
58
|
+
end
|
59
|
+
|
60
|
+
def previous_overlay_direction_map
|
61
|
+
{
|
62
|
+
"bottom": "to top",
|
63
|
+
"top": "to bottom",
|
64
|
+
"left": "to right",
|
65
|
+
"right": "to left",
|
66
|
+
"x": "to right",
|
67
|
+
"y": "to top",
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
def subsequent_overlay_direction_map
|
72
|
+
{
|
73
|
+
"bottom": "to top",
|
74
|
+
"top": "to bottom",
|
75
|
+
"left": "to right",
|
76
|
+
"right": "to left",
|
77
|
+
"x": "to left",
|
78
|
+
"y": "to bottom",
|
79
|
+
}
|
80
|
+
end
|
81
|
+
|
82
|
+
def previous_overlay_direction_map_token
|
83
|
+
{
|
84
|
+
"x": "left",
|
85
|
+
"y": "top",
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
def subsequent_overlay_direction_map_token
|
90
|
+
{
|
91
|
+
"x": "right",
|
92
|
+
"y": "bottom",
|
93
|
+
}
|
94
|
+
end
|
95
|
+
|
96
|
+
def has_subsequent_overlay
|
97
|
+
position == "x".to_sym || position == "y".to_sym
|
98
|
+
end
|
99
|
+
|
100
|
+
def color_map
|
101
|
+
{
|
102
|
+
"card_light": "#fff",
|
103
|
+
"bg_light": "#F3F7FB",
|
104
|
+
"card_dark": "#231E3D",
|
105
|
+
"bg_dark": "#0a0527",
|
106
|
+
}
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -86,33 +86,18 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
86
86
|
const toolbarElement = element.parentElement.querySelector('trix-toolbar') as HTMLElement,
|
87
87
|
blockCodeButton = toolbarElement.querySelector('[data-trix-attribute=code]') as HTMLElement
|
88
88
|
|
89
|
+
// replace default trix "block code" button with "inline code" button
|
89
90
|
let inlineCodeButton = toolbarElement.querySelector('[data-trix-attribute=inlineCode]') as HTMLElement
|
90
|
-
if (!inlineCodeButton)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
if (!inlineCodeButton) {
|
92
|
+
inlineCodeButton = blockCodeButton.cloneNode(true) as HTMLElement
|
93
|
+
blockCodeButton.hidden = true
|
94
|
+
// set button attributes
|
95
|
+
inlineCodeButton.dataset.trixAttribute = 'inlineCode'
|
96
|
+
blockCodeButton.insertAdjacentElement('afterend', inlineCodeButton)
|
97
|
+
}
|
95
98
|
|
96
99
|
if (toolbarBottom) editor.element.after(toolbarElement)
|
97
100
|
|
98
|
-
const getCodeFormattingType = (): string => {
|
99
|
-
if (editor.attributeIsActive('code')) return 'block'
|
100
|
-
if (editor.attributeIsActive('inlineCode')) return 'inline'
|
101
|
-
|
102
|
-
const range = editor.getSelectedRange()
|
103
|
-
if (range[0] == range[1]) return 'block'
|
104
|
-
|
105
|
-
const text = editor.getSelectedDocument().toString().trim()
|
106
|
-
return /\n/.test(text) ? 'block' : 'inline'
|
107
|
-
}
|
108
|
-
|
109
|
-
// DOM event listeners
|
110
|
-
element.addEventListener('trix-selection-change', () => {
|
111
|
-
const type = getCodeFormattingType()
|
112
|
-
blockCodeButton.hidden = type == 'inline'
|
113
|
-
inlineCodeButton.hidden = type == 'block'
|
114
|
-
})
|
115
|
-
|
116
101
|
focus
|
117
102
|
? (document.addEventListener('trix-focus', useFocus),
|
118
103
|
document.addEventListener('trix-blur', useFocus),
|
@@ -2,7 +2,7 @@ import React, { useState } from "react";
|
|
2
2
|
import classnames from "classnames";
|
3
3
|
|
4
4
|
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
|
5
|
-
import { globalProps } from "../utilities/globalProps";
|
5
|
+
import { globalProps, domSafeProps } from "../utilities/globalProps";
|
6
6
|
|
7
7
|
import Checkbox from "../pb_checkbox/_checkbox";
|
8
8
|
import ListItem from "../pb_list/_list_item";
|
@@ -16,6 +16,7 @@ export type SelectableListItemProps = {
|
|
16
16
|
className?: string;
|
17
17
|
data?: GenericObject;
|
18
18
|
defaultChecked?: boolean;
|
19
|
+
dragId?: string;
|
19
20
|
dragHandle?: boolean;
|
20
21
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
21
22
|
id?: string;
|
@@ -33,6 +34,7 @@ const SelectableListItem = ({
|
|
33
34
|
children,
|
34
35
|
className,
|
35
36
|
data = {},
|
37
|
+
dragId,
|
36
38
|
dragHandle = true,
|
37
39
|
defaultChecked,
|
38
40
|
htmlOptions = {},
|
@@ -67,7 +69,7 @@ const SelectableListItem = ({
|
|
67
69
|
{...props}
|
68
70
|
className={classnames(checkedState ? "checked_item" : "", className)}
|
69
71
|
dragHandle={dragHandle}
|
70
|
-
|
72
|
+
dragId={dragId}
|
71
73
|
>
|
72
74
|
<div
|
73
75
|
{...ariaProps}
|
@@ -106,7 +108,9 @@ const SelectableListItem = ({
|
|
106
108
|
text={label}
|
107
109
|
type="radio"
|
108
110
|
value={value}
|
109
|
-
|
111
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
112
|
+
//@ts-ignore
|
113
|
+
{...domSafeProps(props)}
|
110
114
|
/>
|
111
115
|
{children}
|
112
116
|
</>
|
@@ -14,7 +14,7 @@ type SelectableListProps = {
|
|
14
14
|
children?: React.ReactElement[],
|
15
15
|
className?: string,
|
16
16
|
data?: GenericObject,
|
17
|
-
|
17
|
+
enableDrag?: boolean,
|
18
18
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
19
19
|
id?: string,
|
20
20
|
variant?: 'checkbox' | 'radio',
|
@@ -26,7 +26,7 @@ const SelectableList = (props: SelectableListProps) => {
|
|
26
26
|
children,
|
27
27
|
className,
|
28
28
|
data = {},
|
29
|
-
|
29
|
+
enableDrag = false,
|
30
30
|
htmlOptions = {},
|
31
31
|
id,
|
32
32
|
} = props
|
@@ -68,7 +68,7 @@ const SelectableList = (props: SelectableListProps) => {
|
|
68
68
|
className={classes}
|
69
69
|
id={id}
|
70
70
|
>
|
71
|
-
<List
|
71
|
+
<List enableDrag={enableDrag}
|
72
72
|
variant={props.variant}
|
73
73
|
>
|
74
74
|
{selectableListItems}
|
@@ -1,19 +1,19 @@
|
|
1
1
|
import PbEnhancedElement from '../pb_enhanced_element'
|
2
2
|
|
3
3
|
export default class PbTable extends PbEnhancedElement {
|
4
|
-
static get selector() {
|
4
|
+
static get selector(): string {
|
5
5
|
return '.table-responsive-collapse'
|
6
6
|
}
|
7
7
|
|
8
|
-
connect() {
|
8
|
+
connect(): void {
|
9
9
|
const tables = document.querySelectorAll('.table-responsive-collapse');
|
10
10
|
|
11
11
|
// Each Table
|
12
12
|
[].forEach.call(tables, (table: HTMLTableElement) => {
|
13
13
|
// Header Titles
|
14
|
-
|
14
|
+
const headers: string[] = [];
|
15
15
|
[].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
|
16
|
-
|
16
|
+
const colSpan = header.colSpan
|
17
17
|
for (let i = 0; i < colSpan; i++) {
|
18
18
|
headers.push(header.textContent.replace(/\r?\n|\r/, ''));
|
19
19
|
}
|
@@ -52,6 +52,20 @@
|
|
52
52
|
data: object.data,
|
53
53
|
id: object.id,
|
54
54
|
**combined_html_options) do %>
|
55
|
-
|
55
|
+
<% unless sorting_style? %>
|
56
|
+
<%= content.presence || object.text %>
|
57
|
+
<% else %>
|
58
|
+
<%= link_to next_link, style: link_style do %>
|
59
|
+
<%= pb_rails("flex", props:{ align: object.align_content, justify: object.justify_sort_icon, classname: "pb_th_link" }) do %>
|
60
|
+
<%= content.presence || object.text %>
|
61
|
+
<% if sorting_style? %>
|
62
|
+
<%= pb_rails("icon", props: { icon: object.sort_icon(active_item[:direction], active_item[:active]),
|
63
|
+
fixed_width: true,
|
64
|
+
classname: active_item.any? ? "pb_th_active" : "",
|
65
|
+
padding_left: "xs" }) %>
|
66
|
+
<% end %>
|
67
|
+
<% end %>
|
68
|
+
<% end %>
|
69
|
+
<% end %>
|
70
|
+
<% end %>
|
56
71
|
<% end %>
|
57
|
-
<% end %>
|
@@ -5,12 +5,12 @@ import TextInput from '../../pb_text_input/_text_input'
|
|
5
5
|
import Title from '../../pb_title/_title'
|
6
6
|
|
7
7
|
const TextInputDefault = (props) => {
|
8
|
+
const [firstName, setFirstName] = useState('')
|
8
9
|
const handleOnChangeFirstName = ({ target }) => {
|
9
10
|
setFirstName(target.value)
|
10
11
|
}
|
11
12
|
const ref = React.createRef()
|
12
13
|
|
13
|
-
const [firstName, setFirstName] = useState('')
|
14
14
|
const [formFields, setFormFields] = useState({
|
15
15
|
firstName: 'Jane',
|
16
16
|
lastName: 'Doe',
|
@@ -52,14 +52,15 @@ const Textarea = ({
|
|
52
52
|
label,
|
53
53
|
maxCharacters,
|
54
54
|
name,
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
55
56
|
onChange = () => {},
|
56
57
|
placeholder,
|
57
58
|
required,
|
58
59
|
rows = 4,
|
59
60
|
value,
|
60
61
|
...props
|
61
|
-
}: TextareaProps
|
62
|
-
ref = useRef<HTMLTextAreaElement>(null)
|
62
|
+
}: TextareaProps) => {
|
63
|
+
const ref = useRef<HTMLTextAreaElement>(null)
|
63
64
|
useEffect(() => {
|
64
65
|
if (ref.current && resize === 'auto') {
|
65
66
|
PbTextarea.addMatch(ref.current)
|
@@ -71,58 +72,75 @@ const Textarea = ({
|
|
71
72
|
const resizeClass = `resize_${resize}`
|
72
73
|
const classes = classnames('pb_textarea_kit', errorClass, inlineClass, resizeClass, globalProps(props), className)
|
73
74
|
const noCount = typeof characterCount !== 'undefined'
|
74
|
-
const ariaProps: {[key: string]:
|
75
|
-
const dataProps: {[key: string]:
|
75
|
+
const ariaProps: {[key: string]: string} = buildAriaProps(aria)
|
76
|
+
const dataProps: {[key: string]: string} = buildDataProps(data)
|
76
77
|
const htmlProps = buildHtmlProps(htmlOptions)
|
77
|
-
const characterCounter = () => {
|
78
|
-
return maxCharacters && characterCount ? `${checkIfZero(characterCount)} / ${maxCharacters}` : `${checkIfZero(characterCount)}`
|
79
|
-
}
|
80
|
-
|
81
78
|
const checkIfZero = (characterCount: string | number) => {
|
82
79
|
return characterCount == 0 ? characterCount.toString() : characterCount
|
83
80
|
}
|
81
|
+
const characterCounter = () => {
|
82
|
+
return maxCharacters && characterCount ? `${checkIfZero(characterCount)} / ${maxCharacters}` : `${checkIfZero(characterCount)}`
|
83
|
+
}
|
84
84
|
|
85
85
|
return (
|
86
86
|
<div
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
87
|
+
{...ariaProps}
|
88
|
+
{...dataProps}
|
89
|
+
{...htmlProps}
|
90
|
+
className={classes}
|
91
91
|
>
|
92
92
|
<Caption text={label} />
|
93
93
|
{children || (
|
94
94
|
<textarea
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
95
|
+
className="pb_textarea_kit"
|
96
|
+
disabled={disabled}
|
97
|
+
name={name}
|
98
|
+
onChange={onChange}
|
99
|
+
placeholder={placeholder}
|
100
|
+
ref={ref}
|
101
|
+
required={required}
|
102
|
+
rows={rows}
|
103
|
+
value={value}
|
104
|
+
{...props}
|
105
105
|
/>
|
106
106
|
)}
|
107
107
|
|
108
108
|
{error ? (
|
109
109
|
<>
|
110
110
|
{characterCount ? (
|
111
|
-
<Flex
|
111
|
+
<Flex
|
112
|
+
spacing="between"
|
113
|
+
vertical="center"
|
114
|
+
>
|
112
115
|
<FlexItem>
|
113
|
-
<Body
|
116
|
+
<Body
|
117
|
+
margin="none"
|
118
|
+
status="negative"
|
119
|
+
text={error}
|
120
|
+
/>
|
114
121
|
</FlexItem>
|
115
122
|
<FlexItem>
|
116
|
-
<Caption
|
123
|
+
<Caption
|
124
|
+
margin="none"
|
125
|
+
size="xs"
|
126
|
+
text={characterCounter()}
|
127
|
+
/>
|
117
128
|
</FlexItem>
|
118
129
|
</Flex>
|
119
130
|
) : (
|
120
|
-
<Body
|
131
|
+
<Body
|
132
|
+
status="negative"
|
133
|
+
text={error}
|
134
|
+
/>
|
121
135
|
)}
|
122
136
|
</>
|
123
137
|
) : (
|
124
138
|
noCount && (
|
125
|
-
<Caption
|
139
|
+
<Caption
|
140
|
+
margin="none"
|
141
|
+
size="xs"
|
142
|
+
text={characterCounter()}
|
143
|
+
/>
|
126
144
|
)
|
127
145
|
)}
|
128
146
|
</div>
|