playbook_ui 14.1.0.pre.alpha.PA1477timestampkit3536 → 14.1.0.pre.alpha.PBNTR455ganttchartPOC3569
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 +1 -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_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_timestamp/timestamp.rb +2 -37
- data/dist/chunks/{_typeahead-D-4y9pbv.js → _typeahead-B6CmTH6o.js} +3 -3
- data/dist/chunks/_weekday_stacked-CNZpeoOR.js +45 -0
- data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
- data/dist/chunks/{lib-BE0Z3F7x.js → lib-XlOB2yGW.js} +1 -1
- data/dist/chunks/{pb_form_validation-TzZQ0Flx.js → pb_form_validation-mwEv7D-z.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/version.rb +1 -1
- metadata +15 -7
- data/dist/chunks/_weekday_stacked-Cax4nrUa.js +0 -45
- data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8e8a512656c877972bafc24c6eb07997b0416cd20fcd64e834c7e361e5994ae6
|
4
|
+
data.tar.gz: 8263da8743492e725a7883740bbab68a0991babf5a4d48c8ea3b5f91cd5968f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b943e98a13820d9797c4393c035dc9eeea40e152cbbc6743e1e922adbf5454ce869774aa69200a8109148fcc0e8a8426e8bb0d55261341d88030ee5806fbb9e
|
7
|
+
data.tar.gz: 8445df954e532fcf689cc502e7604e42714ed4fa32ede26a81b0fb35356646cd9224daa78274ac975ebc92d077a19ddbc286a6e4b397270146c168009c1460ca
|
@@ -0,0 +1,72 @@
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
2
|
+
import classnames from "classnames";
|
3
|
+
import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
|
4
|
+
import { globalProps } from "../utilities/globalProps";
|
5
|
+
import HighchartsReact from "highcharts-react-official";
|
6
|
+
import Highcharts from "highcharts/highcharts-gantt";
|
7
|
+
|
8
|
+
import { highchartsTheme } from "../pb_dashboard/pbChartsLightTheme";
|
9
|
+
import { highchartsDarkTheme } from "../pb_dashboard/pbChartsDarkTheme";
|
10
|
+
|
11
|
+
type GanttChartProps = {
|
12
|
+
aria?: { [key: string]: string };
|
13
|
+
className?: string;
|
14
|
+
customOptions: Partial<Highcharts.Options>;
|
15
|
+
dark?: boolean;
|
16
|
+
data?: { [key: string]: string };
|
17
|
+
htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
|
18
|
+
id?: string;
|
19
|
+
};
|
20
|
+
|
21
|
+
const GanttChart = (props: GanttChartProps) => {
|
22
|
+
const {
|
23
|
+
aria = {},
|
24
|
+
className,
|
25
|
+
customOptions = {},
|
26
|
+
dark = false,
|
27
|
+
data = {},
|
28
|
+
htmlOptions = {},
|
29
|
+
id,
|
30
|
+
} = props;
|
31
|
+
|
32
|
+
const ariaProps = buildAriaProps(aria);
|
33
|
+
const dataProps = buildDataProps(data);
|
34
|
+
const htmlProps = buildHtmlProps(htmlOptions);
|
35
|
+
const classes = classnames(
|
36
|
+
buildCss("pb_gantt_chart"),
|
37
|
+
globalProps(props),
|
38
|
+
className
|
39
|
+
);
|
40
|
+
|
41
|
+
const [options, setOptions] = useState<Highcharts.Options | undefined>(customOptions);
|
42
|
+
|
43
|
+
useEffect(() => {
|
44
|
+
setOptions(customOptions);
|
45
|
+
}, [customOptions]);
|
46
|
+
|
47
|
+
const setupTheme = () => {
|
48
|
+
dark
|
49
|
+
? Highcharts.setOptions(highchartsDarkTheme)
|
50
|
+
: Highcharts.setOptions(highchartsTheme);
|
51
|
+
};
|
52
|
+
setupTheme();
|
53
|
+
|
54
|
+
return (
|
55
|
+
<div>
|
56
|
+
<HighchartsReact
|
57
|
+
constructorType={"ganttChart"}
|
58
|
+
containerProps={{
|
59
|
+
className: classnames(globalProps(props), classes),
|
60
|
+
id: id,
|
61
|
+
...ariaProps,
|
62
|
+
...dataProps,
|
63
|
+
...htmlProps,
|
64
|
+
}}
|
65
|
+
highcharts={Highcharts}
|
66
|
+
options={options}
|
67
|
+
/>
|
68
|
+
</div>
|
69
|
+
);
|
70
|
+
};
|
71
|
+
|
72
|
+
export default GanttChart;
|
@@ -0,0 +1,53 @@
|
|
1
|
+
import React from "react";
|
2
|
+
import { GanttChart } from "playbook-ui";
|
3
|
+
|
4
|
+
const mockOptions = {
|
5
|
+
title: {
|
6
|
+
text: "Simple Gantt Chart",
|
7
|
+
},
|
8
|
+
|
9
|
+
xAxis: [
|
10
|
+
{
|
11
|
+
min: Date.UTC(2014, 10, 17),
|
12
|
+
max: Date.UTC(2014, 10, 30),
|
13
|
+
},
|
14
|
+
],
|
15
|
+
|
16
|
+
series: [
|
17
|
+
{
|
18
|
+
name: "Project 1",
|
19
|
+
data: [
|
20
|
+
{
|
21
|
+
name: "Start prototype",
|
22
|
+
start: Date.UTC(2014, 10, 18),
|
23
|
+
end: Date.UTC(2014, 10, 25),
|
24
|
+
},
|
25
|
+
{
|
26
|
+
name: "Develop",
|
27
|
+
start: Date.UTC(2014, 10, 20),
|
28
|
+
end: Date.UTC(2014, 10, 25),
|
29
|
+
},
|
30
|
+
{
|
31
|
+
name: "Run acceptance tests",
|
32
|
+
start: Date.UTC(2014, 10, 23),
|
33
|
+
end: Date.UTC(2014, 10, 26),
|
34
|
+
},
|
35
|
+
{
|
36
|
+
name: "Test prototype",
|
37
|
+
start: Date.UTC(2014, 10, 27),
|
38
|
+
end: Date.UTC(2014, 10, 29),
|
39
|
+
},
|
40
|
+
],
|
41
|
+
},
|
42
|
+
],
|
43
|
+
};
|
44
|
+
|
45
|
+
const GanttChartDefault = (props) => (
|
46
|
+
<div>
|
47
|
+
<GanttChart customOptions={mockOptions}
|
48
|
+
{...props}
|
49
|
+
/>
|
50
|
+
</div>
|
51
|
+
);
|
52
|
+
|
53
|
+
export default GanttChartDefault;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { default as GanttChartDefault } from './_gantt_chart_default.jsx'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
// import { renderKit } from '../utilities/test-utils'
|
2
|
+
|
3
|
+
// import GanttChart from './_gantt_chart'
|
4
|
+
|
5
|
+
/* See these resources for more testing info:
|
6
|
+
- https://github.com/testing-library/jest-dom#usage for useage and examples
|
7
|
+
- https://jestjs.io/docs/en/using-matchers
|
8
|
+
*/
|
9
|
+
|
10
|
+
test('generated scaffold test - update me', () => {
|
11
|
+
// const props = {
|
12
|
+
// data: { testid: 'default' }
|
13
|
+
// }
|
14
|
+
|
15
|
+
|
16
|
+
// const kit = renderKit(GanttChart , props)
|
17
|
+
// expect(kit).toBeInTheDocument()
|
18
|
+
})
|
19
|
+
|
@@ -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'
|
@@ -27,15 +27,6 @@ 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_PER_MIN = 60
|
32
|
-
SECS_PER_HOUR = 60 * SECS_PER_MIN
|
33
|
-
SECS_PER_DAY = 24 * SECS_PER_HOUR
|
34
|
-
SECS_PER_WEEK = 7 * SECS_PER_DAY
|
35
|
-
SECS_PER_MONTH = 4 * SECS_PER_WEEK
|
36
|
-
SECS_PER_YEAR = 12 * SECS_PER_MONTH
|
37
|
-
SECS_PER_CENT = 100 * SECS_PER_YEAR
|
38
|
-
|
39
30
|
def classname
|
40
31
|
generate_classname("pb_timestamp_kit", variant_class, align)
|
41
32
|
end
|
@@ -82,36 +73,10 @@ module Playbook
|
|
82
73
|
|
83
74
|
def format_elapsed_string
|
84
75
|
user_string = show_user ? " by #{text}" : ""
|
85
|
-
datetime_string = " #{
|
86
|
-
datetime_string[1] = hide_updated ? datetime_string[1].upcase : datetime_string[1]
|
76
|
+
datetime_string = " #{time_ago_in_words(pb_date_time.convert_to_timestamp)} ago"
|
87
77
|
updated_string = hide_updated ? "" : "Last updated"
|
88
|
-
"#{updated_string}#{user_string}#{datetime_string}"
|
89
|
-
end
|
90
78
|
|
91
|
-
|
92
|
-
time_ago = DateTime.now.to_i - value.to_i
|
93
|
-
case time_ago
|
94
|
-
when (0...SECS_PER_MIN)
|
95
|
-
"a few seconds"
|
96
|
-
when (SECS_PER_MIN...SECS_PER_HOUR)
|
97
|
-
time = time_ago / SECS_PER_MIN
|
98
|
-
time == 1 ? "a minute" : "#{time_ago / SECS_PER_MIN} minutes"
|
99
|
-
when (SECS_PER_HOUR...SECS_PER_DAY)
|
100
|
-
time = time_ago / SECS_PER_HOUR
|
101
|
-
time == 1 ? "an hour" : "#{time_ago / SECS_PER_HOUR} hours"
|
102
|
-
when (SECS_PER_DAY...SECS_PER_WEEK)
|
103
|
-
time = time_ago / SECS_PER_DAY
|
104
|
-
time == 1 ? "a day" : "#{time_ago / SECS_PER_DAY} days"
|
105
|
-
when (SECS_PER_WEEK...SECS_PER_MONTH)
|
106
|
-
time = time_ago / SECS_PER_WEEK
|
107
|
-
time == 1 ? "a week" : "#{time_ago / SECS_PER_WEEK} weeks"
|
108
|
-
when (SECS_PER_MONTH...SECS_PER_YEAR)
|
109
|
-
time = time_ago / SECS_PER_MONTH
|
110
|
-
time == 1 ? "a month" : "#{time_ago / SECS_PER_MONTH} months"
|
111
|
-
when (SECS_PER_YEAR...SECS_PER_CENT)
|
112
|
-
time = time_ago / SECS_PER_YEAR
|
113
|
-
time == 1 ? "a year" : "#{time_ago / SECS_PER_YEAR} years"
|
114
|
-
end
|
79
|
+
"#{updated_string}#{user_string}#{datetime_string}"
|
115
80
|
end
|
116
81
|
|
117
82
|
def datetime_or_text
|