@aquera/nile-elements 0.1.9 → 0.1.11

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent nile-elements following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "nile-elements",
6
- "version": "0.1.9",
6
+ "version": "0.1.11",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -11,25 +11,28 @@ import { css } from 'lit';
11
11
  * CodeEditor CSS
12
12
  */
13
13
  export const styles = css`
14
+ *{
15
+ box-sizing:border-box;
16
+ }
17
+
14
18
  :host {
15
19
  display: block;
16
20
  }
17
21
 
18
- .code-mirror {
22
+ .code__editor__container {
19
23
  display: flex;
20
- justify-content: flex-end;
21
- flex-direction: row-reverse;
22
24
  padding: 5px;
23
25
  border-radius: 5px;
24
26
  border: 1px solid rgb(204, 204, 204);
27
+ position: relative;
25
28
  }
26
29
 
27
30
  .no-scroller .cm-scroller{
28
- scrollbar-width:none;
31
+ scrollbar-width: none;
29
32
  }
30
33
 
31
34
  .error {
32
- border-color: #e5434d;
35
+ border-color: var(--nile-colors-red-500);
33
36
  }
34
37
 
35
38
  .noborder {
@@ -45,14 +48,19 @@ export const styles = css`
45
48
  outline: none;
46
49
  }
47
50
 
