playbook_ui 12.32.0 → 12.33.0.pre.alpha.PLAY905reactionbuttons982

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/index.js +1 -1
  3. data/app/pb_kits/playbook/pb_background/_background.tsx +10 -1
  4. data/app/pb_kits/playbook/pb_background/background.html.erb +2 -1
  5. data/app/pb_kits/playbook/pb_background/background.rb +4 -2
  6. data/app/pb_kits/playbook/pb_body/_body_mixins.scss +1 -0
  7. data/app/pb_kits/playbook/pb_button/_button.scss +33 -0
  8. data/app/pb_kits/playbook/pb_button/_button.tsx +65 -26
  9. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +6 -6
  10. data/app/pb_kits/playbook/pb_button/button.html.erb +13 -0
  11. data/app/pb_kits/playbook/pb_button/button.rb +13 -2
  12. data/app/pb_kits/playbook/pb_button/docs/_button_reaction.html.erb +3 -0
  13. data/app/pb_kits/playbook/pb_button/docs/_button_reaction.jsx +38 -0
  14. data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
  15. data/app/pb_kits/playbook/pb_button/docs/index.js +2 -1
  16. data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +1 -1
  17. data/app/pb_kits/playbook/pb_date/_date.tsx +7 -8
  18. data/app/pb_kits/playbook/pb_date/docs/_date_alignment.jsx +2 -2
  19. data/app/pb_kits/playbook/pb_date/docs/_date_default.jsx +4 -4
  20. data/app/pb_kits/playbook/pb_date/docs/_date_unstyled.jsx +2 -2
  21. data/app/pb_kits/playbook/pb_date/docs/_date_variants.jsx +5 -5
  22. data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.tsx +45 -31
  23. data/app/pb_kits/playbook/pb_date_range_stacked/_date_range_stacked.tsx +5 -3
  24. data/app/pb_kits/playbook/pb_date_stacked/_date_stacked.tsx +24 -21
  25. data/app/pb_kits/playbook/pb_date_time/_date_time.tsx +1 -1
  26. data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +1 -1
  27. data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.tsx +2 -2
  28. data/app/pb_kits/playbook/pb_date_time_stacked/date_time_stacked.test.js +1 -1
  29. data/app/pb_kits/playbook/pb_date_year_stacked/_date_year_stacked.tsx +6 -8
  30. data/app/pb_kits/playbook/pb_dialog/_dialog.scss +321 -316
  31. data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +12 -9
  32. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +8 -8
  33. data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +16 -15
  34. data/app/pb_kits/playbook/pb_icon/_icon.scss +4 -0
  35. data/app/pb_kits/playbook/pb_icon/_icon.tsx +5 -3
  36. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.html.erb +1 -0
  37. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.jsx +21 -0
  38. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.md +7 -0
  39. data/app/pb_kits/playbook/pb_icon/docs/example.yml +2 -0
  40. data/app/pb_kits/playbook/pb_icon/docs/index.js +1 -0
  41. data/app/pb_kits/playbook/pb_icon/icon.html.erb +1 -1
  42. data/app/pb_kits/playbook/pb_icon/icon.rb +1 -1
  43. data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +14 -4
  44. data/app/pb_kits/playbook/pb_icon_circle/icon_circle.rb +1 -1
  45. data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +12 -1
  46. data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.html.erb +6 -0
  47. data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.jsx +9 -0
  48. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.html.erb +16 -12
  49. data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.rb +2 -2
  50. data/app/pb_kits/playbook/pb_kit/dateTime.ts +139 -67
  51. data/app/pb_kits/playbook/pb_label_value/_label_value.tsx +52 -31
  52. data/app/pb_kits/playbook/pb_map/_map.scss +4 -0
  53. data/app/pb_kits/playbook/pb_message/_message.tsx +24 -24
  54. data/app/pb_kits/playbook/pb_time/_time.tsx +9 -11
  55. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +46 -49
  56. data/app/pb_kits/playbook/pb_time_stacked/_time_stacked.tsx +4 -6
  57. data/app/pb_kits/playbook/pb_timestamp/_timestamp.tsx +11 -11
  58. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +8 -11
  59. data/app/pb_kits/playbook/tokens/_colors.scss +4 -2
  60. data/app/pb_kits/playbook/utilities/_border_radius.scss +11 -1
  61. data/app/pb_kits/playbook/utilities/_line_height.scss +1 -2
  62. data/app/pb_kits/playbook/utilities/_shadow.scss +0 -1
  63. data/app/pb_kits/playbook/utilities/globalProps.ts +1 -1
  64. data/dist/playbook-rails.js +7 -7
  65. data/lib/playbook/version.rb +2 -2
  66. metadata +12 -8
  67. data/app/pb_kits/playbook/pb_logistic/_logistic.jsx +0 -120
