@aquera/nile-elements 0.0.34 → 0.0.35

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.
Files changed (30) hide show
  1. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js +30 -13
  2. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
  3. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.d.ts +1 -0
  4. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js +23 -4
  5. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-switcher/nile-switcher.js.map +1 -1
  6. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
  7. package/dist/index.iife.js +49 -20
  8. package/dist/nile-code-editor/extensionSetup.cjs.js +1 -1
  9. package/dist/nile-code-editor/extensionSetup.cjs.js.map +1 -1
  10. package/dist/nile-code-editor/extensionSetup.esm.js +1 -1
  11. package/dist/nile-code-editor/nile-code-editor.cjs.js +2 -2
  12. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  13. package/dist/nile-code-editor/nile-code-editor.esm.js +2 -2
  14. package/dist/nile-switcher/index.cjs.js +1 -1
  15. package/dist/nile-switcher/index.esm.js +1 -1
  16. package/dist/nile-switcher/nile-switcher.cjs.js +1 -1
  17. package/dist/nile-switcher/nile-switcher.cjs.js.map +1 -1
  18. package/dist/nile-switcher/nile-switcher.css.cjs.js +1 -1
  19. package/dist/nile-switcher/nile-switcher.css.cjs.js.map +1 -1
  20. package/dist/nile-switcher/nile-switcher.css.esm.js +32 -15
  21. package/dist/nile-switcher/nile-switcher.esm.js +33 -21
  22. package/dist/src/nile-switcher/nile-switcher.css.js +30 -13
  23. package/dist/src/nile-switcher/nile-switcher.css.js.map +1 -1
  24. package/dist/src/nile-switcher/nile-switcher.d.ts +1 -0
  25. package/dist/src/nile-switcher/nile-switcher.js +23 -4
  26. package/dist/src/nile-switcher/nile-switcher.js.map +1 -1
  27. package/dist/tsconfig.tsbuildinfo +1 -1
  28. package/package.json +1 -1
  29. package/src/nile-switcher/nile-switcher.css.ts +30 -13
  30. package/src/nile-switcher/nile-switcher.ts +25 -4
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.0.34",
6
+ "version": "0.0.35",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -16,22 +16,24 @@ export const styles = css`
16
16
  box-sizing: border-box;
17
17
  }
18
18
 
19
- .switcher-icon-container {
20
- cursor: pointer;
21
- justify-content: center;
19
+ .switcher__label {
22
20
  display: flex;
23
21
  align-items: center;
24
- margin-bottom: 6px;
25
- height: 28px;
26
- width: 28px;
27
- border-radius: 4px;
22
+ color: inherit;
23
+ color: var(--nile-colors-dark-900);
24
+ font-family: Colfax-regular;
25
+ font-size: 14px;
26
+ font-style: normal;
27
+ font-weight: 400;
28
+ line-height: 14px;
29
+ letter-spacing: 0.2px;
28
30
  }
29
31
 
30
32
  .switcher-icon-container.current {
31
33
  background: var(--nile-colors-blue-400);
32
34
  }
33
35
 
34
- .switcher-input-container {
36
+ .switcher-container {
35
37
  display: flex;
36
38
  }
37
39
 
@@ -43,21 +45,36 @@ export const styles = css`
43
45
  flex-direction: column;
44
46
  }
45
47
 
46
- .switcher-block > :first-child {
47
- align-self: end;
48
- }
49
-
50
48
  .switcher-inline > :nth-child(2) {
51
49
  flex: 1;
52
50
  }
53
51
 
54
- .switcher-input-container > :first-child {
52
+ .switcher-icons-container {
55
53
  display: flex;
54
+ margin-left: auto;
56
55
  gap: 0.5rem;
57
56
  max-height: 38px;
58
57
  align-items: center;
59
58
  }
60
59
 
60
+ .switcher-block > .switcher-icons-container {
61
+ margin-left: auto;
62
+ }
63
+
64
+ .label-container {
65
+ display: flex;
66
+ }
67
+
68
+ .switcher-icon-container {
69
+ cursor: pointer;
70
+ justify-content: center;
71
+ display: flex;
72
+ align-items: center;
73
+ margin-bottom: 6px;
74
+ height: 28px;
75
+ width: 28px;
76
+ border-radius: 4px;
77
+ }
61
78
  nile-radio {
62
79
  display: inline-block;
63
80
  padding-right: 10px;
@@ -14,6 +14,7 @@ import { choose } from 'lit/directives/choose.js';
14
14
  import { classMap } from 'lit/directives/class-map.js';
15
15
  import { repeat } from 'lit/directives/repeat.js';
16
16
  import { watch } from '../internal/watch';
17
+ import { HasSlotController } from '../internal/slot';
17
18
 
18
19
  /**
19
20
  * @summary Allows you to switch between nile elements
@@ -101,7 +102,10 @@ export class NileSwitcher extends NileElement {
101
102
  */
102
103
  static styles: CSSResultGroup = styles;
103
104
 
105
+ private readonly hasSlotController = new HasSlotController(this, 'label');
106
+
104
107
  @property({ type: Object }) nileSwitchConfig: switchconfig;
108
+
105
109
  @property({ type: Number }) current: Number = 0;
106
110
 
107
111
  @property({ type: Object }) currentInput: switchInputType;
@@ -352,7 +356,7 @@ export class NileSwitcher extends NileElement {
352
356
  this.nileSwitchConfig.align === POSITIONS.BLOCK ? 'top' : 'bottom';
353
357
 
354
358
  return html`
355
- <div class="switcher-icons-container">
359
+ <div part="icons-container" class="switcher-icons-container">
356
360
  ${repeat(
357
361
  inputs,
358
362
  (input: any, index: number) => html` <nile-tooltip
@@ -384,7 +388,9 @@ export class NileSwitcher extends NileElement {
384
388
  }
385
389
 
386
390
  toggleField(currentInput: switchInputType, index: Number) {
387
- this.current = index;
391
+ if (this.nileSwitchConfig.confirmation) {
392
+ this.current = index;
393
+ }
388
394
  this.emit('nile-switch', { input: this.currentInput });
389
395
  }
390
396
 
@@ -429,15 +435,30 @@ export class NileSwitcher extends NileElement {
429
435
  }
430
436
 
431
437
  public render(): TemplateResult {
438
+ const hasLabelSlot = this.hasSlotController.test('label');
432
439
  const align = this.nileSwitchConfig.align;
433
440
  return html`<div
434
441
  class=${classMap({
435
442
  'switcher-block': align === POSITIONS.BLOCK,
436
443
  'switcher-inline': align === POSITIONS.INLINE,
437
- 'switcher-input-container': true,
444
+ 'switcher-container': true,
438
445
  })}
439
446
  >
440
- ${this.renderIcon()} ${this.singleFieldSwitcher()}
447
+ <div class="label-container">
448
+ ${hasLabelSlot
449
+ ? html`
450
+ <label
451
+ part="switcher-label"
452
+ class="switcher__label"
453
+ for="input"
454
+ >
455
+ <slot name="label"></slot>
456
+ </label>
457
+ </div> `
458
+ : ''}
459
+ ${this.renderIcon()}
460
+ </div>
461
+ ${this.singleFieldSwitcher()}
441
462
  </div>`;
442
463
  }
443
464
  }