@aquera/nile-elements 0.0.36 → 0.0.37
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-code-editor/nile-code-editor.css.js +10 -4
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.css.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.d.ts +6 -2
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.js +55 -23
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-content-editor/nile-content-editor.css.js +0 -1
- 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-icon/icons/svg/edit-write.d.ts +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/edit-write.js +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/edit-write.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/expand-2.d.ts +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/expand-2.js +5 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/expand-2.js.map +1 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/index.d.ts +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/index.js +2 -0
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-icon/icons/svg/index.js.map +1 -1
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js +5 -83
- 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 +17 -38
- package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js +110 -214
- 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/demo/filenames.txt +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.iife.js +362 -475
- package/dist/nile-badge/index.cjs.js +1 -1
- package/dist/nile-badge/index.esm.js +1 -1
- package/dist/nile-badge/nile-badge.cjs.js +1 -1
- package/dist/nile-badge/nile-badge.cjs.js.map +1 -1
- package/dist/nile-badge/nile-badge.esm.js +1 -1
- package/dist/nile-button/index.cjs.js +1 -1
- package/dist/nile-button/index.esm.js +1 -1
- package/dist/nile-button/nile-button.cjs.js +1 -1
- package/dist/nile-button/nile-button.cjs.js.map +1 -1
- package/dist/nile-button/nile-button.esm.js +1 -1
- package/dist/nile-code-editor/extensionSetup.cjs.js +2 -2
- package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
- package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.css.esm.js +12 -6
- package/dist/nile-code-editor/nile-code-editor.esm.js +17 -12
- 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 +0 -1
- package/dist/nile-dialog/index.cjs.js +1 -1
- package/dist/nile-dialog/index.esm.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js.map +1 -1
- package/dist/nile-dialog/nile-dialog.esm.js +1 -1
- package/dist/nile-icon/icons/svg/edit-write.cjs.js +2 -0
- package/dist/nile-icon/icons/svg/edit-write.cjs.js.map +1 -0
- package/dist/nile-icon/icons/svg/edit-write.esm.js +1 -0
- package/dist/nile-icon/icons/svg/expand-2.cjs.js +2 -0
- package/dist/nile-icon/icons/svg/expand-2.cjs.js.map +1 -0
- package/dist/nile-icon/icons/svg/expand-2.esm.js +1 -0
- package/dist/nile-icon/icons/svg/index.cjs.js +1 -1
- package/dist/nile-icon/icons/svg/index.esm.js +1 -1
- package/dist/nile-icon/index.cjs.js +1 -1
- package/dist/nile-icon/index.cjs.js.map +1 -1
- package/dist/nile-icon/index.esm.js +1 -1
- package/dist/nile-icon-button/index.cjs.js +1 -1
- package/dist/nile-icon-button/index.esm.js +1 -1
- package/dist/nile-icon-button/nile-icon-button.cjs.js +1 -1
- package/dist/nile-icon-button/nile-icon-button.cjs.js.map +1 -1
- package/dist/nile-icon-button/nile-icon-button.esm.js +1 -1
- package/dist/nile-input/index.cjs.js +1 -1
- package/dist/nile-input/index.esm.js +1 -1
- package/dist/nile-input/nile-input.cjs.js +1 -1
- package/dist/nile-input/nile-input.cjs.js.map +1 -1
- package/dist/nile-input/nile-input.esm.js +1 -1
- package/dist/nile-menu-item/index.cjs.js +1 -1
- package/dist/nile-menu-item/index.esm.js +1 -1
- package/dist/nile-menu-item/nile-menu-item.cjs.js +1 -1
- package/dist/nile-menu-item/nile-menu-item.cjs.js.map +1 -1
- package/dist/nile-menu-item/nile-menu-item.esm.js +1 -1
- package/dist/nile-option/index.cjs.js +1 -1
- package/dist/nile-option/index.esm.js +1 -1
- package/dist/nile-option/nile-option.cjs.js +1 -1
- package/dist/nile-option/nile-option.cjs.js.map +1 -1
- package/dist/nile-option/nile-option.esm.js +1 -1
- package/dist/nile-select/index.cjs.js +1 -1
- package/dist/nile-select/index.esm.js +1 -1
- package/dist/nile-select/nile-select.cjs.js +1 -1
- package/dist/nile-select/nile-select.cjs.js.map +1 -1
- package/dist/nile-select/nile-select.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 +7 -85
- package/dist/nile-switcher/nile-switcher.esm.js +51 -101
- package/dist/nile-tab/index.cjs.js +1 -1
- package/dist/nile-tab/index.esm.js +1 -1
- package/dist/nile-tab/nile-tab.cjs.js +1 -1
- package/dist/nile-tab/nile-tab.cjs.js.map +1 -1
- package/dist/nile-tab/nile-tab.esm.js +1 -1
- package/dist/nile-tab-group/index.cjs.js +1 -1
- package/dist/nile-tab-group/index.esm.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.cjs.js +1 -1
- package/dist/nile-tab-group/nile-tab-group.cjs.js.map +1 -1
- package/dist/nile-tab-group/nile-tab-group.esm.js +1 -1
- package/dist/nile-tag/index.cjs.js +1 -1
- package/dist/nile-tag/index.esm.js +1 -1
- package/dist/nile-tag/nile-tag.cjs.js +1 -1
- package/dist/nile-tag/nile-tag.cjs.js.map +1 -1
- package/dist/nile-tag/nile-tag.esm.js +1 -1
- package/dist/nile-toast/index.cjs.js +1 -1
- package/dist/nile-toast/index.esm.js +1 -1
- package/dist/nile-toast/nile-toast.cjs.js +1 -1
- package/dist/nile-toast/nile-toast.cjs.js.map +1 -1
- package/dist/nile-toast/nile-toast.esm.js +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.css.js +10 -4
- package/dist/src/nile-code-editor/nile-code-editor.css.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.d.ts +6 -2
- package/dist/src/nile-code-editor/nile-code-editor.js +55 -23
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-content-editor/nile-content-editor.css.js +0 -1
- package/dist/src/nile-content-editor/nile-content-editor.css.js.map +1 -1
- package/dist/src/nile-icon/icons/svg/edit-write.d.ts +5 -0
- package/dist/src/nile-icon/icons/svg/edit-write.js +5 -0
- package/dist/src/nile-icon/icons/svg/edit-write.js.map +1 -0
- package/dist/src/nile-icon/icons/svg/expand-2.d.ts +5 -0
- package/dist/src/nile-icon/icons/svg/expand-2.js +5 -0
- package/dist/src/nile-icon/icons/svg/expand-2.js.map +1 -0
- package/dist/src/nile-icon/icons/svg/index.d.ts +2 -0
- package/dist/src/nile-icon/icons/svg/index.js +2 -0
- package/dist/src/nile-icon/icons/svg/index.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.css.js +5 -83
- package/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
- package/dist/src/nile-switcher/nile-switcher.d.ts +17 -38
- package/dist/src/nile-switcher/nile-switcher.js +110 -214
- 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-code-editor/nile-code-editor.css.ts +10 -4
- package/src/nile-code-editor/nile-code-editor.ts +51 -31
- package/src/nile-content-editor/nile-content-editor.css.ts +0 -1
- package/src/nile-icon/icons/svg/edit-write.ts +5 -0
- package/src/nile-icon/icons/svg/expand-2.ts +5 -0
- package/src/nile-icon/icons/svg/index.ts +2 -0
- package/src/nile-switcher/nile-switcher.css.ts +5 -83
- package/src/nile-switcher/nile-switcher.ts +172 -252
@@ -17,102 +17,24 @@ export const styles = css `
|
|
17
17
|
.pointer-cursor {
|
18
18
|
cursor: pointer;
|
19
19
|
}
|
20
|
-
|
21
|
-
.switcher__label {
|
20
|
+
.input-container {
|
22
21
|
display: flex;
|
23
|
-
align-items: center;
|
24
|
-
color: inherit;
|
25
|
-
color: var(--nile-colors-dark-900);
|
26
|
-
font-family: Colfax-regular;
|
27
|
-
font-size: 14px;
|
28
|
-
font-style: normal;
|
29
|
-
font-weight: 400;
|
30
|
-
line-height: 14px;
|
31
|
-
letter-spacing: 0.2px;
|
32
|
-
}
|
33
|
-
|
34
|
-
switcher-object-mapper:hover {
|
35
|
-
display: flex;
|
36
|
-
}
|
37
|
-
.switcher-icon-container.current {
|
38
|
-
background: var(--nile-colors-blue-400);
|
39
|
-
}
|
40
|
-
|
41
|
-
.switcher-container {
|
42
|
-
display: flex;
|
43
|
-
}
|
44
|
-
|
45
|
-
.switcher-inline {
|
46
22
|
gap: 0.5rem;
|
47
23
|
}
|
48
24
|
|
49
|
-
.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
.switcher-inline > :nth-child(2) {
|
54
|
-
flex: 1;
|
25
|
+
.input-container > :first-child {
|
26
|
+
max-width: 98%;
|
27
|
+
min-width: 98%;
|
55
28
|
}
|
56
29
|
|
57
|
-
|
58
|
-
display: flex;
|
59
|
-
margin-left: auto;
|
60
|
-
gap: 0.5rem;
|
30
|
+
nile-icon {
|
61
31
|
max-height: 38px;
|
62
|
-
align-items: center;
|
63
|
-
}
|
64
|
-
|
65
|
-
.switcher-block > .switcher-icons-container {
|
66
|
-
margin-left: auto;
|
67
|
-
}
|
68
|
-
|
69
|
-
.label-container {
|
70
|
-
display: flex;
|
71
32
|
}
|
72
33
|
|
73
|
-
.switcher-icon-container {
|
74
|
-
cursor: pointer;
|
75
|
-
justify-content: center;
|
76
|
-
display: flex;
|
77
|
-
align-items: center;
|
78
|
-
margin-bottom: 6px;
|
79
|
-
height: 28px;
|
80
|
-
width: 28px;
|
81
|
-
border-radius: 4px;
|
82
|
-
}
|
83
34
|
nile-radio {
|
84
35
|
display: inline-block;
|
85
36
|
padding-right: 10px;
|
86
37
|
}
|
87
|
-
|
88
|
-
nile-code-editor {
|
89
|
-
overflow: hidden;
|
90
|
-
padding-top: 2px;
|
91
|
-
border-radius: 5px;
|
92
|
-
border: 1px solid rgb(204, 204, 204);
|
93
|
-
}
|
94
|
-
|
95
|
-
.code-editor__no-border {
|
96
|
-
border: none;
|
97
|
-
}
|
98
|
-
|
99
|
-
.switcher-object-mapper-icon {
|
100
|
-
display: none;
|
101
|
-
}
|
102
|
-
.switcher-object-mapper:hover > .switcher-object-mapper-icon {
|
103
|
-
display: block;
|
104
|
-
}
|
105
|
-
.switcher-object-mapper::part(input) {
|
106
|
-
color: var(--nile-colors-primary-600);
|
107
|
-
cursor: pointer;
|
108
|
-
}
|
109
|
-
|
110
|
-
.switcher-input--noborder::part(base) {
|
111
|
-
border: none;
|
112
|
-
}
|
113
|
-
.switcher-object-mapper--noborder::part(base) {
|
114
|
-
border: none;
|
115
|
-
}
|
116
38
|
`;
|
117
39
|
export default [styles];
|
118
40
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BxB,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 .pointer-cursor {\n cursor: pointer;\n }\n .input-container {\n display: flex;\n gap: 0.5rem;\n }\n\n .input-container > :first-child {\n max-width: 98%;\n min-width: 98%;\n }\n\n nile-icon {\n max-height: 38px;\n }\n\n nile-radio {\n display: inline-block;\n padding-right: 10px;\n }\n`;\n\nexport default [styles];\n"]}
|
@@ -9,48 +9,41 @@ 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
|
+
|
19
20
|
* @event nile-change - Emitted when the control's value changes.
|
20
21
|
* @event nile-switch - Emitted when the nile component is being switched.
|
22
|
+
|
21
23
|
*/
|
22
24
|
export interface switchconfig {
|
23
25
|
[key: string]: any;
|
24
26
|
toggleSwitch: boolean;
|
25
27
|
disable?: boolean;
|
26
28
|
confirmation?: boolean;
|
27
|
-
|
28
|
-
|
29
|
+
defaultInput: switchInputType;
|
30
|
+
switchInput: switchInputType;
|
29
31
|
}
|
30
32
|
export interface switchInputType {
|
31
|
-
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
|
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
34
|
value?: String | boolean;
|
33
35
|
label?: String;
|
34
36
|
readonly?: boolean;
|
35
37
|
type?: string;
|
36
|
-
icon: string;
|
37
|
-
mode?: string;
|
38
38
|
placeholder?: string;
|
39
39
|
disabled?: boolean;
|
40
40
|
required?: boolean;
|
41
41
|
error?: boolean;
|
42
42
|
errorMessage?: string;
|
43
43
|
options?: Array<any>;
|
44
|
-
customAutoCompletions?: any;
|
45
44
|
helperText?: string;
|
46
45
|
multiple?: boolean;
|
47
46
|
noborder?: boolean;
|
48
|
-
multiLine?: boolean;
|
49
|
-
expand?: boolean;
|
50
|
-
}
|
51
|
-
export declare enum POSITIONS {
|
52
|
-
INLINE = "inline",
|
53
|
-
BLOCK = "block"
|
54
47
|
}
|
55
48
|
export declare enum INPUT_TYPE {
|
56
49
|
DEFAULT = "defaultInput",
|
@@ -62,13 +55,7 @@ export declare enum INPUT_TYPE_NAMES {
|
|
62
55
|
CHECKBOX = "checkbox",
|
63
56
|
TEXTAREA = "text-area",
|
64
57
|
RADIO = "radio",
|
65
|
-
CONTENTEDITOR = "content-editor"
|
66
|
-
OBJECT_MAPPER = "object-mapper",
|
67
|
-
CODE_EDITOR = "code-editor"
|
68
|
-
}
|
69
|
-
export declare enum MODE {
|
70
|
-
CREATE = "create",
|
71
|
-
EDIT = "edit"
|
58
|
+
CONTENTEDITOR = "content-editor"
|
72
59
|
}
|
73
60
|
export declare class NileSwitcher extends NileElement {
|
74
61
|
/**
|
@@ -76,28 +63,20 @@ export declare class NileSwitcher extends NileElement {
|
|
76
63
|
* @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
|
77
64
|
*/
|
78
65
|
static styles: CSSResultGroup;
|
79
|
-
private readonly hasSlotController;
|
80
66
|
nileSwitchConfig: switchconfig;
|
81
|
-
current: Number;
|
82
|
-
currentInput: switchInputType;
|
83
67
|
connectedCallback(): void;
|
84
|
-
handleSwitcherChange(): void;
|
85
|
-
setCurrentInput(): void;
|
86
68
|
disconnectedCallback(): void;
|
87
|
-
renderNileText(Input: switchInputType): TemplateResult<1>;
|
88
|
-
renderDropdown(Input: switchInputType): TemplateResult<1>;
|
89
|
-
renderNileTextArea(Input: switchInputType): TemplateResult<1>;
|
90
|
-
renderNileCheckBox(Input: switchInputType): TemplateResult<1>;
|
91
|
-
renderNileRadio(Input: switchInputType): TemplateResult<1>;
|
69
|
+
renderNileText(Input: switchInputType, inputType: string): TemplateResult<1>;
|
70
|
+
renderDropdown(Input: switchInputType, inputType: string): TemplateResult<1>;
|
71
|
+
renderNileTextArea(Input: switchInputType, inputType: string): TemplateResult<1>;
|
72
|
+
renderNileCheckBox(Input: switchInputType, inputType: string): TemplateResult<1>;
|
73
|
+
renderNileRadio(Input: switchInputType, inputType: string): TemplateResult<1>;
|
92
74
|
renderErrorMessage(errorMessage: string): TemplateResult<1>;
|
93
|
-
renderContentEditor(Input: switchInputType): TemplateResult<1>;
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
renderIcon(): TemplateResult<1>;
|
99
|
-
toggleField(currentInput: switchInputType, index: Number): void;
|
100
|
-
singleFieldSwitcher(): TemplateResult<1>;
|
75
|
+
renderContentEditor(Input: switchInputType, inputType: string): TemplateResult<1>;
|
76
|
+
handleChange(event: CustomEvent, inputType: string, inputTypeName: string): void;
|
77
|
+
renderIcon(defaultInput: switchInputType, switchInput: switchInputType): TemplateResult<1>;
|
78
|
+
toggleField(): void;
|
79
|
+
singleFieldSwitcher(defaultInput: switchInputType, switchInput: switchInputType, toggleField: boolean, disable: boolean): TemplateResult<1>;
|
101
80
|
render(): TemplateResult;
|
102
81
|
}
|
103
82
|
export default NileSwitcher;
|
@@ -11,14 +11,6 @@ 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
|
-
import { watch } from '../internal/watch';
|
16
|
-
import { HasSlotController } from '../internal/slot';
|
17
|
-
export var POSITIONS;
|
18
|
-
(function (POSITIONS) {
|
19
|
-
POSITIONS["INLINE"] = "inline";
|
20
|
-
POSITIONS["BLOCK"] = "block";
|
21
|
-
})(POSITIONS || (POSITIONS = {}));
|
22
14
|
export var INPUT_TYPE;
|
23
15
|
(function (INPUT_TYPE) {
|
24
16
|
INPUT_TYPE["DEFAULT"] = "defaultInput";
|
@@ -32,45 +24,19 @@ export var INPUT_TYPE_NAMES;
|
|
32
24
|
INPUT_TYPE_NAMES["TEXTAREA"] = "text-area";
|
33
25
|
INPUT_TYPE_NAMES["RADIO"] = "radio";
|
34
26
|
INPUT_TYPE_NAMES["CONTENTEDITOR"] = "content-editor";
|
35
|
-
INPUT_TYPE_NAMES["OBJECT_MAPPER"] = "object-mapper";
|
36
|
-
INPUT_TYPE_NAMES["CODE_EDITOR"] = "code-editor";
|
37
27
|
})(INPUT_TYPE_NAMES || (INPUT_TYPE_NAMES = {}));
|
38
|
-
export var MODE;
|
39
|
-
(function (MODE) {
|
40
|
-
MODE["CREATE"] = "create";
|
41
|
-
MODE["EDIT"] = "edit";
|
42
|
-
})(MODE || (MODE = {}));
|
43
28
|
let NileSwitcher = class NileSwitcher extends NileElement {
|
44
|
-
constructor() {
|
45
|
-
super(...arguments);
|
46
|
-
this.hasSlotController = new HasSlotController(this, 'label');
|
47
|
-
this.current = 0;
|
48
|
-
}
|
49
29
|
connectedCallback() {
|
50
30
|
super.connectedCallback();
|
51
31
|
this.emit('nile-init');
|
52
32
|
}
|
53
|
-
handleSwitcherChange() {
|
54
|
-
this.setCurrentInput();
|
55
|
-
}
|
56
|
-
setCurrentInput() {
|
57
|
-
if (this.nileSwitchConfig?.inputs) {
|
58
|
-
this.currentInput = this.nileSwitchConfig.inputs.filter((input, index) => {
|
59
|
-
return index === this.current;
|
60
|
-
})[0];
|
61
|
-
}
|
62
|
-
}
|
63
33
|
disconnectedCallback() {
|
64
34
|
super.disconnectedCallback();
|
65
35
|
this.emit('nile-destroy');
|
66
36
|
}
|
67
|
-
renderNileText(Input) {
|
68
|
-
const { value, label, placeholder, disabled, required, error, errorMessage, inputType
|
37
|
+
renderNileText(Input, inputType) {
|
38
|
+
const { value, label, placeholder, disabled, required, error, errorMessage, inputType: inputTypeName, } = Input;
|
69
39
|
return html `<nile-input
|
70
|
-
class=${classMap({
|
71
|
-
'switcher-input': true,
|
72
|
-
'switcher-input--noborder': !!noborder,
|
73
|
-
})}
|
74
40
|
.value=${value}
|
75
41
|
.label=${label}
|
76
42
|
.disabled=${disabled}
|
@@ -79,15 +45,13 @@ let NileSwitcher = class NileSwitcher extends NileElement {
|
|
79
45
|
.placeholder=${placeholder}
|
80
46
|
.error=${error}
|
81
47
|
@nile-input=${(e) => {
|
82
|
-
this.handleChange(e, inputType);
|
48
|
+
this.handleChange(e, inputType, inputTypeName);
|
83
49
|
}}
|
84
50
|
></nile-input>`;
|
85
51
|
}
|
86
|
-
renderDropdown(Input) {
|
87
|
-
const { options, multiple, placeholder, disabled, value, error, errorMessage, inputType, } = Input;
|
52
|
+
renderDropdown(Input, inputType) {
|
53
|
+
const { options, multiple, placeholder, disabled, value, error, errorMessage, inputType: inputTypeName, } = Input;
|
88
54
|
return html `<nile-select
|
89
|
-
part="dropdown"
|
90
|
-
class="switcher-dropdown"
|
91
55
|
.placeholder=${placeholder}
|
92
56
|
.disabled="${disabled}"
|
93
57
|
.multiple="${multiple}"
|
@@ -95,7 +59,7 @@ let NileSwitcher = class NileSwitcher extends NileElement {
|
|
95
59
|
.error="${error}"
|
96
60
|
.errorMessage="${errorMessage}"
|
97
61
|
@nile-change=${(e) => {
|
98
|
-
this.handleChange(e, inputType);
|
62
|
+
this.handleChange(e, inputType, inputTypeName);
|
99
63
|
}}
|
100
64
|
>
|
101
65
|
${options?.map((option) => {
|
@@ -103,42 +67,39 @@ let NileSwitcher = class NileSwitcher extends NileElement {
|
|
103
67
|
})}
|
104
68
|
</nile-select>`;
|
105
69
|
}
|
106
|
-
renderNileTextArea(Input) {
|
107
|
-
const { value, disabled, readonly, errorMessage, error, inputType } = Input;
|
70
|
+
renderNileTextArea(Input, inputType) {
|
71
|
+
const { value, disabled, readonly, errorMessage, error, inputType: inputTypeName, } = Input;
|
108
72
|
return html `<nile-textarea
|
109
|
-
class="switcher-textarea"
|
110
73
|
.value=${value}
|
111
74
|
.disabled=${disabled}
|
112
75
|
?readonly=${readonly}
|
113
76
|
.error=${error}
|
114
77
|
.errorMessage=${errorMessage}
|
115
78
|
@nile-input=${(e) => {
|
116
|
-
this.handleChange(e, inputType);
|
79
|
+
this.handleChange(e, inputType, inputTypeName);
|
117
80
|
}}
|
118
81
|
></nile-textarea>`;
|
119
82
|
}
|
120
|
-
renderNileCheckBox(Input) {
|
121
|
-
const { value, label, disabled, inputType } = Input;
|
83
|
+
renderNileCheckBox(Input, inputType) {
|
84
|
+
const { value, label, disabled, inputType: inputTypeName } = Input;
|
122
85
|
return html `<nile-checkbox
|
123
|
-
class="switcher-checkbox"
|
124
86
|
.checked=${value}
|
125
87
|
.label=${label}
|
126
88
|
.disabled=${disabled}
|
127
89
|
@valueChange=${(e) => {
|
128
|
-
this.handleChange(e, inputType);
|
90
|
+
this.handleChange(e, inputType, inputTypeName);
|
129
91
|
}}
|
130
92
|
></nile-checkbox
|
131
93
|
>; `;
|
132
94
|
}
|
133
|
-
renderNileRadio(Input) {
|
134
|
-
const { options, value, disabled, errorMessage,
|
95
|
+
renderNileRadio(Input, inputType) {
|
96
|
+
const { options, value, disabled, inputType: inputTypeName, errorMessage, } = Input;
|
135
97
|
const haserrorMessage = !!errorMessage;
|
136
98
|
return html `<nile-radio-group
|
137
|
-
class="switcher-radio-group"
|
138
99
|
.value=${value}
|
139
100
|
.disabled=${disabled}
|
140
101
|
@change=${(e) => {
|
141
|
-
this.handleChange(e, inputType);
|
102
|
+
this.handleChange(e, inputType, inputTypeName);
|
142
103
|
}}
|
143
104
|
>
|
144
105
|
${options &&
|
@@ -153,10 +114,9 @@ let NileSwitcher = class NileSwitcher extends NileElement {
|
|
153
114
|
<nile-form-error-message>${errorMessage}</nile-form-error-message>
|
154
115
|
`;
|
155
116
|
}
|
156
|
-
renderContentEditor(Input) {
|
157
|
-
let { options, inputType, errorMessage, type, readonly, noborder, value } = Input;
|
117
|
+
renderContentEditor(Input, inputType) {
|
118
|
+
let { options, inputType: inputTypeName, errorMessage, type, readonly, noborder, value, } = Input;
|
158
119
|
return html `<nile-content-editor
|
159
|
-
class="switcher-content-editor"
|
160
120
|
.value=${value}
|
161
121
|
.options=${options}
|
162
122
|
.type=${type}
|
@@ -164,170 +124,115 @@ let NileSwitcher = class NileSwitcher extends NileElement {
|
|
164
124
|
.noborder=${noborder}
|
165
125
|
.errorMessage=${errorMessage}
|
166
126
|
@nile-change=${(e) => {
|
167
|
-
this.handleChange(e, inputType);
|
127
|
+
this.handleChange(e, inputType, inputTypeName);
|
168
128
|
}}
|
169
129
|
>
|
170
130
|
</nile-content-editor>`;
|
171
131
|
}
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
132
|
+
handleChange(event, inputType, inputTypeName) {
|
133
|
+
if (inputTypeName === INPUT_TYPE_NAMES.CHECKBOX) {
|
134
|
+
this.nileSwitchConfig[inputType].value =
|
135
|
+
event.detail.checked;
|
136
|
+
}
|
137
|
+
else {
|
138
|
+
this.nileSwitchConfig[inputType].value =
|
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
|
179
158
|
class=${classMap({
|
180
|
-
'
|
181
|
-
'switcher-object-mapper--noborder': !!noborder,
|
159
|
+
'tooltip-container': true,
|
182
160
|
})}
|
183
|
-
|
184
|
-
|
185
|
-
@click="${(e) => this.handleChange(e, INPUT_TYPE_NAMES.OBJECT_MAPPER)}"
|
161
|
+
content=${helperText}
|
162
|
+
placement="bottom"
|
186
163
|
>
|
187
164
|
<nile-icon
|
188
|
-
|
189
|
-
|
190
|
-
name="collapse"
|
191
|
-
color="#005EA6"
|
192
|
-
size="16"
|
193
|
-
>
|
194
|
-
</nile-icon>
|
195
|
-
</nile-input>`;
|
196
|
-
}
|
197
|
-
renderCodeEditor(Input) {
|
198
|
-
const { value, multiLine, customAutoCompletions, disabled, readonly, errorMessage, error, inputType, noborder, } = Input;
|
199
|
-
return html `<nile-code-editor
|
200
|
-
part="code-editor"
|
201
|
-
class=${classMap({
|
202
|
-
'code-editor': true,
|
203
|
-
'code-editor__no-border': !!noborder,
|
204
|
-
})}
|
205
|
-
@nile-expand="${(e) => this.handleExpand(e, INPUT_TYPE_NAMES.CODE_EDITOR)}"
|
206
|
-
@nile-change="${(e) => this.handleChange(e, INPUT_TYPE_NAMES.CODE_EDITOR)}"
|
207
|
-
.multiline="${multiLine}"
|
208
|
-
.value="${value}"
|
209
|
-
.customOptions="${customAutoCompletions}"
|
210
|
-
></nile-code-editor> `;
|
211
|
-
}
|
212
|
-
handleExpand(event, inputType) {
|
213
|
-
this.currentInput.expand = event.detail.expand;
|
214
|
-
this.emit('nile-change', { input: this.currentInput });
|
215
|
-
}
|
216
|
-
handleChange(event, inputType) {
|
217
|
-
switch (inputType) {
|
218
|
-
case INPUT_TYPE_NAMES.OBJECT_MAPPER:
|
219
|
-
this.currentInput.value = 'clicked';
|
220
|
-
break;
|
221
|
-
case INPUT_TYPE_NAMES.CHECKBOX:
|
222
|
-
this.currentInput.value = event.detail.checked;
|
223
|
-
break;
|
224
|
-
case INPUT_TYPE_NAMES.CODE_EDITOR:
|
225
|
-
this.currentInput.value = event.detail.value;
|
226
|
-
break;
|
227
|
-
default:
|
228
|
-
this.currentInput.value = event.detail.value;
|
229
|
-
}
|
230
|
-
event.stopPropagation();
|
231
|
-
this.emit('nile-change', { input: this.currentInput });
|
232
|
-
}
|
233
|
-
renderIcon() {
|
234
|
-
const inputs = this.nileSwitchConfig.inputs;
|
235
|
-
const toolTipPosition = this.nileSwitchConfig.align === POSITIONS.BLOCK ? 'top' : 'bottom';
|
236
|
-
return html `
|
237
|
-
<div part="icons-container" class="switcher-icons-container">
|
238
|
-
${repeat(inputs, (input, index) => html ` <nile-tooltip
|
239
|
-
class=${classMap({
|
240
|
-
'switcher-tooltip-container': true,
|
241
|
-
})}
|
242
|
-
content=${input.helperText}
|
243
|
-
placement=${toolTipPosition}
|
244
|
-
>
|
245
|
-
<div class=${classMap({
|
246
|
-
'switcher-icon-container': true,
|
247
|
-
current: index === this.current,
|
248
|
-
})}>
|
249
|
-
<nile-icon
|
250
|
-
size="16"
|
251
|
-
class=${classMap({
|
165
|
+
size="14"
|
166
|
+
class=${classMap({
|
252
167
|
'pointer-cursor': true,
|
253
168
|
})}
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
this.current = index;
|
169
|
+
.name=${icon}
|
170
|
+
color="#005EA6"
|
171
|
+
@click=${this.toggleField}
|
172
|
+
></nile-icon>
|
173
|
+
</nile-tooltip>`;
|
174
|
+
}
|
175
|
+
toggleField() {
|
176
|
+
if (!this.nileSwitchConfig.confirmation) {
|
177
|
+
this.nileSwitchConfig = {
|
178
|
+
...this.nileSwitchConfig,
|
179
|
+
toggleSwitch: !this.nileSwitchConfig.toggleSwitch,
|
180
|
+
};
|
267
181
|
}
|
268
|
-
this.emit('nile-switch', {
|
182
|
+
this.emit('nile-switch', { config: this.nileSwitchConfig });
|
269
183
|
}
|
270
|
-
singleFieldSwitcher() {
|
271
|
-
|
272
|
-
|
273
|
-
}
|
184
|
+
singleFieldSwitcher(defaultInput, switchInput, toggleField, disable) {
|
185
|
+
const defaultInputType = defaultInput.inputType;
|
186
|
+
const switchInputType = switchInput.inputType;
|
274
187
|
return html `
|
275
|
-
${
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
],
|
302
|
-
|
188
|
+
${!toggleField
|
189
|
+
? choose(defaultInputType, [
|
190
|
+
[
|
191
|
+
INPUT_TYPE_NAMES.TEXT,
|
192
|
+
() => this.renderNileText(defaultInput, INPUT_TYPE.DEFAULT),
|
193
|
+
],
|
194
|
+
[
|
195
|
+
INPUT_TYPE_NAMES.CHECKBOX,
|
196
|
+
() => this.renderNileCheckBox(defaultInput, INPUT_TYPE.DEFAULT),
|
197
|
+
],
|
198
|
+
[
|
199
|
+
INPUT_TYPE_NAMES.TEXTAREA,
|
200
|
+
() => this.renderNileTextArea(defaultInput, INPUT_TYPE.DEFAULT),
|
201
|
+
],
|
202
|
+
[
|
203
|
+
INPUT_TYPE_NAMES.RADIO,
|
204
|
+
() => this.renderNileRadio(defaultInput, INPUT_TYPE.DEFAULT),
|
205
|
+
],
|
206
|
+
[
|
207
|
+
INPUT_TYPE_NAMES.DROPDOWN,
|
208
|
+
() => this.renderDropdown(this.nileSwitchConfig.defaultInput, INPUT_TYPE.DEFAULT),
|
209
|
+
],
|
210
|
+
[
|
211
|
+
INPUT_TYPE_NAMES.CONTENTEDITOR,
|
212
|
+
() => this.renderContentEditor(this.nileSwitchConfig.defaultInput, INPUT_TYPE.DEFAULT),
|
213
|
+
],
|
214
|
+
], () => this.renderNileText(defaultInput, INPUT_TYPE.DEFAULT))
|
215
|
+
: choose(switchInputType, [
|
216
|
+
[
|
217
|
+
INPUT_TYPE_NAMES.TEXTAREA,
|
218
|
+
() => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH),
|
219
|
+
],
|
220
|
+
[
|
221
|
+
INPUT_TYPE_NAMES.TEXT,
|
222
|
+
() => this.renderNileText(switchInput, INPUT_TYPE.SWITCH),
|
223
|
+
],
|
224
|
+
[
|
225
|
+
INPUT_TYPE_NAMES.CONTENTEDITOR,
|
226
|
+
() => this.renderContentEditor(switchInput, INPUT_TYPE.SWITCH),
|
227
|
+
],
|
228
|
+
], () => this.renderNileTextArea(switchInput, INPUT_TYPE.SWITCH))}
|
229
|
+
${!disable ? this.renderIcon(defaultInput, switchInput) : ''}
|
303
230
|
`;
|
304
231
|
}
|
305
232
|
render() {
|
306
|
-
const
|
307
|
-
|
308
|
-
|
309
|
-
part="base"
|
310
|
-
class=${classMap({
|
311
|
-
'switcher-block': align === POSITIONS.BLOCK,
|
312
|
-
'switcher-inline': align === POSITIONS.INLINE,
|
313
|
-
'switcher-container': true,
|
314
|
-
})}
|
315
|
-
>
|
316
|
-
<div class="label-container">
|
317
|
-
${hasLabelSlot
|
318
|
-
? html `
|
319
|
-
<label
|
320
|
-
part="switcher-label"
|
321
|
-
class="switcher__label"
|
322
|
-
for="input"
|
323
|
-
>
|
324
|
-
<slot name="label"></slot>
|
325
|
-
</label>
|
326
|
-
</div> `
|
327
|
-
: ''}
|
328
|
-
${this.renderIcon()}
|
329
|
-
</div>
|
330
|
-
${this.singleFieldSwitcher()}
|
233
|
+
const { toggleSwitch: toggleField, defaultInput, switchInput, disable, } = this.nileSwitchConfig;
|
234
|
+
return html `<div class="input-container">
|
235
|
+
${this.singleFieldSwitcher(defaultInput, switchInput, toggleField, !!disable)}
|
331
236
|
</div>`;
|
332
237
|
}
|
333
238
|
};
|
@@ -339,15 +244,6 @@ NileSwitcher.styles = styles;
|
|
339
244
|
__decorate([
|
340
245
|
property({ type: Object })
|
341
246
|
], NileSwitcher.prototype, "nileSwitchConfig", void 0);
|
342
|
-
__decorate([
|
343
|
-
property({ type: Number })
|
344
|
-
], NileSwitcher.prototype, "current", void 0);
|
345
|
-
__decorate([
|
346
|
-
property({ type: Object })
|
347
|
-
], NileSwitcher.prototype, "currentInput", void 0);
|
348
|
-
__decorate([
|
349
|
-
watch(['current'], { waitUntilFirstUpdate: true })
|
350
|
-
], NileSwitcher.prototype, "handleSwitcherChange", null);
|
351
247
|
NileSwitcher = __decorate([
|
352
248
|
customElement('nile-switcher')
|
353
249
|
], NileSwitcher);
|