playbook_ui 13.31.0.pre.alpha.play1262iconstyles3171 → 13.31.0.pre.alpha.play1416movealiaslogic3232
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_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_collapsible/__snapshots__/collapsible.test.js.snap +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_date_year_stacked/docs/_date_year_stacked_default.jsx +4 -1
- data/app/pb_kits/playbook/pb_draggable/context/index.tsx +15 -1
- data/app/pb_kits/playbook/pb_draggable/context/types.ts +5 -0
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.jsx +14 -19
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_default.md +5 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards.md +7 -3
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list.md +3 -5
- data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list.md +3 -5
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +3 -1
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +2 -0
- data/app/pb_kits/playbook/pb_dropdown/index.js +33 -4
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +9 -0
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +1 -1
- data/app/pb_kits/playbook/pb_icon/_icon.scss +1 -223
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +7 -99
- data/app/pb_kits/playbook/pb_icon/icon.rb +25 -25
- data/app/pb_kits/playbook/pb_nav/_nav_item.test.js +2 -2
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.tsx +8 -23
- data/app/pb_kits/playbook/tokens/_titles.scss +4 -4
- data/app/pb_kits/playbook/tokens/_typography.scss +10 -10
- data/dist/menu.yml +566 -472
- data/dist/playbook-rails.js +6 -6
- data/dist/reset.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +2 -2
@@ -55,74 +55,10 @@ const aliases: AliasesJson = aliasesJson;
|
|
55
55
|
|
56
56
|
|
57
57
|
const flipMap = {
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
none: ''
|
63
|
-
},
|
64
|
-
svg: {
|
65
|
-
horizontal: 'flip_horizontal',
|
66
|
-
vertical: 'flip_vertical',
|
67
|
-
both: 'flip_horizontal flip_vertical',
|
68
|
-
none: ''
|
69
|
-
}
|
70
|
-
}
|
71
|
-
const pulseMap = {
|
72
|
-
fa: 'fa-pulse',
|
73
|
-
svg: 'pulse'
|
74
|
-
}
|
75
|
-
const spinMap = {
|
76
|
-
fa: 'fa-spin',
|
77
|
-
svg: 'spin'
|
78
|
-
}
|
79
|
-
const rotateMap = {
|
80
|
-
fa: {
|
81
|
-
90: 'fa-rotate-90',
|
82
|
-
180: 'fa-rotate-180',
|
83
|
-
270: 'fa-rotate-270'
|
84
|
-
},
|
85
|
-
svg: {
|
86
|
-
90: 'rotate_90',
|
87
|
-
180: 'rotate_180',
|
88
|
-
270: 'rotate_270'
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
const sizeMap = {
|
93
|
-
fa: {
|
94
|
-
"lg": "fa-lg",
|
95
|
-
"xs": "fa-xs",
|
96
|
-
"sm": "fa-sm",
|
97
|
-
"1x": "fa-1x",
|
98
|
-
"2x": "fa-2x",
|
99
|
-
"3x": "fa-3x",
|
100
|
-
"4x": "fa-4x",
|
101
|
-
"5x": "fa-5x",
|
102
|
-
"6x": "fa-6x",
|
103
|
-
"7x": "fa-7x",
|
104
|
-
"8x": "fa-8x",
|
105
|
-
"9x": "fa-9x",
|
106
|
-
"10x": "fa-10x",
|
107
|
-
"": ""
|
108
|
-
},
|
109
|
-
svg: {
|
110
|
-
"lg": "svg_lg",
|
111
|
-
"xs": "svg_xs",
|
112
|
-
"sm": "svg_sm",
|
113
|
-
"1x": "svg_1x",
|
114
|
-
"2x": "svg_2x",
|
115
|
-
"3x": "svg_3x",
|
116
|
-
"4x": "svg_4x",
|
117
|
-
"5x": "svg_5x",
|
118
|
-
"6x": "svg_6x",
|
119
|
-
"7x": "svg_7x",
|
120
|
-
"8x": "svg_8x",
|
121
|
-
"9x": "svg_9x",
|
122
|
-
"10x": "svg_10x",
|
123
|
-
"": ""
|
124
|
-
}
|
125
|
-
|
58
|
+
horizontal: 'fa-flip-horizontal',
|
59
|
+
vertical: 'fa-flip-vertical',
|
60
|
+
both: 'fa-flip-horizontal fa-flip-vertical',
|
61
|
+
none: ""
|
126
62
|
}
|
127
63
|
|
128
64
|
declare global {
|
@@ -194,44 +130,16 @@ const Icon = (props: IconProps) => {
|
|
194
130
|
}
|
195
131
|
}
|
196
132
|
|
197
|
-
const
|
198
|
-
|
199
|
-
let classes = classnames(
|
133
|
+
const classes = classnames(
|
134
|
+
flipMap[flip],
|
200
135
|
(!iconElement && !customIcon) ? 'pb_icon_kit' : '',
|
201
136
|
(iconElement || customIcon) ? 'pb_custom_icon' : fontStyle,
|
202
137
|
iconElement ? 'svg-inline--fa' : '',
|
203
|
-
|
138
|
+
faClasses,
|
204
139
|
globalProps(props),
|
205
140
|
className
|
206
141
|
)
|
207
142
|
|
208
|
-
const transformClasses = classnames(
|
209
|
-
flip ? flipMap[isFA ? 'fa' : 'svg'][flip] : null,
|
210
|
-
pulse ? pulseMap[isFA ? 'fa' : 'svg'] : null,
|
211
|
-
rotation ? rotateMap[isFA ? 'fa' : 'svg'][rotation] : null,
|
212
|
-
spin ? spinMap[isFA ? 'fa' : 'svg'] : null,
|
213
|
-
size ? sizeMap[isFA ? 'fa' : 'svg'][size] : null,
|
214
|
-
border ? isFA ? 'fa-border' : 'svg_border' : null,
|
215
|
-
fixedWidth ? isFA ? 'fa-fw' : 'svg_fw' : null,
|
216
|
-
inverse ? isFA ? 'fa-inverse' : 'svg_inverse' : null,
|
217
|
-
listItem ? isFA ? 'fa-li' : 'svg_li' : null,
|
218
|
-
pull ? isFA ? `fa-pull-${pull}` : `pull_${pull}` : null,
|
219
|
-
)
|
220
|
-
classes += ` ${transformClasses}`
|
221
|
-
|
222
|
-
if (isFA) {
|
223
|
-
const faClassList = {
|
224
|
-
'fa-border': border,
|
225
|
-
'fa-fw': (iconElement) ? false : fixedWidth,
|
226
|
-
'fa-inverse': inverse,
|
227
|
-
'fa-li': listItem,
|
228
|
-
[`fa-${size}`]: size,
|
229
|
-
[`fa-pull-${pull}`]: pull,
|
230
|
-
}
|
231
|
-
faClassList[`fa-${icon}`] = icon as string
|
232
|
-
classes += ` ${classnames(faClassList)}`
|
233
|
-
}
|
234
|
-
|
235
143
|
const classesEmoji = classnames(
|
236
144
|
'pb_icon_kit_emoji',
|
237
145
|
globalProps(props),
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Style/HashLikeCase
|
4
|
+
|
3
5
|
require "open-uri"
|
4
6
|
require "json"
|
5
7
|
|
@@ -37,8 +39,6 @@ module Playbook
|
|
37
39
|
prop :spin, type: Playbook::Props::Boolean,
|
38
40
|
default: false
|
39
41
|
|
40
|
-
ALIASES = JSON.parse(File.read(Playbook::Engine.root.join("app/pb_kits/playbook/pb_icon/icon_aliases.json")))["aliases"].freeze
|
41
|
-
|
42
42
|
def valid_emoji?
|
43
43
|
emoji_regex = /\p{Emoji}/
|
44
44
|
emoji_regex.match?(icon)
|
@@ -80,6 +80,14 @@ module Playbook
|
|
80
80
|
)
|
81
81
|
end
|
82
82
|
|
83
|
+
def icon_alias_map
|
84
|
+
return unless Rails.application.config.respond_to?(:icon_alias_path)
|
85
|
+
|
86
|
+
base_path = Rails.application.config.icon_alias_path
|
87
|
+
json = File.read(Rails.root.join(base_path))
|
88
|
+
JSON.parse(json)["aliases"].freeze
|
89
|
+
end
|
90
|
+
|
83
91
|
def asset_path
|
84
92
|
return unless Rails.application.config.respond_to?(:icon_path)
|
85
93
|
|
@@ -109,7 +117,7 @@ module Playbook
|
|
109
117
|
private
|
110
118
|
|
111
119
|
def resolve_alias(icon)
|
112
|
-
aliases =
|
120
|
+
aliases = icon_alias_map[icon]
|
113
121
|
return icon unless aliases
|
114
122
|
|
115
123
|
if aliases.is_a?(Array)
|
@@ -129,13 +137,11 @@ module Playbook
|
|
129
137
|
end
|
130
138
|
|
131
139
|
def border_class
|
132
|
-
|
133
|
-
border ? prefix : nil
|
140
|
+
border ? "fa-border" : nil
|
134
141
|
end
|
135
142
|
|
136
143
|
def fixed_width_class
|
137
|
-
|
138
|
-
fixed_width ? prefix : nil
|
144
|
+
fixed_width ? "fa-fw" : nil
|
139
145
|
end
|
140
146
|
|
141
147
|
def icon_class
|
@@ -143,45 +149,38 @@ module Playbook
|
|
143
149
|
end
|
144
150
|
|
145
151
|
def inverse_class
|
146
|
-
|
147
|
-
inverse ? class_name : nil
|
152
|
+
inverse ? "fa-inverse" : nil
|
148
153
|
end
|
149
154
|
|
150
155
|
def list_item_class
|
151
|
-
|
152
|
-
list_item ? class_name : nil
|
156
|
+
list_item ? "fa-li" : nil
|
153
157
|
end
|
154
158
|
|
155
159
|
def flip_class
|
156
|
-
prefix = is_svg? ? "flip_" : "fa-flip-"
|
157
160
|
case flip
|
158
161
|
when "horizontal"
|
159
|
-
"
|
162
|
+
"fa-flip-horizontal"
|
160
163
|
when "vertical"
|
161
|
-
"
|
164
|
+
"fa-flip-vertical"
|
162
165
|
when "both"
|
163
|
-
"
|
166
|
+
"fa-flip-horizontal fa-flip-vertical"
|
164
167
|
end
|
165
168
|
end
|
166
169
|
|
167
170
|
def pull_class
|
168
|
-
|
169
|
-
pull ? class_name : nil
|
171
|
+
pull ? "fa-pull-#{pull}" : nil
|
170
172
|
end
|
171
173
|
|
172
174
|
def pulse_class
|
173
|
-
|
174
|
-
pulse ? class_name : nil
|
175
|
+
pulse ? "fa-pulse" : nil
|
175
176
|
end
|
176
177
|
|
177
178
|
def rotation_class
|
178
|
-
|
179
|
-
rotation ? class_name : nil
|
179
|
+
rotation ? "fa-rotate-#{rotation}" : nil
|
180
180
|
end
|
181
181
|
|
182
182
|
def size_class
|
183
|
-
|
184
|
-
size ? class_name : nil
|
183
|
+
size ? "fa-#{size}" : nil
|
185
184
|
end
|
186
185
|
|
187
186
|
def font_style_class
|
@@ -189,9 +188,10 @@ module Playbook
|
|
189
188
|
end
|
190
189
|
|
191
190
|
def spin_class
|
192
|
-
|
193
|
-
spin ? class_name : nil
|
191
|
+
spin ? "fa-spin" : nil
|
194
192
|
end
|
195
193
|
end
|
196
194
|
end
|
197
195
|
end
|
196
|
+
|
197
|
+
# rubocop:enable Style/HashLikeCase
|
@@ -95,11 +95,11 @@ test('should not have a left border', () => {
|
|
95
95
|
test('should have a right icon', () => {
|
96
96
|
render(<NavDefault iconRight="angle-down" />)
|
97
97
|
const kit = screen.getByTestId(itemTestId)
|
98
|
-
expect(kit).toContainHTML('<i class="pb_icon_kit far
|
98
|
+
expect(kit).toContainHTML('<i class="pb_icon_kit far fa-fw fa-angle-down pb_nav_list_item_icon_right" />')
|
99
99
|
})
|
100
100
|
|
101
101
|
test('should have a left icon', () => {
|
102
102
|
render(<NavDefault iconLeft="users-class" />)
|
103
103
|
const kit = screen.getByTestId(itemTestId)
|
104
|
-
expect(kit).toContainHTML('<i class="pb_icon_kit far
|
104
|
+
expect(kit).toContainHTML('<i class="pb_icon_kit far fa-fw fa-users-class pb_nav_list_item_icon_left" />')
|
105
105
|
})
|
@@ -86,33 +86,18 @@ const RichTextEditor = (props: RichTextEditorProps): React.ReactElement => {
|
|
86
86
|
const toolbarElement = element.parentElement.querySelector('trix-toolbar') as HTMLElement,
|
87
87
|
blockCodeButton = toolbarElement.querySelector('[data-trix-attribute=code]') as HTMLElement
|
88
88
|
|
89
|
+
// replace default trix "block code" button with "inline code" button
|
89
90
|
let inlineCodeButton = toolbarElement.querySelector('[data-trix-attribute=inlineCode]') as HTMLElement
|
90
|
-
if (!inlineCodeButton)
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
91
|
+
if (!inlineCodeButton) {
|
92
|
+
inlineCodeButton = blockCodeButton.cloneNode(true) as HTMLElement
|
93
|
+
blockCodeButton.hidden = true
|
94
|
+
// set button attributes
|
95
|
+
inlineCodeButton.dataset.trixAttribute = 'inlineCode'
|
96
|
+
blockCodeButton.insertAdjacentElement('afterend', inlineCodeButton)
|
97
|
+
}
|
95
98
|
|
96
99
|
if (toolbarBottom) editor.element.after(toolbarElement)
|
97
100
|
|
98
|
-
const getCodeFormattingType = (): string => {
|
99
|
-
if (editor.attributeIsActive('code')) return 'block'
|
100
|
-
if (editor.attributeIsActive('inlineCode')) return 'inline'
|
101
|
-
|
102
|
-
const range = editor.getSelectedRange()
|
103
|
-
if (range[0] == range[1]) return 'block'
|
104
|
-
|
105
|
-
const text = editor.getSelectedDocument().toString().trim()
|
106
|
-
return /\n/.test(text) ? 'block' : 'inline'
|
107
|
-
}
|
108
|
-
|
109
|
-
// DOM event listeners
|
110
|
-
element.addEventListener('trix-selection-change', () => {
|
111
|
-
const type = getCodeFormattingType()
|
112
|
-
blockCodeButton.hidden = type == 'inline'
|
113
|
-
inlineCodeButton.hidden = type == 'block'
|
114
|
-
})
|
115
|
-
|
116
101
|
focus
|
117
102
|
? (document.addEventListener('trix-focus', useFocus),
|
118
103
|
document.addEventListener('trix-blur', useFocus),
|
@@ -5,10 +5,11 @@
|
|
5
5
|
@mixin pb_title(
|
6
6
|
$fontSize: $heading_1,
|
7
7
|
$fontWeight: $lighter,
|
8
|
-
$lineHeight: $lh_tighter
|
8
|
+
$lineHeight: $lh_tighter,
|
9
|
+
$letterSpacing: $lspace_tight
|
9
10
|
){
|
10
11
|
font-size: $fontSize;
|
11
|
-
letter-spacing: $
|
12
|
+
letter-spacing: $letterSpacing;
|
12
13
|
font-weight: $fontWeight;
|
13
14
|
color: $text_lt_default;
|
14
15
|
margin: 0;
|
@@ -29,8 +30,7 @@
|
|
29
30
|
}
|
30
31
|
|
31
32
|
@mixin pb_title_4 {
|
32
|
-
@include pb_title($heading_4, $bolder);
|
33
|
-
letter-spacing: -0.03em;
|
33
|
+
@include pb_title($heading_4, $bolder, $letterSpacing: $lspace_normal);
|
34
34
|
}
|
35
35
|
|
36
36
|
@mixin pb_title_dark {
|
@@ -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;
|