@@ -181,7 +181,10 @@ const Dialog = (props: DialogProps) => {
181
181
  {title && !status ? <Dialog.Header>{title}</Dialog.Header> : null}
182
182
  {!status && text ? <Dialog.Body>{text}</Dialog.Body> : null}
183
183
  {status && (
184
- <Dialog.Body padding="md">
184
+ <Dialog.Body
185
+ className="dialog_status_text_align"
186
+ padding="md"
187
+ >
185
188
  <Flex align="center" orientation="column">
186
189
  <IconCircle
187
190
  icon={sweetAlertStatus[status].icon}
@@ -197,17 +200,17 @@ const Dialog = (props: DialogProps) => {
197
200
  )}
198
201
  {cancelButton && confirmButton ? (
199
202
  <Dialog.Footer>
200
- <Button
201
- loading={loading}
202
- onClick={onConfirm}
203
- htmlType="button"
203
+ <Button
204
+ loading={loading}
205
+ onClick={onConfirm}
206
+ htmlType="button"
204
207
  variant="primary">
205
208
  {confirmButton}
206
209
  </Button>
207
- <Button
208
- id="cancel-button"
209
- onClick={onCancel}
210
- variant="link"
210
+ <Button
211
+ id="cancel-button"
212
+ onClick={onCancel}
213
+ variant="link"
211
214
  htmlType="button">
212
215
  {cancelButton}
213
216
  </Button>
@@ -5,38 +5,38 @@
5
5
  id: object.id,
6
6
  class: object.classname) do %>
7
7
  <% if object.status === "" && object.title %>
8
- <%= pb_rails("dialog/dialog_header", props: {title: object.title, id: object.id }) %>
8
+ <%= pb_rails("dialog/dialog_header", props: { title: object.title, id: object.id }) %>
9
9
  <% end %>
10
10
  <% if object.status === "" && object.text %>
11
11
  <%= pb_rails("dialog/dialog_body", props: { text: object.text }) %>
12
12
  <% end %>
13
13
  <% if object.status != "" %>
14
- <%= pb_rails("dialog/dialog_body", props: {padding: "md"}) do %>
15
- <%= pb_rails("flex", props: {align: "center", orientation: "column"}) do %>
14
+ <%= pb_rails("dialog/dialog_body", props: { classname: "dialog_status_text_align" ,padding: "md" }) do %>
15
+ <%= pb_rails("flex", props: { align: "center", orientation: "column" }) do %>
16
16
  <%= pb_rails("icon_circle", props: {
17
17
  icon: object.status_alerts[0],
18
18
  variant: object.status_alerts[1],
19
19
  size: "lg"
20
20
  }) %>
21
21
  <%= pb_rails("title", props: { text: object.title, tag: "h1", size: 3, margin_top: "sm" }) %>
22
- <%= pb_rails("body", props: {text: object.text, margin_top: "sm"}) %>
22
+ <%= pb_rails("body", props: { text: object.text, margin_top: "sm" }) %>
23
23
  <% end %>
24
24
  <% end %>
25
25
  <% end %>
26
26
  <% if object.cancel_button && object.confirm_button %>
27
27
  <%= pb_rails("dialog/dialog_footer", props: {
28
- cancel_button: object.cancel_button,
28
+ cancel_button: object.cancel_button,
29
29
  confirm_button: object.confirm_button,
30
30
  id: object.id
31
31
  }) %>
32
32
  <% end %>
33
-
33
+
34
34
  <%= content %>
35
35
  <% end %>
36
36
  </div>
37
37
 
38
38
  <%= javascript_tag do %>
39
- window.addEventListener("DOMContentLoaded", () => {
39
+ window.addEventListener("DOMContentLoaded", () => {
40
40
  dialogHelper()
41
41
  })
42
- <% end %>
42
+ <% end %>
@@ -1,6 +1,7 @@
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")
4
5
 
5
6
  openTrigger.forEach((open) => {
6
7
  open.addEventListener("click", () => {
@@ -8,21 +9,6 @@ const dialogHelper = () => {
8
9
  var targetDialog = document.getElementById(openTriggerData)
9
10
  if (targetDialog.open) return;
10
11
  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
- );
26
12
  });
27
13
  });
28
14
 
@@ -32,6 +18,21 @@ const dialogHelper = () => {
32
18
  document.getElementById(closeTriggerData).close();
33
19
  });
34
20
  });
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
+ })
35
36
  };
