playbook_ui 14.0.0 → 14.1.0.pre.alpha.PA1477timestampkit3601
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/_playbook.scss +2 -0
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +5 -2
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +24 -20
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +17 -12
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +89 -4
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +5 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.html.erb +1 -1
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +30 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.jsx +67 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_responsive.md +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_avatar/_avatar.scss +0 -30
- data/app/pb_kits/playbook/pb_avatar/_avatar.tsx +19 -1
- data/app/pb_kits/playbook/pb_avatar/avatar.rb +44 -1
- data/app/pb_kits/playbook/pb_avatar/avatar.test.js +17 -0
- data/app/pb_kits/playbook/pb_badge/_badge.scss +9 -0
- data/app/pb_kits/playbook/pb_badge/_badge.tsx +8 -3
- data/app/pb_kits/playbook/pb_badge/badge.rb +1 -1
- data/app/pb_kits/playbook/pb_badge/badge.test.js +17 -11
- data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.html.erb +13 -0
- data/app/pb_kits/playbook/pb_badge/docs/_badge_notification.jsx +31 -12
- data/app/pb_kits/playbook/pb_button/_button.tsx +4 -1
- data/app/pb_kits/playbook/pb_button/button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_button/button.rb +4 -0
- data/app/pb_kits/playbook/pb_date_picker/docs/_description.md +3 -1
- data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +2 -2
- data/app/pb_kits/playbook/pb_dialog/_close_icon.tsx +5 -1
- data/app/pb_kits/playbook/pb_dialog/_dialog.tsx +3 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.test.jsx +20 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -1
- data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +4 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_default.jsx +1 -5
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.jsx +46 -0
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_dialog/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_filter/filter.rb +1 -1
- data/app/pb_kits/playbook/pb_fixed_confirmation_toast/_fixed_confirmation_toast.scss +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -0
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -0
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +43 -25
- data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +6 -2
- data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -2
- data/app/pb_kits/playbook/pb_form_pill/form_pill.html.erb +4 -4
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +4 -0
- data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.scss +3 -0
- data/app/pb_kits/playbook/pb_gantt_chart/_gantt_chart.tsx +72 -0
- data/app/pb_kits/playbook/pb_gantt_chart/docs/_gantt_chart_default.jsx +53 -0
- data/app/pb_kits/playbook/pb_gantt_chart/docs/example.yml +7 -0
- data/app/pb_kits/playbook/pb_gantt_chart/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_gantt_chart/gantt_chart.test.jsx +19 -0
- data/app/pb_kits/playbook/pb_icon/_icon.tsx +4 -1
- data/app/pb_kits/playbook/pb_icon/icon.rb +2 -0
- data/app/pb_kits/playbook/pb_icon_circle/_icon_circle.tsx +2 -1
- data/app/pb_kits/playbook/pb_icon_circle/icon_circle.rb +2 -2
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.scss +0 -11
- data/app/pb_kits/playbook/pb_icon_stat_value/_icon_stat_value.tsx +3 -2
- data/app/pb_kits/playbook/pb_icon_stat_value/docs/_icon_stat_value_color.html.erb +1 -0
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.rb +2 -2
- data/app/pb_kits/playbook/pb_icon_stat_value/icon_stat_value.test.js +5 -4
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +0 -2
- data/app/pb_kits/playbook/pb_nav/_horizontal_nav.scss +1 -1
- data/app/pb_kits/playbook/pb_online_status/_online_status.scss +52 -5
- data/app/pb_kits/playbook/pb_online_status/_online_status.tsx +6 -1
- data/app/pb_kits/playbook/pb_online_status/docs/_online_status_no_border.html.erb +1 -0
- data/app/pb_kits/playbook/pb_online_status/docs/_online_status_no_border.jsx +14 -0
- data/app/pb_kits/playbook/pb_online_status/docs/_online_status_size.html.erb +3 -0
- data/app/pb_kits/playbook/pb_online_status/docs/_online_status_size.jsx +25 -0
- data/app/pb_kits/playbook/pb_online_status/docs/example.yml +6 -2
- data/app/pb_kits/playbook/pb_online_status/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_online_status/online_status.rb +11 -1
- data/app/pb_kits/playbook/pb_online_status/online_status.test.js +31 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_toggle.html.erb +61 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_toggle.jsx +70 -0
- data/app/pb_kits/playbook/pb_overlay/docs/_overlay_toggle.md +1 -0
- data/app/pb_kits/playbook/pb_overlay/docs/example.yml +4 -2
- data/app/pb_kits/playbook/pb_overlay/docs/index.js +1 -0
- data/app/pb_kits/playbook/pb_pagination/_pagination.scss +49 -13
- data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +164 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +19 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default_react.md +1 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +62 -0
- data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +1 -0
- data/app/pb_kits/playbook/pb_pagination/docs/data.js +23 -0
- data/app/pb_kits/playbook/pb_pagination/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_pagination/docs/index.js +2 -0
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.scss +0 -7
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +10 -5
- data/app/pb_kits/playbook/pb_rich_text_editor/_previewer_mixin.scss +132 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/_tiptap_styles.scss +50 -76
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_preview.jsx +73 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +2 -1
- data/app/pb_kits/playbook/pb_star_rating/_star_rating.scss +83 -6
- data/app/pb_kits/playbook/pb_star_rating/docs/example.yml +3 -1
- data/app/pb_kits/playbook/pb_star_rating/index.js +128 -22
- data/app/pb_kits/playbook/pb_star_rating/star_rating.html.erb +5 -3
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +19 -2
- data/app/pb_kits/playbook/pb_star_rating/stars/utils.tsx +5 -1
- data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_display.tsx +0 -2
- data/app/pb_kits/playbook/pb_star_rating/subcomponents/_star_rating_interactive.tsx +50 -22
- data/app/pb_kits/playbook/pb_table/_table.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/index.ts +4 -4
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_cell.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_head.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_header.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -1
- data/app/pb_kits/playbook/pb_table/table.test.js +2 -0
- data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +1 -1
- data/app/pb_kits/playbook/pb_text_input/docs/_text_input_default.jsx +1 -1
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +45 -27
- data/app/pb_kits/playbook/pb_textarea/index.ts +3 -3
- data/app/pb_kits/playbook/pb_time/_time.tsx +15 -11
- data/app/pb_kits/playbook/pb_time/time.html.erb +3 -3
- data/app/pb_kits/playbook/pb_time/time.rb +4 -0
- data/app/pb_kits/playbook/pb_time_range_inline/_time_range_inline.tsx +1 -1
- data/app/pb_kits/playbook/pb_timeline/_item.tsx +1 -1
- data/app/pb_kits/playbook/pb_timeline/_timeline.tsx +1 -1
- 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_title_detail/_title_detail.tsx +10 -10
- data/app/pb_kits/playbook/pb_toggle/_toggle.tsx +1 -1
- data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +2 -2
- data/app/pb_kits/playbook/pb_treemap_chart/_treemap_chart.tsx +1 -2
- data/app/pb_kits/playbook/pb_treemap_chart/treemapChart.test.js +2 -0
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +2 -2
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_multi_kit.html.erb +1 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +1 -0
- data/app/pb_kits/playbook/pb_user/_user.tsx +1 -1
- data/app/pb_kits/playbook/pb_user_badge/_user_badge.tsx +6 -6
- data/app/pb_kits/playbook/pb_user_badge/badges/million-dollar.tsx +236 -235
- data/app/pb_kits/playbook/pb_user_badge/badges/veteran.tsx +1 -1
- data/app/pb_kits/playbook/pb_walkthrough/_walkthrough.tsx +68 -63
- data/app/pb_kits/playbook/pb_weekday_stacked/_weekday_stacked.tsx +1 -1
- data/app/pb_kits/playbook/tokens/_container.scss +21 -0
- data/app/pb_kits/playbook/utilities/_min_width.scss +45 -0
- data/app/pb_kits/playbook/utilities/_positioning.scss +26 -15
- data/app/pb_kits/playbook/utilities/globalPropNames.mjs +1 -0
- data/app/pb_kits/playbook/utilities/globalProps.ts +20 -3
- data/app/pb_kits/playbook/utilities/icons/allicons.tsx +59 -0
- data/app/pb_kits/playbook/utilities/icons/clock.svg +9 -0
- data/app/pb_kits/playbook/utilities/icons/spinner.svg +3 -0
- data/app/pb_kits/playbook/utilities/icons/times.svg +3 -0
- data/dist/chunks/_typeahead-Cq7RLPBA.js +22 -0
- data/dist/chunks/_weekday_stacked-Cykj5kLZ.js +45 -0
- data/dist/chunks/{lib-Bf_E03gc.js → lib-DErGXNy3.js} +2 -2
- data/dist/chunks/{pb_form_validation-D0dhqeN2.js → pb_form_validation-BC6kh7Hu.js} +1 -1
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +4 -0
- 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/classnames.rb +1 -0
- data/lib/playbook/spacing.rb +31 -2
- data/lib/playbook/version.rb +2 -2
- metadata +44 -13
- data/app/pb_kits/playbook/pb_online_status/_online_status_mixins.scss +0 -32
- data/dist/chunks/_typeahead-COUJ88EA.js +0 -22
- data/dist/chunks/_weekday_stacked-BAkwel5p.js +0 -45
- /data/app/pb_kits/playbook/pb_pagination/docs/{_pagination_default.md → _pagination_default_rails.md} +0 -0
@@ -0,0 +1,132 @@
|
|
1
|
+
@import "../tokens/border_radius";
|
2
|
+
@import "../tokens/colors";
|
3
|
+
@import "../tokens/spacing";
|
4
|
+
@import "../tokens/typography";
|
5
|
+
|
6
|
+
@mixin preview_first_child {
|
7
|
+
:first-child {
|
8
|
+
margin-top: 0;
|
9
|
+
}
|
10
|
+
}
|
11
|
+
|
12
|
+
@mixin preview_p {
|
13
|
+
margin: 1rem 0 0 0;
|
14
|
+
min-height: 1rem;
|
15
|
+
}
|
16
|
+
|
17
|
+
@mixin preview_code {
|
18
|
+
font-family: monospace;
|
19
|
+
background: $bg_light;
|
20
|
+
padding: 0.1rem 0.3rem;
|
21
|
+
box-shadow: 0 2px 10px $shadow;
|
22
|
+
border-radius: 0.25rem;
|
23
|
+
overflow: hidden;
|
24
|
+
}
|
25
|
+
|
26
|
+
@mixin preview_pre_codeblock {
|
27
|
+
display: inline-block;
|
28
|
+
width: 100%;
|
29
|
+
vertical-align: top;
|
30
|
+
font-family: monospace;
|
31
|
+
font-size: 0.9em;
|
32
|
+
padding: 0.5em;
|
33
|
+
overflow-x: auto;
|
34
|
+
background: $bg_dark;
|
35
|
+
padding: $space_sm;
|
36
|
+
border-radius: $border_rad_heaviest;
|
37
|
+
margin: 1.5rem 0 2rem 0;
|
38
|
+
|
39
|
+
code {
|
40
|
+
background: transparent !important;
|
41
|
+
box-shadow: none;
|
42
|
+
border: 0;
|
43
|
+
color: #faf6e4;
|
44
|
+
}
|
45
|
+
}
|
46
|
+
|
47
|
+
@mixin preview_a {
|
48
|
+
color: $primary;
|
49
|
+
border-bottom: 1px solid $primary;
|
50
|
+
&:hover {
|
51
|
+
color: $text_lt_default;
|
52
|
+
border-bottom: 1px solid $text_lt_default;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
|
56
|
+
@mixin preview_blockquote {
|
57
|
+
font-size: $font_larger;
|
58
|
+
padding: $space_sm $space_md;
|
59
|
+
font-style: italic;
|
60
|
+
margin: 1rem 0 0 0;
|
61
|
+
p {
|
62
|
+
margin: 0;
|
63
|
+
}
|
64
|
+
}
|
65
|
+
|
66
|
+
@mixin preview_h1 {
|
67
|
+
font-size: $text_largest;
|
68
|
+
line-height: $text_larger;
|
69
|
+
font-weight: $bolder;
|
70
|
+
letter-spacing: $lspace_tight;
|
71
|
+
margin: 2.1rem 0 0 0;
|
72
|
+
}
|
73
|
+
|
74
|
+
@mixin preview_h2 {
|
75
|
+
font-size: $text_larger;
|
76
|
+
line-height: $text_larger;
|
77
|
+
font-weight: $bolder;
|
78
|
+
letter-spacing: $lspace_tight;
|
79
|
+
margin: 1.9rem 0 0 0;
|
80
|
+
}
|
81
|
+
|
82
|
+
@mixin preview_h3 {
|
83
|
+
font-size: $text_large;
|
84
|
+
line-height: $text_large;
|
85
|
+
font-weight: $bolder;
|
86
|
+
letter-spacing: $lspace_tight;
|
87
|
+
margin: 1.7rem 0 0 0;
|
88
|
+
}
|
89
|
+
|
90
|
+
@mixin preview_smaller_headings {
|
91
|
+
font-size: $text_base;
|
92
|
+
line-height: $text_base;
|
93
|
+
letter-spacing: $lspace_tight;
|
94
|
+
font-weight: $bolder;
|
95
|
+
margin: 1rem 0 0 0;
|
96
|
+
}
|
97
|
+
|
98
|
+
@mixin preview_hr {
|
99
|
+
margin: 2.2rem 0;
|
100
|
+
box-sizing: content-box;
|
101
|
+
overflow: hidden;
|
102
|
+
background: transparent;
|
103
|
+
border-bottom: 1px solid $transparent;
|
104
|
+
height: 1px;
|
105
|
+
padding: 0;
|
106
|
+
background-color: $border_light;
|
107
|
+
border: 0;
|
108
|
+
}
|
109
|
+
|
110
|
+
@mixin preview_ol {
|
111
|
+
margin: 1rem 0 0 0;
|
112
|
+
padding-left: $space_md;
|
113
|
+
list-style: decimal;
|
114
|
+
li {
|
115
|
+
margin: 2px 0;
|
116
|
+
p {
|
117
|
+
margin: 0;
|
118
|
+
}
|
119
|
+
}
|
120
|
+
}
|
121
|
+
|
122
|
+
@mixin preview_ul {
|
123
|
+
list-style-position: disc;
|
124
|
+
margin: 1rem 0 0 0;
|
125
|
+
padding-left: $space_md;
|
126
|
+
li {
|
127
|
+
margin: 2px 0;
|
128
|
+
p {
|
129
|
+
margin: 0;
|
130
|
+
}
|
131
|
+
}
|
132
|
+
}
|
@@ -6,6 +6,7 @@
|
|
6
6
|
@import "../tokens/typography";
|
7
7
|
@import "../tokens/shadows";
|
8
8
|
@import "../tokens/transition";
|
9
|
+
@import "previewer_mixin";
|
9
10
|
|
10
11
|
[class^="pb_rich_text_editor_kit"] {
|
11
12
|
.toolbar_button {
|
@@ -85,109 +86,44 @@
|
|
85
86
|
}
|
86
87
|
|
87
88
|
code {
|
88
|
-
|
89
|
-
background: $bg_light;
|
90
|
-
padding: 0.1rem 0.3rem;
|
91
|
-
margin: 0 5px;
|
92
|
-
box-shadow: 0 2px 10px $shadow;
|
93
|
-
border-radius: 0.25rem;
|
94
|
-
overflow: hidden;
|
95
|
-
font-size: ($text_small - 1px);
|
89
|
+
@include preview_code;
|
96
90
|
}
|
97
91
|
|
98
92
|
pre {
|
99
|
-
|
100
|
-
padding: $space_sm;
|
101
|
-
border-radius: $border_rad_heaviest;
|
102
|
-
margin: 1.5rem 0 2rem 0;
|
103
|
-
code {
|
104
|
-
background: transparent;
|
105
|
-
box-shadow: none;
|
106
|
-
border: 0;
|
107
|
-
color: #faf6e4;
|
108
|
-
}
|
93
|
+
@include preview_pre_codeblock;
|
109
94
|
}
|
110
95
|
a {
|
111
|
-
|
112
|
-
border-bottom: 1px solid $primary;
|
113
|
-
&:hover {
|
114
|
-
color: $text_lt_default;
|
115
|
-
border-bottom: 1px solid $text_lt_default;
|
116
|
-
}
|
96
|
+
@include preview_a;
|
117
97
|
}
|
118
98
|
blockquote {
|
119
|
-
|
120
|
-
padding: $space_sm $space_md;
|
121
|
-
font-style: italic;
|
122
|
-
p {
|
123
|
-
margin: 0;
|
124
|
-
}
|
99
|
+
@include preview_blockquote;
|
125
100
|
}
|
126
101
|
&:focus-visible {
|
127
102
|
outline: unset;
|
128
103
|
@include transition_default;
|
129
104
|
}
|
130
105
|
h1 {
|
131
|
-
|
132
|
-
line-height: $text_larger;
|
133
|
-
font-weight: $bolder;
|
134
|
-
letter-spacing: $lspace_tight;
|
135
|
-
margin: 2.1rem 0 0 0;
|
106
|
+
@include preview_h1;
|
136
107
|
}
|
137
108
|
h2 {
|
138
|
-
|
139
|
-
line-height: $text_larger;
|
140
|
-
font-weight: $bolder;
|
141
|
-
letter-spacing: $lspace_tight;
|
142
|
-
margin: 1.9rem 0 0 0;
|
109
|
+
@include preview_h2;
|
143
110
|
}
|
144
111
|
h3 {
|
145
|
-
|
146
|
-
line-height: $text_large;
|
147
|
-
font-weight: $bolder;
|
148
|
-
letter-spacing: $lspace_tight;
|
149
|
-
margin: 1.7rem 0 0 0;
|
112
|
+
@include preview_h3;
|
150
113
|
}
|
151
114
|
h4,
|
152
115
|
h5,
|
153
116
|
h6 {
|
154
|
-
|
155
|
-
line-height: $text_base;
|
156
|
-
letter-spacing: $lspace_tight;
|
157
|
-
font-weight: $bolder;
|
117
|
+
@include preview_smaller_headings;
|
158
118
|
}
|
159
119
|
hr {
|
160
|
-
|
161
|
-
box-sizing: content-box;
|
162
|
-
overflow: hidden;
|
163
|
-
background: transparent;
|
164
|
-
border-bottom: 1px solid $transparent;
|
165
|
-
height: 1px;
|
166
|
-
padding: 0;
|
167
|
-
background-color: $border_light;
|
168
|
-
border: 0;
|
120
|
+
@include preview_hr;
|
169
121
|
}
|
170
122
|
ol {
|
171
|
-
|
172
|
-
padding-left: $space_md;
|
173
|
-
list-style: decimal;
|
174
|
-
li {
|
175
|
-
margin: 2px 0;
|
176
|
-
p {
|
177
|
-
margin: 0;
|
178
|
-
}
|
179
|
-
}
|
123
|
+
@include preview_ol;
|
180
124
|
}
|
181
125
|
ul {
|
182
|
-
|
183
|
-
margin: 1rem 0 0 0;
|
184
|
-
padding-left: $space_md;
|
185
|
-
li {
|
186
|
-
margin: 2px 0;
|
187
|
-
p {
|
188
|
-
margin: 0;
|
189
|
-
}
|
190
|
-
}
|
126
|
+
@include preview_ul;
|
191
127
|
}
|
192
128
|
}
|
193
129
|
}
|
@@ -233,3 +169,41 @@
|
|
233
169
|
}
|
234
170
|
}
|
235
171
|
}
|
172
|
+
.tiptap-content {
|
173
|
+
@include preview_first_child;
|
174
|
+
a {
|
175
|
+
@include preview_a;
|
176
|
+
}
|
177
|
+
blockquote {
|
178
|
+
@include preview_blockquote;
|
179
|
+
}
|
180
|
+
h1 {
|
181
|
+
@include preview_h1;
|
182
|
+
}
|
183
|
+
h2 {
|
184
|
+
@include preview_h2;
|
185
|
+
}
|
186
|
+
h3 {
|
187
|
+
@include preview_h3;
|
188
|
+
}
|
189
|
+
h4,
|
190
|
+
h5,
|
191
|
+
h6 {
|
192
|
+
@include preview_smaller_headings;
|
193
|
+
}
|
194
|
+
hr {
|
195
|
+
@include preview_hr;
|
196
|
+
}
|
197
|
+
ol {
|
198
|
+
@include preview_ol;
|
199
|
+
}
|
200
|
+
p {
|
201
|
+
@include preview_p;
|
202
|
+
}
|
203
|
+
pre {
|
204
|
+
@include preview_pre_codeblock;
|
205
|
+
}
|
206
|
+
ul {
|
207
|
+
@include preview_ul;
|
208
|
+
}
|
209
|
+
}
|
@@ -0,0 +1,73 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import { Button, Card, RichTextEditor } from 'playbook-ui'
|
3
|
+
import { useEditor, EditorContent } from "@tiptap/react"
|
4
|
+
import StarterKit from "@tiptap/starter-kit"
|
5
|
+
import Link from '@tiptap/extension-link'
|
6
|
+
|
7
|
+
|
8
|
+
const RichTextEditorAdvancedPreview = (props) => {
|
9
|
+
|
10
|
+
const editor = useEditor({
|
11
|
+
extensions: [
|
12
|
+
StarterKit,
|
13
|
+
Link
|
14
|
+
],
|
15
|
+
content: "Add text here, format it, and press \"Preview Output\" to see what your stylized output will look like on the page."
|
16
|
+
})
|
17
|
+
|
18
|
+
const [showPreview, setShowPreview] = useState(false)
|
19
|
+
const [previewText, setPreviewText] = useState(<div />)
|
20
|
+
|
21
|
+
const handleChange = () => {
|
22
|
+
if (editor) {
|
23
|
+
setPreviewText(editor.getHTML())
|
24
|
+
}
|
25
|
+
}
|
26
|
+
|
27
|
+
const handleClick = () => {
|
28
|
+
handleChange()
|
29
|
+
setShowPreview(true)
|
30
|
+
}
|
31
|
+
if (!editor) {
|
32
|
+
return null
|
33
|
+
}
|
34
|
+
|
35
|
+
|
36
|
+
return (
|
37
|
+
<div>
|
38
|
+
<RichTextEditor
|
39
|
+
advancedEditor={editor}
|
40
|
+
id="content-advanced-preview-editor"
|
41
|
+
onChange={handleChange}
|
42
|
+
{...props}
|
43
|
+
>
|
44
|
+
<EditorContent editor={editor}/>
|
45
|
+
</RichTextEditor>
|
46
|
+
{showPreview && (
|
47
|
+
<Card
|
48
|
+
marginTop="md"
|
49
|
+
maxWidth="md"
|
50
|
+
>
|
51
|
+
<div
|
52
|
+
className="tiptap-content"
|
53
|
+
// eslint-disable-next-line react/no-danger
|
54
|
+
dangerouslySetInnerHTML={{ __html: previewText }}
|
55
|
+
id="advanced-preview-content"
|
56
|
+
/>
|
57
|
+
</Card>
|
58
|
+
)}
|
59
|
+
{!showPreview && (
|
60
|
+
<div />
|
61
|
+
)}
|
62
|
+
<Button
|
63
|
+
id="preview-button"
|
64
|
+
marginTop="md"
|
65
|
+
onClick={handleClick}
|
66
|
+
text="Preview Output"
|
67
|
+
variant="secondary"
|
68
|
+
/>
|
69
|
+
</div>
|
70
|
+
)
|
71
|
+
}
|
72
|
+
|
73
|
+
export default RichTextEditorAdvancedPreview
|
@@ -9,4 +9,5 @@ export { default as RichTextEditorInline } from './_rich_text_editor_inline.jsx'
|
|
9
9
|
export { default as RichTextEditorPreview } from './_rich_text_editor_preview.jsx'
|
10
10
|
export { default as RichTextEditorAdvancedDefault } from './_rich_text_editor_advanced_default.jsx'
|
11
11
|
export { default as RichTextEditorMoreExtensions } from './_rich_text_editor_more_extensions.jsx'
|
12
|
-
export { default as RichTextEditorToolbarDisabled } from './_rich_text_editor_toolbar_disabled.jsx'
|
12
|
+
export { default as RichTextEditorToolbarDisabled } from './_rich_text_editor_toolbar_disabled.jsx'
|
13
|
+
export { default as RichTextEditorAdvancedPreview } from './_rich_text_editor_advanced_preview.jsx'
|
@@ -9,10 +9,10 @@
|
|
9
9
|
justify-content: flex-start;
|
10
10
|
|
11
11
|
path {
|
12
|
-
&.
|
12
|
+
&.subtle_star_dark {
|
13
13
|
fill: $text_dk_default;
|
14
14
|
}
|
15
|
-
&.
|
15
|
+
&.subtle_star_light {
|
16
16
|
fill: $text_lt_default;
|
17
17
|
}
|
18
18
|
&.outline_star_dark {
|
@@ -49,9 +49,10 @@
|
|
49
49
|
|
50
50
|
$star-styles: (
|
51
51
|
yellow_star: (color: $yellow),
|
52
|
-
|
53
|
-
|
54
|
-
|
52
|
+
primary_star_light: (color: $royal),
|
53
|
+
primary_star_dark: (color: $active_dark),
|
54
|
+
subtle_star_light: (color: $text_lt_default),
|
55
|
+
subtle_star_dark: (color: $text_dk_default),
|
55
56
|
empty_star_dark: (color: $border_dark),
|
56
57
|
empty_star_light: (color: $border_light),
|
57
58
|
outline_empty_star_dark: (color: transparent),
|
@@ -111,13 +112,89 @@
|
|
111
112
|
}
|
112
113
|
}
|
113
114
|
}
|
115
|
+
|
116
|
+
// Interactivity
|
117
|
+
path {
|
118
|
+
transition: fill 0.2s
|
119
|
+
}
|
120
|
+
// Rails selected styles
|
121
|
+
.interactive-star-icon {
|
122
|
+
cursor: pointer;
|
123
|
+
}
|
114
124
|
.yellow-star-selected {
|
115
125
|
color: $yellow;
|
116
126
|
}
|
117
127
|
.primary-star-selected {
|
118
128
|
color: $royal
|
119
129
|
}
|
120
|
-
.
|
130
|
+
.subtle-star-selected {
|
121
131
|
color: $text_lt_default;
|
122
132
|
}
|
133
|
+
&.dark {
|
134
|
+
.primary-star-selected {
|
135
|
+
color: $active_dark;
|
136
|
+
}
|
137
|
+
.subtle-star-selected {
|
138
|
+
color: $text_dk_default;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
// React selected styles
|
142
|
+
&.star-selected {
|
143
|
+
path {
|
144
|
+
animation: growColor 0.3s forwards;
|
145
|
+
}
|
146
|
+
.yellow-star-selected {
|
147
|
+
color: $yellow;
|
148
|
+
}
|
149
|
+
.primary-star-selected {
|
150
|
+
color: $royal;
|
151
|
+
}
|
152
|
+
.subtle-star-selected {
|
153
|
+
color: $text_lt_default;
|
154
|
+
}
|
155
|
+
&.dark {
|
156
|
+
.primary-star-selected {
|
157
|
+
color: $active_dark;
|
158
|
+
}
|
159
|
+
.subtle-star-selected {
|
160
|
+
color: $text_dk_default;
|
161
|
+
}
|
162
|
+
}
|
163
|
+
}
|
164
|
+
// Hover styles
|
165
|
+
.star-hovered {
|
166
|
+
path {
|
167
|
+
fill: mix($primary, $white, 20%);
|
168
|
+
}
|
169
|
+
}
|
170
|
+
&.dark{
|
171
|
+
.star-hovered {
|
172
|
+
path {
|
173
|
+
fill: mix($active_dark, $bg_dark, 50%);
|
174
|
+
}
|
175
|
+
}
|
176
|
+
}
|
177
|
+
// Focus styles
|
178
|
+
.pb_custom_icon {
|
179
|
+
&:focus {
|
180
|
+
outline: none;
|
181
|
+
}
|
182
|
+
&:focus-visible {
|
183
|
+
border-radius: 2px;
|
184
|
+
outline: 1px solid $primary;
|
185
|
+
outline-offset: 2px;
|
186
|
+
}
|
187
|
+
}
|
188
|
+
&.dark {
|
189
|
+
.pb_custom_icon {
|
190
|
+
&:focus {
|
191
|
+
outline: none;
|
192
|
+
}
|
193
|
+
&:focus-visible {
|
194
|
+
border-radius: 2px;
|
195
|
+
outline: 1px solid $active_dark;
|
196
|
+
outline-offset: 2px;
|
197
|
+
}
|
198
|
+
}
|
199
|
+
}
|
123
200
|
}
|
@@ -6,6 +6,7 @@ examples:
|
|
6
6
|
- star_rating_hide: Layout Options
|
7
7
|
- star_rating_number_config: Number Config
|
8
8
|
- star_rating_size_options: Size Options
|
9
|
+
- star_rating_interactive: Interactive
|
9
10
|
|
10
11
|
react:
|
11
12
|
- star_rating_default: Default
|
@@ -13,4 +14,5 @@ examples:
|
|
13
14
|
- star_rating_background_options: Background Options
|
14
15
|
- star_rating_hide: Layout Options
|
15
16
|
- star_rating_number_config: Number Config
|
16
|
-
- star_rating_size_options: Size Options
|
17
|
+
- star_rating_size_options: Size Options
|
18
|
+
- star_rating_interactive: Interactive
|
@@ -1,50 +1,156 @@
|
|
1
|
-
import PbEnhancedElement from "../pb_enhanced_element"
|
1
|
+
import PbEnhancedElement from "../pb_enhanced_element"
|
2
2
|
|
3
|
-
const
|
4
|
-
const
|
3
|
+
const STAR_RATING_WRAPPER_SELECTOR = "[data-pb-star-rating-wrapper]"
|
4
|
+
const STAR_RATING_SELECTOR = "[data-pb-star-rating]"
|
5
|
+
const STAR_RATING_INPUT_DATA_SELECTOR = "[data-pb-star-rating-input]"
|
5
6
|
|
6
7
|
export default class PbStarRating extends PbEnhancedElement {
|
7
8
|
static get selector() {
|
8
|
-
return
|
9
|
+
return STAR_RATING_WRAPPER_SELECTOR
|
9
10
|
}
|
10
11
|
|
11
12
|
connect() {
|
12
|
-
this.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
this.addEventListeners()
|
14
|
+
this.handleFormReset()
|
15
|
+
}
|
16
|
+
|
17
|
+
addEventListeners() {
|
18
|
+
this.element.querySelectorAll(STAR_RATING_SELECTOR).forEach(star => {
|
19
|
+
star.addEventListener("click", (event) => {
|
20
|
+
const clickedStarId = event.currentTarget.id
|
21
|
+
this.updateStarColors(clickedStarId)
|
22
|
+
this.updateHiddenInputValue(clickedStarId)
|
23
|
+
this.clearFormValidation()
|
24
|
+
})
|
25
|
+
|
26
|
+
star.addEventListener("mouseenter", (event) => {
|
27
|
+
const hoveredStarId = event.currentTarget.id
|
28
|
+
this.updateStarHoverColors(hoveredStarId)
|
29
|
+
})
|
30
|
+
|
31
|
+
star.addEventListener("mouseleave", () => {
|
32
|
+
this.removeStarHoverColors()
|
33
|
+
})
|
34
|
+
|
35
|
+
star.addEventListener("keydown", (event) => {
|
36
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
37
|
+
event.preventDefault()
|
38
|
+
this.handleStarClick(star.id)
|
39
|
+
}
|
40
|
+
})
|
41
|
+
})
|
42
|
+
}
|
43
|
+
|
44
|
+
handleStarClick(starId) {
|
45
|
+
this.updateStarColors(starId)
|
46
|
+
this.updateHiddenInputValue(starId)
|
17
47
|
}
|
18
48
|
|
19
49
|
updateStarColors(clickedStarId) {
|
20
|
-
const allStars =
|
50
|
+
const allStars = this.element.querySelectorAll(STAR_RATING_SELECTOR)
|
21
51
|
|
22
52
|
allStars.forEach(star => {
|
23
|
-
const starId = star.id
|
24
|
-
const icon = star.querySelector(".interactive-star-icon")
|
53
|
+
const starId = star.id
|
54
|
+
const icon = star.querySelector(".interactive-star-icon")
|
25
55
|
|
26
56
|
if (icon) {
|
27
57
|
if (starId <= clickedStarId) {
|
28
58
|
if (star.classList.contains("yellow_star")) {
|
29
|
-
icon.classList.add("yellow-star-selected")
|
30
|
-
} else if (star.classList.contains("
|
31
|
-
icon.classList.add("primary-star-selected")
|
32
|
-
} else if (star.classList.contains("
|
33
|
-
icon.classList.add("
|
59
|
+
icon.classList.add("yellow-star-selected")
|
60
|
+
} else if (star.classList.contains("primary_star_light")) {
|
61
|
+
icon.classList.add("primary-star-selected")
|
62
|
+
} else if (star.classList.contains("primary_star_dark")) {
|
63
|
+
icon.classList.add("primary-star-selected")
|
64
|
+
} else if (star.classList.contains("subtle_star_light")) {
|
65
|
+
icon.classList.add("subtle-star-selected")
|
66
|
+
} else if (star.classList.contains("subtle_star_dark")) {
|
67
|
+
icon.classList.add("subtle-star-selected")
|
34
68
|
} else {
|
35
|
-
icon.classList.add("yellow-star-selected")
|
69
|
+
icon.classList.add("yellow-star-selected")
|
36
70
|
}
|
37
71
|
} else {
|
38
|
-
icon.classList.remove("yellow-star-selected", "primary-star-selected", "
|
72
|
+
icon.classList.remove("yellow-star-selected", "primary-star-selected", "subtle-star-selected")
|
39
73
|
}
|
74
|
+
icon.classList.remove("star-hovered")
|
40
75
|
}
|
41
|
-
})
|
76
|
+
})
|
42
77
|
}
|
43
78
|
|
44
79
|
updateHiddenInputValue(value) {
|
45
|
-
const hiddenInput =
|
80
|
+
const hiddenInput = this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR)
|
46
81
|
if (hiddenInput) {
|
47
|
-
hiddenInput.value = value
|
82
|
+
hiddenInput.value = value
|
83
|
+
}
|
84
|
+
}
|
85
|
+
|
86
|
+
updateStarHoverColors(hoveredStarId) {
|
87
|
+
const allStars = this.element.querySelectorAll(STAR_RATING_SELECTOR)
|
88
|
+
|
89
|
+
allStars.forEach(star => {
|
90
|
+
const starId = star.id
|
91
|
+
const icon = star.querySelector(".interactive-star-icon")
|
92
|
+
|
93
|
+
if (icon) {
|
94
|
+
if (starId <= hoveredStarId) {
|
95
|
+
if (!icon.classList.contains("yellow-star-selected") &&
|
96
|
+
!icon.classList.contains("primary-star-selected") &&
|
97
|
+
!icon.classList.contains("subtle-star-selected")) {
|
98
|
+
icon.classList.add("star-hovered")
|
99
|
+
}
|
100
|
+
} else {
|
101
|
+
icon.classList.remove("star-hovered")
|
102
|
+
}
|
103
|
+
}
|
104
|
+
})
|
105
|
+
}
|
106
|
+
|
107
|
+
|
108
|
+
removeStarHoverColors() {
|
109
|
+
const allStars = this.element.querySelectorAll(STAR_RATING_SELECTOR)
|
110
|
+
|
111
|
+
allStars.forEach(star => {
|
112
|
+
const icon = star.querySelector(".interactive-star-icon")
|
113
|
+
if (icon) {
|
114
|
+
if (!icon.classList.contains("yellow-star-selected") &&
|
115
|
+
!icon.classList.contains("primary-star-selected") &&
|
116
|
+
!icon.classList.contains("subtle-star-selected")) {
|
117
|
+
icon.classList.remove("star-hovered")
|
118
|
+
}
|
119
|
+
}
|
120
|
+
})
|
121
|
+
}
|
122
|
+
|
123
|
+
isStarSelected() {
|
124
|
+
return this.element.querySelectorAll(".yellow-star-selected, .primary-star-selected, .subtle-star-selected").length > 0
|
125
|
+
}
|
126
|
+
|
127
|
+
handleFormReset() {
|
128
|
+
const form = this.element.closest("form")
|
129
|
+
if (form) {
|
130
|
+
form.addEventListener("reset", () => {
|
131
|
+
this.updateHiddenInputValue("")
|
132
|
+
this.resetStarRatingValues()
|
133
|
+
})
|
134
|
+
}
|
135
|
+
}
|
136
|
+
|
137
|
+
resetStarRatingValues() {
|
138
|
+
const allStars = this.element.querySelectorAll(STAR_RATING_SELECTOR)
|
139
|
+
allStars.forEach(star => {
|
140
|
+
const icon = star.querySelector(".interactive-star-icon")
|
141
|
+
if (icon) {
|
142
|
+
icon.classList.remove("yellow-star-selected", "primary-star-selected", "subtle-star-selected")
|
143
|
+
}
|
144
|
+
})
|
145
|
+
}
|
146
|
+
|
147
|
+
clearFormValidation() {
|
148
|
+
const hiddenInput = this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR)
|
149
|
+
if (hiddenInput.checkValidity()) {
|
150
|
+
const errorLabelElement = this.element.querySelector(".pb_body_kit_negative")
|
151
|
+
if (errorLabelElement) {
|
152
|
+
errorLabelElement.remove()
|
153
|
+
}
|
48
154
|
}
|
49
155
|
}
|
50
156
|
}
|