playbook_ui 13.32.0.pre.alpha.play1416movealiaslogic3266 → 13.33.0.pre.alpha.PLAY1454formpillicons3309

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.md +4 -0
  3. data/app/pb_kits/playbook/pb_collapsible/__snapshots__/collapsible.test.js.snap +1 -1
  4. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +12 -7
  5. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.html.erb +10 -0
  6. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection.jsx +31 -0
  7. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.html.erb +10 -0
  8. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default_value.jsx +31 -0
  9. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +4 -0
  10. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +3 -1
  11. data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +4 -4
  12. data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +11 -0
  13. data/app/pb_kits/playbook/pb_dropdown/dropdown_trigger.rb +1 -1
  14. data/app/pb_kits/playbook/pb_dropdown/index.js +54 -3
  15. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +112 -5
  16. data/app/pb_kits/playbook/pb_form_pill/_form_pill.test.jsx +64 -0
  17. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +62 -18
  18. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_example.html.erb +5 -1
  19. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_example.jsx +1 -0
  20. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_icon.html.erb +5 -0
  21. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_icon.jsx +19 -0
  22. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_size.html.erb +2 -0
  23. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_size.jsx +2 -0
  24. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_tag.html.erb +4 -1
  25. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_tag.jsx +3 -2
  26. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_user.html.erb +2 -0
  27. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_user.jsx +2 -0
  28. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -1
  29. data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -1
  30. data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +17 -10
  31. data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +10 -1
  32. data/app/pb_kits/playbook/pb_icon/_icon.scss +210 -1
  33. data/app/pb_kits/playbook/pb_icon/_icon.tsx +97 -7
  34. data/app/pb_kits/playbook/pb_icon/icon.rb +22 -16
  35. data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +2 -2
  36. data/app/pb_kits/playbook/pb_nav/docs/_tab_nav.html.erb +48 -0
  37. data/app/pb_kits/playbook/pb_nav/docs/_tab_nav.md +3 -0
  38. data/app/pb_kits/playbook/pb_nav/docs/example.yml +1 -0
  39. data/app/pb_kits/playbook/pb_nav/index.js +43 -0
  40. data/app/pb_kits/playbook/pb_nav/nav.rb +9 -0
  41. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx +1 -1
  42. data/app/pb_kits/playbook/pb_rich_text_editor/TipTap/ToolbarDropdown.tsx +1 -1
  43. data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +11 -2
  44. data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_interactive.html.erb +1 -0
  45. data/app/pb_kits/playbook/pb_star_rating/docs/example.yml +1 -1
  46. data/app/pb_kits/playbook/pb_star_rating/index.js +50 -0
  47. data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +25 -5
  48. data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +6 -0
  49. data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
  50. data/app/pb_kits/playbook/pb_table/index.ts +4 -4
  51. data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +1 -1
  52. data/app/pb_kits/playbook/pb_table/subcomponents/_table_cell.tsx +1 -1
  53. data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +1 -1
  54. data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +1 -1
  55. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -1
  56. data/app/pb_kits/playbook/pb_table/table.test.js +2 -0
  57. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
  58. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
  59. data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +45 -27
  60. data/app/pb_kits/playbook/pb_textarea/index.tsx +3 -3
  61. data/app/pb_kits/playbook/pb_time/_time.tsx +3 -3
  62. data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
  63. data/app/pb_kits/playbook/pb_timeline/_item.tsx +1 -1
  64. data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
  65. data/app/pb_kits/playbook/pb_title_detail/_title_detail.tsx +10 -10
  66. data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
  67. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +2 -2
  68. data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +1 -2
  69. data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +2 -0
  70. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +3 -3
  71. data/app/pb_kits/playbook/pb_typeahead/components/ClearIndicator.tsx +4 -4
  72. data/app/pb_kits/playbook/pb_typeahead/components/Control.tsx +11 -7
  73. data/app/pb_kits/playbook/pb_typeahead/components/IndicatorsContainer.tsx +8 -3
  74. data/app/pb_kits/playbook/pb_typeahead/components/MenuList.tsx +6 -1
  75. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +18 -19
  76. data/app/pb_kits/playbook/pb_typeahead/components/Option.tsx +6 -6
  77. data/app/pb_kits/playbook/pb_typeahead/components/Placeholder.tsx +6 -6
  78. data/app/pb_kits/playbook/pb_typeahead/components/ValueContainer.tsx +3 -3
  79. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_custom_menu_list.jsx +2 -0
  80. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_default.html.erb +22 -57
  81. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async.jsx +2 -2
  82. data/app/pb_kits/playbook/pb_typeahead/index.ts +31 -31
  83. data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
  84. data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +6 -6
  85. data/app/pb_kits/playbook/pb_user_badge/badges/million-dollar.tsx +236 -235
  86. data/app/pb_kits/playbook/pb_user_badge/badges/veteran.tsx +1 -1
  87. data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +68 -63
  88. data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +2 -2
  89. data/app/pb_kits/playbook/playbook-rails.js +6 -0
  90. data/dist/playbook-rails.js +5 -5
  91. data/lib/playbook/forms/builder/star_rating_field.rb +14 -0
  92. data/lib/playbook/forms/builder.rb +1 -0
  93. data/lib/playbook/version.rb +2 -2
  94. metadata +15 -2
