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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1fd71976adcfbabb8b7a108f0326372d2c70f9d24aa30513d910d0d75b0650af
4
- data.tar.gz: 21bb963c6fde24088756eda0f4956ecf7f5b6b282672f550e75119c2c800ca9f
3
+ metadata.gz: d8917e68b216bfff0e401e966630a13207a1a47fe8b37c1440c39913b0051411
4
+ data.tar.gz: ed70e1f405f8df66f5653b199edbd0f5f454740d08ad6f76e6326a7a45307c06
5
5
  SHA512:
6
- metadata.gz: 765a5788bf0369821d38ab5177f5f9e8e741aabdb481ae35cd8a050b1386298e64cd361fe2f05b2cec6099c67ed50994fb0fb588e899294fbc02188b867937b4
7
- data.tar.gz: 37d75b39bbe133a7ff892dac5c7e520e6021cb8fd215df87b4ed05fca74535ef05507f49258aa7a3d16a6c617629b53a00bca2ad89beeb823ff9d361bab94af1
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'| 'reaction',
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
- {...ariaProps}
148
- {...dataProps}
149
- className={css}
150
- href={link}
151
- id={id}
152
- rel={target !== "child" ? "noreferrer" : null}
153
- role="link"
154
- tabIndex={tabIndex}
155
- target={getTargetAttribute()}
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
- } else if (variant === "reaction") {
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
- {...ariaProps}
193
- {...dataProps}
194
- className={css}
195
- disabled={disabled}
196
- form={form}
197
- id={id}
198
- onClick={onClick}
199
- role="button"
200
- tabIndex={tabIndex}
201
- type={htmlType}
202
- value={value}
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 reaction],
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 + default_reaction_class + highlight_active
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;
@@ -6,7 +6,3 @@ svg.pb_custom_icon {
6
6
  fill: currentColor;
7
7
  }
8
8
  }
9
-
10
- .pb_icon_kit_emoji {
11
- font-family: monospace;
12
- }
@@ -97,7 +97,7 @@ const Icon = (props: IconProps) => {
97
97
  const classesEmoji = classnames(
98
98
  'pb_icon_kit',
99
99
  globalProps(props),
100
- 'pb_icon_kit_emoji',
100
+ 'icon_circle_emoji',
101
101
  className
102
102
  )
103
103
 
@@ -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 pb_icon_kit_emoji"><%= object.icon.html_safe %></span>
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,