playbook_ui 13.16.0.pre.alpha.play1141iconkitusinglibrary2100 → 13.16.0.pre.alpha.powercentrainplaybookpt22125
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_advanced_table/Components/TableHeaderCell.tsx +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.jsx +52 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_collapsible_trail.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_default.md +7 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.jsx +59 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_expanded_control.md +18 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.jsx +60 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_loading.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort.jsx +1 -6
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort.md +5 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.jsx +63 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort_control.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.jsx +57 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_subrow_headers.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_options.jsx +61 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_options.md +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.jsx +55 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +10 -4
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +7 -0
- data/app/pb_kits/playbook/pb_advanced_table/scss_partials/_loading.scss +4 -3
- data/app/pb_kits/playbook/pb_button/_button.scss +3 -3
- data/app/pb_kits/playbook/pb_button/_button_mixins.scss +3 -2
- data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +1 -1
- data/app/pb_kits/playbook/pb_dashboard/commonSettings.js +1 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsDarkTheme.ts +1 -1
- data/app/pb_kits/playbook/pb_dashboard/pbChartsLightTheme.ts +1 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +1 -1
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +17 -29
- data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.html.erb +11 -5
- data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.jsx +18 -44
- data/app/pb_kits/playbook/pb_icon/docs/_icon_custom.md +5 -10
- data/app/pb_kits/playbook/pb_icon/icon.html.erb +4 -6
- data/app/pb_kits/playbook/pb_icon/icon.rb +10 -24
- data/app/pb_kits/playbook/tokens/_typography.scss +10 -10
- data/dist/playbook-rails.js +2 -2
- data/dist/reset.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +17 -2
@@ -1,4 +1,4 @@
|
|
1
|
-
import React
|
1
|
+
import React from 'react'
|
2
2
|
import classnames from 'classnames'
|
3
3
|
import { buildAriaProps, buildDataProps, buildHtmlProps } from '../utilities/props'
|
4
4
|
import { GlobalProps, globalProps } from '../utilities/globalProps'
|
@@ -27,7 +27,7 @@ type IconProps = {
|
|
27
27
|
data?: {[key: string]: string},
|
28
28
|
fixedWidth?: boolean,
|
29
29
|
flip?: "horizontal" | "vertical" | "both" | "none",
|
30
|
-
icon: string
|
30
|
+
icon: string,
|
31
31
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
32
32
|
id?: string,
|
33
33
|
inverse?: boolean,
|
@@ -57,7 +57,7 @@ const Icon = (props: IconProps) => {
|
|
57
57
|
fixedWidth = true,
|
58
58
|
flip = "none",
|
59
59
|
htmlOptions = {},
|
60
|
-
icon
|
60
|
+
icon,
|
61
61
|
id,
|
62
62
|
inverse = false,
|
63
63
|
listItem = false,
|
@@ -69,9 +69,6 @@ const Icon = (props: IconProps) => {
|
|
69
69
|
spin = false,
|
70
70
|
} = props
|
71
71
|
|
72
|
-
const iconURL = typeof(icon) === 'string' && icon.includes('.svg') ? icon : null
|
73
|
-
const iconElement: ReactSVGElement | null = typeof(icon) === "object" ? icon : null
|
74
|
-
|
75
72
|
const faClasses = {
|
76
73
|
'fa-border': border,
|
77
74
|
'fa-fw': fixedWidth,
|
@@ -82,14 +79,19 @@ const Icon = (props: IconProps) => {
|
|
82
79
|
[`fa-${size}`]: size,
|
83
80
|
[`fa-pull-${pull}`]: pull,
|
84
81
|
[`fa-rotate-${rotation}`]: rotation,
|
85
|
-
}
|
86
82
|
|
87
|
-
|
83
|
+
}
|
88
84
|
|
85
|
+
// Lets check and see if the icon prop is referring to a custom Power icon...
|
86
|
+
// If so, then set fa-icon to "custom"
|
87
|
+
// this ensures the JS will not do any further operations
|
88
|
+
// faClasses[`fa-${icon}`] = customIcon ? 'custom' : icon
|
89
|
+
if (!customIcon) faClasses[`fa-${icon}`] = icon
|
90
|
+
|
89
91
|
const classes = classnames(
|
90
92
|
flipMap[flip],
|
91
|
-
|
92
|
-
|
93
|
+
'pb_icon_kit',
|
94
|
+
customIcon ? '' : fontStyle,
|
93
95
|
faClasses,
|
94
96
|
globalProps(props),
|
95
97
|
className
|
@@ -108,22 +110,20 @@ const Icon = (props: IconProps) => {
|
|
108
110
|
|
109
111
|
// Add a conditional here to show only the SVG if custom
|
110
112
|
const displaySVG = (customIcon: any) => {
|
111
|
-
if (
|
113
|
+
if (customIcon)
|
112
114
|
return (
|
113
115
|
<>
|
114
116
|
{
|
115
|
-
React.cloneElement(
|
117
|
+
React.cloneElement(customIcon, {
|
116
118
|
...dataProps,
|
117
119
|
...htmlProps,
|
118
120
|
className: classes,
|
119
121
|
id,
|
120
|
-
width: 'auto',
|
121
|
-
height: 'auto',
|
122
122
|
})
|
123
123
|
}
|
124
124
|
</>
|
125
125
|
)
|
126
|
-
else if (isValidEmoji(icon
|
126
|
+
else if (isValidEmoji(icon))
|
127
127
|
return (
|
128
128
|
<>
|
129
129
|
<span
|
@@ -136,19 +136,7 @@ const Icon = (props: IconProps) => {
|
|
136
136
|
</span>
|
137
137
|
</>
|
138
138
|
)
|
139
|
-
|
140
|
-
return (
|
141
|
-
<>
|
142
|
-
<span
|
143
|
-
{...dataProps}
|
144
|
-
{...htmlProps}
|
145
|
-
className={classesEmoji}
|
146
|
-
id={id}
|
147
|
-
>
|
148
|
-
<img src={iconURL} />
|
149
|
-
</span>
|
150
|
-
</>
|
151
|
-
)
|
139
|
+
|
152
140
|
else
|
153
141
|
return (
|
154
142
|
<>
|
@@ -173,4 +161,4 @@ const Icon = (props: IconProps) => {
|
|
173
161
|
)
|
174
162
|
}
|
175
163
|
|
176
|
-
export default Icon
|
164
|
+
export default Icon
|
@@ -2,9 +2,15 @@
|
|
2
2
|
<div class="icon-wrapper">
|
3
3
|
|
4
4
|
<% svg_url = "https://upload.wikimedia.org/wikipedia/commons/3/3b/Wrench_font_awesome.svg" %>
|
5
|
-
<p><%= pb_rails("icon", props: {
|
6
|
-
<p><%= pb_rails("icon", props: { rotation: 90,
|
7
|
-
<p><%= pb_rails("icon", props: { spin: true,
|
8
|
-
<p><%= pb_rails("icon", props: { size: "5x",
|
9
|
-
<p><%= pb_rails("icon", props: { flip: "horizontal", size: "5x",
|
5
|
+
<p><%= pb_rails("icon", props: { custom_icon: svg_url } ) %></p>
|
6
|
+
<p><%= pb_rails("icon", props: { rotation: 90, custom_icon: svg_url, size: "2x" } ) %></p>
|
7
|
+
<p><%= pb_rails("icon", props: { spin: true, custom_icon: svg_url, size: "3x" } ) %></p>
|
8
|
+
<p><%= pb_rails("icon", props: { size: "5x", custom_icon: svg_url } ) %></p>
|
9
|
+
<p><%= pb_rails("icon", props: { flip: "horizontal", size: "5x", custom_icon: svg_url } ) %></p>
|
10
|
+
|
11
|
+
<%= pb_rails("body", props: {
|
12
|
+
text: "Custom icons are compatible with other icon props (size, rotation,
|
13
|
+
spin, flip, etc). Their SVG fill colors will be inherited from
|
14
|
+
parent element's css color properties."
|
15
|
+
} ) %>
|
10
16
|
</div>
|
@@ -1,59 +1,33 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import { Icon } from '../../'
|
3
3
|
|
4
|
+
// import Icons as config from 'power-icons'
|
4
5
|
const config = {
|
5
|
-
|
6
|
-
<svg
|
6
|
+
moon: (
|
7
|
+
<svg
|
8
|
+
ariaHidden="true"
|
9
|
+
focusable="false"
|
10
|
+
role="img"
|
11
|
+
viewBox="0 0 512 512"
|
7
12
|
xmlns="http://www.w3.org/2000/svg"
|
8
13
|
>
|
9
|
-
<
|
10
|
-
|
11
|
-
|
14
|
+
<path
|
15
|
+
d="M448 0H64C28.7 0 0 28.7 0 64v288c0 35.3 28.7 64 64 64h96v84c0 7.1 5.8 12 12 12 2.4 0 4.9-.7 7.1-2.4L304 416h144c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64zm16 352c0 8.8-7.2 16-16 16H288l-12.8 9.6L208 428v-60H64c-8.8 0-16-7.2-16-16V64c0-8.8 7.2-16 16-16h384c8.8 0 16 7.2 16 16v288zM336 184h-56v-56c0-8.8-7.2-16-16-16h-16c-8.8 0-16 7.2-16 16v56h-56c-8.8 0-16 7.2-16 16v16c0 8.8 7.2 16 16 16h56v56c0 8.8 7.2 16 16 16h16c8.8 0 16-7.2 16-16v-56h56c8.8 0 16-7.2 16-16v-16c0-8.8-7.2-16-16-16z"
|
16
|
+
fill="currentColor"
|
17
|
+
/>
|
12
18
|
</svg>
|
13
19
|
),
|
14
20
|
}
|
15
21
|
|
16
22
|
const IconCustom = (props) => {
|
17
23
|
return (
|
18
|
-
<
|
19
|
-
<
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
<p>
|
26
|
-
<Icon
|
27
|
-
icon={config.icon}
|
28
|
-
rotation={90}
|
29
|
-
size="2x"
|
30
|
-
{...props}
|
31
|
-
/>
|
32
|
-
</p>
|
33
|
-
<p>
|
34
|
-
<Icon
|
35
|
-
icon={config.icon}
|
36
|
-
size="3x"
|
37
|
-
spin
|
38
|
-
{...props}
|
39
|
-
/>
|
40
|
-
</p>
|
41
|
-
<p>
|
42
|
-
<Icon
|
43
|
-
icon={config.icon}
|
44
|
-
size="5x"
|
45
|
-
{...props}
|
46
|
-
/>
|
47
|
-
</p>
|
48
|
-
<p>
|
49
|
-
<Icon
|
50
|
-
flip="horizontal"
|
51
|
-
icon={config.icon}
|
52
|
-
size="5x"
|
53
|
-
{...props}
|
54
|
-
/>
|
55
|
-
</p>
|
56
|
-
</React.Fragment>
|
24
|
+
<div>
|
25
|
+
<Icon
|
26
|
+
customIcon={config.moon}
|
27
|
+
size="7x"
|
28
|
+
{...props}
|
29
|
+
/>
|
30
|
+
</div>
|
57
31
|
)
|
58
32
|
}
|
59
33
|
|
@@ -4,21 +4,16 @@ When using custom icons it is important to introduce a "clean" SVG. In order to
|
|
4
4
|
|
5
5
|
Attributes must be React compatible e.g. <code>xmlns:xlink</code> should be <code>xmlnsXlink</code> and so on. <strong>There should be no hyphenated attributes and no semi-colons!.</strong>
|
6
6
|
|
7
|
-
Fill colors with regards to <code>g</code> or <code>path</code> nodes, e.g. <code>fill="black"</code>, should be replaced with
|
7
|
+
Fill colors with regards to <code>g</code> or <code>path</code> nodes, e.g. <code>fill="black"</code>, should be replaced with <code>currentColor</code> ala <code>fill="currentColor"</code>. Your mileage may vary depending on the complexity of your SVG.
|
8
8
|
|
9
|
-
Pay attention to your custom icon's dimensions and `viewBox` attribute. It is best to use a `viewBox="0 0 512 512"` starting point
|
9
|
+
Pay attention to your custom icon's dimensions and `viewBox` attribute. It is best to use a `viewBox="0 0 512 512"` starting point __when designing instead of trying to retrofit the viewbox afterwards__!
|
10
10
|
|
11
|
-
You must source
|
11
|
+
You must source *your own SVG into component/view* you are working on. This can easily be done in programmatic and maintainable ways.
|
12
12
|
|
13
13
|
### React
|
14
14
|
|
15
|
-
|
16
|
-
- Sending the absolute path to your SVG (e.g. `/my/path/to/icon.svg`) results in an `img` node with the `src` attribute set to the provided path:
|
17
|
-
|
18
|
-
```html
|
19
|
-
<img src="host.com/my/path/to/icon.svg" />
|
20
|
-
```
|
15
|
+
So long as you have a valid React `<SVG>` node, you can send it as the `customIcon` prop and the kit will take care of the rest.
|
21
16
|
|
22
17
|
### Rails
|
23
18
|
|
24
|
-
|
19
|
+
Some Rails applications use only webpack(er) which means using `image_url` will be successful over `image_path` in most cases especially development where Webpack Dev Server is serving assets over HTTP. Rails applications still using Asset Pipeline may use `image_path` or `image_url`. Of course, YMMV depending on any custom configurations in your Rails application.
|
@@ -1,9 +1,7 @@
|
|
1
|
-
<% if object.
|
2
|
-
<%= object.render_svg %>
|
3
|
-
<% elsif object.valid_emoji
|
4
|
-
<span class="pb_icon_kit_emoji">
|
5
|
-
<%= object.icon.html_safe %>
|
6
|
-
</span>
|
1
|
+
<% if object.custom_icon %>
|
2
|
+
<%= object.render_svg(object.custom_icon) %>
|
3
|
+
<% elsif object.valid_emoji(object.icon) %>
|
4
|
+
<span class="pb_icon_kit_emoji"><%= object.icon.html_safe %></span>
|
7
5
|
<% else %>
|
8
6
|
<%= content_tag(:i, nil,
|
9
7
|
id: object.id,
|
@@ -38,7 +38,7 @@ module Playbook
|
|
38
38
|
prop :spin, type: Playbook::Props::Boolean,
|
39
39
|
default: false
|
40
40
|
|
41
|
-
def valid_emoji
|
41
|
+
def valid_emoji(icon)
|
42
42
|
emoji_regex = /\p{Emoji}/
|
43
43
|
emoji_regex.match?(icon)
|
44
44
|
end
|
@@ -79,33 +79,19 @@ module Playbook
|
|
79
79
|
)
|
80
80
|
end
|
81
81
|
|
82
|
-
def
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
svg = doc.at_css "svg"
|
92
|
-
svg["class"] = "pb_custom_icon " + object.custom_icon_classname
|
93
|
-
svg["height"] = "auto"
|
94
|
-
svg["width"] = "auto"
|
95
|
-
doc.at_css("path")["fill"] = "currentColor"
|
96
|
-
raw doc
|
97
|
-
end
|
98
|
-
|
99
|
-
def is_svg?
|
100
|
-
(icon || custom_icon.to_s).include?(".svg") || asset_path.present?
|
82
|
+
def render_svg(path)
|
83
|
+
if File.extname(path) == ".svg"
|
84
|
+
doc = Nokogiri::XML(URI.open(path)) # rubocop:disable Security/Open
|
85
|
+
svg = doc.at_css "svg"
|
86
|
+
svg["class"] = "pb_custom_icon " + object.custom_icon_classname
|
87
|
+
raw doc
|
88
|
+
else
|
89
|
+
raise("Custom icon must be an svg. Please check your path and file type.")
|
90
|
+
end
|
101
91
|
end
|
102
92
|
|
103
93
|
private
|
104
94
|
|
105
|
-
def svg_size
|
106
|
-
size.nil? ? "1x" : size
|
107
|
-
end
|
108
|
-
|
109
95
|
def border_class
|
110
96
|
border ? "fa-border" : nil
|
111
97
|
end
|
@@ -1,11 +1,11 @@
|
|
1
|
-
$font_family_base: "
|
1
|
+
$font_family_base: "Power Centra", "Helvetica Neue", Helvetica, Arial, sans_serif !default;
|
2
2
|
|
3
3
|
/* CLEAN UP AND REMOVE */
|
4
4
|
$font_jumbo: 36px !default;
|
5
5
|
$font_largest: 32px !default;
|
6
|
-
$font_larger:
|
6
|
+
$font_larger: 27px !default;
|
7
7
|
$font_large: 20px !default;
|
8
|
-
$font_base:
|
8
|
+
$font_base: 15.5px !default;
|
9
9
|
$font_default: $font_base !default;
|
10
10
|
$font_normal: $font_base !default;
|
11
11
|
$font_medium: $font_base !default;
|
@@ -26,8 +26,8 @@ $text_smaller: $font_smaller !default;
|
|
26
26
|
$text_smallest: $font_smallest !default;
|
27
27
|
|
28
28
|
/* Headings */
|
29
|
-
$heading_1:
|
30
|
-
$heading_2:
|
29
|
+
$heading_1: 44px !default;
|
30
|
+
$heading_2: 32px !default;
|
31
31
|
$heading_3: $font_larger !default;
|
32
32
|
$heading_4: $font_base !default;
|
33
33
|
|
@@ -35,19 +35,19 @@ $heading_4: $font_base !default;
|
|
35
35
|
$lspace_tightest: -.1em !default;
|
36
36
|
$lspace_tighter: -.07em !default;
|
37
37
|
$lspace_tight: -.01em !default;
|
38
|
-
$lspace_normal:
|
38
|
+
$lspace_normal: .003em !default;
|
39
39
|
$lspace_loose: .03em !default;
|
40
40
|
$lspace_looser: .07em !default;
|
41
41
|
$lspace_loosest: .1em !default;
|
42
42
|
$lspace_super_loosest: .2em !default;
|
43
43
|
|
44
44
|
/* Standard Font Weights */
|
45
|
-
$bold:
|
45
|
+
$bold: 700 !default;
|
46
46
|
$regular: 400 !default;
|
47
47
|
|
48
48
|
/* Non_Standard Font Weights */
|
49
|
-
$extrabold:
|
50
|
-
$boldest:
|
49
|
+
$extrabold: 700 !default;
|
50
|
+
$boldest: 700 !default;
|
51
51
|
$bolder: 700 !default;
|
52
52
|
$light: 300 !default;
|
53
|
-
$lighter:
|
53
|
+
$lighter: 300 !default;
|