@@ -5,7 +5,7 @@ import Title from '../pb_title/_title'
5
5
  import Icon from '../pb_icon/_icon'
6
6
  import Avatar from '../pb_avatar/_avatar'
7
7
  import { globalProps, GlobalProps } from '../utilities/globalProps'
8
- import { buildHtmlProps } from '../utilities/props'
8
+ import { buildDataProps, buildHtmlProps } from '../utilities/props'
9
9
 
10
10
  type FormPillProps = {
11
11
  className?: string,
@@ -18,6 +18,10 @@ type FormPillProps = {
18
18
  avatarUrl?: string,
19
19
  size?: string,
20
20
  textTransform?: 'none' | 'lowercase',
21
+ color?: "primary" | "neutral",
22
+ data?: {[key: string]: string},
23
+ tabIndex?: number,
24
+ icon?: string,
21
25
  closeProps?: {
22
26
  onClick?: React.MouseEventHandler<HTMLSpanElement>,
23
27
  onMouseDown?: React.MouseEventHandler<HTMLSpanElement>,
@@ -36,45 +40,85 @@ const FormPill = (props: FormPillProps): React.ReactElement => {
36
40
  closeProps = {},
37
41
  size = '',
38
42
  textTransform = 'none',
43
+ color = "primary",
44
+ data = {},
45
+ tabIndex,
46
+ icon = "",
39
47
  } = props
48
+
49
+ const iconClass = icon ? "_icon" : ""
40
50
  const css = classnames(
41
- `pb_form_pill_kit_${'primary'}`,
51
+ `pb_form_pill_kit_${color}${iconClass}`,
42
52
  globalProps(props),
43
53
  className,
44
54
  size === 'small' ? 'small' : null,
45
55
  textTransform,
46
56
  )
47
57
 
58
+ const dataProps = buildDataProps(data)
48
59
  const htmlProps = buildHtmlProps(htmlOptions)
49
60
 
50
61
  return (
51
62
  <div className={css}
52
63
  id={id}
64
+ tabIndex={tabIndex}
65
+ {...dataProps}
53
66
  {...htmlProps}
54
67
  >
55
- {name &&
68
+ {((name && !icon && !text) || (name && !icon && text)) && (
56
69
  <>
57
- <Avatar
58
- imageUrl={avatarUrl}
59
- name={name}
60
- size="xs"
61
- status={null}
62
- />
63
- <Title
64
- className="pb_form_pill_text"
65
- size={4}
66
- text={name}
67
- />
70
+ <Avatar
71
+ imageUrl={avatarUrl}
72
+ name={name}
73
+ size="xs"
74
+ status={null}
75
+ />
76
+ <Title
77
+ className="pb_form_pill_text"
78
+ size={4}
79
+ text={name}
80
+ />
68
81
  </>
69
- }
70
-
71
- {text &&
82
+ )}
83
+ {((name && icon && !text) || (name && icon && text)) && (
84
+ <>
85
+ <Avatar
86
+ imageUrl={avatarUrl}
87
+ name={name}
88
+ size="xs"
89
+ status={null}
90
+ />
91
+ <Title
92
+ className="pb_form_pill_text"
93
+ size={4}
94
+ text={name}
95
+ />
96
+ <Icon
97
+ className="pb_form_pill_icon"
98
+ icon={icon}
99
+ />
100
+ </>
101
+ )}
102
+ {(!name && icon && text) && (
103
+ <>
104
+ <Icon
105
+ className="pb_form_pill_icon"
106
+ icon={icon}
107
+ />
108
+ <Title
109
+ className="pb_form_pill_tag"
110
+ size={4}
111
+ text={text}
112
+ />
113
+ </>
114
+ )}
115
+ {(!name && !icon && text) && (
72
116
  <Title
73
117
  className="pb_form_pill_tag"
74
118
  size={4}
75
119
  text={text}
76
120
  />
77
- }
121
+ )}
78
122
  <div
79
123
  className="pb_form_pill_close"
80
124
  onClick={onClick}
@@ -1 +1,5 @@
1
- <%= pb_rails("form_pill", props: { text_transform: "lowercase" , text: "THIS IS A TAG" }) %>
1
+ <%= pb_rails("form_pill", props: {
2
+ text_transform: "lowercase" ,
3
+ text: "THIS IS A TAG",
4
+ tabindex: 0,
5
+ }) %>
@@ -6,6 +6,7 @@ const FormPillExample = (props) => {
6
6
  <div>
7
7
  <FormPill
8
8
  onClick={() => alert('Click!')}
9
+ tabIndex={0}
9
10
  text="THIS IS A TAG"
10
11
  textTransform="lowercase"
11
12
  {...props}
@@ -0,0 +1,5 @@
1
+ <%= pb_rails("form_pill", props: {
2
+ icon: "badge-check",
3
+ text: "icon and tag",
4
+ tabindex: 0,
5
+ }) %>
@@ -0,0 +1,19 @@
1
+ import React from 'react'
2
+ import FormPill from '../_form_pill'
3
+
4
+ const FormPillIcon = (props) => {
5
+ return (
6
+ <div>
7
+ <FormPill
8
+ icon="badge-check"
9
+ onClick={() => {
10
+ alert('Click!')
11
+ }}
12
+ tabIndex={0}
13
+ text="icon and tag"
14
+ {...props}
15
+ />
16
+ </div>
17
+ )
18
+ }
19
+ export default FormPillIcon
@@ -2,6 +2,7 @@
2
2
  name: "Anna Black",
3
3
  avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
4
4
  size: "small",
5
+ tabindex: 0,
5
6
  }) %>
6
7
 
7
8
  <br />
@@ -10,4 +11,5 @@
10
11
  <%= pb_rails("form_pill", props: {
11
12
  name: "Anna Black",
12
13
  size: "small",
14
+ tabindex: 0,
13
15
  }) %>
@@ -9,6 +9,7 @@ const FormPillSize = (props) => {
9
9
  avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
10
10
  name="Anna Black"
11
11
  size="small"
12
+ tabIndex={0}
12
13
  {...props}
13
14
  />
14
15
  <br />
@@ -16,6 +17,7 @@ const FormPillSize = (props) => {
16
17
  <FormPill
17
18
  name="Anna Black"
18
19
  size="small"
20
+ tabIndex={0}
19
21
  {...props}
20
22
  />
21
23
  </div>
@@ -1 +1,4 @@
1
- <%= pb_rails("form_pill", props: { text: "this is a tag" }) %>
1
+ <%= pb_rails("form_pill", props: {
2
+ text: "this is a tag",
3
+ tabindex: 0,
4
+ }) %>
@@ -6,8 +6,9 @@ const FormPillDefault = (props) => {
6
6
  <div>
7
7
  <FormPill
8
8
  onClick={() => {
9
- alert('Click!')
10
- }}
9
+ alert('Click!')
10
+ }}
11
+ tabIndex={0}
11
12
  text="this is a tag"
12
13
  {...props}
13
14
  />
@@ -1,6 +1,7 @@
1
1
  <%= pb_rails("form_pill", props: {
2
2
  name: "Anna Black",
3
3
  avatar_url: "https://randomuser.me/api/portraits/women/44.jpg",
4
+ tabindex: 0,
4
5
  }) %>
5
6
 
6
7
  <br />
@@ -8,4 +9,5 @@
8
9
 
9
10
  <%= pb_rails("form_pill", props: {
10
11
  name: "Anna Black",
12
+ tabindex: 0,
11
13
  }) %>
@@ -9,6 +9,7 @@ const FormPillDefault = (props) => {
9
9
  avatarUrl="https://randomuser.me/api/portraits/women/44.jpg"
10
10
  name="Anna Black"
11
11
  onClick={() => alert('Click!')}
12
+ tabIndex={0}
12
13
  {...props}
13
14
  />
14
15
  <br />
@@ -16,6 +17,7 @@ const FormPillDefault = (props) => {
16
17
  <FormPill
17
18
  name="Anna Black"
18
19
  onClick={() => alert('Click!')}
20
+ tabIndex={0}
19
21
  {...props}
20
22
  />
21
23
  </div>
@@ -5,10 +5,11 @@ examples:
5
5
  - form_pill_size: Form Pill Size
6
6
  - form_pill_tag: Form Pill Tag
7
7
  - form_pill_example: Example
8
-
8
+ - form_pill_icon: Form Pill Icon
9
9
 
10
10
  react:
11
11
  - form_pill_user: Form Pill User
12
12
  - form_pill_size: Form Pill Size
13
13
  - form_pill_tag: Form Pill Tag
14
14
  - form_pill_example: Example
15
+ - form_pill_icon: Form Pill Icon
@@ -2,4 +2,4 @@ export { default as FormPillUser } from './_form_pill_user.jsx'
2
2
  export { default as FormPillSize } from './_form_pill_size.jsx'
3
3
  export { default as FormPillTag } from './_form_pill_tag.jsx'
4
4
  export { default as FormPillExample } from './_form_pill_example.jsx'
5
-
5
+ export { default as FormPillIcon } from './_form_pill_icon.jsx'
@@ -1,12 +1,19 @@
1
- <%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, **combined_html_options) do %>
1
+ <%= content_tag(:div, id: object.id, data: object.data, class: object.classname + object.size_class, tabindex: object.tabindex, **combined_html_options) do %>
2
2
  <% if object.name.present? %>
3
3
  <%= pb_rails("avatar", props: { name: object.name, image_url: object.avatar_url, size: "xs" }) %>
4
- <%= pb_rails("title", props: { text: object.name, size: 4, classname: "pb_form_pill_text" }) %>
5
- <% elsif object.text.present? %>
6
- <%= pb_rails("title", props: { text: object.text, size: 4, classname: "pb_form_pill_tag" }) %>
7
- <% end %>
8
-
9
- <%= pb_rails("body", props: { classname: "pb_form_pill_close" }) do %>
10
- <%= pb_rails("icon", props: { icon: 'times' , fixed_width: true }) %>
11
- <% end %>
12
- <% end %>
4
+ <%= pb_rails("title", props: { text: object.name, size: 4, classname: "pb_form_pill_text" }) %>
5
+ <% if object.icon.present? %>
6
+ <%= pb_rails("icon", props: { classname: "pb_form_pill_icon", icon: object.icon }) %>
7
+ <% end %>
8
+ <% elsif object.text.present? %>
9
+ <% if object.icon.present? %>
10
+ <%= pb_rails("icon", props: { classname: "pb_form_pill_icon", icon: object.icon }) %>
11
+ <% end %>
12
+ <% if object.text.present? %>
13
+ <%= pb_rails("title", props: { text: object.text, size: 4, classname: "pb_form_pill_tag" }) %>
14
+ <% end %>
15
+ <% end %>
16
+ <%= pb_rails("body", props: { classname: "pb_form_pill_close" }) do %>
17
+ <%= pb_rails("icon", props: { icon: 'times' , fixed_width: true }) %>
18
+ <% end %>
19
+ <% end %>
@@ -11,9 +11,14 @@ module Playbook
11
11
  prop :text_transform, type: Playbook::Props::Enum,
12
12
  values: %w[none lowercase],
13
13
  default: "none"
14
+ prop :color, type: Playbook::Props::Enum,
15
+ values: %w[primary neutral],
16
+ default: "primary"
17
+ prop :tabindex
18
+ prop :icon
14
19
 
15
20
  def classname
16
- generate_classname("pb_form_pill_kit", "primary", name, text, text_transform)
21
+ generate_classname("pb_form_pill_kit", color, icon_class, name, text, text_transform)
17
22
  end
18
23
 
19
24
  def display_text
@@ -23,6 +28,10 @@ module Playbook
23
28
  def size_class
24
29
  size == "small" ? " small" : ""
25
30
  end
31
+
32
+ def icon_class
33
+ icon ? "icon" : nil
34
+ end
26
35
  end
27
36
  end
28
37
  end
@@ -1,4 +1,3 @@
1
- // Rails custom icon styles
2
1
  svg.pb_custom_icon {
3
2
  width: 1em;
4
3
  fill: currentColor;
@@ -10,3 +9,213 @@ svg.pb_custom_icon {
10
9
  .pb_icon_kit_emoji {
11
10
  font-family: monospace;
12
11
  }
12
+
13
+ $rotate-list: (90, 180, 270);
14
+
15
+ @keyframes pb_icon_spin {
16
+ 0% {
17
+ -webkit-transform: rotate(0);
18
+ transform: rotate(0);
19
+ }
20
+ 100% {
21
+ -webkit-transform: rotate(360deg);
22
+ transform: rotate(360deg);
23
+ }
24
+ };
25
+
26
+ svg {
27
+ &.pb_icon_kit,
28
+ &.pb_custom_icon{
29
+ @each $r in $rotate-list {
30
+ &.rotate_#{$r} {
31
+ transform: rotate(#{$r}deg);
32
+ }
33
+ }
34
+ &.flip_horizontal {
35
+ transform: scaleX(-1);
36
+ }
37
+ &.flip_vertical {
38
+ transform: scaleY(-1);
39
+ }
40
+ &.flip_horizontal.flip_vertical {
41
+ transform: scaleX(-1) scaleY(-1);
42
+ }
43
+ &.svg-inline--fa {
44
+ height: 1em;
45
+ overflow: visible;
46
+ vertical-align: -.125em
47
+ }
48
+ &.svg_inverse {
49
+ color: #fff;
50
+ }
51
+ &.svg_border {
52
+ border-color: #eee;
53
+ border-radius: .1em;
54
+ border-style: solid;
55
+ border-width: .08em;
56
+ padding: .2em .25em .15em;
57
+ }
58
+ &.svg_fw {
59
+ text-align: center;
60
+ width: 1.25em
61
+ }
62
+ &.svg_li {
63
+ left: calc(2em * -1);
64
+ position: absolute;
65
+ text-align: center;
66
+ width: 2em;
67
+ line-height: inherit
68
+ }
69
+ &.pull_left {
70
+ float: left;
71
+ margin-right: .3em;
72
+ }
73
+
74
+ &.pull_right {
75
+ float: right;
76
+ margin-left: .3em;
77
+ }
78
+ &.pulse {
79
+ animation-name: pb_icon_spin;
80
+ animation-direction: normal;
81
+ animation-duration: 1s;
82
+ animation-iteration-count: infinite;
83
+ animation-timing-function: steps(8);
84
+ }
85
+ &.spin {
86
+ animation-name: pb_icon_spin;
87
+ animation-delay: 0s;
88
+ animation-direction: normal;
89
+ animation-duration: 2s;
90
+ animation-iteration-count: infinite;
91
+ animation-timing-function: linear;
92
+ }
93
+
94
+ &.svg_xs {
95
+ font-size: 0.75em
96
+ }
97
+
98
+ &.svg_sm {
99
+ font-size: 0.875em
100
+ }
101
+
102
+ &.svg_lg {
103
+ font-size: 1.25em
104
+ }
105
+
106
+ &.svg_1x {
107
+ font-size: 1em
108
+ }
109
+
110
+ &.svg_2x {
111
+ font-size: 2em
112
+ }
113
+
114
+ &.svg_3x {
115
+ font-size: 3em
116
+ }
117
+
118
+ &.svg_4x {
119
+ font-size: 4em
120
+ }
121
+
122
+ &.svg_5x {
123
+ font-size: 5em
124
+ }
125
+
126
+ &.svg_6x {
127
+ font-size: 6em
128
+ }
129
+
130
+ &.svg_7x {
131
+ font-size: 7em
132
+ }
133
+
134
+ &.svg_8x {
135
+ font-size: 8em
136
+ }
137
+
138
+ &.svg_9x {
139
+ font-size: 9em
140
+ }
141
+
142
+ &.svg_10x {
143
+ font-size: 10em
144
+ }
145
+ &.fa-xs {
146
+ font-size: .75em;
147
+ line-height: .0833333337em;
148
+ vertical-align: .125em
149
+ }
150
+ &.fa-sm {
151
+ font-size: .875em;
152
+ line-height: .0714285718em;
153
+ vertical-align: .0535714295em
154
+ }
155
+ &.fa-lg {
156
+ font-size: 1.25em;
157
+ line-height: .05em;
158
+ vertical-align: -.075em
159
+ }
160
+ &.fa-pull-left {
161
+ float: left;
162
+ margin-right: .3em;
163
+ }
164
+
165
+ &.fa-pull-right {
166
+ float: right;
167
+ margin-left: .3em;
168
+ }
169
+ &.fa-li {
170
+ left: calc(2em * -1);
171
+ position: absolute;
172
+ text-align: center;
173
+ width: 2em;
174
+ line-height: inherit
175
+ }
176
+ &.svg-inline--fa.fa-li {
177
+ width: 2em;
178
+ top: .25em
179
+ }
180
+ &.svg-inline--fa.fa-fw {
181
+ width: 1.25em;
182
+ }
183
+ &.fa-fw {
184
+ text-align: center;
185
+ width: 1.25em
186
+ }
187
+ &.fa-layers {
188
+ display: inline-block;
189
+ height: 1em;
190
+ position: relative;
191
+ text-align: center;
192
+ vertical-align: -.125em;
193
+ width: 1em
194
+ }
195
+ &.fa-2x {
196
+ font-size: 2em
197
+ }
198
+ &.fa-3x {
199
+ font-size: 3em
200
+ }
201
+ &.fa-flip {
202
+ animation-name: fa-flip;
203
+ animation-delay: 0s;
204
+ animation-direction: normal;
205
+ animation-duration: 1s;
206
+ animation-iteration-count: infinite;
207
+ animation-timing-function: ease-in-out;
208
+ }
209
+ &.fa-spin {
210
+ animation-name: fa-spin;
211
+ animation-delay: 0s;
212
+ animation-direction: normal;
213
+ animation-duration: 2s;
214
+ animation-iteration-count: infinite;
215
+ animation-timing-function: linear;
216
+ }
217
+ &.fa-pulse {
218
+ animation: fa-spin 1s infinite linear;
219
+ }
220
+ }
221
+ }
@@ -41,10 +41,74 @@ type IconProps = {
41
41
  } & GlobalProps
42
42
 
43
43
  const flipMap = {
44
- horizontal: 'fa-flip-horizontal',
45
- vertical: 'fa-flip-vertical',
46
- both: 'fa-flip-horizontal fa-flip-vertical',
47
- none: ""
44
+ fa: {
45
+ horizontal: 'fa-flip-horizontal',
46
+ vertical: 'fa-flip-vertical',
47
+ both: 'fa-flip-horizontal fa-flip-vertical',
48
+ none: ''
49
+ },
50
+ svg: {
51
+ horizontal: 'flip_horizontal',
52
+ vertical: 'flip_vertical',
53
+ both: 'flip_horizontal flip_vertical',
54
+ none: ''
55
+ }
56
+ }
57
+ const pulseMap = {
58
+ fa: 'fa-pulse',
59
+ svg: 'pulse'
60
+ }
61
+ const spinMap = {
62
+ fa: 'fa-spin',
63
+ svg: 'spin'
64
+ }
65
+ const rotateMap = {
66
+ fa: {
67
+ 90: 'fa-rotate-90',
68
+ 180: 'fa-rotate-180',
69
+ 270: 'fa-rotate-270'
70
+ },
71
+ svg: {
72
+ 90: 'rotate_90',
73
+ 180: 'rotate_180',
74
+ 270: 'rotate_270'
75
+ }
76
+ }
77
+
78
+ const sizeMap = {
79
+ fa: {
80
+ "lg": "fa-lg",
81
+ "xs": "fa-xs",
82
+ "sm": "fa-sm",
83
+ "1x": "fa-1x",
84
+ "2x": "fa-2x",
85
+ "3x": "fa-3x",
86
+ "4x": "fa-4x",
87
+ "5x": "fa-5x",
88
+ "6x": "fa-6x",
89
+ "7x": "fa-7x",
90
+ "8x": "fa-8x",
91
+ "9x": "fa-9x",
92
+ "10x": "fa-10x",
93
+ "": ""
94
+ },
95
+ svg: {
96
+ "lg": "svg_lg",
97
+ "xs": "svg_xs",
98
+ "sm": "svg_sm",
99
+ "1x": "svg_1x",
100
+ "2x": "svg_2x",
101
+ "3x": "svg_3x",
102
+ "4x": "svg_4x",
103
+ "5x": "svg_5x",
104
+ "6x": "svg_6x",
105
+ "7x": "svg_7x",
106
+ "8x": "svg_8x",
107
+ "9x": "svg_9x",
108
+ "10x": "svg_10x",
109
+ "": ""
110
+ }
111
+
48
112
  }
49
113
 
50
114
  declare global {
@@ -99,16 +163,42 @@ const Icon = (props: IconProps) => {
99
163
  }
100
164
  }
101
165
 
102
- const classes = classnames(
103
- flipMap[flip],
166
+ const isFA = !iconElement && !customIcon
167
+
168
+ let classes = classnames(
104
169
  (!iconElement && !customIcon) ? 'pb_icon_kit' : '',
105
170
  (iconElement || customIcon) ? 'pb_custom_icon' : fontStyle,
106
171
  iconElement ? 'svg-inline--fa' : '',
107
- faClasses,
108
172
  globalProps(props),
109
173
  className
110
174
  )
111
175
 
176
+ const transformClasses = classnames(
177
+ flip ? flipMap[isFA ? 'fa' : 'svg'][flip] : null,
178
+ pulse ? pulseMap[isFA ? 'fa' : 'svg'] : null,
179
+ rotation ? rotateMap[isFA ? 'fa' : 'svg'][rotation] : null,
180
+ spin ? spinMap[isFA ? 'fa' : 'svg'] : null,
181
+ size ? sizeMap[isFA ? 'fa' : 'svg'][size] : null,
182
+ border ? isFA ? 'fa-border' : 'svg_border' : null,
183
+ fixedWidth ? isFA ? 'fa-fw' : 'svg_fw' : null,
184
+ inverse ? isFA ? 'fa-inverse' : 'svg_inverse' : null,
185
+ listItem ? isFA ? 'fa-li' : 'svg_li' : null,
186
+ pull ? isFA ? `fa-pull-${pull}` : `pull_${pull}` : null,
187
+ )
188
+ classes += ` ${transformClasses}`
189
+
190
+ if (isFA) {
191
+ const faClassList = {
192
+ 'fa-border': border,
193
+ 'fa-inverse': inverse,
194
+ 'fa-li': listItem,
195
+ [`fa-${size}`]: size,
196
+ [`fa-pull-${pull}`]: pull,
197
+ }
198
+ faClassList[`fa-${icon}`] = icon as string
199
+ classes += ` ${classnames(faClassList)}`
200
+ }
201
+
112
202
  const classesEmoji = classnames(
113
203
  'pb_icon_kit_emoji',
114
204
  globalProps(props),