@aquera/nile-elements 0.0.4-2 → 0.0.4-3

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 (23) hide show
  1. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-checkbox/nile-checkbox.css.js +29 -11
  2. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-checkbox/nile-checkbox.css.js.map +1 -1
  3. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-checkbox/nile-checkbox.d.ts +2 -0
  4. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-checkbox/nile-checkbox.js +17 -8
  5. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-checkbox/nile-checkbox.js.map +1 -1
  6. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
  7. package/demo/index.html +2 -1
  8. package/dist/index.iife.js +39 -21
  9. package/dist/nile-checkbox/nile-checkbox.cjs.js +1 -1
  10. package/dist/nile-checkbox/nile-checkbox.cjs.js.map +1 -1
  11. package/dist/nile-checkbox/nile-checkbox.css.cjs.js +1 -1
  12. package/dist/nile-checkbox/nile-checkbox.css.cjs.js.map +1 -1
  13. package/dist/nile-checkbox/nile-checkbox.css.esm.js +29 -11
  14. package/dist/nile-checkbox/nile-checkbox.esm.js +13 -13
  15. package/dist/src/nile-checkbox/nile-checkbox.css.js +29 -11
  16. package/dist/src/nile-checkbox/nile-checkbox.css.js.map +1 -1
  17. package/dist/src/nile-checkbox/nile-checkbox.d.ts +2 -0
  18. package/dist/src/nile-checkbox/nile-checkbox.js +17 -8
  19. package/dist/src/nile-checkbox/nile-checkbox.js.map +1 -1
  20. package/dist/tsconfig.tsbuildinfo +1 -1
  21. package/package.json +1 -1
  22. package/src/nile-checkbox/nile-checkbox.css.ts +29 -11
  23. package/src/nile-checkbox/nile-checkbox.ts +21 -17
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.4-2",
6
+ "version": "0.0.4-3",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -11,7 +11,7 @@ import { css } from 'lit-element';
11
11
  * Checkbox CSS
12
12
  */
13
13
  export const styles = css`
14
- :host {
14
+ :host {
15
15
  display: inline-block;
16
16
  }
17
17
 
@@ -41,8 +41,10 @@ export const styles = css`
41
41
  border: solid 1px var(--nile-colors-neutral-700);
42
42
  background-color: var(--nile-colors-white-base);
43
43
  border-radius: 4px;
44
- transition: var(--nile-transition-duration-default border-color), var(--nile-transition-duration-default) background-color,
45
- var(--nile-transition-duration-default) color, var(--nile-transition-duration-default box-shadow);
44
+ transition: var(--nile-transition-duration-default border-color),
45
+ var(--nile-transition-duration-default) background-color,
46
+ var(--nile-transition-duration-default) color,
47
+ var(--nile-transition-duration-default box-shadow);
46
48
  }
47
49
 
48
50
  .checkbox__input {
@@ -53,20 +55,22 @@ export const styles = css`
53
55
  pointer-events: none;
54
56
  }
55
57
 
56
-
57
58
  /* svg {
58
59
  display:none !important;
59
60
  } */
60
61
 
61
62
  /* Hover */
62
- .checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover {
63
+ .checkbox:not(.checkbox--checked):not(.checkbox--disabled)
64
+ .checkbox__control:hover {
63
65
  background: var(--nile-colors-primary-100);
64
66
  border: 1px solid var(--nile-colors-primary-600);
65
67
  border-radius: 4px;
66
68
  }
67
69
 
68
70
  /* Focus */
69
- .checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control {
71
+ .checkbox:not(.checkbox--checked):not(.checkbox--disabled)
72
+ .checkbox__input:focus-visible
73
+ ~ .checkbox__control {
70
74
  outline: solid 3px hsl(198.6 88.7% 48.4% / 40%);
71
75
  outline-offset: 1px;
72
76
  }
@@ -80,14 +84,19 @@ export const styles = css`
80
84
 
81
85
  /* Checked/indeterminate + hover */
82
86
  .checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__control:hover,
83
- .checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__control:hover {
87
+ .checkbox.checkbox--indeterminate:not(.checkbox--disabled)
88
+ .checkbox__control:hover {
84
89
  background: var(--nile-colors-primary-900);
85
90
  border: 1px solid var(--nile-colors-primary-900);
86
91
  }
87
92
 
88
93
  /* Checked/indeterminate + focus */
89
- .checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control,
90
- .checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control {
94
+ .checkbox.checkbox--checked:not(.checkbox--disabled)
95
+ .checkbox__input:focus-visible
96
+ ~ .checkbox__control,
97
+ .checkbox.checkbox--indeterminate:not(.checkbox--disabled)
98
+ .checkbox__input:focus-visible
99
+ ~ .checkbox__control {
91
100
  outline: solid 3px hsl(198.6 88.7% 48.4% / 40%);
92
101
  outline-offset: 1px;
93
102
  }
@@ -114,12 +123,21 @@ export const styles = css`
114
123
 
115
124
  :host([required]) .checkbox__label::after {
116
125
  content: '*';
117
- margin-inline-start: -2px
126
+ margin-inline-start: -2px;
118
127
  }
119
128
 
120
- :host {
129
+ .checkbox__checked-icon {
121
130
  --nile-svg-stroke: white;
122
131
  }
132
+
133
+ .checkbox__indeterminate-icon {
134
+ --nile-svg-stroke: white;
135
+ }
136
+
137
+ .checkbox__icon {
138
+ float: right;
139
+ cursor: pointer;
140
+ }
123
141
  `;
124
142
 
125
143
  export default [styles];
@@ -95,6 +95,8 @@ export class NileCheckbox extends NileElement {
95
95
 
96
96
  @property({ attribute: 'help-text' }) helpText = '';
97
97
 
98
+ @property({ type: Boolean }) showHelpText = false;
99
+
98
100
  @property({ attribute: 'error-message' }) errorMessage = '';
99
101
 
100
102
  /**
@@ -107,6 +109,10 @@ export class NileCheckbox extends NileElement {
107
109
  /** Makes the checkbox a required field. */
108
110
  @property({ type: Boolean, reflect: true }) required = false;
109
111
 
112
+ private toggleHelpText() {
113
+ this.showHelpText = !this.showHelpText;
114
+ }
115
+
110
116
  private handleClick() {
111
117
  this.checked = !this.checked;
112
118
  this.indeterminate = false;
@@ -232,23 +238,21 @@ export class NileCheckbox extends NileElement {
232
238
  </div>
233
239
  </label>
234
240
 
235
- ${
236
- hasHelpText
237
- ? html`
238
- <nile-form-help-text>${this.helpText}</nile-form-help-text>
239
- `
240
- : ``
241
- }
242
-
243
- ${
244
- hasErrorMessage
245
- ? html`
246
- <nile-form-error-message
247
- >${this.errorMessage}</nile-form-error-message
248
- >
249
- `
250
- : ``
251
- }
241
+ ${hasHelpText
242
+ ? html` <nile-icon name="question" @click=${this.toggleHelpText} class="checkbox__icon"></nile-icon> `
243
+ : ``}
244
+
245
+ ${hasHelpText && this.showHelpText
246
+ ? html` <nile-form-help-text>${this.helpText}</nile-form-help-text> `
247
+ : ``}
248
+
249
+ ${hasErrorMessage
250
+ ? html`
251
+ <nile-form-error-message
252
+ >${this.errorMessage}</nile-form-error-message
253
+ >
254
+ `
255
+ : ``}
252
256
  `;
253
257
  }
254
258
  }