@nuralyui/radio-group 0.0.6

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