@aquera/nile-elements 0.0.28 → 0.0.30
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/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.css.js +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-message/nile-error-message.js +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-error-message/nile-error-message.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js +43 -6
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.d.ts +30 -17
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js +143 -110
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +379 -318
- package/dist/nile-content-editor/nile-content-editor.css.cjs.js +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.cjs.js.map +1 -1
- package/dist/nile-content-editor/nile-content-editor.css.esm.js +1 -0
- package/dist/nile-error-message/nile-error-message.cjs.js +1 -1
- package/dist/nile-error-message/nile-error-message.cjs.js.map +1 -1
- package/dist/nile-error-message/nile-error-message.esm.js +1 -1
- package/dist/nile-switcher/index.cjs.js +1 -1
- package/dist/nile-switcher/index.esm.js +1 -1
- package/dist/nile-switcher/nile-switcher.cjs.js +1 -1
- package/dist/nile-switcher/nile-switcher.cjs.js.map +1 -1
- package/dist/nile-switcher/nile-switcher.css.cjs.js +1 -1
- package/dist/nile-switcher/nile-switcher.css.cjs.js.map +1 -1
- package/dist/nile-switcher/nile-switcher.css.esm.js +45 -8
- package/dist/nile-switcher/nile-switcher.esm.js +72 -44
- package/dist/src/nile-content-editor/nile-content-editor.css.js +1 -0
- package/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
- package/dist/src/nile-error-message/nile-error-message.js +1 -1
- package/dist/src/nile-error-message/nile-error-message.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.css.js +43 -6
- package/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.d.ts +30 -17
- package/dist/src/nile-switcher/nile-switcher.js +143 -110
- package/dist/src/nile-switcher/nile-switcher.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/nile-content-editor/nile-content-editor.css.ts +1 -0
- package/src/nile-error-message/nile-error-message.ts +1 -1
- package/src/nile-switcher/nile-switcher.css.ts +43 -6
- package/src/nile-switcher/nile-switcher.ts +167 -172
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-content-editor.css.js","sourceRoot":"","sources":["../../../src/nile-content-editor/nile-content-editor.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
1
|
+
{"version":3,"file":"nile-content-editor.css.js","sourceRoot":"","sources":["../../../src/nile-content-editor/nile-content-editor.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6FxB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * AttributeExpression CSS\n */\nexport const styles = css`\n :host {\n box-sizing: border-box;\n font-size: 14px;\n overflow: hidden;\n }\n\n .content-editable-wrapper {\n position: relative;\n width: 100%;\n box-sizing: border-box;\n }\n\n .dropdown-position {\n position: relative;\n bottom: 1px;\n }\n .content-editable-input {\n box-sizing: border-box;\n width: 100%;\n padding: 9px;\n border: 1px solid #c7ced4;\n border-radius: 4px;\n overflow: auto;\n overflow-x: auto;\n overflow-anchor: none;\n scrollbar-width: none;\n -ms-overflow-style: none;\n cursor: text;\n white-space: nowrap;\n background-color: #ffffff;\n height: 38px;\n }\n .content-editable-input:focus {\n outline: none;\n }\n\n .error {\n border-color: #e5434d;\n }\n\n .read-only {\n background-color: hsl(240 4.8% 95.9%);\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n .chips {\n display: inline;\n background: #e5e9eb;\n color: #000;\n border-radius: 4px;\n padding: 6px;\n height: 24px;\n line-height: 10px;\n margin-left: 3px;\n letter-spacing: 0.2px;\n }\n\n .text-area {\n height: 120px;\n overflow: scroll;\n line-height: 26px;\n }\n\n .text-area .chips {\n padding: 4px 8px;\n }\n\n .chip-error {\n background: #f3a5aa;\n }\n .nile-options-container {\n box-sizing: border-box;\n background-color: #ffffff;\n border: 1px solid #c7ced4;\n overflow: auto;\n max-height: 150px;\n }\n\n label {\n display: inline-block;\n margin-bottom: 6px;\n font-family: 'colfax-medium';\n }\n\n .asterik {\n color: #e5434d;\n }\n\n .no-border {\n border: none;\n }\n`;\n\nexport default [styles];\n"]}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-error-message.js","sourceRoot":"","sources":["../../../src/nile-error-message/nile-error-message.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,GAGT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD;;;GAGG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,UAAU;IAAzC;;QAKL,4DAA4D;QAE5D,iBAAY,GAAW,EAAE,CAAC;QAW1B,eAAU,GAAY,KAAK,CAAC;QAE5B,wCAAwC;QACvB,eAAU,GAAW,GAAG,CAAC;IA0D5C,CAAC;IA9EQ,MAAM,KAAK,MAAM;QACtB,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAoBD;;;OAGG;IACH,oBAAoB;QAClB,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE;YAC/C,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;SACjE;QACD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;IACrC,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAA;;;;;;;;;kDASmC,IAAI,CAAC,YAAY;;;UAGzD,IAAI,CAAC,aAAa;YACpB,CAAC,CAAC,IAAI,CAAA;;cAEA,IAAI,CAAC,aAAa;cAClB,IAAI,CAAC,iBAAiB;gBACpB,CAAC,CAAC,IAAI,CAAA;;;uBAGC,IAAI,CAAC,cAAc;iBACzB,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW;cAC9C,CAAA,CAAC,CAAA,EAAE;;aAEJ;YACL,CAAC,CAAC,EAAE;;;yDAG6C,IAAI,CAAC,UAAU;YAC5D,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,WAAW;;YAEb,IAAI,CAAC,iBAAiB;;;KAG7B,CAAC;IACJ,CAAC;CACF,CAAA;AAxEC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDACD;AAI1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDACL;AAItB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACD;AAG1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDACA;AAlBjB,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA+E5B;SA/EY,gBAAgB","sourcesContent":["import {\n LitElement,\n html,\n property,\n CSSResultArray,\n TemplateResult,\n} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-error-message.css';\n\n/**\n * A custom error message component that displays error information to the user.\n * @customElement nile-error-message\n */\n@customElement('nile-error-message')\nexport class NileErrorMessage extends LitElement {\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n // Represents the error message to be displayed to the user.\n @property({ type: String })\n errorMessage: string = '';\n\n // Represents additional details about the error, like stack trace or other info.\n @property({ type: String })\n errorResponse: string;\n\n // Extended error information\n @property({ type: String })\n errorResponseLong: string;\n\n @property({ type: Boolean })\n isExpanded: boolean = false;\n\n // The maximum length before truncation.\n private readonly MAX_LENGTH: number = 100;\n\n /**\n * Get a truncated version of the errorResponse if it's too long.\n * @returns {string}\n */\n getTruncatedResponse(): string {\n if (this.errorResponse.length > this.MAX_LENGTH) {\n return `${this.errorResponse.substring(0, this.MAX_LENGTH)}...`;\n }\n return this.errorResponse;\n }\n\n /**\n * Toggle the expanded state of the error response.\n */\n toggleExpanded() {\n this.isExpanded = !this.isExpanded;\n }\n\n public render(): TemplateResult {\n return html`\n <div class=\"nile-error-message\" part=\"base\">\n <nile-icon\n name=\"info2\"\n size=\"14\"\n class=\"nile-error-message__icon\"\n part=\"icon\"\n color=\"#
|
1
|
+
{"version":3,"file":"nile-error-message.js","sourceRoot":"","sources":["../../../src/nile-error-message/nile-error-message.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,QAAQ,GAGT,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD;;;GAGG;AAEI,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,UAAU;IAAzC;;QAKL,4DAA4D;QAE5D,iBAAY,GAAW,EAAE,CAAC;QAW1B,eAAU,GAAY,KAAK,CAAC;QAE5B,wCAAwC;QACvB,eAAU,GAAW,GAAG,CAAC;IA0D5C,CAAC;IA9EQ,MAAM,KAAK,MAAM;QACtB,OAAO,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAoBD;;;OAGG;IACH,oBAAoB;QAClB,IAAI,IAAI,CAAC,aAAa,CAAC,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE;YAC/C,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC;SACjE;QACD,OAAO,IAAI,CAAC,aAAa,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,cAAc;QACZ,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;IACrC,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAA;;;;;;;;;kDASmC,IAAI,CAAC,YAAY;;;UAGzD,IAAI,CAAC,aAAa;YACpB,CAAC,CAAC,IAAI,CAAA;;cAEA,IAAI,CAAC,aAAa;cAClB,IAAI,CAAC,iBAAiB;gBACpB,CAAC,CAAC,IAAI,CAAA;;;uBAGC,IAAI,CAAC,cAAc;iBACzB,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW;cAC9C,CAAA,CAAC,CAAA,EAAE;;aAEJ;YACL,CAAC,CAAC,EAAE;;;yDAG6C,IAAI,CAAC,UAAU;YAC5D,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,WAAW;;YAEb,IAAI,CAAC,iBAAiB;;;KAG7B,CAAC;IACJ,CAAC;CACF,CAAA;AAxEC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDACD;AAI1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDACL;AAItB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACD;AAG1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDACA;AAlBjB,gBAAgB;IAD5B,aAAa,CAAC,oBAAoB,CAAC;GACvB,gBAAgB,CA+E5B;SA/EY,gBAAgB","sourcesContent":["import {\n LitElement,\n html,\n property,\n CSSResultArray,\n TemplateResult,\n} from 'lit-element';\nimport { customElement } from 'lit/decorators.js';\nimport { styles } from './nile-error-message.css';\n\n/**\n * A custom error message component that displays error information to the user.\n * @customElement nile-error-message\n */\n@customElement('nile-error-message')\nexport class NileErrorMessage extends LitElement {\n public static get styles(): CSSResultArray {\n return [styles];\n }\n\n // Represents the error message to be displayed to the user.\n @property({ type: String })\n errorMessage: string = '';\n\n // Represents additional details about the error, like stack trace or other info.\n @property({ type: String })\n errorResponse: string;\n\n // Extended error information\n @property({ type: String })\n errorResponseLong: string;\n\n @property({ type: Boolean })\n isExpanded: boolean = false;\n\n // The maximum length before truncation.\n private readonly MAX_LENGTH: number = 100;\n\n /**\n * Get a truncated version of the errorResponse if it's too long.\n * @returns {string}\n */\n getTruncatedResponse(): string {\n if (this.errorResponse.length > this.MAX_LENGTH) {\n return `${this.errorResponse.substring(0, this.MAX_LENGTH)}...`;\n }\n return this.errorResponse;\n }\n\n /**\n * Toggle the expanded state of the error response.\n */\n toggleExpanded() {\n this.isExpanded = !this.isExpanded;\n }\n\n public render(): TemplateResult {\n return html`\n <div class=\"nile-error-message\" part=\"base\">\n <nile-icon\n name=\"info2\"\n size=\"14\"\n class=\"nile-error-message__icon\"\n part=\"icon\"\n color=\"#A4121C\"\n ></nile-icon>\n <span class=\"nile-error-message__error\">${this.errorMessage}</span>\n\n\n ${this.errorResponse\n ? html`\n <div class=\"nile-error-message__response\">\n ${this.errorResponse}\n ${this.errorResponseLong\n ? html`\n <span\n class=\"nile-error-message__more-button\"\n @click=${this.toggleExpanded}\n >${this.isExpanded ? 'View Less' : 'View More'}</span\n >`:``}\n </div>\n `\n : ``}\n\n <div\n class=\"nile-error-message__response-expanded ${this.isExpanded\n ? 'expanded'\n : 'collapsed'}\"\n >\n ${this.errorResponseLong}\n </div>\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-error-message': NileErrorMessage;\n }\n}\n"]}
|
@@ -14,27 +14,64 @@ export const styles = css `
|
|
14
14
|
box-sizing: border-box;
|
15
15
|
}
|
16
16
|
|
17
|
-
.
|
17
|
+
.switcher-icon-container {
|
18
18
|
cursor: pointer;
|
19
|
+
justify-content: center;
|
20
|
+
display: flex;
|
21
|
+
align-items: center;
|
22
|
+
margin-bottom: 6px;
|
23
|
+
height: 28px;
|
24
|
+
width: 28px;
|
25
|
+
border-radius: 4px;
|
26
|
+
}
|
27
|
+
|
28
|
+
.switcher-icon-container.current {
|
29
|
+
background: var(--nile-colors-blue-400);
|
19
30
|
}
|
20
|
-
|
31
|
+
|
32
|
+
.switcher-input-container {
|
21
33
|
display: flex;
|
34
|
+
}
|
35
|
+
|
36
|
+
.switcher-inline {
|
22
37
|
gap: 0.5rem;
|
23
38
|
}
|
24
39
|
|
25
|
-
.
|
26
|
-
|
27
|
-
|
40
|
+
.switcher-block {
|
41
|
+
flex-direction: column;
|
42
|
+
}
|
43
|
+
|
44
|
+
.switcher-block > :first-child {
|
45
|
+
align-self: end;
|
46
|
+
}
|
47
|
+
|
48
|
+
.switcher-inline > :nth-child(2) {
|
49
|
+
flex: 1;
|
28
50
|
}
|
29
51
|
|
30
|
-
|
52
|
+
.switcher-input-container > :first-child {
|
53
|
+
display: flex;
|
54
|
+
gap: 0.5rem;
|
31
55
|
max-height: 38px;
|
56
|
+
align-items: center;
|
32
57
|
}
|
33
58
|
|
34
59
|
nile-radio {
|
35
60
|
display: inline-block;
|
36
61
|
padding-right: 10px;
|
37
62
|
}
|
63
|
+
|
64
|
+
.switcher-object-mapper::part(input) {
|
65
|
+
color: var(--nile-colors-primary-600);
|
66
|
+
cursor: pointer;
|
67
|
+
}
|
68
|
+
|
69
|
+
.switcher-input--noborder::part(base) {
|
70
|
+
border: none;
|
71
|
+
}
|
72
|
+
.switcher-object-mapper--noborder::part(base) {
|
73
|
+
border: none;
|
74
|
+
}
|
38
75
|
`;
|
39
76
|
export default [styles];
|
40
77
|
//# sourceMappingURL=nile-switcher.css.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nile-switcher.css.js","sourceRoot":"","sources":["../../../src/nile-switcher/nile-switcher.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
1
|
+
{"version":3,"file":"nile-switcher.css.js","sourceRoot":"","sources":["../../../src/nile-switcher/nile-switcher.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgExB,CAAC;AAEF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit-element';\n\n/**\n * FieldGenerator CSS\n */\nexport const styles = css`\n :host {\n width: 100%;\n box-sizing: border-box;\n }\n\n .switcher-icon-container {\n cursor: pointer;\n justify-content: center;\n display: flex;\n align-items: center;\n margin-bottom: 6px;\n height: 28px;\n width: 28px;\n border-radius: 4px;\n }\n\n .switcher-icon-container.current {\n background: var(--nile-colors-blue-400);\n }\n\n .switcher-input-container {\n display: flex;\n }\n\n .switcher-inline {\n gap: 0.5rem;\n }\n\n .switcher-block {\n flex-direction: column;\n }\n\n .switcher-block > :first-child {\n align-self: end;\n }\n\n .switcher-inline > :nth-child(2) {\n flex: 1;\n }\n\n .switcher-input-container > :first-child {\n display: flex;\n gap: 0.5rem;\n max-height: 38px;\n align-items: center;\n }\n\n nile-radio {\n display: inline-block;\n padding-right: 10px;\n }\n\n .switcher-object-mapper::part(input) {\n color: var(--nile-colors-primary-600);\n cursor: pointer;\n }\n\n .switcher-input--noborder::part(base) {\n border: none;\n }\n .switcher-object-mapper--noborder::part(base) {\n border: none;\n }\n`;\n\nexport default [styles];\n"]}
|
@@ -9,32 +9,34 @@ import NileElement from '../internal/nile-element';
|
|
9
9
|
import { CSSResultGroup } from 'lit';
|
10
10
|
/**
|
11
11
|
* @summary Allows you to switch between nile elements
|
12
|
-
|
12
|
+
*
|
13
13
|
* @dependency nile-icon
|
14
14
|
* @dependency nile-input
|
15
15
|
* @dependency nile-checkbox
|
16
16
|
* @dependency nile-dropdown
|
17
17
|
* @dependency nile-textarea
|
18
18
|
*
|
19
|
-
|
20
19
|
* @event nile-change - Emitted when the control's value changes.
|
21
20
|
* @event nile-switch - Emitted when the nile component is being switched.
|
22
|
-
|
23
21
|
*/
|
24
22
|
export interface switchconfig {
|
25
23
|
[key: string]: any;
|
26
24
|
toggleSwitch: boolean;
|
27
25
|
disable?: boolean;
|
28
26
|
confirmation?: boolean;
|
29
|
-
|
30
|
-
|
27
|
+
current: number;
|
28
|
+
align: 'block' | 'inline';
|
29
|
+
inputs: switchInputType[];
|
31
30
|
}
|
32
31
|
export interface switchInputType {
|
33
|
-
inputType: INPUT_TYPE_NAMES.DROPDOWN | INPUT_TYPE_NAMES.TEXT | INPUT_TYPE_NAMES.CHECKBOX | INPUT_TYPE_NAMES.TEXTAREA | INPUT_TYPE_NAMES.RADIO | INPUT_TYPE_NAMES.CONTENTEDITOR;
|
32
|
+
inputType: INPUT_TYPE_NAMES.DROPDOWN | INPUT_TYPE_NAMES.TEXT | INPUT_TYPE_NAMES.CHECKBOX | INPUT_TYPE_NAMES.TEXTAREA | INPUT_TYPE_NAMES.RADIO | INPUT_TYPE_NAMES.CONTENTEDITOR | INPUT_TYPE_NAMES.OBJECT_MAPPER;
|
34
33
|
value?: String | boolean;
|
35
34
|
label?: String;
|
36
35
|
readonly?: boolean;
|
36
|
+
order: number;
|
37
37
|
type?: string;
|
38
|
+
icon: string;
|
39
|
+
mode?: string;
|
38
40
|
placeholder?: string;
|
39
41
|
disabled?: boolean;
|
40
42
|
required?: boolean;
|
@@ -45,6 +47,10 @@ export interface switchInputType {
|
|
45
47
|
multiple?: boolean;
|
46
48
|
noborder?: boolean;
|
47
49
|
}
|
50
|
+
export declare enum POSITIONS {
|
51
|
+
INLINE = "inline",
|
52
|
+
BLOCK = "block"
|
53
|
+
}
|
48
54
|
export declare enum INPUT_TYPE {
|
49
55
|
DEFAULT = "defaultInput",
|
50
56
|
SWITCH = "switchInput"
|
@@ -55,7 +61,12 @@ export declare enum INPUT_TYPE_NAMES {
|
|
55
61
|
CHECKBOX = "checkbox",
|
56
62
|
TEXTAREA = "text-area",
|
57
63
|
RADIO = "radio",
|
58
|
-
CONTENTEDITOR = "content-editor"
|
64
|
+
CONTENTEDITOR = "content-editor",
|
65
|
+
OBJECT_MAPPER = "object-mapper"
|
66
|
+
}
|
67
|
+
export declare enum MODE {
|
68
|
+
CREATE = "create",
|
69
|
+
EDIT = "edit"
|
59
70
|
}
|
60
71
|
export declare class NileSwitcher extends NileElement {
|
61
72
|
/**
|
@@ -64,19 +75,21 @@ export declare class NileSwitcher extends NileElement {
|
|
64
75
|
*/
|
65
76
|
static styles: CSSResultGroup;
|
66
77
|
nileSwitchConfig: switchconfig;
|
78
|
+
currentInput: switchInputType;
|
67
79
|
connectedCallback(): void;
|
68
80
|
disconnectedCallback(): void;
|
69
|
-
renderNileText(Input: switchInputType
|
70
|
-
renderDropdown(Input: switchInputType
|
71
|
-
renderNileTextArea(Input: switchInputType
|
72
|
-
renderNileCheckBox(Input: switchInputType
|
73
|
-
renderNileRadio(Input: switchInputType
|
81
|
+
renderNileText(Input: switchInputType): TemplateResult<1>;
|
82
|
+
renderDropdown(Input: switchInputType): TemplateResult<1>;
|
83
|
+
renderNileTextArea(Input: switchInputType): TemplateResult<1>;
|
84
|
+
renderNileCheckBox(Input: switchInputType): TemplateResult<1>;
|
85
|
+
renderNileRadio(Input: switchInputType): TemplateResult<1>;
|
74
86
|
renderErrorMessage(errorMessage: string): TemplateResult<1>;
|
75
|
-
renderContentEditor(Input: switchInputType
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
87
|
+
renderContentEditor(Input: switchInputType): TemplateResult<1>;
|
88
|
+
renderObjectMapper(): TemplateResult<1>;
|
89
|
+
handleChange(event: CustomEvent, inputType: string): void;
|
90
|
+
renderIcon(): TemplateResult<1>;
|
91
|
+
toggleField(currentInput: switchInputType): void;
|
92
|
+
singleFieldSwitcher(): TemplateResult<1>;
|
80
93
|
render(): TemplateResult;
|
81
94
|
}
|
82
95
|
export default NileSwitcher;
|
@@ -11,6 +11,12 @@ import { styles } from './nile-switcher.css';
|
|
11
11
|
import NileElement from '../internal/nile-element';
|
12
12
|
import { choose } from 'lit/directives/choose.js';
|
13
13
|
import { classMap } from 'lit/directives/class-map.js';
|
14
|
+
import { repeat } from 'lit/directives/repeat.js';
|
15
|
+
export var POSITIONS;
|
16
|
+
(function (POSITIONS) {
|
17
|
+
POSITIONS["INLINE"] = "inline";
|
18
|
+
POSITIONS["BLOCK"] = "block";
|
19
|
+
})(POSITIONS || (POSITIONS = {}));
|
14
20
|
export var INPUT_TYPE;
|
15
21
|
(function (INPUT_TYPE) {
|
16
22
|
INPUT_TYPE["DEFAULT"] = "defaultInput";
|
@@ -24,9 +30,16 @@ export var INPUT_TYPE_NAMES;
|
|
24
30
|
INPUT_TYPE_NAMES["TEXTAREA"] = "text-area";
|
25
31
|
INPUT_TYPE_NAMES["RADIO"] = "radio";
|
26
32
|
INPUT_TYPE_NAMES["CONTENTEDITOR"] = "content-editor";
|
33
|
+
INPUT_TYPE_NAMES["OBJECT_MAPPER"] = "object-mapper";
|
27
34
|
})(INPUT_TYPE_NAMES || (INPUT_TYPE_NAMES = {}));
|
35
|
+
export var MODE;
|
36
|
+
(function (MODE) {
|
37
|
+
MODE["CREATE"] = "create";
|
38
|
+
MODE["EDIT"] = "edit";
|
39
|
+
})(MODE || (MODE = {}));
|
28
40
|
let NileSwitcher = class NileSwitcher extends NileElement {
|
29
41
|
connectedCallback() {
|
42
|
+
this.currentInput = this.nileSwitchConfig.inputs[0];
|
30
43
|
super.connectedCallback();
|
31
44
|
this.emit('nile-init');
|
32
45
|
}
|
@@ -34,9 +47,13 @@ let NileSwitcher = class NileSwitcher extends NileElement {
|
|
34
47
|
super.disconnectedCallback();
|
35
48
|
this.emit('nile-destroy');
|
36
49
|
}
|
37
|
-
renderNileText(Input
|
38
|
-
const { value, label, placeholder, disabled, required, error, errorMessage, inputType
|
50
|
+
renderNileText(Input) {
|
51
|
+
const { value, label, placeholder, disabled, required, error, errorMessage, inputType, noborder, } = Input;
|
39
52
|
return html `<nile-input
|
53
|
+
class=${classMap({
|
54
|
+
'switcher-input': true,
|
55
|
+
'switcher-input--noborder': !!noborder,
|
56
|
+
})}
|
40
57
|
.value=${value}
|
41
58
|
.label=${label}
|
42
59
|
.disabled=${disabled}
|
@@ -45,13 +62,14 @@ let NileSwitcher = class NileSwitcher extends NileElement {
|
|
45
62
|
.placeholder=${placeholder}
|
46
63
|
.error=${error}
|
47
64
|
@nile-input=${(e) => {
|
48
|
-
this.handleChange(e, inputType
|
65
|
+
this.handleChange(e, inputType);
|
49
66
|
}}
|
50
67
|
></nile-input>`;
|
51
68
|
}
|
52
|
-
renderDropdown(Input
|
53
|
-
const { options, multiple, placeholder, disabled, value, error, errorMessage, inputType
|
69
|
+
renderDropdown(Input) {
|
70
|
+
const { options, multiple, placeholder, disabled, value, error, errorMessage, inputType, } = Input;
|
54
71
|
return html `<nile-select
|
72
|
+
class="switcher-dropdown"
|
55
73
|
.placeholder=${placeholder}
|
56
74
|
.disabled="${disabled}"
|
57
75
|
.multiple="${multiple}"
|
@@ -59,7 +77,7 @@ let NileSwitcher = class NileSwitcher extends NileElement {
|
|
59
77
|
.error="${error}"
|
60
78
|
.errorMessage="${errorMessage}"
|
61
79
|
@nile-change=${(e) => {
|
62
|
-
this.handleChange(e, inputType
|
80
|
+
this.handleChange(e, inputType);
|
63
81
|
}}
|
64
82
|
>
|
65
83
|
${options?.map((option) => {
|
@@ -67,39 +85,42 @@ let NileSwitcher = class NileSwitcher extends NileElement {
|
|
67
85
|
})}
|
68
86
|
</nile-select>`;
|
69
87
|
}
|
70
|
-
renderNileTextArea(Input
|
71
|
-
const { value, disabled, readonly, errorMessage, error, inputType
|
88
|
+
renderNileTextArea(Input) {
|
89
|
+
const { value, disabled, readonly, errorMessage, error, inputType } = Input;
|
72
90
|
return html `<nile-textarea
|
91
|
+
class="switcher-textarea"
|
73
92
|
.value=${value}
|
74
93
|
.disabled=${disabled}
|
75
94
|
?readonly=${readonly}
|
76
95
|
.error=${error}
|
77
96
|
.errorMessage=${errorMessage}
|
78
97
|
@nile-input=${(e) => {
|
79
|
-
this.handleChange(e, inputType
|
98
|
+
this.handleChange(e, inputType);
|
80
99
|
}}
|
81
100
|
></nile-textarea>`;
|
82
101
|
}
|
83
|
-
renderNileCheckBox(Input
|
84
|
-
const { value, label, disabled, inputType
|
102
|
+
renderNileCheckBox(Input) {
|
103
|
+
const { value, label, disabled, inputType } = Input;
|
85
104
|
return html `<nile-checkbox
|
105
|
+
class="switcher-checkbox"
|
86
106
|
.checked=${value}
|
87
107
|
.label=${label}
|
88
108
|
.disabled=${disabled}
|
89
109
|
@valueChange=${(e) => {
|
90
|
-
this.handleChange(e, inputType
|
110
|
+
this.handleChange(e, inputType);
|
91
111
|
}}
|
92
112
|
></nile-checkbox
|
93
113
|
>; `;
|
94
114
|
}
|
95
|
-
renderNileRadio(Input
|
96
|
-
const { options, value, disabled,
|
115
|
+
renderNileRadio(Input) {
|
116
|
+
const { options, value, disabled, errorMessage, inputType } = Input;
|
97
117
|
const haserrorMessage = !!errorMessage;
|
98
118
|
return html `<nile-radio-group
|
119
|
+
class="switcher-radio-group"
|
99
120
|
.value=${value}
|
100
121
|
.disabled=${disabled}
|
101
122
|
@change=${(e) => {
|
102
|
-
this.handleChange(e, inputType
|
123
|
+
this.handleChange(e, inputType);
|
103
124
|
}}
|
104
125
|
>
|
105
126
|
${options &&
|
@@ -114,9 +135,10 @@ let NileSwitcher = class NileSwitcher extends NileElement {
|
|
114
135
|
<nile-form-error-message>${errorMessage}</nile-form-error-message>
|
115
136
|
`;
|
116
137
|
}
|
117
|
-
renderContentEditor(Input
|
118
|
-
let { options, inputType
|
138
|
+
renderContentEditor(Input) {
|
139
|
+
let { options, inputType, errorMessage, type, readonly, noborder, value } = Input;
|
119
140
|
return html `<nile-content-editor
|
141
|
+
class="switcher-content-editor"
|
120
142
|
.value=${value}
|
121
143
|
.options=${options}
|
122
144
|
.type=${type}
|
@@ -124,115 +146,123 @@ let NileSwitcher = class NileSwitcher extends NileElement {
|
|
124
146
|
.noborder=${noborder}
|
125
147
|
.errorMessage=${errorMessage}
|
126
148
|
@nile-change=${(e) => {
|
127
|
-
this.handleChange(e, inputType
|
149
|
+
this.handleChange(e, inputType);
|
128
150
|
}}
|
129
151
|
>
|
130
152
|
</nile-content-editor>`;
|
131
153
|
}
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
event.detail.value;
|
140
|
-
}
|
141
|
-
event.stopPropagation();
|
142
|
-
this.emit('nile-change', { config: this.nileSwitchConfig });
|
143
|
-
}
|
144
|
-
renderIcon(defaultInput, switchInput) {
|
145
|
-
const defaultHelperText = defaultInput.helperText;
|
146
|
-
const switchHelperText = switchInput.helperText;
|
147
|
-
const icon = !this.nileSwitchConfig.toggleSwitch
|
148
|
-
? 'header-functions'
|
149
|
-
: 'stringinput';
|
150
|
-
const helperText = !this.nileSwitchConfig.toggleSwitch
|
151
|
-
? !!switchHelperText
|
152
|
-
? switchHelperText
|
153
|
-
: `switch to ${switchInput.inputType}`
|
154
|
-
: !!defaultHelperText
|
155
|
-
? defaultHelperText
|
156
|
-
: `switch to ${defaultInput.inputType}`;
|
157
|
-
return html ` <nile-tooltip
|
154
|
+
renderObjectMapper() {
|
155
|
+
const noborder = this.currentInput.noborder;
|
156
|
+
const mode = this.currentInput.mode;
|
157
|
+
const value = this.currentInput.mode === MODE.CREATE
|
158
|
+
? 'Click to Create - Not Mapped'
|
159
|
+
: '';
|
160
|
+
return html `<nile-input
|
158
161
|
class=${classMap({
|
159
|
-
'
|
162
|
+
'switcher-object-mapper': true,
|
163
|
+
'switcher-object-mapper--noborder': !!noborder,
|
160
164
|
})}
|
161
|
-
|
162
|
-
|
165
|
+
.value=${value}
|
166
|
+
readonly="true"
|
167
|
+
@click="${(e) => this.handleChange(e, INPUT_TYPE_NAMES.OBJECT_MAPPER)}"
|
163
168
|
>
|
164
169
|
<nile-icon
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
})}
|
169
|
-
.name=${icon}
|
170
|
+
class="pointer-cursor switcher-object-mapper-icon"
|
171
|
+
slot="suffix"
|
172
|
+
name="collapse"
|
170
173
|
color="#005EA6"
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
+
size="16"
|
175
|
+
>
|
176
|
+
</nile-icon>
|
177
|
+
</nile-input>`;
|
174
178
|
}
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
179
|
+
handleChange(event, inputType) {
|
180
|
+
switch (inputType) {
|
181
|
+
case INPUT_TYPE_NAMES.OBJECT_MAPPER:
|
182
|
+
this.currentInput.value = 'clicked';
|
183
|
+
break;
|
184
|
+
case INPUT_TYPE_NAMES.CHECKBOX:
|
185
|
+
this.currentInput.value = event.detail.checked;
|
186
|
+
break;
|
187
|
+
default:
|
188
|
+
this.currentInput.value = event.detail.value;
|
181
189
|
}
|
182
|
-
|
190
|
+
event.stopPropagation();
|
191
|
+
this.emit('nile-change', { input: this.currentInput });
|
183
192
|
}
|
184
|
-
|
185
|
-
const
|
186
|
-
const
|
193
|
+
renderIcon() {
|
194
|
+
const inputs = this.nileSwitchConfig.inputs;
|
195
|
+
const toolTipPosition = this.nileSwitchConfig.align === POSITIONS.BLOCK ? 'top' : 'bottom';
|
187
196
|
return html `
|
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
|
-
|
197
|
+
<div class="switcher-icons-container">
|
198
|
+
${repeat(inputs, input => html ` <nile-tooltip
|
199
|
+
class=${classMap({
|
200
|
+
'switcher-tooltip-container': true,
|
201
|
+
})}
|
202
|
+
content=${input.helperText}
|
203
|
+
placement=${toolTipPosition}
|
204
|
+
>
|
205
|
+
<div class=${classMap({
|
206
|
+
'switcher-icon-container': true,
|
207
|
+
current: input.order === this.currentInput.order,
|
208
|
+
})}>
|
209
|
+
<nile-icon
|
210
|
+
size="16"
|
211
|
+
class=${classMap({
|
212
|
+
'pointer-cursor': true,
|
213
|
+
})}
|
214
|
+
.name=${input.icon}
|
215
|
+
color="#000000"
|
216
|
+
@click=${() => this.toggleField(input)}
|
217
|
+
></nile-icon>
|
218
|
+
<div>
|
219
|
+
|
220
|
+
</nile-tooltip>`)}
|
221
|
+
</div>
|
222
|
+
`;
|
223
|
+
}
|
224
|
+
toggleField(currentInput) {
|
225
|
+
this.currentInput = currentInput;
|
226
|
+
this.emit('nile-switch', { input: this.currentInput });
|
227
|
+
}
|
228
|
+
singleFieldSwitcher() {
|
229
|
+
return html `
|
230
|
+
${choose(this.currentInput.inputType, [
|
231
|
+
[INPUT_TYPE_NAMES.TEXT, () => this.renderNileText(this.currentInput)],
|
232
|
+
[
|
233
|
+
INPUT_TYPE_NAMES.CHECKBOX,
|
234
|
+
() => this.renderNileCheckBox(this.currentInput),
|
235
|
+
],
|
236
|
+
[
|
237
|
+
INPUT_TYPE_NAMES.TEXTAREA,
|
238
|
+
() => this.renderNileTextArea(this.currentInput),
|
239
|
+
],
|
240
|
+
[
|
241
|
+
INPUT_TYPE_NAMES.RADIO,
|
242
|
+
() => this.renderNileRadio(this.currentInput),
|
243
|
+
],
|
244
|
+
[
|
245
|
+
INPUT_TYPE_NAMES.DROPDOWN,
|
246
|
+
() => this.renderDropdown(this.currentInput),
|
247
|
+
],
|
248
|
+
[
|
249
|
+
INPUT_TYPE_NAMES.CONTENTEDITOR,
|
250
|
+
() => this.renderContentEditor(this.currentInput),
|
251
|
+
],
|
252
|
+
[INPUT_TYPE_NAMES.OBJECT_MAPPER, () => this.renderObjectMapper()],
|
253
|
+
], () => this.renderNileText(this.currentInput))}
|
230
254
|
`;
|
231
255
|
}
|
232
256
|
render() {
|
233
|
-
const
|
234
|
-
return html `<div
|
235
|
-
|
257
|
+
const align = this.nileSwitchConfig.align;
|
258
|
+
return html `<div
|
259
|
+
class=${classMap({
|
260
|
+
'switcher-block': align === POSITIONS.BLOCK,
|
261
|
+
'switcher-inline': align === POSITIONS.INLINE,
|
262
|
+
'switcher-input-container': true,
|
263
|
+
})}
|
264
|
+
>
|
265
|
+
${this.renderIcon()} ${this.singleFieldSwitcher()}
|
236
266
|
</div>`;
|
237
267
|
}
|
238
268
|
};
|
@@ -244,6 +274,9 @@ NileSwitcher.styles = styles;
|
|
244
274
|
__decorate([
|
245
275
|
property({ type: Object })
|
246
276
|
], NileSwitcher.prototype, "nileSwitchConfig", void 0);
|
277
|
+
__decorate([
|
278
|
+
property()
|
279
|
+
], NileSwitcher.prototype, "currentInput", void 0);
|
247
280
|
NileSwitcher = __decorate([
|
248
281
|
customElement('nile-switcher')
|
249
282
|
], NileSwitcher);
|