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

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 +30 -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 +40 -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 +30 -11
  14. package/dist/nile-checkbox/nile-checkbox.esm.js +13 -13
  15. package/dist/src/nile-checkbox/nile-checkbox.css.js +30 -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 +30 -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-4",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -11,8 +11,9 @@ 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
+ width: 100%;
16
17
  }
17
18
 
18
19
  .checkbox {
@@ -41,8 +42,10 @@ export const styles = css`
41
42
  border: solid 1px var(--nile-colors-neutral-700);
42
43
  background-color: var(--nile-colors-white-base);
43
44
  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);
45
+ transition: var(--nile-transition-duration-default border-color),
46
+ var(--nile-transition-duration-default) background-color,
47
+ var(--nile-transition-duration-default) color,
48
+ var(--nile-transition-duration-default box-shadow);
46
49
  }
47
50
 
48
51
  .checkbox__input {
@@ -53,20 +56,22 @@ export const styles = css`
53
56
  pointer-events: none;
54
57
  }
55
58
 
56
-
57
59
  /* svg {
58
60
  display:none !important;
59
61
  } */
60
62
 
61
63
  /* Hover */
62
- .checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__control:hover {
64
+ .checkbox:not(.checkbox--checked):not(.checkbox--disabled)
65
+ .checkbox__control:hover {
63
66
  background: var(--nile-colors-primary-100);
64
67
  border: 1px solid var(--nile-colors-primary-600);
65
68
  border-radius: 4px;
66
69
  }
67
70
 
68
71
  /* Focus */
69
- .checkbox:not(.checkbox--checked):not(.checkbox--disabled) .checkbox__input:focus-visible ~ .checkbox__control {
72
+ .checkbox:not(.checkbox--checked):not(.checkbox--disabled)
73
+ .checkbox__input:focus-visible
74
+ ~ .checkbox__control {
70
75
  outline: solid 3px hsl(198.6 88.7% 48.4% / 40%);
71
76
  outline-offset: 1px;
72
77
  }
@@ -80,14 +85,19 @@ export const styles = css`
80
85
 
81
86
  /* Checked/indeterminate + hover */
82
87
  .checkbox.checkbox--checked:not(.checkbox--disabled) .checkbox__control:hover,
83
- .checkbox.checkbox--indeterminate:not(.checkbox--disabled) .checkbox__control:hover {
88
+ .checkbox.checkbox--indeterminate:not(.checkbox--disabled)
89
+ .checkbox__control:hover {
84
90
  background: var(--nile-colors-primary-900);
85
91
  border: 1px solid var(--nile-colors-primary-900);
86
92
  }
87
93
 
88
94
  /* 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 {
95
+ .checkbox.checkbox--checked:not(.checkbox--disabled)
96
+ .checkbox__input:focus-visible
97
+ ~ .checkbox__control,
98
+ .checkbox.checkbox--indeterminate:not(.checkbox--disabled)
99
+ .checkbox__input:focus-visible
100
+ ~ .checkbox__control {
91
101
  outline: solid 3px hsl(198.6 88.7% 48.4% / 40%);
92
102
  outline-offset: 1px;
93
103
  }
@@ -114,12 +124,21 @@ export const styles = css`
114
124
 
115
125
  :host([required]) .checkbox__label::after {
116
126
  content: '*';
117
- margin-inline-start: -2px
127
+ margin-inline-start: -2px;
118
128
  }
119
129
 
120
- :host {
130
+ .checkbox__checked-icon {
121
131
  --nile-svg-stroke: white;
122
132
  }
133
+
134
+ .checkbox__indeterminate-icon {
135
+ --nile-svg-stroke: white;
136
+ }
137
+
138
+ .checkbox__icon {
139
+ float: right;
140
+ cursor: pointer;
141
+ }
123
142
  `;
124
143
 
125
144
  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
  }