@everchron/ec-shards 0.7.52 → 0.7.53

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everchron/ec-shards",
3
- "version": "0.7.52",
3
+ "version": "0.7.53",
4
4
  "private": false,
5
5
  "description": "Everchron Shards UI Library",
6
6
  "repository": "https://github.com/everchron/ec-shards.git",
@@ -0,0 +1,219 @@
1
+ <template>
2
+ <div class="ecs-excerpt-snippet" :class="sizeClass">
3
+ <div class="ecs-excerpt-title">
4
+ <span>
5
+ <ecs-icon v-if="icon" :type="icon" width="20" height="20" />
6
+ {{ headline }}
7
+ </span>
8
+ <span v-if="cite">{{ cite }}</span>
9
+ </div>
10
+ <div class="ecs-excerpt-content scrollbar scrollbar-sml" :style="maxHeightStyles">
11
+ <ecs-formatted v-if="type == 'formatted'" :small="smallFormatted">
12
+ <slot></slot>
13
+ </ecs-formatted>
14
+
15
+ <div v-else-if="type == 'transcript'" class="ecs-excerpt-content-transcript">
16
+ <slot></slot>
17
+ </div>
18
+
19
+ <div v-else-if="type == 'rectangle'" :style="'background-color:' + annotationBackgroundColor" class="ecs-excerpt-content-rectangle">
20
+ <span :style="'color:' + annotationTextColor">Rectangle Annotation</span>
21
+ </div>
22
+
23
+ <div v-else class="ecs-excerpt-content-regular">
24
+ <slot></slot>
25
+ </div>
26
+ </div>
27
+ </div>
28
+ </template>
29
+
30
+ <script>
31
+ import EcsIcon from '../icon/icon'
32
+ import EcsFormatted from '../formatted/formatted'
33
+
34
+ export default {
35
+ components: { EcsIcon, EcsFormatted },
36
+
37
+ props: {
38
+ type: {
39
+ type: String,
40
+ validator: v => ['transcript', 'regular', 'rectangle', 'formatted'].includes(v),
41
+ default: 'transcript'
42
+ },
43
+ size: {
44
+ type: String,
45
+ validator: v => ['sml', 'md'].includes(v),
46
+ default: 'md'
47
+ },
48
+ icon: {
49
+ type: String,
50
+ default: 'transcript'
51
+ },
52
+ headline: {
53
+ type: String,
54
+ required: true
55
+ },
56
+ cite: {
57
+ type: String
58
+ },
59
+ maxHeight: {
60
+ type: String
61
+ },
62
+ annotationColor: {
63
+ type: Number,
64
+ default: null
65
+ }
66
+ },
67
+
68
+ computed: {
69
+ smallFormatted() {
70
+ if (this.size == 'sml')
71
+ return true
72
+ },
73
+
74
+ sizeClass() {
75
+ if (this.size && this.size !== '')
76
+ return `ecs-excerpt-snippet-${this.size}`
77
+ return this.size
78
+ },
79
+
80
+ maxHeightStyles() {
81
+ if (this.maxHeight)
82
+ return `max-height: ${this.maxHeight}; overflow: auto;`
83
+ },
84
+
85
+ annotationBackgroundColor() {
86
+ switch (this.annotationColor){
87
+ case 1:
88
+ return 'rgba(249, 223, 0, 0.2)'
89
+ case 2:
90
+ return 'rgba(243, 161, 0, 0.2)'
91
+ case 3:
92
+ return 'rgba(183, 234, 128, 0.2)'
93
+ case 4:
94
+ return 'rgba(72, 228, 194, 0.2)'
95
+ case 5:
96
+ return 'rgba(72, 157, 255, 0.2)'
97
+ case 6:
98
+ return 'rgba(184, 119, 240, 0.2)'
99
+ case 7:
100
+ return 'rgba(253, 120, 253, 0.2)'
101
+ case 8:
102
+ return 'rgba(197, 148, 101, 0.2)'
103
+ case 9:
104
+ return 'rgba(133, 142, 159, 0.2)'
105
+ default:
106
+ return 'rgba(249, 223, 0, 0.2)'
107
+ }
108
+ },
109
+
110
+ annotationTextColor() {
111
+ switch (this.annotationColor){
112
+ case 1:
113
+ return '#B57100'
114
+ case 2:
115
+ return '#A95A00'
116
+ case 3:
117
+ return '#429700'
118
+ case 4:
119
+ return '#06956E'
120
+ case 5:
121
+ return '#0E4BBE'
122
+ case 6:
123
+ return '#6B1ABA'
124
+ case 7:
125
+ return '#BE15BF'
126
+ case 8:
127
+ return '#7B3F1B'
128
+ case 9:
129
+ return '#364258'
130
+ default:
131
+ return '#B57100'
132
+ }
133
+ }
134
+ }
135
+ }
136
+ </script>
137
+
138
+ <style lang="scss" scoped>
139
+ @import "../tokens/tokens";
140
+ @import "../mixins/svg-uri";
141
+
142
+ .ecs-excerpt-snippet{
143
+ border-radius: 6px;
144
+ background: $gray-2;
145
+ padding: 6px;
146
+ width: 100%;
147
+ }
148
+
149
+ .ecs-excerpt-snippet-sml{
150
+ padding: 4px;
151
+ border-radius: 4px;
152
+
153
+ .ecs-excerpt-content{
154
+ padding: 8px;
155
+ border-radius: 2px;
156
+ }
157
+
158
+ .ecs-excerpt-title{
159
+ padding: 2px 4px 4px 2px;
160
+ font-size: 12px;
161
+ }
162
+
163
+ .ecs-excerpt-content-transcript{
164
+ font-size: 10px;
165
+ }
166
+
167
+ .ecs-excerpt-content-regular,
168
+ .ecs-excerpt-content-rectangle{
169
+ font-size: 12px;
170
+ }
171
+ }
172
+
173
+ .ecs-excerpt-title{
174
+ display: flex;
175
+ align-items: center;
176
+ justify-content: space-between;
177
+ padding: 4px 4px 12px 4px;
178
+ color: $gray-10;
179
+ font-size: 14px;
180
+
181
+ > span{
182
+ display: flex;
183
+ align-items: center;
184
+ }
185
+
186
+ .icon{
187
+ margin-right: 4px;
188
+ }
189
+ }
190
+
191
+ .ecs-excerpt-content{
192
+ background: #FFFFFF;
193
+ box-shadow: 0 0 0 1px rgba($gray-10, .06), 0 1px 3px 0 rgba($gray-10, .1);
194
+ border-radius: 4px;
195
+ padding: 12px;
196
+
197
+ &-transcript{
198
+ line-height: 1.4em;
199
+ white-space: pre-wrap;
200
+ font-family: $mono;
201
+ color: $gray-14;
202
+ font-size: 12px;
203
+ }
204
+
205
+ &-regular{
206
+ white-space: pre-wrap;
207
+ line-height: 1.4em;
208
+ font-size: 14px;
209
+ color: $gray-14;
210
+ }
211
+
212
+ &-rectangle{
213
+ text-align: center;
214
+ font-size: 14px;
215
+ padding: .5em;
216
+ border-radius: 2px;
217
+ }
218
+ }
219
+ </style>
@@ -0,0 +1,50 @@
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"> BY MR. KANTER:
12
+ Q. Do you have any college education?
13
+ A. Oh, yeah, yeah, uh-uh. Oh, you want to
14
+ know what the details of it is?
15
+ Q. Sure.</ecs-excerpt-snippet>
16
+ <ecs-excerpt-snippet size="sml" cite="3:6-4:3" headline="Excerpt Text"> BY MR. KANTER:
17
+ Q. Do you have any college education?
18
+ A. Oh, yeah, yeah, uh-uh. Oh, you want to
19
+ know what the details of it is?
20
+ Q. Sure.</ecs-excerpt-snippet>
21
+ </main>`,
22
+ });
23
+
24
+ export const formattedText = () => ({
25
+ components: { EcsExcerptSnippet },
26
+ template: `<main>
27
+ <ecs-excerpt-snippet headline="Summary" type="formatted" style="margin-bottom:16px">
28
+ <p>This is a <b>formatted</b> text.</p>
29
+ </ecs-excerpt-snippet>
30
+ <ecs-excerpt-snippet headline="Summary" type="formatted" size="sml">
31
+ <p>This is a <b>formatted</b> text.</p>
32
+ </ecs-excerpt-snippet>
33
+ </main>`,
34
+ });
35
+
36
+ export const rectangleAnnotation = () => ({
37
+ components: { EcsExcerptSnippet },
38
+ template: `<main>
39
+ <ecs-excerpt-snippet headline="Document Headline" type="rectangle" icon="document" :annotation-color="1" style="margin-bottom:16px" />
40
+ <ecs-excerpt-snippet size="sml" headline="Document Headline" type="rectangle" icon="document" :annotation-color="3" />
41
+ </main>`,
42
+ });
43
+
44
+ export const regular = () => ({
45
+ components: { EcsExcerptSnippet },
46
+ template: `<main>
47
+ <ecs-excerpt-snippet headline="Document Headline" type="regular" icon="document">The below note outlines the changes I made to the Enron Machine and
48
+ Mechanical Services, Inc.</ecs-excerpt-snippet>
49
+ </main>`,
50
+ });
@@ -0,0 +1,82 @@
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
+ ## Props, Slots and Events
81
+
82
+ <ArgsTable of={EcsExcerptSnippet} />