48
- .code-editor__icon__container {
51
+ .expand__icon__container{
49
52
  display: none;
53
+ position: absolute;
54
+ border-radius: 5px;
50
55
  cursor: pointer;
51
- align-self: start;
52
- padding: 5px 5px 0px 0px;
56
+ right: 0px;
57
+ top: 5px;
58
+ z-index: 1;
59
+ padding: 5px;
60
+ background-color: var(--nile-colors-white-base);
53
61
  }
54
62
 
55
- .code-mirror:hover > .code-editor__icon__container {
63
+ .code__editor__container:hover > .expand__icon__container{
56
64
  display: flex;
57
65
  }
58
66
  `;
@@ -47,7 +47,7 @@ import { Theme } from './theme';
47
47
  @customElement('nile-code-editor')
48
48
  export class NileCodeEditor extends NileElement {
49
49
 
50
- @query('.code-mirror') codeEditor: HTMLInputElement;
50
+ @query('.code__editor__container') codeEditor: HTMLInputElement;
51
51
 
52
52
  @property({ type: String, reflect: true , attribute: true }) value = '';
53
53
 
@@ -179,22 +179,22 @@ export class NileCodeEditor extends NileElement {
179
179
  return html`<div
180
180
  part="code-editor-base"
181
181
  class=${classMap({
182
- 'code-mirror': true,
182
+ 'code__editor__container': true,
183
183
  'noborder': noborder,
184
184
  'error': hasError || hasErrorMessage,
185
- 'code-mirror__singleline': !this.multiline,
185
+ 'code__editor__singleline': !this.multiline,
186
186
  'no-scroller': noScrollbar
187
187
  })}
188
188
  >
189
189
  ${this.expandable
190
190
  ? html`
191
- <nile-icon
192
- name="${this.expandIcon}"
193
- class="code-editor__icon__container"
194
- size="16"
195
- color="black"
196
- @click="${(e: CustomEvent) => this.emit('nile-expand')}"
197
- ></nile-icon>`
191
+ <div @click="${(e: CustomEvent) => this.emit('nile-expand')}" class="expand__icon__container">
192
+ <nile-icon
193
+ name="${this.expandIcon}"
194
+ size="16"
195
+ color="black"
196
+ ></nile-icon>
197
+ </div>`
198
198
  : ''}
199
199
  </div>
200
200
  ${hasErrorMessage
@@ -95,6 +95,8 @@ export class NileDrawer extends NileElement {
95
95
  */
96
96
  @property({ type: Boolean, reflect: true }) open = false;
97
97
 
98
+ @property({ type: Boolean, reflect: true }) closeOnEscape = true;
99
+
98
100
  /**
99
101
  * The drawer's label as displayed in the header. You should always include a relevant label even when using
100
102
  * `no-header`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.
@@ -162,11 +164,11 @@ export class NileDrawer extends NileElement {
162
164
  }
163
165
 
164
166
  private addOpenListeners() {
165
- document.addEventListener('keydown', this.handleDocumentKeyDown);
167
+ if(this.closeOnEscape) document.addEventListener('keydown', this.handleDocumentKeyDown);
166
168
  }
167
169
 
168
170
  private removeOpenListeners() {
169
- document.removeEventListener('keydown', this.handleDocumentKeyDown);
171
+ if(this.closeOnEscape) document.removeEventListener('keydown', this.handleDocumentKeyDown);
170
172
  }
171
173
 
172
174
  private handleDocumentKeyDown(event: KeyboardEvent) {
@@ -1067,13 +1067,18 @@
1067
1067
  },
1068
1068
  {
1069
1069
  "name": "nile-drawer",
1070
- "description": "Nile drawer component.\n\nEvents:\n\n * `nile-show` {} - Emitted when the drawer opens.\n\n * `nile-after-show` {} - Emitted after the drawer opens and all animations are complete.\n\n * `nile-hide` {} - Emitted when the drawer closes.\n\n * `nile-after-hide` {} - Emitted after the drawer closes and all animations are complete.\n\n * `nile-initial-focus` {} - Emitted when the drawer opens and is ready to receive focus. Calling\n`event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.\n\n * `nile-request-close` {`\"{ source: 'close-button' \" | \"keyboard\" | \" 'overlay' }\"`} - Emitted when the user attempts to\nclose the drawer by clicking the close button, clicking the overlay, or pressing escape. Calling\n`event.preventDefault()` will keep the drawer open. Avoid using this unless closing the drawer will result in\ndestructive behavior such as data loss.\n\nSlots:\n\n * ` ` {} - The drawer's main content.\n\n * `label` {} - The drawer's label. Alternatively, you can use the `label` attribute.\n\n * `header-actions` {} - Optional actions to add to the header. Works best with `<nile-icon-button>`.\n\n * `footer` {} - The drawer's footer, usually one or more buttons representing various options.\n\nAttributes:\n\n * `open` {`boolean`} - Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can\nuse the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.\n\n * `label` {`string`} - The drawer's label as displayed in the header. You should always include a relevant label even when using\n`no-header`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.\n\n * `placement` {`\"top\" | \"end\" | \"bottom\" | \"start\"`} - The direction from which the drawer will open.\n\n * `contained` {`boolean`} - By default, the drawer slides out of its containing block (usually the viewport). To make the drawer slide out of\nits parent element, set this attribute and add `position: relative` to the parent.\n\n * `preventOverlayClose` {`boolean`} - Drawer doesnt close when clicled on overlay, the only way to close is to do by handling open property\n\n * `no-header` {`boolean`} - Removes the header. This will also remove the default close button, so please ensure you provide an easy,\naccessible way for users to dismiss the drawer.\n\nProperties:\n\n * `styles` - \n\n * `hasSlotController` - \n\n * `modal` - \n\n * `originalTrigger` {`HTMLElement | null`} - \n\n * `drawer` {`HTMLElement`} - \n\n * `panel` {`HTMLElement`} - \n\n * `overlay` {`HTMLElement`} - \n\n * `open` {`boolean`} - Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can\nuse the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.\n\n * `label` {`string`} - The drawer's label as displayed in the header. You should always include a relevant label even when using\n`no-header`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.\n\n * `placement` {`\"top\" | \"end\" | \"bottom\" | \"start\"`} - The direction from which the drawer will open.\n\n * `contained` {`boolean`} - By default, the drawer slides out of its containing block (usually the viewport). To make the drawer slide out of\nits parent element, set this attribute and add `position: relative` to the parent.\n\n * `preventOverlayClose` {`boolean`} - Drawer doesnt close when clicled on overlay, the only way to close is to do by handling open property\n\n * `noHeader` {`boolean`} - Removes the header. This will also remove the default close button, so please ensure you provide an easy,\naccessible way for users to dismiss the drawer.\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
1070
+ "description": "Nile drawer component.\n\nEvents:\n\n * `nile-show` {} - Emitted when the drawer opens.\n\n * `nile-after-show` {} - Emitted after the drawer opens and all animations are complete.\n\n * `nile-hide` {} - Emitted when the drawer closes.\n\n * `nile-after-hide` {} - Emitted after the drawer closes and all animations are complete.\n\n * `nile-initial-focus` {} - Emitted when the drawer opens and is ready to receive focus. Calling\n`event.preventDefault()` will prevent focusing and allow you to set it on a different element, such as an input.\n\n * `nile-request-close` {`\"{ source: 'close-button' \" | \"keyboard\" | \" 'overlay' }\"`} - Emitted when the user attempts to\nclose the drawer by clicking the close button, clicking the overlay, or pressing escape. Calling\n`event.preventDefault()` will keep the drawer open. Avoid using this unless closing the drawer will result in\ndestructive behavior such as data loss.\n\nSlots:\n\n * ` ` {} - The drawer's main content.\n\n * `label` {} - The drawer's label. Alternatively, you can use the `label` attribute.\n\n * `header-actions` {} - Optional actions to add to the header. Works best with `<nile-icon-button>`.\n\n * `footer` {} - The drawer's footer, usually one or more buttons representing various options.\n\nAttributes:\n\n * `open` {`boolean`} - Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can\nuse the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.\n\n * `closeOnEscape` {`boolean`} - \n\n * `label` {`string`} - The drawer's label as displayed in the header. You should always include a relevant label even when using\n`no-header`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.\n\n * `placement` {`\"top\" | \"end\" | \"bottom\" | \"start\"`} - The direction from which the drawer will open.\n\n * `contained` {`boolean`} - By default, the drawer slides out of its containing block (usually the viewport). To make the drawer slide out of\nits parent element, set this attribute and add `position: relative` to the parent.\n\n * `preventOverlayClose` {`boolean`} - Drawer doesnt close when clicled on overlay, the only way to close is to do by handling open property\n\n * `no-header` {`boolean`} - Removes the header. This will also remove the default close button, so please ensure you provide an easy,\naccessible way for users to dismiss the drawer.\n\nProperties:\n\n * `styles` - \n\n * `hasSlotController` - \n\n * `modal` - \n\n * `originalTrigger` {`HTMLElement | null`} - \n\n * `drawer` {`HTMLElement`} - \n\n * `panel` {`HTMLElement`} - \n\n * `overlay` {`HTMLElement`} - \n\n * `open` {`boolean`} - Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can\nuse the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.\n\n * `closeOnEscape` {`boolean`} - \n\n * `label` {`string`} - The drawer's label as displayed in the header. You should always include a relevant label even when using\n`no-header`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.\n\n * `placement` {`\"top\" | \"end\" | \"bottom\" | \"start\"`} - The direction from which the drawer will open.\n\n * `contained` {`boolean`} - By default, the drawer slides out of its containing block (usually the viewport). To make the drawer slide out of\nits parent element, set this attribute and add `position: relative` to the parent.\n\n * `preventOverlayClose` {`boolean`} - Drawer doesnt close when clicled on overlay, the only way to close is to do by handling open property\n\n * `noHeader` {`boolean`} - Removes the header. This will also remove the default close button, so please ensure you provide an easy,\naccessible way for users to dismiss the drawer.\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
1071
1071
  "attributes": [
1072
1072
  {
1073
1073
  "name": "open",
1074
1074
  "description": "`open` {`boolean`} - Indicates whether or not the drawer is open. You can toggle this attribute to show and hide the drawer, or you can\nuse the `show()` and `hide()` methods and this attribute will reflect the drawer's open state.\n\nProperty: open\n\nDefault: false",
1075
1075
  "valueSet": "v"
1076
1076
  },
1077
+ {
1078
+ "name": "closeOnEscape",
1079
+ "description": "`closeOnEscape` {`boolean`} - \n\nProperty: closeOnEscape\n\nDefault: true",
1080
+ "valueSet": "v"
1081
+ },
1077
1082
  {
1078
1083
  "name": "label",
1079
1084
  "description": "`label` {`string`} - The drawer's label as displayed in the header. You should always include a relevant label even when using\n`no-header`, as it is required for proper accessibility. If you need to display HTML, use the `label` slot instead.\n\nProperty: label\n\nDefault: "