playbook_ui 14.3.0.pre.rc.3 → 14.3.0.pre.rc.5
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_avatar_action_button/_avatar_action_button.scss +3 -3
- data/app/pb_kits/playbook/pb_badge/_badge.scss +2 -2
- data/app/pb_kits/playbook/pb_bread_crumbs/_bread_crumbs.scss +1 -1
- data/app/pb_kits/playbook/pb_button/_button.scss +1 -1
- data/app/pb_kits/playbook/pb_button_toolbar/_button_toolbar_mixins.scss +2 -2
- data/app/pb_kits/playbook/pb_circle_icon_button/_circle_icon_button.scss +1 -1
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_input_styles.scss +1 -1
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_overrides.scss +2 -2
- data/app/pb_kits/playbook/pb_date_range_inline/_date_range_inline.scss +4 -4
- data/app/pb_kits/playbook/pb_date_time_stacked/_date_time_stacked.scss +4 -4
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +1 -1
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +2 -2
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.scss +1 -1
- data/app/pb_kits/playbook/pb_label_value/_label_value.scss +1 -1
- data/app/pb_kits/playbook/pb_message/_message_mixins.scss +1 -1
- data/app/pb_kits/playbook/pb_multiple_users/_multiple_users.scss +1 -1
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.scss +3 -3
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +2 -2
- data/app/pb_kits/playbook/pb_phone_number_input/intlTelInput.scss +1290 -0
- data/app/pb_kits/playbook/pb_pill/_pill.scss +2 -2
- data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.scss +2 -2
- data/app/pb_kits/playbook/pb_radio/_radio.tsx +100 -50
- data/app/pb_kits/playbook/pb_radio/docs/_radio_children.jsx +56 -0
- data/app/pb_kits/playbook/pb_radio/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_radio/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_previewer_mixin.scss +49 -13
- data/app/pb_kits/playbook/pb_rich_text_editor/_rich_text_editor.scss +2 -14
- data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_styles.scss +23 -23
- data/app/pb_kits/playbook/pb_rich_text_editor/_trix_styles.scss +19 -27
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_preview.html.erb +21 -11
- data/app/pb_kits/playbook/pb_select/_select.scss +1 -1
- data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +3 -3
- data/app/pb_kits/playbook/pb_text_input/_text_input.scss +1 -1
- data/app/pb_kits/playbook/pb_textarea/_textarea.scss +1 -1
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.scss +4 -4
- data/app/pb_kits/playbook/pb_timeline/_timeline.scss +2 -2
- data/app/pb_kits/playbook/pb_timestamp/docs/_timestamp_elapsed.html.erb +2 -2
- data/app/pb_kits/playbook/pb_timestamp/timestamp.rb +46 -2
- data/app/pb_kits/playbook/pb_toggle/_toggle.scss +3 -3
- data/dist/chunks/{_typeahead-KAYMhDNO.js → _typeahead-C4E2LFD8.js} +3 -3
- data/dist/chunks/{_weekday_stacked-CTvE8Bet.js → _weekday_stacked-BxO6ii_q.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +5 -3
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
<%= pb_rails("rich_text_editor", props: { id: "content-preview-editor" }) %>
|
3
3
|
<div id="card-obfuscation" style="display:none">
|
4
|
-
<%= pb_rails("card", props: { margin_top: "md" }) do %>
|
4
|
+
<%= pb_rails("card", props: { margin_top: "md", max_width: "md", padding: "sm" }) do %>
|
5
5
|
<div id="content-preview" class="trix-content">
|
6
6
|
</div>
|
7
7
|
<% end %>
|
@@ -11,15 +11,25 @@
|
|
11
11
|
<% end %>
|
12
12
|
|
13
13
|
<script>
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
const previewArea = document.getElementById('content-preview');
|
19
|
-
const cardDiv = document.getElementById('card-obfuscation');
|
14
|
+
document.addEventListener('DOMContentLoaded', () => {
|
15
|
+
function handleButtonClick() {
|
16
|
+
const editorContainer = [...document.querySelectorAll('[data-react-props]')]
|
17
|
+
.find(element => element.getAttribute('data-react-props')?.includes('"id":"content-preview-editor"'))
|
20
18
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
const editorElement = editorContainer?.querySelector('trix-editor')
|
20
|
+
const inputId = editorElement?.getAttribute('input')
|
21
|
+
const inputElement = inputId && document.getElementById(inputId)
|
22
|
+
|
23
|
+
const editorContent = inputElement?.value || ''
|
24
|
+
const previewArea = document.getElementById('content-preview')
|
25
|
+
const cardDiv = document.getElementById('card-obfuscation')
|
26
|
+
|
27
|
+
if (previewArea && cardDiv) {
|
28
|
+
previewArea.innerHTML = editorContent
|
29
|
+
cardDiv.style.display = 'block'
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
document.getElementById('preview-button')?.addEventListener('click', handleButtonClick)
|
34
|
+
})
|
25
35
|
</script>
|
@@ -43,7 +43,7 @@ $pb_selectable_card_border: 2px;
|
|
43
43
|
align-items: center;
|
44
44
|
height: $pb_selectable_card_indicator_size;
|
45
45
|
width: $pb_selectable_card_indicator_size;
|
46
|
-
border-radius:
|
46
|
+
border-radius: $pb_selectable_card_indicator_size/2 + $pb_selectable_card_border/2;
|
47
47
|
border-width: $pb_selectable_card_border;
|
48
48
|
border-style: solid;
|
49
49
|
border-color: $white;
|
@@ -52,8 +52,8 @@ $pb_selectable_card_border: 2px;
|
|
52
52
|
font-size: $font_smaller;
|
53
53
|
text-align: center;
|
54
54
|
position: absolute;
|
55
|
-
top: -(
|
56
|
-
right: -(
|
55
|
+
top: -($pb_selectable_card_indicator_size/2);
|
56
|
+
right: -($pb_selectable_card_indicator_size/2);
|
57
57
|
opacity: 0;
|
58
58
|
}
|
59
59
|
}
|
@@ -22,14 +22,14 @@
|
|
22
22
|
display: flex;
|
23
23
|
align-items: center;
|
24
24
|
[class*=pb_time_range_inline_arrow] {
|
25
|
-
margin-left:
|
26
|
-
margin-right:
|
25
|
+
margin-left: $space_xs/2;
|
26
|
+
margin-right: $space_xs/2;
|
27
27
|
}
|
28
28
|
[class*=pb_time_range_inline_timezone] {
|
29
|
-
margin-left:
|
29
|
+
margin-left: $space_xs/2;
|
30
30
|
}
|
31
31
|
[class*=pb_time_range_inline_icon] {
|
32
|
-
margin-right:
|
32
|
+
margin-right: $space_xs/2;
|
33
33
|
}
|
34
34
|
}
|
35
35
|
}
|
@@ -4,9 +4,9 @@
|
|
4
4
|
@import "../tokens/typography";
|
5
5
|
|
6
6
|
$connector_width: 2px;
|
7
|
-
$icon_margin:
|
7
|
+
$icon_margin: $space_xs/2;
|
8
8
|
$icon_height: 28px;
|
9
|
-
$height_from_top:
|
9
|
+
$height_from_top: $icon_height/2 - $connector_width/2;
|
10
10
|
|
11
11
|
@mixin pb_timeline_line_solid($width, $height, $margin) {
|
12
12
|
width: $width;
|
@@ -8,7 +8,7 @@
|
|
8
8
|
<br>
|
9
9
|
|
10
10
|
<%= pb_rails("timestamp", props: {
|
11
|
-
timestamp: DateTime.now,
|
11
|
+
timestamp: DateTime.now - 3.months,
|
12
12
|
variant: "elapsed",
|
13
13
|
show_user: false
|
14
14
|
}) %>
|
@@ -16,7 +16,7 @@
|
|
16
16
|
<br>
|
17
17
|
|
18
18
|
<%= pb_rails("timestamp", props: {
|
19
|
-
timestamp: DateTime.now,
|
19
|
+
timestamp: DateTime.now - 320.days,
|
20
20
|
variant: "elapsed",
|
21
21
|
show_user: false,
|
22
22
|
hide_updated: true
|
@@ -27,6 +27,18 @@ module Playbook
|
|
27
27
|
values: %w[default elapsed updated],
|
28
28
|
default: "default"
|
29
29
|
|
30
|
+
# Variables to use with pb_time_ago method
|
31
|
+
SECS_FORTY_FIVE = 45
|
32
|
+
SECS_PER_MIN = 60
|
33
|
+
SECS_PER_HOUR = 60 * SECS_PER_MIN # 3,600 seconds
|
34
|
+
SECS_PER_DAY = 24 * SECS_PER_HOUR # 86,400 seconds
|
35
|
+
SECS_PER_WEEK = 7 * SECS_PER_DAY # 604,800 seconds
|
36
|
+
SECS_PER_26 = 26 * SECS_PER_DAY # 26 days = 2,246,400 seconds
|
37
|
+
SECS_PER_MONTH = 4 * SECS_PER_WEEK # 2,419,200 seconds
|
38
|
+
SECS_PER_YEAR = 12 * SECS_PER_MONTH # 29,030,400 seconds
|
39
|
+
SECS_PER_320 = 320 * SECS_PER_DAY # 320 days = 27,648,000 seconds
|
40
|
+
SECS_PER_CENT = 100 * SECS_PER_YEAR # 3,153,600,000 seconds
|
41
|
+
|
30
42
|
def classname
|
31
43
|
generate_classname("pb_timestamp_kit", variant_class, align)
|
32
44
|
end
|
@@ -73,12 +85,44 @@ module Playbook
|
|
73
85
|
|
74
86
|
def format_elapsed_string
|
75
87
|
user_string = show_user ? " by #{text}" : ""
|
76
|
-
datetime_string = " #{
|
88
|
+
datetime_string = " #{pb_time_ago(pb_date_time.convert_to_timestamp)} ago"
|
89
|
+
datetime_string[1] = hide_updated ? datetime_string[1].upcase : datetime_string[1]
|
77
90
|
updated_string = hide_updated ? "" : "Last updated"
|
78
|
-
|
79
91
|
"#{updated_string}#{user_string}#{datetime_string}"
|
80
92
|
end
|
81
93
|
|
94
|
+
def pb_time_ago(value)
|
95
|
+
time_ago = DateTime.now.to_i - value.to_i
|
96
|
+
case time_ago
|
97
|
+
when (0...SECS_FORTY_FIVE)
|
98
|
+
"a few seconds"
|
99
|
+
when (SECS_FORTY_FIVE...SECS_PER_MIN)
|
100
|
+
"a minute"
|
101
|
+
when (SECS_PER_MIN...SECS_PER_HOUR)
|
102
|
+
time = time_ago / SECS_PER_MIN
|
103
|
+
time == 1 ? "a minute" : "#{time_ago / SECS_PER_MIN} minutes"
|
104
|
+
when (SECS_PER_HOUR...SECS_PER_DAY)
|
105
|
+
time = time_ago / SECS_PER_HOUR
|
106
|
+
time == 1 ? "an hour" : "#{time_ago / SECS_PER_HOUR} hours"
|
107
|
+
when (SECS_PER_DAY...SECS_PER_WEEK)
|
108
|
+
time = time_ago / SECS_PER_DAY
|
109
|
+
time == 1 ? "a day" : "#{time_ago / SECS_PER_DAY} days"
|
110
|
+
when (SECS_PER_WEEK...SECS_PER_26)
|
111
|
+
time = time_ago / SECS_PER_WEEK
|
112
|
+
time == 1 ? "a week" : "#{time_ago / SECS_PER_WEEK} weeks"
|
113
|
+
when (SECS_PER_26...SECS_PER_MONTH)
|
114
|
+
"a month"
|
115
|
+
when (SECS_PER_MONTH...SECS_PER_320)
|
116
|
+
time = time_ago / SECS_PER_MONTH
|
117
|
+
time == 1 ? "a month" : "#{time_ago / SECS_PER_MONTH} months"
|
118
|
+
when (SECS_PER_320...SECS_PER_YEAR)
|
119
|
+
"a year"
|
120
|
+
when (SECS_PER_YEAR...SECS_PER_CENT)
|
121
|
+
time = time_ago / SECS_PER_YEAR
|
122
|
+
time == 1 ? "a year" : "#{time_ago / SECS_PER_YEAR} years"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
82
126
|
def datetime_or_text
|
83
127
|
timestamp ? format_datetime_string : text
|
84
128
|
end
|
@@ -8,7 +8,7 @@ $transition: .2s ease-in-out;
|
|
8
8
|
[class^=pb_toggle_kit] {
|
9
9
|
position: relative;
|
10
10
|
$width: 44px;
|
11
|
-
$height:
|
11
|
+
$height: $width / 2;
|
12
12
|
$border_success: 3px solid $color_checkbox_success;
|
13
13
|
$border_default: 3px solid $color_checkbox_default;
|
14
14
|
|
@@ -27,7 +27,7 @@ $transition: .2s ease-in-out;
|
|
27
27
|
&:after {
|
28
28
|
transition: $transition;
|
29
29
|
content: "";
|
30
|
-
width:
|
30
|
+
width: $width / 2 - 4px;
|
31
31
|
height: $height - 4px;
|
32
32
|
background-color: $color_checkbox_default;
|
33
33
|
border-radius: 50%;
|
@@ -68,7 +68,7 @@ $transition: .2s ease-in-out;
|
|
68
68
|
background-color: $color_checkbox_success;
|
69
69
|
|
70
70
|
&:after {
|
71
|
-
left:
|
71
|
+
left: $width / 2 + 2px;
|
72
72
|
background-color: $white;
|
73
73
|
}
|
74
74
|
}
|