@ilo-org/twig 0.0.1
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/.browserslistrc +4 -0
- package/.editorconfig +12 -0
- package/.eslintignore +11 -0
- package/.eslintrc.js +66 -0
- package/.prettierignore +16 -0
- package/.prettierrc.js +13 -0
- package/.stylelintignore +9 -0
- package/.stylelintrc +23 -0
- package/.turbo/turbo-build.log +15313 -0
- package/LICENSE +201 -0
- package/README.md +23 -0
- package/apps/storybook/assets.js +5 -0
- package/apps/storybook/config/prefix.yml +1 -0
- package/apps/storybook/main.js +16 -0
- package/apps/storybook/manager.js +7 -0
- package/apps/storybook/patterns/colors.stories.mdx +18 -0
- package/apps/storybook/patterns/typeset.stories.mdx +28 -0
- package/apps/storybook/patterns/welcome.stories.mdx +24 -0
- package/apps/storybook/preview-body.html +4 -0
- package/apps/storybook/preview-head.html +11 -0
- package/apps/storybook/preview.js +38 -0
- package/apps/storybook/styles.scss +2 -0
- package/apps/storybook/theme.js +11 -0
- package/babel.config.js +16 -0
- package/contributing.md +5 -0
- package/importprefix.js +18 -0
- package/importsvgs.js +5 -0
- package/jest.config.js +18 -0
- package/outputtwigs.js +54 -0
- package/package.json +108 -0
- package/postcss.config.js +6 -0
- package/src/namespaces.js +14 -0
- package/src/patterns/components/accordion/accordion-item.twig +16 -0
- package/src/patterns/components/accordion/accordion-item.wingsuit.yml +30 -0
- package/src/patterns/components/accordion/accordion.behavior.js +14 -0
- package/src/patterns/components/accordion/accordion.js +178 -0
- package/src/patterns/components/accordion/accordion.stories.jsx +7 -0
- package/src/patterns/components/accordion/accordion.twig +17 -0
- package/src/patterns/components/accordion/accordion.wingsuit.yml +59 -0
- package/src/patterns/components/accordion/index.js +7 -0
- package/src/patterns/components/breadcrumb/breadcrumb.behavior.js +14 -0
- package/src/patterns/components/breadcrumb/breadcrumb.js +93 -0
- package/src/patterns/components/breadcrumb/breadcrumb.stories.jsx +7 -0
- package/src/patterns/components/breadcrumb/breadcrumb.twig +32 -0
- package/src/patterns/components/breadcrumb/breadcrumb.wingsuit.yml +35 -0
- package/src/patterns/components/breadcrumb/index.js +7 -0
- package/src/patterns/components/button/button.stories.jsx +7 -0
- package/src/patterns/components/button/button.twig +18 -0
- package/src/patterns/components/button/button.wingsuit.yml +104 -0
- package/src/patterns/components/button/index.js +6 -0
- package/src/patterns/components/callout/callout.behaviors.js +14 -0
- package/src/patterns/components/callout/callout.js +121 -0
- package/src/patterns/components/callout/callout.stories.jsx +7 -0
- package/src/patterns/components/callout/callout.twig +30 -0
- package/src/patterns/components/callout/callout.wingsuit.yml +66 -0
- package/src/patterns/components/callout/index.js +6 -0
- package/src/patterns/components/card/card.stories.jsx +7 -0
- package/src/patterns/components/card/card.twig +98 -0
- package/src/patterns/components/card/card.wingsuit.yml +300 -0
- package/src/patterns/components/card/index.js +6 -0
- package/src/patterns/components/cardgroup/cardgroup.stories.jsx +7 -0
- package/src/patterns/components/cardgroup/cardgroup.twig +30 -0
- package/src/patterns/components/cardgroup/cardgroup.wingsuit.yml +419 -0
- package/src/patterns/components/cardgroup/index.js +6 -0
- package/src/patterns/components/contextmenu/contextmenu.stories.jsx +7 -0
- package/src/patterns/components/contextmenu/contextmenu.twig +12 -0
- package/src/patterns/components/contextmenu/contextmenu.wingsuit.yml +23 -0
- package/src/patterns/components/contextmenu/index.js +6 -0
- package/src/patterns/components/dropdown/dropdown.stories.jsx +7 -0
- package/src/patterns/components/dropdown/dropdown.twig +20 -0
- package/src/patterns/components/dropdown/dropdown.wingsuit.yml +71 -0
- package/src/patterns/components/dropdown/index.js +6 -0
- package/src/patterns/components/fieldset/fieldset.twig +43 -0
- package/src/patterns/components/footer/footer.stories.jsx +7 -0
- package/src/patterns/components/footer/footer.twig +62 -0
- package/src/patterns/components/footer/footer.wingsuit.yml +104 -0
- package/src/patterns/components/footer/index.js +6 -0
- package/src/patterns/components/form/checkbox.twig +13 -0
- package/src/patterns/components/form/checkboxgroup.twig +5 -0
- package/src/patterns/components/form/datepicker.twig +32 -0
- package/src/patterns/components/form/file.twig +14 -0
- package/src/patterns/components/form/fileupload.behavior.js +14 -0
- package/src/patterns/components/form/fileupload.js +118 -0
- package/src/patterns/components/form/form.stories.jsx +7 -0
- package/src/patterns/components/form/form.twig +94 -0
- package/src/patterns/components/form/form.wingsuit.yml +973 -0
- package/src/patterns/components/form/index.js +7 -0
- package/src/patterns/components/form/input.twig +13 -0
- package/src/patterns/components/form/number.twig +13 -0
- package/src/patterns/components/form/radio.twig +4 -0
- package/src/patterns/components/form/textarea.twig +13 -0
- package/src/patterns/components/hero/hero.stories.jsx +7 -0
- package/src/patterns/components/hero/hero.twig +24 -0
- package/src/patterns/components/hero/hero.wingsuit.yml +56 -0
- package/src/patterns/components/hero/index.js +6 -0
- package/src/patterns/components/herocard/herocard.stories.jsx +7 -0
- package/src/patterns/components/herocard/herocard.twig +31 -0
- package/src/patterns/components/herocard/herocard.wingsuit.yml +43 -0
- package/src/patterns/components/herocard/index.js +6 -0
- package/src/patterns/components/icon/icon.twig +4 -0
- package/src/patterns/components/icon/index.js +6 -0
- package/src/patterns/components/image/image.stories.jsx +7 -0
- package/src/patterns/components/image/image.twig +19 -0
- package/src/patterns/components/image/image.wingsuit.yml +37 -0
- package/src/patterns/components/image/index.js +6 -0
- package/src/patterns/components/link/index.js +6 -0
- package/src/patterns/components/link/link.stories.jsx +7 -0
- package/src/patterns/components/link/link.twig +8 -0
- package/src/patterns/components/link/link.wingsuit.yml +35 -0
- package/src/patterns/components/linklist/index.js +6 -0
- package/src/patterns/components/linklist/linklist.stories.jsx +7 -0
- package/src/patterns/components/linklist/linklist.twig +26 -0
- package/src/patterns/components/linklist/linklist.wingsuit.yml +53 -0
- package/src/patterns/components/list/index.js +6 -0
- package/src/patterns/components/list/list-item.twig +6 -0
- package/src/patterns/components/list/list-item.wingsuit.yml +18 -0
- package/src/patterns/components/list/list.stories.jsx +7 -0
- package/src/patterns/components/list/list.twig +30 -0
- package/src/patterns/components/list/list.wingsuit.yml +48 -0
- package/src/patterns/components/loading/index.js +7 -0
- package/src/patterns/components/loading/loading.behavior.js +14 -0
- package/src/patterns/components/loading/loading.js +102 -0
- package/src/patterns/components/loading/loading.stories.jsx +7 -0
- package/src/patterns/components/loading/loading.twig +8 -0
- package/src/patterns/components/loading/loading.wingsuit.yml +37 -0
- package/src/patterns/components/modal/index.js +7 -0
- package/src/patterns/components/modal/modal.behavior.js +14 -0
- package/src/patterns/components/modal/modal.js +130 -0
- package/src/patterns/components/modal/modal.stories.jsx +7 -0
- package/src/patterns/components/modal/modal.twig +18 -0
- package/src/patterns/components/modal/modal.wingsuit.yml +54 -0
- package/src/patterns/components/notification/index.js +7 -0
- package/src/patterns/components/notification/notification.behavior.js +15 -0
- package/src/patterns/components/notification/notification.js +95 -0
- package/src/patterns/components/notification/notification.stories.jsx +7 -0
- package/src/patterns/components/notification/notification.twig +18 -0
- package/src/patterns/components/notification/notification.wingsuit.yml +58 -0
- package/src/patterns/components/pagination/Pagination.stories.jsx +7 -0
- package/src/patterns/components/pagination/index.js +6 -0
- package/src/patterns/components/pagination/pagination.twig +48 -0
- package/src/patterns/components/pagination/pagination.wingsuit.yml +72 -0
- package/src/patterns/components/polyfill/index.js +6 -0
- package/src/patterns/components/polyfill/polyfill.twig +10 -0
- package/src/patterns/components/profile/index.js +6 -0
- package/src/patterns/components/profile/profile.stories.jsx +7 -0
- package/src/patterns/components/profile/profile.twig +18 -0
- package/src/patterns/components/profile/profile.wingsuit.yml +35 -0
- package/src/patterns/components/readmore/index.js +7 -0
- package/src/patterns/components/readmore/readmore.behavior.js +14 -0
- package/src/patterns/components/readmore/readmore.js +119 -0
- package/src/patterns/components/readmore/readmore.stories.jsx +7 -0
- package/src/patterns/components/readmore/readmore.twig +16 -0
- package/src/patterns/components/readmore/readmore.wingsuit.yml +32 -0
- package/src/patterns/components/richtext/index.js +6 -0
- package/src/patterns/components/richtext/richtext.stories.jsx +7 -0
- package/src/patterns/components/richtext/richtext.twig +6 -0
- package/src/patterns/components/richtext/richtext.wingsuit.yml +12 -0
- package/src/patterns/components/searchfield/index.js +6 -0
- package/src/patterns/components/searchfield/searchfield.stories.jsx +7 -0
- package/src/patterns/components/searchfield/searchfield.twig +7 -0
- package/src/patterns/components/searchfield/searchfield.wingsuit.yml +22 -0
- package/src/patterns/components/table/index.js +7 -0
- package/src/patterns/components/table/table.behavior.js +14 -0
- package/src/patterns/components/table/table.js +279 -0
- package/src/patterns/components/table/table.stories.jsx +7 -0
- package/src/patterns/components/table/table.twig +36 -0
- package/src/patterns/components/table/table.wingsuit.yml +112 -0
- package/src/patterns/components/tableofcontents/index.js +6 -0
- package/src/patterns/components/tableofcontents/tableofcontents.stories.jsx +7 -0
- package/src/patterns/components/tableofcontents/tableofcontents.twig +14 -0
- package/src/patterns/components/tableofcontents/tableofcontents.wingsuit.yml +22 -0
- package/src/patterns/components/tabs/index.js +7 -0
- package/src/patterns/components/tabs/tabs.behavior.js +23 -0
- package/src/patterns/components/tabs/tabs.js +209 -0
- package/src/patterns/components/tabs/tabs.stories.jsx +7 -0
- package/src/patterns/components/tabs/tabs.twig +30 -0
- package/src/patterns/components/tabs/tabs.wingsuit.yml +168 -0
- package/src/patterns/components/tag/index.js +7 -0
- package/src/patterns/components/tag/tag-set.twig +15 -0
- package/src/patterns/components/tag/tag.behavior.js +14 -0
- package/src/patterns/components/tag/tag.stories.jsx +7 -0
- package/src/patterns/components/tag/tag.twig +24 -0
- package/src/patterns/components/tag/tag.wingsuit.yml +43 -0
- package/src/patterns/components/tag/tagset.js +160 -0
- package/src/patterns/components/tag/tagset.wingsuit.yml +43 -0
- package/src/patterns/components/tooltip/index.js +7 -0
- package/src/patterns/components/tooltip/tooltip.behavior.js +14 -0
- package/src/patterns/components/tooltip/tooltip.js +184 -0
- package/src/patterns/components/tooltip/tooltip.stories.jsx +7 -0
- package/src/patterns/components/tooltip/tooltip.twig +11 -0
- package/src/patterns/components/tooltip/tooltip.wingsuit.yml +30 -0
- package/src/patterns/components/video/index.js +7 -0
- package/src/patterns/components/video/video.behavior.js +14 -0
- package/src/patterns/components/video/video.js +114 -0
- package/src/patterns/components/video/video.stories.jsx +7 -0
- package/src/patterns/components/video/video.twig +17 -0
- package/src/patterns/components/video/video.wingsuit.yml +44 -0
- package/src/patterns/components/video/videoplayer.twig +10 -0
- package/src/tokens/exports/_colors.scss +7 -0
- package/src/tokens/exports/_font-families.scss +6 -0
- package/src/tokens/exports/_font-sizes-heading.scss +10 -0
- package/src/tokens/index.scss +7 -0
- package/src/vendorjs/lib.vendor.js +1 -0
- package/wingsuit.config.js +27 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
pagination:
|
|
2
|
+
use: '@components/pagination/pagination.twig'
|
|
3
|
+
label: Pagination
|
|
4
|
+
description: The Pagination component presents a dismissible alert.
|
|
5
|
+
fields:
|
|
6
|
+
currentPage:
|
|
7
|
+
type: numeric
|
|
8
|
+
label: Current page
|
|
9
|
+
description: current page number that the user is on, zero-indexed
|
|
10
|
+
required: true
|
|
11
|
+
preview: 0
|
|
12
|
+
firstPageUrl:
|
|
13
|
+
type: string
|
|
14
|
+
label: First Page link
|
|
15
|
+
description: Link to the first page
|
|
16
|
+
required: true
|
|
17
|
+
preview: 'http://www.google.com?s=first'
|
|
18
|
+
firstPageTitle:
|
|
19
|
+
type: string
|
|
20
|
+
label: First Page Title
|
|
21
|
+
description: Title label for the first page
|
|
22
|
+
required: true
|
|
23
|
+
preview: 'First'
|
|
24
|
+
lastPageUrl:
|
|
25
|
+
type: string
|
|
26
|
+
label: Last Page link
|
|
27
|
+
description: Link to the last page
|
|
28
|
+
required: true
|
|
29
|
+
preview: 'http://www.google.com?s=last'
|
|
30
|
+
lastPageTitle:
|
|
31
|
+
type: string
|
|
32
|
+
label: Last Page Title
|
|
33
|
+
description: Title label for the last page
|
|
34
|
+
required: true
|
|
35
|
+
preview: 'Last'
|
|
36
|
+
nextPageUrl:
|
|
37
|
+
type: string
|
|
38
|
+
label: Next Page link
|
|
39
|
+
description: Link to the next page
|
|
40
|
+
required: true
|
|
41
|
+
preview: 'http://www.google.com?s=next'
|
|
42
|
+
nextPageTitle:
|
|
43
|
+
type: string
|
|
44
|
+
label: Next Page Title
|
|
45
|
+
description: Title label for the next page
|
|
46
|
+
required: true
|
|
47
|
+
preview: 'Next'
|
|
48
|
+
prevPageUrl:
|
|
49
|
+
type: string
|
|
50
|
+
label: Prev Page link
|
|
51
|
+
description: Link to the prev page
|
|
52
|
+
required: true
|
|
53
|
+
preview: 'http://www.google.com?s=prev'
|
|
54
|
+
prevPageTitle:
|
|
55
|
+
type: string
|
|
56
|
+
label: Prev Page Title
|
|
57
|
+
description: Title label for the prev page
|
|
58
|
+
required: true
|
|
59
|
+
preview: 'Previous'
|
|
60
|
+
pageCountPreposition:
|
|
61
|
+
type: string
|
|
62
|
+
label: Page Count Preposition
|
|
63
|
+
description: Linking word for the page count
|
|
64
|
+
required: true
|
|
65
|
+
preview: 'of'
|
|
66
|
+
totalPages:
|
|
67
|
+
type: numeric
|
|
68
|
+
label: Total Pages
|
|
69
|
+
description: The number of total pages
|
|
70
|
+
required: true
|
|
71
|
+
preview: 8
|
|
72
|
+
visibility: storybook
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{#
|
|
2
|
+
POLYFILL COMPONENT
|
|
3
|
+
|
|
4
|
+
This component is specifically to make this polyfill work correctly in Wingsuit. To use this in the context of Drupal, Wordpress, etc, consider using the approach documented at https://github.com/GoogleChromeLabs/container-query-polyfill
|
|
5
|
+
#}
|
|
6
|
+
<script>
|
|
7
|
+
if (!("container" in document.documentElement.style)) {
|
|
8
|
+
import("https://unpkg.com/container-query-polyfill@^0.2.0");
|
|
9
|
+
}
|
|
10
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{#
|
|
2
|
+
PROFILE COMPONENT
|
|
3
|
+
#}
|
|
4
|
+
<figure class="storybook {{prefix}}--profile">
|
|
5
|
+
<img class="{{prefix}}--profile--avatar" src="{{avatar}}" alt="Avatar for {{name}}">
|
|
6
|
+
<figcaption class="{{prefix}}--profile--contents">
|
|
7
|
+
<span class="{{prefix}}--profile--name id">{{name}}</span>
|
|
8
|
+
{% if role %}
|
|
9
|
+
<span class="{{prefix}}--profile--role id">{{role}}</span>
|
|
10
|
+
{% endif %}
|
|
11
|
+
{% if description %}
|
|
12
|
+
<p class="{{prefix}}--profile--description info">{{description}}</p>
|
|
13
|
+
{% endif %}
|
|
14
|
+
{% if link and link.url and link.label %}
|
|
15
|
+
<a class="{{prefix}}--profile--link info" href="{{link.url}}"><span>{{link.label}}</span></a>
|
|
16
|
+
{% endif %}
|
|
17
|
+
</figcaption>
|
|
18
|
+
</figure>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
profile:
|
|
2
|
+
use: '@components/profile/profile.twig'
|
|
3
|
+
label: Profile
|
|
4
|
+
description: The Profile component is used to display information about a person.
|
|
5
|
+
fields:
|
|
6
|
+
avatar:
|
|
7
|
+
type: string
|
|
8
|
+
label: Avatar
|
|
9
|
+
description: The avatar for the profile
|
|
10
|
+
required: true
|
|
11
|
+
preview: "http://placekitten.com/128/128"
|
|
12
|
+
description:
|
|
13
|
+
type: string
|
|
14
|
+
label: Description
|
|
15
|
+
description: An optional plain-text description (e.g. a short bio)
|
|
16
|
+
preview: "Firstname Lastname is the Senior Media Strategist. He has been with ILO for eight years."
|
|
17
|
+
link:
|
|
18
|
+
type: object
|
|
19
|
+
label: Link
|
|
20
|
+
description: An optional url and label for a link associated with the profile
|
|
21
|
+
preview:
|
|
22
|
+
label: "Optional Link"
|
|
23
|
+
url: "http://www.google.com"
|
|
24
|
+
name:
|
|
25
|
+
type: string
|
|
26
|
+
label: Name
|
|
27
|
+
description: The name of the person associated with the profile
|
|
28
|
+
preview: 'Firstname Lastname'
|
|
29
|
+
required: true
|
|
30
|
+
role:
|
|
31
|
+
type: string
|
|
32
|
+
label: Role
|
|
33
|
+
description: An optional plain-text field indicating the person's role in the organization
|
|
34
|
+
preview: 'Senior Media Strategist'
|
|
35
|
+
visibility: storybook
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import ReadMore from './readmore';
|
|
2
|
+
|
|
3
|
+
Drupal.behaviors.readmore = {
|
|
4
|
+
attach() {
|
|
5
|
+
Array.prototype.forEach.call(
|
|
6
|
+
document.querySelectorAll(`[data-loadcomponent="ReadMore"]`),
|
|
7
|
+
(element) => {
|
|
8
|
+
// eslint-disable-next-line no-console
|
|
9
|
+
console.log('loading ReadMore component....');
|
|
10
|
+
new ReadMore(element);
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { getUpdatedItems, EVENTS, ARIA } from '@ilo-org/utils';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The ReadMore module which handles rendering field labels inline on a form.
|
|
5
|
+
*
|
|
6
|
+
* @class ReadMore
|
|
7
|
+
*/
|
|
8
|
+
export default class ReadMore {
|
|
9
|
+
/**
|
|
10
|
+
* ReadMore constructor which assigns the element passed into the constructor
|
|
11
|
+
* to the `this.element` property for later reference
|
|
12
|
+
*
|
|
13
|
+
* @param {HTMLElement} element - REQUIRED - the module's container
|
|
14
|
+
*/
|
|
15
|
+
constructor(element) {
|
|
16
|
+
/**
|
|
17
|
+
* Reference to the DOM element that is the root of the component
|
|
18
|
+
* @property {Object}
|
|
19
|
+
*/
|
|
20
|
+
this.element = element;
|
|
21
|
+
|
|
22
|
+
// get the theme prefix
|
|
23
|
+
this.prefix = this.element.dataset.prefix;
|
|
24
|
+
|
|
25
|
+
// set some values
|
|
26
|
+
this.openclass = `${this.prefix}--read-more--open`;
|
|
27
|
+
this.buttonopenclass = `${this.prefix}--read-more--button--open`;
|
|
28
|
+
|
|
29
|
+
// grab our HTML text to swap
|
|
30
|
+
this.fulltext = this.element.dataset.fulltext;
|
|
31
|
+
|
|
32
|
+
// cache the excerpt
|
|
33
|
+
this.excerpt = this.element.dataset.excerpt;
|
|
34
|
+
|
|
35
|
+
// grab out button labels to swap
|
|
36
|
+
this.buttonlabel = {
|
|
37
|
+
closed: this.element.dataset.closed,
|
|
38
|
+
opened: this.element.dataset.opened,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// Initialize the view
|
|
42
|
+
this.init();
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Initializes the view by calling the functions to
|
|
47
|
+
* create DOM references, setup event handlers and
|
|
48
|
+
* then create the event listeners
|
|
49
|
+
*
|
|
50
|
+
* @return {Object} ReadMore A reference to the instance of the class
|
|
51
|
+
* @chainable
|
|
52
|
+
*/
|
|
53
|
+
init() {
|
|
54
|
+
this.cacheDomReferences().setupHandlers().enable();
|
|
55
|
+
|
|
56
|
+
return this;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Find all necessary DOM elements used in the view and cache them
|
|
61
|
+
*
|
|
62
|
+
* @return {Object} ReadMore A reference to the instance of the class
|
|
63
|
+
* @chainable
|
|
64
|
+
*/
|
|
65
|
+
cacheDomReferences() {
|
|
66
|
+
/**
|
|
67
|
+
* The button for toggling Read More state
|
|
68
|
+
* @type {Object}
|
|
69
|
+
*/
|
|
70
|
+
this.ReadMoreButton = this.element.querySelector(`.${this.prefix}--read-more--button`);
|
|
71
|
+
this.RichText = this.element.querySelector(`.${this.prefix}--richtext`);
|
|
72
|
+
|
|
73
|
+
return this;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Bind event handlers with the proper context of `this`.
|
|
78
|
+
*
|
|
79
|
+
* @return {Object} ReadMore A reference to the current instance of the class
|
|
80
|
+
* @chainable
|
|
81
|
+
*/
|
|
82
|
+
setupHandlers() {
|
|
83
|
+
this.onClick = this.onClick.bind(this);
|
|
84
|
+
|
|
85
|
+
return this;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Creates event listeners to enable interaction with view
|
|
90
|
+
*
|
|
91
|
+
* @return {Object} ReadMore A reference to the instance of the class
|
|
92
|
+
* @chainable
|
|
93
|
+
*/
|
|
94
|
+
enable() {
|
|
95
|
+
this.ReadMoreButton.addEventListener(EVENTS.CLICK, () => this.onClick());
|
|
96
|
+
|
|
97
|
+
return this;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Onclick interaction with the ReadMore button
|
|
102
|
+
*
|
|
103
|
+
* @return {Object} ReadMore A reference to the instance of the class
|
|
104
|
+
* @chainable
|
|
105
|
+
*/
|
|
106
|
+
onClick() {
|
|
107
|
+
if (this.element.classList.contains(this.openclass)) {
|
|
108
|
+
this.RichText.innerHTML = this.excerpt;
|
|
109
|
+
this.ReadMoreButton.innerHTML = this.buttonlabel.closed;
|
|
110
|
+
} else {
|
|
111
|
+
this.RichText.innerHTML = this.fulltext;
|
|
112
|
+
this.ReadMoreButton.innerHTML = this.buttonlabel.opened;
|
|
113
|
+
}
|
|
114
|
+
this.element.classList.toggle(this.openclass);
|
|
115
|
+
this.ReadMoreButton.classList.toggle(this.buttonopenclass);
|
|
116
|
+
|
|
117
|
+
return this;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{#
|
|
2
|
+
READ MORE COMPONENT
|
|
3
|
+
#}
|
|
4
|
+
{% set content = excerpt %}
|
|
5
|
+
{% set btnlabel = buttonlabel.closed %}
|
|
6
|
+
{% if openatstart is defined and openatstart == 'true' %}
|
|
7
|
+
{% set content = fulltext %}
|
|
8
|
+
{% set btnlabel = buttonlabel.opened %}
|
|
9
|
+
{% endif %}
|
|
10
|
+
|
|
11
|
+
<div class="{{prefix}}--read-more" data-excerpt="{{excerpt|raw}}" data-fulltext="{{fulltext|raw}}" data-closed="{{buttonlabel.closed}}" data-opened="{{buttonlabel.opened}}" data-loadcomponent="ReadMore" data-prefix="{{prefix}}">
|
|
12
|
+
{% include "@components/richtext/richtext.twig" with {
|
|
13
|
+
content: content,
|
|
14
|
+
} %}
|
|
15
|
+
<button class="{{prefix}}--read-more--button">{{btnlabel}}</button>
|
|
16
|
+
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
readmore:
|
|
2
|
+
use: '@components/readmore/readmore.twig'
|
|
3
|
+
label: Read More
|
|
4
|
+
description: A component for displaying rich text as entered in a WYSIWYG editor.
|
|
5
|
+
fields:
|
|
6
|
+
buttonlabel:
|
|
7
|
+
type: object
|
|
8
|
+
label: Button Label
|
|
9
|
+
description: labels for the two states of button
|
|
10
|
+
required: true
|
|
11
|
+
preview:
|
|
12
|
+
closed: Read More
|
|
13
|
+
opened: Close
|
|
14
|
+
excerpt:
|
|
15
|
+
type: string
|
|
16
|
+
label: Excerpt
|
|
17
|
+
description: HTML content
|
|
18
|
+
preview: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
|
19
|
+
required: true
|
|
20
|
+
fulltext:
|
|
21
|
+
type: string
|
|
22
|
+
label: Full Text
|
|
23
|
+
description: HTML content
|
|
24
|
+
preview: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
|
|
25
|
+
required: true
|
|
26
|
+
openatstart:
|
|
27
|
+
type: boolean
|
|
28
|
+
label: Open At Start
|
|
29
|
+
description: should the read more be open at page load?
|
|
30
|
+
preview: false
|
|
31
|
+
required: true
|
|
32
|
+
visibility: storybook
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
richtext:
|
|
2
|
+
use: '@components/richtext/richtext.twig'
|
|
3
|
+
label: Rich Text
|
|
4
|
+
description: A component for displaying rich text as entered in a WYSIWYG editor.
|
|
5
|
+
fields:
|
|
6
|
+
content:
|
|
7
|
+
type: string
|
|
8
|
+
label: Content
|
|
9
|
+
description: HTML content
|
|
10
|
+
preview: "<h1>Apollo 11</h1><p><strong>Apollo 11</strong> was the spaceflight that landed the first humans, Americans <a href='http://en.wikipedia.org/wiki/Neil_Armstrong'>Neil Armstrong</a> and <a href='http://en.wikipedia.org/wiki/Buzz_Aldrin'>Buzz Aldrin</a>, on the Moon on July 20, 1969, at 20:18 UTC. Armstrong became the first to step onto the lunar surface 6 hours later on July 21 at 02:56 UTC.</p><p>Armstrong spent about <s>three and a half</s> two and a half hours outside the spacecraft, Aldrin slightly less; and together they collected 47.5 pounds (21.5 kg) of lunar material for return to Earth. A third member of the mission, <a href='http://en.wikipedia.org/wiki/Michael_Collins_(astronaut)'>Michael Collins</a>, piloted the <a href='http://en.wikipedia.org/wiki/Apollo_Command/Service_Module'>command</a> spacecraft alone in lunar orbit until Armstrong and Aldrin returned to it for the trip back to Earth. <figure><img alt='placeholder image' class='right' src='https://place-hold.it/400x300?text=Placeholder Image'><figcaption>The caption for this image</figcaption></figure></p><h2>Broadcasting and <em>quotes</em> <a id='quotes' name='quotes'></a></h2><p>Broadcast on live TV to a world-wide audience, Armstrong stepped onto the lunar surface and described the event as:</p><blockquote><p>One small step for [a] man, one giant leap for mankind</p><cite>Neil Armstrong</cite></blockquote><h2>Technical details <a id='tech-details' name='tech-details'></a></h2><p>Launched by a <strong>Saturn V</strong> rocket from <a href='http://en.wikipedia.org/wiki/Kennedy_Space_Center'>Kennedy Space Center</a> in Merritt Island, Florida on July 16, Apollo 11 was the fifth manned mission of <a href='http://en.wikipedia.org/wiki/NASA'>NASA</a>'s Apollo program. The Apollo spacecraft had three parts:</p><ol><li><strong>Command Module</strong> with a cabin for the three astronauts which was the only part which landed back on Earth</li><li><strong>Service Module</strong> which supported the Command Module with propulsion, electrical power, oxygen and water</li><li><strong>Lunar Module</strong> for landing on the Moon.</li></ol><p>After being sent to the Moon by the Saturn V's upper stage, the astronauts separated the spacecraft from it and travelled for three days until they entered into lunar orbit. Armstrong and Aldrin then moved into the Lunar Module and landed in the <a href='http://en.wikipedia.org/wiki/Mare_Tranquillitatis'>Sea of Tranquility</a>. They stayed a total of about 21 and a half hours on the lunar surface. After lifting off in the upper part of the Lunar Module and rejoining Collins in the Command Module, they returned to Earth and landed in the <a href='http://en.wikipedia.org/wiki/Pacific_Ocean'>Pacific Ocean</a> on July 24.</p><hr><p><small>Source: <a href='http://en.wikipedia.org/wiki/Apollo_11'>Wikipedia.org</a></small></p>"
|
|
11
|
+
required: true
|
|
12
|
+
visibility: storybook
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
searchfield:
|
|
2
|
+
use: '@components/searchfield/searchfield.twig'
|
|
3
|
+
label: Search Field
|
|
4
|
+
description: A component for displaying a search field.
|
|
5
|
+
fields:
|
|
6
|
+
action:
|
|
7
|
+
type: string
|
|
8
|
+
label: action
|
|
9
|
+
description: The form's action attribute
|
|
10
|
+
preview: "http://www.ilo.org"
|
|
11
|
+
required: false
|
|
12
|
+
input:
|
|
13
|
+
type: object
|
|
14
|
+
label: input
|
|
15
|
+
description: The search field input's attributes
|
|
16
|
+
preview:
|
|
17
|
+
label: "Search Field Label"
|
|
18
|
+
helper: "The search field's helper text"
|
|
19
|
+
name: "text"
|
|
20
|
+
placeholder: "Search Field"
|
|
21
|
+
type: "text"
|
|
22
|
+
visibility: storybook
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Table from './table';
|
|
2
|
+
|
|
3
|
+
Drupal.behaviors.table = {
|
|
4
|
+
attach() {
|
|
5
|
+
Array.prototype.forEach.call(
|
|
6
|
+
document.querySelectorAll(`[data-loadcomponent="Table"]`),
|
|
7
|
+
(element) => {
|
|
8
|
+
// eslint-disable-next-line no-console
|
|
9
|
+
console.log('loading Table component....');
|
|
10
|
+
new Table(element);
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
},
|
|
14
|
+
};
|