@aquera/nile-elements 0.0.6-10 → 0.0.6-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.
Files changed (129) hide show
  1. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.d.ts +2 -0
  2. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js +2 -0
  3. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/index.js.map +1 -1
  4. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle/index.d.ts +1 -0
  5. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle/index.js +2 -0
  6. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle/index.js.map +1 -0
  7. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/{nile-radio-button/nile-radio-button.css.d.ts → nile-button-toggle/nile-button-toggle.css.d.ts} +1 -1
  8. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle/nile-button-toggle.css.js +52 -0
  9. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle/nile-button-toggle.css.js.map +1 -0
  10. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle/nile-button-toggle.d.ts +39 -0
  11. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle/nile-button-toggle.js +94 -0
  12. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle/nile-button-toggle.js.map +1 -0
  13. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle-group/index.d.ts +1 -0
  14. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle-group/index.js +2 -0
  15. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle-group/index.js.map +1 -0
  16. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle-group/nile-button-toggle-group.css.d.ts +12 -0
  17. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle-group/nile-button-toggle-group.css.js +17 -0
  18. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle-group/nile-button-toggle-group.css.js.map +1 -0
  19. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle-group/nile-button-toggle-group.d.ts +37 -0
  20. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle-group/nile-button-toggle-group.js +76 -0
  21. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-button-toggle-group/nile-button-toggle-group.js.map +1 -0
  22. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
  23. package/dist/index.cjs.js +1 -1
  24. package/dist/index.esm.js +1 -1
  25. package/dist/index.iife.js +249 -194
  26. package/dist/nile-button-toggle/index.cjs.js +2 -0
  27. package/dist/nile-button-toggle/index.esm.js +1 -0
  28. package/dist/nile-button-toggle/nile-button-toggle.cjs.js +2 -0
  29. package/dist/nile-button-toggle/nile-button-toggle.cjs.js.map +1 -0
  30. package/dist/nile-button-toggle/nile-button-toggle.css.cjs.js +2 -0
  31. package/dist/nile-button-toggle/nile-button-toggle.css.cjs.js.map +1 -0
  32. package/dist/nile-button-toggle/nile-button-toggle.css.esm.js +40 -0
  33. package/dist/nile-button-toggle/nile-button-toggle.esm.js +6 -0
  34. package/dist/nile-button-toggle-group/index.cjs.js +2 -0
  35. package/dist/nile-button-toggle-group/index.esm.js +1 -0
  36. package/dist/nile-button-toggle-group/nile-button-toggle-group.cjs.js +2 -0
  37. package/dist/nile-button-toggle-group/nile-button-toggle-group.cjs.js.map +1 -0
  38. package/dist/nile-button-toggle-group/nile-button-toggle-group.css.cjs.js +2 -0
  39. package/dist/nile-button-toggle-group/nile-button-toggle-group.css.cjs.js.map +1 -0
  40. package/dist/nile-button-toggle-group/nile-button-toggle-group.css.esm.js +5 -0
  41. package/dist/nile-button-toggle-group/nile-button-toggle-group.esm.js +3 -0
  42. package/dist/src/index.d.ts +2 -0
  43. package/dist/src/index.js +2 -0
  44. package/dist/src/index.js.map +1 -1
  45. package/dist/src/nile-button-toggle/index.d.ts +1 -0
  46. package/dist/src/nile-button-toggle/index.js +2 -0
  47. package/dist/src/nile-button-toggle/index.js.map +1 -0
  48. package/dist/src/{nile-radio-button/nile-radio-button.css.d.ts → nile-button-toggle/nile-button-toggle.css.d.ts} +1 -1
  49. package/dist/src/nile-button-toggle/nile-button-toggle.css.js +52 -0
  50. package/dist/src/nile-button-toggle/nile-button-toggle.css.js.map +1 -0
  51. package/dist/src/nile-button-toggle/nile-button-toggle.d.ts +39 -0
  52. package/dist/src/nile-button-toggle/nile-button-toggle.js +94 -0
  53. package/dist/src/nile-button-toggle/nile-button-toggle.js.map +1 -0
  54. package/dist/src/nile-button-toggle-group/index.d.ts +1 -0
  55. package/dist/src/nile-button-toggle-group/index.js +2 -0
  56. package/dist/src/nile-button-toggle-group/index.js.map +1 -0
  57. package/dist/src/nile-button-toggle-group/nile-button-toggle-group.css.d.ts +12 -0
  58. package/dist/src/nile-button-toggle-group/nile-button-toggle-group.css.js +17 -0
  59. package/dist/src/nile-button-toggle-group/nile-button-toggle-group.css.js.map +1 -0
  60. package/dist/src/nile-button-toggle-group/nile-button-toggle-group.d.ts +37 -0
  61. package/dist/src/nile-button-toggle-group/nile-button-toggle-group.js +76 -0
  62. package/dist/src/nile-button-toggle-group/nile-button-toggle-group.js.map +1 -0
  63. package/dist/tsconfig.tsbuildinfo +1 -1
  64. package/package.json +1 -1
  65. package/src/index.ts +3 -1
  66. package/src/nile-button-toggle/index.ts +1 -0
  67. package/src/nile-button-toggle/nile-button-toggle.css.ts +54 -0
  68. package/src/nile-button-toggle/nile-button-toggle.ts +99 -0
  69. package/src/nile-button-toggle-group/index.ts +1 -0
  70. package/src/nile-button-toggle-group/nile-button-toggle-group.css.ts +19 -0
  71. package/src/nile-button-toggle-group/nile-button-toggle-group.ts +90 -0
  72. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/index.d.ts +0 -1
  73. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/index.js +0 -2
  74. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/index.js.map +0 -1
  75. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/nile-radio-button.css.js +0 -173
  76. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/nile-radio-button.css.js.map +0 -1
  77. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/nile-radio-button.d.ts +0 -57
  78. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/nile-radio-button.js +0 -145
  79. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/nile-radio-button.js.map +0 -1
  80. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/index.d.ts +0 -1
  81. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/index.js +0 -2
  82. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/index.js.map +0 -1
  83. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.css.d.ts +0 -12
  84. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.css.js +0 -70
  85. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.css.js.map +0 -1
  86. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.d.ts +0 -66
  87. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.js +0 -308
  88. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.js.map +0 -1
  89. package/dist/nile-radio-button/index.cjs.js +0 -2
  90. package/dist/nile-radio-button/index.esm.js +0 -1
  91. package/dist/nile-radio-button/nile-radio-button.cjs.js +0 -2
  92. package/dist/nile-radio-button/nile-radio-button.cjs.js.map +0 -1
  93. package/dist/nile-radio-button/nile-radio-button.css.cjs.js +0 -2
  94. package/dist/nile-radio-button/nile-radio-button.css.cjs.js.map +0 -1
  95. package/dist/nile-radio-button/nile-radio-button.css.esm.js +0 -161
  96. package/dist/nile-radio-button/nile-radio-button.esm.js +0 -21
  97. package/dist/nile-radio-button-group/index.cjs.js +0 -2
  98. package/dist/nile-radio-button-group/index.esm.js +0 -1
  99. package/dist/nile-radio-button-group/nile-radio-button-group.cjs.js +0 -2
  100. package/dist/nile-radio-button-group/nile-radio-button-group.cjs.js.map +0 -1
  101. package/dist/nile-radio-button-group/nile-radio-button-group.css.cjs.js +0 -2
  102. package/dist/nile-radio-button-group/nile-radio-button-group.css.cjs.js.map +0 -1
  103. package/dist/nile-radio-button-group/nile-radio-button-group.css.esm.js +0 -58
  104. package/dist/nile-radio-button-group/nile-radio-button-group.esm.js +0 -56
  105. package/dist/src/nile-radio-button/index.d.ts +0 -1
  106. package/dist/src/nile-radio-button/index.js +0 -2
  107. package/dist/src/nile-radio-button/index.js.map +0 -1
  108. package/dist/src/nile-radio-button/nile-radio-button.css.js +0 -173
  109. package/dist/src/nile-radio-button/nile-radio-button.css.js.map +0 -1
  110. package/dist/src/nile-radio-button/nile-radio-button.d.ts +0 -57
  111. package/dist/src/nile-radio-button/nile-radio-button.js +0 -145
  112. package/dist/src/nile-radio-button/nile-radio-button.js.map +0 -1
  113. package/dist/src/nile-radio-button-group/index.d.ts +0 -1
  114. package/dist/src/nile-radio-button-group/index.js +0 -2
  115. package/dist/src/nile-radio-button-group/index.js.map +0 -1
  116. package/dist/src/nile-radio-button-group/nile-radio-button-group.css.d.ts +0 -12
  117. package/dist/src/nile-radio-button-group/nile-radio-button-group.css.js +0 -70
  118. package/dist/src/nile-radio-button-group/nile-radio-button-group.css.js.map +0 -1
  119. package/dist/src/nile-radio-button-group/nile-radio-button-group.d.ts +0 -66
  120. package/dist/src/nile-radio-button-group/nile-radio-button-group.js +0 -308
  121. package/dist/src/nile-radio-button-group/nile-radio-button-group.js.map +0 -1
  122. package/src/nile-radio-button/index.ts +0 -1
  123. package/src/nile-radio-button/nile-radio-button.css.ts +0 -175
  124. package/src/nile-radio-button/nile-radio-button.ts +0 -151
  125. package/src/nile-radio-button-group/index.ts +0 -1
  126. package/src/nile-radio-button-group/nile-radio-button-group.css.ts +0 -72
  127. package/src/nile-radio-button-group/nile-radio-button-group.ts +0 -337
  128. /package/dist/{nile-radio-button → nile-button-toggle}/index.cjs.js.map +0 -0
  129. /package/dist/{nile-radio-button-group → nile-button-toggle-group}/index.cjs.js.map +0 -0
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.6-10",
6
+ "version": "0.0.6-11",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
package/src/index.ts CHANGED
@@ -29,6 +29,8 @@ export { NileErrorMessage } from './nile-error-message';
29
29
  export { NileFormErrorMessage } from './nile-form-error-message';
30
30
  export { NileFormHelpText } from './nile-form-help-text';
31
31
  export { NileCalendar } from './nile-calendar';
32
- export { NileLink } from './nile-link';
32
+ export { NileLink} from './nile-link';
33
+ export { NileButtonToggleGroup } from './nile-button-toggle-group';
34
+ export { NileButtonToggle } from './nile-button-toggle';
33
35
  export { NileSwitcher } from './nile-switcher';
34
36
  export { NileContentEditor } from './nile-content-editor';
@@ -0,0 +1 @@
1
+ export { NileButtonToggle } from './nile-button-toggle';
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { css } from 'lit-element';
9
+
10
+ /**
11
+ * ButtonToggle CSS
12
+ */
13
+ export const styles = css`
14
+ :host {
15
+ }
16
+
17
+ .nile-button-toggle {
18
+ display: flex;
19
+ padding: 12px;
20
+ border: 1px solid #ccc;
21
+ cursor: pointer;
22
+ border-radius: 4px;
23
+ color: #000;
24
+ text-align: center;
25
+ font-family: Colfax-regular;
26
+ font-size: 14px;
27
+ line-height: 14px;
28
+ letter-spacing: 0.2px;
29
+ justify-content: center;
30
+ align-items: center;
31
+ gap: 10px;
32
+ }
33
+
34
+ .nile-button-toggle__initial {
35
+ border-radius: 4px 0 0 4px;
36
+ }
37
+
38
+ .nile-button-toggle__end {
39
+ border-radius: 0 4px 4px 0;
40
+ }
41
+
42
+ .nile-button-toggle__middle {
43
+ border-width: 1px 0px;
44
+ border-style: solid;
45
+ border-color: #ccc;
46
+ border-radius: 0;
47
+ }
48
+
49
+ .nile-button-toggle__active {
50
+ background-color: #c7ced4;
51
+ }
52
+ `;
53
+
54
+ export default [styles];
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {LitElement, html, property, CSSResultArray, TemplateResult} from 'lit-element';
9
+ import { customElement } from 'lit/decorators.js';
10
+ import {styles} from './nile-button-toggle.css';
11
+
12
+ /**
13
+ * Nile icon component.
14
+ *
15
+ * @tag nile-button-toggle
16
+ *
17
+ */
18
+ @customElement('nile-button-toggle')
19
+ export class NileButtonToggle extends LitElement {
20
+
21
+ /**
22
+ * The styles for ButtonToggle
23
+ * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
24
+ */
25
+ public static get styles(): CSSResultArray {
26
+ return [styles];
27
+ }
28
+
29
+ @property({ type: Boolean, reflect: true })
30
+ active = false;
31
+
32
+ @property({ type: Boolean, reflect: true })
33
+ initial = false;
34
+
35
+ @property({ type: Boolean, reflect: true })
36
+ middle = false;
37
+
38
+ @property({ type: Boolean, reflect: true })
39
+ end = false;
40
+
41
+ @property({ type: String })
42
+ value = '';
43
+
44
+ connectedCallback() {
45
+ super.connectedCallback();
46
+ this.addEventListener('click', this.toggle);
47
+ }
48
+
49
+ disconnectedCallback() {
50
+ this.removeEventListener('click', this.toggle);
51
+ super.disconnectedCallback();
52
+ }
53
+
54
+ toggle() {
55
+ this.active = true;
56
+ const eventData = { active: this.active, value: this.value };
57
+ this.dispatchEvent(new CustomEvent('nile-toggle-changed', { detail: eventData, bubbles: true }));
58
+
59
+ }
60
+
61
+ /**
62
+ * Render method
63
+ * @slot This is a slot test
64
+ */
65
+ public render(): TemplateResult {
66
+ let classes = ['nile-button-toggle'];
67
+ if (this.active) {
68
+ classes.push('nile-button-toggle__active');
69
+ }
70
+ if (this.initial) {
71
+ classes.push('nile-button-toggle__initial');
72
+ }
73
+ if (this.middle) {
74
+ classes.push('nile-button-toggle__middle');
75
+ }
76
+ if (this.end) {
77
+ classes.push('nile-button-toggle__end');
78
+ }
79
+
80
+ const classString = classes.join(' ');
81
+
82
+ return html`
83
+ <div class="${classString}">
84
+ <slot name="prefix"></slot>
85
+ <slot> </slot>
86
+ </div>
87
+ `;
88
+ }
89
+
90
+ /* #endregion */
91
+ }
92
+
93
+ export default NileButtonToggle;
94
+
95
+ declare global {
96
+ interface HTMLElementTagNameMap {
97
+ 'nile-button-toggle': NileButtonToggle;
98
+ }
99
+ }
@@ -0,0 +1 @@
1
+ export { NileButtonToggleGroup } from './nile-button-toggle-group';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {css} from 'lit-element';
9
+
10
+ /**
11
+ * ButtonToggleGroup CSS
12
+ */
13
+ export const styles = css`
14
+ :host {
15
+ display: inline-flex;
16
+ }
17
+ `;
18
+
19
+ export default [styles];
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Copyright Aquera Inc 2023
3
+ *
4
+ * This source code is licensed under the BSD-3-Clause license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import {LitElement, html, property, CSSResultArray, TemplateResult} from 'lit-element';
9
+ import { customElement, query, queryAll } from 'lit/decorators.js';
10
+ import {styles} from './nile-button-toggle-group.css';
11
+ import NileButtonToggle from '../nile-button-toggle/nile-button-toggle';
12
+ /**
13
+ * Nile icon component.
14
+ *
15
+ * @tag nile-button-toggle-group
16
+ *
17
+ */
18
+ @customElement('nile-button-toggle-group')
19
+ export class NileButtonToggleGroup extends LitElement {
20
+
21
+ /**
22
+ * The styles for ButtonToggleGroup
23
+ * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
24
+ */
25
+ public static get styles(): CSSResultArray {
26
+ return [styles];
27
+ }
28
+
29
+ @queryAll('nile-button-toggle')
30
+ private toggles!: NodeListOf<NileButtonToggle>;
31
+
32
+ @query('slot:not([name])')
33
+ private defaultSlot!: HTMLSlotElement;
34
+
35
+
36
+ connectedCallback() {
37
+ super.connectedCallback();
38
+ }
39
+
40
+ firstUpdated() {
41
+ this.defaultSlot.addEventListener('slotchange', () => this.updateTogglePositions());
42
+ this.addEventListener('nile-toggle-changed', this.handleToggle);
43
+ this.updateTogglePositions();
44
+ }
45
+
46
+ updateTogglePositions() {
47
+ const assignedNodes = this.defaultSlot.assignedNodes({flatten: true});
48
+ const toggles = assignedNodes.filter(node => node instanceof NileButtonToggle) as NileButtonToggle[];
49
+
50
+ toggles.forEach((toggle, index) => {
51
+ toggle.initial = index === 0;
52
+ toggle.middle = index > 0 && index < toggles.length - 1;
53
+ toggle.end = index === toggles.length - 1;
54
+ });
55
+ }
56
+
57
+ handleToggle(event: CustomEvent) {
58
+ const toggles = this.querySelectorAll('nile-button-toggle');
59
+
60
+ if (toggles && event.detail.active) {
61
+ toggles.forEach((toggle: any) => {
62
+ if (toggle !== event.target) {
63
+ toggle.active = false;
64
+ }
65
+ });
66
+
67
+ this.dispatchEvent(new CustomEvent('nile-changed', { detail: { value: event.detail.value } }));
68
+ }
69
+ };
70
+
71
+ /**
72
+ * Render method
73
+ * @slot This is a slot test
74
+ */
75
+ public render(): TemplateResult {
76
+ return html`
77
+ <slot> </slot>
78
+ `;
79
+ }
80
+
81
+ /* #endregion */
82
+ }
83
+
84
+ export default NileButtonToggleGroup;
85
+
86
+ declare global {
87
+ interface HTMLElementTagNameMap {
88
+ 'nile-button-toggle-group': NileButtonToggleGroup;
89
+ }
90
+ }
@@ -1 +0,0 @@
1
- export { NileRadioButton } from './nile-radio-button';
@@ -1,2 +0,0 @@
1
- export { NileRadioButton } from './nile-radio-button';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/nile-radio-button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC","sourcesContent":["export { NileRadioButton } from './nile-radio-button';\n"]}
@@ -1,173 +0,0 @@
1
- /**
2
- * Copyright Aquera Inc 2023
3
- *
4
- * This source code is licensed under the BSD-3-Clause license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { css } from 'lit-element';
8
- /**
9
- * RadioButton CSS
10
- */
11
- export const styles = css `
12
- :host {
13
- }
14
-
15
- .button {
16
- display: inline-flex;
17
- align-items: center;
18
- justify-content: center;
19
- width: 100%;
20
- color: var(--color-text-default, #000);
21
- text-align: center;
22
- border-radius: 4px;
23
- font-family: Colfax-regular;
24
- font-size: 14px;
25
- font-style: normal;
26
- font-weight: 400;
27
- line-height: 14px; /* 100% */
28
- letter-spacing: 0.2px;
29
- text-decoration: none;
30
- user-select: none;
31
- white-space: nowrap;
32
- vertical-align: middle;
33
- padding: 12px;
34
- cursor: pointer;
35
- gap: 10px;
36
- }
37
-
38
- .button::-moz-focus-inner {
39
- border: 0;
40
- }
41
-
42
- .button:focus {
43
- outline: none;
44
- }
45
-
46
- .button:focus-visible {
47
- outline: var(--nile-focus-ring);
48
- outline-offset: var(--nile-focus-ring-offset);
49
- }
50
-
51
- .button--disabled {
52
- opacity: 0.5;
53
- cursor: not-allowed;
54
- }
55
-
56
- /* When disabled, prevent mouse events from bubbling up from children */
57
- .button--disabled * {
58
- pointer-events: none;
59
- }
60
-
61
- .button__prefix,
62
- .button__suffix {
63
- flex: 0 0 auto;
64
- display: flex;
65
- align-items: center;
66
- pointer-events: none;
67
- }
68
-
69
- .button__label {
70
- display: inline-block;
71
- }
72
-
73
- .button__label::slotted(nile-icon) {
74
- vertical-align: -2px;
75
- }
76
-
77
- /* Default */
78
- .button--default {
79
- border: 1px solid #c7ced4;
80
- background: #fff;
81
- color: black;
82
- }
83
-
84
- .button--default:hover:not(.button--disabled) {
85
- border: 1px solid #c7ced4;
86
- background: #e5e9eb;
87
- }
88
-
89
- .button--default:active:not(.button--disabled) {
90
- border: 1px solid #c7ced4;
91
- background: #e5e9eb;
92
- }
93
-
94
- .button--checked {
95
- border: 1px solid #c7ced4;
96
- background: #e5e9eb;
97
- }
98
-
99
- .button--has-label.button--medium .button__label {
100
- padding: 0 var(--nile-spacing-medium);
101
- }
102
-
103
- .button--has-prefix.button--medium {
104
- padding-inline-start: var(--nile-spacing-small);
105
- }
106
-
107
- .button--has-prefix.button--medium .button__label {
108
- padding-inline-start: var(--nile-spacing-small);
109
- }
110
-
111
- .button--has-suffix.button--medium,
112
- .button--caret.button--medium {
113
- padding-inline-end: var(--nile-spacing-small);
114
- }
115
-
116
- .button--has-suffix.button--medium .button__label,
117
- .button--caret.button--medium .button__label {
118
- padding-inline-end: var(--nile-spacing-small);
119
- }
120
-
121
- .nile-radio-button--first {
122
- background-color: red;
123
- }
124
-
125
- :host(.nile-radio-button--first:not(.nile-radio-button--last)) .button {
126
- border-start-end-radius: 0;
127
- border-end-end-radius: 0;
128
- }
129
-
130
- :host(.nile-group-button--inner) .button {
131
- border-radius: 0;
132
- }
133
-
134
- :host(.nile-radio-button--last:not(.nile-radio-button--first)) .button {
135
- border-start-start-radius: 0;
136
- border-end-start-radius: 0;
137
- }
138
-
139
- /* All except the first */
140
- :host(.nile-radio-button__button:not(.nile-radio-button__button--first)) {
141
- margin-inline-start: calc(-1 * var(--nile-input-border-width));
142
- }
143
-
144
- :host(.nile-radio-button--inner) .button {
145
- border-radius: 0;
146
- border-left: 0;
147
- border-right: 0;
148
- }
149
-
150
- .button__prefix,
151
- .button__suffix,
152
- .button__label {
153
- display: inline-flex;
154
- position: relative;
155
- align-items: center;
156
- }
157
-
158
- /* We use a hidden input so constraint validation errors work, since they don't appear to show when used with buttons.
159
- We can't actually hide it, though, otherwise the messages will be suppressed by the browser. */
160
- .hidden-input {
161
- all: unset;
162
- position: absolute;
163
- top: 0;
164
- left: 0;
165
- bottom: 0;
166
- right: 0;
167
- outline: dotted 1px red;
168
- opacity: 0;
169
- z-index: -1;
170
- }
171
- `;
172
- export default [styles];
173
- //# sourceMappingURL=nile-radio-button.css.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nile-radio-button.css.js","sourceRoot":"","sources":["../../../src/nile-radio-button/nile-radio-button.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgKxB,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 * RadioButton CSS\n */\nexport const styles = css`\n :host {\n }\n\n .button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n color: var(--color-text-default, #000);\n text-align: center;\n border-radius: 4px;\n font-family: Colfax-regular;\n font-size: 14px;\n font-style: normal;\n font-weight: 400;\n line-height: 14px; /* 100% */\n letter-spacing: 0.2px;\n text-decoration: none;\n user-select: none;\n white-space: nowrap;\n vertical-align: middle;\n padding: 12px;\n cursor: pointer;\n gap: 10px;\n }\n\n .button::-moz-focus-inner {\n border: 0;\n }\n\n .button:focus {\n outline: none;\n }\n\n .button:focus-visible {\n outline: var(--nile-focus-ring);\n outline-offset: var(--nile-focus-ring-offset);\n }\n\n .button--disabled {\n opacity: 0.5;\n cursor: not-allowed;\n }\n\n /* When disabled, prevent mouse events from bubbling up from children */\n .button--disabled * {\n pointer-events: none;\n }\n\n .button__prefix,\n .button__suffix {\n flex: 0 0 auto;\n display: flex;\n align-items: center;\n pointer-events: none;\n }\n\n .button__label {\n display: inline-block;\n }\n\n .button__label::slotted(nile-icon) {\n vertical-align: -2px;\n }\n\n /* Default */\n .button--default {\n border: 1px solid #c7ced4;\n background: #fff;\n color: black;\n }\n\n .button--default:hover:not(.button--disabled) {\n border: 1px solid #c7ced4;\n background: #e5e9eb;\n }\n\n .button--default:active:not(.button--disabled) {\n border: 1px solid #c7ced4;\n background: #e5e9eb;\n }\n\n .button--checked {\n border: 1px solid #c7ced4;\n background: #e5e9eb;\n }\n\n .button--has-label.button--medium .button__label {\n padding: 0 var(--nile-spacing-medium);\n }\n\n .button--has-prefix.button--medium {\n padding-inline-start: var(--nile-spacing-small);\n }\n\n .button--has-prefix.button--medium .button__label {\n padding-inline-start: var(--nile-spacing-small);\n }\n\n .button--has-suffix.button--medium,\n .button--caret.button--medium {\n padding-inline-end: var(--nile-spacing-small);\n }\n\n .button--has-suffix.button--medium .button__label,\n .button--caret.button--medium .button__label {\n padding-inline-end: var(--nile-spacing-small);\n }\n\n .nile-radio-button--first {\n background-color: red;\n }\n\n :host(.nile-radio-button--first:not(.nile-radio-button--last)) .button {\n border-start-end-radius: 0;\n border-end-end-radius: 0;\n }\n\n :host(.nile-group-button--inner) .button {\n border-radius: 0;\n }\n\n :host(.nile-radio-button--last:not(.nile-radio-button--first)) .button {\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n }\n\n /* All except the first */\n :host(.nile-radio-button__button:not(.nile-radio-button__button--first)) {\n margin-inline-start: calc(-1 * var(--nile-input-border-width));\n }\n\n :host(.nile-radio-button--inner) .button {\n border-radius: 0;\n border-left: 0;\n border-right: 0;\n }\n\n .button__prefix,\n .button__suffix,\n .button__label {\n display: inline-flex;\n position: relative;\n align-items: center;\n }\n\n /* We use a hidden input so constraint validation errors work, since they don't appear to show when used with buttons.\n We can't actually hide it, though, otherwise the messages will be suppressed by the browser. */\n .hidden-input {\n all: unset;\n position: absolute;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n outline: dotted 1px red;\n opacity: 0;\n z-index: -1;\n }\n`;\n\nexport default [styles];\n"]}
@@ -1,57 +0,0 @@
1
- /**
2
- * Copyright Aquera Inc 2023
3
- *
4
- * This source code is licensed under the BSD-3-Clause license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { CSSResultArray, TemplateResult } from 'lit-element';
8
- import NileElement from '../internal/nile-element';
9
- /**
10
- * Nile icon component.
11
- *
12
- * @tag nile-radio-button
13
- *
14
- */
15
- export declare class NileRadioButton extends NileElement {
16
- /**
17
- * The styles for RadioButton
18
- * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
19
- */
20
- static get styles(): CSSResultArray;
21
- private readonly hasSlotController;
22
- input: HTMLInputElement;
23
- hiddenInput: HTMLInputElement;
24
- protected hasFocus: boolean;
25
- /**
26
- * @internal The radio button's checked state. This is exposed as an "internal" attribute so we can reflect it, making
27
- * it easier to style in button groups.
28
- */
29
- checked: boolean;
30
- /** The radio's value. When selected, the radio group will receive this value. */
31
- value: string;
32
- /** Disables the radio button. */
33
- disabled: boolean;
34
- /**
35
- * The radio button's size. When used inside a radio group, the size will be determined by the radio group's size so
36
- * this attribute can typically be omitted.
37
- */
38
- size: 'small' | 'medium' | 'large';
39
- /** Draws a pill-style radio button with rounded edges. */
40
- pill: boolean;
41
- connectedCallback(): void;
42
- private handleBlur;
43
- private handleClick;
44
- private handleFocus;
45
- handleDisabledChange(): void;
46
- /** Sets focus on the radio button. */
47
- focus(options?: FocusOptions): void;
48
- /** Removes focus from the radio button. */
49
- blur(): void;
50
- render(): TemplateResult<1>;
51
- }
52
- export default NileRadioButton;
53
- declare global {
54
- interface HTMLElementTagNameMap {
55
- 'nile-radio-button': NileRadioButton;
56
- }
57
- }
@@ -1,145 +0,0 @@
1
- /**
2
- * Copyright Aquera Inc 2023
3
- *
4
- * This source code is licensed under the BSD-3-Clause license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import { __decorate } from "tslib";
8
- import { html, property, } from 'lit-element';
9
- import { customElement, query, state } from 'lit/decorators.js';
10
- import { styles } from './nile-radio-button.css';
11
- import NileElement from '../internal/nile-element';
12
- import { HasSlotController } from '../slot';
13
- import { classMap } from 'lit/directives/class-map.js';
14
- import { ifDefined } from 'lit/directives/if-defined.js';
15
- import { watch } from '../internal/watch';
16
- /**
17
- * Nile icon component.
18
- *
19
- * @tag nile-radio-button
20
- *
21
- */
22
- let NileRadioButton = class NileRadioButton extends NileElement {
23
- constructor() {
24
- super(...arguments);
25
- this.hasSlotController = new HasSlotController(this, '[default]', 'prefix', 'suffix');
26
- this.hasFocus = false;
27
- /**
28
- * @internal The radio button's checked state. This is exposed as an "internal" attribute so we can reflect it, making
29
- * it easier to style in button groups.
30
- */
31
- this.checked = false;
32
- /** Disables the radio button. */
33
- this.disabled = false;
34
- /**
35
- * The radio button's size. When used inside a radio group, the size will be determined by the radio group's size so
36
- * this attribute can typically be omitted.
37
- */
38
- this.size = 'medium';
39
- /** Draws a pill-style radio button with rounded edges. */
40
- this.pill = false;
41
- }
42
- /**
43
- * The styles for RadioButton
44
- * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
45
- */
46
- static get styles() {
47
- return [styles];
48
- }
49
- connectedCallback() {
50
- super.connectedCallback();
51
- this.setAttribute('role', 'presentation');
52
- }
53
- handleBlur() {
54
- this.hasFocus = false;
55
- this.emit('nile-blur');
56
- }
57
- handleClick(e) {
58
- if (this.disabled) {
59
- e.preventDefault();
60
- e.stopPropagation();
61
- return;
62
- }
63
- this.checked = true;
64
- }
65
- handleFocus() {
66
- this.hasFocus = true;
67
- this.emit('nile-focus');
68
- }
69
- handleDisabledChange() {
70
- this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');
71
- }
72
- /** Sets focus on the radio button. */
73
- focus(options) {
74
- this.input.focus(options);
75
- }
76
- /** Removes focus from the radio button. */
77
- blur() {
78
- this.input.blur();
79
- }
80
- render() {
81
- return html `
82
- <div part="base" role="presentation">
83
- <button
84
- part="${`button${this.checked ? ' button--checked' : ''}`}"
85
- role="radio"
86
- aria-checked="${this.checked}"
87
- class=${classMap({
88
- button: true,
89
- 'button--default': true,
90
- 'button--checked': this.checked,
91
- 'button--disabled': this.disabled,
92
- 'button--focused': this.hasFocus,
93
- 'button--has-label': this.hasSlotController.test('[default]'),
94
- 'button--has-prefix': this.hasSlotController.test('prefix'),
95
- 'button--has-suffix': this.hasSlotController.test('suffix'),
96
- })}
97
- aria-disabled=${this.disabled}
98
- type="button"
99
- value=${ifDefined(this.value)}
100
- tabindex="${this.checked ? '0' : '-1'}"
101
- @blur=${this.handleBlur}
102
- @focus=${this.handleFocus}
103
- @click=${this.handleClick}
104
- >
105
- <slot name="prefix" part="prefix" class="button__prefix"></slot>
106
- <slot part="label" class="button__label"></slot>
107
- <slot name="suffix" part="suffix" class="button__suffix"></slot>
108
- </button>
109
- </div>
110
- `;
111
- }
112
- };
113
- __decorate([
114
- query('.button')
115
- ], NileRadioButton.prototype, "input", void 0);
116
- __decorate([
117
- query('.hidden-input')
118
- ], NileRadioButton.prototype, "hiddenInput", void 0);
119
- __decorate([
120
- state()
121
- ], NileRadioButton.prototype, "hasFocus", void 0);
122
- __decorate([
123
- property({ type: Boolean, reflect: true })
124
- ], NileRadioButton.prototype, "checked", void 0);
125
- __decorate([
126
- property()
127
- ], NileRadioButton.prototype, "value", void 0);
128
- __decorate([
129
- property({ type: Boolean, reflect: true })
130
- ], NileRadioButton.prototype, "disabled", void 0);
131
- __decorate([
132
- property({ reflect: true })
133
- ], NileRadioButton.prototype, "size", void 0);
134
- __decorate([
135
- property({ type: Boolean, reflect: true })
136
- ], NileRadioButton.prototype, "pill", void 0);
137
- __decorate([
138
- watch('disabled', { waitUntilFirstUpdate: true })
139
- ], NileRadioButton.prototype, "handleDisabledChange", null);
140
- NileRadioButton = __decorate([
141
- customElement('nile-radio-button')
142
- ], NileRadioButton);
143
- export { NileRadioButton };
144
- export default NileRadioButton;
145
- //# sourceMappingURL=nile-radio-button.js.map