@xplortech/apollo-core 0.5.2 → 0.5.3
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/dist/apollo-core/apollo-core.css +5468 -9
- package/dist/apollo-core/apollo-core.esm.js +125 -1
- package/dist/apollo-core/app-globals-0f993ce5.js +3 -0
- package/dist/apollo-core/css-shim-bbdf0cc6.js +4 -0
- package/dist/apollo-core/dom-1f98a75f.js +73 -0
- package/dist/apollo-core/index-3c9f25ef.js +2938 -0
- package/dist/apollo-core/index-912d1a21.js +584 -0
- package/dist/apollo-core/index.esm.js +1 -0
- package/dist/{cjs/regular-872f5226.js → apollo-core/regular-133c23b5.js} +12 -3
- package/dist/apollo-core/shadow-css-67b66845.js +389 -0
- package/dist/apollo-core/xpl-application-shell.entry.js +50 -0
- package/dist/apollo-core/xpl-avatar.entry.js +19 -0
- package/dist/apollo-core/xpl-backdrop.entry.js +21 -0
- package/dist/{esm → apollo-core}/xpl-badge.entry.js +1 -1
- package/dist/{collection/components/xpl-breadcrumbs/xpl-breadcrumb-item/xpl-breadcrumb-item.js → apollo-core/xpl-breadcrumb-item.entry.js} +9 -12
- package/dist/apollo-core/xpl-breadcrumbs.entry.js +14 -0
- package/dist/{esm → apollo-core}/xpl-button-row.entry.js +1 -1
- package/dist/apollo-core/xpl-button.entry.js +34 -0
- package/dist/apollo-core/xpl-checkbox.entry.js +25 -0
- package/dist/{esm → apollo-core}/xpl-choicelist.entry.js +1 -1
- package/dist/apollo-core/xpl-content-area.entry.js +16 -0
- package/dist/{esm → apollo-core}/xpl-divider.entry.js +1 -1
- package/dist/{esm → apollo-core}/xpl-grid-item.entry.js +1 -1
- package/dist/{esm → apollo-core}/xpl-grid.entry.js +1 -1
- package/dist/{esm → apollo-core}/xpl-input.entry.js +20 -3
- package/dist/{esm → apollo-core}/xpl-list.entry.js +2 -2
- package/dist/apollo-core/xpl-main-nav.entry.js +26 -0
- package/dist/apollo-core/xpl-nav-item.entry.js +12 -0
- package/dist/{esm → apollo-core}/xpl-pagination.entry.js +1 -1
- package/dist/apollo-core/xpl-radio.entry.js +25 -0
- package/dist/apollo-core/xpl-secondary-nav.entry.js +12 -0
- package/dist/{esm → apollo-core}/xpl-select.entry.js +43 -3
- package/dist/{esm → apollo-core}/xpl-table.entry.js +1 -1
- package/dist/{esm → apollo-core}/xpl-tag.entry.js +1 -1
- package/dist/{esm → apollo-core}/xpl-toggle.entry.js +2 -2
- package/dist/apollo-core/xpl-utility-bar.entry.js +25 -0
- package/dist/types/components/xpl-choicelist/choice.d.ts +1 -1
- package/dist/types/components/xpl-choicelist/xpl-choicelist.d.ts +1 -0
- package/dist/types/components/xpl-dropdown/dropdownchoice.d.ts +5 -5
- package/dist/types/components/xpl-dropdown/xpl-dropdown.d.ts +1 -0
- package/dist/types/components/xpl-list/listitem.d.ts +15 -15
- package/dist/types/components/xpl-list/xpl-list.d.ts +1 -0
- package/dist/types/components/xpl-select/xpl-select.d.ts +1 -0
- package/dist/types/components.d.ts +3 -0
- package/package.json +1 -1
- package/dist/apollo-core/p-0203d4e8.entry.js +0 -1
- package/dist/apollo-core/p-0b2c612e.entry.js +0 -1
- package/dist/apollo-core/p-128a0240.entry.js +0 -1
- package/dist/apollo-core/p-2f90296c.js +0 -10
- package/dist/apollo-core/p-30003b15.entry.js +0 -1
- package/dist/apollo-core/p-4e56a2ca.entry.js +0 -1
- package/dist/apollo-core/p-5854d1e4.entry.js +0 -1
- package/dist/apollo-core/p-611536d8.entry.js +0 -1
- package/dist/apollo-core/p-7c9fee7e.entry.js +0 -1
- package/dist/apollo-core/p-8b6633c7.js +0 -1
- package/dist/apollo-core/p-97cd1f73.entry.js +0 -1
- package/dist/apollo-core/p-9c5ca308.entry.js +0 -1
- package/dist/apollo-core/p-ad90fe4d.js +0 -1
- package/dist/apollo-core/p-bd4a7e3c.entry.js +0 -1
- package/dist/apollo-core/p-dab8e7a1.entry.js +0 -1
- package/dist/apollo-core/p-eb63b401.entry.js +0 -1
- package/dist/apollo-core/p-ee2f4422.entry.js +0 -1
- package/dist/apollo-core/p-f167aa05.entry.js +0 -1
- package/dist/cjs/apollo-core.cjs.js +0 -19
- package/dist/cjs/index-944adb2e.js +0 -1609
- package/dist/cjs/index.cjs.js +0 -2
- package/dist/cjs/loader.cjs.js +0 -21
- package/dist/cjs/v4-14140ff3.js +0 -77
- package/dist/cjs/xpl-application-shell_11.cjs.entry.js +0 -230
- package/dist/cjs/xpl-badge.cjs.entry.js +0 -21
- package/dist/cjs/xpl-button-row.cjs.entry.js +0 -24
- package/dist/cjs/xpl-checkbox_2.cjs.entry.js +0 -51
- package/dist/cjs/xpl-choicelist.cjs.entry.js +0 -36
- package/dist/cjs/xpl-divider.cjs.entry.js +0 -18
- package/dist/cjs/xpl-grid-item.cjs.entry.js +0 -25
- package/dist/cjs/xpl-grid.cjs.entry.js +0 -35
- package/dist/cjs/xpl-input.cjs.entry.js +0 -2527
- package/dist/cjs/xpl-list.cjs.entry.js +0 -63
- package/dist/cjs/xpl-pagination.cjs.entry.js +0 -76
- package/dist/cjs/xpl-select.cjs.entry.js +0 -623
- package/dist/cjs/xpl-table.cjs.entry.js +0 -89
- package/dist/cjs/xpl-tag.cjs.entry.js +0 -21
- package/dist/cjs/xpl-toggle.cjs.entry.js +0 -34
- package/dist/collection/collection-manifest.json +0 -37
- package/dist/collection/components/xpl-application-shell/xpl-application-shell.js +0 -143
- package/dist/collection/components/xpl-avatar/xpl-avatar.js +0 -158
- package/dist/collection/components/xpl-backdrop/xpl-backdrop.js +0 -41
- package/dist/collection/components/xpl-badge/xpl-badge.js +0 -50
- package/dist/collection/components/xpl-breadcrumbs/xpl-breadcrumbs/xpl-breadcrumbs.js +0 -15
- package/dist/collection/components/xpl-button/xpl-button.js +0 -214
- package/dist/collection/components/xpl-button-row/xpl-button-row.js +0 -119
- package/dist/collection/components/xpl-checkbox/xpl-checkbox.js +0 -185
- package/dist/collection/components/xpl-choicelist/xpl-choicelist.js +0 -143
- package/dist/collection/components/xpl-content-area/xpl-content-area.js +0 -39
- package/dist/collection/components/xpl-divider/xpl-divider.js +0 -30
- package/dist/collection/components/xpl-dropdown/xpl-dropdown.js +0 -32
- package/dist/collection/components/xpl-grid/xpl-grid.js +0 -26
- package/dist/collection/components/xpl-grid-item/xpl-grid-item.js +0 -93
- package/dist/collection/components/xpl-input/xpl-input.js +0 -471
- package/dist/collection/components/xpl-list/xpl-list.js +0 -93
- package/dist/collection/components/xpl-main-nav/xpl-main-nav.js +0 -72
- package/dist/collection/components/xpl-nav-item/xpl-nav-item.js +0 -10
- package/dist/collection/components/xpl-pagination/xpl-pagination.js +0 -189
- package/dist/collection/components/xpl-radio/xpl-radio.js +0 -168
- package/dist/collection/components/xpl-secondary-nav/xpl-secondary-nav.js +0 -9
- package/dist/collection/components/xpl-select/xpl-select.js +0 -311
- package/dist/collection/components/xpl-table/xpl-table.js +0 -194
- package/dist/collection/components/xpl-tag/xpl-tag.js +0 -30
- package/dist/collection/components/xpl-toggle/xpl-toggle.js +0 -157
- package/dist/collection/components/xpl-utility-bar/xpl-utility-bar.js +0 -70
- package/dist/custom-elements/index.js +0 -19959
- package/dist/esm/apollo-core.js +0 -17
- package/dist/esm/index-899dba3b.js +0 -1580
- package/dist/esm/index.js +0 -1
- package/dist/esm/loader.js +0 -17
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/esm/regular-86225e9d.js +0 -16041
- package/dist/esm/v4-929670b7.js +0 -75
- package/dist/esm/xpl-application-shell_11.entry.js +0 -216
- package/dist/esm/xpl-checkbox_2.entry.js +0 -46
- package/dist/index.cjs.js +0 -1
- package/dist/index.js +0 -1
- package/dist/stories/application-shell.stories.js +0 -766
- package/dist/stories/avatar.stories.js +0 -173
- package/dist/stories/backdrop.stories.js +0 -18
- package/dist/stories/badge.stories.js +0 -48
- package/dist/stories/breadcrumbs.stories.js +0 -115
- package/dist/stories/button-row.stories.js +0 -64
- package/dist/stories/button.stories.js +0 -98
- package/dist/stories/checkbox.stories.js +0 -76
- package/dist/stories/choicelist.stories.js +0 -112
- package/dist/stories/content-area.stories.js +0 -53
- package/dist/stories/divider.stories.js +0 -34
- package/dist/stories/grid.stories.js +0 -100
- package/dist/stories/input.stories.js +0 -252
- package/dist/stories/list.stories.js +0 -134
- package/dist/stories/main-nav.stories.js +0 -308
- package/dist/stories/pagination.stories.js +0 -84
- package/dist/stories/radio.stories.js +0 -66
- package/dist/stories/secondary-nav.stories.js +0 -76
- package/dist/stories/select.stories.js +0 -111
- package/dist/stories/table.stories.js +0 -107
- package/dist/stories/tabs.stories.js +0 -24
- package/dist/stories/toggle.stories.js +0 -80
- package/dist/stories/utility-bar.stories.js +0 -94
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/application-shell.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/avatar.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/backdrop.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/badge.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/breadcrumbs.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/button-row.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/button.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/checkbox.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/choicelist.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/content-area.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/divider.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/grid.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/input.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/list.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/main-nav.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/pagination.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/radio.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/secondary-nav.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/select.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/table.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/tabs.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/toggle.stories.d.ts +0 -0
- /package/dist/types/Users/{fernandogelin/Projects → roc/Sites}/apollo/.stencil/stories/utility-bar.stories.d.ts +0 -0
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { v4 as uuid } from "uuid";
|
|
2
|
-
export default {
|
|
3
|
-
title: "Components/Choicelist",
|
|
4
|
-
argTypes: {
|
|
5
|
-
multi: {
|
|
6
|
-
control: {
|
|
7
|
-
type: "boolean",
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
styled: {
|
|
11
|
-
control: {
|
|
12
|
-
type: "boolean",
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
};
|
|
17
|
-
const data = [
|
|
18
|
-
{
|
|
19
|
-
label: "Label #1",
|
|
20
|
-
description: "Lorem ipsum dolor sit amet",
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
label: "Label #2",
|
|
24
|
-
description: "Lorem ipsum dolor sit amet",
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
label: "Label #3",
|
|
28
|
-
description: "Lorem ipsum dolor sit amet",
|
|
29
|
-
}
|
|
30
|
-
];
|
|
31
|
-
const script = ({ id, multi, styled }) => `
|
|
32
|
-
(function() {
|
|
33
|
-
const choicelist = document.getElementById("${id}");
|
|
34
|
-
choicelist.choices = ${JSON.stringify(data)};
|
|
35
|
-
choicelist.multi = ${multi ? 'true' : 'false'};
|
|
36
|
-
choicelist.styled = ${styled ? 'true' : 'false'};
|
|
37
|
-
})();
|
|
38
|
-
`;
|
|
39
|
-
export const Choicelist = ({ multi, styled }) => {
|
|
40
|
-
const id = uuid();
|
|
41
|
-
return `<xpl-choicelist id="${id}" name="choicelist"></xpl-choicelist><script>${script({
|
|
42
|
-
id,
|
|
43
|
-
multi,
|
|
44
|
-
styled
|
|
45
|
-
})}</script>`;
|
|
46
|
-
};
|
|
47
|
-
Choicelist.parameters = {
|
|
48
|
-
layout: "centered",
|
|
49
|
-
"web-component": {
|
|
50
|
-
render({ multi, styled }) {
|
|
51
|
-
let attrs = "";
|
|
52
|
-
if (multi)
|
|
53
|
-
attrs += " multi";
|
|
54
|
-
if (styled)
|
|
55
|
-
attrs += " styled";
|
|
56
|
-
return [
|
|
57
|
-
`<xpl-choicelist${attrs} name="choicelist-name"></xpl-choicelist>`,
|
|
58
|
-
`choicelist.choices = [
|
|
59
|
-
{
|
|
60
|
-
label: "Label #1",
|
|
61
|
-
description: "Lorem ipsum dolor sit amet"
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
label: "Label #2",
|
|
65
|
-
description: "Lorem ipsum dolor sit amet"
|
|
66
|
-
},
|
|
67
|
-
...
|
|
68
|
-
];`,
|
|
69
|
-
];
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
html: {
|
|
73
|
-
render({ multi, styled }) {
|
|
74
|
-
let className = "xpl-choicelist";
|
|
75
|
-
if (styled)
|
|
76
|
-
className += " xpl-choicelist--styled";
|
|
77
|
-
const output = [];
|
|
78
|
-
if (styled)
|
|
79
|
-
output.push(`WARNING: For \`styled\` choicelists, there is
|
|
80
|
-
JS interactivity that is only provided by the web component
|
|
81
|
-
(specifically highlighting the background of a choice). The
|
|
82
|
-
code shown below does not reflect the additional \`styled\`
|
|
83
|
-
choicelist markup and interactivity.`);
|
|
84
|
-
output.push(`<ul class="${className}">
|
|
85
|
-
<li>
|
|
86
|
-
<div class="xpl-${multi ? 'checkbox' : 'radio'}-container">
|
|
87
|
-
<input class="xpl-${multi ? 'checkbox' : 'radio'}" id="choice-1" name="choicelist-name" type="${multi ? 'checkbox' : 'radio'}" value="choice-1"></input>
|
|
88
|
-
<label for="choice-1">
|
|
89
|
-
Label #1
|
|
90
|
-
<small>Lorem ipsum dolor sit amet</small>
|
|
91
|
-
</label>
|
|
92
|
-
</div>
|
|
93
|
-
</li>
|
|
94
|
-
<li>
|
|
95
|
-
<div class="xpl-${multi ? 'checkbox' : 'radio'}-container">
|
|
96
|
-
<input class="xpl-${multi ? 'checkbox' : 'radio'}" id="choice-2" name="choicelist-name" type="${multi ? 'checkbox' : 'radio'}" value="choice-2"></input>
|
|
97
|
-
<label for="choice-2">
|
|
98
|
-
Label #2
|
|
99
|
-
<small>Lorem ipsum dolor sit amet</small>
|
|
100
|
-
</label>
|
|
101
|
-
</div>
|
|
102
|
-
</li>
|
|
103
|
-
...
|
|
104
|
-
</ul>`);
|
|
105
|
-
return output;
|
|
106
|
-
},
|
|
107
|
-
},
|
|
108
|
-
};
|
|
109
|
-
Choicelist.args = {
|
|
110
|
-
multi: false,
|
|
111
|
-
styled: false,
|
|
112
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
title: "Components/Content Area",
|
|
3
|
-
argTypes: {
|
|
4
|
-
size: {
|
|
5
|
-
options: ["wide", "narrow", "full"],
|
|
6
|
-
control: {
|
|
7
|
-
type: "select",
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
}
|
|
11
|
-
};
|
|
12
|
-
export const ContentArea = ({ size }) => `<xpl-content-area size="${size}">
|
|
13
|
-
<div>
|
|
14
|
-
Sed ut perspiciatis unde omnis iste natus error sit voluptatem
|
|
15
|
-
accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae
|
|
16
|
-
ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt
|
|
17
|
-
explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
|
|
18
|
-
sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro
|
|
19
|
-
quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia
|
|
20
|
-
non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
|
|
21
|
-
Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi
|
|
22
|
-
ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate
|
|
23
|
-
velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla
|
|
24
|
-
pariatur?
|
|
25
|
-
</div>
|
|
26
|
-
</xpl-content-area>`;
|
|
27
|
-
ContentArea.parameters = {
|
|
28
|
-
"web-component": {
|
|
29
|
-
render: ContentArea,
|
|
30
|
-
},
|
|
31
|
-
html: {
|
|
32
|
-
render: ({ size }) => `
|
|
33
|
-
<main class="xpl-content-area-wrapper xpl-content-area-wrapper__${size}">
|
|
34
|
-
<div class="xpl-content-area">
|
|
35
|
-
Sed ut perspiciatis unde omnis iste natus error sit voluptatem
|
|
36
|
-
accusantium doloremque laudantium, totam rem aperiam, eaque ipsa quae
|
|
37
|
-
ab illo inventore veritatis et quasi architecto beatae vitae dicta sunt
|
|
38
|
-
explicabo. Nemo enim ipsam voluptatem quia voluptas sit aspernatur aut odit aut fugit,
|
|
39
|
-
sed quia consequuntur magni dolores eos qui ratione voluptatem sequi nesciunt. Neque porro
|
|
40
|
-
quisquam est, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia
|
|
41
|
-
non numquam eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem.
|
|
42
|
-
Ut enim ad minima veniam, quis nostrum exercitationem ullam corporis suscipit laboriosam, nisi
|
|
43
|
-
ut aliquid ex ea commodi consequatur? Quis autem vel eum iure reprehenderit qui in ea voluptate
|
|
44
|
-
velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum fugiat quo voluptas nulla
|
|
45
|
-
pariatur?
|
|
46
|
-
</div>
|
|
47
|
-
</main>
|
|
48
|
-
`,
|
|
49
|
-
},
|
|
50
|
-
};
|
|
51
|
-
ContentArea.args = {
|
|
52
|
-
size: "wide",
|
|
53
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
title: "Components/Divider",
|
|
3
|
-
argTypes: {
|
|
4
|
-
tier: {
|
|
5
|
-
options: [3, 2, 1, 0],
|
|
6
|
-
control: {
|
|
7
|
-
type: "select",
|
|
8
|
-
},
|
|
9
|
-
},
|
|
10
|
-
text: {
|
|
11
|
-
type: { name: "string", required: false },
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
};
|
|
15
|
-
export const Divider = ({ tier, text }) => {
|
|
16
|
-
let attrs = "";
|
|
17
|
-
attrs += ` tier="${tier}"`;
|
|
18
|
-
return `<xpl-divider${attrs}>${text}</xpl-divider>`;
|
|
19
|
-
};
|
|
20
|
-
Divider.parameters = {
|
|
21
|
-
layout: "centered",
|
|
22
|
-
"web-component": {
|
|
23
|
-
render: Divider,
|
|
24
|
-
},
|
|
25
|
-
html: {
|
|
26
|
-
render({ tier, text }) {
|
|
27
|
-
return `<div class="xpl-divider xpl-divider--${tier.toString()}">${text}</div>`;
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
Divider.args = {
|
|
32
|
-
tier: 3,
|
|
33
|
-
text: "Lorem Ipsum",
|
|
34
|
-
};
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
title: "Components/Grid",
|
|
3
|
-
argTypes: {
|
|
4
|
-
unit1Lg: { control: { type: "number", }, },
|
|
5
|
-
unit1Md: { control: { type: "number", }, },
|
|
6
|
-
unit1Sm: { control: { type: "number", }, },
|
|
7
|
-
unit1Xs: { control: { type: "number", }, },
|
|
8
|
-
unit2Lg: { control: { type: "number", }, },
|
|
9
|
-
unit2Md: { control: { type: "number", }, },
|
|
10
|
-
unit2Sm: { control: { type: "number", }, },
|
|
11
|
-
unit2Xs: { control: { type: "number", }, },
|
|
12
|
-
unit3Lg: { control: { type: "number", }, },
|
|
13
|
-
unit3Md: { control: { type: "number", }, },
|
|
14
|
-
unit3Sm: { control: { type: "number", }, },
|
|
15
|
-
unit3Xs: { control: { type: "number", }, },
|
|
16
|
-
unit4Lg: { control: { type: "number", }, },
|
|
17
|
-
unit4Md: { control: { type: "number", }, },
|
|
18
|
-
unit4Sm: { control: { type: "number", }, },
|
|
19
|
-
unit4Xs: { control: { type: "number", }, },
|
|
20
|
-
},
|
|
21
|
-
};
|
|
22
|
-
export const Grid = ({ unit1Lg, unit1Md, unit1Sm, unit1Xs, unit2Lg, unit2Md, unit2Sm, unit2Xs, unit3Lg, unit3Md, unit3Sm, unit3Xs, unit4Lg, unit4Md, unit4Sm, unit4Xs, }) => {
|
|
23
|
-
return `<xpl-grid>
|
|
24
|
-
<xpl-grid-item lg="${unit1Lg}" md="${unit1Md}" sm="${unit1Sm}" xs="${unit1Xs}" style="border: 1px solid red;">
|
|
25
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut scelerisque, diam non vulputate pretium, metus lectus vulputate purus, nec laoreet lectus enim vitae ipsum. Phasellus molestie luctus egestas.
|
|
26
|
-
</xpl-grid-item>
|
|
27
|
-
<xpl-grid-item lg="${unit2Lg}" md="${unit2Md}" sm="${unit2Sm}" xs="${unit2Xs}" style="border: 1px solid red;">
|
|
28
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut scelerisque, diam non vulputate pretium, metus lectus vulputate purus, nec laoreet lectus enim vitae ipsum. Phasellus molestie luctus egestas.
|
|
29
|
-
</xpl-grid-item>
|
|
30
|
-
<xpl-grid-item lg="${unit3Lg}" md="${unit3Md}" sm="${unit3Sm}" xs="${unit3Xs}" style="border: 1px solid red;">
|
|
31
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut scelerisque, diam non vulputate pretium, metus lectus vulputate purus, nec laoreet lectus enim vitae ipsum. Phasellus molestie luctus egestas.
|
|
32
|
-
</xpl-grid-item>
|
|
33
|
-
<xpl-grid-item lg="${unit4Lg}" md="${unit4Md}" sm="${unit4Sm}" xs="${unit4Xs}" style="border: 1px solid red;">
|
|
34
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut scelerisque, diam non vulputate pretium, metus lectus vulputate purus, nec laoreet lectus enim vitae ipsum. Phasellus molestie luctus egestas.
|
|
35
|
-
</xpl-grid-item>
|
|
36
|
-
</xpl-grid>`;
|
|
37
|
-
};
|
|
38
|
-
Grid.parameters = {
|
|
39
|
-
layout: "centered",
|
|
40
|
-
"web-component": {
|
|
41
|
-
render({ unit1Lg, unit1Md, unit1Sm, unit1Xs, unit2Lg, unit2Md, unit2Sm, unit2Xs, unit3Lg, unit3Md, unit3Sm, unit3Xs, unit4Lg, unit4Md, unit4Sm, unit4Xs, }) {
|
|
42
|
-
return `<xpl-grid>
|
|
43
|
-
<xpl-grid-item lg="${unit1Lg}" md="${unit1Md}" sm="${unit1Sm}" xs="${unit1Xs}">
|
|
44
|
-
Lorem ipsum...
|
|
45
|
-
</xpl-grid-item>
|
|
46
|
-
<xpl-grid-item lg="${unit2Lg}" md="${unit2Md}" sm="${unit2Sm}" xs="${unit2Xs}">
|
|
47
|
-
Lorem ipsum...
|
|
48
|
-
</xpl-grid-item>
|
|
49
|
-
<xpl-grid-item lg="${unit3Lg}" md="${unit3Md}" sm="${unit3Sm}" xs="${unit3Xs}">
|
|
50
|
-
Lorem ipsum...
|
|
51
|
-
</xpl-grid-item>
|
|
52
|
-
<xpl-grid-item lg="${unit4Lg}" md="${unit4Md}" sm="${unit4Sm}" xs="${unit4Xs}">
|
|
53
|
-
Lorem ipsum...
|
|
54
|
-
</xpl-grid-item>
|
|
55
|
-
</xpl-grid>`;
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
html: {
|
|
59
|
-
render() {
|
|
60
|
-
// const columns = layout.split(",").map(c => +c);
|
|
61
|
-
// return `<div class="xpl-grid" id="grid-id">
|
|
62
|
-
// <style>
|
|
63
|
-
// @media screen and (max-width: ${breakpoint}px) {
|
|
64
|
-
// #grid-id {
|
|
65
|
-
// display: block;
|
|
66
|
-
// }
|
|
67
|
-
// #grid-id [class^="xpl-grid__col"] {
|
|
68
|
-
// margin-bottom: 1.5rem;
|
|
69
|
-
// margin-right: 0;
|
|
70
|
-
// width: 100%;
|
|
71
|
-
// }
|
|
72
|
-
// }
|
|
73
|
-
// </style>${columns.map(c => {
|
|
74
|
-
// return `
|
|
75
|
-
// <div class="xpl-grid__col-${c}">
|
|
76
|
-
// Lorem ipsum...
|
|
77
|
-
// </div>`;
|
|
78
|
-
// }).join("")}
|
|
79
|
-
// </div>`
|
|
80
|
-
},
|
|
81
|
-
},
|
|
82
|
-
};
|
|
83
|
-
Grid.args = {
|
|
84
|
-
unit1Lg: 4,
|
|
85
|
-
unit1Md: 3,
|
|
86
|
-
unit1Sm: 3,
|
|
87
|
-
unit1Xs: 6,
|
|
88
|
-
unit2Lg: 2,
|
|
89
|
-
unit2Md: 3,
|
|
90
|
-
unit2Sm: 3,
|
|
91
|
-
unit2Xs: 6,
|
|
92
|
-
unit3Lg: 2,
|
|
93
|
-
unit3Md: 3,
|
|
94
|
-
unit3Sm: 6,
|
|
95
|
-
unit3Xs: 6,
|
|
96
|
-
unit4Lg: 4,
|
|
97
|
-
unit4Md: 3,
|
|
98
|
-
unit4Sm: 6,
|
|
99
|
-
unit4Xs: 6,
|
|
100
|
-
};
|
|
@@ -1,252 +0,0 @@
|
|
|
1
|
-
export default {
|
|
2
|
-
title: "Components/Input",
|
|
3
|
-
argTypes: {
|
|
4
|
-
label: {
|
|
5
|
-
type: { name: "string", required: true }
|
|
6
|
-
},
|
|
7
|
-
description: {
|
|
8
|
-
type: { name: "string", required: false },
|
|
9
|
-
},
|
|
10
|
-
disabled: {
|
|
11
|
-
type: {
|
|
12
|
-
name: "boolean"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
error: {
|
|
16
|
-
type: {
|
|
17
|
-
name: "boolean"
|
|
18
|
-
}
|
|
19
|
-
},
|
|
20
|
-
errorMessage: {
|
|
21
|
-
type: { name: "string", required: false },
|
|
22
|
-
},
|
|
23
|
-
type: {
|
|
24
|
-
options: ["text", "number"],
|
|
25
|
-
control: {
|
|
26
|
-
type: "select",
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
export const Input = ({ label, description, disabled, error, errorMessage, pre, post, type, }) => {
|
|
32
|
-
let attrs = "";
|
|
33
|
-
if (label)
|
|
34
|
-
attrs += ` label="${label}"`;
|
|
35
|
-
if (description)
|
|
36
|
-
attrs += ` description="${description}"`;
|
|
37
|
-
if (disabled)
|
|
38
|
-
attrs += ` disabled`;
|
|
39
|
-
if (error)
|
|
40
|
-
attrs += ` error${errorMessage ? ('="' + errorMessage + '"') : ''}`;
|
|
41
|
-
if (pre)
|
|
42
|
-
attrs += ` pre="${pre}"`;
|
|
43
|
-
if (post)
|
|
44
|
-
attrs += ` post="${post}"`;
|
|
45
|
-
if (type !== "text")
|
|
46
|
-
attrs += ` type=${type}`;
|
|
47
|
-
return `<xpl-input${attrs} name="input-name" placeholder="Placeholder"></xpl-input>`;
|
|
48
|
-
};
|
|
49
|
-
Input.parameters = {
|
|
50
|
-
layout: "centered",
|
|
51
|
-
"web-component": {
|
|
52
|
-
render: Input,
|
|
53
|
-
},
|
|
54
|
-
html: {
|
|
55
|
-
render({ label, description, disabled, error, errorMessage, pre, post, type, }) {
|
|
56
|
-
const output = [];
|
|
57
|
-
let className = "xpl-input";
|
|
58
|
-
if (disabled)
|
|
59
|
-
className += " xpl-input--disabled";
|
|
60
|
-
if (error)
|
|
61
|
-
className += " xpl-input--error";
|
|
62
|
-
output.push(`<div class="${className}">
|
|
63
|
-
<label for="id">
|
|
64
|
-
${label}${description ? `
|
|
65
|
-
<small>${description}</small>` : ''}
|
|
66
|
-
</label>
|
|
67
|
-
<div class="xpl-input-wrapper">${pre ? `
|
|
68
|
-
<label class="xpl-input-pre" for="id">${pre}</label>` : ''}
|
|
69
|
-
${`<input ${disabled ? 'disabled ' : ''}id="id" name="input-name" placeholder="Placeholder" type="${type}" />`}${post ? `
|
|
70
|
-
<label class="xpl-input-post" for="id">${post}</label>` : ''}
|
|
71
|
-
</div>${errorMessage ? `
|
|
72
|
-
<label class="xpl-input-error" for="id">
|
|
73
|
-
${`<svg width="10" height="11" viewBox="0 0 10 11" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.84375 5.25C9.84375 2.59375 7.65625 0.40625 5 0.40625C2.32422 0.40625 0.15625 2.59375 0.15625 5.25C0.15625 7.92578 2.32422 10.0938 5 10.0938C7.65625 10.0938 9.84375 7.92578 9.84375 5.25ZM5 6.22656C5.48828 6.22656 5.89844 6.63672 5.89844 7.125C5.89844 7.63281 5.48828 8.02344 5 8.02344C4.49219 8.02344 4.10156 7.63281 4.10156 7.125C4.10156 6.63672 4.49219 6.22656 5 6.22656ZM4.14062 3.00391C4.12109 2.86719 4.23828 2.75 4.375 2.75H5.60547C5.74219 2.75 5.85938 2.86719 5.83984 3.00391L5.70312 5.66016C5.68359 5.79688 5.58594 5.875 5.46875 5.875H4.51172C4.39453 5.875 4.29688 5.79688 4.27734 5.66016L4.14062 3.00391Z" /></svg>`}
|
|
74
|
-
${errorMessage}
|
|
75
|
-
</label>` : ''}
|
|
76
|
-
</div>`);
|
|
77
|
-
return output;
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
Input.args = {
|
|
82
|
-
label: "Input",
|
|
83
|
-
description: "A brief description",
|
|
84
|
-
disabled: false,
|
|
85
|
-
error: false,
|
|
86
|
-
errorMessage: "",
|
|
87
|
-
pre: "",
|
|
88
|
-
post: "",
|
|
89
|
-
type: "text",
|
|
90
|
-
};
|
|
91
|
-
export const Multiline = ({ label, description, disabled, error, errorMessage, maxCharacterCount, }) => {
|
|
92
|
-
let attrs = " multiline";
|
|
93
|
-
if (label)
|
|
94
|
-
attrs += ` label="${label}"`;
|
|
95
|
-
if (description)
|
|
96
|
-
attrs += ` description="${description}"`;
|
|
97
|
-
if (disabled)
|
|
98
|
-
attrs += ` disabled`;
|
|
99
|
-
if (error)
|
|
100
|
-
attrs += ` error${errorMessage ? ('="' + errorMessage + '"') : ''}`;
|
|
101
|
-
if (maxCharacterCount >= 0)
|
|
102
|
-
attrs += ` max-character-count="${maxCharacterCount}"`;
|
|
103
|
-
return `<xpl-input${attrs} name="input-name" placeholder="Placeholder"></xpl-input>`;
|
|
104
|
-
};
|
|
105
|
-
Multiline.parameters = {
|
|
106
|
-
layout: "centered",
|
|
107
|
-
"web-component": {
|
|
108
|
-
render: Multiline,
|
|
109
|
-
},
|
|
110
|
-
html: {
|
|
111
|
-
render({ disabled, error, errorMessage, label, description, maxCharacterCount }) {
|
|
112
|
-
const output = [];
|
|
113
|
-
if (maxCharacterCount > 0)
|
|
114
|
-
output.push(`WARNING: For multiline inputs with a max. character count,
|
|
115
|
-
there is JS interactivity that is provided only by
|
|
116
|
-
the web component. The code shown below does not
|
|
117
|
-
reflect the additional markup and interactivity.`);
|
|
118
|
-
let className = "xpl-input";
|
|
119
|
-
if (disabled)
|
|
120
|
-
className += " xpl-input--disabled";
|
|
121
|
-
if (error)
|
|
122
|
-
className += " xpl-input--error";
|
|
123
|
-
output.push(`<div class="${className}">
|
|
124
|
-
<label for="id">
|
|
125
|
-
${label}${description ? `
|
|
126
|
-
<small>${description}</small>` : ''}
|
|
127
|
-
</label>
|
|
128
|
-
<div class="xpl-input-wrapper">
|
|
129
|
-
${`<textarea ${disabled ? 'disabled ' : ''}id="id" name="input-name" placeholder="Placeholder"></textarea>`}
|
|
130
|
-
</div>${errorMessage ? `
|
|
131
|
-
<label class="xpl-input-error" for="id">
|
|
132
|
-
${`<svg width="10" height="11" viewBox="0 0 10 11" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.84375 5.25C9.84375 2.59375 7.65625 0.40625 5 0.40625C2.32422 0.40625 0.15625 2.59375 0.15625 5.25C0.15625 7.92578 2.32422 10.0938 5 10.0938C7.65625 10.0938 9.84375 7.92578 9.84375 5.25ZM5 6.22656C5.48828 6.22656 5.89844 6.63672 5.89844 7.125C5.89844 7.63281 5.48828 8.02344 5 8.02344C4.49219 8.02344 4.10156 7.63281 4.10156 7.125C4.10156 6.63672 4.49219 6.22656 5 6.22656ZM4.14062 3.00391C4.12109 2.86719 4.23828 2.75 4.375 2.75H5.60547C5.74219 2.75 5.85938 2.86719 5.83984 3.00391L5.70312 5.66016C5.68359 5.79688 5.58594 5.875 5.46875 5.875H4.51172C4.39453 5.875 4.29688 5.79688 4.27734 5.66016L4.14062 3.00391Z" /></svg>`}
|
|
133
|
-
${errorMessage}
|
|
134
|
-
</label>` : ''}
|
|
135
|
-
</div>`);
|
|
136
|
-
return output;
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
};
|
|
140
|
-
Multiline.args = {
|
|
141
|
-
label: "Multiline Input",
|
|
142
|
-
description: "A brief description",
|
|
143
|
-
disabled: false,
|
|
144
|
-
error: false,
|
|
145
|
-
errorMessage: "",
|
|
146
|
-
maxCharacterCount: 50,
|
|
147
|
-
};
|
|
148
|
-
export const Datepicker = ({ label, dateFormat, description, disabled, error, errorMessage, min, mode, max, }) => {
|
|
149
|
-
let attrs = ` type="date"`;
|
|
150
|
-
if (label)
|
|
151
|
-
attrs += ` label="${label}"`;
|
|
152
|
-
if (dateFormat)
|
|
153
|
-
attrs += ` date-format="${dateFormat}"`;
|
|
154
|
-
if (description)
|
|
155
|
-
attrs += ` description="${description}"`;
|
|
156
|
-
if (disabled)
|
|
157
|
-
attrs += ` disabled`;
|
|
158
|
-
if (error)
|
|
159
|
-
attrs += ` error${errorMessage ? ('="' + errorMessage + '"') : ''}`;
|
|
160
|
-
if (min)
|
|
161
|
-
attrs += ` min="${min}"`;
|
|
162
|
-
if (max)
|
|
163
|
-
attrs += ` max="${max}"`;
|
|
164
|
-
if (mode)
|
|
165
|
-
attrs += ` mode="${mode}"`;
|
|
166
|
-
return `<xpl-input${attrs} name="input-name" placeholder="Placeholder"></xpl-input>`;
|
|
167
|
-
};
|
|
168
|
-
Datepicker.argTypes = {
|
|
169
|
-
mode: {
|
|
170
|
-
options: ["single", /* "multiple", */ "range"],
|
|
171
|
-
control: {
|
|
172
|
-
type: "select",
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
};
|
|
176
|
-
Datepicker.args = {
|
|
177
|
-
mode: "single",
|
|
178
|
-
label: "Datepicker",
|
|
179
|
-
dateFormat: "m/d/Y",
|
|
180
|
-
description: "A brief description",
|
|
181
|
-
disabled: false,
|
|
182
|
-
error: false,
|
|
183
|
-
errorMessage: "",
|
|
184
|
-
min: "01/01/2000",
|
|
185
|
-
max: "12/31/2099",
|
|
186
|
-
};
|
|
187
|
-
Datepicker.parameters = {
|
|
188
|
-
layout: "centered",
|
|
189
|
-
"web-component": {
|
|
190
|
-
render: Datepicker
|
|
191
|
-
},
|
|
192
|
-
html: {
|
|
193
|
-
render({ label, description, disabled, error, errorMessage, min, max, }) {
|
|
194
|
-
const output = [
|
|
195
|
-
`The full-featured Datepicker Input only supports web component usage. However, a 'lite' version that uses native browser features is inlcuded here:`
|
|
196
|
-
];
|
|
197
|
-
let className = "xpl-input";
|
|
198
|
-
if (disabled)
|
|
199
|
-
className += " xpl-input--disabled";
|
|
200
|
-
if (error)
|
|
201
|
-
className += " xpl-input--error";
|
|
202
|
-
output.push(`<div class="${className}">
|
|
203
|
-
<label for="id">
|
|
204
|
-
${label}${description ? `
|
|
205
|
-
<small>${description}</small>` : ''}
|
|
206
|
-
</label>
|
|
207
|
-
<div class="xpl-input-wrapper">
|
|
208
|
-
${`<input ${disabled ? 'disabled ' : ''}id="id"${min ? ` min="${min}"` : ''}${max ? ` max="${max}"` : ''} name="input-name" placeholder="Placeholder" type="date" />`}
|
|
209
|
-
</div>${errorMessage ? `
|
|
210
|
-
<label class="xpl-input-error" for="id">
|
|
211
|
-
${`<svg width="10" height="11" viewBox="0 0 10 11" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M9.84375 5.25C9.84375 2.59375 7.65625 0.40625 5 0.40625C2.32422 0.40625 0.15625 2.59375 0.15625 5.25C0.15625 7.92578 2.32422 10.0938 5 10.0938C7.65625 10.0938 9.84375 7.92578 9.84375 5.25ZM5 6.22656C5.48828 6.22656 5.89844 6.63672 5.89844 7.125C5.89844 7.63281 5.48828 8.02344 5 8.02344C4.49219 8.02344 4.10156 7.63281 4.10156 7.125C4.10156 6.63672 4.49219 6.22656 5 6.22656ZM4.14062 3.00391C4.12109 2.86719 4.23828 2.75 4.375 2.75H5.60547C5.74219 2.75 5.85938 2.86719 5.83984 3.00391L5.70312 5.66016C5.68359 5.79688 5.58594 5.875 5.46875 5.875H4.51172C4.39453 5.875 4.29688 5.79688 4.27734 5.66016L4.14062 3.00391Z" /></svg>`}
|
|
212
|
-
${errorMessage}
|
|
213
|
-
</label>` : ''}
|
|
214
|
-
</div>`);
|
|
215
|
-
return output;
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
};
|
|
219
|
-
export const Password = ({ label, description, disabled, error, errorMessage, pre, post, }) => {
|
|
220
|
-
let attrs = "";
|
|
221
|
-
if (label)
|
|
222
|
-
attrs += ` label="${label}"`;
|
|
223
|
-
if (description)
|
|
224
|
-
attrs += ` description="${description}"`;
|
|
225
|
-
if (disabled)
|
|
226
|
-
attrs += ` disabled`;
|
|
227
|
-
if (error)
|
|
228
|
-
attrs += ` error${errorMessage ? ('="' + errorMessage + '"') : ''}`;
|
|
229
|
-
if (pre)
|
|
230
|
-
attrs += ` pre="${pre}"`;
|
|
231
|
-
if (post)
|
|
232
|
-
attrs += ` post="${post}"`;
|
|
233
|
-
return `<xpl-input type="password"${attrs} name="input-name"></xpl-input>`;
|
|
234
|
-
};
|
|
235
|
-
Password.parameters = {
|
|
236
|
-
layout: "centered",
|
|
237
|
-
"web-component": {
|
|
238
|
-
render: Password,
|
|
239
|
-
},
|
|
240
|
-
html: {
|
|
241
|
-
render() {
|
|
242
|
-
return `Sorry, the Password Input only supports web component usage.`;
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
};
|
|
246
|
-
Password.args = {
|
|
247
|
-
label: "Password",
|
|
248
|
-
description: "Enter a password:",
|
|
249
|
-
disabled: false,
|
|
250
|
-
error: false,
|
|
251
|
-
errorMessage: "",
|
|
252
|
-
};
|
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { v4 as uuid } from "uuid";
|
|
2
|
-
export default {
|
|
3
|
-
title: "Components/List",
|
|
4
|
-
argTypes: {
|
|
5
|
-
avatar: {
|
|
6
|
-
options: ["none", "image", "placeholder"],
|
|
7
|
-
control: {
|
|
8
|
-
type: "select",
|
|
9
|
-
},
|
|
10
|
-
},
|
|
11
|
-
avatars: {
|
|
12
|
-
type: { name: "boolean", }
|
|
13
|
-
},
|
|
14
|
-
badges: {
|
|
15
|
-
type: { name: "boolean", }
|
|
16
|
-
},
|
|
17
|
-
link: {
|
|
18
|
-
type: { name: "boolean", }
|
|
19
|
-
},
|
|
20
|
-
metadata: {
|
|
21
|
-
type: { name: "boolean", }
|
|
22
|
-
},
|
|
23
|
-
title: {
|
|
24
|
-
type: { name: "string", },
|
|
25
|
-
},
|
|
26
|
-
subtext: {
|
|
27
|
-
type: { name: "string", },
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
};
|
|
31
|
-
const script = ({ id, avatar, avatars, badges, metadata, link, title, subtext }) => `
|
|
32
|
-
(function() {
|
|
33
|
-
const list = document.getElementById("${id}");
|
|
34
|
-
const item = ${JSON.stringify({
|
|
35
|
-
avatar: avatar === "image" ? "https://pbs.twimg.com/profile_images/1388990311637127168/njwE8QEa_reasonably_small.jpg" :
|
|
36
|
-
avatar === "placeholder" ? "ABC" :
|
|
37
|
-
null,
|
|
38
|
-
avatars: avatars ? [
|
|
39
|
-
"https://pbs.twimg.com/profile_images/1388990311637127168/njwE8QEa_reasonably_small.jpg",
|
|
40
|
-
"https://pbs.twimg.com/profile_images/1388990311637127168/njwE8QEa_reasonably_small.jpg",
|
|
41
|
-
"https://pbs.twimg.com/profile_images/1388990311637127168/njwE8QEa_reasonably_small.jpg",
|
|
42
|
-
] : null,
|
|
43
|
-
badges: badges ? [
|
|
44
|
-
"Badge",
|
|
45
|
-
{
|
|
46
|
-
dot: "true",
|
|
47
|
-
text: "With Dot",
|
|
48
|
-
},
|
|
49
|
-
{
|
|
50
|
-
variant: "error",
|
|
51
|
-
text: "Error",
|
|
52
|
-
}
|
|
53
|
-
] : null,
|
|
54
|
-
href: link ? "#" : null,
|
|
55
|
-
metadata: metadata ? [
|
|
56
|
-
"Metadata",
|
|
57
|
-
{
|
|
58
|
-
icon: "envelope",
|
|
59
|
-
text: "Metadata w/ Icon",
|
|
60
|
-
}
|
|
61
|
-
] : null,
|
|
62
|
-
title,
|
|
63
|
-
subtext,
|
|
64
|
-
})};
|
|
65
|
-
list.items = [item, item, item];
|
|
66
|
-
})();
|
|
67
|
-
`;
|
|
68
|
-
export const List = (props) => {
|
|
69
|
-
const id = uuid();
|
|
70
|
-
return `<xpl-list id="${id}"></xpl-list>
|
|
71
|
-
<script>${script(Object.assign({ id }, props))}</script>`;
|
|
72
|
-
};
|
|
73
|
-
List.parameters = {
|
|
74
|
-
layout: "centered",
|
|
75
|
-
"web-component": {
|
|
76
|
-
render({ avatar, avatars, badges, metadata, link, title, subtext }) {
|
|
77
|
-
return [
|
|
78
|
-
`<xpl-list id="list-id"></xpl-list>`,
|
|
79
|
-
`<script>
|
|
80
|
-
const item = {${avatar !== "none" ? `
|
|
81
|
-
avatar: ${avatar === "placeholder" ? "\"ABC\"" : "\"https://example.jpg\""},` : ''}${avatars ? `
|
|
82
|
-
avatars: [
|
|
83
|
-
"https://example.jpg",
|
|
84
|
-
"https://example.jpg",
|
|
85
|
-
"https://example.jpg",
|
|
86
|
-
],` : ''}${badges ? `
|
|
87
|
-
badges: [
|
|
88
|
-
"Badge",
|
|
89
|
-
{
|
|
90
|
-
dot: true,
|
|
91
|
-
text: "With Dot",
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
variant: "error",
|
|
95
|
-
text: "Error",
|
|
96
|
-
},
|
|
97
|
-
],` : ''}${metadata ? `
|
|
98
|
-
metadata: [
|
|
99
|
-
"Metadata",
|
|
100
|
-
{
|
|
101
|
-
icon: "envelope",
|
|
102
|
-
text: "Metadata w/ Icon",
|
|
103
|
-
},
|
|
104
|
-
],` : ''}${link ? `
|
|
105
|
-
link: "https://example.com",` : ""},
|
|
106
|
-
title: ${title},${subtext ? `
|
|
107
|
-
subtext: "${subtext}",` : ""}
|
|
108
|
-
};
|
|
109
|
-
document.getElementById("list-id").items = [
|
|
110
|
-
item,
|
|
111
|
-
item,
|
|
112
|
-
item
|
|
113
|
-
];`
|
|
114
|
-
];
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
html: {
|
|
118
|
-
render() {
|
|
119
|
-
// let className = "xpl-badge";
|
|
120
|
-
// if (dot) className += " xpl-badge--dot";
|
|
121
|
-
// if (variant !== "default") className += " xpl-badge--" + variant;
|
|
122
|
-
// return `<div class="${className}">${text}</div>`;
|
|
123
|
-
},
|
|
124
|
-
},
|
|
125
|
-
};
|
|
126
|
-
List.args = {
|
|
127
|
-
avatar: "none",
|
|
128
|
-
avatars: false,
|
|
129
|
-
badges: false,
|
|
130
|
-
link: true,
|
|
131
|
-
metadata: false,
|
|
132
|
-
title: "List Item",
|
|
133
|
-
subtext: ""
|
|
134
|
-
};
|