@ng-primitives/mcp 0.125.0 → 0.126.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
|
@@ -2564,6 +2564,99 @@
|
|
|
2564
2564
|
}
|
|
2565
2565
|
]
|
|
2566
2566
|
},
|
|
2567
|
+
"NgpPasswordToggle": {
|
|
2568
|
+
"name": "NgpPasswordToggle",
|
|
2569
|
+
"description": "Apply the `ngpPasswordToggle` directive to a `button` element to toggle the visibility of the\npassword within an `ngpPassword` container.",
|
|
2570
|
+
"selector": "button[ngpPasswordToggle]",
|
|
2571
|
+
"exportAs": [
|
|
2572
|
+
"ngpPasswordToggle"
|
|
2573
|
+
],
|
|
2574
|
+
"inputs": [
|
|
2575
|
+
{
|
|
2576
|
+
"name": "ngpPasswordToggleShowLabel",
|
|
2577
|
+
"type": "string",
|
|
2578
|
+
"description": "The accessible label shown when the password is hidden.",
|
|
2579
|
+
"isRequired": false,
|
|
2580
|
+
"defaultValue": "'Show password'"
|
|
2581
|
+
},
|
|
2582
|
+
{
|
|
2583
|
+
"name": "ngpPasswordToggleHideLabel",
|
|
2584
|
+
"type": "string",
|
|
2585
|
+
"description": "The accessible label shown when the password is visible.",
|
|
2586
|
+
"isRequired": false,
|
|
2587
|
+
"defaultValue": "'Hide password'"
|
|
2588
|
+
},
|
|
2589
|
+
{
|
|
2590
|
+
"name": "ngpPasswordToggleShownAnnouncement",
|
|
2591
|
+
"type": "string",
|
|
2592
|
+
"description": "The message announced when the password becomes visible.",
|
|
2593
|
+
"isRequired": false,
|
|
2594
|
+
"defaultValue": "'Your password is shown'"
|
|
2595
|
+
},
|
|
2596
|
+
{
|
|
2597
|
+
"name": "ngpPasswordToggleHiddenAnnouncement",
|
|
2598
|
+
"type": "string",
|
|
2599
|
+
"description": "The message announced when the password becomes hidden.",
|
|
2600
|
+
"isRequired": false,
|
|
2601
|
+
"defaultValue": "'Your password is hidden'"
|
|
2602
|
+
}
|
|
2603
|
+
],
|
|
2604
|
+
"outputs": []
|
|
2605
|
+
},
|
|
2606
|
+
"NgpPassword": {
|
|
2607
|
+
"name": "NgpPassword",
|
|
2608
|
+
"description": "The `NgpPassword` directive is a container for a password field and its visibility toggle.",
|
|
2609
|
+
"selector": "[ngpPassword]",
|
|
2610
|
+
"exportAs": [
|
|
2611
|
+
"ngpPassword"
|
|
2612
|
+
],
|
|
2613
|
+
"inputs": [
|
|
2614
|
+
{
|
|
2615
|
+
"name": "ngpPasswordVisible",
|
|
2616
|
+
"type": "boolean | undefined",
|
|
2617
|
+
"description": "Whether the password is visible.",
|
|
2618
|
+
"isRequired": false
|
|
2619
|
+
},
|
|
2620
|
+
{
|
|
2621
|
+
"name": "ngpPasswordDefaultVisible",
|
|
2622
|
+
"type": "boolean",
|
|
2623
|
+
"description": "The default visibility state for uncontrolled usage.\n@default false",
|
|
2624
|
+
"isRequired": false,
|
|
2625
|
+
"defaultValue": "false"
|
|
2626
|
+
}
|
|
2627
|
+
],
|
|
2628
|
+
"outputs": [
|
|
2629
|
+
{
|
|
2630
|
+
"name": "ngpPasswordVisibleChange",
|
|
2631
|
+
"type": "boolean",
|
|
2632
|
+
"description": "Emits when the visibility state changes."
|
|
2633
|
+
}
|
|
2634
|
+
]
|
|
2635
|
+
},
|
|
2636
|
+
"NgpPasswordInput": {
|
|
2637
|
+
"name": "NgpPasswordInput",
|
|
2638
|
+
"description": "Apply the `ngpPasswordInput` directive to an `input` element within an `ngpPassword` container.\nIt is a complete input (form control, interactions, autofill) with password visibility toggling\nlayered on top, so it does not need to be combined with `ngpInput`.",
|
|
2639
|
+
"selector": "input[ngpPasswordInput]",
|
|
2640
|
+
"exportAs": [
|
|
2641
|
+
"ngpPasswordInput"
|
|
2642
|
+
],
|
|
2643
|
+
"inputs": [
|
|
2644
|
+
{
|
|
2645
|
+
"name": "disabled",
|
|
2646
|
+
"type": "boolean",
|
|
2647
|
+
"description": "Whether the input is disabled.",
|
|
2648
|
+
"isRequired": false
|
|
2649
|
+
},
|
|
2650
|
+
{
|
|
2651
|
+
"name": "ngpPasswordInputIgnorePasswordManagers",
|
|
2652
|
+
"type": "boolean",
|
|
2653
|
+
"description": "Whether to opt the input out of password manager injection\n(1Password, LastPass, Bitwarden, etc.).",
|
|
2654
|
+
"isRequired": false,
|
|
2655
|
+
"defaultValue": "false"
|
|
2656
|
+
}
|
|
2657
|
+
],
|
|
2658
|
+
"outputs": []
|
|
2659
|
+
},
|
|
2567
2660
|
"NgpPopoverArrow": {
|
|
2568
2661
|
"name": "NgpPopoverArrow",
|
|
2569
2662
|
"description": "",
|
|
@@ -4177,6 +4270,41 @@
|
|
|
4177
4270
|
}
|
|
4178
4271
|
]
|
|
4179
4272
|
},
|
|
4273
|
+
"NgpPasswordConfig": {
|
|
4274
|
+
"name": "NgpPasswordConfig",
|
|
4275
|
+
"properties": [
|
|
4276
|
+
{
|
|
4277
|
+
"name": "showLabel",
|
|
4278
|
+
"type": "string",
|
|
4279
|
+
"description": "The accessible label for the toggle button when the password is hidden.",
|
|
4280
|
+
"default": "'Show password'"
|
|
4281
|
+
},
|
|
4282
|
+
{
|
|
4283
|
+
"name": "hideLabel",
|
|
4284
|
+
"type": "string",
|
|
4285
|
+
"description": "The accessible label for the toggle button when the password is visible.",
|
|
4286
|
+
"default": "'Hide password'"
|
|
4287
|
+
},
|
|
4288
|
+
{
|
|
4289
|
+
"name": "shownAnnouncement",
|
|
4290
|
+
"type": "string",
|
|
4291
|
+
"description": "The message announced to screen readers when the password becomes visible.",
|
|
4292
|
+
"default": "'Your password is shown'"
|
|
4293
|
+
},
|
|
4294
|
+
{
|
|
4295
|
+
"name": "hiddenAnnouncement",
|
|
4296
|
+
"type": "string",
|
|
4297
|
+
"description": "The message announced to screen readers when the password becomes hidden.",
|
|
4298
|
+
"default": "'Your password is hidden'"
|
|
4299
|
+
},
|
|
4300
|
+
{
|
|
4301
|
+
"name": "ignorePasswordManagers",
|
|
4302
|
+
"type": "boolean",
|
|
4303
|
+
"description": "Whether to opt the input out of password manager injection by default.",
|
|
4304
|
+
"default": "false"
|
|
4305
|
+
}
|
|
4306
|
+
]
|
|
4307
|
+
},
|
|
4180
4308
|
"NgpPopoverConfig": {
|
|
4181
4309
|
"name": "NgpPopoverConfig",
|
|
4182
4310
|
"properties": [
|
|
@@ -1134,6 +1134,58 @@
|
|
|
1134
1134
|
"hasSizes": true
|
|
1135
1135
|
}
|
|
1136
1136
|
},
|
|
1137
|
+
{
|
|
1138
|
+
"name": "password",
|
|
1139
|
+
"entryPoint": "ng-primitives/password",
|
|
1140
|
+
"exports": [
|
|
1141
|
+
"defaultPasswordConfig",
|
|
1142
|
+
"injectPasswordConfig",
|
|
1143
|
+
"NgpPasswordConfig",
|
|
1144
|
+
"NgpPasswordConfigToken",
|
|
1145
|
+
"providePasswordConfig",
|
|
1146
|
+
"NgpPasswordInput",
|
|
1147
|
+
"injectPasswordInputState",
|
|
1148
|
+
"ngpPasswordInput",
|
|
1149
|
+
"NgpPasswordInputProps",
|
|
1150
|
+
"NgpPasswordInputState",
|
|
1151
|
+
"providePasswordInputState",
|
|
1152
|
+
"NgpPasswordToggle",
|
|
1153
|
+
"injectPasswordToggleState",
|
|
1154
|
+
"ngpPasswordToggle",
|
|
1155
|
+
"NgpPasswordToggleProps",
|
|
1156
|
+
"NgpPasswordToggleState",
|
|
1157
|
+
"providePasswordToggleState",
|
|
1158
|
+
"NgpPassword",
|
|
1159
|
+
"injectPasswordState",
|
|
1160
|
+
"ngpPassword",
|
|
1161
|
+
"NgpPasswordProps",
|
|
1162
|
+
"NgpPasswordState",
|
|
1163
|
+
"providePasswordState"
|
|
1164
|
+
],
|
|
1165
|
+
"hasSecondaryEntryPoint": true,
|
|
1166
|
+
"category": "utility",
|
|
1167
|
+
"description": "The password primitive is a form control that lets users reveal and hide the contents of a password field with an accessible toggle button.",
|
|
1168
|
+
"accessibility": [
|
|
1169
|
+
"screen reader"
|
|
1170
|
+
],
|
|
1171
|
+
"examples": [
|
|
1172
|
+
{
|
|
1173
|
+
"name": "example-0",
|
|
1174
|
+
"code": "<div ngpFormField>\n <label ngpLabel>Password</label>\n <div ngpPassword #password=\"ngpPassword\">\n <input ngpPasswordInput type=\"password\" autocomplete=\"current-password\" />\n <button ngpButton ngpPasswordToggle>\n <ng-icon [name]=\"password.isVisible() ? 'lucideEyeOff' : 'lucideEye'\" />\n </button>\n </div>\n</div>",
|
|
1175
|
+
"description": "Usage"
|
|
1176
|
+
},
|
|
1177
|
+
{
|
|
1178
|
+
"name": "example-1",
|
|
1179
|
+
"code": "import { providePasswordConfig } from 'ng-primitives/password';\n\nbootstrapApplication(AppComponent, {\n providers: [\n providePasswordConfig({\n showLabel: 'Show password',\n hideLabel: 'Hide password',\n shownAnnouncement: 'Your password is shown',\n hiddenAnnouncement: 'Your password is hidden',\n ignorePasswordManagers: false,\n }),\n ],\n});",
|
|
1180
|
+
"description": "Global Configuration"
|
|
1181
|
+
}
|
|
1182
|
+
],
|
|
1183
|
+
"reusableComponent": {
|
|
1184
|
+
"code": "import { Component, input, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { lucideEye, lucideEyeOff } from '@ng-icons/lucide';\nimport { NgpButton } from 'ng-primitives/button';\nimport {\n injectPasswordState,\n NgpPassword,\n NgpPasswordInput,\n NgpPasswordToggle,\n} from 'ng-primitives/password';\nimport { ChangeFn, provideValueAccessor, TouchedFn } from 'ng-primitives/utils';\n\n@Component({\n selector: 'app-password',\n hostDirectives: [NgpPassword],\n imports: [NgIcon, NgpPasswordInput, NgpPasswordToggle, NgpButton],\n providers: [provideValueAccessor(Password), provideIcons({ lucideEye, lucideEyeOff })],\n template: `\n <input\n [value]=\"value()\"\n [placeholder]=\"placeholder()\"\n (input)=\"onValueChange($event)\"\n ngpPasswordInput\n type=\"password\"\n autocomplete=\"current-password\"\n />\n <button ngpButton ngpPasswordToggle>\n <ng-icon [name]=\"state().visible() ? 'lucideEyeOff' : 'lucideEye'\" />\n </button>\n `,\n styles: `\n :host {\n display: block;\n position: relative;\n }\n\n [ngpPasswordInput] {\n height: 2.125rem;\n width: 100%;\n border-radius: 0.5rem;\n padding: 0 40px 0 12px;\n border: none;\n background: var(--ngp-background);\n color: var(--ngp-text-primary);\n font-size: 0.875rem;\n letter-spacing: -0.006em;\n box-shadow: var(--ngp-input-shadow);\n outline: none;\n }\n\n [ngpPasswordInput][data-focus] {\n outline: 2px solid var(--ngp-focus-ring);\n outline-offset: 2px;\n }\n\n [ngpPasswordInput]::placeholder {\n color: var(--ngp-text-placeholder);\n }\n\n [ngpPasswordToggle] {\n position: absolute;\n top: 0;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 2.125rem;\n width: 2.125rem;\n border: none;\n border-radius: 0.5rem;\n background-color: transparent;\n color: var(--ngp-text-tertiary);\n font-size: 1.125rem;\n cursor: pointer;\n outline: none;\n transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n [ngpPasswordToggle][data-hover] {\n color: var(--ngp-text-secondary);\n }\n\n [ngpPasswordToggle][data-visible] {\n color: var(--ngp-primary);\n }\n\n [ngpPasswordToggle][data-focus-visible] {\n outline: 2px solid var(--ngp-focus-ring);\n outline-offset: -2px;\n }\n `,\n host: {\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class Password implements ControlValueAccessor {\n /** Access the password state to read the visibility. */\n protected readonly state = injectPasswordState();\n\n /** The placeholder text */\n readonly placeholder = input<string>('');\n\n /** The current value */\n protected value = signal<string>('');\n\n /** The function to call when the value changes */\n private onChange?: ChangeFn<string>;\n\n /** The function to call when the control is touched */\n protected onTouched?: TouchedFn;\n\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n registerOnChange(fn: ChangeFn<string>): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: TouchedFn): void {\n this.onTouched = fn;\n }\n\n protected onValueChange(event: Event): void {\n const input = event.target as HTMLInputElement;\n this.value.set(input.value);\n this.onChange?.(input.value);\n }\n\n protected onFocusOut(event: FocusEvent): void {\n // only mark as touched when focus leaves the component, not when moving\n // between the input and the toggle button\n const host = event.currentTarget as HTMLElement;\n if (!host.contains(event.relatedTarget as Node | null)) {\n this.onTouched?.();\n }\n }\n}\n",
|
|
1185
|
+
"hasVariants": false,
|
|
1186
|
+
"hasSizes": true
|
|
1187
|
+
}
|
|
1188
|
+
},
|
|
1137
1189
|
{
|
|
1138
1190
|
"name": "popover",
|
|
1139
1191
|
"entryPoint": "ng-primitives/popover",
|
|
@@ -125,6 +125,13 @@
|
|
|
125
125
|
"hasVariants": false,
|
|
126
126
|
"hasSizes": true
|
|
127
127
|
},
|
|
128
|
+
{
|
|
129
|
+
"name": "password",
|
|
130
|
+
"code": "import { Component, input, signal } from '@angular/core';\nimport { ControlValueAccessor } from '@angular/forms';\nimport { NgIcon, provideIcons } from '@ng-icons/core';\nimport { lucideEye, lucideEyeOff } from '@ng-icons/lucide';\nimport { NgpButton } from 'ng-primitives/button';\nimport {\n injectPasswordState,\n NgpPassword,\n NgpPasswordInput,\n NgpPasswordToggle,\n} from 'ng-primitives/password';\nimport { ChangeFn, provideValueAccessor, TouchedFn } from 'ng-primitives/utils';\n\n@Component({\n selector: 'app-password',\n hostDirectives: [NgpPassword],\n imports: [NgIcon, NgpPasswordInput, NgpPasswordToggle, NgpButton],\n providers: [provideValueAccessor(Password), provideIcons({ lucideEye, lucideEyeOff })],\n template: `\n <input\n [value]=\"value()\"\n [placeholder]=\"placeholder()\"\n (input)=\"onValueChange($event)\"\n ngpPasswordInput\n type=\"password\"\n autocomplete=\"current-password\"\n />\n <button ngpButton ngpPasswordToggle>\n <ng-icon [name]=\"state().visible() ? 'lucideEyeOff' : 'lucideEye'\" />\n </button>\n `,\n styles: `\n :host {\n display: block;\n position: relative;\n }\n\n [ngpPasswordInput] {\n height: 2.125rem;\n width: 100%;\n border-radius: 0.5rem;\n padding: 0 40px 0 12px;\n border: none;\n background: var(--ngp-background);\n color: var(--ngp-text-primary);\n font-size: 0.875rem;\n letter-spacing: -0.006em;\n box-shadow: var(--ngp-input-shadow);\n outline: none;\n }\n\n [ngpPasswordInput][data-focus] {\n outline: 2px solid var(--ngp-focus-ring);\n outline-offset: 2px;\n }\n\n [ngpPasswordInput]::placeholder {\n color: var(--ngp-text-placeholder);\n }\n\n [ngpPasswordToggle] {\n position: absolute;\n top: 0;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n height: 2.125rem;\n width: 2.125rem;\n border: none;\n border-radius: 0.5rem;\n background-color: transparent;\n color: var(--ngp-text-tertiary);\n font-size: 1.125rem;\n cursor: pointer;\n outline: none;\n transition: color 150ms cubic-bezier(0.4, 0, 0.2, 1);\n }\n\n [ngpPasswordToggle][data-hover] {\n color: var(--ngp-text-secondary);\n }\n\n [ngpPasswordToggle][data-visible] {\n color: var(--ngp-primary);\n }\n\n [ngpPasswordToggle][data-focus-visible] {\n outline: 2px solid var(--ngp-focus-ring);\n outline-offset: -2px;\n }\n `,\n host: {\n '(focusout)': 'onFocusOut($event)',\n },\n})\nexport class Password implements ControlValueAccessor {\n /** Access the password state to read the visibility. */\n protected readonly state = injectPasswordState();\n\n /** The placeholder text */\n readonly placeholder = input<string>('');\n\n /** The current value */\n protected value = signal<string>('');\n\n /** The function to call when the value changes */\n private onChange?: ChangeFn<string>;\n\n /** The function to call when the control is touched */\n protected onTouched?: TouchedFn;\n\n writeValue(value: string): void {\n this.value.set(value);\n }\n\n registerOnChange(fn: ChangeFn<string>): void {\n this.onChange = fn;\n }\n\n registerOnTouched(fn: TouchedFn): void {\n this.onTouched = fn;\n }\n\n protected onValueChange(event: Event): void {\n const input = event.target as HTMLInputElement;\n this.value.set(input.value);\n this.onChange?.(input.value);\n }\n\n protected onFocusOut(event: FocusEvent): void {\n // only mark as touched when focus leaves the component, not when moving\n // between the input and the toggle button\n const host = event.currentTarget as HTMLElement;\n if (!host.contains(event.relatedTarget as Node | null)) {\n this.onTouched?.();\n }\n }\n}\n",
|
|
131
|
+
"primitive": "password",
|
|
132
|
+
"hasVariants": false,
|
|
133
|
+
"hasSizes": true
|
|
134
|
+
},
|
|
128
135
|
{
|
|
129
136
|
"name": "popover",
|
|
130
137
|
"code": "import { Directive, input } from '@angular/core';\nimport { injectPopoverTriggerState } from 'ng-primitives/popover';\nimport { NgpPopoverTrigger } from 'ng-primitives/popover';\nimport { Popover } from './popover';\n\n@Directive({\n selector: '[appPopoverTrigger]',\n hostDirectives: [\n {\n directive: NgpPopoverTrigger,\n inputs: [\n 'ngpPopoverTriggerDisabled:appPopoverTriggerDisabled',\n 'ngpPopoverTriggerPlacement:appPopoverTriggerPlacement',\n 'ngpPopoverTriggerOffset:appPopoverTriggerOffset',\n 'ngpPopoverTriggerShowDelay:appPopoverTriggerShowDelay',\n 'ngpPopoverTriggerHideDelay:appPopoverTriggerHideDelay',\n 'ngpPopoverTriggerFlip:appPopoverTriggerFlip',\n 'ngpPopoverTriggerContainer:appPopoverTriggerContainer',\n 'ngpPopoverTriggerCloseOnOutsideClick:appPopoverTriggerCloseOnOutsideClick',\n 'ngpPopoverTriggerCloseOnEscape:appPopoverTriggerCloseOnEscape',\n 'ngpPopoverTriggerScrollBehavior:appPopoverTriggerScrollBehavior',\n 'ngpPopoverTriggerContext:appPopoverTrigger',\n ],\n },\n ],\n})\nexport class PopoverTrigger {\n /** Access the popover trigger */\n private readonly popoverTrigger = injectPopoverTriggerState();\n\n /** Define the content of the popover */\n readonly content = input.required<string>({\n alias: 'appPopoverTrigger',\n });\n\n constructor() {\n this.popoverTrigger().popover.set(Popover);\n }\n}\n",
|