playbook_ui 10.0.0 → 10.0.1.alpha.railscusticon

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: fab9c2c11d0d9b010b8498fdd9b1e9e1bad54b8776029ea6e75f11e51fd16fa9
4
- data.tar.gz: ab6a5a56762a24213347eacefef14c9431d719cbf72b9bde1628a62a20a05db1
3
+ metadata.gz: 2fac834bfee4b1e2becacc6beb81454bc07c2245b4aa5868ce39f15680f17b75
4
+ data.tar.gz: 3906161634d9eff14a41c5c754f754b371aeb7ab9e9619a050f4b4bec81eaa59
5
5
  SHA512:
6
- metadata.gz: ae2f49bada534b72189ada36e1f07d8a61bc1c7aebaf04697e6bc4ee12535a8c0b398d85d1f67c6d51f1e0a2cea8ee09a2bc2d5e03446669d262d4ec5d6c7e41
7
- data.tar.gz: 2d36758af0cae0e80897e55660ec95a3d53eaa0feba43c22f52e56ae9348e5f3f763c326b09d7759443726c3250a55d5fd3d9c9275d0eb0b6aca66443a1bdcef
6
+ metadata.gz: 3e85c115a8506cf4b388bdb0e07e3fa34b516f861ed72e7796355caff50439489c5073484c5691b995192a914395ed40ddd906c85fedc0e97843486699619a3d
7
+ data.tar.gz: 4f875cce483498737eca8abab11167a83272706cb345f2068a70d928f50ef67e6a0ddaa267ab7a716c005bdeeb7c0b88d0407efad90b59045892e5f198155e85
@@ -1,4 +1,3 @@
1
- @import 'tokens/fonts';
2
1
  @import 'pb_background/background';
3
2
  @import 'pb_body/body';
4
3
  @import 'pb_bread_crumbs/bread_crumbs';
@@ -1,6 +1,7 @@
1
1
  @import "./button_mixins";
2
2
 
