@aquera/nile-elements 0.0.4-8 → 0.0.4-9

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 (81) 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-link/nile-link.css.js +2 -0
  5. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-link/nile-link.css.js.map +1 -1
  6. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/index.d.ts +1 -0
  7. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/index.js +2 -0
  8. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/index.js.map +1 -0
  9. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/nile-radio-button.css.d.ts +12 -0
  10. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/nile-radio-button.css.js +173 -0
  11. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/nile-radio-button.css.js.map +1 -0
  12. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/nile-radio-button.d.ts +57 -0
  13. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/nile-radio-button.js +145 -0
  14. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button/nile-radio-button.js.map +1 -0
  15. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/index.d.ts +1 -0
  16. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/index.js +2 -0
  17. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/index.js.map +1 -0
  18. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.css.d.ts +12 -0
  19. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.css.js +70 -0
  20. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.css.js.map +1 -0
  21. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.d.ts +66 -0
  22. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.js +308 -0
  23. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/src/nile-radio-button-group/nile-radio-button-group.js.map +1 -0
  24. package/.rollup.cache/opt/atlassian/pipelines/agent/build/packages/nile-elements/dist/tsconfig.tsbuildinfo +1 -1
  25. package/dist/index.cjs.js +1 -1
  26. package/dist/index.esm.js +1 -1
  27. package/dist/index.iife.js +370 -76
  28. package/dist/nile-link/nile-link.css.cjs.js +1 -1
  29. package/dist/nile-link/nile-link.css.cjs.js.map +1 -1
  30. package/dist/nile-link/nile-link.css.esm.js +2 -0
  31. package/dist/nile-radio-button/index.cjs.js +2 -0
  32. package/dist/nile-radio-button/index.cjs.js.map +1 -0
  33. package/dist/nile-radio-button/index.esm.js +1 -0
  34. package/dist/nile-radio-button/nile-radio-button.cjs.js +2 -0
  35. package/dist/nile-radio-button/nile-radio-button.cjs.js.map +1 -0
  36. package/dist/nile-radio-button/nile-radio-button.css.cjs.js +2 -0
  37. package/dist/nile-radio-button/nile-radio-button.css.cjs.js.map +1 -0
  38. package/dist/nile-radio-button/nile-radio-button.css.esm.js +161 -0
  39. package/dist/nile-radio-button/nile-radio-button.esm.js +21 -0
  40. package/dist/nile-radio-button-group/index.cjs.js +2 -0
  41. package/dist/nile-radio-button-group/index.cjs.js.map +1 -0
  42. package/dist/nile-radio-button-group/index.esm.js +1 -0
  43. package/dist/nile-radio-button-group/nile-radio-button-group.cjs.js +2 -0
  44. package/dist/nile-radio-button-group/nile-radio-button-group.cjs.js.map +1 -0
  45. package/dist/nile-radio-button-group/nile-radio-button-group.css.cjs.js +2 -0
  46. package/dist/nile-radio-button-group/nile-radio-button-group.css.cjs.js.map +1 -0
  47. package/dist/nile-radio-button-group/nile-radio-button-group.css.esm.js +58 -0
  48. package/dist/nile-radio-button-group/nile-radio-button-group.esm.js +56 -0
  49. package/dist/src/index.d.ts +2 -0
  50. package/dist/src/index.js +2 -0
  51. package/dist/src/index.js.map +1 -1
  52. package/dist/src/nile-link/nile-link.css.js +2 -0
  53. package/dist/src/nile-link/nile-link.css.js.map +1 -1
  54. package/dist/src/nile-radio-button/index.d.ts +1 -0
  55. package/dist/src/nile-radio-button/index.js +2 -0
  56. package/dist/src/nile-radio-button/index.js.map +1 -0
  57. package/dist/src/nile-radio-button/nile-radio-button.css.d.ts +12 -0
  58. package/dist/src/nile-radio-button/nile-radio-button.css.js +173 -0
  59. package/dist/src/nile-radio-button/nile-radio-button.css.js.map +1 -0
  60. package/dist/src/nile-radio-button/nile-radio-button.d.ts +57 -0
  61. package/dist/src/nile-radio-button/nile-radio-button.js +145 -0
  62. package/dist/src/nile-radio-button/nile-radio-button.js.map +1 -0
  63. package/dist/src/nile-radio-button-group/index.d.ts +1 -0
  64. package/dist/src/nile-radio-button-group/index.js +2 -0
  65. package/dist/src/nile-radio-button-group/index.js.map +1 -0
  66. package/dist/src/nile-radio-button-group/nile-radio-button-group.css.d.ts +12 -0
  67. package/dist/src/nile-radio-button-group/nile-radio-button-group.css.js +70 -0
  68. package/dist/src/nile-radio-button-group/nile-radio-button-group.css.js.map +1 -0
  69. package/dist/src/nile-radio-button-group/nile-radio-button-group.d.ts +66 -0
  70. package/dist/src/nile-radio-button-group/nile-radio-button-group.js +308 -0
  71. package/dist/src/nile-radio-button-group/nile-radio-button-group.js.map +1 -0
  72. package/dist/tsconfig.tsbuildinfo +1 -1
  73. package/package.json +1 -1
  74. package/src/index.ts +2 -0
  75. package/src/nile-link/nile-link.css.ts +2 -0
  76. package/src/nile-radio-button/index.ts +1 -0
  77. package/src/nile-radio-button/nile-radio-button.css.ts +175 -0
  78. package/src/nile-radio-button/nile-radio-button.ts +151 -0
  79. package/src/nile-radio-button-group/index.ts +1 -0
  80. package/src/nile-radio-button-group/nile-radio-button-group.css.ts +72 -0
  81. package/src/nile-radio-button-group/nile-radio-button-group.ts +337 -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.4-8",
