playbook_ui 14.12.0.pre.alpha.PBNTR456fixedconftoastrailsautoclose5757 → 14.12.0.pre.alpha.PBNTR779railsdraggablecrosscontainer5863
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/_advanced_table.scss +3 -4
- data/app/pb_kits/playbook/pb_advanced_table/index.js +9 -6
- data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +8 -5
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +9 -0
- data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +11 -7
- data/app/pb_kits/playbook/pb_avatar/avatar.html.erb +6 -7
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_badge_component_overlay.jsx +9 -3
- data/app/pb_kits/playbook/pb_avatar/docs/_avatar_circle_icon_component_overlay.jsx +6 -2
- data/app/pb_kits/playbook/pb_button/button.rb +1 -1
- data/app/pb_kits/playbook/pb_date/_date.tsx +14 -4
- data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +2 -1
- data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +13 -5
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.html.erb +193 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_multiple_containers_rails.md +1 -0
- data/app/pb_kits/playbook/pb_draggable/docs/example.yml +1 -5
- data/app/pb_kits/playbook/pb_draggable/draggable_container.html.erb +2 -2
- data/app/pb_kits/playbook/pb_draggable/draggable_container.rb +3 -0
- data/app/pb_kits/playbook/pb_draggable/draggable_item.rb +2 -0
- data/app/pb_kits/playbook/pb_draggable/index.js +88 -16
- data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +1 -6
- data/app/pb_kits/playbook/pb_filter/filter.html.erb +1 -5
- data/app/pb_kits/playbook/pb_form_group/form_group.html.erb +1 -6
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +1 -1
- data/app/pb_kits/playbook/pb_home_address_street/_home_address_street.tsx +11 -7
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.html.erb +11 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting.jsx +22 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_rails.md +1 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/_home_address_street_formatting_react.md +1 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_home_address_street/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_home_address_street/home_address_street.rb +11 -2
- data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.html.erb +6 -9
- data/app/pb_kits/playbook/pb_table/docs/_table_with_background_kit.jsx +6 -9
- data/app/pb_kits/playbook/pb_table/styles/_desktop_collapse.scss +26 -0
- data/app/pb_kits/playbook/pb_table/styles/_mobile.scss +0 -1
- data/app/pb_kits/playbook/pb_table/styles/_mobile_collapse.scss +25 -0
- data/app/pb_kits/playbook/pb_table/styles/_tablet_collapse.scss +25 -0
- data/app/pb_kits/playbook/pb_user/_user.tsx +3 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.html.erb +42 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.jsx +59 -0
- data/app/pb_kits/playbook/pb_user/docs/_user_light_weight.md +2 -0
- data/app/pb_kits/playbook/pb_user/docs/example.yml +2 -0
- data/app/pb_kits/playbook/pb_user/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_user/user.html.erb +1 -1
- data/app/pb_kits/playbook/pb_user/user.rb +1 -0
- data/app/pb_kits/playbook/pb_user/user.test.js +14 -0
- data/dist/chunks/{_typeahead-BIhRQo8Q.js → _typeahead-W0hatdPs.js} +2 -2
- data/dist/chunks/_weekday_stacked-C98LOqgG.js +45 -0
- data/dist/chunks/vendor.js +1 -1
- 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/version.rb +1 -1
- metadata +13 -4
- data/dist/chunks/_weekday_stacked-VKMYuo6-.js +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 765d089ccf2865b636f00f2731f259d3251554090ba8cf345d1b96c887af523a
|
4
|
+
data.tar.gz: d2027d84bedb2da3000a272b5c85e8c108dbf4fac0c612653a8ce7f943924f51
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5927b36c0974b0d951da24d21a0afbae2f1e4949ec0e73e299491f7bb33e378b6be3eb573c0e090edc94efb924753b9117a310d12c6ff43da62c79cd21edbc17
|
7
|
+
data.tar.gz: 123324d5d23872521397b16043be4df25028beb28731e8cf7e2a79ff4c49058aa4a902a1908677d0533163256ea5860861d2cdb629971be3599a61b55192c95d
|
@@ -89,7 +89,6 @@
|
|
89
89
|
}
|
90
90
|
}
|
91
91
|
|
92
|
-
|
93
92
|
.table-header-cells-active:first-child {
|
94
93
|
color: $primary !important;
|
95
94
|
}
|
@@ -179,7 +178,7 @@
|
|
179
178
|
}
|
180
179
|
|
181
180
|
// Responsive Styles
|
182
|
-
@media only screen and (max-width: $screen-xl-min) {
|
181
|
+
@media only screen and (max-width: $screen-xl-min) {
|
183
182
|
&[class*="advanced-table-responsive-scroll"] {
|
184
183
|
border-radius: 4px;
|
185
184
|
box-shadow: 1px 0 0 0px $border_light,
|
@@ -215,7 +214,7 @@
|
|
215
214
|
.bg-white td:first-child {
|
216
215
|
background-color: $white;
|
217
216
|
}
|
218
|
-
|
217
|
+
|
219
218
|
}
|
220
219
|
}
|
221
220
|
@media only screen and (min-width: $screen-xl-min) {
|
@@ -306,4 +305,4 @@
|
|
306
305
|
}
|
307
306
|
}
|
308
307
|
}
|
309
|
-
}
|
308
|
+
}
|
@@ -133,15 +133,18 @@ export default class PbAdvancedTable extends PbEnhancedElement {
|
|
133
133
|
if (!elements.length) return;
|
134
134
|
|
135
135
|
const isVisible = elements[0].classList.contains("is-visible");
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
136
|
+
|
137
|
+
isVisible ? this.hideElement(elements) : this.showElement(elements);
|
138
|
+
isVisible ? this.displayDownArrow() : this.displayUpArrow();
|
139
|
+
|
140
|
+
const row = this.element.closest("tr");
|
141
|
+
if (row) {
|
142
|
+
row.classList.toggle("bg-silver", !isVisible);
|
143
|
+
row.classList.toggle("bg-white", isVisible);
|
142
144
|
}
|
143
145
|
}
|
144
146
|
|
147
|
+
|
145
148
|
displayDownArrow() {
|
146
149
|
this.element.querySelector(DOWN_ARROW_SELECTOR).style.display =
|
147
150
|
"inline-block";
|
@@ -14,10 +14,13 @@
|
|
14
14
|
<div style="padding-left: <%= depth * 1.25 %>em">
|
15
15
|
<%= pb_rails("flex", props:{align: "center", column_gap: "xs"}) do %>
|
16
16
|
<% if index.zero? && object.row[:children].present? %>
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
<button
|
18
|
+
id="<%= "#{object.id}_#{object.row.object_id}" %>"
|
19
|
+
class="gray-icon expand-toggle-icon"
|
20
|
+
data-advanced-table="true">
|
21
|
+
<%= pb_rails("icon", props: { id: "advanced-table_open_icon", icon: "circle-play", cursor: "pointer" }) %>
|
22
|
+
<%= pb_rails("icon", props: { id: "advanced-table_close_icon", display: "none", icon: "circle-play", cursor: "pointer", rotation: 90 }) %>
|
23
|
+
</button>
|
21
24
|
<% end %>
|
22
25
|
<%= pb_rails("flex/flex_item", props:{padding_left: index.zero? && object.row[:children].present? ? "none" : "xs"}) do %>
|
23
26
|
<% if column[:custom_renderer].present? %>
|
@@ -42,4 +45,4 @@
|
|
42
45
|
<% end %>
|
43
46
|
<% end %>
|
44
47
|
<% end %>
|
45
|
-
<% end %>
|
48
|
+
<% end %>
|
@@ -27,6 +27,9 @@ $avatar-sizes: (
|
|
27
27
|
flex-basis: $size;
|
28
28
|
|
29
29
|
& > [class^=pb_flex_kit] {
|
30
|
+
[class^=pb_card_kit] {
|
31
|
+
padding: 2px;
|
32
|
+
}
|
30
33
|
[class^=pb_card_kit].overlay_bottom_center,
|
31
34
|
[class^=pb_card_kit].overlay_top_center {
|
32
35
|
left: 50%;
|
@@ -52,6 +55,10 @@ $avatar-sizes: (
|
|
52
55
|
flex-grow: 0;
|
53
56
|
flex-basis: $size;
|
54
57
|
|
58
|
+
.dark & {
|
59
|
+
background: $text_dk_light;
|
60
|
+
}
|
61
|
+
|
55
62
|
&::before {
|
56
63
|
content: attr(data-initials);
|
57
64
|
width: 100%;
|
@@ -78,9 +85,11 @@ $avatar-sizes: (
|
|
78
85
|
}
|
79
86
|
}
|
80
87
|
}
|
88
|
+
|
81
89
|
&.dark {
|
82
90
|
[class^=pb_card_kit] {
|
83
91
|
position: absolute;
|
92
|
+
padding: 2px;
|
84
93
|
}
|
85
94
|
}
|
86
95
|
}
|
@@ -23,8 +23,8 @@ export type AvatarProps = {
|
|
23
23
|
variant?: string,
|
24
24
|
icon?: string
|
25
25
|
},
|
26
|
-
data?: {[key: string]: string},
|
27
26
|
dark?: boolean,
|
27
|
+
data?: {[key: string]: string},
|
28
28
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
29
29
|
id?: string,
|
30
30
|
imageAlt?: string,
|
@@ -71,13 +71,13 @@ const Avatar = (props: AvatarProps): React.ReactElement => {
|
|
71
71
|
|
72
72
|
const canShowImage = imageUrl && !error
|
73
73
|
|
74
|
-
const onlineStatusSize =
|
74
|
+
const onlineStatusSize =
|
75
75
|
['xxs', 'xs'].includes(size) ? 'sm' :
|
76
76
|
['sm', 'md'].includes(size) ? 'md' :
|
77
77
|
['lg', 'xl'].includes(size) ? 'lg' :
|
78
78
|
'sm';
|
79
79
|
|
80
|
-
const onlineStatusPositionProps = (["xxs", "xs", "sm"].includes(size)) ?
|
80
|
+
const onlineStatusPositionProps = (["xxs", "xs", "sm"].includes(size)) ?
|
81
81
|
{
|
82
82
|
top: { inset: true, value: "0" },
|
83
83
|
right: { inset: false, value: "xxs" }
|
@@ -96,10 +96,10 @@ const Avatar = (props: AvatarProps): React.ReactElement => {
|
|
96
96
|
id={id}
|
97
97
|
>
|
98
98
|
{componentOverlay ? (
|
99
|
-
<Flex display="display_inline_block"
|
99
|
+
<Flex display="display_inline_block"
|
100
100
|
position="relative"
|
101
101
|
>
|
102
|
-
<div className="avatar_wrapper"
|
102
|
+
<div className="avatar_wrapper"
|
103
103
|
data-initials={initials}
|
104
104
|
>
|
105
105
|
{canShowImage && (
|
@@ -115,12 +115,14 @@ const Avatar = (props: AvatarProps): React.ReactElement => {
|
|
115
115
|
<Card
|
116
116
|
borderNone
|
117
117
|
borderRadius="rounded"
|
118
|
+
dark={dark}
|
118
119
|
padding="none"
|
119
120
|
position="absolute"
|
120
121
|
{...getPlacementProps(componentOverlay.placement, size)}
|
121
122
|
>
|
122
|
-
|
123
|
+
|
123
124
|
<Badge
|
125
|
+
dark={dark}
|
124
126
|
rounded
|
125
127
|
text={componentOverlay.text}
|
126
128
|
variant={componentOverlay.variant as "error" | "info" | "neutral" | "primary" | "success" | "warning" | "notification"}
|
@@ -131,11 +133,13 @@ const Avatar = (props: AvatarProps): React.ReactElement => {
|
|
131
133
|
<Card
|
132
134
|
borderNone
|
133
135
|
borderRadius="rounded"
|
136
|
+
dark={dark}
|
134
137
|
htmlOptions={{style: {padding:"2px"}}}
|
135
138
|
position="absolute"
|
136
139
|
{...getPlacementProps(componentOverlay.placement, size)}
|
137
140
|
>
|
138
141
|
<IconCircle
|
142
|
+
dark={dark}
|
139
143
|
icon={componentOverlay.icon}
|
140
144
|
size="xxs"
|
141
145
|
variant={componentOverlay.variant as "default" | "royal" | "blue" | "purple" | "teal" | "red" | "yellow" | "orange" | "green"}
|
@@ -145,7 +149,7 @@ const Avatar = (props: AvatarProps): React.ReactElement => {
|
|
145
149
|
</Flex>
|
146
150
|
) : (
|
147
151
|
<>
|
148
|
-
<div className="avatar_wrapper"
|
152
|
+
<div className="avatar_wrapper"
|
149
153
|
data-initials={initials}
|
150
154
|
>
|
151
155
|
{canShowImage && (
|
@@ -1,22 +1,22 @@
|
|
1
1
|
|
2
2
|
<%= object.pb_content_tag(:div, data: object.data.merge(initials: object.initials)) do %>
|
3
3
|
<% if object.component_overlay && object.component_overlay[:component] == "icon_circle" %>
|
4
|
-
<%= pb_rails("flex", props: {display: "display_inline_block", position: "relative" }) do %>
|
4
|
+
<%= pb_rails("flex", props: { display: "display_inline_block", position: "relative" }) do %>
|
5
5
|
<%= content_tag(:div, data: { initials: object.initials }, class: "avatar_wrapper") do %>
|
6
6
|
<%= pb_rails("image", props: { alt: object.alt_text, url: object.image_url, on_error: object.handle_img_error }) if object.image_url.present? %>
|
7
7
|
<% end %>
|
8
|
-
<%= pb_rails("card", props: { border_none: true, border_radius: "rounded",
|
8
|
+
<%= pb_rails("card", props: { border_none: true, border_radius: "rounded", dark: object.dark, position: "absolute" }.merge(specific_placement_style)) do %>
|
9
9
|
|
10
|
-
<%= pb_rails("icon_circle", props: { size: "xxs", icon: object.component_overlay[:icon], variant: object.component_overlay[:variant] }) %>
|
10
|
+
<%= pb_rails("icon_circle", props: { dark: object.dark, size: "xxs", icon: object.component_overlay[:icon], variant: object.component_overlay[:variant] }) %>
|
11
11
|
<% end %>
|
12
12
|
<% end %>
|
13
13
|
<% elsif object.component_overlay && object.component_overlay[:component] == "badge" %>
|
14
|
-
<%= pb_rails("flex", props: {display: "display_inline_block", position: "relative" }) do %>
|
14
|
+
<%= pb_rails("flex", props: { display: "display_inline_block", position: "relative" }) do %>
|
15
15
|
<%= content_tag(:div, data: { initials: object.initials }, class: "avatar_wrapper") do %>
|
16
16
|
<%= pb_rails("image", props: { alt: object.alt_text, url: object.image_url, on_error: object.handle_img_error }) if object.image_url.present? %>
|
17
17
|
<% end %>
|
18
|
-
<%= pb_rails("card", props: { border_none: true, border_radius: "rounded", padding: "none", position: "absolute" }.merge(specific_placement_style)) do %>
|
19
|
-
<%= pb_rails("badge", props: { rounded: true, text: object.component_overlay[:text], variant: object.component_overlay[:variant] }) %>
|
18
|
+
<%= pb_rails("card", props: { border_none: true, border_radius: "rounded", dark: object.dark, padding: "none", position: "absolute" }.merge(specific_placement_style)) do %>
|
19
|
+
<%= pb_rails("badge", props: { dark: object.dark, rounded: true, text: object.component_overlay[:text], variant: object.component_overlay[:variant] }) %>
|
20
20
|
<% end %>
|
21
21
|
<% end %>
|
22
22
|
<% else %>
|
@@ -26,4 +26,3 @@
|
|
26
26
|
<%= pb_rails("online_status", props: object.online_status_props) if object.status %>
|
27
27
|
<% end %>
|
28
28
|
<% end %>
|
29
|
-
|
@@ -1,18 +1,19 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Avatar } from 'playbook-ui'
|
3
3
|
|
4
|
-
const AvatarBadgeComponentOverlay = () => {
|
4
|
+
const AvatarBadgeComponentOverlay = (props) => {
|
5
5
|
return (
|
6
6
|
<div>
|
7
7
|
<Avatar
|
8
8
|
componentOverlay={{
|
9
9
|
component: "badge",
|
10
10
|
placement: "bottom-right",
|
11
|
-
text: "12"
|
11
|
+
text: "12",
|
12
12
|
}}
|
13
13
|
imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
|
14
14
|
marginBottom="sm"
|
15
15
|
size="sm"
|
16
|
+
{...props}
|
16
17
|
/>
|
17
18
|
|
18
19
|
<Avatar
|
@@ -24,6 +25,8 @@ const AvatarBadgeComponentOverlay = () => {
|
|
24
25
|
imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
|
25
26
|
marginBottom="sm"
|
26
27
|
size="md"
|
28
|
+
{...props}
|
29
|
+
|
27
30
|
/>
|
28
31
|
|
29
32
|
<Avatar
|
@@ -36,6 +39,8 @@ const AvatarBadgeComponentOverlay = () => {
|
|
36
39
|
imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
|
37
40
|
marginBottom="sm"
|
38
41
|
size="lg"
|
42
|
+
{...props}
|
43
|
+
|
39
44
|
/>
|
40
45
|
|
41
46
|
<Avatar
|
@@ -48,7 +53,8 @@ const AvatarBadgeComponentOverlay = () => {
|
|
48
53
|
imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
|
49
54
|
marginBottom="sm"
|
50
55
|
size="xl"
|
51
|
-
|
56
|
+
{...props}
|
57
|
+
/>
|
52
58
|
</div>
|
53
59
|
)
|
54
60
|
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import React from "react";
|
2
2
|
import { Avatar } from 'playbook-ui'
|
3
3
|
|
4
|
-
const AvatarCircleIconComponentOverlay = () => {
|
4
|
+
const AvatarCircleIconComponentOverlay = (props) => {
|
5
5
|
return (
|
6
6
|
<div>
|
7
7
|
<Avatar
|
@@ -14,6 +14,7 @@ const AvatarCircleIconComponentOverlay = () => {
|
|
14
14
|
imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
|
15
15
|
marginBottom="sm"
|
16
16
|
size="sm"
|
17
|
+
{...props}
|
17
18
|
/>
|
18
19
|
|
19
20
|
<Avatar
|
@@ -26,6 +27,7 @@ const AvatarCircleIconComponentOverlay = () => {
|
|
26
27
|
imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
|
27
28
|
marginBottom="sm"
|
28
29
|
size="md"
|
30
|
+
{...props}
|
29
31
|
/>
|
30
32
|
|
31
33
|
<Avatar
|
@@ -38,6 +40,7 @@ const AvatarCircleIconComponentOverlay = () => {
|
|
38
40
|
imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
|
39
41
|
marginBottom="sm"
|
40
42
|
size="lg"
|
43
|
+
{...props}
|
41
44
|
/>
|
42
45
|
|
43
46
|
<Avatar
|
@@ -50,7 +53,8 @@ const AvatarCircleIconComponentOverlay = () => {
|
|
50
53
|
imageUrl="https://randomuser.me/api/portraits/men/44.jpg"
|
51
54
|
marginBottom="sm"
|
52
55
|
size="xl"
|
53
|
-
|
56
|
+
{...props}
|
57
|
+
/>
|
54
58
|
</div>
|
55
59
|
)
|
56
60
|
}
|
@@ -14,6 +14,7 @@ type PbDateProps = {
|
|
14
14
|
alignment?: "left" | "center" | "right";
|
15
15
|
aria?: { [key: string]: string };
|
16
16
|
className?: string;
|
17
|
+
dark?: boolean;
|
17
18
|
data?: { [key: string]: string };
|
18
19
|
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
19
20
|
id?: string;
|
@@ -29,6 +30,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
29
30
|
aria = {},
|
30
31
|
alignment = "left",
|
31
32
|
className,
|
33
|
+
dark = false,
|
32
34
|
data = {},
|
33
35
|
htmlOptions = {},
|
34
36
|
id,
|
@@ -56,7 +58,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
56
58
|
);
|
57
59
|
|
58
60
|
return (
|
59
|
-
<div
|
61
|
+
<div
|
60
62
|
{...ariaProps}
|
61
63
|
{...dataProps}
|
62
64
|
{...htmlProps}
|
@@ -93,7 +95,9 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
93
95
|
</>
|
94
96
|
: size == "md" || size == "lg"
|
95
97
|
? (
|
96
|
-
<Title
|
98
|
+
<Title
|
99
|
+
dark={dark}
|
100
|
+
size={4}
|
97
101
|
tag="h4"
|
98
102
|
>
|
99
103
|
{showIcon && (
|
@@ -127,6 +131,7 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
127
131
|
<>
|
128
132
|
{showIcon && (
|
129
133
|
<Caption className="pb_icon_kit_container"
|
134
|
+
dark={dark}
|
130
135
|
tag="span"
|
131
136
|
>
|
132
137
|
<Icon fixedWidth
|
@@ -138,15 +143,20 @@ const PbDate = (props: PbDateProps): React.ReactElement => {
|
|
138
143
|
|
139
144
|
{showDayOfWeek && (
|
140
145
|
<>
|
141
|
-
<Caption
|
146
|
+
<Caption dark={dark}
|
147
|
+
tag="div">
|
148
|
+
{weekday}
|
149
|
+
</Caption>
|
142
150
|
<Caption color="light"
|
151
|
+
dark={dark}
|
143
152
|
tag="div"
|
144
153
|
text=" • "
|
145
154
|
/>
|
146
155
|
</>
|
147
156
|
)}
|
148
157
|
|
149
|
-
<Caption
|
158
|
+
<Caption dark={dark}
|
159
|
+
tag="span">
|
150
160
|
{month} {day}
|
151
161
|
{currentYear != year && <>{`, ${year}`}</>}
|
152
162
|
</Caption>
|
@@ -18,7 +18,7 @@ const DateDefault = (props) => {
|
|
18
18
|
value={"2012-08-03"}
|
19
19
|
{...props}
|
20
20
|
/>
|
21
|
-
<Caption>{"(Hyphenated Date)"}</Caption>
|
21
|
+
<Caption {...props}>{"(Hyphenated Date)"}</Caption>
|
22
22
|
</div>
|
23
23
|
|
24
24
|
<br />
|
@@ -56,6 +56,7 @@ const DateDefault = (props) => {
|
|
56
56
|
<Title
|
57
57
|
size={4}
|
58
58
|
text={"(Hyphenated Date)"}
|
59
|
+
{...props}
|
59
60
|
/>
|
60
61
|
</div>
|
61
62
|
|
@@ -4,7 +4,8 @@ import { Caption, Date as FormattedDate, Title } from 'playbook-ui'
|
|
4
4
|
const DateUnstyled = (props) => {
|
5
5
|
return (
|
6
6
|
<>
|
7
|
-
<Caption
|
7
|
+
<Caption {...props}
|
8
|
+
size="xs"
|
8
9
|
text="Basic unstyled example"
|
9
10
|
/>
|
10
11
|
<FormattedDate
|
@@ -15,10 +16,14 @@ const DateUnstyled = (props) => {
|
|
15
16
|
|
16
17
|
<br />
|
17
18
|
|
18
|
-
<Caption
|
19
|
+
<Caption {...props}
|
20
|
+
|
21
|
+
size="xs"
|
19
22
|
text="Example with wrapping typography kit"
|
20
23
|
/>
|
21
|
-
<Title
|
24
|
+
<Title {...props}
|
25
|
+
size={1}
|
26
|
+
>
|
22
27
|
<FormattedDate
|
23
28
|
unstyled
|
24
29
|
value={new Date('25 Dec 1995')}
|
@@ -28,10 +33,13 @@ const DateUnstyled = (props) => {
|
|
28
33
|
|
29
34
|
<br />
|
30
35
|
|
31
|
-
<Caption
|
36
|
+
<Caption {...props}
|
37
|
+
size="xs"
|
32
38
|
text="Example with icon + subcaption"
|
33
39
|
/>
|
34
|
-
<Caption
|
40
|
+
<Caption {...props}
|
41
|
+
size="xs"
|
42
|
+
>
|
35
43
|
<FormattedDate
|
36
44
|
showDayOfWeek
|
37
45
|
showIcon
|
@@ -0,0 +1,193 @@
|
|
1
|
+
<% content_for :helper_methods do %>
|
2
|
+
<% def badge_properties(container)
|
3
|
+
case container
|
4
|
+
when "To Do"
|
5
|
+
{ text: "queue", variant: "warning" }
|
6
|
+
when "In Progress"
|
7
|
+
{ text: "progress", variant: "primary" }
|
8
|
+
else
|
9
|
+
{ text: "done", variant: "success" }
|
10
|
+
end
|
11
|
+
end %>
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<% containers = [
|
15
|
+
"To Do",
|
16
|
+
"In Progress",
|
17
|
+
"Done"
|
18
|
+
] %>
|
19
|
+
|
20
|
+
<% items_data = [
|
21
|
+
{
|
22
|
+
id: "11",
|
23
|
+
container: "To Do",
|
24
|
+
title: "Task 1",
|
25
|
+
description: "Bug fixes",
|
26
|
+
assignee_name: "Terry Miles",
|
27
|
+
assignee_img: "https://randomuser.me/api/portraits/men/44.jpg",
|
28
|
+
},
|
29
|
+
{
|
30
|
+
id: "12",
|
31
|
+
container: "To Do",
|
32
|
+
title: "Task 2",
|
33
|
+
description: "Documentation",
|
34
|
+
assignee_name: "Sophia Miles",
|
35
|
+
assignee_img: "https://randomuser.me/api/portraits/women/8.jpg",
|
36
|
+
},
|
37
|
+
{
|
38
|
+
id: "13",
|
39
|
+
container: "In Progress",
|
40
|
+
title: "Task 3",
|
41
|
+
description: "Add a variant",
|
42
|
+
assignee_name: "Alice Jones",
|
43
|
+
assignee_img: "https://randomuser.me/api/portraits/women/10.jpg",
|
44
|
+
},
|
45
|
+
{
|
46
|
+
id: "14",
|
47
|
+
container: "To Do",
|
48
|
+
title: "Task 4",
|
49
|
+
description: "Add jest tests",
|
50
|
+
assignee_name: "Mike James",
|
51
|
+
assignee_img: "https://randomuser.me/api/portraits/men/8.jpg",
|
52
|
+
},
|
53
|
+
{
|
54
|
+
id: "15",
|
55
|
+
container: "Done",
|
56
|
+
title: "Task 5",
|
57
|
+
description: "Alpha testing",
|
58
|
+
assignee_name: "James Guy",
|
59
|
+
assignee_img: "https://randomuser.me/api/portraits/men/18.jpg",
|
60
|
+
},
|
61
|
+
{
|
62
|
+
id: "16",
|
63
|
+
container: "In Progress",
|
64
|
+
title: "Task 6",
|
65
|
+
description: "Release",
|
66
|
+
assignee_name: "Sally Jones",
|
67
|
+
assignee_img: "https://randomuser.me/api/portraits/women/28.jpg",
|
68
|
+
},
|
69
|
+
] %>
|
70
|
+
|
71
|
+
<%= pb_rails("draggable", props: { initial_items: items_data }) do %>
|
72
|
+
<%= pb_rails("flex", props: { justify_content: "center" }) do %>
|
73
|
+
<% containers.each do |container| %>
|
74
|
+
<%= pb_rails("draggable/draggable_container", props: {
|
75
|
+
container: container,
|
76
|
+
width: "xs",
|
77
|
+
height: "xs",
|
78
|
+
padding: "sm",
|
79
|
+
data: { container: container }
|
80
|
+
}) do %>
|
81
|
+
<%= pb_rails("caption", props: { text_align: "center" }) do %><%= container %><% end %>
|
82
|
+
<%= pb_rails("flex", props: {align_items: "stretch", orientation: "column"}) do %>
|
83
|
+
<% items_data.select { |item| item[:container] == container }.each do |item| %>
|
84
|
+
<%= pb_rails("draggable/draggable_item", props: {
|
85
|
+
container: container,
|
86
|
+
drag_id: item[:id]
|
87
|
+
}) do %>
|
88
|
+
<%= pb_rails("card", props: { margin_bottom: "sm", padding: "sm"}) do %>
|
89
|
+
<%= pb_rails("flex", props: { justify: "between" }) do %>
|
90
|
+
<%= pb_rails("flex/flex_item") do %>
|
91
|
+
<%= pb_rails("flex") do %>
|
92
|
+
<%= pb_rails("avatar", props: {
|
93
|
+
image_url: item[:assignee_img],
|
94
|
+
name: item[:assignee_name],
|
95
|
+
size: "xxs"
|
96
|
+
}) %>
|
97
|
+
<%= pb_rails("title", props: {
|
98
|
+
padding_left: "xs",
|
99
|
+
size: 4,
|
100
|
+
text: item[:title]
|
101
|
+
}) %>
|
102
|
+
<% end %>
|
103
|
+
<% end %>
|
104
|
+
<%= pb_rails("badge", props: {
|
105
|
+
margin_left: "sm",
|
106
|
+
rounded: true,
|
107
|
+
text: badge_properties(container)[:text],
|
108
|
+
variant: badge_properties(container)[:variant],
|
109
|
+
data: {
|
110
|
+
pb_status_badge: true,
|
111
|
+
pb_tag_type: "badge"
|
112
|
+
}
|
113
|
+
}) %>
|
114
|
+
<% end %>
|
115
|
+
<%= pb_rails("body", props: { padding_top: "xs", text: item[:description] }) %>
|
116
|
+
<% end %>
|
117
|
+
<% end %>
|
118
|
+
<% end %>
|
119
|
+
<% end %>
|
120
|
+
<% end %>
|
121
|
+
<% end %>
|
122
|
+
<% end %>
|
123
|
+
<% end %>
|
124
|
+
|
125
|
+
<script>
|
126
|
+
const initBadgeUpdates = function() {
|
127
|
+
const updateBadge = function(container) {
|
128
|
+
switch (container) {
|
129
|
+
case 'To Do':
|
130
|
+
return { text: 'queue', variant: 'warning' };
|
131
|
+
case 'In Progress':
|
132
|
+
return { text: 'progress', variant: 'primary' };
|
133
|
+
case 'Done':
|
134
|
+
return { text: 'done', variant: 'success' };
|
135
|
+
default:
|
136
|
+
return { text: 'queue', variant: 'warning' };
|
137
|
+
}
|
138
|
+
};
|
139
|
+
|
140
|
+
let draggedElement = null;
|
141
|
+
let startContainer = null;
|
142
|
+
|
143
|
+
document.querySelectorAll('.pb_draggable_item').forEach(function(item) {
|
144
|
+
item.addEventListener('dragstart', function(event) {
|
145
|
+
draggedElement = event.target;
|
146
|
+
startContainer = draggedElement.closest('.pb_draggable_container');
|
147
|
+
});
|
148
|
+
});
|
149
|
+
|
150
|
+
document.querySelectorAll('.pb_draggable_container').forEach(function(container) {
|
151
|
+
container.addEventListener('drop', function(event) {
|
152
|
+
event.preventDefault();
|
153
|
+
|
154
|
+
if (draggedElement) {
|
155
|
+
setTimeout(function() {
|
156
|
+
const currentContainer = container;
|
157
|
+
|
158
|
+
if (currentContainer && startContainer && currentContainer !== startContainer) {
|
159
|
+
const containerData = currentContainer.getAttribute('data-container');
|
160
|
+
const badge = draggedElement.querySelector('[data-pb-status-badge]');
|
161
|
+
|
162
|
+
if (badge && containerData) {
|
163
|
+
const newProperties = updateBadge(containerData);
|
164
|
+
const span = badge.querySelector('span');
|
165
|
+
|
166
|
+
if (span) {
|
167
|
+
span.textContent = newProperties.text;
|
168
|
+
}
|
169
|
+
|
170
|
+
badge.classList.forEach(function(className) {
|
171
|
+
if (className.includes('pb_badge_kit_') || className === 'ml_sm') {
|
172
|
+
badge.classList.remove(className);
|
173
|
+
}
|
174
|
+
});
|
175
|
+
|
176
|
+
badge.className = `pb_badge_kit_${newProperties.variant}_rounded ml_sm`;
|
177
|
+
}
|
178
|
+
}
|
179
|
+
|
180
|
+
draggedElement = null;
|
181
|
+
startContainer = null;
|
182
|
+
}, 50);
|
183
|
+
}
|
184
|
+
});
|
185
|
+
});
|
186
|
+
};
|
187
|
+
|
188
|
+
if (document.readyState === 'loading') {
|
189
|
+
document.addEventListener('DOMContentLoaded', initBadgeUpdates);
|
190
|
+
} else {
|
191
|
+
initBadgeUpdates();
|
192
|
+
}
|
193
|
+
</script>
|
@@ -0,0 +1 @@
|
|
1
|
+
The Draggable kit can also be used to achieve more complex, multiple container functionality as shown here. This complex usage requires the full subcomponent structure.
|