3
3
  [class^=pb_button_kit]{
4
+ @include pb_button;
4
5
  // Variants =================
5
6
  &[class*=_primary] {
6
7
  @include pb_button_primary;
@@ -12,8 +12,17 @@ $pb_button_h_padding: 34px;
12
12
  $pb_button_hover_darken: 4%;
13
13
  $pb_button_border_width: 0px;
14
14
 
15
+ @mixin pb_button_variant($bg: $primary_action, $color: $text_dk_default, $border: transparent) {
16
+ background-color: $bg;
17
+ color: $color;
18
+ border-color: $border;
19
+
20
+ &:active {
21
+ border-color: darken($bg, $pb_button_hover_darken);
22
+ }
23
+ }
15
24
 
16
- @mixin pb_button($bg: $primary_action, $color: $text_dk_default, $border: transparent) {
25
+ @mixin pb_button {
17
26
  text-rendering: optimizeLegibility;
18
27
  font-size: $font_small;
19
28
  font-weight: $bold;
@@ -21,15 +30,12 @@ $pb_button_border_width: 0px;
21
30
  vertical-align: middle;
22
31
  text-transform: none;
23
32
  border-width: $pb_button_border_width;
24
- border-color: $border;
25
33
  border-style: solid;
26
34
  border-radius: $border_rad_light;
27
35
  min-height: $pb_button_size;
28
36
  line-height: 1.5;
29
37
  padding: $pb_button_v_padding $pb_button_h_padding;
30
38
  cursor: pointer;
31
- background-color: $bg;
32
- color: $color;
33
39
  outline: none;
34
40
  transition: background $transition_default ease, color $transition_default ease;
35
41
  box-sizing: border-box;
@@ -57,7 +63,6 @@ $pb_button_border_width: 0px;
57
63
  &:active {
58
64
  outline: none;
59
65
  border-width: $pb_button_border_width;
60
- border-color: darken($bg, $pb_button_hover_darken);
61
66
  }
62
67
 
63
68
  };
@@ -68,7 +73,7 @@ $pb_button_border_width: 0px;
68
73
 
69
74
  // Primary ======================
70
75
  @mixin pb_button_primary {
71
- @include pb_button;
76
+ @include pb_button_variant($primary_action, $text_dk_default, transparent);
72
77
 
73
78
  @media (hover:hover) {
74
79
  &:hover {
@@ -79,7 +84,7 @@ $pb_button_border_width: 0px;
79
84
 
80
85
  // Secondary ====================
81
86
  @mixin pb_button_secondary {
82
- @include pb_button(rgba($primary_action, 0.05), $primary_action);
87
+ @include pb_button_variant(rgba($primary_action, 0.05), $primary_action);
83
88
 
84
89
  @media (hover:hover) {
85
90
  &:hover {
@@ -90,7 +95,7 @@ $pb_button_border_width: 0px;
90
95
 
91
96
  // Link =========================
92
97
  @mixin pb_button_link {
93
- @include pb_button($transparent, $primary_action);
98
+ @include pb_button_variant($transparent, $primary_action);
94
99
 
95
100
  @media (hover:hover) {
96
101
  &:hover {
@@ -102,7 +107,7 @@ $pb_button_border_width: 0px;
102
107
  // Disabled ====================
103
108
  @mixin pb_button_disabled {
104
109
  $disabled_color: rgba($charcoal, $opacity_5);
105
- @include pb_button(rgba($slate, $opacity_4), $disabled_color);
110
+ @include pb_button_variant(rgba($slate, $opacity_4), $disabled_color);
106
111
  pointer-events: none;
107
112
  }
108
113
 
@@ -127,7 +132,7 @@ $pb_button_border_width: 0px;
127
132
 
128
133
  // Dark Primary =================
129
134
  @mixin pb_button_primary_dark{
130
- @include pb_button($primary_action);
135
+ @include pb_button_variant($primary_action);
131
136
 
132
137
  @media (hover:hover) {
133
138
  &:hover {
@@ -138,7 +143,7 @@ $pb_button_border_width: 0px;
138
143
 
139
144
  // Dark Secondary ==============
140
145
  @mixin pb_button_secondary_dark{
141
- @include pb_button(rgba($white, 0.2), $white);
146
+ @include pb_button_variant(rgba($white, 0.2), $white);
142
147
 
143
148
  @media (hover:hover) {
144
149
  &:hover {
@@ -149,7 +154,7 @@ $pb_button_border_width: 0px;
149
154
 
150
155
  // Dark Link =============
151
156
  @mixin pb_button_link_dark {
152
- @include pb_button($transparent, $white);
157
+ @include pb_button_variant($transparent, $white);
153
158
 
154
159
  @media (hover:hover) {
155
160
  &:hover {
@@ -161,6 +166,6 @@ $pb_button_border_width: 0px;
161
166
  // Dark Disabled ====================
162
167
  @mixin pb_button_disabled_dark {
163
168
  $disabled_color: rgba($white, $opacity_5);
164
- @include pb_button(rgba($slate, $opacity_5), $disabled_color);
169
+ @include pb_button_variant(rgba($slate, $opacity_5), $disabled_color);
165
170
  pointer-events: none;
166
171
  }
@@ -1,3 +1,12 @@
1
1
  [class^=pb_icon_kit]{
2
2
 
3
3
  }
4
+
5
+ // Rails custom icon styles
6
+ svg.pb_custom_icon {
7
+ width: 1em;
8
+ fill: currentColor;
9
+ path {
10
+ fill: currentColor;
11
+ }
12
+ }
@@ -0,0 +1,22 @@
1
+ <%# SVG fill color inherited from css color property %>
2
+ <div class="icon-wrapper" style="color:blue;">
3
+
4
+ <p><%= pb_rails("icon", props: { custom_icon: "https://upload.wikimedia.org/wikipedia/commons/3/3b/Wrench_font_awesome.svg", size: "2x" } ) %></p>
5
+ <p><%= pb_rails("icon", props: { custom_icon: "app/javascript/images/powergon.svg", size: "3x" } ) %></p>
6
+
7
+ <%= pb_rails("icon", props: { flip: "vertical", custom_icon: "app/javascript/images/powergon.svg", size: "5x" } ) %>
8
+ <%= pb_rails("icon", props: { rotation: 90, custom_icon: "app/javascript/images/powergon.svg", size: "5x" } ) %>
9
+ <%= pb_rails("icon", props: { spin: true, custom_icon: "app/javascript/images/powergon.svg", size: "5x" } ) %>
10
+ <%= pb_rails("icon", props: { custom_icon: "app/javascript/images/powergon.svg", size: "8x" } ) %>
11
+
12
+
13
+ <%# <%= pb_rails("icon", props: { custom_icon: "https://en.wikipedia.org/wiki/Portable_Network_Graphics#/media/File:PNG_transparency_demonstration_1.png", size: "8x" } ) %>
14
+
15
+
16
+ <%= pb_rails("body", props: {
17
+ text: "Custom icons must be SVGs. They can be locally or remotely
18
+ sourced and are compatible with other icon props (size, rotation,
19
+ spin, flip, etc). Their SVG fill colors will be inherited from
20
+ parent element's css color properties."
21
+ } ) %>
22
+ </div>
@@ -7,6 +7,7 @@ examples:
7
7
  - icon_pull: Icon Pull
8
8
  - icon_border: Icon Border
9
9
  - icon_sizes: Icon Sizes
10
+ - icon_custom: Icon Custom
10
11
 
11
12
  react:
12
13
  - icon_default: Icon Default
@@ -1,7 +1,13 @@
1
- <%= content_tag(:i, nil,
2
- id: object.id,
3
- data: object.data,
4
- class: object.classname ) %>
5
- <%= content_tag(:span, nil,
6
- aria: { label: "#{object.icon} icon" }.merge(object.aria),
7
- hidden: true ) %>
1
+ <% if object.custom_icon %>
2
+ <%= object.render_svg(object.custom_icon) %>
3
+ <% else %>
4
+ <%= content_tag(:i, nil,
5
+ id: object.id,
6
+ data: object.data,
7
+ class: object.classname
8
+ ) %>
9
+ <%= content_tag(:span, nil,
10
+ aria: { label: "#{object.icon} icon" }.merge(object.aria),
11
+ hidden: true
12
+ ) %>
13
+ <% end %>
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "open-uri"
4
+
3
5
  module Playbook
4
6
  module PbIcon
5
7
  class Icon < Playbook::KitBase
@@ -10,7 +12,9 @@ module Playbook
10
12
  prop :flip, type: Playbook::Props::Enum,
11
13
  values: ["horizontal", "vertical", "both", nil],
12
14
  default: nil
13
- prop :icon, required: true
15
+ prop :icon
16
+ prop :custom_icon, type: Playbook::Props::String,
17
+ default: nil
14
18
  prop :inverse, type: Playbook::Props::Boolean,
15
19
  default: false
16
20
  prop :list_item, type: Playbook::Props::Boolean,
@@ -48,6 +52,34 @@ module Playbook
48
52
  )
49
53
  end
50
54
 
55
+ def custom_icon_classname
56
+ generate_classname(
57
+ "pb_icon_kit",
58
+ border_class,
59
+ fixed_width_class,
60
+ flip_class,
61
+ inverse_class,
62
+ list_item_class,
63
+ pull_class,
64
+ pulse_class,
65
+ rotation_class,
66
+ size_class,
67
+ spin_class,
68
+ separator: " "
69
+ )
70
+ end
71
+
72
+ def render_svg(path)
73
+ if File.extname(path) == ".svg"
74
+ doc = Nokogiri::XML(open(path)) # rubocop:disable Security/Open
75
+ svg = doc.at_css "svg"
76
+ svg["class"] = "pb_custom_icon " + object.custom_icon_classname
77
+ raw doc
78
+ else
79
+ raise("Custom icon must be an svg. Please check your path and file type.")
80
+ end
81
+ end
82
+
51
83
  private
52
84
 
53
85
  def border_class
@@ -36,6 +36,7 @@ const MultipleUsers = (props: MultipleUsersProps) => {
36
36
  const displayCount =
37
37
  users.length > maxDisplayedUsers ? maxDisplayedUsers - 1 : users.length
38
38
  const usersToDisplay = users.slice(0, displayCount)
39
+
39
40
  const reverseClass = reverse === true ? 'reverse' : ''
40
41
  const avatarSizeClass = size === 'xxs' ? 'xxs' : 'xs'
41
42
  const ariaProps = buildAriaProps(aria)
@@ -1 +1 @@
1
- The multiple users kit is used to show that more than one user is associated to an action or item.
1
+ The multiple users kit is used to show that more than one user is associated to an action or item.
@@ -2,7 +2,6 @@
2
2
  text: "xs",
3
3
  color: "light"
4
4
  }) %>
5
-
6
5
  <%= pb_rails("multiple_users", props: {
7
6
  users: [
8
7
  {
@@ -28,9 +27,11 @@
28
27
  ]
29
28
  }) %>
30
29
 
31
- <br/><br/>
30
+ <br />
32
31
 
33
32
  <%= pb_rails("multiple_users", props: {
33
+ margin_top: "xs",
34
+ size: "xs",
34
35
  users: [
35
36
  {
36
37
  name: "Shawn Palmer",
@@ -43,57 +44,52 @@
43
44
  ]
44
45
  }) %>
45
46
 
46
- <br/><br/>
47
+ <br />
47
48
 
48
49
  <%= pb_rails("body", props: {
49
50
  text: "xxs",
51
+ margin_top: "xs",
50
52
  color: "light"
51
53
  }) %>
52
-
53
54
  <%= pb_rails("multiple_users", props: {
55
+ size: "xxs",
54
56
  users: [
55
57
  {
56
58
  name: "Patrick Welch",
57
59
  image_url: "https://randomuser.me/api/portraits/men/9.jpg",
58
- size: "xxs",
59
60
  },
60
61
  {
61
62
  name: "Lucille Sanchez",
62
63
  image_url: "https://randomuser.me/api/portraits/women/6.jpg",
63
- size: "xxs",
64
64
  },
65
65
  {
66
66
  name: "Beverly Reyes",
67
67
  image_url: "https://randomuser.me/api/portraits/women/74.jpg",
68
- size: "xxs",
69
68
  },
70
69
  {
71
70
  name: "Keith Craig",
72
71
  image_url: "https://randomuser.me/api/portraits/men/40.jpg",
73
- size: "xxs",
74
72
  },
75
73
  {
76
74
  name: "Alicia Cooper",
77
75
  image_url: "https://randomuser.me/api/portraits/women/46.jpg",
78
- size: "xxs",
79
76
  }
80
77
  ]
81
78
  }) %>
82
79
 
83
- <br/><br/>
80
+ <br />
84
81
 
85
82
  <%= pb_rails("multiple_users", props: {
83
+ margin_top: "xs",
84
+ size: "xxs",
86
85
  users: [
87
86
  {
88
87
  name: "Shawn Palmer",
89
88
  image_url: "https://randomuser.me/api/portraits/men/93.jpg",
90
- size: "xxs",
91
89
  },
92
90
  {
93
91
  name: "Andrew Murray",
94
92
  image_url: "https://randomuser.me/api/portraits/men/75.jpg",
95
- size: "xxs",
96
93
  }
97
94
  ]
98
- }) %>
99
-
95
+ }) %>
@@ -1,11 +1,14 @@
1
1
  import React from 'react'
2
- import { MultipleUsers } from '../../'
2
+ import { Body, MultipleUsers } from '../../'
3
3
 
4
4
  const MultipleUsersSize = (props) => {
5
5
  return (
6
6
  <div>
7
+ <Body
8
+ color="light"
9
+ text="xs"
10
+ />
7
11
  <MultipleUsers
8
- size="xxs"
9
12
  users={[
10
13
  {
11
14
  name: 'Patrick Welch',
@@ -32,20 +35,70 @@ const MultipleUsersSize = (props) => {
32
35
  />
33
36
 
34
37
  <br />
38
+
39
+ <MultipleUsers
40
+ marginTop="xs"
41
+ size="xs"
42
+ users={[
43
+ {
44
+ name: 'Shawn Palmer',
45
+ imageUrl: 'https://randomuser.me/api/portraits/men/93.jpg',
46
+ },
47
+ {
48
+ name: 'Andrew Murray Cooper Craig',
49
+ imageUrl: 'https://randomuser.me/api/portraits/men/75.jpg',
50
+ },
51
+ ]}
52
+ {...props}
53
+ />
54
+
55
+ <Body
56
+ color="light"
57
+ marginTop="xs"
58
+ text="xxs"
59
+ />
60
+ <MultipleUsers
61
+ size="xxs"
62
+ users={[
63
+ {
64
+ name: 'Patrick Welch',
65
+ imageUrl: 'https://randomuser.me/api/portraits/men/9.jpg',
66
+ },
67
+ {
68
+ name: 'Lucille Sanchez',
69
+ imageUrl: 'https://randomuser.me/api/portraits/women/6.jpg',
70
+ },
71
+ {
72
+ name: 'Beverly Reyes',
73
+ imageUrl: 'https://randomuser.me/api/portraits/women/74.jpg',
74
+ },
75
+ {
76
+ name: 'Keith Craig',
77
+ imageUrl: 'https://randomuser.me/api/portraits/men/40.jpg',
78
+ },
79
+ {
80
+ name: 'Alicia Cooper',
81
+ imageUrl: 'https://randomuser.me/api/portraits/women/46.jpg',
82
+ },
83
+ ]}
84
+ {...props}
85
+ />
86
+
35
87
  <br />
36
88
 
37
89
  <MultipleUsers
90
+ marginTop="xs"
38
91
  size="xxs"
39
92
  users={[
40
- {
41
- name: 'Shawn Palmer',
42
- imageUrl: 'https://randomuser.me/api/portraits/men/93.jpg',
43
- },
44
- {
45
- name: 'Andrew Murray Cooper Craig',
46
- imageUrl: 'https://randomuser.me/api/portraits/men/75.jpg',
47
- },
48
- ]}
93
+ {
94
+ name: 'Shawn Palmer',
95
+ imageUrl: 'https://randomuser.me/api/portraits/men/93.jpg',
96
+ },
97
+ {
98
+ name: 'Andrew Murray Cooper Craig',
99
+ imageUrl: 'https://randomuser.me/api/portraits/men/75.jpg',
100
+ },
101
+ ]}
49
102
  {...props}
50
103
  />
51
104
  </div>
@@ -4,16 +4,11 @@
4
4
  data: object.data,
5
5
  id: object.id) do %>
6
6
  <% object.users.take(object.display_count).each do |user| %>
7
- <%= pb_rails("avatar", props: user.merge({
8
- classname: "pb_multiple_users_item",
9
- dark: object.dark,
10
- size: object.avatar_size(user[:size].present?),
11
- })
12
- )%>
7
+ <%= pb_rails("avatar", props: user.merge({size: object.size, classname: "pb_multiple_users_item", dark: object.dark}) ) %>
13
8
  <% end %>
14
9
 
15
10
  <% if object.more_than_four %>
16
- <div class="pb_multiple_users_item multiple_users_badge<%= (object.data[:size] == 'xxs') ? '_xxs' : '_xs' %>">
11
+ <div class="pb_multiple_users_item multiple_users_badge_<%= object.size %>">
17
12
  <%= "+#{object.users.count - object.display_count}" %>
18
13
  </div>
19
14
  <% end %>
@@ -4,7 +4,9 @@ module Playbook
4
4
  module PbMultipleUsers
5
5
  class MultipleUsers < Playbook::KitBase
6
6
  prop :reverse, type: Playbook::Props::Boolean, default: false
7
- prop :size, type: Playbook::Props::String, default: "xs"
7
+ prop :size, type: Playbook::Props::Enum,
8
+ values: %w[xxs xs],
9
+ default: "xs"
8
10
  prop :users, type: Playbook::Props::HashArray, required: true
9
11
 
10
12
  def more_than_four
@@ -19,12 +21,6 @@ module Playbook
19
21
  generate_classname("pb_multiple_users_kit", reverse_class)
20
22
  end
21
23
 
22
- def avatar_size(size = "xs")
23
- return data[:size] = "xs" if size.blank? || size == "xs"
24
-
25
- data[:size] = "xxs"
26
- end
27
-
28
24
  private
29
25
 
30
26
  def reverse_class
@@ -23,6 +23,8 @@
23
23
  overflow-x: auto;
24
24
  }
25
25
  [class^=pb_rich_text_editor_kit] {
26
+ // Fixes flex container resizing bug
27
+ overflow-x: auto;
26
28
  // Disables File Attatchment Button in Toolbar
27
29
  trix-toolbar [data-trix-button-group="file-tools"] {
28
30
  display: none;
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Playbook
4
- PREVIOUS_VERSION = "9.19.0"
5
- VERSION = "10.0.0"
4
+ PREVIOUS_VERSION = "10.0.1"
5
+ VERSION = "10.0.1.alpha.railscusticon"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 10.0.0
4
+ version: 10.0.1.alpha.railscusticon
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-06-30 00:00:00.000000000 Z
12
+ date: 2021-07-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -1004,6 +1004,7 @@ files:
1004
1004
  - app/pb_kits/playbook/pb_icon/docs/_icon_animate.md
1005
1005
  - app/pb_kits/playbook/pb_icon/docs/_icon_border.html.erb
1006
1006
  - app/pb_kits/playbook/pb_icon/docs/_icon_border.jsx
1007
+ - app/pb_kits/playbook/pb_icon/docs/_icon_custom.html.erb
1007
1008
  - app/pb_kits/playbook/pb_icon/docs/_icon_custom.jsx
1008
1009
  - app/pb_kits/playbook/pb_icon/docs/_icon_default.html.erb
1009
1010
  - app/pb_kits/playbook/pb_icon/docs/_icon_default.jsx
@@ -1976,7 +1977,6 @@ files:
1976
1977
  - app/pb_kits/playbook/tokens/_animation-curves.scss
1977
1978
  - app/pb_kits/playbook/tokens/_border_radius.scss
1978
1979
  - app/pb_kits/playbook/tokens/_colors.scss
1979
- - app/pb_kits/playbook/tokens/_fonts.scss
1980
1980
  - app/pb_kits/playbook/tokens/_line_height.scss
1981
1981
  - app/pb_kits/playbook/tokens/_opacity.scss
1982
1982
  - app/pb_kits/playbook/tokens/_positioning.scss
@@ -2063,9 +2063,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
2063
2063
  version: '0'
2064
2064
  required_rubygems_version: !ruby/object:Gem::Requirement
2065
2065
  requirements:
2066
- - - ">="
2066
+ - - ">"
2067
2067
  - !ruby/object:Gem::Version
2068
- version: '0'
2068
+ version: 1.3.1
2069
2069
  requirements: []
2070
2070
  rubygems_version: 3.1.4
2071
2071
  signing_key: