@everchron/ec-shards 0.7.52 → 0.7.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div class="ecs-excerpt-snippet" :class="sizeClass">
|
|
3
|
+
<div class="ecs-excerpt-title">
|
|
4
|
+
<div class="ecs-excerpt-title-headline">
|
|
5
|
+
<ecs-skeleton-loader v-if="icon && loading" type="rect" :width="20" :height="20" />
|
|
6
|
+
<ecs-icon v-if="icon && !loading" :type="icon" width="20" height="20" />
|
|
7
|
+
<ecs-skeleton-loader v-if="loading" type="single" :width="20" />
|
|
8
|
+
<span v-else>{{ headline }}</span>
|
|
9
|
+
</div>
|
|
10
|
+
<div class="ecs-excerpt-title-cite" v-if="cite">
|
|
11
|
+
<ecs-skeleton-loader v-if="loading" type="single" :width="100" />
|
|
12
|
+
<span v-else>{{ cite }}</span>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="ecs-excerpt-content scrollbar scrollbar-sml" :style="maxHeightStyles">
|
|
16
|
+
<ecs-skeleton-loader v-if="loading" type="multi" :count="3" />
|
|
17
|
+
<template v-else>
|
|
18
|
+
<ecs-formatted v-if="type == 'formatted'" :small="smallFormatted">
|
|
19
|
+
<slot></slot>
|
|
20
|
+
</ecs-formatted>
|
|
21
|
+
|
|
22
|
+
<div v-else-if="type == 'transcript'" class="ecs-excerpt-content-transcript">
|
|
23
|
+
<slot></slot>
|
|
24
|
+
</div>
|
|
25
|
+
|
|
26
|
+
<div v-else-if="type == 'rectangle'" :style="'background-color:' + annotationBackgroundColor" class="ecs-excerpt-content-rectangle">
|
|
27
|
+
<span :style="'color:' + annotationTextColor">Rectangle Annotation</span>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<div v-else class="ecs-excerpt-content-regular">
|
|
31
|
+
<slot></slot>
|
|
32
|
+
</div>
|
|
33
|
+
</template>
|
|
34
|
+
</div>
|
|
35
|
+
</div>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script>
|
|
39
|
+
import EcsIcon from '../icon/icon'
|
|
40
|
+
import EcsSkeletonLoader from '../skeleton-loader/skeleton-loader'
|
|
41
|
+
import EcsFormatted from '../formatted/formatted'
|
|
42
|
+
|
|
43
|
+
export default {
|
|
44
|
+
components: { EcsIcon, EcsSkeletonLoader, EcsFormatted },
|
|
45
|
+
|
|
46
|
+
props: {
|
|
47
|
+
type: {
|
|
48
|
+
type: String,
|
|
49
|
+
validator: v => ['transcript', 'regular', 'rectangle', 'formatted'].includes(v),
|
|
50
|
+
default: 'transcript'
|
|
51
|
+
},
|
|
52
|
+
size: {
|
|
53
|
+
type: String,
|
|
54
|
+
validator: v => ['sml', 'md'].includes(v),
|
|
55
|
+
default: 'md'
|
|
56
|
+
},
|
|
57
|
+
icon: {
|
|
58
|
+
type: String,
|
|
59
|
+
default: 'transcript'
|
|
60
|
+
},
|
|
61
|
+
headline: {
|
|
62
|
+
type: String,
|
|
63
|
+
required: true
|
|
64
|
+
},
|
|
65
|
+
cite: {
|
|
66
|
+
type: String
|
|
67
|
+
},
|
|
68
|
+
maxHeight: {
|
|
69
|
+
type: String
|
|
70
|
+
},
|
|
71
|
+
annotationColor: {
|
|
72
|
+
type: Number,
|
|
73
|
+
default: null
|
|
74
|
+
},
|
|
75
|
+
loading: {
|
|
76
|
+
type: Boolean,
|
|
77
|
+
default: false
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
|
|
81
|
+
computed: {
|
|
82
|
+
smallFormatted() {
|
|
83
|
+
if (this.size == 'sml')
|
|
84
|
+
return true
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
sizeClass() {
|
|
88
|
+
if (this.size && this.size !== '')
|
|
89
|
+
return `ecs-excerpt-snippet-${this.size}`
|
|
90
|
+
return this.size
|
|
91
|
+
},
|
|
92
|
+
|
|
93
|
+
maxHeightStyles() {
|
|
94
|
+
if (this.maxHeight)
|
|
95
|
+
return `max-height: ${this.maxHeight}; overflow: auto;`
|
|
96
|
+
},
|
|
97
|
+
|
|
98
|
+
annotationBackgroundColor() {
|
|
99
|
+
switch (this.annotationColor){
|
|
100
|
+
case 1:
|
|
101
|
+
return 'rgba(249, 223, 0, 0.2)'
|
|
102
|
+
case 2:
|
|
103
|
+
return 'rgba(243, 161, 0, 0.2)'
|
|
104
|
+
case 3:
|
|
105
|
+
return 'rgba(183, 234, 128, 0.2)'
|
|
106
|
+
case 4:
|
|
107
|
+
return 'rgba(72, 228, 194, 0.2)'
|
|
108
|
+
case 5:
|
|
109
|
+
return 'rgba(72, 157, 255, 0.2)'
|
|
110
|
+
case 6:
|
|
111
|
+
return 'rgba(184, 119, 240, 0.2)'
|
|
112
|
+
case 7:
|
|
113
|
+
return 'rgba(253, 120, 253, 0.2)'
|
|
114
|
+
case 8:
|
|
115
|
+
return 'rgba(197, 148, 101, 0.2)'
|
|
116
|
+
case 9:
|
|
117
|
+
return 'rgba(133, 142, 159, 0.2)'
|
|
118
|
+
default:
|
|
119
|
+
return 'rgba(249, 223, 0, 0.2)'
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
|
|
123
|
+
annotationTextColor() {
|
|
124
|
+
switch (this.annotationColor){
|
|
125
|
+
case 1:
|
|
126
|
+
return '#B57100'
|
|
127
|
+
case 2:
|
|
128
|
+
return '#A95A00'
|
|
129
|
+
case 3:
|
|
130
|
+
return '#429700'
|
|
131
|
+
case 4:
|
|
132
|
+
return '#06956E'
|
|
133
|
+
case 5:
|
|
134
|
+
return '#0E4BBE'
|
|
135
|
+
case 6:
|
|
136
|
+
return '#6B1ABA'
|
|
137
|
+
case 7:
|
|
138
|
+
return '#BE15BF'
|
|
139
|
+
case 8:
|
|
140
|
+
return '#7B3F1B'
|
|
141
|
+
case 9:
|
|
142
|
+
return '#364258'
|
|
143
|
+
default:
|
|
144
|
+
return '#B57100'
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
</script>
|
|
150
|
+
|
|
151
|
+
<style lang="scss" scoped>
|
|
152
|
+
@import "../tokens/tokens";
|
|
153
|
+
@import "../mixins/svg-uri";
|
|
154
|
+
|
|
155
|
+
.ecs-excerpt-snippet{
|
|
156
|
+
border-radius: 6px;
|
|
157
|
+
background: $gray-2;
|
|
158
|
+
padding: 6px;
|
|
159
|
+
width: 100%;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.ecs-excerpt-snippet-sml{
|
|
163
|
+
padding: 4px;
|
|
164
|
+
border-radius: 4px;
|
|
165
|
+
|
|
166
|
+
.ecs-excerpt-content{
|
|
167
|
+
padding: 8px;
|
|
168
|
+
border-radius: 2px;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.ecs-excerpt-title{
|
|
172
|
+
padding: 2px 4px 4px 2px;
|
|
173
|
+
font-size: 12px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.ecs-excerpt-content-transcript{
|
|
177
|
+
font-size: 10px;
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.ecs-excerpt-content-regular,
|
|
181
|
+
.ecs-excerpt-content-rectangle{
|
|
182
|
+
font-size: 12px;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.ecs-excerpt-title{
|
|
187
|
+
display: flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
justify-content: space-between;
|
|
190
|
+
padding: 4px 4px 12px 4px;
|
|
191
|
+
color: $gray-10;
|
|
192
|
+
font-size: 14px;
|
|
193
|
+
|
|
194
|
+
&-headline{
|
|
195
|
+
display: flex;
|
|
196
|
+
align-items: center;
|
|
197
|
+
flex: 1;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.icon,
|
|
201
|
+
.skeleton-rectangle{
|
|
202
|
+
margin-right: 4px;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
&-cite{
|
|
206
|
+
flex-shrink: 0;
|
|
207
|
+
text-align: right;
|
|
208
|
+
min-width: 60px;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.ecs-excerpt-content{
|
|
213
|
+
background: #FFFFFF;
|
|
214
|
+
box-shadow: 0 0 0 1px rgba($gray-10, .06), 0 1px 3px 0 rgba($gray-10, .1);
|
|
215
|
+
border-radius: 4px;
|
|
216
|
+
padding: 12px;
|
|
217
|
+
|
|
218
|
+
&-transcript{
|
|
219
|
+
line-height: 1.6em;
|
|
220
|
+
white-space: pre-wrap;
|
|
221
|
+
font-family: $mono;
|
|
222
|
+
color: $gray-14;
|
|
223
|
+
font-size: 12px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
&-regular{
|
|
227
|
+
white-space: pre-wrap;
|
|
228
|
+
line-height: 1.4em;
|
|
229
|
+
font-size: 14px;
|
|
230
|
+
color: $gray-14;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
&-rectangle{
|
|
234
|
+
text-align: center;
|
|
235
|
+
font-size: 14px;
|
|
236
|
+
padding: .5em;
|
|
237
|
+
border-radius: 2px;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
</style>
|
|
241
|
+
|
|
242
|
+
<style lang="scss">
|
|
243
|
+
@import "../tokens/tokens";
|
|
244
|
+
|
|
245
|
+
.ecs-excerpt-content-transcript{
|
|
246
|
+
span{
|
|
247
|
+
display: block;
|
|
248
|
+
position: relative;
|
|
249
|
+
|
|
250
|
+
&[data-line]:before{
|
|
251
|
+
content: attr(data-line);
|
|
252
|
+
min-width: 3em;
|
|
253
|
+
display: inline-block;
|
|
254
|
+
color: $gray-5;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
&[data-line="01"]:not(:first-child):after{
|
|
258
|
+
content: "";
|
|
259
|
+
position: absolute;
|
|
260
|
+
width: 100%;
|
|
261
|
+
height: 1px;
|
|
262
|
+
top: 0;
|
|
263
|
+
left: 0;
|
|
264
|
+
background: $gray-3;
|
|
265
|
+
border-radius: 1px;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
</style>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import EcsExcerptSnippet from '@components/excerpt-snippet/excerpt-snippet';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: 'Content Structures/Excerpt Snippet',
|
|
5
|
+
component: EcsExcerptSnippet
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
export const transcript = () => ({
|
|
9
|
+
components: { EcsExcerptSnippet },
|
|
10
|
+
template: `<main>
|
|
11
|
+
<ecs-excerpt-snippet cite="3:6-4:3" headline="Excerpt Text" style="margin-bottom:16px"><div>
|
|
12
|
+
<span data-line="24">That was a false statement, wasn't it?</span><span data-line="25">A. I mean, it sucks for those investments.</span><span data-line="01">Good thing I didn't have anything to do with them.</span></div></ecs-excerpt-snippet>
|
|
13
|
+
<ecs-excerpt-snippet size="sml" cite="3:6-4:3" headline="Excerpt Text"><div>
|
|
14
|
+
<span data-line="06">That was a false statement, wasn't it?</span><span data-line="07">A. I mean, it sucks for those investments.</span><span data-line="08">Good thing I didn't have anything to do with them.</span></div></ecs-excerpt-snippet>
|
|
15
|
+
</main>`,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export const formattedText = () => ({
|
|
19
|
+
components: { EcsExcerptSnippet },
|
|
20
|
+
template: `<main>
|
|
21
|
+
<ecs-excerpt-snippet headline="Summary" type="formatted" style="margin-bottom:16px">
|
|
22
|
+
<p>This is a <b>formatted</b> text.</p>
|
|
23
|
+
</ecs-excerpt-snippet>
|
|
24
|
+
<ecs-excerpt-snippet headline="Summary" type="formatted" size="sml">
|
|
25
|
+
<p>This is a <b>formatted</b> text.</p>
|
|
26
|
+
</ecs-excerpt-snippet>
|
|
27
|
+
</main>`,
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export const rectangleAnnotation = () => ({
|
|
31
|
+
components: { EcsExcerptSnippet },
|
|
32
|
+
template: `<main>
|
|
33
|
+
<ecs-excerpt-snippet headline="Document Headline" type="rectangle" icon="document" :annotation-color="1" style="margin-bottom:16px" />
|
|
34
|
+
<ecs-excerpt-snippet size="sml" headline="Document Headline" type="rectangle" icon="document" :annotation-color="3" />
|
|
35
|
+
</main>`,
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export const regular = () => ({
|
|
39
|
+
components: { EcsExcerptSnippet },
|
|
40
|
+
template: `<main>
|
|
41
|
+
<ecs-excerpt-snippet headline="Document Headline" type="regular" icon="document">The below note outlines the changes I made to the Enron Machine and
|
|
42
|
+
Mechanical Services, Inc.</ecs-excerpt-snippet>
|
|
43
|
+
</main>`,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
export const loading = () => ({
|
|
47
|
+
components: { EcsExcerptSnippet },
|
|
48
|
+
template: `<main>
|
|
49
|
+
<ecs-excerpt-snippet loading headline="Document Headline" type="regular" icon="document">The below note outlines the changes I made to the Enron Machine and
|
|
50
|
+
Mechanical Services, Inc.</ecs-excerpt-snippet>
|
|
51
|
+
</main>`,
|
|
52
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { Meta, Story, ArgsTable, Canvas, Description } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import EcsExcerptSnippet from '@components/excerpt-snippet/excerpt-snippet';
|
|
3
|
+
import * as stories from './excerpt-snippet.stories.js';
|
|
4
|
+
|
|
5
|
+
<Meta
|
|
6
|
+
title="Content Structures/Excerpt Snippet"
|
|
7
|
+
component={EcsExcerptSnippet} />
|
|
8
|
+
|
|
9
|
+
# Excerpt Snippet `EcsExcerptSnippet`
|
|
10
|
+
|
|
11
|
+
Excerpt snippets are small containers that are used to display a summary of a piece of content. They are used mostly for excerpts of transcripts.
|
|
12
|
+
|
|
13
|
+
## Transcript Excerpt
|
|
14
|
+
|
|
15
|
+
The default exerpt snippet type is a transcript text snippet.
|
|
16
|
+
|
|
17
|
+
<Canvas withSource="none" withToolbar={true}>
|
|
18
|
+
<Story name="Transcript" height="100px">
|
|
19
|
+
{stories.transcript()}
|
|
20
|
+
</Story>
|
|
21
|
+
</Canvas>
|
|
22
|
+
|
|
23
|
+
```js
|
|
24
|
+
<ecs-excerpt-snippet cite="3:6-4:3" headline="Excerpt Text">
|
|
25
|
+
BY MR. KANTER:
|
|
26
|
+
Q. Do you have any college education?
|
|
27
|
+
A. Oh, yeah, yeah, uh-uh. Oh, you want to
|
|
28
|
+
know what the details of it is?
|
|
29
|
+
Q. Sure.
|
|
30
|
+
</ecs-excerpt-snippet>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Regular Excerpt
|
|
34
|
+
|
|
35
|
+
By setting the `type` prop to `regular`, you can render a regular excerpt.
|
|
36
|
+
|
|
37
|
+
<Canvas withSource="none" withToolbar={true}>
|
|
38
|
+
<Story name="Regular" height="100px">
|
|
39
|
+
{stories.regular()}
|
|
40
|
+
</Story>
|
|
41
|
+
</Canvas>
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
<ecs-excerpt-snippet headline="Document Headline" type="regular" icon="document">
|
|
45
|
+
The below note outlines the changes I made to the Enron Machine and
|
|
46
|
+
Mechanical Services, Inc.
|
|
47
|
+
</ecs-excerpt-snippet>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Regular Excerpt
|
|
51
|
+
|
|
52
|
+
By setting the `type` prop to `rectangle`, you can render a rectangle annotation with it's given `annotation-color` (1-9).
|
|
53
|
+
|
|
54
|
+
<Canvas withSource="none" withToolbar={true}>
|
|
55
|
+
<Story name="Rectangle Annotation" height="100px">
|
|
56
|
+
{stories.rectangleAnnotation()}
|
|
57
|
+
</Story>
|
|
58
|
+
</Canvas>
|
|
59
|
+
|
|
60
|
+
```js
|
|
61
|
+
<ecs-excerpt-snippet headline="Document Headline" type="rectangle" icon="document" :annotation-color="1" />
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Formatted Text
|
|
65
|
+
|
|
66
|
+
By setting the `type` prop to `formatted`, you can render formatted text inside the snippet content area.
|
|
67
|
+
|
|
68
|
+
<Canvas withSource="none" withToolbar={true}>
|
|
69
|
+
<Story name="Formatted Text" height="100px">
|
|
70
|
+
{stories.formattedText()}
|
|
71
|
+
</Story>
|
|
72
|
+
</Canvas>
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
<ecs-excerpt-snippet headline="Summary" type="formatted">
|
|
76
|
+
<p>This is a <b>formatted</b> text.</p>
|
|
77
|
+
</ecs-excerpt-snippet>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Loading
|
|
81
|
+
|
|
82
|
+
By setting the `loading` prop, the excerpt snippet shows a loading indicator.
|
|
83
|
+
|
|
84
|
+
<Canvas withSource="none" withToolbar={true}>
|
|
85
|
+
<Story name="Loading" height="100px">
|
|
86
|
+
{stories.loading()}
|
|
87
|
+
</Story>
|
|
88
|
+
</Canvas>
|
|
89
|
+
|
|
90
|
+
```js
|
|
91
|
+
<ecs-excerpt-snippet loading headline="Summary" type="formatted">
|
|
92
|
+
<p>This is a <b>formatted</b> text.</p>
|
|
93
|
+
</ecs-excerpt-snippet>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Props, Slots and Events
|
|
97
|
+
|
|
98
|
+
<ArgsTable of={EcsExcerptSnippet} />
|