380
800
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<div class="m-rich-text">

    <p>There are a few options for integration, first we'll display a simple toggle interaction:</p>

    <details>
        <summary>
            <h3>Example #1</h3>
        </summary>
        <div>
            <p>This accordion is uses no JS, with very simple markup. It depends on the browser's native support for <code class="a-tag" style="font-family: monospace;">&lt;details&gt;</code> and <code class="a-tag" style="font-family: monospace;">&lt;summary&gt;</code> tags. This reduces the complexity of integration.</p>
        </div>
    </details>
    <details data-behavior="Toggle" data-toggle-tween="0.2">
        <summary data-toggle-trigger>
            <h3>Example #2</h3>
        </summary>
        <div data-toggle-content>
            <p>This accordion uses JS to provide a smooth transition, and better browser support but does require some custom markup.</p>
        </div>
    </details>
    <details data-behavior="Toggle" data-toggle-tween="0.2">
        <summary data-toggle-trigger>
            <h3>Example #3</h3>
            <svg role="img" aria-hidden="true">
                <use class="icon--action--sm-plus" role="presentation" xlink:href="#icon--action--sm-plus" />
                <use class="icon--action--sm-minus" role="presentation" xlink:href="#icon--action--sm-minus" />
                <use class="icon--action--md-plus" role="presentation" xlink:href="#icon--action--md-plus" />
                <use class="icon--action--md-minus" role="presentation" xlink:href="#icon--action--md-minus" />
            </svg>
        </summary>
        <div data-toggle-content>
            <p>This accordion uses JS to provide a smooth transition, and custom markup to display a more pixel perfect SVG icon for the (+/-).</p>
        </div>
    </details>

    <p>You can also provide a more typical "accordion" interaction with some JS, via data-attributes:</p>

    <div data-behavior="Accordion">
        <details data-Accordion-item data-Accordion-tween="0.2">
            <summary data-Accordion-trigger>
                <h3>Example #1</h3>
            </summary>
            <div data-Accordion-content>
                <p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>
            </div>
        </details>
        <details data-Accordion-item data-Accordion-tween="0.2">
            <summary data-Accordion-trigger>
                <h3>Example #2</h3>
            </summary>
            <div data-Accordion-content>
                <p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>
            </div>
        </details>
        <details data-Accordion-item data-Accordion-tween="0.2">
            <summary data-Accordion-trigger>
                <h3>Example #3</h3>
            </summary>
            <div data-Accordion-content>
                <p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>
            </div>
        </details>
    </div>


