@nuralyui/radio-group 0.0.6 → 0.0.7

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.
@@ -1,146 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2023 Nuraly, Laabidi Aymen
4
- * SPDX-License-Identifier: MIT
5
- */
6
- import { LitElement } from 'lit';
7
- import '../icon/icon.component.js';
8
- import '../button/button.component.js';
9
- import { RadioButtonType, RadioButtonOption } from './radio.type.js';
10
- declare const NrRadioGroupElement_base: (new (...args: any[]) => import("../../shared/dependency-mixin.js").DependencyAware) & (new (...args: any[]) => import("../../shared/theme-mixin.js").ThemeAware) & (new (...args: any[]) => import("../../shared/event-handler-mixin.js").EventHandlerCapable) & typeof LitElement;
11
- /**
12
- * A radio button group component using Reactive Controllers architecture.
13
- *
14
- * Supports multiple display modes:
15
- * - Default: Traditional radio buttons with labels
16
- * - Button: Button-style radio group
17
- * - Slot: Custom HTML content with radio selection
18
- *
19
- * Features:
20
- * - Theme-aware styling with light/dark mode support
21
- * - Keyboard navigation (arrow keys, space, enter)
22
- * - Accessibility compliance
23
- * - Form validation and integration
24
- * - Ripple effects on interaction
25
- * - Modular controller-based architecture
26
- *
27
- * @example
28
- * ```html
29
- * <nr-radio-group
30
- * .options='[
31
- * { value: "option1", label: "Option 1" },
32
- * { value: "option2", label: "Option 2" }
33
- * ]'
34
- * default-value="option1"
35
- * direction="horizontal">
36
- * </nr-radio-group>
37
- * ```
38
- *
39
- * @fires change - Dispatched when the selected option changes
40
- */
41
- export declare class NrRadioGroupElement extends NrRadioGroupElement_base {
42
- static styles: import("lit").CSSResult;
43
- requiredComponents: string[];
44
- options: RadioButtonOption[];
45
- defaultValue: string;
46
- value: string;
47
- name: string;
48
- direction: 'horizontal' | 'vertical';
49
- type: RadioButtonType;
50
- required: boolean;
51
- disabled: boolean;
52
- private groupController;
53
- private keyboardController;
54
- private focusController;
55
- private validationController;
56
- private rippleController;
57
- /**
58
- * Get the currently selected option - DELEGATES to controller
59
- */
60
- get selectedOption(): RadioButtonOption | undefined;
61
- /**
62
- * Check if an option is selected - DELEGATES to controller
63
- */
64
- isOptionSelected(option: RadioButtonOption): boolean;
65
- /**
66
- * Check if an option is disabled - DELEGATES to controller
67
- */
68
- isOptionDisabled(option: RadioButtonOption): boolean;
69
- /**
70
- * Handle option selection change - DELEGATES to controller
71
- */
72
- handleSelectionChange(option: RadioButtonOption): void;
73
- /**
74
- * Set focused option by index - DELEGATES to controller
75
- */
76
- setFocusedOption(index: number): void;
77
- /**
78
- * Handle keyboard events - DELEGATES to controller
79
- */
80
- handleKeyDown(_event: KeyboardEvent): void;
81
- /**
82
- * Add ripple effect on radio input click - DELEGATES to controller
83
- */
84
- addRippleEffect(event: Event): void;
85
- /**
86
- * Validate the radio group - DELEGATES to controller
87
- */
88
- validate(): boolean;
89
- /**
90
- * Get validation message - DELEGATES to controller
91
- */
92
- get validationMessage(): string;
93
- /**
94
- * Check if the radio group is valid - DELEGATES to controller
95
- */
96
- get isValid(): boolean;
97
- /**
98
- * Get form data for form submission - DELEGATES to controller
99
- */
100
- getFormData(): {
101
- [key: string]: string;
102
- };
103
- /**
104
- * Reset the radio group - DELEGATES to controller
105
- */
106
- reset(): void;
107
- /**
108
- * FormData integration for native form submission - DELEGATES to controller
109
- */
110
- get formData(): FormData | null;
111
- /**
112
- * Check form validity (required for HTML5 form validation)
113
- */
114
- checkValidity(): boolean;
115
- /**
116
- * Report form validity (required for HTML5 form validation) - DELEGATES to controller
117
- */
118
- reportValidity(): boolean;
119
- /**
120
- * Programmatically focus the radio group - DELEGATES to controller
121
- */
122
- focus(): void;
123
- /**
124
- * Programmatically blur the radio group - DELEGATES to controller
125
- */
126
- blur(): void;
127
- /**
128
- * Render default radio button style
129
- */
130
- private renderOptionDefault;
131
- /**
132
- * Render button style radio group
133
- */
134
- private renderOptionsWithButtons;
135
- /**
136
- * Render slot-based radio group (for custom HTML content)
137
- */
138
- private renderOptionsWithSlots;
139
- /**
140
- * Render button style with slots
141
- */
142
- private renderButtonsWithSlots;
143
- protected render(): import("lit").TemplateResult<1>;
144
- }
145
- export {};
146
- //# sourceMappingURL=radio.component.d.ts.map
@@ -1,394 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2023 Nuraly, Laabidi Aymen
4
- * SPDX-License-Identifier: MIT
5
- */
6
- var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
7
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
8
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
9
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
10
- return c > 3 && r && Object.defineProperty(target, key, r), r;
11
- };
12
- import { LitElement, html, nothing } from 'lit';
13
- import { customElement, property } from 'lit/decorators.js';
14
- import { choose } from 'lit/directives/choose.js';
15
- import { classMap } from 'lit/directives/class-map.js';
16
- // Import dependencies
17
- import '../icon/icon.component.js';
18
- import '../button/button.component.js';
19
- import { NuralyUIBaseMixin } from '../../shared/base-mixin.js';
20
- import { RadioGroupController, RadioKeyboardController, RadioFocusController, RadioValidationController, RadioRippleController } from './controllers/index.js';
21
- import { styles } from './radio.style.js';
22
- import { RadioButtonType } from './radio.type.js';
23
- /**
24
- * A radio button group component using Reactive Controllers architecture.
25
- *
26
- * Supports multiple display modes:
27
- * - Default: Traditional radio buttons with labels
28
- * - Button: Button-style radio group
29
- * - Slot: Custom HTML content with radio selection
30
- *
31
- * Features:
32
- * - Theme-aware styling with light/dark mode support
33
- * - Keyboard navigation (arrow keys, space, enter)
34
- * - Accessibility compliance
35
- * - Form validation and integration
36
- * - Ripple effects on interaction
37
- * - Modular controller-based architecture
38
- *
39
- * @example
40
- * ```html
41
- * <nr-radio-group
42
- * .options='[
43
- * { value: "option1", label: "Option 1" },
44
- * { value: "option2", label: "Option 2" }
45
- * ]'
46
- * default-value="option1"
47
- * direction="horizontal">
48
- * </nr-radio-group>
49
- * ```
50
- *
51
- * @fires change - Dispatched when the selected option changes
52
- */
53
- let NrRadioGroupElement = class NrRadioGroupElement extends NuralyUIBaseMixin(LitElement) {
54
- constructor() {
55
- super(...arguments);
56
- this.requiredComponents = ['nr-icon'];
57
- // Properties
58
- this.options = [];
59
- this.defaultValue = '';
60
- this.value = '';
61
- this.name = '';
62
- this.direction = 'vertical';
63
- this.type = RadioButtonType.Default;
64
- this.required = false;
65
- this.disabled = false;
66
- // Reactive Controllers - PROPERLY implemented now
67
- this.groupController = new RadioGroupController(this);
68
- // @ts-ignore - Controller handles events through listeners, doesn't need direct reference
69
- this.keyboardController = new RadioKeyboardController(this, this.groupController);
70
- // Additional controllers for full functionality
71
- this.focusController = new RadioFocusController(this);
72
- this.validationController = new RadioValidationController(this);
73
- this.rippleController = new RadioRippleController(this);
74
- }
75
- /**
76
- * Get the currently selected option - DELEGATES to controller
77
- */
78
- get selectedOption() {
79
- return this.groupController.getSelectedOption();
80
- }
81
- /**
82
- * Check if an option is selected - DELEGATES to controller
83
- */
84
- isOptionSelected(option) {
85
- return this.groupController.isOptionSelected(option);
86
- }
87
- /**
88
- * Check if an option is disabled - DELEGATES to controller
89
- */
90
- isOptionDisabled(option) {
91
- return this.groupController.isOptionDisabled(option);
92
- }
93
- /**
94
- * Handle option selection change - DELEGATES to controller
95
- */
96
- handleSelectionChange(option) {
97
- this.groupController.selectOption(option);
98
- }
99
- /**
100
- * Set focused option by index - DELEGATES to controller
101
- */
102
- setFocusedOption(index) {
103
- this.focusController.setFocusedOption(index);
104
- }
105
- /**
106
- * Handle keyboard events - DELEGATES to controller
107
- */
108
- handleKeyDown(_event) {
109
- // Controller handles keyboard navigation automatically via event listeners
110
- // This method exists for template compatibility but delegates to controller
111
- }
112
- /**
113
- * Add ripple effect on radio input click - DELEGATES to controller
114
- */
115
- addRippleEffect(event) {
116
- this.rippleController.addRippleEffect(event);
117
- }
118
- /**
119
- * Validate the radio group - DELEGATES to controller
120
- */
121
- validate() {
122
- return this.validationController.validate();
123
- }
124
- /**
125
- * Get validation message - DELEGATES to controller
126
- */
127
- get validationMessage() {
128
- return this.validationController.validationMessage;
129
- }
130
- /**
131
- * Check if the radio group is valid - DELEGATES to controller
132
- */
133
- get isValid() {
134
- return this.validationController.isValid;
135
- }
136
- /**
137
- * Get form data for form submission - DELEGATES to controller
138
- */
139
- getFormData() {
140
- return this.validationController.getFormData();
141
- }
142
- /**
143
- * Reset the radio group - DELEGATES to controller
144
- */
145
- reset() {
146
- this.validationController.reset();
147
- }
148
- /**
149
- * FormData integration for native form submission - DELEGATES to controller
150
- */
151
- get formData() {
152
- return this.validationController.getFormDataObject();
153
- }
154
- /**
155
- * Check form validity (required for HTML5 form validation)
156
- */
157
- checkValidity() {
158
- return this.validate();
159
- }
160
- /**
161
- * Report form validity (required for HTML5 form validation) - DELEGATES to controller
162
- */
163
- reportValidity() {
164
- return this.validationController.reportValidity();
165
- }
166
- /**
167
- * Programmatically focus the radio group - DELEGATES to controller
168
- */
169
- focus() {
170
- this.focusController.focus();
171
- }
172
- /**
173
- * Programmatically blur the radio group - DELEGATES to controller
174
- */
175
- blur() {
176
- this.focusController.blur();
177
- }
178
- /**
179
- * Render default radio button style
180
- */
181
- renderOptionDefault() {
182
- return html `
183
- <div
184
- role="radiogroup"
185
- aria-labelledby="radio-group-label"
186
- class="radio-group"
187
- >
188
- ${this.options.map((option, index) => html `
189
- <div
190
- class="${classMap({
191
- 'radio-container': true,
192
- error: option.state === 'error',
193
- warning: option.state === 'warning',
194
- [option.className || '']: Boolean(option.className)
195
- })}"
196
- data-theme="${this.currentTheme}"
197
- style="${option.style || ''}"
198
- title="${option.title || ''}"
199
- >
200
- <label class="radio" id="${option.id || option.value}-label">
201
- <div class="input-container">
202
- <input
203
- class="radio-input"
204
- type="radio"
205
- role="radio"
206
- name="radioGroup"
207
- .value="${option.value}"
208
- aria-labelledby="${option.value}-label"
209
- aria-describedby="${option.state && option.message ? `${option.value}-message` : nothing}"
210
- tabindex="${this.isOptionSelected(option) ? '0' : '-1'}"
211
- @change="${(e) => { this.addRippleEffect(e); this.handleSelectionChange(option); }}"
212
- @focus="${() => this.setFocusedOption(index)}"
213
- ?checked="${this.isOptionSelected(option)}"
214
- ?disabled="${this.isOptionDisabled(option)}"
215
- />
216
- </div>
217
- <span>${option.label}</span>
218
- </label>
219
- ${option.state && option.message
220
- ? html `<div class="message-container" id="${option.value}-message">
221
- <nr-icon name="${option.state === 'error' ? 'exclamation-circle' : 'warning'}"></nr-icon>
222
- <span>${option.message}</span>
223
- </div>`
224
- : nothing}
225
- </div>
226
- `)}
227
- </div>
228
- `;
229
- }
230
- /**
231
- * Render button style radio group
232
- */
233
- renderOptionsWithButtons() {
234
- return html `
235
- <div
236
- class="type-button"
237
- role="radiogroup"
238
- aria-labelledby="radio-group-label"
239
- @keydown="${this.handleKeyDown}"
240
- >
241
- ${this.options.map((option, index) => html `
242
- <nr-button
243
- class="${this.isOptionSelected(option) ? 'selected' : ''}"
244
- type="${this.isOptionSelected(option) ? "primary" /* ButtonType.Primary */ : "default" /* ButtonType.Default */}"
245
- role="radio"
246
- aria-checked="${this.isOptionSelected(option)}"
247
- aria-describedby="${option.state && option.message ? `${option.value}-message` : nothing}"
248
- tabindex="${this.isOptionSelected(option) ? '0' : '-1'}"
249
- .icon="${option.icon ? [option.icon] : []}"
250
- .disabled="${this.isOptionDisabled(option)}"
251
- @click="${() => this.handleSelectionChange(option)}"
252
- @focus="${() => this.setFocusedOption(index)}"
253
- >
254
- ${option.label}
255
- </nr-button>
256
- ${option.state && option.message
257
- ? html `<div class="message-container" id="${option.value}-message">
258
- <nr-icon name="${option.state === 'error' ? 'exclamation-circle' : 'warning'}"></nr-icon>
259
- <span>${option.message}</span>
260
- </div>`
261
- : nothing}
262
- `)}
263
- </div>
264
- `;
265
- }
266
- /**
267
- * Render slot-based radio group (for custom HTML content)
268
- */
269
- renderOptionsWithSlots() {
270
- return html `
271
- <div
272
- role="radiogroup"
273
- aria-labelledby="radio-group-label"
274
- class="radio-group slot-group"
275
- >
276
- ${this.options.map((option, index) => html `
277
- <div
278
- class="${classMap({
279
- 'radio-container': true,
280
- 'slot-container': true,
281
- error: option.state === 'error',
282
- warning: option.state === 'warning',
283
- selected: this.isOptionSelected(option),
284
- [option.className || '']: Boolean(option.className)
285
- })}"
286
- data-theme="${this.currentTheme}"
287
- style="${option.style || ''}"
288
- title="${option.title || ''}"
289
- @click="${() => this.handleSelectionChange(option)}"
290
- >
291
- <label class="radio slot-radio" id="${option.value}-label">
292
- <input
293
- class="radio-input"
294
- type="radio"
295
- role="radio"
296
- name="radioGroup"
297
- .value="${option.value}"
298
- aria-labelledby="${option.value}-label"
299
- aria-describedby="${option.state && option.message ? `${option.value}-message` : nothing}"
300
- tabindex="${this.isOptionSelected(option) ? '0' : '-1'}"
301
- @change="${(e) => { this.addRippleEffect(e); this.handleSelectionChange(option); }}"
302
- @focus="${() => this.setFocusedOption(index)}"
303
- ?checked="${this.isOptionSelected(option)}"
304
- ?disabled="${this.isOptionDisabled(option)}"
305
- />
306
- <div class="slot-content">
307
- <slot name="${option.value}"></slot>
308
- </div>
309
- </label>
310
- ${option.state && option.message
311
- ? html `<div class="message-container" id="${option.value}-message">
312
- <nr-icon name="${option.state === 'error' ? 'exclamation-circle' : 'warning'}"></nr-icon>
313
- <span>${option.message}</span>
314
- </div>`
315
- : nothing}
316
- </div>
317
- `)}
318
- </div>
319
- `;
320
- }
321
- /**
322
- * Render button style with slots
323
- */
324
- renderButtonsWithSlots() {
325
- return html `
326
- <div
327
- class="type-button"
328
- role="radiogroup"
329
- aria-labelledby="radio-group-label"
330
- @keydown="${this.handleKeyDown}"
331
- >
332
- ${this.options.map((option, index) => html `
333
- <nr-button
334
- class="${this.isOptionSelected(option) ? 'selected' : ''}"
335
- type="${this.isOptionSelected(option) ? "primary" /* ButtonType.Primary */ : "default" /* ButtonType.Default */}"
336
- role="radio"
337
- aria-checked="${this.isOptionSelected(option)}"
338
- aria-describedby="${option.state && option.message ? `${option.value}-message` : nothing}"
339
- tabindex="${this.isOptionSelected(option) ? '0' : '-1'}"
340
- .disabled="${this.isOptionDisabled(option)}"
341
- @click="${() => this.handleSelectionChange(option)}"
342
- @focus="${() => this.setFocusedOption(index)}"
343
- >
344
- <slot name="${option.value}" slot="default"></slot>
345
- </nr-button>
346
- ${option.state && option.message
347
- ? html `<div class="message-container" id="${option.value}-message">
348
- <nr-icon name="${option.state === 'error' ? 'exclamation-circle' : 'warning'}"></nr-icon>
349
- <span>${option.message}</span>
350
- </div>`
351
- : nothing}
352
- `)}
353
- </div>
354
- `;
355
- }
356
- render() {
357
- return html `${choose(this.type, [
358
- [RadioButtonType.Default, () => this.renderOptionDefault()],
359
- [RadioButtonType.Button, () => this.renderOptionsWithButtons()],
360
- [RadioButtonType.Slot, () => this.renderOptionsWithSlots()],
361
- ['button-slot', () => this.renderButtonsWithSlots()], // Special case for button with slots
362
- ])} `;
363
- }
364
- };
365
- NrRadioGroupElement.styles = styles;
366
- __decorate([
367
- property({ type: Array })
368
- ], NrRadioGroupElement.prototype, "options", void 0);
369
- __decorate([
370
- property({ type: String, attribute: 'default-value' })
371
- ], NrRadioGroupElement.prototype, "defaultValue", void 0);
372
- __decorate([
373
- property({ type: String })
374
- ], NrRadioGroupElement.prototype, "value", void 0);
375
- __decorate([
376
- property({ type: String })
377
- ], NrRadioGroupElement.prototype, "name", void 0);
378
- __decorate([
379
- property({ type: String })
380
- ], NrRadioGroupElement.prototype, "direction", void 0);
381
- __decorate([
382
- property({ type: String })
383
- ], NrRadioGroupElement.prototype, "type", void 0);
384
- __decorate([
385
- property({ type: Boolean })
386
- ], NrRadioGroupElement.prototype, "required", void 0);
387
- __decorate([
388
- property({ type: Boolean })
389
- ], NrRadioGroupElement.prototype, "disabled", void 0);
390
- NrRadioGroupElement = __decorate([
391
- customElement('nr-radio-group')
392
- ], NrRadioGroupElement);
393
- export { NrRadioGroupElement };
394
- //# sourceMappingURL=radio.component.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"radio.component.js","sourceRoot":"","sources":["../../../src/components/radio-group/radio.component.ts"],"names":[],"mappings":"AAAA;;;;GAIG;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAClD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AAEvD,sBAAsB;AACtB,OAAO,2BAA2B,CAAC;AACnC,OAAO,+BAA+B,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EACH,oBAAoB,EACpB,uBAAuB,EACvB,oBAAoB,EACpB,yBAAyB,EACzB,qBAAqB,EACxB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAqB,MAAM,iBAAiB,CAAC;AAGrE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,iBAAiB,CAAC,UAAU,CAAC;IAAtE;;QAGW,uBAAkB,GAAG,CAAC,SAAS,CAAC,CAAC;QAE1C,aAAa;QACc,YAAO,GAAwB,EAAE,CAAC;QACL,iBAAY,GAAW,EAAE,CAAC;QACtD,UAAK,GAAW,EAAE,CAAC;QACnB,SAAI,GAAW,EAAE,CAAC;QAClB,cAAS,GAA8B,UAAU,CAAC;QAClD,SAAI,GAAoB,eAAe,CAAC,OAAO,CAAC;QAC/C,aAAQ,GAAY,KAAK,CAAC;QAC1B,aAAQ,GAAY,KAAK,CAAC;QAEvD,kDAAkD;QAC1C,oBAAe,GAAG,IAAI,oBAAoB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C9B,CAAC,eAAe,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,mBAAmB,EAAE,CAAC;YAC3D,CAAC,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,wBAAwB,EAAE,CAAC;YAC/D,CAAC,eAAe,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC;YAC3D,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,sBAAsB,EAAE,CAAC,EAAE,qCAAqC;SAC5F,CAAC,GAAG,CAAC;IACR,CAAC;CACF,CAAA;AArViB,0BAAM,GAAG,MAAO,CAAA;AAKL;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAmC;AACL;IAAvD,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;yDAA2B;AACtD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAoB;AACnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAmB;AAClB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAmD;AAClD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAiD;AAC/C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDAA2B;AAC1B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDAA2B;AAb5C,mBAAmB;IAD/B,aAAa,CAAC,gBAAgB,CAAC;GACnB,mBAAmB,CAsV/B;SAtVY,mBAAmB","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { LitElement, html, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { choose } from 'lit/directives/choose.js';\nimport { classMap } from 'lit/directives/class-map.js';\n\n// Import dependencies\nimport '../icon/icon.component.js';\nimport '../button/button.component.js';\n\nimport { NuralyUIBaseMixin } from '../../shared/base-mixin.js';\nimport {\n RadioGroupController,\n RadioKeyboardController,\n RadioFocusController,\n RadioValidationController,\n RadioRippleController\n} from './controllers/index.js';\nimport { styles } from './radio.style.js';\nimport { RadioButtonType, RadioButtonOption } from './radio.type.js';\nimport { ButtonType } from '../button/button.types.js';\n\n/**\n * A radio button group component using Reactive Controllers architecture.\n * \n * Supports multiple display modes:\n * - Default: Traditional radio buttons with labels\n * - Button: Button-style radio group\n * - Slot: Custom HTML content with radio selection\n * \n * Features:\n * - Theme-aware styling with light/dark mode support\n * - Keyboard navigation (arrow keys, space, enter)\n * - Accessibility compliance\n * - Form validation and integration\n * - Ripple effects on interaction\n * - Modular controller-based architecture\n * \n * @example\n * ```html\n * <nr-radio-group\n * .options='[\n * { value: \"option1\", label: \"Option 1\" },\n * { value: \"option2\", label: \"Option 2\" }\n * ]'\n * default-value=\"option1\"\n * direction=\"horizontal\">\n * </nr-radio-group>\n * ```\n * \n * @fires change - Dispatched when the selected option changes\n */\n@customElement('nr-radio-group')\nexport class NrRadioGroupElement extends NuralyUIBaseMixin(LitElement) {\n static override styles = styles;\n\n override requiredComponents = ['nr-icon'];\n\n // Properties\n @property({ type: Array }) options: RadioButtonOption[] = [];\n @property({ type: String, attribute: 'default-value' }) defaultValue: string = '';\n @property({ type: String }) value: string = '';\n @property({ type: String }) name: string = '';\n @property({ type: String }) direction: 'horizontal' | 'vertical' = 'vertical';\n @property({ type: String }) type: RadioButtonType = RadioButtonType.Default;\n @property({ type: Boolean }) required: boolean = false;\n @property({ type: Boolean }) disabled: boolean = false;\n\n // Reactive Controllers - PROPERLY implemented now\n private groupController = new RadioGroupController(this);\n // @ts-ignore - Controller handles events through listeners, doesn't need direct reference\n private keyboardController = new RadioKeyboardController(this, this.groupController);\n // Additional controllers for full functionality\n private focusController = new RadioFocusController(this);\n private validationController = new RadioValidationController(this);\n private rippleController = new RadioRippleController(this);\n\n /**\n * Get the currently selected option - DELEGATES to controller\n */\n get selectedOption(): RadioButtonOption | undefined {\n return this.groupController.getSelectedOption();\n }\n\n /**\n * Check if an option is selected - DELEGATES to controller\n */\n isOptionSelected(option: RadioButtonOption): boolean {\n return this.groupController.isOptionSelected(option);\n }\n\n /**\n * Check if an option is disabled - DELEGATES to controller\n */\n isOptionDisabled(option: RadioButtonOption): boolean {\n return this.groupController.isOptionDisabled(option);\n }\n\n /**\n * Handle option selection change - DELEGATES to controller\n */\n handleSelectionChange(option: RadioButtonOption): void {\n this.groupController.selectOption(option);\n }\n\n /**\n * Set focused option by index - DELEGATES to controller\n */\n setFocusedOption(index: number): void {\n this.focusController.setFocusedOption(index);\n }\n\n /**\n * Handle keyboard events - DELEGATES to controller\n */\n handleKeyDown(_event: KeyboardEvent): void {\n // Controller handles keyboard navigation automatically via event listeners\n // This method exists for template compatibility but delegates to controller\n }\n\n /**\n * Add ripple effect on radio input click - DELEGATES to controller\n */\n addRippleEffect(event: Event): void {\n this.rippleController.addRippleEffect(event);\n }\n\n /**\n * Validate the radio group - DELEGATES to controller\n */\n validate(): boolean {\n return this.validationController.validate();\n }\n\n /**\n * Get validation message - DELEGATES to controller\n */\n get validationMessage(): string {\n return this.validationController.validationMessage;\n }\n\n /**\n * Check if the radio group is valid - DELEGATES to controller\n */\n get isValid(): boolean {\n return this.validationController.isValid;\n }\n\n /**\n * Get form data for form submission - DELEGATES to controller\n */\n getFormData(): { [key: string]: string } {\n return this.validationController.getFormData();\n }\n\n /**\n * Reset the radio group - DELEGATES to controller\n */\n reset(): void {\n this.validationController.reset();\n }\n\n /**\n * FormData integration for native form submission - DELEGATES to controller\n */\n get formData(): FormData | null {\n return this.validationController.getFormDataObject();\n }\n\n /**\n * Check form validity (required for HTML5 form validation)\n */\n checkValidity(): boolean {\n return this.validate();\n }\n\n /**\n * Report form validity (required for HTML5 form validation) - DELEGATES to controller\n */\n reportValidity(): boolean {\n return this.validationController.reportValidity();\n }\n\n /**\n * Programmatically focus the radio group - DELEGATES to controller\n */\n override focus(): void {\n this.focusController.focus();\n }\n\n /**\n * Programmatically blur the radio group - DELEGATES to controller\n */\n override blur(): void {\n this.focusController.blur();\n }\n\n /**\n * Render default radio button style\n */\n private renderOptionDefault() {\n return html`\n <div \n role=\"radiogroup\" \n aria-labelledby=\"radio-group-label\"\n class=\"radio-group\"\n >\n ${this.options.map(\n (option: RadioButtonOption, index: number) => html`\n <div\n class=\"${classMap({\n 'radio-container': true,\n error: option.state === 'error',\n warning: option.state === 'warning',\n [option.className || '']: Boolean(option.className)\n })}\"\n data-theme=\"${this.currentTheme}\"\n style=\"${option.style || ''}\"\n title=\"${option.title || ''}\"\n >\n <label class=\"radio\" id=\"${option.id || option.value}-label\">\n <div class=\"input-container\">\n <input\n class=\"radio-input\"\n type=\"radio\"\n role=\"radio\"\n name=\"radioGroup\"\n .value=\"${option.value}\"\n aria-labelledby=\"${option.value}-label\"\n aria-describedby=\"${option.state && option.message ? `${option.value}-message` : nothing}\"\n tabindex=\"${this.isOptionSelected(option) ? '0' : '-1'}\"\n @change=\"${(e: Event) => { this.addRippleEffect(e); this.handleSelectionChange(option); }}\"\n @focus=\"${() => this.setFocusedOption(index)}\"\n ?checked=\"${this.isOptionSelected(option)}\"\n ?disabled=\"${this.isOptionDisabled(option)}\"\n />\n </div>\n <span>${option.label}</span>\n </label>\n ${option.state && option.message\n ? html`<div class=\"message-container\" id=\"${option.value}-message\">\n <nr-icon name=\"${option.state === 'error' ? 'exclamation-circle' : 'warning'}\"></nr-icon>\n <span>${option.message}</span>\n </div>`\n : nothing}\n </div>\n `\n )}\n </div>\n `;\n }\n\n /**\n * Render button style radio group\n */\n private renderOptionsWithButtons() {\n return html`\n <div \n class=\"type-button\" \n role=\"radiogroup\" \n aria-labelledby=\"radio-group-label\"\n @keydown=\"${this.handleKeyDown}\"\n >\n ${this.options.map(\n (option: RadioButtonOption, index: number) => html`\n <nr-button\n class=\"${this.isOptionSelected(option) ? 'selected' : ''}\"\n type=\"${this.isOptionSelected(option) ? ButtonType.Primary : ButtonType.Default}\"\n role=\"radio\"\n aria-checked=\"${this.isOptionSelected(option)}\"\n aria-describedby=\"${option.state && option.message ? `${option.value}-message` : nothing}\"\n tabindex=\"${this.isOptionSelected(option) ? '0' : '-1'}\"\n .icon=\"${option.icon ? [option.icon] : []}\"\n .disabled=\"${this.isOptionDisabled(option)}\"\n @click=\"${() => this.handleSelectionChange(option)}\"\n @focus=\"${() => this.setFocusedOption(index)}\"\n >\n ${option.label}\n </nr-button>\n ${option.state && option.message\n ? html`<div class=\"message-container\" id=\"${option.value}-message\">\n <nr-icon name=\"${option.state === 'error' ? 'exclamation-circle' : 'warning'}\"></nr-icon>\n <span>${option.message}</span>\n </div>`\n : nothing}\n `\n )}\n </div>\n `;\n }\n\n /**\n * Render slot-based radio group (for custom HTML content)\n */\n private renderOptionsWithSlots() {\n return html`\n <div \n role=\"radiogroup\" \n aria-labelledby=\"radio-group-label\"\n class=\"radio-group slot-group\"\n >\n ${this.options.map(\n (option: RadioButtonOption, index: number) => html`\n <div\n class=\"${classMap({\n 'radio-container': true,\n 'slot-container': true,\n error: option.state === 'error',\n warning: option.state === 'warning',\n selected: this.isOptionSelected(option),\n [option.className || '']: Boolean(option.className)\n })}\"\n data-theme=\"${this.currentTheme}\"\n style=\"${option.style || ''}\"\n title=\"${option.title || ''}\"\n @click=\"${() => this.handleSelectionChange(option)}\"\n >\n <label class=\"radio slot-radio\" id=\"${option.value}-label\">\n <input\n class=\"radio-input\"\n type=\"radio\"\n role=\"radio\"\n name=\"radioGroup\"\n .value=\"${option.value}\"\n aria-labelledby=\"${option.value}-label\"\n aria-describedby=\"${option.state && option.message ? `${option.value}-message` : nothing}\"\n tabindex=\"${this.isOptionSelected(option) ? '0' : '-1'}\"\n @change=\"${(e: Event) => { this.addRippleEffect(e); this.handleSelectionChange(option); }}\"\n @focus=\"${() => this.setFocusedOption(index)}\"\n ?checked=\"${this.isOptionSelected(option)}\"\n ?disabled=\"${this.isOptionDisabled(option)}\"\n />\n <div class=\"slot-content\">\n <slot name=\"${option.value}\"></slot>\n </div>\n </label>\n ${option.state && option.message\n ? html`<div class=\"message-container\" id=\"${option.value}-message\">\n <nr-icon name=\"${option.state === 'error' ? 'exclamation-circle' : 'warning'}\"></nr-icon>\n <span>${option.message}</span>\n </div>`\n : nothing}\n </div>\n `\n )}\n </div>\n `;\n }\n\n /**\n * Render button style with slots\n */\n private renderButtonsWithSlots() {\n return html`\n <div \n class=\"type-button\" \n role=\"radiogroup\" \n aria-labelledby=\"radio-group-label\"\n @keydown=\"${this.handleKeyDown}\"\n >\n ${this.options.map(\n (option: RadioButtonOption, index: number) => html`\n <nr-button\n class=\"${this.isOptionSelected(option) ? 'selected' : ''}\"\n type=\"${this.isOptionSelected(option) ? ButtonType.Primary : ButtonType.Default}\"\n role=\"radio\"\n aria-checked=\"${this.isOptionSelected(option)}\"\n aria-describedby=\"${option.state && option.message ? `${option.value}-message` : nothing}\"\n tabindex=\"${this.isOptionSelected(option) ? '0' : '-1'}\"\n .disabled=\"${this.isOptionDisabled(option)}\"\n @click=\"${() => this.handleSelectionChange(option)}\"\n @focus=\"${() => this.setFocusedOption(index)}\"\n >\n <slot name=\"${option.value}\" slot=\"default\"></slot>\n </nr-button>\n ${option.state && option.message\n ? html`<div class=\"message-container\" id=\"${option.value}-message\">\n <nr-icon name=\"${option.state === 'error' ? 'exclamation-circle' : 'warning'}\"></nr-icon>\n <span>${option.message}</span>\n </div>`\n : nothing}\n `\n )}\n </div>\n `;\n }\n\n protected override render() {\n return html`${choose(this.type, [\n [RadioButtonType.Default, () => this.renderOptionDefault()],\n [RadioButtonType.Button, () => this.renderOptionsWithButtons()],\n [RadioButtonType.Slot, () => this.renderOptionsWithSlots()],\n ['button-slot', () => this.renderButtonsWithSlots()], // Special case for button with slots\n ])} `;\n }\n}\n"]}
package/radio.style.d.ts DELETED
@@ -1,7 +0,0 @@
1
- /**
2
- * @license
3
- * Copyright 2023 Nuraly, Laabidi Aymen
4
- * SPDX-License-Identifier: MIT
5
- */
6
- export declare const styles: import("lit").CSSResult;
7
- //# sourceMappingURL=radio.style.d.ts.map