@nuralyui/radio-group 0.0.10 → 0.0.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.
- package/bundle.js +100 -22
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/radio-group.component.d.ts +20 -1
- package/radio-group.component.js +50 -11
- package/radio-group.component.js.map +1 -1
- package/radio-group.style.js +74 -0
- package/radio-group.style.js.map +1 -1
- package/radio-group.types.d.ts +3 -1
- package/radio-group.types.js +1 -0
- package/radio-group.types.js.map +1 -1
- package/radio.constant.js.map +1 -1
- package/react.js.map +1 -1
package/bundle.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{css as t,LitElement as r,html as i,nothing as o}from"lit";import{property as e,customElement as
|
|
1
|
+
import{css as t,LitElement as r,html as i,nothing as o}from"lit";import{property as e,customElement as n}from"lit/decorators.js";import{choose as a}from"lit/directives/choose.js";import{classMap as s}from"lit/directives/class-map.js";import{NuralyUIBaseMixin as l}from"@nuralyui/common/mixins";import{throttle as d}from"@nuralyui/common/utils";
|
|
2
2
|
/**
|
|
3
3
|
* @license
|
|
4
4
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
5
5
|
* SPDX-License-Identifier: MIT
|
|
6
|
-
*/class u{constructor(t){this.host=t,t.addController(this)}hostConnected(){if(this.host.defaultValue&&!this.host.value){const t=this.host.options.find(
|
|
6
|
+
*/class u{constructor(t){this.host=t,t.addController(this)}hostConnected(){if(this.host.defaultValue&&!this.host.value){const t=this.host.options.find(t=>t.value===this.host.defaultValue);t&&!this.isOptionDisabled(t)&&this.selectOption(t)}}hostDisconnected(){}selectOption(t){if(this.isOptionDisabled(t))return;const r=this.host.value;this.host.value=t.value,this.dispatchChangeEvent(t,r),this.host.requestUpdate()}getSelectedOption(){return this.host.options.find(t=>t.value===this.host.value)}isOptionSelected(t){return t.value===this.host.value}isOptionDisabled(t){return this.host.disabled||Boolean(t.disabled)}getFormData(){return this.host.name?{[this.host.name]:this.host.value}:{}}reset(){this.host.value=this.host.defaultValue||"",this.host.requestUpdate()}getSelectedValue(){return this.host.value}dispatchChangeEvent(t,r){const i=new CustomEvent("nr-change",{detail:{value:t.value,option:t,oldValue:r},bubbles:!0,composed:!0});this.host.dispatchEvent(i)}}
|
|
7
7
|
/**
|
|
8
8
|
* @license
|
|
9
9
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
10
10
|
* SPDX-License-Identifier: MIT
|
|
11
|
-
*/class
|
|
11
|
+
*/class h{constructor(t,r){this.groupController=r,this.host=t,this.boundKeyDownHandler=this.handleKeyDown.bind(this),t.addController(this)}hostConnected(){this.host.addEventListener("keydown",this.boundKeyDownHandler)}hostDisconnected(){this.host.removeEventListener("keydown",this.boundKeyDownHandler)}handleKeyDown(t){const r=this.host.options;if(!r||0===r.length)return;const i=r.findIndex(t=>this.groupController.isOptionSelected(t));switch(t.key){case"ArrowDown":case"ArrowRight":t.preventDefault(),this.selectNextOption(r,i);break;case"ArrowUp":case"ArrowLeft":t.preventDefault(),this.selectPreviousOption(r,i);break;case" ":case"Enter":t.preventDefault(),-1===i&&this.selectFirstEnabledOption(r);break;case"Home":t.preventDefault(),this.selectFirstEnabledOption(r);break;case"End":t.preventDefault(),this.selectLastEnabledOption(r)}}selectNextOption(t,r){const i=-1===r?0:r+1;for(let r=0;r<t.length;r++){const o=t[(i+r)%t.length];if(!this.groupController.isOptionDisabled(o)){this.groupController.selectOption(o);break}}}selectPreviousOption(t,r){const i=-1===r?t.length-1:r-1;for(let r=0;r<t.length;r++){const o=t[(i-r+t.length)%t.length];if(!this.groupController.isOptionDisabled(o)){this.groupController.selectOption(o);break}}}selectFirstEnabledOption(t){const r=t.find(t=>!this.groupController.isOptionDisabled(t));r&&this.groupController.selectOption(r)}selectLastEnabledOption(t){const r=t.filter(t=>!this.groupController.isOptionDisabled(t)),i=r[r.length-1];i&&this.groupController.selectOption(i)}}
|
|
12
12
|
/**
|
|
13
13
|
* @license
|
|
14
14
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
15
15
|
* SPDX-License-Identifier: MIT
|
|
16
|
-
*/class
|
|
16
|
+
*/class c{constructor(t){this._focusedIndex=-1,this._hasFocus=!1,this.host=t,this.boundFocusInHandler=this.handleFocusIn.bind(this),this.boundFocusOutHandler=this.handleFocusOut.bind(this),t.addController(this)}hostConnected(){this.host.addEventListener("focusin",this.boundFocusInHandler),this.host.addEventListener("focusout",this.boundFocusOutHandler)}hostDisconnected(){this.host.removeEventListener("focusin",this.boundFocusInHandler),this.host.removeEventListener("focusout",this.boundFocusOutHandler)}get focusedIndex(){return this._focusedIndex}get hasFocus(){return this._hasFocus}setFocusedOption(t){const r=this._focusedIndex;this._focusedIndex=t,r!==t&&this.host.requestUpdate()}getFocusedIndex(){return this._focusedIndex}clearFocus(){this._focusedIndex=-1,this._hasFocus=!1,this.host.requestUpdate()}handleFocusIn(t){var r;this._hasFocus=!0;const i=t.target;if(i&&i.matches('input[type="radio"], nr-button[role="radio"]')){const t=null===(r=this.host.shadowRoot)||void 0===r?void 0:r.querySelectorAll('input[type="radio"], nr-button[role="radio"]');if(t){const r=Array.from(t).indexOf(i);-1!==r&&this.setFocusedOption(r)}}this.host.requestUpdate()}handleFocusOut(t){const r=t.relatedTarget,i=this.host;r&&i.contains(r)||(this._hasFocus=!1,this.host.requestUpdate())}focus(){const t=this.host.options,r=this.host.value,i=t.findIndex(t=>t.value===r);if(-1!==i)return void this.focusOptionAtIndex(i);const o=t.findIndex(t=>!t.disabled);-1!==o&&this.focusOptionAtIndex(o)}blur(){const t=this.host.shadowRoot;if(!t)return;const r=t.querySelector('input[type="radio"]:focus, nr-button[role="radio"]:focus');r&&"function"==typeof r.blur&&r.blur()}focusOptionAtIndex(t){const r=this.host.shadowRoot;if(!r)return;this.updateTabIndices(t);const i=r.querySelectorAll('input[type="radio"]');if(i[t])return void i[t].focus();const o=r.querySelectorAll('nr-button[role="radio"]');o[t]&&o[t].focus()}updateTabIndices(t){const r=this.host.shadowRoot;if(!r)return;const i=this.host.options,o=this.host.value;let e=t;if(void 0===e){const t=i.findIndex(t=>t.value===o);e=-1!==t?t:i.findIndex(t=>!t.disabled)}r.querySelectorAll('input[type="radio"]').forEach((t,r)=>{t.tabIndex=r===e?0:-1});r.querySelectorAll('nr-button[role="radio"]').forEach((t,r)=>{t.tabIndex=r===e?0:-1})}hostUpdated(){this.updateTabIndices()}}
|
|
17
17
|
/**
|
|
18
18
|
* @license
|
|
19
19
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
@@ -23,7 +23,7 @@ import{css as t,LitElement as r,html as i,nothing as o}from"lit";import{property
|
|
|
23
23
|
* @license
|
|
24
24
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
25
25
|
* SPDX-License-Identifier: MIT
|
|
26
|
-
*/class b{constructor(t){this._rippleEnabled=!0,this.activeRipples=new Set,this.ripplePool=[],this.host=t,this.boundClickHandler=this.handleClick.bind(this),t.addController(this);const r=this.addRippleEffect.bind(this);this.addRippleEffect=d(r,16)}hostConnected(){this.host.addEventListener("click",this.boundClickHandler)}hostDisconnected(){this.host.removeEventListener("click",this.boundClickHandler)}get rippleEnabled(){return this._rippleEnabled}set rippleEnabled(t){this._rippleEnabled=t}handleClick(t){if(!this._rippleEnabled)return;const r=t.target;r&&r.matches('input[type="radio"]')&&this.addRippleToElement(r),r&&r.matches('nr-button[role="radio"]')&&this.addButtonRippleEffect(r)}addRippleEffect(t){const r=t.target;r&&this.addRippleToElement(r)}addRippleToElement(t){t.style.animation="none",t.offsetHeight;const r=getComputedStyle(t).getPropertyValue("--nuraly-radio-ripple-duration")||getComputedStyle(t).getPropertyValue("--nuraly-radio-local-ripple-duration")||"300ms";t.style.animation=`radioRipple ${r} ease-out`;const i=this.parseDuration(r);setTimeout((
|
|
26
|
+
*/class b{constructor(t){this._rippleEnabled=!0,this.activeRipples=new Set,this.ripplePool=[],this.host=t,this.boundClickHandler=this.handleClick.bind(this),t.addController(this);const r=this.addRippleEffect.bind(this);this.addRippleEffect=d(r,16)}hostConnected(){this.host.addEventListener("click",this.boundClickHandler)}hostDisconnected(){this.host.removeEventListener("click",this.boundClickHandler)}get rippleEnabled(){return this._rippleEnabled}set rippleEnabled(t){this._rippleEnabled=t}handleClick(t){if(!this._rippleEnabled)return;const r=t.target;r&&r.matches('input[type="radio"]')&&this.addRippleToElement(r),r&&r.matches('nr-button[role="radio"]')&&this.addButtonRippleEffect(r)}addRippleEffect(t){const r=t.target;r&&this.addRippleToElement(r)}addRippleToElement(t){t.style.animation="none",t.offsetHeight;const r=getComputedStyle(t).getPropertyValue("--nuraly-radio-ripple-duration")||getComputedStyle(t).getPropertyValue("--nuraly-radio-local-ripple-duration")||"300ms";t.style.animation=`radioRipple ${r} ease-out`;const i=this.parseDuration(r);setTimeout(()=>{t.style.animation=""},i)}addButtonRippleEffect(t){const r=this.createRippleElement(t);r&&(t.appendChild(r),setTimeout(()=>{r.parentNode&&r.parentNode.removeChild(r)},600))}createRippleElement(t){const r=this.getRippleElement(t);return r.style.animation="radioRippleSpread 600ms ease-out",r}parseDuration(t){const r=t.match(/^([\d.]+)(s|ms)$/);if(!r)return 300;const i=parseFloat(r[1]);return"s"===r[2]?1e3*i:i}triggerRipple(t){if(!this._rippleEnabled)return;const r=this.host.shadowRoot;if(!r)return;let i=null;i=t?r.querySelector(`input[type="radio"][value="${t}"]`):r.querySelector('input[type="radio"]:checked'),i&&this.addRippleToElement(i)}disableRipple(){this._rippleEnabled=!1}enableRipple(){this._rippleEnabled=!0}clearRipples(){this.activeRipples.forEach(t=>{t.parentNode&&t.parentNode.removeChild(t),this.ripplePool.length<10&&(t.style.animation="",t.style.transform="scale(0)",this.ripplePool.push(t))}),this.activeRipples.clear();const t=this.host.shadowRoot;if(t){t.querySelectorAll('input[type="radio"]').forEach(t=>{t.style.animation=""})}}getRippleElement(t){let r=this.ripplePool.pop();r||(r=document.createElement("span"),r.className="radio-ripple",r.style.position="absolute",r.style.borderRadius="50%",r.style.background="currentColor",r.style.opacity="0.1",r.style.pointerEvents="none");const i=t.getBoundingClientRect(),o=Math.max(i.width,i.height);return r.style.width=`${o}px`,r.style.height=`${o}px`,r.style.left=-o/2+"px",r.style.top=-o/2+"px",r.style.transform="scale(0)",this.activeRipples.add(r),r}addRippleEffectToElement(t){this.addRippleToElement(t)}setRippleEnabled(t){this._rippleEnabled=t}}
|
|
27
27
|
/**
|
|
28
28
|
* @license
|
|
29
29
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
@@ -185,6 +185,57 @@ import{css as t,LitElement as r,html as i,nothing as o}from"lit";import{property
|
|
|
185
185
|
--nuraly-icon-local-color: var(--nuraly-button-primary-disabled-text-color, var(--nuraly-button-local-primary-disabled-text-color));
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
+
/* ========================================
|
|
189
|
+
* AUTO WIDTH STYLING
|
|
190
|
+
* ======================================== */
|
|
191
|
+
|
|
192
|
+
:host([auto-width]) .type-button nr-button {
|
|
193
|
+
--nuraly-button-min-width: 40px;
|
|
194
|
+
min-width: auto;
|
|
195
|
+
width: auto;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/* Ensure minimum padding for auto-width buttons to prevent them from becoming too small */
|
|
199
|
+
:host([auto-width]) .type-button nr-button button {
|
|
200
|
+
min-width: auto;
|
|
201
|
+
padding-left: max(var(--nuraly-spacing-2), 0.5rem);
|
|
202
|
+
padding-right: max(var(--nuraly-spacing-2), 0.5rem);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/* Icon-only buttons with auto-width should have minimal but adequate padding */
|
|
206
|
+
:host([auto-width]) .type-button nr-button.icon-only {
|
|
207
|
+
padding: 0.375rem; /* Even more minimal padding for icon-only */
|
|
208
|
+
min-width: auto;
|
|
209
|
+
width: auto;
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
:host([auto-width]) .type-button nr-button.icon-only button {
|
|
213
|
+
padding: max(0.375rem, var(--nuraly-spacing-2)); /* Ensure minimum 6px padding for icon-only */
|
|
214
|
+
min-width: auto;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/* For small size buttons, use proportionally smaller but still adequate padding */
|
|
218
|
+
:host([auto-width]) .type-button nr-button[size="small"] button {
|
|
219
|
+
padding-left: max(var(--nuraly-spacing-1-5), 0.375rem);
|
|
220
|
+
padding-right: max(var(--nuraly-spacing-1-5), 0.375rem);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/* For small size icon-only buttons, use even less but still minimum padding */
|
|
224
|
+
:host([auto-width]) .type-button nr-button.icon-only[size="small"] button {
|
|
225
|
+
padding: max(0.25rem, var(--nuraly-spacing-1-5));
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/* For large size buttons, maintain larger minimum padding */
|
|
229
|
+
:host([auto-width]) .type-button nr-button[size="large"] button {
|
|
230
|
+
padding-left: max(var(--nuraly-spacing-4), 0.75rem);
|
|
231
|
+
padding-right: max(var(--nuraly-spacing-4), 0.75rem);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/* For large size icon-only buttons, use proportionally larger padding */
|
|
235
|
+
:host([auto-width]) .type-button nr-button.icon-only[size="large"] button {
|
|
236
|
+
padding: max(0.5rem, var(--nuraly-spacing-3));
|
|
237
|
+
}
|
|
238
|
+
|
|
188
239
|
/* ========================================
|
|
189
240
|
* SLOT-BASED RADIO STYLING
|
|
190
241
|
* ======================================== */
|
|
@@ -216,21 +267,44 @@ import{css as t,LitElement as r,html as i,nothing as o}from"lit";import{property
|
|
|
216
267
|
.slot-container.selected .slot-wrapper {
|
|
217
268
|
background-color: var(--nuraly-radio-group-slot-selected-bg);
|
|
218
269
|
}
|
|
219
|
-
|
|
270
|
+
|
|
271
|
+
/* ========================================
|
|
272
|
+
* HELPER TEXT SLOT STYLING
|
|
273
|
+
* ======================================== */
|
|
274
|
+
|
|
275
|
+
::slotted([slot='helper-text']) {
|
|
276
|
+
color: var(--nuraly-input-helper-text-color, var(--nuraly-helper-text-color, #8c8c8c));
|
|
277
|
+
font-size: var(--nuraly-input-helper-text-font-size, var(--nuraly-helper-text-font-size, 12px));
|
|
278
|
+
padding-top: var(--nuraly-input-helper-text-padding-top, var(--nuraly-helper-text-padding-top, 4px));
|
|
279
|
+
|
|
280
|
+
/* Prevent text overflow and ensure proper wrapping without affecting parent width */
|
|
281
|
+
word-wrap: break-word;
|
|
282
|
+
word-break: break-word;
|
|
283
|
+
overflow-wrap: break-word;
|
|
284
|
+
hyphens: auto;
|
|
285
|
+
white-space: normal;
|
|
286
|
+
max-width: 100%;
|
|
287
|
+
width: 0;
|
|
288
|
+
min-width: 100%;
|
|
289
|
+
box-sizing: border-box;
|
|
290
|
+
line-height: 1.4;
|
|
291
|
+
display: block;
|
|
292
|
+
}
|
|
293
|
+
`;var g,m,v,f,w;!function(t){t.Horizontal="horizontal",t.Vertical="vertical"}(g||(g={})),function(t){t.Left="left",t.Right="right"}(m||(m={})),function(t){t.Default="default",t.Button="button",t.Slot="slot",t.ButtonSlot="button-slot"}(v||(v={})),function(t){t.Small="small",t.Medium="medium",t.Large="large"}(f||(f={})),function(t){t.Default="default",t.Solid="solid"}(w||(w={}));
|
|
220
294
|
/**
|
|
221
295
|
* @license
|
|
222
296
|
* Copyright 2023 Nuraly, Laabidi Aymen
|
|
223
297
|
* SPDX-License-Identifier: MIT
|
|
224
298
|
*/
|
|
225
|
-
var x=function(t,r,i,o){for(var e,
|
|
299
|
+
var x=function(t,r,i,o){for(var e,n=arguments.length,a=n<3?r:null===o?o=Object.getOwnPropertyDescriptor(r,i):o,s=t.length-1;s>=0;s--)(e=t[s])&&(a=(n<3?e(a):n>3?e(r,i,a):e(r,i))||a);return n>3&&a&&Object.defineProperty(r,i,a),a};let $=class extends(l(r)){constructor(){super(...arguments),this.requiredComponents=["nr-icon","nr-radio"],this.options=[],this.defaultValue="",this.value="",this.name="radioGroup",this.direction="vertical",this.type=v.Default,this.required=!1,this.disabled=!1,this.size="medium",this.position="left",this.autoWidth=!1,this.helper="",this.groupController=new u(this),this.keyboardController=new h(this,this.groupController),this.focusController=new c(this),this.validationController=new p(this),this.rippleController=new b(this)}get selectedOption(){return this.groupController.getSelectedOption()}isOptionSelected(t){return this.groupController.isOptionSelected(t)}isOptionDisabled(t){return this.groupController.isOptionDisabled(t)}isOptionIconOnly(t){return!(!t.icon||t.label&&""!==t.label.trim())}handleSelectionChange(t){this.groupController.selectOption(t)}setFocusedOption(t){this.focusController.setFocusedOption(t)}handleKeyDown(t){}addRippleEffect(t){this.rippleController.addRippleEffect(t)}validate(){return this.validationController.validate()}get validationMessage(){return this.validationController.validationMessage}get isValid(){return this.validationController.isValid}getFormData(){return this.validationController.getFormData()}reset(){this.validationController.reset()}get formData(){return this.validationController.getFormDataObject()}checkValidity(){return this.validate()}reportValidity(){return this.validationController.reportValidity()}focus(){this.focusController.focus()}blur(){this.focusController.blur()}renderOptionDefault(){return i`
|
|
226
300
|
<div
|
|
227
301
|
role="radiogroup"
|
|
228
302
|
aria-labelledby="radio-group-label"
|
|
229
303
|
class="radio-group ${this.direction}"
|
|
230
304
|
>
|
|
231
|
-
${this.options.map((
|
|
305
|
+
${this.options.map((t,r)=>i`
|
|
232
306
|
<div
|
|
233
|
-
class="${
|
|
307
|
+
class="${s({"radio-wrapper":!0,error:"error"===t.state,warning:"warning"===t.state,[t.className||""]:Boolean(t.className)})}"
|
|
234
308
|
data-theme="${this.currentTheme}"
|
|
235
309
|
style="${t.style||""}"
|
|
236
310
|
title="${t.title||""}"
|
|
@@ -254,7 +328,7 @@ var x=function(t,r,i,o){for(var e,s=arguments.length,n=s<3?r:null===o?o=Object.g
|
|
|
254
328
|
<span>${t.message}</span>
|
|
255
329
|
</div>`:o}
|
|
256
330
|
</div>
|
|
257
|
-
`)
|
|
331
|
+
`)}
|
|
258
332
|
</div>
|
|
259
333
|
`}renderOptionsWithButtons(){return i`
|
|
260
334
|
<div
|
|
@@ -263,14 +337,15 @@ var x=function(t,r,i,o){for(var e,s=arguments.length,n=s<3?r:null===o?o=Object.g
|
|
|
263
337
|
aria-labelledby="radio-group-label"
|
|
264
338
|
@keydown="${this.handleKeyDown}"
|
|
265
339
|
>
|
|
266
|
-
${this.options.map((
|
|
340
|
+
${this.options.map((t,r)=>{const e=this.isOptionSelected(t),n=[e?"selected":"",this.isOptionIconOnly(t)&&this.autoWidth?"icon-only":""].filter(Boolean).join(" ");return i`
|
|
267
341
|
<nr-button
|
|
268
|
-
class="${
|
|
269
|
-
type="${
|
|
342
|
+
class="${n}"
|
|
343
|
+
type="${e?"primary":"default"}"
|
|
344
|
+
size="${this.size}"
|
|
270
345
|
role="radio"
|
|
271
|
-
aria-checked="${
|
|
346
|
+
aria-checked="${e}"
|
|
272
347
|
aria-describedby="${t.state&&t.message?`${t.value}-message`:o}"
|
|
273
|
-
tabindex="${
|
|
348
|
+
tabindex="${e?"0":"-1"}"
|
|
274
349
|
.icon="${t.icon?[t.icon]:[]}"
|
|
275
350
|
.disabled="${this.isOptionDisabled(t)}"
|
|
276
351
|
@click="${()=>this.handleSelectionChange(t)}"
|
|
@@ -282,7 +357,7 @@ var x=function(t,r,i,o){for(var e,s=arguments.length,n=s<3?r:null===o?o=Object.g
|
|
|
282
357
|
<nr-icon name="${"error"===t.state?"exclamation-circle":"warning"}"></nr-icon>
|
|
283
358
|
<span>${t.message}</span>
|
|
284
359
|
</div>`:o}
|
|
285
|
-
`)
|
|
360
|
+
`})}
|
|
286
361
|
</div>
|
|
287
362
|
`}renderOptionsWithSlots(){return i`
|
|
288
363
|
<div
|
|
@@ -290,9 +365,9 @@ var x=function(t,r,i,o){for(var e,s=arguments.length,n=s<3?r:null===o?o=Object.g
|
|
|
290
365
|
aria-labelledby="radio-group-label"
|
|
291
366
|
class="radio-group slot-group ${this.direction}"
|
|
292
367
|
>
|
|
293
|
-
${this.options.map((
|
|
368
|
+
${this.options.map((t,r)=>i`
|
|
294
369
|
<div
|
|
295
|
-
class="${
|
|
370
|
+
class="${s({"radio-wrapper":!0,"slot-container":!0,error:"error"===t.state,warning:"warning"===t.state,selected:this.isOptionSelected(t),[t.className||""]:Boolean(t.className)})}"
|
|
296
371
|
data-theme="${this.currentTheme}"
|
|
297
372
|
style="${t.style||""}"
|
|
298
373
|
title="${t.title||""}"
|
|
@@ -320,7 +395,7 @@ var x=function(t,r,i,o){for(var e,s=arguments.length,n=s<3?r:null===o?o=Object.g
|
|
|
320
395
|
<span>${t.message}</span>
|
|
321
396
|
</div>`:o}
|
|
322
397
|
</div>
|
|
323
|
-
`)
|
|
398
|
+
`)}
|
|
324
399
|
</div>
|
|
325
400
|
`}renderButtonsWithSlots(){return i`
|
|
326
401
|
<div
|
|
@@ -329,7 +404,7 @@ var x=function(t,r,i,o){for(var e,s=arguments.length,n=s<3?r:null===o?o=Object.g
|
|
|
329
404
|
aria-labelledby="radio-group-label"
|
|
330
405
|
@keydown="${this.handleKeyDown}"
|
|
331
406
|
>
|
|
332
|
-
${this.options.map((
|
|
407
|
+
${this.options.map((t,r)=>i`
|
|
333
408
|
<nr-button
|
|
334
409
|
class="${this.isOptionSelected(t)?"selected":""}"
|
|
335
410
|
type="${this.isOptionSelected(t)?"primary":"default"}"
|
|
@@ -347,6 +422,9 @@ var x=function(t,r,i,o){for(var e,s=arguments.length,n=s<3?r:null===o?o=Object.g
|
|
|
347
422
|
<nr-icon name="${"error"===t.state?"exclamation-circle":"warning"}"></nr-icon>
|
|
348
423
|
<span>${t.message}</span>
|
|
349
424
|
</div>`:o}
|
|
350
|
-
`)
|
|
425
|
+
`)}
|
|
351
426
|
</div>
|
|
352
|
-
`}render(){return i
|
|
427
|
+
`}render(){return i`
|
|
428
|
+
${a(this.type,[[v.Default,()=>this.renderOptionDefault()],[v.Button,()=>this.renderOptionsWithButtons()],[v.Slot,()=>this.renderOptionsWithSlots()],[v.ButtonSlot,()=>this.renderButtonsWithSlots()]])}
|
|
429
|
+
<slot name="helper-text"></slot>
|
|
430
|
+
`}};$.styles=y,x([e({type:Array})],$.prototype,"options",void 0),x([e({type:String,attribute:"default-value"})],$.prototype,"defaultValue",void 0),x([e({type:String})],$.prototype,"value",void 0),x([e({type:String})],$.prototype,"name",void 0),x([e({type:String})],$.prototype,"direction",void 0),x([e({type:String})],$.prototype,"type",void 0),x([e({type:Boolean})],$.prototype,"required",void 0),x([e({type:Boolean})],$.prototype,"disabled",void 0),x([e({type:String})],$.prototype,"size",void 0),x([e({type:String})],$.prototype,"position",void 0),x([e({type:Boolean,attribute:"auto-width"})],$.prototype,"autoWidth",void 0),x([e({type:String})],$.prototype,"helper",void 0),$=x([n("nr-radio-group")],$);export{$ as NrRadioGroupElement,g as RadioButtonDirection,m as RadioButtonPosition,f as RadioButtonSize,v as RadioButtonType,w as RadioButtonVariant};
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["
|
|
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
CHANGED
|
@@ -32,9 +32,22 @@ declare const NrRadioGroupElement_base: (new (...args: any[]) => import("@nuraly
|
|
|
32
32
|
* default-value="option1"
|
|
33
33
|
* direction="horizontal">
|
|
34
34
|
* </nr-radio-group>
|
|
35
|
+
*
|
|
36
|
+
* <!-- Button style with auto-width -->
|
|
37
|
+
* <nr-radio-group
|
|
38
|
+
* type="button"
|
|
39
|
+
* auto-width
|
|
40
|
+
* .options='[
|
|
41
|
+
* { value: "yes", label: "Yes" },
|
|
42
|
+
* { value: "no", label: "No" },
|
|
43
|
+
* { value: "maybe", label: "Maybe" }
|
|
44
|
+
* ]'>
|
|
45
|
+
* </nr-radio-group>
|
|
35
46
|
* ```
|
|
36
47
|
*
|
|
37
48
|
* @fires nr-change - Dispatched when the selected option changes
|
|
49
|
+
*
|
|
50
|
+
* @slot helper-text - Helper text displayed below the radio group
|
|
38
51
|
*/
|
|
39
52
|
export declare class NrRadioGroupElement extends NrRadioGroupElement_base {
|
|
40
53
|
static styles: import("lit").CSSResult;
|
|
@@ -49,6 +62,8 @@ export declare class NrRadioGroupElement extends NrRadioGroupElement_base {
|
|
|
49
62
|
disabled: boolean;
|
|
50
63
|
size: 'small' | 'medium' | 'large';
|
|
51
64
|
position: 'left' | 'right';
|
|
65
|
+
autoWidth: boolean;
|
|
66
|
+
helper: string;
|
|
52
67
|
private groupController;
|
|
53
68
|
private keyboardController;
|
|
54
69
|
private focusController;
|
|
@@ -66,6 +81,10 @@ export declare class NrRadioGroupElement extends NrRadioGroupElement_base {
|
|
|
66
81
|
* Check if an option is disabled - DELEGATES to controller
|
|
67
82
|
*/
|
|
68
83
|
isOptionDisabled(option: RadioButtonOption): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* Check if an option is icon-only (has icon but no meaningful label)
|
|
86
|
+
*/
|
|
87
|
+
isOptionIconOnly(option: RadioButtonOption): boolean;
|
|
69
88
|
/**
|
|
70
89
|
* Handle option selection change - DELEGATES to controller
|
|
71
90
|
*/
|
|
@@ -140,7 +159,7 @@ export declare class NrRadioGroupElement extends NrRadioGroupElement_base {
|
|
|
140
159
|
* Render button style with slots
|
|
141
160
|
*/
|
|
142
161
|
private renderButtonsWithSlots;
|
|
143
|
-
protected render(): import("lit").TemplateResult<1>;
|
|
162
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
144
163
|
}
|
|
145
164
|
export {};
|
|
146
165
|
//# sourceMappingURL=radio-group.component.d.ts.map
|
package/radio-group.component.js
CHANGED
|
@@ -43,9 +43,22 @@ import { RadioButtonType } from './radio-group.types.js';
|
|
|
43
43
|
* default-value="option1"
|
|
44
44
|
* direction="horizontal">
|
|
45
45
|
* </nr-radio-group>
|
|
46
|
+
*
|
|
47
|
+
* <!-- Button style with auto-width -->
|
|
48
|
+
* <nr-radio-group
|
|
49
|
+
* type="button"
|
|
50
|
+
* auto-width
|
|
51
|
+
* .options='[
|
|
52
|
+
* { value: "yes", label: "Yes" },
|
|
53
|
+
* { value: "no", label: "No" },
|
|
54
|
+
* { value: "maybe", label: "Maybe" }
|
|
55
|
+
* ]'>
|
|
56
|
+
* </nr-radio-group>
|
|
46
57
|
* ```
|
|
47
58
|
*
|
|
48
59
|
* @fires nr-change - Dispatched when the selected option changes
|
|
60
|
+
*
|
|
61
|
+
* @slot helper-text - Helper text displayed below the radio group
|
|
49
62
|
*/
|
|
50
63
|
let NrRadioGroupElement = class NrRadioGroupElement extends NuralyUIBaseMixin(LitElement) {
|
|
51
64
|
constructor() {
|
|
@@ -62,6 +75,8 @@ let NrRadioGroupElement = class NrRadioGroupElement extends NuralyUIBaseMixin(Li
|
|
|
62
75
|
this.disabled = false;
|
|
63
76
|
this.size = 'medium';
|
|
64
77
|
this.position = 'left';
|
|
78
|
+
this.autoWidth = false;
|
|
79
|
+
this.helper = '';
|
|
65
80
|
// Reactive Controllers - PROPERLY implemented now
|
|
66
81
|
this.groupController = new RadioGroupController(this);
|
|
67
82
|
// @ts-ignore - Controller handles events through listeners, doesn't need direct reference
|
|
@@ -89,6 +104,12 @@ let NrRadioGroupElement = class NrRadioGroupElement extends NuralyUIBaseMixin(Li
|
|
|
89
104
|
isOptionDisabled(option) {
|
|
90
105
|
return this.groupController.isOptionDisabled(option);
|
|
91
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* Check if an option is icon-only (has icon but no meaningful label)
|
|
109
|
+
*/
|
|
110
|
+
isOptionIconOnly(option) {
|
|
111
|
+
return !!(option.icon && (!option.label || option.label.trim() === ''));
|
|
112
|
+
}
|
|
92
113
|
/**
|
|
93
114
|
* Handle option selection change - DELEGATES to controller
|
|
94
115
|
*/
|
|
@@ -235,14 +256,22 @@ let NrRadioGroupElement = class NrRadioGroupElement extends NuralyUIBaseMixin(Li
|
|
|
235
256
|
aria-labelledby="radio-group-label"
|
|
236
257
|
@keydown="${this.handleKeyDown}"
|
|
237
258
|
>
|
|
238
|
-
${this.options.map((option, index) =>
|
|
259
|
+
${this.options.map((option, index) => {
|
|
260
|
+
const isSelected = this.isOptionSelected(option);
|
|
261
|
+
const isIconOnly = this.isOptionIconOnly(option);
|
|
262
|
+
const classes = [
|
|
263
|
+
isSelected ? 'selected' : '',
|
|
264
|
+
isIconOnly && this.autoWidth ? 'icon-only' : ''
|
|
265
|
+
].filter(Boolean).join(' ');
|
|
266
|
+
return html `
|
|
239
267
|
<nr-button
|
|
240
|
-
class="${
|
|
241
|
-
type="${
|
|
268
|
+
class="${classes}"
|
|
269
|
+
type="${isSelected ? "primary" /* ButtonType.Primary */ : "default" /* ButtonType.Default */}"
|
|
270
|
+
size="${this.size}"
|
|
242
271
|
role="radio"
|
|
243
|
-
aria-checked="${
|
|
272
|
+
aria-checked="${isSelected}"
|
|
244
273
|
aria-describedby="${option.state && option.message ? `${option.value}-message` : nothing}"
|
|
245
|
-
tabindex="${
|
|
274
|
+
tabindex="${isSelected ? '0' : '-1'}"
|
|
246
275
|
.icon="${option.icon ? [option.icon] : []}"
|
|
247
276
|
.disabled="${this.isOptionDisabled(option)}"
|
|
248
277
|
@click="${() => this.handleSelectionChange(option)}"
|
|
@@ -251,12 +280,13 @@ let NrRadioGroupElement = class NrRadioGroupElement extends NuralyUIBaseMixin(Li
|
|
|
251
280
|
${option.label}
|
|
252
281
|
</nr-button>
|
|
253
282
|
${option.state && option.message
|
|
254
|
-
|
|
283
|
+
? html `<div class="message-container" id="${option.value}-message">
|
|
255
284
|
<nr-icon name="${option.state === 'error' ? 'exclamation-circle' : 'warning'}"></nr-icon>
|
|
256
285
|
<span>${option.message}</span>
|
|
257
286
|
</div>`
|
|
258
|
-
|
|
259
|
-
|
|
287
|
+
: nothing}
|
|
288
|
+
`;
|
|
289
|
+
})}
|
|
260
290
|
</div>
|
|
261
291
|
`;
|
|
262
292
|
}
|
|
@@ -352,12 +382,15 @@ let NrRadioGroupElement = class NrRadioGroupElement extends NuralyUIBaseMixin(Li
|
|
|
352
382
|
`;
|
|
353
383
|
}
|
|
354
384
|
render() {
|
|
355
|
-
return html
|
|
385
|
+
return html `
|
|
386
|
+
${choose(this.type, [
|
|
356
387
|
[RadioButtonType.Default, () => this.renderOptionDefault()],
|
|
357
388
|
[RadioButtonType.Button, () => this.renderOptionsWithButtons()],
|
|
358
389
|
[RadioButtonType.Slot, () => this.renderOptionsWithSlots()],
|
|
359
|
-
[
|
|
360
|
-
])}
|
|
390
|
+
[RadioButtonType.ButtonSlot, () => this.renderButtonsWithSlots()], // Special case for button with slots
|
|
391
|
+
])}
|
|
392
|
+
<slot name="helper-text"></slot>
|
|
393
|
+
`;
|
|
361
394
|
}
|
|
362
395
|
};
|
|
363
396
|
NrRadioGroupElement.styles = styles;
|
|
@@ -391,6 +424,12 @@ __decorate([
|
|
|
391
424
|
__decorate([
|
|
392
425
|
property({ type: String })
|
|
393
426
|
], NrRadioGroupElement.prototype, "position", void 0);
|
|
427
|
+
__decorate([
|
|
428
|
+
property({ type: Boolean, attribute: 'auto-width' })
|
|
429
|
+
], NrRadioGroupElement.prototype, "autoWidth", void 0);
|
|
430
|
+
__decorate([
|
|
431
|
+
property({ type: String })
|
|
432
|
+
], NrRadioGroupElement.prototype, "helper", void 0);
|
|
394
433
|
NrRadioGroupElement = __decorate([
|
|
395
434
|
customElement('nr-radio-group')
|
|
396
435
|
], NrRadioGroupElement);
|
|
@@ -1 +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,OAAO,EAAE,iB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Q,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;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\nimport { NuralyUIBaseMixin } from '@nuralyui/common/mixins';\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"]}
|
|
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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IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAqC;AACV;IAArD,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;sDAA4B;AACrD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAqB;AAjBrC,mBAAmB;IAD/B,aAAa,CAAC,gBAAgB,CAAC;GACnB,mBAAmB,CA4W/B;SA5WY,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\nimport { NuralyUIBaseMixin } from '@nuralyui/common/mixins';\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 * <!-- Button style with auto-width -->\n * <nr-radio-group\n * type=\"button\"\n * auto-width\n * .options='[\n * { value: \"yes\", label: \"Yes\" },\n * { value: \"no\", label: \"No\" },\n * { value: \"maybe\", label: \"Maybe\" }\n * ]'>\n * </nr-radio-group>\n * ```\n * \n * @fires nr-change - Dispatched when the selected option changes\n * \n * @slot helper-text - Helper text displayed below the radio group\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 @property({ type: Boolean, attribute: 'auto-width' }) autoWidth: boolean = false;\n @property({ type: String }) helper: string = '';\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 * Check if an option is icon-only (has icon but no meaningful label)\n */\n isOptionIconOnly(option: RadioButtonOption): boolean {\n return !!(option.icon && (!option.label || option.label.trim() === ''));\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) => {\n const isSelected = this.isOptionSelected(option);\n const isIconOnly = this.isOptionIconOnly(option);\n const classes = [\n isSelected ? 'selected' : '',\n isIconOnly && this.autoWidth ? 'icon-only' : ''\n ].filter(Boolean).join(' ');\n\n return html`\n <nr-button\n class=\"${classes}\"\n type=\"${isSelected ? ButtonType.Primary : ButtonType.Default}\"\n size=\"${this.size}\"\n role=\"radio\"\n aria-checked=\"${isSelected}\"\n aria-describedby=\"${option.state && option.message ? `${option.value}-message` : nothing}\"\n tabindex=\"${isSelected ? '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`\n ${choose(this.type, [\n [RadioButtonType.Default, () => this.renderOptionDefault()],\n [RadioButtonType.Button, () => this.renderOptionsWithButtons()],\n [RadioButtonType.Slot, () => this.renderOptionsWithSlots()],\n [RadioButtonType.ButtonSlot, () => this.renderButtonsWithSlots()], // Special case for button with slots\n ])}\n <slot name=\"helper-text\"></slot>\n `;\n }\n}\n"]}
|
package/radio-group.style.js
CHANGED
|
@@ -161,6 +161,57 @@ export const styles = css `
|
|
|
161
161
|
--nuraly-icon-local-color: var(--nuraly-button-primary-disabled-text-color, var(--nuraly-button-local-primary-disabled-text-color));
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
/* ========================================
|
|
165
|
+
* AUTO WIDTH STYLING
|
|
166
|
+
* ======================================== */
|
|
167
|
+
|
|
168
|
+
:host([auto-width]) .type-button nr-button {
|
|
169
|
+
--nuraly-button-min-width: 40px;
|
|
170
|
+
min-width: auto;
|
|
171
|
+
width: auto;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/* Ensure minimum padding for auto-width buttons to prevent them from becoming too small */
|
|
175
|
+
:host([auto-width]) .type-button nr-button button {
|
|
176
|
+
min-width: auto;
|
|
177
|
+
padding-left: max(var(--nuraly-spacing-2), 0.5rem);
|
|
178
|
+
padding-right: max(var(--nuraly-spacing-2), 0.5rem);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/* Icon-only buttons with auto-width should have minimal but adequate padding */
|
|
182
|
+
:host([auto-width]) .type-button nr-button.icon-only {
|
|
183
|
+
padding: 0.375rem; /* Even more minimal padding for icon-only */
|
|
184
|
+
min-width: auto;
|
|
185
|
+
width: auto;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
:host([auto-width]) .type-button nr-button.icon-only button {
|
|
189
|
+
padding: max(0.375rem, var(--nuraly-spacing-2)); /* Ensure minimum 6px padding for icon-only */
|
|
190
|
+
min-width: auto;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/* For small size buttons, use proportionally smaller but still adequate padding */
|
|
194
|
+
:host([auto-width]) .type-button nr-button[size="small"] button {
|
|
195
|
+
padding-left: max(var(--nuraly-spacing-1-5), 0.375rem);
|
|
196
|
+
padding-right: max(var(--nuraly-spacing-1-5), 0.375rem);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/* For small size icon-only buttons, use even less but still minimum padding */
|
|
200
|
+
:host([auto-width]) .type-button nr-button.icon-only[size="small"] button {
|
|
201
|
+
padding: max(0.25rem, var(--nuraly-spacing-1-5));
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/* For large size buttons, maintain larger minimum padding */
|
|
205
|
+
:host([auto-width]) .type-button nr-button[size="large"] button {
|
|
206
|
+
padding-left: max(var(--nuraly-spacing-4), 0.75rem);
|
|
207
|
+
padding-right: max(var(--nuraly-spacing-4), 0.75rem);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/* For large size icon-only buttons, use proportionally larger padding */
|
|
211
|
+
:host([auto-width]) .type-button nr-button.icon-only[size="large"] button {
|
|
212
|
+
padding: max(0.5rem, var(--nuraly-spacing-3));
|
|
213
|
+
}
|
|
214
|
+
|
|
164
215
|
/* ========================================
|
|
165
216
|
* SLOT-BASED RADIO STYLING
|
|
166
217
|
* ======================================== */
|
|
@@ -192,5 +243,28 @@ export const styles = css `
|
|
|
192
243
|
.slot-container.selected .slot-wrapper {
|
|
193
244
|
background-color: var(--nuraly-radio-group-slot-selected-bg);
|
|
194
245
|
}
|
|
246
|
+
|
|
247
|
+
/* ========================================
|
|
248
|
+
* HELPER TEXT SLOT STYLING
|
|
249
|
+
* ======================================== */
|
|
250
|
+
|
|
251
|
+
::slotted([slot='helper-text']) {
|
|
252
|
+
color: var(--nuraly-input-helper-text-color, var(--nuraly-helper-text-color, #8c8c8c));
|
|
253
|
+
font-size: var(--nuraly-input-helper-text-font-size, var(--nuraly-helper-text-font-size, 12px));
|
|
254
|
+
padding-top: var(--nuraly-input-helper-text-padding-top, var(--nuraly-helper-text-padding-top, 4px));
|
|
255
|
+
|
|
256
|
+
/* Prevent text overflow and ensure proper wrapping without affecting parent width */
|
|
257
|
+
word-wrap: break-word;
|
|
258
|
+
word-break: break-word;
|
|
259
|
+
overflow-wrap: break-word;
|
|
260
|
+
hyphens: auto;
|
|
261
|
+
white-space: normal;
|
|
262
|
+
max-width: 100%;
|
|
263
|
+
width: 0;
|
|
264
|
+
min-width: 100%;
|
|
265
|
+
box-sizing: border-box;
|
|
266
|
+
line-height: 1.4;
|
|
267
|
+
display: block;
|
|
268
|
+
}
|
|
195
269
|
`;
|
|
196
270
|
//# sourceMappingURL=radio-group.style.js.map
|
package/radio-group.style.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.style.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"radio-group.style.js","sourceRoot":"","sources":["../../../../src/components/radio-group/radio-group.style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsQxB,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Nuraly, Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport { css } from 'lit';\n\nexport const styles = css`\n :host {\n /* ========================================\n * CSS CUSTOM PROPERTIES - RADIO GROUP\n * ======================================== */\n \n /* Group Layout */\n --nuraly-radio-group-gap: 12px;\n --nuraly-radio-group-horizontal-gap: 16px;\n\n /* Colors - Error/Warning states */\n --nuraly-radio-group-error-icon-color: var(--nuraly-color-radio-error-icon, #ef4444);\n --nuraly-radio-group-error-text-color: var(--nuraly-color-radio-error-text, #ef4444);\n --nuraly-radio-group-warning-icon-color: var(--nuraly-color-radio-warning-icon, #f59e0b);\n --nuraly-radio-group-warning-text-color: var(--nuraly-color-radio-warning-text, #f59e0b);\n\n /* Typography */\n --nuraly-radio-group-font-family: var(--nuraly-font-family-radio, Inter, ui-sans-serif, system-ui, -apple-system, \"Segoe UI\", Roboto, Ubuntu, Cantarell, \"Noto Sans\", sans-serif);\n --nuraly-radio-group-message-font-size: var(--nuraly-font-size-radio-message, 12px);\n\n /* Button type styling */\n --nuraly-radio-group-button-border-radius: 4px;\n --nuraly-radio-group-button-hover-color: var(--nuraly-color-radio-border-hover, #7c3aed);\n\n /* Slot container styling */\n --nuraly-radio-group-slot-hover-bg: rgba(124, 58, 237, 0.04);\n --nuraly-radio-group-slot-selected-bg: rgba(124, 58, 237, 0.08);\n --nuraly-radio-group-slot-border-radius: 6px;\n\n /* ========================================\n * COMPONENT STYLES\n * ======================================== */\n \n width: fit-content;\n display: block;\n font-family: var(--nuraly-radio-group-font-family);\n }\n\n /* ========================================\n * RADIO GROUP LAYOUT\n * ======================================== */\n\n .radio-group {\n display: flex;\n flex-direction: column;\n gap: var(--nuraly-radio-group-gap);\n }\n\n .radio-group.horizontal {\n flex-direction: row;\n flex-wrap: wrap;\n gap: var(--nuraly-radio-group-horizontal-gap);\n }\n\n .radio-wrapper {\n display: flex;\n flex-direction: column;\n gap: 4px;\n }\n\n /* ========================================\n * MESSAGE CONTAINERS (Error/Warning)\n * ======================================== */\n\n .radio-wrapper .message-container {\n display: flex;\n align-items: center;\n gap: 6px;\n font-size: var(--nuraly-radio-group-message-font-size);\n padding-left: 28px; /* Align with radio label */\n }\n\n nr-icon {\n display: flex;\n }\n\n .radio-wrapper.error nr-icon {\n --nuraly-icon-color: var(--nuraly-radio-group-error-icon-color);\n }\n\n .radio-wrapper.warning nr-icon {\n --nuraly-icon-color: var(--nuraly-radio-group-warning-icon-color);\n }\n\n .radio-wrapper.error .message-container {\n color: var(--nuraly-radio-group-error-text-color);\n }\n\n .radio-wrapper.warning .message-container {\n color: var(--nuraly-radio-group-warning-text-color);\n }\n\n /* ========================================\n * BUTTON TYPE STYLING\n * ======================================== */\n\n .type-button {\n display: inline-flex;\n gap: 0px;\n }\n\n /* Button border radius for first and last child */\n .type-button :first-child {\n --nuraly-button-border-top-left-radius: var(--nuraly-radio-group-button-border-radius);\n --nuraly-button-border-bottom-left-radius: var(--nuraly-radio-group-button-border-radius);\n }\n\n .type-button :last-child {\n --nuraly-button-border-top-right-radius: var(--nuraly-radio-group-button-border-radius);\n --nuraly-button-border-bottom-right-radius: var(--nuraly-radio-group-button-border-radius);\n }\n\n .type-button nr-button:not(:last-child) {\n margin-right: -1px;\n }\n\n .type-button nr-button {\n position: relative;\n z-index: 1;\n }\n\n .type-button nr-button[type=\"default\"]:hover {\n --nuraly-button-color: var(--nuraly-radio-group-button-hover-color);\n --nuraly-button-border-color: var(--nuraly-radio-group-button-hover-color);\n z-index: 2;\n }\n\n .type-button nr-button[type=\"primary\"] {\n z-index: 1;\n position: relative;\n }\n\n /* Disabled button states */\n .type-button nr-button[disabled] {\n opacity: 0.6;\n cursor: not-allowed;\n pointer-events: none;\n }\n\n .type-button nr-button[disabled]:hover {\n z-index: auto;\n --nuraly-button-border-color: var(--nuraly-button-disabled-border-color, var(--nuraly-button-local-disabled-border-color));\n --nuraly-button-background-color: var(--nuraly-button-disabled-background-color, var(--nuraly-button-local-disabled-background-color));\n --nuraly-button-color: var(--nuraly-button-disabled-text-color, var(--nuraly-button-local-disabled-text-color));\n }\n\n .type-button nr-button[type=\"primary\"][disabled] {\n --nuraly-button-background-color: var(--nuraly-button-primary-disabled-background-color, var(--nuraly-button-local-primary-disabled-background-color));\n --nuraly-button-border-color: var(--nuraly-button-primary-disabled-border-color, var(--nuraly-button-local-primary-disabled-border-color));\n --nuraly-button-color: var(--nuraly-button-primary-disabled-text-color, var(--nuraly-button-local-primary-disabled-text-color));\n }\n\n .type-button nr-button[type=\"primary\"][disabled] nr-icon {\n --nuraly-icon-color: var(--nuraly-button-primary-disabled-text-color, var(--nuraly-button-local-primary-disabled-text-color));\n --nuraly-icon-local-color: var(--nuraly-button-primary-disabled-text-color, var(--nuraly-button-local-primary-disabled-text-color));\n }\n\n /* ========================================\n * AUTO WIDTH STYLING\n * ======================================== */\n\n :host([auto-width]) .type-button nr-button {\n --nuraly-button-min-width: 40px;\n min-width: auto;\n width: auto;\n }\n\n /* Ensure minimum padding for auto-width buttons to prevent them from becoming too small */\n :host([auto-width]) .type-button nr-button button {\n min-width: auto;\n padding-left: max(var(--nuraly-spacing-2), 0.5rem);\n padding-right: max(var(--nuraly-spacing-2), 0.5rem);\n }\n\n /* Icon-only buttons with auto-width should have minimal but adequate padding */\n :host([auto-width]) .type-button nr-button.icon-only {\n padding: 0.375rem; /* Even more minimal padding for icon-only */\n min-width: auto;\n width: auto;\n }\n\n :host([auto-width]) .type-button nr-button.icon-only button {\n padding: max(0.375rem, var(--nuraly-spacing-2)); /* Ensure minimum 6px padding for icon-only */\n min-width: auto;\n }\n\n /* For small size buttons, use proportionally smaller but still adequate padding */\n :host([auto-width]) .type-button nr-button[size=\"small\"] button {\n padding-left: max(var(--nuraly-spacing-1-5), 0.375rem);\n padding-right: max(var(--nuraly-spacing-1-5), 0.375rem);\n }\n\n /* For small size icon-only buttons, use even less but still minimum padding */\n :host([auto-width]) .type-button nr-button.icon-only[size=\"small\"] button {\n padding: max(0.25rem, var(--nuraly-spacing-1-5));\n }\n\n /* For large size buttons, maintain larger minimum padding */\n :host([auto-width]) .type-button nr-button[size=\"large\"] button {\n padding-left: max(var(--nuraly-spacing-4), 0.75rem);\n padding-right: max(var(--nuraly-spacing-4), 0.75rem);\n }\n\n /* For large size icon-only buttons, use proportionally larger padding */\n :host([auto-width]) .type-button nr-button.icon-only[size=\"large\"] button {\n padding: max(0.5rem, var(--nuraly-spacing-3));\n }\n\n /* ========================================\n * SLOT-BASED RADIO STYLING\n * ======================================== */\n\n .slot-wrapper {\n display: flex;\n align-items: flex-start;\n gap: 12px;\n cursor: pointer;\n transition: all 0.2s ease;\n padding: 8px;\n border-radius: var(--nuraly-radio-group-slot-border-radius);\n }\n\n .slot-wrapper:hover {\n background-color: var(--nuraly-radio-group-slot-hover-bg);\n }\n\n .slot-wrapper nr-radio {\n flex-shrink: 0;\n margin-top: 2px;\n }\n\n .slot-wrapper .slot-content {\n flex: 1;\n min-width: 0;\n }\n\n .slot-container.selected .slot-wrapper {\n background-color: var(--nuraly-radio-group-slot-selected-bg);\n }\n\n /* ========================================\n * HELPER TEXT SLOT STYLING\n * ======================================== */\n\n ::slotted([slot='helper-text']) {\n color: var(--nuraly-input-helper-text-color, var(--nuraly-helper-text-color, #8c8c8c));\n font-size: var(--nuraly-input-helper-text-font-size, var(--nuraly-helper-text-font-size, 12px));\n padding-top: var(--nuraly-input-helper-text-padding-top, var(--nuraly-helper-text-padding-top, 4px));\n \n /* Prevent text overflow and ensure proper wrapping without affecting parent width */\n word-wrap: break-word;\n word-break: break-word;\n overflow-wrap: break-word;\n hyphens: auto;\n white-space: normal;\n max-width: 100%;\n width: 0;\n min-width: 100%;\n box-sizing: border-box;\n line-height: 1.4;\n display: block;\n }\n`;\n"]}
|
package/radio-group.types.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare type RadioButtonOption = {
|
|
|
10
10
|
style?: string;
|
|
11
11
|
title?: string;
|
|
12
12
|
id?: string;
|
|
13
|
+
autoWidth?: boolean;
|
|
13
14
|
};
|
|
14
15
|
export declare type RadioButtonState = 'error' | 'warning';
|
|
15
16
|
export declare enum RadioButtonDirection {
|
|
@@ -23,7 +24,8 @@ export declare enum RadioButtonPosition {
|
|
|
23
24
|
export declare enum RadioButtonType {
|
|
24
25
|
Default = "default",
|
|
25
26
|
Button = "button",
|
|
26
|
-
Slot = "slot"
|
|
27
|
+
Slot = "slot",
|
|
28
|
+
ButtonSlot = "button-slot"
|
|
27
29
|
}
|
|
28
30
|
export declare enum RadioButtonSize {
|
|
29
31
|
Small = "small",
|
package/radio-group.types.js
CHANGED
|
@@ -13,6 +13,7 @@ export var RadioButtonType;
|
|
|
13
13
|
RadioButtonType["Default"] = "default";
|
|
14
14
|
RadioButtonType["Button"] = "button";
|
|
15
15
|
RadioButtonType["Slot"] = "slot";
|
|
16
|
+
RadioButtonType["ButtonSlot"] = "button-slot";
|
|
16
17
|
})(RadioButtonType || (RadioButtonType = {}));
|
|
17
18
|
export var RadioButtonSize;
|
|
18
19
|
(function (RadioButtonSize) {
|
package/radio-group.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio-group.types.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"radio-group.types.js","sourceRoot":"","sources":["../../../../src/components/radio-group/radio-group.types.ts"],"names":[],"mappings":"AAiBA,MAAM,CAAN,IAAY,oBAGX;AAHD,WAAY,oBAAoB;IAC9B,iDAAyB,CAAA;IACzB,6CAAqB,CAAA;AACvB,CAAC,EAHW,oBAAoB,KAApB,oBAAoB,QAG/B;AAED,MAAM,CAAN,IAAY,mBAGX;AAHD,WAAY,mBAAmB;IAC7B,oCAAa,CAAA;IACb,sCAAe,CAAA;AACjB,CAAC,EAHW,mBAAmB,KAAnB,mBAAmB,QAG9B;AAED,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,sCAAmB,CAAA;IACnB,oCAAiB,CAAA;IACjB,gCAAa,CAAA;IACb,6CAA0B,CAAA;AAC5B,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B;AAED,MAAM,CAAN,IAAY,eAIX;AAJD,WAAY,eAAe;IACzB,kCAAe,CAAA;IACf,oCAAiB,CAAA;IACjB,kCAAe,CAAA;AACjB,CAAC,EAJW,eAAe,KAAf,eAAe,QAI1B;AAED,MAAM,CAAN,IAAY,kBAGX;AAHD,WAAY,kBAAkB;IAC5B,yCAAmB,CAAA;IACnB,qCAAe,CAAA;AACjB,CAAC,EAHW,kBAAkB,KAAlB,kBAAkB,QAG7B","sourcesContent":["export type RadioButtonOption = {\n value: string;\n label: string;\n icon?: string;\n disabled?: boolean;\n state?: RadioButtonState;\n message?: string;\n htmlContent?: string; // Support for HTML content instead of plain label\n className?: string; // Custom CSS class for the option\n style?: string; // Inline styles for the option\n title?: string; // Tooltip text\n id?: string; // Custom ID for the option\n autoWidth?: boolean; // Override global auto-width setting for this specific option\n};\n\nexport type RadioButtonState = 'error' | 'warning';\n\nexport enum RadioButtonDirection {\n Horizontal = 'horizontal',\n Vertical = 'vertical',\n}\n\nexport enum RadioButtonPosition {\n Left = 'left',\n Right = 'right',\n}\n\nexport enum RadioButtonType {\n Default = 'default',\n Button = 'button',\n Slot = 'slot',\n ButtonSlot = 'button-slot',\n}\n\nexport enum RadioButtonSize {\n Small = 'small',\n Medium = 'medium',\n Large = 'large',\n}\n\nexport enum RadioButtonVariant {\n Default = 'default',\n Solid = 'solid',\n}\n"]}
|
package/radio.constant.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"radio.constant.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"radio.constant.js","sourceRoot":"","sources":["../../../../src/components/radio-group/radio.constant.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC","sourcesContent":["export const EMPTY_STRING = '';\n"]}
|
package/react.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"react.js","sourceRoot":"","sources":["../../../../src/components/radio-group/react.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAEjE,MAAM,CAAC,MAAM,YAAY,GAAG,eAAe,CAAC;IAC1C,OAAO,EAAE,gBAAgB;IACzB,YAAY,EAAE,mBAAmB;IACjC,KAAK,EAAE,KAAK;IACZ,MAAM,EAAE;QACN,SAAS,EAAE,WAAW;KACvB;CACF,CAAC,CAAC","sourcesContent":["/**\n * @license\n * Copyright 2023 Google Laabidi Aymen\n * SPDX-License-Identifier: MIT\n */\n\nimport React from 'react';\nimport { createComponent } from '@lit-labs/react';\nimport { NrRadioGroupElement } from './radio-group.component.js';\n\nexport const NrRadioGroup = createComponent({\n tagName: 'nr-radio-group',\n elementClass: NrRadioGroupElement,\n react: React,\n events: {\n onChanged: 'nr-change'\n }\n});\n"]}
|