playbook_ui 12.33.0.pre.alpha.PLAY905reactionbuttons982 → 12.33.0.pre.alpha.revert2650closedialogonoutsideclick977
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_button/_button.scss +0 -33
- data/app/pb_kits/playbook/pb_button/_button.tsx +26 -65
- data/app/pb_kits/playbook/pb_button/button.html.erb +0 -13
- data/app/pb_kits/playbook/pb_button/button.rb +2 -13
- data/app/pb_kits/playbook/pb_button/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_button/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +15 -16
- data/app/pb_kits/playbook/pb_icon/_icon.scss +0 -4
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon/icon.html.erb +1 -1
- data/dist/playbook-rails.js +4 -4
- data/lib/playbook/version.rb +1 -1
- metadata +2 -4
- data/app/pb_kits/playbook/pb_button/docs/_button_reaction.html.erb +0 -3
- data/app/pb_kits/playbook/pb_button/docs/_button_reaction.jsx +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8917e68b216bfff0e401e966630a13207a1a47fe8b37c1440c39913b0051411
|
4
|
+
data.tar.gz: ed70e1f405f8df66f5653b199edbd0f5f454740d08ad6f76e6326a7a45307c06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3893e3784acf3a18098ae34ae4c2974422f27b214cc440da543be340ba8cdb87a189dfc380bd2106e389284fbf6b179c8224f87ce9c023fc3957e7662a9d6fac
|
7
|
+
data.tar.gz: 643a46fb715b5c0f990c641991670ed74c0eee64bf0a191e2a7a20a1021307ea9caa6151f91f94657642ebc1c8a8968802cc741492d368d2d6c21fc30dcffe43
|
@@ -1,9 +1,5 @@
|
|
1
1
|
@import "./button_mixins";
|
2
2
|
@import "../tokens/colors";
|
3
|
-
@import "../tokens/border_radius";
|
4
|
-
@import "../tokens/colors";
|
5
|
-
@import "../tokens/spacing";
|
6
|
-
@import "../tokens/typography";
|
7
3
|
|
8
4
|
$pb_button_sizes: (
|
9
5
|
"sm": 0.75rem,
|
@@ -34,35 +30,6 @@ $pb_button_sizes: (
|
|
34
30
|
&[class*=_link] {
|
35
31
|
@include pb_button_link;
|
36
32
|
}
|
37
|
-
&[class*=_reaction] {
|
38
|
-
background-color: $card_light;
|
39
|
-
min-width: 40px;
|
40
|
-
border-radius: $border_radius_rounded;
|
41
|
-
border: 1px solid $border_light;
|
42
|
-
color: $text_lt_light;
|
43
|
-
padding: ($space_xxs - 2) $space_xs;
|
44
|
-
min-height: $space_md + 4;
|
45
|
-
|
46
|
-
.pb_icon_kit_emoji {
|
47
|
-
font-size: $font_base;
|
48
|
-
}
|
49
|
-
&:hover {
|
50
|
-
background-color: $bg_light;
|
51
|
-
}
|
52
|
-
&.active {
|
53
|
-
border-color: $primary_action;
|
54
|
-
}
|
55
|
-
}
|
56
|
-
|
57
|
-
&.reaction_default {
|
58
|
-
padding: ($space_xxs + 1) ($space_sm - 4);
|
59
|
-
color: $text_lt_lighter;
|
60
|
-
}
|
61
|
-
|
62
|
-
.reaction_button_icon_wrapper {
|
63
|
-
display: flex;
|
64
|
-
align-items: center;
|
65
|
-
}
|
66
33
|
|
67
34
|
// Disabled =================
|
68
35
|
&[class*=_disabled] {
|
@@ -4,7 +4,6 @@ import { buildAriaProps, buildDataProps } from '../utilities/props'
|
|
4
4
|
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
5
5
|
|
6
6
|
import Icon from '../pb_icon/_icon'
|
7
|
-
import Caption from "../pb_caption/_caption"
|
8
7
|
|
9
8
|
type EventHandler = (React.MouseEventHandler<HTMLElement>)
|
10
9
|
|
@@ -12,13 +11,11 @@ type ButtonPropTypes = {
|
|
12
11
|
aria?: { [key: string]: string },
|
13
12
|
children?: React.ReactChild[] | React.ReactChild,
|
14
13
|
className?: string | string[],
|
15
|
-
count?: number,
|
16
14
|
data?: { [key: string]: string },
|
17
15
|
disabled?: boolean,
|
18
16
|
fixedWidth?: boolean,
|
19
17
|
form?: string,
|
20
18
|
fullWidth?: boolean,
|
21
|
-
highlight?: boolean,
|
22
19
|
icon?: string,
|
23
20
|
iconRight?: boolean,
|
24
21
|
id?: string,
|
@@ -33,7 +30,7 @@ type ButtonPropTypes = {
|
|
33
30
|
type?: 'inline' | null,
|
34
31
|
htmlType?: 'submit' | 'reset' | 'button' | undefined,
|
35
32
|
value?: string | null,
|
36
|
-
variant?: 'primary' | 'secondary' | 'link'
|
33
|
+
variant?: 'primary' | 'secondary' | 'link',
|
37
34
|
wrapperClass?: string,
|
38
35
|
} & GlobalProps
|
39
36
|
|
@@ -41,8 +38,6 @@ const buttonClassName = (props: ButtonPropTypes) => {
|
|
41
38
|
const {
|
42
39
|
disabled = false,
|
43
40
|
fullWidth = false,
|
44
|
-
highlight,
|
45
|
-
icon,
|
46
41
|
loading = false,
|
47
42
|
type = 'inline',
|
48
43
|
variant = 'primary',
|
@@ -57,8 +52,6 @@ const buttonClassName = (props: ButtonPropTypes) => {
|
|
57
52
|
className += disabled ? '_disabled' : '_enabled'
|
58
53
|
className += loading ? '_loading' : ''
|
59
54
|
className += `${size !== null ? ` size_${size}` : ''}`
|
60
|
-
className += `${variant === 'reaction' && !icon ? ` reaction_default` : ''}`
|
61
|
-
className += `${variant === 'reaction' && highlight ? ` active` : ''}`
|
62
55
|
|
63
56
|
return className
|
64
57
|
}
|
@@ -68,7 +61,6 @@ const Button = (props: ButtonPropTypes) => {
|
|
68
61
|
aria = {},
|
69
62
|
children,
|
70
63
|
className,
|
71
|
-
count,
|
72
64
|
data = {},
|
73
65
|
disabled,
|
74
66
|
icon = null,
|
@@ -83,7 +75,6 @@ const Button = (props: ButtonPropTypes) => {
|
|
83
75
|
text,
|
84
76
|
htmlType = 'button',
|
85
77
|
value,
|
86
|
-
variant,
|
87
78
|
form = null
|
88
79
|
} = props
|
89
80
|
|
@@ -140,71 +131,41 @@ const Button = (props: ButtonPropTypes) => {
|
|
140
131
|
return null
|
141
132
|
}
|
142
133
|
|
143
|
-
const displayButton = () => {
|
144
|
-
if (link)
|
134
|
+
const displayButton = () => {
|
135
|
+
if (link)
|
145
136
|
return (
|
146
137
|
<a
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
138
|
+
{...ariaProps}
|
139
|
+
{...dataProps}
|
140
|
+
className={css}
|
141
|
+
href={link}
|
142
|
+
id={id}
|
143
|
+
rel={target !== 'child' ? 'noreferrer' : null}
|
144
|
+
role="link"
|
145
|
+
tabIndex={tabIndex}
|
146
|
+
target={getTargetAttribute()}
|
156
147
|
>
|
157
148
|
{ifLoading()}
|
158
149
|
</a>
|
159
|
-
)
|
160
|
-
|
161
|
-
return (
|
162
|
-
<button
|
163
|
-
{...ariaProps}
|
164
|
-
{...dataProps}
|
165
|
-
className={css}
|
166
|
-
disabled={disabled}
|
167
|
-
form={form}
|
168
|
-
id={id}
|
169
|
-
onClick={onClick}
|
170
|
-
role="button"
|
171
|
-
tabIndex={tabIndex}
|
172
|
-
type={htmlType}
|
173
|
-
value={value}
|
174
|
-
>
|
175
|
-
{icon ? (
|
176
|
-
<div className='reaction_button_icon_wrapper'>
|
177
|
-
<Icon icon={icon} />
|
178
|
-
{count && (
|
179
|
-
<Caption paddingLeft="xxs" size="xs">
|
180
|
-
{count}
|
181
|
-
</Caption>
|
182
|
-
)}
|
183
|
-
</div>
|
184
|
-
) : (
|
185
|
-
<Icon icon="face-smile-plus" />
|
186
|
-
)}
|
187
|
-
</button>
|
188
|
-
);
|
189
|
-
} else {
|
150
|
+
)
|
151
|
+
else
|
190
152
|
return (
|
191
153
|
<button
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
154
|
+
{...ariaProps}
|
155
|
+
{...dataProps}
|
156
|
+
className={css}
|
157
|
+
disabled={disabled}
|
158
|
+
form={form}
|
159
|
+
id={id}
|
160
|
+
onClick={onClick}
|
161
|
+
role="button"
|
162
|
+
tabIndex={tabIndex}
|
163
|
+
type={htmlType}
|
164
|
+
value={value}
|
203
165
|
>
|
204
166
|
{ifLoading()}
|
205
167
|
</button>
|
206
|
-
)
|
207
|
-
}
|
168
|
+
)
|
208
169
|
}
|
209
170
|
|
210
171
|
return (
|
@@ -1,17 +1,5 @@
|
|
1
1
|
<%= content_tag(object.tag,
|
2
2
|
object.tag == "button" ? object.options : object.link_options) do %>
|
3
|
-
<% if object.variant === "reaction" %>
|
4
|
-
<% if object.icon %>
|
5
|
-
<div class="reaction_button_icon_wrapper">
|
6
|
-
<%= pb_rails("icon", props: { icon: "#{icon}"}) %>
|
7
|
-
<% if object.count %>
|
8
|
-
<%= pb_rails("caption", props: { text: "#{count}", size: "xs", padding_left:"xxs" }) %>
|
9
|
-
<% end %>
|
10
|
-
</div>
|
11
|
-
<% else %>
|
12
|
-
<%= pb_rails("icon", props: { icon: "face-smile-plus" }) %>
|
13
|
-
<% end %>
|
14
|
-
<% else %>
|
15
3
|
<% if object.icon && !object.icon_right %>
|
16
4
|
<span>
|
17
5
|
<%= pb_rails("icon", props: { icon: "#{icon}", fixed_width: true, margin_right: "xs" }) %>
|
@@ -24,6 +12,5 @@
|
|
24
12
|
<%= pb_rails("icon", props: { icon: "#{icon}", fixed_width: true, margin_left: "xs" }) %>
|
25
13
|
</span>
|
26
14
|
<% end %>
|
27
|
-
<% end %>
|
28
15
|
|
29
16
|
<% end %>
|
@@ -16,11 +16,8 @@ module Playbook
|
|
16
16
|
prop :new_window, type: Playbook::Props::Boolean,
|
17
17
|
default: false
|
18
18
|
prop :variant, type: Playbook::Props::Enum,
|
19
|
-
values: %w[primary secondary link
|
19
|
+
values: %w[primary secondary link],
|
20
20
|
default: "primary"
|
21
|
-
prop :count, type: Playbook::Props::Number
|
22
|
-
prop :highlight, type: Playbook::Props::Boolean,
|
23
|
-
default: false
|
24
21
|
prop :target
|
25
22
|
prop :text
|
26
23
|
prop :type
|
@@ -68,7 +65,7 @@ module Playbook
|
|
68
65
|
|
69
66
|
def classname
|
70
67
|
button_class = generate_classname("pb_button_kit", variant, full_width_class, disabled_class, loading_class)
|
71
|
-
button_class + size_class
|
68
|
+
button_class + size_class
|
72
69
|
end
|
73
70
|
|
74
71
|
private
|
@@ -88,14 +85,6 @@ module Playbook
|
|
88
85
|
def size_class
|
89
86
|
size ? " size_#{size}" : ""
|
90
87
|
end
|
91
|
-
|
92
|
-
def default_reaction_class
|
93
|
-
variant === "reaction" && !object.icon ? " reaction_default" : ""
|
94
|
-
end
|
95
|
-
|
96
|
-
def highlight_active
|
97
|
-
variant === "reaction" && object.highlight ? " active" : ""
|
98
|
-
end
|
99
88
|
end
|
100
89
|
end
|
101
90
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
examples:
|
2
2
|
rails:
|
3
3
|
- button_default: Button Variants
|
4
|
-
- button_reaction: Reaction Button
|
5
4
|
- button_full_width: Button Full Width
|
6
5
|
- button_link: Button Links
|
7
6
|
- button_loading: Button Loading
|
@@ -14,7 +13,6 @@ examples:
|
|
14
13
|
|
15
14
|
react:
|
16
15
|
- button_default: Button Variants
|
17
|
-
- button_reaction: Reaction Button
|
18
16
|
- button_full_width: Button Full Width
|
19
17
|
- button_link: Button Links
|
20
18
|
- button_loading: Button Loading
|
@@ -8,5 +8,4 @@ export { default as ButtonAccessibility } from './_button_accessibility.jsx'
|
|
8
8
|
export { default as ButtonOptions } from './_button_options.jsx'
|
9
9
|
export { default as ButtonSize } from './_button_size.jsx'
|
10
10
|
export { default as ButtonForm } from './_button_form.jsx'
|
11
|
-
export { default as ButtonHover } from './_button_hover.jsx'
|
12
|
-
export {default as ButtonReaction } from './_button_reaction.jsx'
|
11
|
+
export { default as ButtonHover } from './_button_hover.jsx'
|
@@ -1,7 +1,6 @@
|
|
1
1
|
const dialogHelper = () => {
|
2
2
|
const openTrigger = document.querySelectorAll("[data-open-dialog]");
|
3
3
|
const closeTrigger = document.querySelectorAll("[data-close-dialog]");
|
4
|
-
const dialogs = document.querySelectorAll(".pb_dialog_rails")
|
5
4
|
|
6
5
|
openTrigger.forEach((open) => {
|
7
6
|
open.addEventListener("click", () => {
|
@@ -9,6 +8,21 @@ const dialogHelper = () => {
|
|
9
8
|
var targetDialog = document.getElementById(openTriggerData)
|
10
9
|
if (targetDialog.open) return;
|
11
10
|
targetDialog.showModal();
|
11
|
+
|
12
|
+
//the following allows you to close dialog by clicking on overlay
|
13
|
+
targetDialog.addEventListener('click',((event) => {
|
14
|
+
var dialogContainerData = targetDialog.parentElement.dataset
|
15
|
+
if (dialogContainerData.overlayClick === "overlay_close") return;
|
16
|
+
let rect = event.target.getBoundingClientRect();
|
17
|
+
if (rect.left > event.clientX ||
|
18
|
+
rect.right < event.clientX ||
|
19
|
+
rect.top > event.clientY ||
|
20
|
+
rect.bottom < event.clientY
|
21
|
+
) {
|
22
|
+
targetDialog.close();
|
23
|
+
}
|
24
|
+
})
|
25
|
+
);
|
12
26
|
});
|
13
27
|
});
|
14
28
|
|
@@ -18,21 +32,6 @@ const dialogHelper = () => {
|
|
18
32
|
document.getElementById(closeTriggerData).close();
|
19
33
|
});
|
20
34
|
});
|
21
|
-
|
22
|
-
// Close dialog box on outside click
|
23
|
-
dialogs.forEach((dialogElement) => {
|
24
|
-
dialogElement.addEventListener("click", (event) => {
|
25
|
-
const dialogParentDataset = dialogElement.parentElement.dataset
|
26
|
-
if (dialogParentDataset.overlayClick === "overlay_close") return
|
27
|
-
|
28
|
-
const clickedOutsideDialogBox = event.target.classList.contains("pb_dialog_rails")
|
29
|
-
|
30
|
-
if (clickedOutsideDialogBox) {
|
31
|
-
dialogElement.close()
|
32
|
-
event.stopPropagation()
|
33
|
-
}
|
34
|
-
})
|
35
|
-
})
|
36
35
|
};
|
37
36
|
|
38
37
|
export default dialogHelper;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if object.custom_icon %>
|
2
2
|
<%= object.render_svg(object.custom_icon) %>
|
3
3
|
<% elsif object.valid_emoji(object.icon) %>
|
4
|
-
<span class="pb_icon_kit
|
4
|
+
<span class="pb_icon_kit icon_circle_emoji"><%= object.icon.html_safe %></span>
|
5
5
|
<% else %>
|
6
6
|
<%= content_tag(:i, nil,
|
7
7
|
id: object.id,
|