</div>
1
2
3
4
5
{
  "content": [
    "\n      <p>There are a few options for integration, first we'll display a simple toggle interaction:</p>\n\n      <details>\n        <summary>\n          <h3>Example #1</h3>\n        </summary>\n        <div>\n          <p>This accordion is uses no JS, with very simple markup. It depends on the browser's native support for <code class=\"a-tag\" style=\"font-family: monospace;\">&lt;details&gt;</code> and <code class=\"a-tag\" style=\"font-family: monospace;\">&lt;summary&gt;</code> tags. This reduces the complexity of integration.</p>\n        </div>\n      </details>\n      <details data-behavior=\"Toggle\" data-toggle-tween=\"0.2\">\n        <summary data-toggle-trigger>\n          <h3>Example #2</h3>\n        </summary>\n        <div data-toggle-content>\n          <p>This accordion uses JS to provide a smooth transition, and better browser support but does require some custom markup.</p>\n        </div>\n      </details>\n      <details data-behavior=\"Toggle\" data-toggle-tween=\"0.2\">\n        <summary data-toggle-trigger>\n          <h3>Example #3</h3>\n          <svg role=\"img\" aria-hidden=\"true\">\n            <use class=\"icon--action--sm-plus\" role=\"presentation\" xlink:href=\"#icon--action--sm-plus\"/>\n            <use class=\"icon--action--sm-minus\" role=\"presentation\" xlink:href=\"#icon--action--sm-minus\"/>\n            <use class=\"icon--action--md-plus\" role=\"presentation\" xlink:href=\"#icon--action--md-plus\"/>\n            <use class=\"icon--action--md-minus\" role=\"presentation\" xlink:href=\"#icon--action--md-minus\"/>\n          </svg>\n        </summary>\n        <div data-toggle-content>\n          <p>This accordion uses JS to provide a smooth transition, and custom markup to display a more pixel perfect SVG icon for the (+/-).</p>\n        </div>\n      </details>\n\n      <p>You can also provide a more typical \"accordion\" interaction with some JS, via data-attributes:</p>\n\n      <div data-behavior=\"Accordion\">\n        <details data-Accordion-item data-Accordion-tween=\"0.2\">\n          <summary data-Accordion-trigger>\n            <h3>Example #1</h3>\n          </summary>\n          <div data-Accordion-content>\n            <p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>\n          </div>\n        </details>\n        <details data-Accordion-item data-Accordion-tween=\"0.2\">\n          <summary data-Accordion-trigger>\n            <h3>Example #2</h3>\n          </summary>\n          <div data-Accordion-content>\n            <p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>\n          </div>\n        </details>\n        <details data-Accordion-item data-Accordion-tween=\"0.2\">\n          <summary data-Accordion-trigger>\n            <h3>Example #3</h3>\n          </summary>\n          <div data-Accordion-content>\n            <p>Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit.</p>\n          </div>\n        </details>\n      </div>\n\n      "
  ]
}
1
2
3
<div class="m-rich-text">
	{{ content | join(" ") }}
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
@import "rich-text__accordion-item";
@import "rich-text__blockquote";
@import "rich-text__buttons";
@import "rich-text__ordered-list-item";
@import "rich-text__unordered-list-item";
@import "rich-text__table";
@import "rich-text__figure";

@mixin m-rich-text__body-level {
  @include spacing(
    (
      "xsmall": 16px,
      "medium+": 20px,
      "xlarge+": 24px,
    )
  );
}

@mixin m-rich-text__block-level($both: false) {
  @include spacing(
    (
      "xsmall": 32px,
      "medium+": 40px,
      "xlarge+": 48px,
    )
  );

  @if $both {
    &:not(:last-child) + *:not(:first-child) {
      // not's are only there to increase specificity
      @include spacing(
        (
          "xsmall": 32px,
          "medium+": 40px,
          "xlarge+": 48px,
        )
      );
    }
  }
}

