@ng-primitives/mcp 0.123.1 → 0.124.0
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/package.json
CHANGED
|
@@ -2829,8 +2829,14 @@
|
|
|
2829
2829
|
"inputs": [
|
|
2830
2830
|
{
|
|
2831
2831
|
"name": "ngpRadioGroupValue",
|
|
2832
|
+
"type": "T | null | undefined",
|
|
2833
|
+
"description": "The value of the radio group. Leave unset for uncontrolled usage.",
|
|
2834
|
+
"isRequired": false
|
|
2835
|
+
},
|
|
2836
|
+
{
|
|
2837
|
+
"name": "ngpRadioGroupDefaultValue",
|
|
2832
2838
|
"type": "T | null",
|
|
2833
|
-
"description": "The value of the radio group.",
|
|
2839
|
+
"description": "The default value of the radio group for uncontrolled usage.",
|
|
2834
2840
|
"isRequired": false,
|
|
2835
2841
|
"defaultValue": "null"
|
|
2836
2842
|
},
|
|
@@ -1295,10 +1295,16 @@
|
|
|
1295
1295
|
"exports": [
|
|
1296
1296
|
"NgpRadioGroup",
|
|
1297
1297
|
"injectRadioGroupState",
|
|
1298
|
+
"ngpRadioGroup",
|
|
1299
|
+
"NgpRadioGroupProps",
|
|
1300
|
+
"NgpRadioGroupState",
|
|
1298
1301
|
"provideRadioGroupState",
|
|
1299
1302
|
"NgpRadioIndicator",
|
|
1300
1303
|
"NgpRadioItem",
|
|
1301
1304
|
"injectRadioItemState",
|
|
1305
|
+
"ngpRadioItem",
|
|
1306
|
+
"NgpRadioItemProps",
|
|
1307
|
+
"NgpRadioItemState",
|
|
1302
1308
|
"provideRadioItemState"
|
|
1303
1309
|
],
|
|
1304
1310
|
"hasSecondaryEntryPoint": true,
|
|
@@ -1315,7 +1321,7 @@
|
|
|
1315
1321
|
}
|
|
1316
1322
|
],
|
|
1317
1323
|
"reusableComponent": {
|
|
1318
|
-
"code": "import { Component } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { injectRadioGroupState, NgpRadioGroup } from 'ng-primitives/radio';\nimport {
|
|
1324
|
+
"code": "import { Component } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { injectRadioGroupState, NgpRadioGroup } from 'ng-primitives/radio';\nimport {\n ChangeFn,\n provideValueAccessor,\n safeTakeUntilDestroyed,\n TouchedFn,\n} from 'ng-primitives/utils';\n\n@Component({\n selector: 'app-radio-group',\n hostDirectives: [\n {\n directive: NgpRadioGroup,\n inputs: [\n 'ngpRadioGroupValue:value',\n 'ngpRadioGroupDisabled:disabled',\n 'ngpRadioGroupOrientation:orientation',\n ],\n outputs: ['ngpRadioGroupValueChange:valueChange'],\n },\n ],\n providers: [provideValueAccessor(RadioGroup)],\n template: `\n <ng-content />\n `,\n styles: `\n :host {\n display: flex;\n flex-direction: column;\n row-gap: 1rem;\n }\n `,\n host: {\n '(focusout)': 'onTouched?.()',\n },\n})\nexport class RadioGroup implements ControlValueAccessor {\n /** Access the radio group state */\n protected readonly state = injectRadioGroupState<string>();\n\n /** The on change callback */\n private onChange?: ChangeFn<string | null>;\n\n /** The on touched callback */\n protected onTouched?: TouchedFn;\n\n constructor() {\n this.state()\n .valueChange.pipe(safeTakeUntilDestroyed())\n .subscribe(value => this.onChange?.(value));\n }\n\n /** Write a new value to the radio group */\n writeValue(value: string | null): void {\n this.state().setValue(value, { emit: false });\n }\n\n /** Register the on change callback */\n registerOnChange(onChange: ChangeFn<string | null>): void {\n this.onChange = onChange;\n }\n\n /** Register the on touched callback */\n registerOnTouched(onTouched: TouchedFn): void {\n this.onTouched = onTouched;\n }\n\n /** Set the disabled state of the radio group */\n setDisabledState(isDisabled: boolean): void {\n this.state().setDisabled(isDisabled);\n }\n}\n",
|
|
1319
1325
|
"hasVariants": false,
|
|
1320
1326
|
"hasSizes": false
|
|
1321
1327
|
}
|
|
@@ -141,7 +141,7 @@
|
|
|
141
141
|
},
|
|
142
142
|
{
|
|
143
143
|
"name": "radio",
|
|
144
|
-
"code": "import { Component } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { injectRadioGroupState, NgpRadioGroup } from 'ng-primitives/radio';\nimport {
|
|
144
|
+
"code": "import { Component } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { injectRadioGroupState, NgpRadioGroup } from 'ng-primitives/radio';\nimport {\n ChangeFn,\n provideValueAccessor,\n safeTakeUntilDestroyed,\n TouchedFn,\n} from 'ng-primitives/utils';\n\n@Component({\n selector: 'app-radio-group',\n hostDirectives: [\n {\n directive: NgpRadioGroup,\n inputs: [\n 'ngpRadioGroupValue:value',\n 'ngpRadioGroupDisabled:disabled',\n 'ngpRadioGroupOrientation:orientation',\n ],\n outputs: ['ngpRadioGroupValueChange:valueChange'],\n },\n ],\n providers: [provideValueAccessor(RadioGroup)],\n template: `\n <ng-content />\n `,\n styles: `\n :host {\n display: flex;\n flex-direction: column;\n row-gap: 1rem;\n }\n `,\n host: {\n '(focusout)': 'onTouched?.()',\n },\n})\nexport class RadioGroup implements ControlValueAccessor {\n /** Access the radio group state */\n protected readonly state = injectRadioGroupState<string>();\n\n /** The on change callback */\n private onChange?: ChangeFn<string | null>;\n\n /** The on touched callback */\n protected onTouched?: TouchedFn;\n\n constructor() {\n this.state()\n .valueChange.pipe(safeTakeUntilDestroyed())\n .subscribe(value => this.onChange?.(value));\n }\n\n /** Write a new value to the radio group */\n writeValue(value: string | null): void {\n this.state().setValue(value, { emit: false });\n }\n\n /** Register the on change callback */\n registerOnChange(onChange: ChangeFn<string | null>): void {\n this.onChange = onChange;\n }\n\n /** Register the on touched callback */\n registerOnTouched(onTouched: TouchedFn): void {\n this.onTouched = onTouched;\n }\n\n /** Set the disabled state of the radio group */\n setDisabledState(isDisabled: boolean): void {\n this.state().setDisabled(isDisabled);\n }\n}\n",
|
|
145
145
|
"primitive": "radio",
|
|
146
146
|
"hasVariants": false,
|
|
147
147
|
"hasSizes": false
|