6
+ "version": "0.0.4-9",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
package/src/index.ts CHANGED
@@ -30,3 +30,5 @@ export { NileFormErrorMessage } from './nile-form-error-message';
30
30
  export { NileFormHelpText } from './nile-form-help-text';
31
31
  export { NileCalendar } from './nile-calendar';
32
32
  export { NileLink} from './nile-link';
33
+ export { NileRadioButton } from './nile-radio-button';
34
+ export { NileRadioButtonGroup } from './nile-radio-button-group';
@@ -25,6 +25,7 @@ export const styles = css`
25
25
  gap: 8px;
26
26
  height: 38px;
27
27
  box-sizing: border-box;
28
+ cursor: pointer
28
29
  }
29
30
 
30
31
  .link__label {
@@ -42,6 +43,7 @@ export const styles = css`
42
43
  color: rgba(0, 94, 166, 0.5);
43
44
  cursor: not-allowed;
44
45
  opacity: 0.6;
46
+ pointer-events:none;
45
47
  }
46
48
 
47
49
  .link:not(.link--disabled):not(.link__button):hover {
@@ -0,0 +1 @@
1
+ export { NileRadioButton } from './nile-radio-button';
@@ -0,0 +1,175 @@
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
+ * RadioButton CSS
12
+ */
13
+ export const styles = css`
14
+ :host {
15
+ }
16
+
17
+ .button {
18
+ display: inline-flex;
19
+ align-items: center;
20
+ justify-content: center;
21
+ width: 100%;
22
+ color: var(--color-text-default, #000);
23
+ text-align: center;
24
+ border-radius: 4px;
25
+ font-family: Colfax-regular;
26
+ font-size: 14px;
27
+ font-style: normal;
28
+ font-weight: 400;
29
+ line-height: 14px; /* 100% */
30
+ letter-spacing: 0.2px;
31
+ text-decoration: none;
32
+ user-select: none;
33
+ white-space: nowrap;
34
+ vertical-align: middle;
35
+ padding: 12px;
36
+ cursor: pointer;
37
+ gap: 10px;
38
+ }
39
+
40
+ .button::-moz-focus-inner {
41
+ border: 0;
42
+ }
43
+
44
+ .button:focus {
45
+ outline: none;
46
+ }
47
+
48
+ .button:focus-visible {
49
+ outline: var(--nile-focus-ring);
50
+ outline-offset: var(--nile-focus-ring-offset);
51
+ }
52
+
53
+ .button--disabled {
54
+ opacity: 0.5;
55
+ cursor: not-allowed;
56
+ }
57
+
58
+ /* When disabled, prevent mouse events from bubbling up from children */
59
+ .button--disabled * {
60
+ pointer-events: none;
61
+ }
62
+
63
+ .button__prefix,
64
+ .button__suffix {
65
+ flex: 0 0 auto;
66
+ display: flex;
67
+ align-items: center;
68
+ pointer-events: none;
69
+ }
70
+
71
+ .button__label {
72
+ display: inline-block;
73
+ }
74
+
75
+ .button__label::slotted(nile-icon) {
76
+ vertical-align: -2px;
77
+ }
78
+
79
+ /* Default */
80
+ .button--default {
81
+ border: 1px solid #c7ced4;
82
+ background: #fff;
83
+ color: black;
84
+ }
85
+
86
+ .button--default:hover:not(.button--disabled) {
87
+ border: 1px solid #c7ced4;
88
+ background: #e5e9eb;
89
+ }
90
+
91
+ .button--default:active:not(.button--disabled) {
92
+ border: 1px solid #c7ced4;
93
+ background: #e5e9eb;
94
+ }
95
+
96
+ .button--checked {
97
+ border: 1px solid #c7ced4;
98
+ background: #e5e9eb;
99
+ }
100
+
101
+ .button--has-label.button--medium .button__label {
102
+ padding: 0 var(--nile-spacing-medium);
103
+ }
104
+
105
+ .button--has-prefix.button--medium {
106
+ padding-inline-start: var(--nile-spacing-small);
107
+ }
108
+
109
+ .button--has-prefix.button--medium .button__label {
110
+ padding-inline-start: var(--nile-spacing-small);
111
+ }
112
+
113
+ .button--has-suffix.button--medium,
114
+ .button--caret.button--medium {
115
+ padding-inline-end: var(--nile-spacing-small);
116
+ }
117
+
118
+ .button--has-suffix.button--medium .button__label,
119
+ .button--caret.button--medium .button__label {
120
+ padding-inline-end: var(--nile-spacing-small);
121
+ }
122
+
123
+ .nile-radio-button--first {
124
+ background-color: red;
125
+ }
126
+
127
+ :host(.nile-radio-button--first:not(.nile-radio-button--last)) .button {
128
+ border-start-end-radius: 0;
129
+ border-end-end-radius: 0;
130
+ }
131
+
132
+ :host(.nile-group-button--inner) .button {
133
+ border-radius: 0;
134
+ }
135
+
136
+ :host(.nile-radio-button--last:not(.nile-radio-button--first)) .button {
137
+ border-start-start-radius: 0;
138
+ border-end-start-radius: 0;
139
+ }
140
+
141
+ /* All except the first */
142
+ :host(.nile-radio-button__button:not(.nile-radio-button__button--first)) {
143
+ margin-inline-start: calc(-1 * var(--nile-input-border-width));
144
+ }
145
+
146
+ :host(.nile-radio-button--inner) .button {
147
+ border-radius: 0;
148
+ border-left: 0;
149
+ border-right: 0;
150
+ }
151
+
152
+ .button__prefix,
153
+ .button__suffix,
154
+ .button__label {
155
+ display: inline-flex;
156
+ position: relative;
157
+ align-items: center;
158
+ }
159
+
160
+ /* We use a hidden input so constraint validation errors work, since they don't appear to show when used with buttons.
161
+ We can't actually hide it, though, otherwise the messages will be suppressed by the browser. */
162
+ .hidden-input {
163
+ all: unset;
164
+ position: absolute;
165
+ top: 0;
166
+ left: 0;
167
+ bottom: 0;
168
+ right: 0;
169
+ outline: dotted 1px red;
170
+ opacity: 0;
171
+ z-index: -1;
172
+ }
173
+ `;
174
+
175
+ export default [styles];
@@ -0,0 +1,151 @@
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 {
9
+ LitElement,
10
+ html,
11
+ property,
12
+ CSSResultArray,
13
+ TemplateResult,
14
+ } from 'lit-element';
15
+ import { customElement, query, state } from 'lit/decorators.js';
16
+ import { styles } from './nile-radio-button.css';
17
+ import NileElement from '../internal/nile-element';
18
+ import { HasSlotController } from '../slot';
19
+ import { classMap } from 'lit/directives/class-map.js';
20
+ import { ifDefined } from 'lit/directives/if-defined.js';
21
+ import { watch } from '../internal/watch';
22
+
23
+ /**
24
+ * Nile icon component.
25
+ *
26
+ * @tag nile-radio-button
27
+ *
28
+ */
29
+ @customElement('nile-radio-button')
30
+ export class NileRadioButton extends NileElement {
31
+ /**
32
+ * The styles for RadioButton
33
+ * @remarks If you are extending this class you can extend the base styles with super. Eg `return [super(), myCustomStyles]`
34
+ */
35
+ public static get styles(): CSSResultArray {
36
+ return [styles];
37
+ }
38
+ private readonly hasSlotController = new HasSlotController(
39
+ this,
40
+ '[default]',
41
+ 'prefix',
42
+ 'suffix'
43
+ );
44
+
45
+ @query('.button') input: HTMLInputElement;
46
+ @query('.hidden-input') hiddenInput: HTMLInputElement;
47
+
48
+ @state() protected hasFocus = false;
49
+
50
+ /**
51
+ * @internal The radio button's checked state. This is exposed as an "internal" attribute so we can reflect it, making
52
+ * it easier to style in button groups.
53
+ */
54
+ @property({ type: Boolean, reflect: true }) checked = false;
55
+
56
+ /** The radio's value. When selected, the radio group will receive this value. */
57
+ @property() value: string;
58
+
59
+ /** Disables the radio button. */
60
+ @property({ type: Boolean, reflect: true }) disabled = false;
61
+
62
+ /**
63
+ * The radio button's size. When used inside a radio group, the size will be determined by the radio group's size so
64
+ * this attribute can typically be omitted.
65
+ */
66
+ @property({ reflect: true }) size: 'small' | 'medium' | 'large' = 'medium';
67
+
68
+ /** Draws a pill-style radio button with rounded edges. */
69
+ @property({ type: Boolean, reflect: true }) pill = false;
70
+
71
+ connectedCallback() {
72
+ super.connectedCallback();
73
+ this.setAttribute('role', 'presentation');
74
+ }
75
+
76
+ private handleBlur() {
77
+ this.hasFocus = false;
78
+ this.emit('nile-blur');
79
+ }
80
+
81
+ private handleClick(e: MouseEvent) {
82
+ if (this.disabled) {
83
+ e.preventDefault();
84
+ e.stopPropagation();
85
+ return;
86
+ }
87
+
88
+ this.checked = true;
89
+ }
90
+
91
+ private handleFocus() {
92
+ this.hasFocus = true;
93
+ this.emit('nile-focus');
94
+ }
95
+
96
+ @watch('disabled', { waitUntilFirstUpdate: true })
97
+ handleDisabledChange() {
98
+ this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');
99
+ }
100
+
101
+ /** Sets focus on the radio button. */
102
+ focus(options?: FocusOptions) {
103
+ this.input.focus(options);
104
+ }
105
+
106
+ /** Removes focus from the radio button. */
107
+ blur() {
108
+ this.input.blur();
109
+ }
110
+
111
+ render() {
112
+ return html`
113
+ <div part="base" role="presentation">
114
+ <button
115
+ part="${`button${this.checked ? ' button--checked' : ''}`}"
116
+ role="radio"
117
+ aria-checked="${this.checked}"
118
+ class=${classMap({
119
+ button: true,
120
+ 'button--default': true,
121
+ 'button--checked': this.checked,
122
+ 'button--disabled': this.disabled,
123
+ 'button--focused': this.hasFocus,
124
+ 'button--has-label': this.hasSlotController.test('[default]'),
125
+ 'button--has-prefix': this.hasSlotController.test('prefix'),
126
+ 'button--has-suffix': this.hasSlotController.test('suffix'),
127
+ })}
128
+ aria-disabled=${this.disabled}
129
+ type="button"
130
+ value=${ifDefined(this.value)}
131
+ tabindex="${this.checked ? '0' : '-1'}"
132
+ @blur=${this.handleBlur}
133
+ @focus=${this.handleFocus}
134
+ @click=${this.handleClick}
135
+ >
136
+ <slot name="prefix" part="prefix" class="button__prefix"></slot>
137
+ <slot part="label" class="button__label"></slot>
138
+ <slot name="suffix" part="suffix" class="button__suffix"></slot>
139
+ </button>
140
+ </div>
141
+ `;
142
+ }
143
+ }
144
+
145
+ export default NileRadioButton;
146
+
147
+ declare global {
148
+ interface HTMLElementTagNameMap {
149
+ 'nile-radio-button': NileRadioButton;
150
+ }
151
+ }
@@ -0,0 +1 @@
1
+ export { NileRadioButtonGroup } from './nile-radio-button-group';
@@ -0,0 +1,72 @@
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
+ * RadioButtonGroup CSS
12
+ */
13
+ export const styles = css`
14
+ :host {
15
+ display: block;
16
+ }
17
+
18
+ .form-control {
19
+ border: none;
20
+ padding: 0;
21
+ margin: 0;
22
+ }
23
+
24
+ .form-control__label {
25
+ padding: 0;
26
+ font-size: 14px;
27
+ color: var(--nile-colors-dark-900);
28
+ font-family: Colfax-regular;
29
+ font-size: 14px;
30
+ font-style: normal;
31
+ font-weight: 400;
32
+ line-height: 14px;
33
+ letter-spacing: 0.2px;
34
+ }
35
+
36
+ .radio-group--required .radio-group__label::after {
37
+ content: '*';
38
+ margin-inline-start: -2px;
39
+ }
40
+
41
+ .visually-hidden {
42
+ position: absolute;
43
+ width: 1px;
44
+ height: 1px;
45
+ padding: 0;
46
+ margin: -1px;
47
+ overflow: hidden;
48
+ clip: rect(0, 0, 0, 0);
49
+ white-space: nowrap;
50
+ border: 0;
51
+ }
52
+
53
+ .form-control-input {
54
+ display: flex;
55
+ flex-wrap: nowrap;
56
+ }
57
+
58
+ .form-control--has-label .form-control__label {
59
+ display: inline-block;
60
+ color: inherit;
61
+ margin-bottom: 12px;
62
+ color: var(--nile-colors-dark-900);
63
+ font-family: Colfax-regular;
64
+ font-size: 14px;
65
+ font-style: normal;
66
+ font-weight: 400;
67
+ line-height: 14px;
68
+ letter-spacing: 0.2px;
69
+ }
70
+ `;
71
+
72
+ export default [styles];