.m-rich-text {
  $root-class: #{&};
  @include f-body-1;
  @include spacing(
    (
      "xsmall": 16px,
      "medium+": 24px,
    ),
    "margin-top",
    -1
  );

  &__body-level {
    @include m-rich-text__body-level;
  }

  &__block-level {
    @include m-rich-text__block-level(true);
  }

  &__block-list {
    border-top-width: 1px;
    margin-top: 32px;
  }

  /*
    Title Level
  */
  &__title {
    @include f-heading-5;
    @include m-rich-text__block-level;
  }

  &__sub-title {
    @include f-heading-2;
    @include m-rich-text__body-level;
  }

  &__sub-title-2 {
    @include f-heading-1;
    @include m-rich-text__body-level;
  }

  & &__title + &__sub-title {
    @include spacing(
      (
        "xsmall": 16px,
        "medium+": 20px,
        "xlarge+": 24px,
      )
    );
  }

  & &__sub-title + ol:not([class]),
  & &__sub-title + ul:not([class]),
  & &__sub-title + &__ordered-list,
  & &__sub-title + &__list {
    @include spacing(
      (
        "xsmall": 8px,
      )
    );
  }

  & &__sub-title + p:not([class]),
  & &__sub-title + &__body {
    @include spacing(
      (
        xsmall: 4px,
      )
    );
  }

  & &__sub-title-2 + p:not([class]),
  & &__sub-title-2 + &__body {
    @include spacing(
      (
        xsmall: 0px,
      )
    );
  }

  /*
    Body Level
  */

  &__link,
  & > dl a:not([class]),
  & > p a:not([class]),
  & > ol a:not([class]),
  & > ul a:not([class]) {
    @include a-link-sm;

    @media print {
      &[href]:after {
        content: " (" attr(href) ")";
      }
    }
  }

  small {
    color: var(--color--text--aux);
  }

  .a-link-strong {
    @include spacing(
      (
        xsmall: 12px,
      )
    );
  }

  & > p:not([class]),
  & > ol:not([class]),
  & > ul:not([class]),
  &__definition-list,
  &__body,
  &__ordered-list,
  &__list,
  &__note {
    @include m-rich-text__body-level();
  }

  & > ul:not([class]),
  & > ol:not([class]),
  &__ordered-list,
  &__list {
    margin-top: -4px;
    margin-left:24px;
  }

  & > ul:not([class]),
  & > ol:not([class]) {
    text-indent: -44px;
  }

  &__list-item,
  ul:not([class]) li {
    padding-top: 4px;
    @include m-rich-text__unordered-list-item();
    &:not(:last-child) > p {
      padding-bottom: 32px;
    }
  }

  &__ordered-list-item,
  ol:not([class]) li {
    @include m-rich-text__ordered-list-item();
    &:not(:last-child) > p {
      padding-bottom: 32px;
    }
  }

  dl:not([class]),
  &__definition-list {
    margin-top: -12px;
    display: block;
    @include m-rich-text__body-level;

    &:only-child {
      column-span: all;
      column-count: inherit;
      column-gap: inherit;
      margin-top: -24px;
      & > * {
        padding-top: 12px;
      }
    }

    & > * {
      break-inside: avoid;
    }
  }

  dt:not([class]),
  &__definition-term {
    @include f-heading-1;
    padding-top: 12px;
  }

  &__note {
    @include f-caption-1;
  }

  /*
    Block Level
  */

  &__buttons {
    @include m-rich-text__buttons;
    @include m-rich-text__block-level(true);
  }

  & > figure:not([class]),
  &__figure {
    @include m-rich-text__figure;
    // @include m-rich-text__block-level(true);
    @include m-rich-text__block-level;
  }

  & > figure:not([class]) + *,
  &__figure + * {
    @include m-rich-text__block-level;
  }

  &__blockquote,
  & > blockquote:not([class]) {
    @include m-rich-text__blockquote;
    @include m-rich-text__block-level(true);
  }

  details,
  &__accordion-item {
    @include m-rich-text__accordion-item;
    @include m-rich-text__block-level(true);

    & + details,
    & + #{$root-class}__accordion-item {
      padding-top: 0 !important;
    }
  }

  table:not([class]),
  &__table {
    @include m-rich-text__table;
  }

  & > table:not([class]),
  & > &__table {
    @include m-rich-text__block-level(true);
  }

  & > :first-child,
  & > :first-child:not([class]) {
    @include m-rich-text__body-level;
  }

  &-meta {
    padding-top:16px;

    & > * {
      margin-top: 20px;
    }

    &__item {

      &-title {
        font-size: 1rem;
        line-height: 1.5;
        --line-height: 24px;
        font-weight: 500;
        letter-spacing: 0em;
        font-variant-ligatures: common-ligatures;
        font-variant-numeric: oldstyle-nums;
        font-kerning: normal;
        font-feature-settings: "salt";
      }
    }

    @include breakpoint("large+") {
      display:flex;
      margin:0 -16px;
      flex-wrap:wrap;
      padding-top:0;

      &__item {
        flex: 1 1 0;
        min-width:254px;
        margin-top:0;
        padding: 16px 16px 0;
        border-top-width: 0;

        & a {
          @include a-link-sm;
        }
      }
    }
  }

  // etc

  canvas {
    width: 100%;
  }
}