@radix-ng/primitives 0.12.1 → 0.13.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/README.md +3 -1
- package/accordion/index.d.ts +16 -0
- package/accordion/src/accordion-content.directive.d.ts +11 -0
- package/accordion/src/accordion-header.directive.d.ts +7 -0
- package/accordion/src/accordion-item.directive.d.ts +82 -0
- package/accordion/src/accordion-root.directive.d.ts +93 -0
- package/accordion/src/accordion-trigger.directive.d.ts +15 -0
- package/alert-dialog/{index.ts → index.d.ts} +0 -1
- package/alert-dialog/src/alert-dialog-cancel.directive.d.ts +7 -0
- package/alert-dialog/src/alert-dialog-content.directive.d.ts +9 -0
- package/alert-dialog/src/alert-dialog-root.directive.d.ts +9 -0
- package/alert-dialog/src/alert-dialog-title.directive.d.ts +5 -0
- package/alert-dialog/src/alert-dialog-trigger.directive.d.ts +7 -0
- package/alert-dialog/src/alert-dialog.service.d.ts +14 -0
- package/avatar/src/avatar-fallback.directive.d.ts +28 -0
- package/avatar/src/avatar-image.directive.d.ts +21 -0
- package/avatar/src/avatar-root.directive.d.ts +21 -0
- package/avatar/src/avatar.config.d.ts +13 -0
- package/checkbox/src/checkbox-button.directive.d.ts +8 -0
- package/checkbox/src/checkbox-indicator.directive.d.ts +6 -0
- package/checkbox/src/checkbox-input.directive.d.ts +9 -0
- package/checkbox/src/checkbox.directive.d.ts +75 -0
- package/checkbox/src/checkbox.token.d.ts +4 -0
- package/collapsible/src/collapsible-content.directive.d.ts +17 -0
- package/collapsible/src/collapsible-content.token.d.ts +3 -0
- package/collapsible/src/collapsible-root.directive.d.ts +55 -0
- package/collapsible/src/collapsible-trigger.directive.d.ts +26 -0
- package/compodoc/documentation.json +14249 -0
- package/context-menu/index.d.ts +26 -0
- package/context-menu/src/context-menu-content.directive.d.ts +15 -0
- package/context-menu/src/context-menu-item-checkbox.directive.d.ts +9 -0
- package/context-menu/src/context-menu-item-indicator.directive.d.ts +7 -0
- package/context-menu/src/context-menu-item-radio-group.directive.d.ts +12 -0
- package/context-menu/src/context-menu-item-radio.directive.d.ts +19 -0
- package/context-menu/src/context-menu-item-selectable.d.ts +12 -0
- package/context-menu/src/context-menu-item.directive.d.ts +17 -0
- package/context-menu/src/context-menu-label.directive.d.ts +5 -0
- package/context-menu/src/context-menu-separator.directive.d.ts +6 -0
- package/context-menu/src/context-menu-trigger.directive.d.ts +31 -0
- package/dialog/index.d.ts +23 -0
- package/dialog/src/dialog-close.directive.d.ts +7 -0
- package/dialog/src/dialog-content.directive.d.ts +21 -0
- package/dialog/src/dialog-description.directive.d.ts +5 -0
- package/dialog/src/dialog-dismiss.directive.d.ts +7 -0
- package/dialog/src/dialog-ref.d.ts +37 -0
- package/dialog/src/dialog-title.directive.d.ts +5 -0
- package/dialog/src/dialog-trigger.directive.d.ts +16 -0
- package/dialog/src/dialog.config.d.ts +39 -0
- package/dialog/src/dialog.injectors.d.ts +4 -0
- package/dialog/src/{dialog.providers.ts → dialog.providers.d.ts} +3 -11
- package/dialog/src/dialog.service.d.ts +26 -0
- package/dropdown-menu/index.d.ts +26 -0
- package/dropdown-menu/src/dropdown-menu-content.directive.d.ts +15 -0
- package/dropdown-menu/src/dropdown-menu-item-checkbox.directive.d.ts +9 -0
- package/dropdown-menu/src/dropdown-menu-item-indicator.directive.d.ts +7 -0
- package/dropdown-menu/src/dropdown-menu-item-radio-group.directive.d.ts +12 -0
- package/dropdown-menu/src/dropdown-menu-item-radio.directive.d.ts +19 -0
- package/dropdown-menu/src/dropdown-menu-item-selectable.d.ts +12 -0
- package/dropdown-menu/src/dropdown-menu-item.directive.d.ts +17 -0
- package/dropdown-menu/src/dropdown-menu-label.directive.d.ts +5 -0
- package/dropdown-menu/src/dropdown-menu-separator.directive.d.ts +6 -0
- package/dropdown-menu/src/dropdown-menu-trigger.directive.d.ts +46 -0
- package/esm2022/accordion/index.mjs +40 -0
- package/esm2022/accordion/radix-ng-primitives-accordion.mjs +5 -0
- package/esm2022/accordion/src/accordion-content.directive.mjs +42 -0
- package/esm2022/accordion/src/accordion-header.directive.mjs +23 -0
- package/esm2022/accordion/src/accordion-item.directive.mjs +187 -0
- package/esm2022/accordion/src/accordion-root.directive.mjs +172 -0
- package/esm2022/accordion/src/accordion-trigger.directive.mjs +42 -0
- package/esm2022/alert-dialog/index.mjs +7 -0
- package/esm2022/alert-dialog/radix-ng-primitives-alert-dialog.mjs +5 -0
- package/esm2022/alert-dialog/src/alert-dialog-cancel.directive.mjs +24 -0
- package/esm2022/alert-dialog/src/alert-dialog-content.directive.mjs +34 -0
- package/esm2022/alert-dialog/src/alert-dialog-root.directive.mjs +24 -0
- package/esm2022/alert-dialog/src/alert-dialog-title.directive.mjs +14 -0
- package/esm2022/alert-dialog/src/alert-dialog-trigger.directive.mjs +24 -0
- package/esm2022/alert-dialog/src/alert-dialog.service.mjs +46 -0
- package/esm2022/avatar/index.mjs +5 -0
- package/esm2022/avatar/radix-ng-primitives-avatar.mjs +5 -0
- package/esm2022/avatar/src/avatar-fallback.directive.mjs +60 -0
- package/esm2022/avatar/src/avatar-image.directive.mjs +52 -0
- package/esm2022/avatar/src/avatar-root.directive.mjs +38 -0
- package/esm2022/avatar/src/avatar.config.mjs +17 -0
- package/esm2022/checkbox/index.mjs +6 -0
- package/esm2022/checkbox/radix-ng-primitives-checkbox.mjs +5 -0
- package/esm2022/checkbox/src/checkbox-button.directive.mjs +33 -0
- package/esm2022/checkbox/src/checkbox-indicator.directive.mjs +24 -0
- package/esm2022/checkbox/src/checkbox-input.directive.mjs +41 -0
- package/esm2022/checkbox/src/checkbox.directive.mjs +141 -0
- package/esm2022/checkbox/src/checkbox.token.mjs +6 -0
- package/esm2022/collapsible/index.mjs +4 -0
- package/esm2022/collapsible/radix-ng-primitives-collapsible.mjs +5 -0
- package/esm2022/collapsible/src/collapsible-content.directive.mjs +45 -0
- package/esm2022/collapsible/src/collapsible-content.token.mjs +3 -0
- package/esm2022/collapsible/src/collapsible-root.directive.mjs +118 -0
- package/esm2022/collapsible/src/collapsible-trigger.directive.mjs +49 -0
- package/esm2022/context-menu/index.mjs +65 -0
- package/esm2022/context-menu/radix-ng-primitives-context-menu.mjs +5 -0
- package/esm2022/context-menu/src/context-menu-content.directive.mjs +56 -0
- package/esm2022/context-menu/src/context-menu-item-checkbox.directive.mjs +39 -0
- package/esm2022/context-menu/src/context-menu-item-indicator.directive.mjs +22 -0
- package/esm2022/context-menu/src/context-menu-item-radio-group.directive.mjs +37 -0
- package/esm2022/context-menu/src/context-menu-item-radio.directive.mjs +67 -0
- package/esm2022/context-menu/src/context-menu-item-selectable.mjs +31 -0
- package/esm2022/context-menu/src/context-menu-item.directive.mjs +70 -0
- package/esm2022/context-menu/src/context-menu-label.directive.mjs +14 -0
- package/esm2022/context-menu/src/context-menu-separator.directive.mjs +21 -0
- package/esm2022/context-menu/src/context-menu-trigger.directive.mjs +92 -0
- package/esm2022/dialog/index.mjs +50 -0
- package/esm2022/dialog/radix-ng-primitives-dialog.mjs +5 -0
- package/esm2022/dialog/src/dialog-close.directive.mjs +25 -0
- package/esm2022/dialog/src/dialog-content.directive.mjs +46 -0
- package/esm2022/dialog/src/dialog-description.directive.mjs +14 -0
- package/esm2022/dialog/src/dialog-dismiss.directive.mjs +25 -0
- package/esm2022/dialog/src/dialog-ref.mjs +46 -0
- package/esm2022/dialog/src/dialog-title.directive.mjs +14 -0
- package/esm2022/dialog/src/dialog-trigger.directive.mjs +54 -0
- package/esm2022/dialog/src/dialog.config.mjs +6 -0
- package/esm2022/dialog/src/dialog.injectors.mjs +10 -0
- package/esm2022/dialog/src/dialog.providers.mjs +26 -0
- package/esm2022/dialog/src/dialog.service.mjs +96 -0
- package/esm2022/dropdown-menu/index.mjs +68 -0
- package/esm2022/dropdown-menu/radix-ng-primitives-dropdown-menu.mjs +5 -0
- package/esm2022/dropdown-menu/src/dropdown-menu-content.directive.mjs +56 -0
- package/esm2022/dropdown-menu/src/dropdown-menu-item-checkbox.directive.mjs +39 -0
- package/esm2022/dropdown-menu/src/dropdown-menu-item-indicator.directive.mjs +22 -0
- package/esm2022/dropdown-menu/src/dropdown-menu-item-radio-group.directive.mjs +37 -0
- package/esm2022/dropdown-menu/src/dropdown-menu-item-radio.directive.mjs +67 -0
- package/esm2022/dropdown-menu/src/dropdown-menu-item-selectable.mjs +31 -0
- package/esm2022/dropdown-menu/src/dropdown-menu-item.directive.mjs +71 -0
- package/esm2022/dropdown-menu/src/dropdown-menu-label.directive.mjs +14 -0
- package/esm2022/dropdown-menu/src/dropdown-menu-separator.directive.mjs +21 -0
- package/esm2022/dropdown-menu/src/dropdown-menu-trigger.directive.mjs +179 -0
- package/esm2022/index.mjs +2 -0
- package/esm2022/label/index.mjs +2 -0
- package/esm2022/label/radix-ng-primitives-label.mjs +5 -0
- package/esm2022/label/src/label.directive.mjs +59 -0
- package/esm2022/menu/index.mjs +45 -0
- package/esm2022/menu/radix-ng-primitives-menu.mjs +5 -0
- package/esm2022/menu/src/menu-content.directive.mjs +17 -0
- package/esm2022/menu/src/menu-directive.mjs +18 -0
- package/esm2022/menu/src/menu-group.directive.mjs +20 -0
- package/esm2022/menu/src/menu-item.directive.mjs +46 -0
- package/esm2022/menu/src/menu-label.directive.mjs +14 -0
- package/esm2022/menu/src/menu-separator.directive.mjs +21 -0
- package/esm2022/menubar/index.mjs +60 -0
- package/esm2022/menubar/radix-ng-primitives-menubar.mjs +5 -0
- package/esm2022/menubar/src/menubar-content.directive.mjs +17 -0
- package/esm2022/menubar/src/menubar-item-checkbox.directive.mjs +34 -0
- package/esm2022/menubar/src/menubar-item-indicator.directive.mjs +17 -0
- package/esm2022/menubar/src/menubar-item-radio.directive.mjs +35 -0
- package/esm2022/menubar/src/menubar-item.directive.mjs +20 -0
- package/esm2022/menubar/src/menubar-radio-group.directive.mjs +17 -0
- package/esm2022/menubar/src/menubar-root.directive.mjs +24 -0
- package/esm2022/menubar/src/menubar-separator.directive.mjs +17 -0
- package/esm2022/menubar/src/menubar-trigger.directive.mjs +45 -0
- package/esm2022/progress/index.mjs +25 -0
- package/esm2022/progress/radix-ng-primitives-progress.mjs +5 -0
- package/esm2022/progress/src/progress-indicator.directive.mjs +34 -0
- package/esm2022/progress/src/progress-root.directive.mjs +127 -0
- package/esm2022/radio/index.mjs +4 -0
- package/esm2022/radio/radix-ng-primitives-radio.mjs +5 -0
- package/esm2022/radio/src/radio-indicator.directive.mjs +25 -0
- package/esm2022/radio/src/radio-item.directive.mjs +70 -0
- package/esm2022/radio/src/radio-root.directive.mjs +194 -0
- package/esm2022/radio/src/radio-tokens.mjs +3 -0
- package/esm2022/radix-ng-primitives.mjs +5 -0
- package/esm2022/separator/index.mjs +2 -0
- package/esm2022/separator/radix-ng-primitives-separator.mjs +5 -0
- package/esm2022/separator/src/separator.directive.mjs +32 -0
- package/esm2022/switch/index.mjs +30 -0
- package/esm2022/switch/radix-ng-primitives-switch.mjs +5 -0
- package/esm2022/switch/src/switch-input.directive.mjs +32 -0
- package/esm2022/switch/src/switch-root.directive.mjs +95 -0
- package/esm2022/switch/src/switch-thumb.directive.mjs +23 -0
- package/esm2022/tabs/index.mjs +38 -0
- package/esm2022/tabs/radix-ng-primitives-tabs.mjs +5 -0
- package/esm2022/tabs/src/tabs-content.directive.mjs +29 -0
- package/esm2022/tabs/src/tabs-context.service.mjs +43 -0
- package/esm2022/tabs/src/tabs-list.directive.mjs +23 -0
- package/esm2022/tabs/src/tabs-root.directive.mjs +54 -0
- package/esm2022/tabs/src/tabs-trigger.directive.mjs +52 -0
- package/esm2022/toggle/index.mjs +2 -0
- package/esm2022/toggle/radix-ng-primitives-toggle.mjs +5 -0
- package/esm2022/toggle/src/toggle.directive.mjs +39 -0
- package/esm2022/toggle-group/index.mjs +6 -0
- package/esm2022/toggle-group/radix-ng-primitives-toggle-group.mjs +5 -0
- package/esm2022/toggle-group/src/toggle-group-button.directive.mjs +75 -0
- package/esm2022/toggle-group/src/toggle-group-button.token.mjs +6 -0
- package/esm2022/toggle-group/src/toggle-group-multi.directive.mjs +143 -0
- package/esm2022/toggle-group/src/toggle-group.directive.mjs +134 -0
- package/esm2022/toggle-group/src/toggle-group.token.mjs +6 -0
- package/fesm2022/radix-ng-primitives-accordion.mjs +483 -0
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs +159 -0
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-avatar.mjs +166 -0
- package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-checkbox.mjs +241 -0
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-collapsible.mjs +213 -0
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-context-menu.mjs +463 -0
- package/fesm2022/radix-ng-primitives-context-menu.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-dialog.mjs +373 -0
- package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs +555 -0
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-label.mjs +66 -0
- package/fesm2022/radix-ng-primitives-label.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-menu.mjs +158 -0
- package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-menubar.mjs +245 -0
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-progress.mjs +184 -0
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-radio.mjs +289 -0
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-separator.mjs +39 -0
- package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-switch.mjs +173 -0
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-tabs.mjs +222 -0
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +358 -0
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives-toggle.mjs +46 -0
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -0
- package/fesm2022/radix-ng-primitives.mjs +4 -0
- package/fesm2022/radix-ng-primitives.mjs.map +1 -0
- package/label/src/label.directive.d.ts +29 -0
- package/menu/index.d.ts +18 -0
- package/menu/src/menu-content.directive.d.ts +6 -0
- package/menu/src/menu-directive.d.ts +6 -0
- package/menu/src/menu-group.directive.d.ts +6 -0
- package/menu/src/menu-item.directive.d.ts +12 -0
- package/menu/src/menu-label.directive.d.ts +5 -0
- package/menu/src/menu-separator.directive.d.ts +6 -0
- package/menubar/index.d.ts +24 -0
- package/menubar/src/menubar-content.directive.d.ts +6 -0
- package/menubar/src/menubar-item-checkbox.directive.d.ts +14 -0
- package/menubar/src/menubar-item-indicator.directive.d.ts +5 -0
- package/menubar/src/menubar-item-radio.directive.d.ts +14 -0
- package/menubar/src/menubar-item.directive.d.ts +8 -0
- package/menubar/src/menubar-radio-group.directive.d.ts +6 -0
- package/menubar/src/menubar-root.directive.d.ts +7 -0
- package/menubar/src/menubar-separator.directive.d.ts +6 -0
- package/menubar/src/menubar-trigger.directive.d.ts +11 -0
- package/package.json +124 -4
- package/progress/index.d.ts +11 -0
- package/progress/src/progress-indicator.directive.d.ts +16 -0
- package/progress/src/progress-root.directive.d.ts +63 -0
- package/radio/{index.ts → index.d.ts} +0 -1
- package/radio/src/radio-indicator.directive.d.ts +9 -0
- package/radio/src/radio-item.directive.d.ts +21 -0
- package/radio/src/radio-root.directive.d.ts +72 -0
- package/radio/src/{radio-tokens.ts → radio-tokens.d.ts} +1 -5
- package/separator/src/separator.directive.d.ts +22 -0
- package/switch/index.d.ts +13 -0
- package/switch/src/switch-input.directive.d.ts +6 -0
- package/switch/src/switch-root.directive.d.ts +51 -0
- package/switch/src/switch-thumb.directive.d.ts +6 -0
- package/tabs/index.d.ts +15 -0
- package/tabs/src/tabs-content.directive.d.ts +8 -0
- package/tabs/src/tabs-context.service.d.ts +22 -0
- package/tabs/src/tabs-list.directive.d.ts +6 -0
- package/tabs/src/tabs-root.directive.d.ts +37 -0
- package/tabs/src/tabs-trigger.directive.d.ts +19 -0
- package/toggle/src/toggle.directive.d.ts +30 -0
- package/toggle-group/src/toggle-group-button.directive.d.ts +39 -0
- package/toggle-group/src/toggle-group-button.token.d.ts +4 -0
- package/toggle-group/src/toggle-group-multi.directive.d.ts +93 -0
- package/toggle-group/src/toggle-group.directive.d.ts +84 -0
- package/toggle-group/src/toggle-group.token.d.ts +5 -0
- package/.compodocrc.json +0 -12
- package/CHANGELOG.md +0 -189
- package/accordion/__tests__/accordion-content.directive.spec.ts +0 -8
- package/accordion/__tests__/accordion-header.directive.spec.ts +0 -8
- package/accordion/__tests__/accordion-item.directive.spec.ts +0 -8
- package/accordion/__tests__/accordion-root.directive.spec.ts +0 -8
- package/accordion/__tests__/accordion-trigger.directive.spec.ts +0 -8
- package/accordion/index.ts +0 -5
- package/accordion/ng-package.json +0 -5
- package/accordion/src/accordion-content.directive.ts +0 -46
- package/accordion/src/accordion-header.directive.ts +0 -15
- package/accordion/src/accordion-item.directive.ts +0 -216
- package/accordion/src/accordion-root.directive.ts +0 -205
- package/accordion/src/accordion-trigger.directive.ts +0 -37
- package/accordion/stories/accordion.docs.mdx +0 -77
- package/accordion/stories/accordion.stories.ts +0 -340
- package/alert-dialog/ng-package.json +0 -5
- package/alert-dialog/src/alert-dialog-cancel.directive.ts +0 -17
- package/alert-dialog/src/alert-dialog-content.directive.ts +0 -24
- package/alert-dialog/src/alert-dialog-root.directive.ts +0 -15
- package/alert-dialog/src/alert-dialog-title.directive.ts +0 -7
- package/alert-dialog/src/alert-dialog-trigger.directive.ts +0 -17
- package/alert-dialog/src/alert-dialog.service.ts +0 -51
- package/alert-dialog/stories/alert-dialog.stories.ts +0 -139
- package/avatar/__tests__/avatar-fallback.directive.spec.ts +0 -31
- package/avatar/__tests__/avatar-image.directive.spec.ts +0 -36
- package/avatar/ng-package.json +0 -5
- package/avatar/src/avatar-fallback.directive.ts +0 -62
- package/avatar/src/avatar-image.directive.ts +0 -55
- package/avatar/src/avatar-root.directive.ts +0 -35
- package/avatar/src/avatar.config.ts +0 -29
- package/avatar/stories/avatar.docs.mdx +0 -37
- package/avatar/stories/avatar.stories.ts +0 -87
- package/button/__tests__/.gitkeep +0 -0
- package/button/src/button-abstract.directive.ts +0 -46
- package/checkbox/ng-package.json +0 -5
- package/checkbox/src/checkbox-button.directive.ts +0 -26
- package/checkbox/src/checkbox-indicator.directive.ts +0 -16
- package/checkbox/src/checkbox-input.directive.ts +0 -36
- package/checkbox/src/checkbox.directive.ts +0 -146
- package/checkbox/src/checkbox.token.ts +0 -8
- package/checkbox/stories/checkbox-group.component.ts +0 -87
- package/checkbox/stories/checkbox-group.styles.scss +0 -49
- package/checkbox/stories/checkbox-indeterminate.component.ts +0 -52
- package/checkbox/stories/checkbox.docs.mdx +0 -58
- package/checkbox/stories/checkbox.stories.ts +0 -105
- package/collapsible/__tests__/collapsible-content.directive.spec.ts +0 -30
- package/collapsible/__tests__/collapsible-root.directive.spec.ts +0 -27
- package/collapsible/__tests__/collapsible-trigger.directive.spec.ts +0 -30
- package/collapsible/ng-package.json +0 -5
- package/collapsible/src/collapsible-content.directive.ts +0 -34
- package/collapsible/src/collapsible-content.token.ts +0 -6
- package/collapsible/src/collapsible-root.directive.ts +0 -120
- package/collapsible/src/collapsible-trigger.directive.ts +0 -44
- package/collapsible/stories/collapsible-animation.component.ts +0 -116
- package/collapsible/stories/collapsible-external-triggering.component.ts +0 -86
- package/collapsible/stories/collapsible.docs.mdx +0 -53
- package/collapsible/stories/collapsible.stories.ts +0 -151
- package/context-menu/index.ts +0 -10
- package/context-menu/ng-package.json +0 -5
- package/context-menu/src/context-menu-content.directive.ts +0 -47
- package/context-menu/src/context-menu-item-checkbox.directive.ts +0 -30
- package/context-menu/src/context-menu-item-indicator.directive.ts +0 -14
- package/context-menu/src/context-menu-item-radio-group.directive.ts +0 -31
- package/context-menu/src/context-menu-item-radio.directive.ts +0 -69
- package/context-menu/src/context-menu-item-selectable.ts +0 -18
- package/context-menu/src/context-menu-item.directive.ts +0 -65
- package/context-menu/src/context-menu-label.directive.ts +0 -7
- package/context-menu/src/context-menu-separator.directive.ts +0 -13
- package/context-menu/src/context-menu-trigger.directive.ts +0 -82
- package/context-menu/stories/context-menu.docs.mdx +0 -23
- package/context-menu/stories/context-menu.stories.ts +0 -253
- package/core/index.ts +0 -3
- package/core/src/accessor/provide-value-accessor.ts +0 -20
- package/core/src/auto-focus.directive.ts +0 -81
- package/core/src/inject-ng-control.ts +0 -28
- package/core/src/mount.ts +0 -27
- package/dialog/__tests__/dialog-content.directive.spec.ts +0 -77
- package/dialog/__tests__/dialog-trigger.directive.spec.ts +0 -85
- package/dialog/index.ts +0 -31
- package/dialog/ng-package.json +0 -5
- package/dialog/src/dialog-close.directive.ts +0 -18
- package/dialog/src/dialog-content.directive.ts +0 -45
- package/dialog/src/dialog-description.directive.ts +0 -7
- package/dialog/src/dialog-dismiss.directive.ts +0 -18
- package/dialog/src/dialog-ref.ts +0 -70
- package/dialog/src/dialog-title.directive.ts +0 -7
- package/dialog/src/dialog-trigger.directive.ts +0 -52
- package/dialog/src/dialog.config.ts +0 -55
- package/dialog/src/dialog.injectors.ts +0 -12
- package/dialog/src/dialog.service.ts +0 -94
- package/dialog/stories/dialog.docs.mdx +0 -32
- package/dialog/stories/dialog.stories.ts +0 -233
- package/dropdown-menu/index.ts +0 -10
- package/dropdown-menu/ng-package.json +0 -5
- package/dropdown-menu/src/dropdown-menu-content.directive.ts +0 -47
- package/dropdown-menu/src/dropdown-menu-item-checkbox.directive.ts +0 -30
- package/dropdown-menu/src/dropdown-menu-item-indicator.directive.ts +0 -14
- package/dropdown-menu/src/dropdown-menu-item-radio-group.directive.ts +0 -31
- package/dropdown-menu/src/dropdown-menu-item-radio.directive.ts +0 -72
- package/dropdown-menu/src/dropdown-menu-item-selectable.ts +0 -18
- package/dropdown-menu/src/dropdown-menu-item.directive.ts +0 -66
- package/dropdown-menu/src/dropdown-menu-label.directive.ts +0 -7
- package/dropdown-menu/src/dropdown-menu-separator.directive.ts +0 -13
- package/dropdown-menu/src/dropdown-menu-trigger.directive.ts +0 -185
- package/dropdown-menu/stories/dropdown-menu-item-checkbox.component.ts +0 -104
- package/dropdown-menu/stories/dropdown-menu-item-checkbox.styles.scss +0 -106
- package/dropdown-menu/stories/dropdown-menu-item-radio.component.ts +0 -95
- package/dropdown-menu/stories/dropdown-menu-item-radio.styles.scss +0 -106
- package/dropdown-menu/stories/dropdown.docs.mdx +0 -27
- package/dropdown-menu/stories/dropdown.stories.ts +0 -212
- package/form-field/index.ts +0 -1
- package/form-field/src/.gitkeep +0 -0
- package/jest.config.ts +0 -21
- package/label/__tests__/label-root.directive.spec.ts +0 -99
- package/label/ng-package.json +0 -5
- package/label/src/label.directive.ts +0 -58
- package/label/stories/label.docs.mdx +0 -40
- package/label/stories/label.stories.ts +0 -76
- package/menu/index.ts +0 -29
- package/menu/ng-package.json +0 -5
- package/menu/src/menu-content.directive.ts +0 -9
- package/menu/src/menu-directive.ts +0 -10
- package/menu/src/menu-group.directive.ts +0 -12
- package/menu/src/menu-item.directive.ts +0 -44
- package/menu/src/menu-label.directive.ts +0 -7
- package/menu/src/menu-separator.directive.ts +0 -13
- package/menubar/index.ts +0 -38
- package/menubar/ng-package.json +0 -5
- package/menubar/src/menubar-content.directive.ts +0 -9
- package/menubar/src/menubar-item-checkbox.directive.ts +0 -32
- package/menubar/src/menubar-item-indicator.directive.ts +0 -10
- package/menubar/src/menubar-item-radio.directive.ts +0 -33
- package/menubar/src/menubar-item.directive.ts +0 -12
- package/menubar/src/menubar-radio-group.directive.ts +0 -9
- package/menubar/src/menubar-root.directive.ts +0 -15
- package/menubar/src/menubar-separator.directive.ts +0 -9
- package/menubar/src/menubar-trigger.directive.ts +0 -40
- package/menubar/stories/menubar.stories.ts +0 -229
- package/ng-package.json +0 -8
- package/portal/stories/portal.docs.mdx +0 -85
- package/presence/__test__/presence-test.component.ts +0 -51
- package/presence/__test__/presence.spec.ts +0 -50
- package/presence/index.ts +0 -4
- package/presence/src/presence.ts +0 -119
- package/presence/src/transitions/transition.collapse.ts +0 -99
- package/presence/src/transitions/transition.toast.ts +0 -27
- package/presence/src/types.ts +0 -20
- package/presence/src/utils.ts +0 -63
- package/presence/stories/presence-story.componen.ts +0 -69
- package/presence/stories/presence.docs.mdx +0 -40
- package/presence/stories/presence.stories.ts +0 -29
- package/progress/__test__/progress.spec.ts +0 -55
- package/progress/index.ts +0 -4
- package/progress/ng-package.json +0 -5
- package/progress/src/progress-indicator.directive.ts +0 -26
- package/progress/src/progress-root.directive.ts +0 -134
- package/progress/stories/progress.docs.mdx +0 -65
- package/progress/stories/progress.stories.ts +0 -66
- package/project.json +0 -39
- package/radio/ng-package.json +0 -5
- package/radio/src/radio-indicator.directive.ts +0 -17
- package/radio/src/radio-item.directive.ts +0 -68
- package/radio/src/radio-root.directive.ts +0 -207
- package/radio/stories/radio-group.component.ts +0 -39
- package/radio/stories/radio-group.styles.scss +0 -70
- package/radio/stories/radio.docs.mdx +0 -68
- package/radio/stories/radio.stories.ts +0 -155
- package/separator/__tests__/separator.directive.spec.ts +0 -58
- package/separator/ng-package.json +0 -5
- package/separator/src/separator.directive.ts +0 -35
- package/separator/stories/separator.docs.mdx +0 -37
- package/separator/stories/separator.stories.ts +0 -82
- package/slider/src/slider-input.directive.ts +0 -0
- package/slider/src/slider-thumb.directives.ts +0 -60
- package/slider/src/slider-track.directive.ts +0 -11
- package/slider/src/slider.directive.ts +0 -59
- package/slider/src/slider.types.ts +0 -4
- package/switch/index.ts +0 -22
- package/switch/ng-package.json +0 -5
- package/switch/src/switch-input.directive.ts +0 -24
- package/switch/src/switch-root.directive.ts +0 -127
- package/switch/src/switch-thumb.directive.ts +0 -15
- package/switch/stories/switch.docs.mdx +0 -83
- package/switch/stories/switch.stories.ts +0 -149
- package/tabs/__tests__/tabs-context.service.spec.ts +0 -35
- package/tabs/index.ts +0 -26
- package/tabs/ng-package.json +0 -5
- package/tabs/src/tabs-content.directive.ts +0 -23
- package/tabs/src/tabs-context.service.ts +0 -43
- package/tabs/src/tabs-list.directive.ts +0 -21
- package/tabs/src/tabs-root.directive.ts +0 -70
- package/tabs/src/tabs-trigger.directive.ts +0 -55
- package/tabs/stories/tabs.stories.ts +0 -213
- package/test-setup.ts +0 -1
- package/toggle/__tests__/toggle.directive.spec.ts +0 -87
- package/toggle/ng-package.json +0 -5
- package/toggle/src/toggle.directive.ts +0 -49
- package/toggle/stories/toggle.docs.mdx +0 -60
- package/toggle/stories/toggle.stories.ts +0 -84
- package/toggle-group/ng-package.json +0 -5
- package/toggle-group/src/toggle-group-button.directive.ts +0 -73
- package/toggle-group/src/toggle-group-button.token.ts +0 -8
- package/toggle-group/src/toggle-group-multi.directive.ts +0 -158
- package/toggle-group/src/toggle-group.directive.ts +0 -148
- package/toggle-group/src/toggle-group.token.ts +0 -11
- package/toggle-group/stories/toggle-group.docs.mdx +0 -87
- package/toggle-group/stories/toggle-group.stories.ts +0 -95
- package/tsconfig.doc.json +0 -11
- package/tsconfig.json +0 -29
- package/tsconfig.lib.json +0 -19
- package/tsconfig.lib.prod.json +0 -12
- package/tsconfig.spec.json +0 -11
- package/visually-hidden/README.md +0 -3
- package/visually-hidden/stories/visually-hidden.docs.mdx +0 -36
- /package/avatar/{index.ts → index.d.ts} +0 -0
- /package/checkbox/{index.ts → index.d.ts} +0 -0
- /package/collapsible/{index.ts → index.d.ts} +0 -0
- /package/{index.ts → index.d.ts} +0 -0
- /package/label/{index.ts → index.d.ts} +0 -0
- /package/separator/{index.ts → index.d.ts} +0 -0
- /package/toggle/{index.ts → index.d.ts} +0 -0
- /package/toggle-group/{index.ts → index.d.ts} +0 -0
@@ -0,0 +1,159 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { Injectable, inject, Directive, Renderer2, ElementRef, Input, ViewContainerRef } from '@angular/core';
|
3
|
+
import * as i1 from '@angular/cdk/overlay';
|
4
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
5
|
+
import * as i1$1 from '@angular/cdk/a11y';
|
6
|
+
import { CdkTrapFocus } from '@angular/cdk/a11y';
|
7
|
+
|
8
|
+
class AlertDialogService {
|
9
|
+
constructor(overlay) {
|
10
|
+
this.overlay = overlay;
|
11
|
+
}
|
12
|
+
setDialogContent(viewContainerRef, template) {
|
13
|
+
this.dialogContent = { viewContainerRef, template };
|
14
|
+
}
|
15
|
+
open() {
|
16
|
+
if (!this.dialogContent) {
|
17
|
+
throw new Error('Dialog content is not set');
|
18
|
+
}
|
19
|
+
this.overlayRef = this.overlay.create({
|
20
|
+
hasBackdrop: true,
|
21
|
+
backdropClass: 'cdk-overlay-dark-backdrop',
|
22
|
+
positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically()
|
23
|
+
});
|
24
|
+
const templatePortal = new TemplatePortal(this.dialogContent.template, this.dialogContent.viewContainerRef);
|
25
|
+
this.overlayRef.attach(templatePortal);
|
26
|
+
this.overlayRef.keydownEvents().subscribe((event) => {
|
27
|
+
if (event.key === 'Escape' || event.code === 'Escape') {
|
28
|
+
this.close();
|
29
|
+
}
|
30
|
+
});
|
31
|
+
this.overlayRef.backdropClick().subscribe(() => this.close());
|
32
|
+
}
|
33
|
+
close() {
|
34
|
+
if (this.overlayRef) {
|
35
|
+
this.overlayRef.dispose();
|
36
|
+
this.overlayRef = null;
|
37
|
+
}
|
38
|
+
}
|
39
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogService, deps: [{ token: i1.Overlay }], target: i0.ɵɵFactoryTarget.Injectable }); }
|
40
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogService, providedIn: 'root' }); }
|
41
|
+
}
|
42
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogService, decorators: [{
|
43
|
+
type: Injectable,
|
44
|
+
args: [{
|
45
|
+
providedIn: 'root'
|
46
|
+
}]
|
47
|
+
}], ctorParameters: () => [{ type: i1.Overlay }] });
|
48
|
+
|
49
|
+
class AlertDialogCancelDirective {
|
50
|
+
constructor() {
|
51
|
+
this.alertDialogService = inject(AlertDialogService);
|
52
|
+
}
|
53
|
+
onClick() {
|
54
|
+
this.alertDialogService.close();
|
55
|
+
}
|
56
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogCancelDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
57
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.1", type: AlertDialogCancelDirective, isStandalone: true, selector: "[rdxAlertDialogCancel]", host: { listeners: { "click": "onClick()" } }, ngImport: i0 }); }
|
58
|
+
}
|
59
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogCancelDirective, decorators: [{
|
60
|
+
type: Directive,
|
61
|
+
args: [{
|
62
|
+
selector: '[rdxAlertDialogCancel]',
|
63
|
+
standalone: true,
|
64
|
+
host: {
|
65
|
+
'(click)': 'onClick()'
|
66
|
+
}
|
67
|
+
}]
|
68
|
+
}] });
|
69
|
+
|
70
|
+
class AlertDialogContentDirective {
|
71
|
+
constructor() {
|
72
|
+
this.renderer = inject(Renderer2);
|
73
|
+
this.elementRef = inject(ElementRef);
|
74
|
+
}
|
75
|
+
set maxWidth(value) {
|
76
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'maxWidth', value);
|
77
|
+
}
|
78
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
79
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.1", type: AlertDialogContentDirective, isStandalone: true, selector: "[rdxAlertDialogContent]", inputs: { maxWidth: "maxWidth" }, host: { properties: { "attr.data-state": "open", "attr.cdkTrapFocusAutoCapture": "true" } }, hostDirectives: [{ directive: i1$1.CdkTrapFocus }], ngImport: i0 }); }
|
80
|
+
}
|
81
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogContentDirective, decorators: [{
|
82
|
+
type: Directive,
|
83
|
+
args: [{
|
84
|
+
selector: '[rdxAlertDialogContent]',
|
85
|
+
hostDirectives: [
|
86
|
+
{
|
87
|
+
directive: CdkTrapFocus
|
88
|
+
}
|
89
|
+
],
|
90
|
+
standalone: true,
|
91
|
+
host: {
|
92
|
+
'[attr.data-state]': 'open',
|
93
|
+
'[attr.cdkTrapFocusAutoCapture]': 'true'
|
94
|
+
}
|
95
|
+
}]
|
96
|
+
}], propDecorators: { maxWidth: [{
|
97
|
+
type: Input
|
98
|
+
}] } });
|
99
|
+
|
100
|
+
class AlertDialogRootDirective {
|
101
|
+
constructor() {
|
102
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
103
|
+
this.alertDialogService = inject(AlertDialogService);
|
104
|
+
}
|
105
|
+
set content(template) {
|
106
|
+
this.alertDialogService.setDialogContent(this.viewContainerRef, template);
|
107
|
+
}
|
108
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
109
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.1", type: AlertDialogRootDirective, isStandalone: true, selector: "[rdxAlertDialogRoot]", inputs: { content: "content" }, ngImport: i0 }); }
|
110
|
+
}
|
111
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogRootDirective, decorators: [{
|
112
|
+
type: Directive,
|
113
|
+
args: [{
|
114
|
+
selector: '[rdxAlertDialogRoot]',
|
115
|
+
standalone: true
|
116
|
+
}]
|
117
|
+
}], propDecorators: { content: [{
|
118
|
+
type: Input
|
119
|
+
}] } });
|
120
|
+
|
121
|
+
class AlertDialogTitleDirective {
|
122
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogTitleDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
123
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.1", type: AlertDialogTitleDirective, isStandalone: true, selector: "[rdxAlertDialogTitle]", ngImport: i0 }); }
|
124
|
+
}
|
125
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogTitleDirective, decorators: [{
|
126
|
+
type: Directive,
|
127
|
+
args: [{
|
128
|
+
selector: '[rdxAlertDialogTitle]',
|
129
|
+
standalone: true
|
130
|
+
}]
|
131
|
+
}] });
|
132
|
+
|
133
|
+
class AlertDialogTriggerDirective {
|
134
|
+
constructor() {
|
135
|
+
this.alertDialogService = inject(AlertDialogService);
|
136
|
+
}
|
137
|
+
handleClick() {
|
138
|
+
this.alertDialogService.open();
|
139
|
+
}
|
140
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
141
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.1", type: AlertDialogTriggerDirective, isStandalone: true, selector: "[rdxAlertDialogTrigger]", host: { listeners: { "click": "handleClick()" } }, ngImport: i0 }); }
|
142
|
+
}
|
143
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: AlertDialogTriggerDirective, decorators: [{
|
144
|
+
type: Directive,
|
145
|
+
args: [{
|
146
|
+
selector: '[rdxAlertDialogTrigger]',
|
147
|
+
standalone: true,
|
148
|
+
host: {
|
149
|
+
'(click)': 'handleClick()'
|
150
|
+
}
|
151
|
+
}]
|
152
|
+
}] });
|
153
|
+
|
154
|
+
/**
|
155
|
+
* Generated bundle index. Do not edit.
|
156
|
+
*/
|
157
|
+
|
158
|
+
export { AlertDialogCancelDirective, AlertDialogContentDirective, AlertDialogRootDirective, AlertDialogService, AlertDialogTitleDirective, AlertDialogTriggerDirective };
|
159
|
+
//# sourceMappingURL=radix-ng-primitives-alert-dialog.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-alert-dialog.mjs","sources":["../../../packages/primitives/alert-dialog/src/alert-dialog.service.ts","../../../packages/primitives/alert-dialog/src/alert-dialog-cancel.directive.ts","../../../packages/primitives/alert-dialog/src/alert-dialog-content.directive.ts","../../../packages/primitives/alert-dialog/src/alert-dialog-root.directive.ts","../../../packages/primitives/alert-dialog/src/alert-dialog-title.directive.ts","../../../packages/primitives/alert-dialog/src/alert-dialog-trigger.directive.ts","../../../packages/primitives/alert-dialog/radix-ng-primitives-alert-dialog.ts"],"sourcesContent":["import { Overlay, OverlayRef } from '@angular/cdk/overlay';\nimport { TemplatePortal } from '@angular/cdk/portal';\nimport { Injectable, TemplateRef, ViewContainerRef } from '@angular/core';\n\n@Injectable({\n providedIn: 'root'\n})\nexport class AlertDialogService {\n private overlayRef: OverlayRef | null | undefined;\n private dialogContent:\n | {\n viewContainerRef: ViewContainerRef;\n template: TemplateRef<any>;\n }\n | undefined;\n\n constructor(private overlay: Overlay) {}\n\n setDialogContent(viewContainerRef: ViewContainerRef, template: TemplateRef<any>) {\n this.dialogContent = { viewContainerRef, template };\n }\n\n open() {\n if (!this.dialogContent) {\n throw new Error('Dialog content is not set');\n }\n\n this.overlayRef = this.overlay.create({\n hasBackdrop: true,\n backdropClass: 'cdk-overlay-dark-backdrop',\n positionStrategy: this.overlay.position().global().centerHorizontally().centerVertically()\n });\n\n const templatePortal = new TemplatePortal(this.dialogContent.template, this.dialogContent.viewContainerRef);\n this.overlayRef.attach(templatePortal);\n\n this.overlayRef.keydownEvents().subscribe((event) => {\n if (event.key === 'Escape' || event.code === 'Escape') {\n this.close();\n }\n });\n this.overlayRef.backdropClick().subscribe(() => this.close());\n }\n\n close() {\n if (this.overlayRef) {\n this.overlayRef.dispose();\n this.overlayRef = null;\n }\n }\n}\n","import { Directive, inject } from '@angular/core';\nimport { AlertDialogService } from './alert-dialog.service';\n\n@Directive({\n selector: '[rdxAlertDialogCancel]',\n standalone: true,\n host: {\n '(click)': 'onClick()'\n }\n})\nexport class AlertDialogCancelDirective {\n private readonly alertDialogService = inject(AlertDialogService);\n\n onClick() {\n this.alertDialogService.close();\n }\n}\n","import { CdkTrapFocus } from '@angular/cdk/a11y';\nimport { Directive, ElementRef, inject, Input, Renderer2 } from '@angular/core';\n\n@Directive({\n selector: '[rdxAlertDialogContent]',\n hostDirectives: [\n {\n directive: CdkTrapFocus\n }\n ],\n standalone: true,\n host: {\n '[attr.data-state]': 'open',\n '[attr.cdkTrapFocusAutoCapture]': 'true'\n }\n})\nexport class AlertDialogContentDirective {\n private readonly renderer = inject(Renderer2);\n private readonly elementRef = inject(ElementRef);\n\n @Input() set maxWidth(value: string) {\n this.renderer.setStyle(this.elementRef.nativeElement, 'maxWidth', value);\n }\n}\n","import { Directive, inject, Input, TemplateRef, ViewContainerRef } from '@angular/core';\nimport { AlertDialogService } from './alert-dialog.service';\n\n@Directive({\n selector: '[rdxAlertDialogRoot]',\n standalone: true\n})\nexport class AlertDialogRootDirective {\n private readonly viewContainerRef = inject(ViewContainerRef);\n private readonly alertDialogService = inject(AlertDialogService);\n\n @Input() set content(template: TemplateRef<any>) {\n this.alertDialogService.setDialogContent(this.viewContainerRef, template);\n }\n}\n","import { Directive } from '@angular/core';\n\n@Directive({\n selector: '[rdxAlertDialogTitle]',\n standalone: true\n})\nexport class AlertDialogTitleDirective {}\n","import { Directive, inject } from '@angular/core';\nimport { AlertDialogService } from './alert-dialog.service';\n\n@Directive({\n selector: '[rdxAlertDialogTrigger]',\n standalone: true,\n host: {\n '(click)': 'handleClick()'\n }\n})\nexport class AlertDialogTriggerDirective {\n private readonly alertDialogService = inject(AlertDialogService);\n\n handleClick() {\n this.alertDialogService.open();\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":["i1"],"mappings":";;;;;;;MAOa,kBAAkB,CAAA;AAS3B,IAAA,WAAA,CAAoB,OAAgB,EAAA;QAAhB,IAAO,CAAA,OAAA,GAAP,OAAO,CAAS;KAAI;IAExC,gBAAgB,CAAC,gBAAkC,EAAE,QAA0B,EAAA;QAC3E,IAAI,CAAC,aAAa,GAAG,EAAE,gBAAgB,EAAE,QAAQ,EAAE,CAAC;KACvD;IAED,IAAI,GAAA;AACA,QAAA,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;AACrB,YAAA,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;SAChD;QAED,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;AAClC,YAAA,WAAW,EAAE,IAAI;AACjB,YAAA,aAAa,EAAE,2BAA2B;AAC1C,YAAA,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,CAAC,kBAAkB,EAAE,CAAC,gBAAgB,EAAE;AAC7F,SAAA,CAAC,CAAC;AAEH,QAAA,MAAM,cAAc,GAAG,IAAI,cAA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AA2B,EAAA,UAAA,EAAA,CAAA;kBAPvC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,yBAAyB;AACnC,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,SAAS,EAAE,eAAe;AAC7B,qBAAA;AACJ,iBAAA,CAAA;;;ACTD;;AAEG;;;;"}
|
@@ -0,0 +1,166 @@
|
|
1
|
+
import { isPlatformBrowser } from '@angular/common';
|
2
|
+
import * as i0 from '@angular/core';
|
3
|
+
import { InjectionToken, inject, signal, Directive, NgZone, PLATFORM_ID, numberAttribute, Input, ElementRef, EventEmitter, Output } from '@angular/core';
|
4
|
+
|
5
|
+
const RdxAvatarToken = new InjectionToken('RdxAvatarToken');
|
6
|
+
function injectAvatar() {
|
7
|
+
return inject(RdxAvatarToken);
|
8
|
+
}
|
9
|
+
class RdxAvatarRootDirective {
|
10
|
+
constructor() {
|
11
|
+
/**
|
12
|
+
* A readonly signal property that holds the current state of image loading.
|
13
|
+
* To set a new status, use the `setState` method of the component.
|
14
|
+
* @internal
|
15
|
+
*/
|
16
|
+
this._state = signal('idle');
|
17
|
+
}
|
18
|
+
/**
|
19
|
+
* Set the avatar state.
|
20
|
+
* @param state The new image loading status to set. This value should be one of the predefined states
|
21
|
+
* in the `ImageLoadingStatus`
|
22
|
+
* @returns void This method does not return a value.
|
23
|
+
* @internal
|
24
|
+
*/
|
25
|
+
_setState(state) {
|
26
|
+
this._state.set(state);
|
27
|
+
}
|
28
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxAvatarRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
29
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.1", type: RdxAvatarRootDirective, isStandalone: true, selector: "span[rdxAvatarRoot]", providers: [{ provide: RdxAvatarToken, useExisting: RdxAvatarRootDirective }], exportAs: ["rdxAvatarRoot"], ngImport: i0 }); }
|
30
|
+
}
|
31
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxAvatarRootDirective, decorators: [{
|
32
|
+
type: Directive,
|
33
|
+
args: [{
|
34
|
+
selector: 'span[rdxAvatarRoot]',
|
35
|
+
exportAs: 'rdxAvatarRoot',
|
36
|
+
standalone: true,
|
37
|
+
providers: [{ provide: RdxAvatarToken, useExisting: RdxAvatarRootDirective }]
|
38
|
+
}]
|
39
|
+
}] });
|
40
|
+
|
41
|
+
const defaultAvatarConfig = {
|
42
|
+
delayMs: 0
|
43
|
+
};
|
44
|
+
const RdxAvatarConfigToken = new InjectionToken('RdxAvatarConfigToken');
|
45
|
+
function provideRdxAvatarConfig(config) {
|
46
|
+
return [
|
47
|
+
{
|
48
|
+
provide: RdxAvatarConfigToken,
|
49
|
+
useValue: { ...defaultAvatarConfig, ...config }
|
50
|
+
}
|
51
|
+
];
|
52
|
+
}
|
53
|
+
function injectAvatarConfig() {
|
54
|
+
return inject(RdxAvatarConfigToken, { optional: true }) ?? defaultAvatarConfig;
|
55
|
+
}
|
56
|
+
|
57
|
+
class RdxAvatarFallbackDirective {
|
58
|
+
constructor() {
|
59
|
+
this.avatar = injectAvatar();
|
60
|
+
this.config = injectAvatarConfig();
|
61
|
+
this.ngZone = inject(NgZone);
|
62
|
+
this.platformId = inject(PLATFORM_ID);
|
63
|
+
/**
|
64
|
+
* Define a delay before the fallback is shown.
|
65
|
+
* This is useful to only show the fallback for those with slower connections.
|
66
|
+
* @default 0
|
67
|
+
*/
|
68
|
+
this.delayMs = this.config.delayMs;
|
69
|
+
/**
|
70
|
+
* Determine the delay has elapsed, and we can show the fallback.
|
71
|
+
*/
|
72
|
+
this.delayElapsed = false;
|
73
|
+
this.timeoutId = null;
|
74
|
+
}
|
75
|
+
get visible() {
|
76
|
+
return this.delayElapsed && this.avatar._state() !== 'loaded';
|
77
|
+
}
|
78
|
+
ngOnInit() {
|
79
|
+
if (isPlatformBrowser(this.platformId)) {
|
80
|
+
this.ngZone.runOutsideAngular(() => {
|
81
|
+
this.timeoutId = globalThis.setTimeout(() => {
|
82
|
+
this.ngZone.run(() => {
|
83
|
+
this.delayElapsed = true;
|
84
|
+
});
|
85
|
+
}, this.delayMs);
|
86
|
+
});
|
87
|
+
}
|
88
|
+
}
|
89
|
+
ngOnDestroy() {
|
90
|
+
if (isPlatformBrowser(this.platformId) && this.timeoutId !== null) {
|
91
|
+
globalThis.clearTimeout(this.timeoutId);
|
92
|
+
}
|
93
|
+
}
|
94
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxAvatarFallbackDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
95
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.2.1", type: RdxAvatarFallbackDirective, isStandalone: true, selector: "span[rdxAvatarFallback]", inputs: { delayMs: ["rdxDelayMs", "delayMs", numberAttribute] }, host: { properties: { "style.display": "visible ? null : \"none\"" } }, exportAs: ["rdxAvatarFallback"], ngImport: i0 }); }
|
96
|
+
}
|
97
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxAvatarFallbackDirective, decorators: [{
|
98
|
+
type: Directive,
|
99
|
+
args: [{
|
100
|
+
selector: 'span[rdxAvatarFallback]',
|
101
|
+
exportAs: 'rdxAvatarFallback',
|
102
|
+
standalone: true,
|
103
|
+
host: {
|
104
|
+
'[style.display]': 'visible ? null : "none"'
|
105
|
+
}
|
106
|
+
}]
|
107
|
+
}], propDecorators: { delayMs: [{
|
108
|
+
type: Input,
|
109
|
+
args: [{ alias: 'rdxDelayMs', transform: numberAttribute }]
|
110
|
+
}] } });
|
111
|
+
|
112
|
+
class RdxAvatarImageDirective {
|
113
|
+
constructor() {
|
114
|
+
this.avatar = injectAvatar();
|
115
|
+
this.elementRef = inject(ElementRef);
|
116
|
+
/**
|
117
|
+
* By default, it will only render when it has loaded.
|
118
|
+
* You can use the `onLoadingStatusChange` handler if you need more control.
|
119
|
+
*/
|
120
|
+
this.onLoadingStatusChange = new EventEmitter();
|
121
|
+
}
|
122
|
+
ngOnInit() {
|
123
|
+
this.avatar._setState('loading');
|
124
|
+
if (!this.nativeElement.src) {
|
125
|
+
this.avatar._setState('error');
|
126
|
+
}
|
127
|
+
if (this.nativeElement.complete) {
|
128
|
+
this.avatar._setState('loaded');
|
129
|
+
}
|
130
|
+
this.onLoadingStatusChange.emit(this.avatar._state());
|
131
|
+
}
|
132
|
+
onLoad() {
|
133
|
+
this.avatar._setState('loaded');
|
134
|
+
this.onLoadingStatusChange.emit('loaded');
|
135
|
+
}
|
136
|
+
onError() {
|
137
|
+
this.avatar._setState('error');
|
138
|
+
this.onLoadingStatusChange.emit('error');
|
139
|
+
}
|
140
|
+
get nativeElement() {
|
141
|
+
return this.elementRef.nativeElement;
|
142
|
+
}
|
143
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxAvatarImageDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
144
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.1", type: RdxAvatarImageDirective, isStandalone: true, selector: "img[rdxAvatarImage]", outputs: { onLoadingStatusChange: "onLoadingStatusChange" }, host: { listeners: { "load": "onLoad()", "error": "onError()" } }, exportAs: ["rdxAvatarImage"], ngImport: i0 }); }
|
145
|
+
}
|
146
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxAvatarImageDirective, decorators: [{
|
147
|
+
type: Directive,
|
148
|
+
args: [{
|
149
|
+
selector: 'img[rdxAvatarImage]',
|
150
|
+
exportAs: 'rdxAvatarImage',
|
151
|
+
standalone: true,
|
152
|
+
host: {
|
153
|
+
'(load)': 'onLoad()',
|
154
|
+
'(error)': 'onError()'
|
155
|
+
}
|
156
|
+
}]
|
157
|
+
}], propDecorators: { onLoadingStatusChange: [{
|
158
|
+
type: Output
|
159
|
+
}] } });
|
160
|
+
|
161
|
+
/**
|
162
|
+
* Generated bundle index. Do not edit.
|
163
|
+
*/
|
164
|
+
|
165
|
+
export { RdxAvatarConfigToken, RdxAvatarFallbackDirective, RdxAvatarImageDirective, RdxAvatarRootDirective, defaultAvatarConfig, injectAvatar, injectAvatarConfig, provideRdxAvatarConfig };
|
166
|
+
//# sourceMappingURL=radix-ng-primitives-avatar.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"radix-ng-primitives-avatar.mjs","sources":["../../../packages/primitives/avatar/src/avatar-root.directive.ts","../../../packages/primitives/avatar/src/avatar.config.ts","../../../packages/primitives/avatar/src/avatar-fallback.directive.ts","../../../packages/primitives/avatar/src/avatar-image.directive.ts","../../../packages/primitives/avatar/radix-ng-primitives-avatar.ts"],"sourcesContent":["import { Directive, inject, InjectionToken, signal } from '@angular/core';\n\nconst RdxAvatarToken = new InjectionToken<RdxAvatarRootDirective>('RdxAvatarToken');\n\nexport function injectAvatar(): RdxAvatarRootDirective {\n return inject(RdxAvatarToken);\n}\n\nexport type RdxImageLoadingStatus = 'idle' | 'loading' | 'loaded' | 'error';\n\n@Directive({\n selector: 'span[rdxAvatarRoot]',\n exportAs: 'rdxAvatarRoot',\n standalone: true,\n providers: [{ provide: RdxAvatarToken, useExisting: RdxAvatarRootDirective }]\n})\nexport class RdxAvatarRootDirective {\n /**\n * A readonly signal property that holds the current state of image loading.\n * To set a new status, use the `setState` method of the component.\n * @internal\n */\n readonly _state = signal<RdxImageLoadingStatus>('idle');\n\n /**\n * Set the avatar state.\n * @param state The new image loading status to set. This value should be one of the predefined states\n * in the `ImageLoadingStatus`\n * @returns void This method does not return a value.\n * @internal\n */\n _setState(state: RdxImageLoadingStatus): void {\n this._state.set(state);\n }\n}\n","import { inject, InjectionToken, Provider } from '@angular/core';\n\nexport interface RdxAvatarConfig {\n /**\n * Define a delay before the fallback is shown.\n * This is useful to only show the fallback for those with slower connections.\n * @default 0\n */\n delayMs: number;\n}\n\nexport const defaultAvatarConfig: RdxAvatarConfig = {\n delayMs: 0\n};\n\nexport const RdxAvatarConfigToken = new InjectionToken<RdxAvatarConfig>('RdxAvatarConfigToken');\n\nexport function provideRdxAvatarConfig(config: Partial<RdxAvatarConfig>): Provider[] {\n return [\n {\n provide: RdxAvatarConfigToken,\n useValue: { ...defaultAvatarConfig, ...config }\n }\n ];\n}\n\nexport function injectAvatarConfig(): RdxAvatarConfig {\n return inject(RdxAvatarConfigToken, { optional: true }) ?? defaultAvatarConfig;\n}\n","import { isPlatformBrowser } from '@angular/common';\nimport { Directive, inject, Input, NgZone, numberAttribute, OnDestroy, OnInit, PLATFORM_ID } from '@angular/core';\nimport { injectAvatar } from './avatar-root.directive';\nimport { injectAvatarConfig } from './avatar.config';\n\nexport interface RdxAvatarFallbackProps {\n delayMs?: number;\n}\n\n@Directive({\n selector: 'span[rdxAvatarFallback]',\n exportAs: 'rdxAvatarFallback',\n standalone: true,\n host: {\n '[style.display]': 'visible ? null : \"none\"'\n }\n})\nexport class RdxAvatarFallbackDirective implements RdxAvatarFallbackProps, OnInit, OnDestroy {\n private readonly avatar = injectAvatar();\n\n private readonly config = injectAvatarConfig();\n\n private readonly ngZone = inject(NgZone);\n\n private readonly platformId = inject(PLATFORM_ID);\n\n /**\n * Define a delay before the fallback is shown.\n * This is useful to only show the fallback for those with slower connections.\n * @default 0\n */\n @Input({ alias: 'rdxDelayMs', transform: numberAttribute }) delayMs: number = this.config.delayMs;\n\n protected get visible(): boolean {\n return this.delayElapsed && this.avatar._state() !== 'loaded';\n }\n\n /**\n * Determine the delay has elapsed, and we can show the fallback.\n */\n private delayElapsed = false;\n\n private timeoutId: ReturnType<typeof setTimeout> | null = null;\n\n ngOnInit(): void {\n if (isPlatformBrowser(this.platformId)) {\n this.ngZone.runOutsideAngular(() => {\n this.timeoutId = globalThis.setTimeout(() => {\n this.ngZone.run(() => {\n this.delayElapsed = true;\n });\n }, this.delayMs);\n });\n }\n }\n\n ngOnDestroy(): void {\n if (isPlatformBrowser(this.platformId) && this.timeoutId !== null) {\n globalThis.clearTimeout(this.timeoutId);\n }\n }\n}\n","import { Directive, ElementRef, EventEmitter, inject, OnInit, Output } from '@angular/core';\nimport { injectAvatar, RdxImageLoadingStatus } from './avatar-root.directive';\n\nexport interface RdxAvatarImageProps {\n onLoadingStatusChange?: EventEmitter<RdxImageLoadingStatus>;\n}\n\n@Directive({\n selector: 'img[rdxAvatarImage]',\n exportAs: 'rdxAvatarImage',\n standalone: true,\n host: {\n '(load)': 'onLoad()',\n '(error)': 'onError()'\n }\n})\nexport class RdxAvatarImageDirective implements RdxAvatarImageProps, OnInit {\n private readonly avatar = injectAvatar();\n\n private readonly elementRef = inject<ElementRef<HTMLImageElement>>(ElementRef);\n\n /**\n * By default, it will only render when it has loaded.\n * You can use the `onLoadingStatusChange` handler if you need more control.\n */\n @Output() onLoadingStatusChange = new EventEmitter<RdxImageLoadingStatus>();\n\n ngOnInit(): void {\n this.avatar._setState('loading');\n\n if (!this.nativeElement.src) {\n this.avatar._setState('error');\n }\n\n if (this.nativeElement.complete) {\n this.avatar._setState('loaded');\n }\n\n this.onLoadingStatusChange.emit(this.avatar._state());\n }\n\n protected onLoad(): void {\n this.avatar._setState('loaded');\n this.onLoadingStatusChange.emit('loaded');\n }\n\n protected onError(): void {\n this.avatar._setState('error');\n this.onLoadingStatusChange.emit('error');\n }\n\n get nativeElement() {\n return this.elementRef.nativeElement;\n }\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;;;AAEA,MAAM,cAAc,GAAG,IAAI,cAAc,CAAyB,gBAAgB,CAAC,CAAC;SAEpE,YAAY,GAAA;AACxB,IAAA,OAAO,MAAM,CAAC,cAAc,CAAC,CA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,CAAA,EAAA,QAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA;;2FAAvB,uBAAuB,EAAA,UAAA,EAAA,CAAA;kBATnC,SAAS;AAAC,YAAA,IAAA,EAAA,CAAA;AACP,oBAAA,QAAQ,EAAE,qBAAqB;AAC/B,oBAAA,QAAQ,EAAE,gBAAgB;AAC1B,oBAAA,UAAU,EAAE,IAAI;AAChB,oBAAA,IAAI,EAAE;AACF,wBAAA,QAAQ,EAAE,UAAU;AACpB,wBAAA,SAAS,EAAE,WAAW;AACzB,qBAAA;AACJ,iBAAA,CAAA;8BAUa,qBAAqB,EAAA,CAAA;sBAA9B,MAAM;;;ACzBX;;AAEG;;;;"}
|
@@ -0,0 +1,241 @@
|
|
1
|
+
import * as i0 from '@angular/core';
|
2
|
+
import { InjectionToken, inject, input, computed, Directive, EventEmitter, booleanAttribute, Input, Output } from '@angular/core';
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
4
|
+
|
5
|
+
const RdxCheckboxToken = new InjectionToken('RdxCheckboxToken');
|
6
|
+
function injectCheckbox() {
|
7
|
+
return inject(RdxCheckboxToken);
|
8
|
+
}
|
9
|
+
|
10
|
+
class RdxCheckboxButtonDirective {
|
11
|
+
constructor() {
|
12
|
+
this.checkbox = injectCheckbox();
|
13
|
+
this.id = input(null);
|
14
|
+
this.elementId = computed(() => (this.id() ? this.id() : `rdx-checkbox-${this.id()}`));
|
15
|
+
}
|
16
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxCheckboxButtonDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
17
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.1", type: RdxCheckboxButtonDirective, isStandalone: true, selector: "button[CheckboxButton]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "button", "role": "checkbox", "tabindex": "-1" }, properties: { "checked": "checkbox.checked", "disabled": "checkbox.disabled", "required": "checkbox.required", "attr.id": "elementId()", "attr.aria-checked": "checkbox.indeterminate ? \"mixed\" : checkbox.checked", "attr.aria-required": "checkbox.required ? \"\" : null", "attr.data-state": "checkbox.state", "attr.data-disabled": "checkbox.disabled ? \"\" : null" } }, ngImport: i0 }); }
|
18
|
+
}
|
19
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxCheckboxButtonDirective, decorators: [{
|
20
|
+
type: Directive,
|
21
|
+
args: [{
|
22
|
+
standalone: true,
|
23
|
+
selector: 'button[CheckboxButton]',
|
24
|
+
host: {
|
25
|
+
type: 'button',
|
26
|
+
role: 'checkbox',
|
27
|
+
tabindex: '-1',
|
28
|
+
'[checked]': 'checkbox.checked',
|
29
|
+
'[disabled]': 'checkbox.disabled',
|
30
|
+
'[required]': 'checkbox.required',
|
31
|
+
'[attr.id]': 'elementId()',
|
32
|
+
'[attr.aria-checked]': 'checkbox.indeterminate ? "mixed" : checkbox.checked',
|
33
|
+
'[attr.aria-required]': 'checkbox.required ? "" : null',
|
34
|
+
'[attr.data-state]': 'checkbox.state',
|
35
|
+
'[attr.data-disabled]': 'checkbox.disabled ? "" : null'
|
36
|
+
}
|
37
|
+
}]
|
38
|
+
}] });
|
39
|
+
|
40
|
+
class RdxCheckboxIndicatorDirective {
|
41
|
+
constructor() {
|
42
|
+
this.checkbox = injectCheckbox();
|
43
|
+
}
|
44
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxCheckboxIndicatorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
45
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "18.2.1", type: RdxCheckboxIndicatorDirective, isStandalone: true, selector: "[CheckboxIndicator]", host: { properties: { "style.pointer-events": "\"none\"", "attr.aria-checked": "checkbox.indeterminate ? \"mixed\" : checkbox.checked", "attr.data-state": "checkbox.state", "attr.data-disabled": "checkbox.disabled ? \"\" : null" } }, ngImport: i0 }); }
|
46
|
+
}
|
47
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxCheckboxIndicatorDirective, decorators: [{
|
48
|
+
type: Directive,
|
49
|
+
args: [{
|
50
|
+
selector: '[CheckboxIndicator]',
|
51
|
+
standalone: true,
|
52
|
+
host: {
|
53
|
+
'[style.pointer-events]': '"none"',
|
54
|
+
'[attr.aria-checked]': 'checkbox.indeterminate ? "mixed" : checkbox.checked',
|
55
|
+
'[attr.data-state]': 'checkbox.state',
|
56
|
+
'[attr.data-disabled]': 'checkbox.disabled ? "" : null'
|
57
|
+
}
|
58
|
+
}]
|
59
|
+
}] });
|
60
|
+
|
61
|
+
class RdxCheckboxInputDirective {
|
62
|
+
constructor() {
|
63
|
+
this.checkbox = injectCheckbox();
|
64
|
+
this.id = input();
|
65
|
+
this.elementId = computed(() => (this.id() ? this.id() : `rdx-checkbox-${this.id()}`));
|
66
|
+
this.value = computed(() => {
|
67
|
+
const state = this.checkbox.state;
|
68
|
+
if (state === 'indeterminate') {
|
69
|
+
return '';
|
70
|
+
}
|
71
|
+
return state ? 'on' : 'off';
|
72
|
+
});
|
73
|
+
}
|
74
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxCheckboxInputDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
75
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "18.2.1", type: RdxCheckboxInputDirective, isStandalone: true, selector: "input[CheckboxInput]", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "type": "checkbox", "tabindex": "-1" }, properties: { "checked": "checkbox.checked", "disabled": "checkbox.disabled", "required": "checkbox.required", "attr.id": "elementId()", "attr.aria-hidden": "true", "attr.aria-checked": "checkbox.indeterminate ? \"mixed\" : checkbox.checked", "attr.aria-required": "checkbox.required ? \"\" : null", "attr.data-state": "checkbox.state", "attr.data-disabled": "checkbox.disabled ? \"\" : null", "attr.value": "value()" } }, ngImport: i0 }); }
|
76
|
+
}
|
77
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxCheckboxInputDirective, decorators: [{
|
78
|
+
type: Directive,
|
79
|
+
args: [{
|
80
|
+
standalone: true,
|
81
|
+
selector: 'input[CheckboxInput]',
|
82
|
+
host: {
|
83
|
+
type: 'checkbox',
|
84
|
+
tabindex: '-1',
|
85
|
+
'[checked]': 'checkbox.checked',
|
86
|
+
'[disabled]': 'checkbox.disabled',
|
87
|
+
'[required]': 'checkbox.required',
|
88
|
+
'[attr.id]': 'elementId()',
|
89
|
+
'[attr.aria-hidden]': 'true',
|
90
|
+
'[attr.aria-checked]': 'checkbox.indeterminate ? "mixed" : checkbox.checked',
|
91
|
+
'[attr.aria-required]': 'checkbox.required ? "" : null',
|
92
|
+
'[attr.data-state]': 'checkbox.state',
|
93
|
+
'[attr.data-disabled]': 'checkbox.disabled ? "" : null',
|
94
|
+
'[attr.value]': 'value()'
|
95
|
+
}
|
96
|
+
}]
|
97
|
+
}] });
|
98
|
+
|
99
|
+
class RdxCheckboxDirective {
|
100
|
+
constructor() {
|
101
|
+
/**
|
102
|
+
* The controlled checked state of the checkbox. Must be used in conjunction with onCheckedChange.
|
103
|
+
*/
|
104
|
+
this.checked = false;
|
105
|
+
/**
|
106
|
+
* Defines whether the checkbox is indeterminate.
|
107
|
+
*/
|
108
|
+
this.indeterminate = false;
|
109
|
+
/**
|
110
|
+
* Defines whether the checkbox is disabled.
|
111
|
+
*/
|
112
|
+
this.disabled = false;
|
113
|
+
this.required = false;
|
114
|
+
/**
|
115
|
+
* Event emitted when the checkbox checked state changes.
|
116
|
+
*/
|
117
|
+
this.checkedChange = new EventEmitter();
|
118
|
+
/**
|
119
|
+
* Event emitted when the indeterminate state changes.
|
120
|
+
*/
|
121
|
+
this.indeterminateChange = new EventEmitter();
|
122
|
+
}
|
123
|
+
/**
|
124
|
+
* Determine the state
|
125
|
+
*/
|
126
|
+
get state() {
|
127
|
+
if (this.indeterminate) {
|
128
|
+
return 'indeterminate';
|
129
|
+
}
|
130
|
+
return this.checked ? 'checked' : 'unchecked';
|
131
|
+
}
|
132
|
+
onKeyDown(event) {
|
133
|
+
// According to WAI ARIA, Checkboxes don't activate on enter keypress
|
134
|
+
if (event.key === 'Enter') {
|
135
|
+
event.preventDefault();
|
136
|
+
}
|
137
|
+
}
|
138
|
+
onClick($event) {
|
139
|
+
if (this.disabled) {
|
140
|
+
return;
|
141
|
+
}
|
142
|
+
this.checked = this.indeterminate ? true : !this.checked;
|
143
|
+
this.checkedChange.emit(this.checked);
|
144
|
+
this.onChange?.(this.checked);
|
145
|
+
if (this.indeterminate) {
|
146
|
+
this.indeterminate = false;
|
147
|
+
this.indeterminateChange.emit(this.indeterminate);
|
148
|
+
}
|
149
|
+
$event.preventDefault();
|
150
|
+
}
|
151
|
+
onBlur() {
|
152
|
+
this.onTouched?.();
|
153
|
+
}
|
154
|
+
ngOnChanges(changes) {
|
155
|
+
if (changes['checked'] && !changes['checked'].isFirstChange()) {
|
156
|
+
this.checkedChange.emit(this.checked);
|
157
|
+
}
|
158
|
+
if (changes['indeterminate'] && !changes['indeterminate'].isFirstChange()) {
|
159
|
+
this.indeterminateChange.emit(this.indeterminate);
|
160
|
+
}
|
161
|
+
}
|
162
|
+
/**
|
163
|
+
* Sets the checked state of the checkbox.
|
164
|
+
* @param checked The checked state of the checkbox.
|
165
|
+
* @internal
|
166
|
+
*/
|
167
|
+
writeValue(checked) {
|
168
|
+
this.checked = checked;
|
169
|
+
}
|
170
|
+
/**
|
171
|
+
* Registers a callback function that should be called when the checkbox checked state changes.
|
172
|
+
* @param fn The callback function.
|
173
|
+
* @internal
|
174
|
+
*/
|
175
|
+
registerOnChange(fn) {
|
176
|
+
this.onChange = fn;
|
177
|
+
}
|
178
|
+
/**
|
179
|
+
* Registers a callback function that should be called when the checkbox is blurred.
|
180
|
+
* @param fn The callback function.
|
181
|
+
* @internal
|
182
|
+
*/
|
183
|
+
registerOnTouched(fn) {
|
184
|
+
this.onTouched = fn;
|
185
|
+
}
|
186
|
+
/**
|
187
|
+
* Sets the disabled state of the checkbox.
|
188
|
+
* @param isDisabled The disabled state of the checkbox.
|
189
|
+
* @internal
|
190
|
+
*/
|
191
|
+
setDisabledState(isDisabled) {
|
192
|
+
this.disabled = isDisabled;
|
193
|
+
}
|
194
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxCheckboxDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
195
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "16.1.0", version: "18.2.1", type: RdxCheckboxDirective, isStandalone: true, selector: "[CheckboxRoot]", inputs: { checked: ["checked", "checked", booleanAttribute], indeterminate: ["indeterminate", "indeterminate", booleanAttribute], disabled: ["disabled", "disabled", booleanAttribute], required: ["required", "required", booleanAttribute] }, outputs: { checkedChange: "checkedChange", indeterminateChange: "indeterminateChange" }, host: { listeners: { "keydown": "onKeyDown($event)", "click": "onClick($event)", "blur": "onBlur()" }, properties: { "disabled": "disabled", "attr.data-disabled": "disabled ? \"\" : null", "attr.data-state": "state" } }, providers: [
|
196
|
+
{ provide: RdxCheckboxToken, useExisting: RdxCheckboxDirective },
|
197
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: RdxCheckboxDirective, multi: true }
|
198
|
+
], usesOnChanges: true, ngImport: i0 }); }
|
199
|
+
}
|
200
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.1", ngImport: i0, type: RdxCheckboxDirective, decorators: [{
|
201
|
+
type: Directive,
|
202
|
+
args: [{
|
203
|
+
selector: '[CheckboxRoot]',
|
204
|
+
standalone: true,
|
205
|
+
providers: [
|
206
|
+
{ provide: RdxCheckboxToken, useExisting: RdxCheckboxDirective },
|
207
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: RdxCheckboxDirective, multi: true }
|
208
|
+
],
|
209
|
+
host: {
|
210
|
+
'[disabled]': 'disabled',
|
211
|
+
'[attr.data-disabled]': 'disabled ? "" : null',
|
212
|
+
'[attr.data-state]': 'state',
|
213
|
+
'(keydown)': 'onKeyDown($event)',
|
214
|
+
'(click)': 'onClick($event)',
|
215
|
+
'(blur)': 'onBlur()'
|
216
|
+
}
|
217
|
+
}]
|
218
|
+
}], propDecorators: { checked: [{
|
219
|
+
type: Input,
|
220
|
+
args: [{ transform: booleanAttribute }]
|
221
|
+
}], indeterminate: [{
|
222
|
+
type: Input,
|
223
|
+
args: [{ transform: booleanAttribute }]
|
224
|
+
}], disabled: [{
|
225
|
+
type: Input,
|
226
|
+
args: [{ transform: booleanAttribute }]
|
227
|
+
}], required: [{
|
228
|
+
type: Input,
|
229
|
+
args: [{ transform: booleanAttribute }]
|
230
|
+
}], checkedChange: [{
|
231
|
+
type: Output
|
232
|
+
}], indeterminateChange: [{
|
233
|
+
type: Output
|
234
|
+
}] } });
|
235
|
+
|
236
|
+
/**
|
237
|
+
* Generated bundle index. Do not edit.
|
238
|
+
*/
|
239
|
+
|
240
|
+
export { RdxCheckboxButtonDirective, RdxCheckboxDirective, RdxCheckboxIndicatorDirective, RdxCheckboxInputDirective, RdxCheckboxToken, injectCheckbox };
|
241
|
+
//# sourceMappingURL=radix-ng-primitives-checkbox.mjs.map
|