36
37
 
37
38
  export default dialogHelper;
@@ -6,3 +6,7 @@ svg.pb_custom_icon {
6
6
  fill: currentColor;
7
7
  }
8
8
  }
9
+
10
+ .pb_icon_kit_emoji {
11
+ font-family: monospace;
12
+ }
@@ -34,7 +34,7 @@ type IconProps = {
34
34
  pulse?: boolean,
35
35
  rotation?: 90 | 180 | 270,
36
36
  size?: IconSizes,
37
- fontStyle?: 'far' | 'fas' | 'fab',
37
+ fontStyle?: 'far' | 'fas' | 'fab' | 'fak',
38
38
  spin?: boolean,
39
39
  } & GlobalProps
40
40
 
@@ -76,6 +76,7 @@ const Icon = (props: IconProps) => {
76
76
  [`fa-${size}`]: size,
77
77
  [`fa-pull-${pull}`]: pull,
78
78
  [`fa-rotate-${rotation}`]: rotation,
79
+
79
80
  }
80
81
 
81
82
  // Lets check and see if the icon prop is referring to a custom Power icon...
@@ -83,7 +84,7 @@ const Icon = (props: IconProps) => {
83
84
  // this ensures the JS will not do any further operations
84
85
  // faClasses[`fa-${icon}`] = customIcon ? 'custom' : icon
85
86
  if (!customIcon) faClasses[`fa-${icon}`] = icon
86
-
87
+
87
88
  const classes = classnames(
88
89
  flipMap[flip],
89
90
  'pb_icon_kit',
@@ -96,7 +97,7 @@ const Icon = (props: IconProps) => {
96
97
  const classesEmoji = classnames(
97
98
  'pb_icon_kit',
98
99
  globalProps(props),
99
- 'icon_circle_emoji',
100
+ 'pb_icon_kit_emoji',
100
101
  className
101
102
  )
102
103
 
@@ -110,6 +111,7 @@ const Icon = (props: IconProps) => {
110
111
  return emojiRegex.test(emoji);
111
112
  };
112
113
 
114
+
113
115
  // Add a conditional here to show only the SVG if custom
114
116
  const displaySVG = (customIcon: any) => {
115
117
  if (customIcon)
@@ -0,0 +1 @@
1
+ <%= pb_rails("icon", props: { icon: "powergon", font_style: "fak", fixed_width: true, size: "5x" }) %>
@@ -0,0 +1,21 @@
1
+ import React from 'react'
2
+
3
+ import Icon from '../_icon'
4
+
5
+ import '../../../../../../playbook-website/app/javascript/scripts/custom-icons'
6
+
7
+ const IconFaKit = (props) => {
8
+ return (
9
+ <div>
10
+ <Icon
11
+ {...props}
12
+ fixedWidth
13
+ fontStyle="fak"
14
+ icon="powergon"
15
+ size="5x"
16
+ />
17
+ </div>
18
+ )
19
+ }
20
+
21
+ export default IconFaKit
@@ -0,0 +1,7 @@
1
+ Our Icon kit allows integration with [FontAwesome's custom kit](https://fontawesome.com/v6/docs/web/setup/use-kit#contentHeader) functionality out-of-the-box.
2
+
3
+ All you need to do is 3 things:
4
+ 1) Import your custom-icon.js file as outlined in the FontAwesome docs.
5
+ 2) Use our fontStyle prop called "fak" so that our Icon component knows you are using a "fa-kit" icon.
6
+ 3) Pass in your FaKit name as a string to our icon prop (This is the name that you designated when you uploaded the icon on their site).
7
+
@@ -8,6 +8,7 @@ examples:
8
8
  - icon_border: Icon Border
9
9
  - icon_sizes: Icon Sizes
10
10
  - icon_custom: Icon Custom
11
+ - icon_fa_kit: Icon with FontAwesome Kit
11
12
 
12
13
  react:
13
14
  - icon_default: Icon Default
@@ -18,3 +19,4 @@ examples:
18
19
  - icon_border: Icon Border
19
20
  - icon_sizes: Icon Sizes
20
21
  - icon_custom: Icon Custom
22
+ - icon_fa_kit: Icon with FontAwesome Kit
@@ -6,3 +6,4 @@ export { default as IconPull } from './_icon_pull.jsx'
6
6
  export { default as IconBorder } from './_icon_border.jsx'
7
7
  export { default as IconSizes } from './_icon_sizes.jsx'
8
8
  export { default as IconCustom } from './_icon_custom.jsx'
9
+ export { default as IconFaKit} from './_icon_fa_kit.jsx'
@@ -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 icon_circle_emoji"><%= object.icon.html_safe %></span>
4
+ <span class="pb_icon_kit pb_icon_kit_emoji"><%= object.icon.html_safe %></span>
5
5
  <% else %>
6
6
  <%= content_tag(:i, nil,
7
7
  id: object.id,
@@ -33,7 +33,7 @@ module Playbook
33
33
  values: ["lg", "xs", "sm", "1x", "2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x", nil],
34
34
  default: nil
35
35
  prop :font_style, type: Playbook::Props::Enum,
36
- values: %w[far fas fab],
36
+ values: %w[far fas fab fak],
37
37
  default: "far"
38
38
  prop :spin, type: Playbook::Props::Boolean,
39
39
  default: false
@@ -22,11 +22,21 @@ type IconCircleProps = {
22
22
  | "teal"
23
23
  | "red"
24
24
  | "yellow"
25
+ | "orange"
25
26
  | "green",
26
27
  }
27
28
 
28
29
  const IconCircle = (props: IconCircleProps) => {
29
- const { aria = {}, className, dark = false, data = {}, icon, id, size = 'md', variant = 'default' } = props
30
+ const {
31
+ aria = {},
32
+ className,
33
+ dark = false,
34
+ data = {},
35
+ icon,
36
+ id,
37
+ size = 'md',
38
+ variant = 'default'
39
+ } = props
30
40
 
31
41
  const ariaProps = buildAriaProps(aria)
32
42
  const dataProps = buildDataProps(data)
@@ -41,10 +51,10 @@ const IconCircle = (props: IconCircleProps) => {
41
51
  id={id}
42
52
  >
43
53
  <Icon
44
- dark={dark}
45
- icon={icon}
54
+ dark={dark}
55
+ icon={icon}
46
56
  />
47
-
57
+
48
58
  </div>
49
59
  )
50
60
  }
@@ -10,7 +10,7 @@ module Playbook
10
10
  values: %w[xs sm md base lg xl],
11
11
  default: "md"
12
12
  prop :variant, type: Playbook::Props::Enum,
13
- values: %w[default royal blue orange purple teal red yellow green],
13
+ values: %w[default royal blue orange purple teal red yellow green orange],
14
14
  default: "default"
15
15
 
16
16
  def classname
@@ -14,6 +14,7 @@ type IconStatValueProps = {
14
14
  aria?: { [key: string]: string },
15
15
  className?: string,
16
16
  data?: object,
17
+ dark?: boolean,
17
18
  icon: string,
18
19
  id?: string,
19
20
  orientation?: "vertical" | "horizontal",
@@ -28,6 +29,7 @@ type IconStatValueProps = {
28
29
  | "teal"
29
30
  | "red"
30
31
  | "yellow"
32
+ | "orange"
31
33
  | "green",
32
34
  }
33
35
 
@@ -36,6 +38,7 @@ const IconStatValue = (props: IconStatValueProps) => {
36
38
  aria = {},
37
39
  className,
38
40
  data = {},
41
+ dark = false,
39
42
  icon,
40
43
  id,
41
44
  orientation = 'horizontal',
@@ -55,6 +58,7 @@ const IconStatValue = (props: IconStatValueProps) => {
55
58
  if (size == 'lg') {
56
59
  return (
57
60
  <Title
61
+ dark={dark}
58
62
  size={1}
59
63
  tag="span"
60
64
  text={`${value}`}
@@ -63,6 +67,7 @@ const IconStatValue = (props: IconStatValueProps) => {
63
67
  } else if (size == 'md') {
64
68
  return (
65
69
  <Title
70
+ dark={dark}
66
71
  size={2}
67
72
  tag="span"
68
73
  text={`${value}`}
@@ -71,6 +76,7 @@ const IconStatValue = (props: IconStatValueProps) => {
71
76
  } else {
72
77
  return (
73
78
  <Title
79
+ dark={dark}
74
80
  size={3}
75
81
  tag="span"
76
82
  text={`${value}`}
@@ -87,6 +93,7 @@ const IconStatValue = (props: IconStatValueProps) => {
87
93
  id={id}
88
94
  >
89
95
  <IconCircle
96
+ dark={dark}
90
97
  icon={icon}
91
98
  size={size}
92
99
  variant={variant}
@@ -99,10 +106,14 @@ const IconStatValue = (props: IconStatValueProps) => {
99
106
  {titleSize(size)}
100
107
  &nbsp;
101
108
  <Body
109
+ dark={dark}
102
110
  text={unit}
103
111
  />
104
112
  </Flex>
105
- <Caption text={text} />
113
+ <Caption
114
+ dark={dark}
115
+ text={text}
116
+ />
106
117
  </div>
107
118
 
108
119
  </div>
@@ -46,4 +46,10 @@
46
46
  unit: "AU",
47
47
  value: 19.18,
48
48
  variant:"green"
49
+ }) %>
50
+ <%= pb_rails("icon_stat_value", props: { icon: "globe",
51
+ text: "Uranus",
52
+ unit: "AU",
53
+ value: 19.18,
54
+ variant:"orange"
49
55
  }) %>
@@ -66,6 +66,15 @@ const IconStatValueColor = (props) => {
66
66
  variant="green"
67
67
  {...props}
68
68
  />
69
+ <br />
70
+ <IconStatValue
71
+ icon="globe"
72
+ text="Uranus"
73
+ unit="AU"
74
+ value={19.18}
75
+ variant="orange"
76
+ {...props}
77
+ />
69
78
  </div>
70
79
 
71
80
  )
@@ -4,22 +4,26 @@
4
4
  data: object.data,
5
5
  class: object.classname) do %>
6
6
 
7
- <%= pb_rails "icon_circle", props: {
8
- icon: object.icon,
9
- size: object.size,
10
- variant: object.variant } %>
7
+ <%= pb_rails("icon_circle", props: {
8
+ dark: object.dark,
9
+ icon: object.icon,
10
+ size: object.size,
11
+ variant: object.variant }) %>
11
12
 
12
- <div>
13
+ <div>
13
14
  <%= pb_rails("flex", props: { align: "baseline" }) do %>
14
- <%= pb_rails "title", props: {
15
+ <%= pb_rails("title", props: {
16
+ dark: object.dark,
15
17
  tag: "span",
16
18
  text: object.value_string,
17
- size: object.title_size } %>
19
+ size: object.title_size }) %>
18
20
  &nbsp;
19
- <%= pb_rails "body", props: {
20
- text: object.unit } %>
21
+ <%= pb_rails("body", props: {
22
+ dark: object.dark,
23
+ text: object.unit }) %>
21
24
  <% end %>
22
- <%= pb_rails "caption", props: {
23
- text: object.text } %>
24
- </div>
25
+ <%= pb_rails("caption", props: {
26
+ dark: object.dark,
27
+ text: object.text }) %>
28
+ </div>
25
29
  <% end %>
@@ -9,7 +9,7 @@ module Playbook
9
9
  values: %w[sm md lg],
10
10
  default: "sm"
11
11
  prop :variant, type: Playbook::Props::Enum,
12
- values: %w[default royal blue purple teal red yellow green],
12
+ values: %w[default royal blue purple teal red yellow green orange],
13
13
  default: "default"
14
14
 
15
15
  prop :orientation, type: Playbook::Props::Enum,
@@ -22,7 +22,7 @@ module Playbook
22
22
  prop :text, type: Playbook::Props::String,
23
23
  default: ""
24
24
 
25
- prop :value, type: Playbook::Props::Numeric
25
+ prop :value
26
26
 
27
27
  def classname
28
28
  generate_classname("pb_icon_stat_value_kit", orientation, size, variant)