@digital-realty/ix-drawer 1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 ix-drawer
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,82 @@
1
+ # \<ix-drawer>
2
+
3
+ This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) recommendation.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm i @digital-realty/ix-drawer
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```html
14
+ <script type="module">
15
+ import '@digital-realty/ix-drawer/ix-drawer.js';
16
+ </script>
17
+
18
+ <ix-drawer
19
+ .isVisible=${true}
20
+ .onClosed=${() => handleOnClosed()}
21
+ >
22
+ <div slot="content">
23
+ <h5>Title in h5</h5>
24
+ <p>
25
+ Ipsum amet excepteur velit anim dolor fugiat non dolor non
26
+ occaecat tempor deserunt sit consectetur. Qui deserunt
27
+ aliqua ex fugiat amet quis non. Dolore excepteur mollit
28
+ ipsum mollit elit officia exercitation adipisicing nisi
29
+ laborum commodo officia. Excepteur nisi non laborum aute
30
+ ullamco non aliquip incididunt. Incididunt eiusmod proident
31
+ culpa voluptate proident fugiat deserunt dolore qui
32
+ pariatur. Esse amet ad in anim cillum. Pariatur laborum
33
+ tempor et labore. Adipisicing esse pariatur non eiusmod
34
+ commodo. Lorem eu nulla qui eiusmod est do magna ea ut
35
+ consectetur ut dolore consectetur aliquip. Minim laboris
36
+ laboris magna sint laboris excepteur dolor sunt consectetur
37
+ nulla commodo in cupidatat. Cupidatat duis elit culpa
38
+ commodo fugiat eu. Consequat proident nisi proident nisi ad
39
+ ut aliqua elit anim nisi veniam et et Lorem. Quis labore non
40
+ laborum et amet in veniam tempor sint proident proident
41
+ Lorem ut excepteur. Non voluptate aliquip consequat
42
+ consequat adipisicing irure mollit eiusmod veniam non eu
43
+ velit.
44
+ </p>
45
+ </div>
46
+ </ix-drawer>
47
+ ```
48
+
49
+ ```JS
50
+ import { IxDrawer } from 'ix-drawer'
51
+
52
+ <IxDrawer>
53
+ <div slot="content">
54
+ <h5>Title in h5</h5>
55
+ <p>
56
+ Ipsum amet excepteur velit anim dolor fugiat non dolor non
57
+ occaecat tempor deserunt sit consectetur. Qui deserunt
58
+ aliqua ex fugiat amet quis non. Dolore excepteur mollit
59
+ ipsum mollit elit officia exercitation adipisicing nisi
60
+ laborum commodo officia. Excepteur nisi non laborum aute
61
+ ullamco non aliquip incididunt. Incididunt eiusmod proident
62
+ culpa voluptate proident fugiat deserunt dolore qui
63
+ pariatur. Esse amet ad in anim cillum. Pariatur laborum
64
+ tempor et labore. Adipisicing esse pariatur non eiusmod
65
+ commodo. Lorem eu nulla qui eiusmod est do magna ea ut
66
+ consectetur ut dolore consectetur aliquip. Minim laboris
67
+ laboris magna sint laboris excepteur dolor sunt consectetur
68
+ nulla commodo in cupidatat. Cupidatat duis elit culpa
69
+ commodo fugiat eu. Consequat proident nisi proident nisi ad
70
+ ut aliqua elit anim nisi veniam et et Lorem. Quis labore non
71
+ laborum et amet in veniam tempor sint proident proident
72
+ Lorem ut excepteur. Non voluptate aliquip consequat
73
+ consequat adipisicing irure mollit eiusmod veniam non eu
74
+ velit.
75
+ </p>
76
+ </div>
77
+ </IxDrawer>
78
+ ```
79
+
80
+ ## Demo and Documentation
81
+
82
+ Full documentation and demo are available at [DLR Component Gallery](https://inxn-p1-uicomponentgallery.azurewebsites.net/?path=/story/inxn-ix-drawer--default).
@@ -0,0 +1,10 @@
1
+ import { LitElement, nothing } from 'lit';
2
+ import '@digital-realty/ix-button/ix-button.js';
3
+ import '@material/web/icon/icon.js';
4
+ export declare class IxDrawer extends LitElement {
5
+ static get styles(): import("lit").CSSResult[];
6
+ isVisible: boolean;
7
+ onClosed: any;
8
+ renderHideButton(): symbol;
9
+ render(): typeof nothing | import("lit").TemplateResult<1>;
10
+ }
@@ -0,0 +1,54 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, html, nothing } from 'lit';
3
+ import { property } from 'lit/decorators.js';
4
+ import { IxDrawerStyles } from './styles/ix-drawer-styles.js';
5
+ import '@digital-realty/ix-button/ix-button.js';
6
+ import '@material/web/icon/icon.js';
7
+ export class IxDrawer extends LitElement {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.isVisible = false;
11
+ }
12
+ static get styles() {
13
+ return [IxDrawerStyles];
14
+ }
15
+ // eslint-disable-next-line class-methods-use-this
16
+ renderHideButton() {
17
+ return nothing;
18
+ // TO DO: this part will be completed with https://telxapp.atlassian.net/browse/IXUAT-8818
19
+ // return html`<ix-button appearance="text" has-icon @click=${this.onClosed}>
20
+ // <md-icon slot="icon">fullscreen_exit</md-icon>
21
+ // Hide
22
+ // </ix-button>`;
23
+ }
24
+ render() {
25
+ if (this.isVisible)
26
+ return html `
27
+ <div class="drawer-container">
28
+ <aside class="drawer">
29
+ <div class="drawer-header">
30
+ <div class="drawer-header__hide-btn">
31
+ ${this.renderHideButton()}
32
+ </div>
33
+ <div class="drawer-header__close-btn">
34
+ <div class="drawer-header__close-btn-hover-layer">
35
+ <md-icon @click=${this.onClosed}>Close</md-icon>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ <div class="drawer-body">
40
+ <slot name="content"></slot>
41
+ </div>
42
+ </aside>
43
+ </div>
44
+ `;
45
+ return nothing;
46
+ }
47
+ }
48
+ __decorate([
49
+ property({ type: Boolean })
50
+ ], IxDrawer.prototype, "isVisible", void 0);
51
+ __decorate([
52
+ property({ type: Function })
53
+ ], IxDrawer.prototype, "onClosed", void 0);
54
+ //# sourceMappingURL=IxDrawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IxDrawer.js","sourceRoot":"","sources":["../src/IxDrawer.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,wCAAwC,CAAC;AAChD,OAAO,4BAA4B,CAAC;AAEpC,MAAM,OAAO,QAAS,SAAQ,UAAU;IAAxC;;QAK+B,cAAS,GAAG,KAAK,CAAC;IAuCjD,CAAC;IA3CC,MAAM,KAAK,MAAM;QACf,OAAO,CAAC,cAAc,CAAC,CAAC;IAC1B,CAAC;IAMD,kDAAkD;IAClD,gBAAgB;QACd,OAAO,OAAO,CAAC;QAEf,0FAA0F;QAC1F,6EAA6E;QAC7E,mDAAmD;QACnD,SAAS;QACT,iBAAiB;IACnB,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,SAAS;YAChB,OAAO,IAAI,CAAA;;;;;kBAKC,IAAI,CAAC,gBAAgB,EAAE;;;;oCAIL,IAAI,CAAC,QAAQ;;;;;;;;;OAS1C,CAAC;QAEJ,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AAvC8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAAmB;AAEjB;IAA7B,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;0CAAe","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { IxDrawerStyles } from './styles/ix-drawer-styles.js';\nimport '@digital-realty/ix-button/ix-button.js';\nimport '@material/web/icon/icon.js';\n\nexport class IxDrawer extends LitElement {\n static get styles() {\n return [IxDrawerStyles];\n }\n\n @property({ type: Boolean }) isVisible = false;\n\n @property({ type: Function }) onClosed: any;\n\n // eslint-disable-next-line class-methods-use-this\n renderHideButton() {\n return nothing;\n\n // TO DO: this part will be completed with https://telxapp.atlassian.net/browse/IXUAT-8818\n // return html`<ix-button appearance=\"text\" has-icon @click=${this.onClosed}>\n // <md-icon slot=\"icon\">fullscreen_exit</md-icon>\n // Hide\n // </ix-button>`;\n }\n\n render() {\n if (this.isVisible)\n return html`\n <div class=\"drawer-container\">\n <aside class=\"drawer\">\n <div class=\"drawer-header\">\n <div class=\"drawer-header__hide-btn\">\n ${this.renderHideButton()}\n </div>\n <div class=\"drawer-header__close-btn\">\n <div class=\"drawer-header__close-btn-hover-layer\">\n <md-icon @click=${this.onClosed}>Close</md-icon>\n </div>\n </div>\n </div>\n <div class=\"drawer-body\">\n <slot name=\"content\"></slot>\n </div>\n </aside>\n </div>\n `;\n\n return nothing;\n }\n}\n"]}
@@ -0,0 +1 @@
1
+ export { IxDrawer } from './IxDrawer.js';
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { IxDrawer } from './IxDrawer.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC","sourcesContent":["export { IxDrawer } from './IxDrawer.js';\n"]}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ import { IxDrawer } from './IxDrawer.js';
2
+ window.customElements.define('ix-drawer', IxDrawer);
3
+ //# sourceMappingURL=ix-drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ix-drawer.js","sourceRoot":"","sources":["../src/ix-drawer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import { IxDrawer } from './IxDrawer.js';\n\nwindow.customElements.define('ix-drawer', IxDrawer);\n"]}
@@ -0,0 +1,4 @@
1
+ import { IxDrawer as IxDrawerLit } from '../IxDrawer.js';
2
+ export declare const IxDrawer: import("@lit/react").ReactWebComponent<IxDrawerLit, {
3
+ onclick: string;
4
+ }>;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { createComponent } from '@lit/react';
3
+ import { IxDrawer as IxDrawerLit } from '../IxDrawer.js';
4
+ customElements.define('ix-drawer', IxDrawerLit);
5
+ export const IxDrawer = createComponent({
6
+ tagName: 'ix-drawer',
7
+ elementClass: IxDrawerLit,
8
+ react: React,
9
+ events: {
10
+ onclick: 'onClick',
11
+ },
12
+ });
13
+ //# sourceMappingURL=IxDrawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IxDrawer.js","sourceRoot":"","sources":["../../src/react/IxDrawer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,QAAQ,IAAI,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEzD,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;AAEhD,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,CAAC;IACtC,OAAO,EAAE,WAAW;IACpB,YAAY,EAAE,WAAW;IACzB,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACN,OAAO,EAAE,SAAS;KACnB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { createComponent } from '@lit/react';\nimport { IxDrawer as IxDrawerLit } from '../IxDrawer.js';\n\ncustomElements.define('ix-drawer', IxDrawerLit);\n\nexport const IxDrawer = createComponent({\n tagName: 'ix-drawer',\n elementClass: IxDrawerLit,\n react: React,\n events: {\n onclick: 'onClick',\n },\n});\n"]}
@@ -0,0 +1 @@
1
+ export declare const IxDrawerStyles: import("lit").CSSResult;
@@ -0,0 +1,53 @@
1
+ import { css } from 'lit';
2
+ export const IxDrawerStyles = css `
3
+ .drawer-container {
4
+ z-index: 1;
5
+ display: block;
6
+ position: absolute;
7
+ width: 100%;
8
+ height: 100%;
9
+ top: 0;
10
+ left: 0;
11
+ background-color: rgba(0, 0, 0, 0.2);
12
+ scroll-behavior: auto;
13
+ overflow: auto;
14
+ }
15
+
16
+ .drawer {
17
+ width: 45%;
18
+ height: 100%;
19
+ float: right;
20
+ padding: 32px 40px 40px;
21
+ background-color: white;
22
+ border-radius: 20px 0px 0px 20px;
23
+ box-sizing: border-box;
24
+ }
25
+
26
+ .drawer-header {
27
+ display: flex;
28
+ justify-content: space-between;
29
+ align-items: center;
30
+ }
31
+ .drawer-header__hide-btn {
32
+ flex: 0;
33
+ }
34
+ .drawer-header__close-btn {
35
+ flex: 1;
36
+ }
37
+ .drawer-header__close-btn-hover-layer {
38
+ width: 24px;
39
+ height: 24px;
40
+ border-radius: 9999px;
41
+ float: right;
42
+ }
43
+ .drawer-header__close-btn-hover-layer:hover {
44
+ transition: 0.15s;
45
+ background-color: lightgrey;
46
+ }
47
+
48
+ .drawer-body {
49
+ height: 100%;
50
+ overflow: auto;
51
+ }
52
+ `;
53
+ //# sourceMappingURL=ix-drawer-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ix-drawer-styles.js","sourceRoot":"","sources":["../../src/styles/ix-drawer-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDhC,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const IxDrawerStyles = css`\n .drawer-container {\n z-index: 1;\n display: block;\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n background-color: rgba(0, 0, 0, 0.2);\n scroll-behavior: auto;\n overflow: auto;\n }\n\n .drawer {\n width: 45%;\n height: 100%;\n float: right;\n padding: 32px 40px 40px;\n background-color: white;\n border-radius: 20px 0px 0px 20px;\n box-sizing: border-box;\n }\n\n .drawer-header {\n display: flex;\n justify-content: space-between;\n align-items: center;\n }\n .drawer-header__hide-btn {\n flex: 0;\n }\n .drawer-header__close-btn {\n flex: 1;\n }\n .drawer-header__close-btn-hover-layer {\n width: 24px;\n height: 24px;\n border-radius: 9999px;\n float: right;\n }\n .drawer-header__close-btn-hover-layer:hover {\n transition: 0.15s;\n background-color: lightgrey;\n }\n\n .drawer-body {\n height: 100%;\n overflow: auto;\n }\n`;\n"]}
package/package.json ADDED
@@ -0,0 +1,107 @@
1
+ {
2
+ "name": "@digital-realty/ix-drawer",
3
+ "description": "Webcomponent ix-drawer following open-wc recommendations",
4
+ "license": "MIT",
5
+ "author": "interxion",
6
+ "version": "1.0.1",
7
+ "type": "module",
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.js",
10
+ "exports": {
11
+ ".": "./dist/index.js",
12
+ "./ix-drawer.js": "./dist/ix-drawer.js",
13
+ "./IxDrawer": "./dist/react/IxDrawer.js"
14
+ },
15
+ "publishConfig": {
16
+ "access": "public"
17
+ },
18
+ "scripts": {
19
+ "analyze": "cem analyze --litelement",
20
+ "start": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
21
+ "build": "tsc && npm run analyze -- --exclude dist",
22
+ "prepublish": "tsc && npm run analyze -- --exclude dist",
23
+ "lint": "eslint --ext .ts,.html . --ignore-path .gitignore && prettier \"**/*.ts\" --check --ignore-path .gitignore",
24
+ "format": "eslint --ext .ts,.html . --fix --ignore-path .gitignore && prettier \"**/*.ts\" --write --ignore-path .gitignore",
25
+ "test": "tsc && wtr --coverage",
26
+ "test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
27
+ "storybook": "tsc && npm run analyze -- --exclude dist && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds -c .storybook/server.mjs\"",
28
+ "storybook:build": "tsc && npm run analyze -- --exclude dist && build-storybook"
29
+ },
30
+ "dependencies": {
31
+ "@digital-realty/ix-button": "*",
32
+ "@digital-realty/theme": "*",
33
+ "@lit/react": "^1.0.2",
34
+ "@material/web": "^1.0.1",
35
+ "lit": "^2.0.2",
36
+ "react": "^18.2.0"
37
+ },
38
+ "devDependencies": {
39
+ "@custom-elements-manifest/analyzer": "^0.4.17",
40
+ "@open-wc/eslint-config": "^9.2.1",
41
+ "@open-wc/testing": "^3.1.6",
42
+ "@typescript-eslint/eslint-plugin": "^5.48.0",
43
+ "@typescript-eslint/parser": "^5.48.0",
44
+ "@web/dev-server": "^0.1.34",
45
+ "@web/dev-server-storybook": "^0.5.4",
46
+ "@web/test-runner": "^0.14.0",
47
+ "concurrently": "^5.3.0",
48
+ "eslint": "^8.31.0",
49
+ "eslint-config-prettier": "^8.3.0",
50
+ "husky": "^4.3.8",
51
+ "lint-staged": "^10.5.4",
52
+ "prettier": "^2.4.1",
53
+ "tslib": "^2.3.1",
54
+ "typescript": "^4.5.2"
55
+ },
56
+ "customElements": "custom-elements.json",
57
+ "eslintConfig": {
58
+ "parser": "@typescript-eslint/parser",
59
+ "extends": [
60
+ "@open-wc",
61
+ "prettier"
62
+ ],
63
+ "plugins": [
64
+ "@typescript-eslint"
65
+ ],
66
+ "rules": {
67
+ "no-unused-vars": "off",
68
+ "@typescript-eslint/no-unused-vars": [
69
+ "error"
70
+ ],
71
+ "import/no-unresolved": "off",
72
+ "import/extensions": [
73
+ "error",
74
+ "always",
75
+ {
76
+ "ignorePackages": true
77
+ }
78
+ ]
79
+ },
80
+ "globals": {
81
+ "ShadowRootInit": true
82
+ }
83
+ },
84
+ "prettier": {
85
+ "singleQuote": true,
86
+ "arrowParens": "avoid"
87
+ },
88
+ "husky": {
89
+ "hooks": {
90
+ "pre-commit": "lint-staged"
91
+ }
92
+ },
93
+ "lint-staged": {
94
+ "*.ts": [
95
+ "eslint --fix",
96
+ "prettier --write"
97
+ ]
98
+ },
99
+ "files": [
100
+ "/dist",
101
+ "!/dist/test",
102
+ "package.json",
103
+ "README.md",
104
+ "LICENSE"
105
+ ],
106
+ "gitHead": "6d563c5fc9147dc96c57c5f01604503118485d2d"
107
+ }