@radix-ng/primitives 0.11.0 → 0.12.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/.compodocrc.json +12 -0
- package/CHANGELOG.md +182 -0
- package/LICENSE +21 -0
- package/accordion/__tests__/accordion-content.directive.spec.ts +8 -0
- package/accordion/__tests__/accordion-header.directive.spec.ts +8 -0
- package/accordion/__tests__/accordion-item.directive.spec.ts +8 -0
- package/accordion/__tests__/accordion-root.directive.spec.ts +8 -0
- package/accordion/__tests__/accordion-trigger.directive.spec.ts +8 -0
- package/accordion/ng-package.json +5 -0
- package/accordion/src/accordion-content.directive.ts +46 -0
- package/accordion/src/accordion-header.directive.ts +15 -0
- package/accordion/src/accordion-item.directive.ts +216 -0
- package/accordion/src/accordion-root.directive.ts +205 -0
- package/accordion/src/accordion-trigger.directive.ts +37 -0
- package/accordion/stories/accordion.docs.mdx +77 -0
- package/accordion/stories/accordion.stories.ts +340 -0
- package/alert-dialog/{index.d.ts → index.ts} +1 -0
- package/alert-dialog/ng-package.json +5 -0
- package/alert-dialog/src/alert-dialog-cancel.directive.ts +17 -0
- package/alert-dialog/src/alert-dialog-content.directive.ts +24 -0
- package/alert-dialog/src/alert-dialog-root.directive.ts +15 -0
- package/alert-dialog/src/alert-dialog-title.directive.ts +7 -0
- package/alert-dialog/src/alert-dialog-trigger.directive.ts +17 -0
- package/alert-dialog/src/alert-dialog.service.ts +51 -0
- package/alert-dialog/stories/alert-dialog.stories.ts +139 -0
- package/avatar/__tests__/avatar-fallback.directive.spec.ts +31 -0
- package/avatar/__tests__/avatar-image.directive.spec.ts +36 -0
- package/avatar/ng-package.json +5 -0
- package/avatar/src/avatar-fallback.directive.ts +62 -0
- package/avatar/src/avatar-image.directive.ts +55 -0
- package/avatar/src/avatar-root.directive.ts +35 -0
- package/avatar/src/avatar.config.ts +29 -0
- package/avatar/stories/avatar.docs.mdx +37 -0
- package/avatar/stories/avatar.stories.ts +87 -0
- package/button/__tests__/.gitkeep +0 -0
- package/button/src/button-abstract.directive.ts +46 -0
- package/checkbox/ng-package.json +5 -0
- package/checkbox/src/checkbox-button.directive.ts +26 -0
- package/checkbox/src/checkbox-indicator.directive.ts +16 -0
- package/checkbox/src/checkbox-input.directive.ts +36 -0
- package/checkbox/src/checkbox.directive.ts +146 -0
- package/checkbox/src/checkbox.token.ts +8 -0
- package/checkbox/stories/checkbox-group.component.ts +87 -0
- package/checkbox/stories/checkbox-group.styles.scss +49 -0
- package/checkbox/stories/checkbox-indeterminate.component.ts +52 -0
- package/checkbox/stories/checkbox.docs.mdx +58 -0
- package/checkbox/stories/checkbox.stories.ts +105 -0
- package/collapsible/__tests__/collapsible-content.directive.spec.ts +30 -0
- package/collapsible/__tests__/collapsible-root.directive.spec.ts +27 -0
- package/collapsible/__tests__/collapsible-trigger.directive.spec.ts +30 -0
- package/collapsible/ng-package.json +5 -0
- package/collapsible/src/collapsible-content.directive.ts +34 -0
- package/collapsible/src/collapsible-content.token.ts +6 -0
- package/collapsible/src/collapsible-root.directive.ts +120 -0
- package/collapsible/src/collapsible-trigger.directive.ts +44 -0
- package/collapsible/stories/collapsible-animation.component.ts +116 -0
- package/collapsible/stories/collapsible-external-triggering.component.ts +86 -0
- package/collapsible/stories/collapsible.docs.mdx +53 -0
- package/collapsible/stories/collapsible.stories.ts +151 -0
- package/context-menu/README.md +1 -0
- package/context-menu/index.ts +10 -0
- package/context-menu/ng-package.json +5 -0
- package/context-menu/src/context-menu-content.directive.ts +47 -0
- package/context-menu/src/context-menu-item-checkbox.directive.ts +30 -0
- package/context-menu/src/context-menu-item-indicator.directive.ts +14 -0
- package/context-menu/src/context-menu-item-radio-group.directive.ts +31 -0
- package/context-menu/src/context-menu-item-radio.directive.ts +69 -0
- package/context-menu/src/context-menu-item-selectable.ts +18 -0
- package/context-menu/src/context-menu-item.directive.ts +65 -0
- package/context-menu/src/context-menu-label.directive.ts +7 -0
- package/context-menu/src/context-menu-separator.directive.ts +13 -0
- package/context-menu/src/context-menu-trigger.directive.ts +82 -0
- package/context-menu/stories/context-menu.docs.mdx +23 -0
- package/context-menu/stories/context-menu.stories.ts +253 -0
- package/core/index.ts +3 -0
- package/core/src/accessor/provide-value-accessor.ts +20 -0
- package/core/src/auto-focus.directive.ts +81 -0
- package/core/src/inject-ng-control.ts +28 -0
- package/core/src/mount.ts +27 -0
- package/dialog/README.md +1 -0
- package/dialog/__tests__/dialog-content.directive.spec.ts +77 -0
- package/dialog/__tests__/dialog-trigger.directive.spec.ts +85 -0
- package/dialog/index.ts +31 -0
- package/dialog/ng-package.json +5 -0
- package/dialog/src/dialog-close.directive.ts +18 -0
- package/dialog/src/dialog-content.directive.ts +45 -0
- package/dialog/src/dialog-description.directive.ts +7 -0
- package/dialog/src/dialog-dismiss.directive.ts +18 -0
- package/dialog/src/dialog-ref.ts +70 -0
- package/dialog/src/dialog-title.directive.ts +7 -0
- package/dialog/src/dialog-trigger.directive.ts +52 -0
- package/dialog/src/dialog.config.ts +55 -0
- package/dialog/src/dialog.injectors.ts +12 -0
- package/dialog/src/dialog.providers.ts +27 -0
- package/dialog/src/dialog.service.ts +94 -0
- package/dialog/stories/dialog.docs.mdx +32 -0
- package/dialog/stories/dialog.stories.ts +233 -0
- package/dropdown-menu/ng-package.json +5 -0
- package/dropdown-menu/src/dropdown-menu-content.directive.ts +47 -0
- package/dropdown-menu/src/dropdown-menu-item-checkbox.directive.ts +30 -0
- package/dropdown-menu/src/dropdown-menu-item-indicator.directive.ts +14 -0
- package/dropdown-menu/src/dropdown-menu-item-radio-group.directive.ts +31 -0
- package/dropdown-menu/src/dropdown-menu-item-radio.directive.ts +72 -0
- package/dropdown-menu/src/dropdown-menu-item-selectable.ts +18 -0
- package/dropdown-menu/src/dropdown-menu-item.directive.ts +66 -0
- package/dropdown-menu/src/dropdown-menu-label.directive.ts +7 -0
- package/dropdown-menu/src/dropdown-menu-separator.directive.ts +13 -0
- package/dropdown-menu/src/dropdown-menu-trigger.directive.ts +185 -0
- package/dropdown-menu/stories/dropdown-menu-item-checkbox.component.ts +104 -0
- package/dropdown-menu/stories/dropdown-menu-item-checkbox.styles.scss +106 -0
- package/dropdown-menu/stories/dropdown-menu-item-radio.component.ts +95 -0
- package/dropdown-menu/stories/dropdown-menu-item-radio.styles.scss +106 -0
- package/dropdown-menu/stories/dropdown.docs.mdx +27 -0
- package/dropdown-menu/stories/dropdown.stories.ts +212 -0
- package/form-field/index.ts +1 -0
- package/form-field/src/.gitkeep +0 -0
- package/jest.config.ts +21 -0
- package/label/__tests__/label-root.directive.spec.ts +99 -0
- package/label/ng-package.json +5 -0
- package/label/src/label.directive.ts +58 -0
- package/label/stories/label.docs.mdx +40 -0
- package/label/stories/label.stories.ts +76 -0
- package/menu/index.ts +29 -0
- package/menu/ng-package.json +5 -0
- package/menu/src/menu-content.directive.ts +9 -0
- package/menu/src/menu-directive.ts +10 -0
- package/menu/src/menu-group.directive.ts +12 -0
- package/menu/src/menu-item.directive.ts +44 -0
- package/menu/src/menu-label.directive.ts +7 -0
- package/menu/src/menu-separator.directive.ts +13 -0
- package/menubar/index.ts +38 -0
- package/menubar/ng-package.json +5 -0
- package/menubar/src/menubar-content.directive.ts +9 -0
- package/menubar/src/menubar-item-checkbox.directive.ts +32 -0
- package/menubar/src/menubar-item-indicator.directive.ts +10 -0
- package/menubar/src/menubar-item-radio.directive.ts +33 -0
- package/menubar/src/menubar-item.directive.ts +12 -0
- package/menubar/src/menubar-radio-group.directive.ts +9 -0
- package/menubar/src/menubar-root.directive.ts +15 -0
- package/menubar/src/menubar-separator.directive.ts +9 -0
- package/menubar/src/menubar-trigger.directive.ts +40 -0
- package/menubar/stories/menubar.stories.ts +229 -0
- package/ng-package.json +8 -0
- package/package.json +4 -112
- package/portal/stories/portal.docs.mdx +85 -0
- package/presence/__test__/presence-test.component.ts +51 -0
- package/presence/__test__/presence.spec.ts +50 -0
- package/presence/index.ts +4 -0
- package/presence/src/presence.ts +119 -0
- package/presence/src/transitions/transition.collapse.ts +99 -0
- package/presence/src/transitions/transition.toast.ts +27 -0
- package/presence/src/types.ts +20 -0
- package/presence/src/utils.ts +63 -0
- package/presence/stories/presence-story.componen.ts +69 -0
- package/presence/stories/presence.docs.mdx +40 -0
- package/presence/stories/presence.stories.ts +29 -0
- package/progress/__test__/progress.spec.ts +55 -0
- package/progress/{index.d.ts → index.ts} +1 -0
- package/progress/ng-package.json +5 -0
- package/progress/src/progress-indicator.directive.ts +26 -0
- package/progress/src/progress-root.directive.ts +134 -0
- package/progress/stories/progress.docs.mdx +65 -0
- package/progress/stories/progress.stories.ts +66 -0
- package/project.json +39 -0
- package/radio/{index.d.ts → index.ts} +1 -0
- package/radio/ng-package.json +5 -0
- package/radio/src/radio-indicator.directive.ts +17 -0
- package/radio/src/radio-item.directive.ts +68 -0
- package/radio/src/radio-root.directive.ts +207 -0
- package/radio/src/{radio-tokens.d.ts → radio-tokens.ts} +5 -1
- package/radio/stories/radio-group.component.ts +39 -0
- package/radio/stories/radio-group.styles.scss +70 -0
- package/radio/stories/radio.docs.mdx +68 -0
- package/radio/stories/radio.stories.ts +155 -0
- package/separator/__tests__/separator.directive.spec.ts +58 -0
- package/separator/ng-package.json +5 -0
- package/separator/src/separator.directive.ts +35 -0
- package/separator/stories/separator.docs.mdx +37 -0
- package/separator/stories/separator.stories.ts +82 -0
- package/slider/src/slider-input.directive.ts +0 -0
- package/slider/src/slider-thumb.directives.ts +60 -0
- package/slider/src/slider-track.directive.ts +11 -0
- package/slider/src/slider.directive.ts +59 -0
- package/slider/src/slider.types.ts +4 -0
- package/switch/index.ts +22 -0
- package/switch/ng-package.json +5 -0
- package/switch/src/switch-input.directive.ts +24 -0
- package/switch/src/switch-root.directive.ts +127 -0
- package/switch/src/switch-thumb.directive.ts +15 -0
- package/switch/stories/switch.docs.mdx +83 -0
- package/switch/stories/switch.stories.ts +149 -0
- package/tabs/__tests__/tabs-context.service.spec.ts +35 -0
- package/tabs/index.ts +26 -0
- package/tabs/ng-package.json +5 -0
- package/tabs/src/tabs-content.directive.ts +23 -0
- package/tabs/src/tabs-context.service.ts +43 -0
- package/tabs/src/tabs-list.directive.ts +21 -0
- package/tabs/src/tabs-root.directive.ts +70 -0
- package/tabs/src/tabs-trigger.directive.ts +55 -0
- package/tabs/stories/tabs.stories.ts +213 -0
- package/test-setup.ts +1 -0
- package/toggle/__tests__/toggle.directive.spec.ts +87 -0
- package/toggle/ng-package.json +5 -0
- package/toggle/src/toggle.directive.ts +49 -0
- package/toggle/stories/toggle.docs.mdx +60 -0
- package/toggle/stories/toggle.stories.ts +84 -0
- package/toggle-group/ng-package.json +5 -0
- package/toggle-group/src/toggle-group-button.directive.ts +73 -0
- package/toggle-group/src/toggle-group-button.token.ts +8 -0
- package/toggle-group/src/toggle-group-multi.directive.ts +158 -0
- package/toggle-group/src/toggle-group.directive.ts +148 -0
- package/toggle-group/src/toggle-group.token.ts +11 -0
- package/toggle-group/stories/toggle-group.docs.mdx +87 -0
- package/toggle-group/stories/toggle-group.stories.ts +95 -0
- package/tsconfig.doc.json +11 -0
- package/tsconfig.json +29 -0
- package/tsconfig.lib.json +19 -0
- package/tsconfig.lib.prod.json +12 -0
- package/tsconfig.spec.json +11 -0
- package/visually-hidden/README.md +3 -0
- package/visually-hidden/stories/visually-hidden.docs.mdx +36 -0
- package/accordion/src/accordion-content.directive.d.ts +0 -16
- package/accordion/src/accordion-header.directive.d.ts +0 -7
- package/accordion/src/accordion-item.directive.d.ts +0 -62
- package/accordion/src/accordion-root.directive.d.ts +0 -78
- package/accordion/src/accordion-trigger.directive.d.ts +0 -15
- package/alert-dialog/src/alert-dialog-cancel.directive.d.ts +0 -7
- package/alert-dialog/src/alert-dialog-content.directive.d.ts +0 -9
- package/alert-dialog/src/alert-dialog-root.directive.d.ts +0 -9
- package/alert-dialog/src/alert-dialog-title.directive.d.ts +0 -5
- package/alert-dialog/src/alert-dialog-trigger.directive.d.ts +0 -7
- package/alert-dialog/src/alert-dialog.service.d.ts +0 -14
- package/avatar/src/avatar-fallback.directive.d.ts +0 -27
- package/avatar/src/avatar-image.directive.d.ts +0 -16
- package/avatar/src/avatar-root.directive.d.ts +0 -21
- package/avatar/src/avatar.config.d.ts +0 -13
- package/checkbox/src/checkbox-button.directive.d.ts +0 -8
- package/checkbox/src/checkbox-indicator.directive.d.ts +0 -6
- package/checkbox/src/checkbox-input.directive.d.ts +0 -9
- package/checkbox/src/checkbox.directive.d.ts +0 -75
- package/checkbox/src/checkbox.token.d.ts +0 -4
- package/collapsible/src/collapsible-content.directive.d.ts +0 -17
- package/collapsible/src/collapsible-content.token.d.ts +0 -3
- package/collapsible/src/collapsible-root.directive.d.ts +0 -55
- package/collapsible/src/collapsible-trigger.directive.d.ts +0 -26
- package/compodoc/documentation.json +0 -11395
- package/dropdown-menu/src/dropdown-menu-content.directive.d.ts +0 -15
- package/dropdown-menu/src/dropdown-menu-item-checkbox.directive.d.ts +0 -9
- package/dropdown-menu/src/dropdown-menu-item-indicator.directive.d.ts +0 -7
- package/dropdown-menu/src/dropdown-menu-item-radio-group.directive.d.ts +0 -12
- package/dropdown-menu/src/dropdown-menu-item-radio.directive.d.ts +0 -19
- package/dropdown-menu/src/dropdown-menu-item-selectable.d.ts +0 -12
- package/dropdown-menu/src/dropdown-menu-item.directive.d.ts +0 -17
- package/dropdown-menu/src/dropdown-menu-label.directive.d.ts +0 -5
- package/dropdown-menu/src/dropdown-menu-separator.directive.d.ts +0 -6
- package/dropdown-menu/src/dropdown-menu-trigger.directive.d.ts +0 -43
- package/esm2022/accordion/index.mjs +0 -6
- package/esm2022/accordion/radix-ng-primitives-accordion.mjs +0 -5
- package/esm2022/accordion/src/accordion-content.directive.mjs +0 -36
- package/esm2022/accordion/src/accordion-header.directive.mjs +0 -23
- package/esm2022/accordion/src/accordion-item.directive.mjs +0 -170
- package/esm2022/accordion/src/accordion-root.directive.mjs +0 -157
- package/esm2022/accordion/src/accordion-trigger.directive.mjs +0 -42
- package/esm2022/alert-dialog/index.mjs +0 -7
- package/esm2022/alert-dialog/radix-ng-primitives-alert-dialog.mjs +0 -5
- package/esm2022/alert-dialog/src/alert-dialog-cancel.directive.mjs +0 -24
- package/esm2022/alert-dialog/src/alert-dialog-content.directive.mjs +0 -34
- package/esm2022/alert-dialog/src/alert-dialog-root.directive.mjs +0 -25
- package/esm2022/alert-dialog/src/alert-dialog-title.directive.mjs +0 -14
- package/esm2022/alert-dialog/src/alert-dialog-trigger.directive.mjs +0 -24
- package/esm2022/alert-dialog/src/alert-dialog.service.mjs +0 -47
- package/esm2022/avatar/index.mjs +0 -5
- package/esm2022/avatar/radix-ng-primitives-avatar.mjs +0 -5
- package/esm2022/avatar/src/avatar-fallback.directive.mjs +0 -54
- package/esm2022/avatar/src/avatar-image.directive.mjs +0 -48
- package/esm2022/avatar/src/avatar-root.directive.mjs +0 -38
- package/esm2022/avatar/src/avatar.config.mjs +0 -17
- package/esm2022/checkbox/index.mjs +0 -6
- package/esm2022/checkbox/radix-ng-primitives-checkbox.mjs +0 -5
- package/esm2022/checkbox/src/checkbox-button.directive.mjs +0 -33
- package/esm2022/checkbox/src/checkbox-indicator.directive.mjs +0 -24
- package/esm2022/checkbox/src/checkbox-input.directive.mjs +0 -41
- package/esm2022/checkbox/src/checkbox.directive.mjs +0 -141
- package/esm2022/checkbox/src/checkbox.token.mjs +0 -6
- package/esm2022/collapsible/index.mjs +0 -4
- package/esm2022/collapsible/radix-ng-primitives-collapsible.mjs +0 -5
- package/esm2022/collapsible/src/collapsible-content.directive.mjs +0 -45
- package/esm2022/collapsible/src/collapsible-content.token.mjs +0 -3
- package/esm2022/collapsible/src/collapsible-root.directive.mjs +0 -118
- package/esm2022/collapsible/src/collapsible-trigger.directive.mjs +0 -49
- package/esm2022/dropdown-menu/index.mjs +0 -11
- package/esm2022/dropdown-menu/radix-ng-primitives-dropdown-menu.mjs +0 -5
- package/esm2022/dropdown-menu/src/dropdown-menu-content.directive.mjs +0 -56
- package/esm2022/dropdown-menu/src/dropdown-menu-item-checkbox.directive.mjs +0 -36
- package/esm2022/dropdown-menu/src/dropdown-menu-item-indicator.directive.mjs +0 -22
- package/esm2022/dropdown-menu/src/dropdown-menu-item-radio-group.directive.mjs +0 -37
- package/esm2022/dropdown-menu/src/dropdown-menu-item-radio.directive.mjs +0 -64
- package/esm2022/dropdown-menu/src/dropdown-menu-item-selectable.mjs +0 -31
- package/esm2022/dropdown-menu/src/dropdown-menu-item.directive.mjs +0 -71
- package/esm2022/dropdown-menu/src/dropdown-menu-label.directive.mjs +0 -14
- package/esm2022/dropdown-menu/src/dropdown-menu-separator.directive.mjs +0 -21
- package/esm2022/dropdown-menu/src/dropdown-menu-trigger.directive.mjs +0 -176
- package/esm2022/index.mjs +0 -2
- package/esm2022/label/index.mjs +0 -2
- package/esm2022/label/radix-ng-primitives-label.mjs +0 -5
- package/esm2022/label/src/label.directive.mjs +0 -59
- package/esm2022/menu/index.mjs +0 -45
- package/esm2022/menu/radix-ng-primitives-menu.mjs +0 -5
- package/esm2022/menu/src/menu-content.directive.mjs +0 -17
- package/esm2022/menu/src/menu-directive.mjs +0 -18
- package/esm2022/menu/src/menu-group.directive.mjs +0 -20
- package/esm2022/menu/src/menu-item.directive.mjs +0 -46
- package/esm2022/menu/src/menu-label.directive.mjs +0 -14
- package/esm2022/menu/src/menu-separator.directive.mjs +0 -21
- package/esm2022/menubar/index.mjs +0 -60
- package/esm2022/menubar/radix-ng-primitives-menubar.mjs +0 -5
- package/esm2022/menubar/src/menubar-content.directive.mjs +0 -17
- package/esm2022/menubar/src/menubar-item-checkbox.directive.mjs +0 -34
- package/esm2022/menubar/src/menubar-item-indicator.directive.mjs +0 -17
- package/esm2022/menubar/src/menubar-item-radio.directive.mjs +0 -35
- package/esm2022/menubar/src/menubar-item.directive.mjs +0 -20
- package/esm2022/menubar/src/menubar-radio-group.directive.mjs +0 -17
- package/esm2022/menubar/src/menubar-root.directive.mjs +0 -24
- package/esm2022/menubar/src/menubar-separator.directive.mjs +0 -17
- package/esm2022/menubar/src/menubar-trigger.directive.mjs +0 -45
- package/esm2022/progress/index.mjs +0 -3
- package/esm2022/progress/radix-ng-primitives-progress.mjs +0 -5
- package/esm2022/progress/src/progress-indicator.directive.mjs +0 -34
- package/esm2022/progress/src/progress-root.directive.mjs +0 -127
- package/esm2022/radio/index.mjs +0 -4
- package/esm2022/radio/radix-ng-primitives-radio.mjs +0 -5
- package/esm2022/radio/src/radio-indicator.directive.mjs +0 -25
- package/esm2022/radio/src/radio-item.directive.mjs +0 -70
- package/esm2022/radio/src/radio-root.directive.mjs +0 -194
- package/esm2022/radio/src/radio-tokens.mjs +0 -3
- package/esm2022/radix-ng-primitives.mjs +0 -5
- package/esm2022/separator/index.mjs +0 -2
- package/esm2022/separator/radix-ng-primitives-separator.mjs +0 -5
- package/esm2022/separator/src/separator.directive.mjs +0 -31
- package/esm2022/switch/index.mjs +0 -30
- package/esm2022/switch/radix-ng-primitives-switch.mjs +0 -5
- package/esm2022/switch/src/switch-input.directive.mjs +0 -32
- package/esm2022/switch/src/switch-root.directive.mjs +0 -95
- package/esm2022/switch/src/switch-thumb.directive.mjs +0 -23
- package/esm2022/tabs/index.mjs +0 -38
- package/esm2022/tabs/radix-ng-primitives-tabs.mjs +0 -5
- package/esm2022/tabs/src/tabs-content.directive.mjs +0 -29
- package/esm2022/tabs/src/tabs-context.service.mjs +0 -43
- package/esm2022/tabs/src/tabs-list.directive.mjs +0 -23
- package/esm2022/tabs/src/tabs-root.directive.mjs +0 -54
- package/esm2022/tabs/src/tabs-trigger.directive.mjs +0 -52
- package/esm2022/toggle/index.mjs +0 -2
- package/esm2022/toggle/radix-ng-primitives-toggle.mjs +0 -5
- package/esm2022/toggle/src/toggle.directive.mjs +0 -39
- package/esm2022/toggle-group/index.mjs +0 -6
- package/esm2022/toggle-group/radix-ng-primitives-toggle-group.mjs +0 -5
- package/esm2022/toggle-group/src/toggle-group-button.directive.mjs +0 -75
- package/esm2022/toggle-group/src/toggle-group-button.token.mjs +0 -6
- package/esm2022/toggle-group/src/toggle-group-multi.directive.mjs +0 -143
- package/esm2022/toggle-group/src/toggle-group.directive.mjs +0 -134
- package/esm2022/toggle-group/src/toggle-group.token.mjs +0 -6
- package/fesm2022/radix-ng-primitives-accordion.mjs +0 -418
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs +0 -161
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-avatar.mjs +0 -156
- package/fesm2022/radix-ng-primitives-avatar.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +0 -241
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +0 -213
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs +0 -502
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-label.mjs +0 -66
- package/fesm2022/radix-ng-primitives-label.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-menu.mjs +0 -158
- package/fesm2022/radix-ng-primitives-menu.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs +0 -245
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-progress.mjs +0 -165
- package/fesm2022/radix-ng-primitives-progress.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +0 -289
- package/fesm2022/radix-ng-primitives-radio.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-separator.mjs +0 -38
- package/fesm2022/radix-ng-primitives-separator.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +0 -173
- package/fesm2022/radix-ng-primitives-switch.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +0 -222
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +0 -358
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +0 -46
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +0 -1
- package/fesm2022/radix-ng-primitives.mjs +0 -4
- package/fesm2022/radix-ng-primitives.mjs.map +0 -1
- package/label/src/label.directive.d.ts +0 -29
- package/menu/index.d.ts +0 -18
- package/menu/src/menu-content.directive.d.ts +0 -6
- package/menu/src/menu-directive.d.ts +0 -6
- package/menu/src/menu-group.directive.d.ts +0 -6
- package/menu/src/menu-item.directive.d.ts +0 -12
- package/menu/src/menu-label.directive.d.ts +0 -5
- package/menu/src/menu-separator.directive.d.ts +0 -6
- package/menubar/index.d.ts +0 -24
- package/menubar/src/menubar-content.directive.d.ts +0 -6
- package/menubar/src/menubar-item-checkbox.directive.d.ts +0 -14
- package/menubar/src/menubar-item-indicator.directive.d.ts +0 -5
- package/menubar/src/menubar-item-radio.directive.d.ts +0 -14
- package/menubar/src/menubar-item.directive.d.ts +0 -8
- package/menubar/src/menubar-radio-group.directive.d.ts +0 -6
- package/menubar/src/menubar-root.directive.d.ts +0 -7
- package/menubar/src/menubar-separator.directive.d.ts +0 -6
- package/menubar/src/menubar-trigger.directive.d.ts +0 -11
- package/progress/src/progress-indicator.directive.d.ts +0 -16
- package/progress/src/progress-root.directive.d.ts +0 -63
- package/radio/src/radio-indicator.directive.d.ts +0 -9
- package/radio/src/radio-item.directive.d.ts +0 -21
- package/radio/src/radio-root.directive.d.ts +0 -72
- package/separator/src/separator.directive.d.ts +0 -22
- package/switch/index.d.ts +0 -13
- package/switch/src/switch-input.directive.d.ts +0 -6
- package/switch/src/switch-root.directive.d.ts +0 -51
- package/switch/src/switch-thumb.directive.d.ts +0 -6
- package/tabs/index.d.ts +0 -15
- package/tabs/src/tabs-content.directive.d.ts +0 -8
- package/tabs/src/tabs-context.service.d.ts +0 -22
- package/tabs/src/tabs-list.directive.d.ts +0 -6
- package/tabs/src/tabs-root.directive.d.ts +0 -37
- package/tabs/src/tabs-trigger.directive.d.ts +0 -19
- package/toggle/src/toggle.directive.d.ts +0 -30
- package/toggle-group/src/toggle-group-button.directive.d.ts +0 -39
- package/toggle-group/src/toggle-group-button.token.d.ts +0 -4
- package/toggle-group/src/toggle-group-multi.directive.d.ts +0 -93
- package/toggle-group/src/toggle-group.directive.d.ts +0 -84
- package/toggle-group/src/toggle-group.token.d.ts +0 -5
- /package/accordion/{index.d.ts → index.ts} +0 -0
- /package/avatar/{index.d.ts → index.ts} +0 -0
- /package/checkbox/{index.d.ts → index.ts} +0 -0
- /package/collapsible/{index.d.ts → index.ts} +0 -0
- /package/dropdown-menu/{index.d.ts → index.ts} +0 -0
- /package/{index.d.ts → index.ts} +0 -0
- /package/label/{index.d.ts → index.ts} +0 -0
- /package/separator/{index.d.ts → index.ts} +0 -0
- /package/toggle/{index.d.ts → index.ts} +0 -0
- /package/toggle-group/{index.d.ts → index.ts} +0 -0
@@ -0,0 +1,158 @@
|
|
1
|
+
import {
|
2
|
+
AfterContentInit,
|
3
|
+
booleanAttribute,
|
4
|
+
ContentChildren,
|
5
|
+
Directive,
|
6
|
+
EventEmitter,
|
7
|
+
Input,
|
8
|
+
OnChanges,
|
9
|
+
QueryList,
|
10
|
+
SimpleChanges
|
11
|
+
} from '@angular/core';
|
12
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
13
|
+
import type { RdxToggleGroupButtonDirective } from './toggle-group-button.directive';
|
14
|
+
import { RdxToggleGroupButtonToken } from './toggle-group-button.token';
|
15
|
+
import { RdxToggleGroupToken } from './toggle-group.token';
|
16
|
+
|
17
|
+
@Directive({
|
18
|
+
selector: '[rdxToggleGroupMulti]',
|
19
|
+
standalone: true,
|
20
|
+
providers: [
|
21
|
+
{ provide: RdxToggleGroupToken, useExisting: RdxToggleGroupMultiDirective },
|
22
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: RdxToggleGroupMultiDirective, multi: true }
|
23
|
+
],
|
24
|
+
host: {
|
25
|
+
role: 'group',
|
26
|
+
'[attr.data-orientation]': 'orientation',
|
27
|
+
'(focusout)': 'onTouched?.()'
|
28
|
+
}
|
29
|
+
})
|
30
|
+
export class RdxToggleGroupMultiDirective implements OnChanges, AfterContentInit, ControlValueAccessor {
|
31
|
+
/**
|
32
|
+
* The selected toggle button.
|
33
|
+
*/
|
34
|
+
@Input('rdxToggleGroupMultiValue') value: ReadonlyArray<string> = [];
|
35
|
+
|
36
|
+
/**
|
37
|
+
* The orientation of the toggle group.
|
38
|
+
* @default 'horizontal'
|
39
|
+
*/
|
40
|
+
@Input('rdxToggleGroupMultiOrientation') orientation: 'horizontal' | 'vertical' = 'horizontal';
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Whether the toggle group is disabled.
|
44
|
+
* @default false
|
45
|
+
*/
|
46
|
+
@Input({ alias: 'rdxToggleGroupMultiDisabled', transform: booleanAttribute }) disabled = false;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Whether the toggle group roving focus should wrap.
|
50
|
+
* @default true
|
51
|
+
*/
|
52
|
+
@Input({ alias: 'rdxToggleGroupMultiWrap', transform: booleanAttribute }) wrap = true;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Event emitted when the selected toggle button changes.
|
56
|
+
*/
|
57
|
+
@Input('rdxToggleGroupMultiValueChange') readonly valueChange = new EventEmitter<ReadonlyArray<string>>();
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Access the buttons in the toggle group.
|
61
|
+
* @ignore
|
62
|
+
*/
|
63
|
+
@ContentChildren(RdxToggleGroupButtonToken)
|
64
|
+
protected buttons?: QueryList<RdxToggleGroupButtonDirective>;
|
65
|
+
|
66
|
+
/**
|
67
|
+
* The value change callback.
|
68
|
+
* @ignore
|
69
|
+
*/
|
70
|
+
private onChange?: (value: ReadonlyArray<string>) => void;
|
71
|
+
|
72
|
+
/**
|
73
|
+
* onTouch function registered via registerOnTouch (ControlValueAccessor).
|
74
|
+
* @ignore
|
75
|
+
*/
|
76
|
+
protected onTouched?: () => void;
|
77
|
+
|
78
|
+
/**
|
79
|
+
* @ignore
|
80
|
+
*/
|
81
|
+
ngOnChanges(changes: SimpleChanges): void {
|
82
|
+
if ('disabled' in changes) {
|
83
|
+
this.buttons?.forEach((button) => button.updateDisabled());
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
/**
|
88
|
+
* @ignore
|
89
|
+
*/
|
90
|
+
ngAfterContentInit(): void {
|
91
|
+
if (this.disabled) {
|
92
|
+
this.buttons?.forEach((button) => button.updateDisabled());
|
93
|
+
}
|
94
|
+
}
|
95
|
+
|
96
|
+
/**
|
97
|
+
* Determine if a value is selected.
|
98
|
+
* @param value The value to check.
|
99
|
+
* @returns Whether the value is selected.
|
100
|
+
* @ignore
|
101
|
+
*/
|
102
|
+
isSelected(value: string): boolean {
|
103
|
+
return this.value.includes(value);
|
104
|
+
}
|
105
|
+
|
106
|
+
/**
|
107
|
+
* Toggle a value.
|
108
|
+
* @param value The value to toggle.
|
109
|
+
* @ignore
|
110
|
+
*/
|
111
|
+
toggle(value: string): void {
|
112
|
+
if (this.disabled) {
|
113
|
+
return;
|
114
|
+
}
|
115
|
+
|
116
|
+
this.value = this.value.includes(value) ? this.value.filter((v) => v !== value) : [...this.value, value];
|
117
|
+
|
118
|
+
this.valueChange.emit(this.value);
|
119
|
+
this.onChange?.(this.value);
|
120
|
+
}
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Select a value from Angular forms.
|
124
|
+
* @param value The value to select.
|
125
|
+
* @ignore
|
126
|
+
*/
|
127
|
+
writeValue(value: ReadonlyArray<string>): void {
|
128
|
+
this.value = value;
|
129
|
+
}
|
130
|
+
|
131
|
+
/**
|
132
|
+
* Register a callback to be called when the value changes.
|
133
|
+
* @param fn The callback to register.
|
134
|
+
* @ignore
|
135
|
+
*/
|
136
|
+
registerOnChange(fn: (value: ReadonlyArray<string>) => void): void {
|
137
|
+
this.onChange = fn;
|
138
|
+
}
|
139
|
+
|
140
|
+
/**
|
141
|
+
* Register a callback to be called when the toggle group is touched.
|
142
|
+
* @param fn The callback to register.
|
143
|
+
* @ignore
|
144
|
+
*/
|
145
|
+
registerOnTouched(fn: () => void): void {
|
146
|
+
this.onTouched = fn;
|
147
|
+
}
|
148
|
+
|
149
|
+
/**
|
150
|
+
* Set the disabled state of the toggle group.
|
151
|
+
* @param isDisabled Whether the toggle group is disabled.
|
152
|
+
* @ignore
|
153
|
+
*/
|
154
|
+
setDisabledState(isDisabled: boolean): void {
|
155
|
+
this.disabled = isDisabled;
|
156
|
+
this.buttons?.forEach((button) => button.updateDisabled());
|
157
|
+
}
|
158
|
+
}
|
@@ -0,0 +1,148 @@
|
|
1
|
+
import {
|
2
|
+
AfterContentInit,
|
3
|
+
booleanAttribute,
|
4
|
+
ContentChildren,
|
5
|
+
Directive,
|
6
|
+
EventEmitter,
|
7
|
+
Input,
|
8
|
+
OnChanges,
|
9
|
+
QueryList,
|
10
|
+
SimpleChanges
|
11
|
+
} from '@angular/core';
|
12
|
+
import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms';
|
13
|
+
import type { RdxToggleGroupButtonDirective } from './toggle-group-button.directive';
|
14
|
+
import { RdxToggleGroupButtonToken } from './toggle-group-button.token';
|
15
|
+
import { RdxToggleGroupToken } from './toggle-group.token';
|
16
|
+
|
17
|
+
@Directive({
|
18
|
+
selector: '[rdxToggleGroup]',
|
19
|
+
standalone: true,
|
20
|
+
providers: [
|
21
|
+
{ provide: RdxToggleGroupToken, useExisting: RdxToggleGroupDirective },
|
22
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: RdxToggleGroupDirective, multi: true }
|
23
|
+
],
|
24
|
+
host: {
|
25
|
+
role: 'group',
|
26
|
+
'[attr.data-orientation]': 'orientation',
|
27
|
+
'(focusout)': 'onTouched?.()'
|
28
|
+
}
|
29
|
+
})
|
30
|
+
export class RdxToggleGroupDirective implements OnChanges, AfterContentInit, ControlValueAccessor {
|
31
|
+
/**
|
32
|
+
* The selected toggle button.
|
33
|
+
*/
|
34
|
+
@Input() value: string | null = null;
|
35
|
+
|
36
|
+
/**
|
37
|
+
* The orientation of the toggle group.
|
38
|
+
* @default 'horizontal'
|
39
|
+
*/
|
40
|
+
@Input() orientation: 'horizontal' | 'vertical' = 'horizontal';
|
41
|
+
|
42
|
+
/**
|
43
|
+
* Whether the toggle group is disabled.
|
44
|
+
* @default false
|
45
|
+
*/
|
46
|
+
@Input({ transform: booleanAttribute }) disabled = false;
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Whether the toggle group roving focus should wrap.
|
50
|
+
* @default true
|
51
|
+
*/
|
52
|
+
@Input({ transform: booleanAttribute }) wrap = true;
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Event emitted when the selected toggle button changes.
|
56
|
+
*/
|
57
|
+
@Input() readonly valueChange = new EventEmitter<string | null>();
|
58
|
+
|
59
|
+
/**
|
60
|
+
* Access the buttons in the toggle group.
|
61
|
+
*/
|
62
|
+
@ContentChildren(RdxToggleGroupButtonToken)
|
63
|
+
protected buttons?: QueryList<RdxToggleGroupButtonDirective>;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* The value change callback.
|
67
|
+
*/
|
68
|
+
private onChange?: (value: string | null) => void;
|
69
|
+
|
70
|
+
/**
|
71
|
+
* onTouch function registered via registerOnTouch (ControlValueAccessor).
|
72
|
+
*/
|
73
|
+
protected onTouched?: () => void;
|
74
|
+
|
75
|
+
ngOnChanges(changes: SimpleChanges): void {
|
76
|
+
if ('disabled' in changes) {
|
77
|
+
this.buttons?.forEach((button) => button.updateDisabled());
|
78
|
+
}
|
79
|
+
}
|
80
|
+
|
81
|
+
ngAfterContentInit(): void {
|
82
|
+
if (this.disabled) {
|
83
|
+
this.buttons?.forEach((button) => button.updateDisabled());
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Determine if a value is selected.
|
89
|
+
* @param value The value to check.
|
90
|
+
* @returns Whether the value is selected.
|
91
|
+
* @internal
|
92
|
+
*/
|
93
|
+
isSelected(value: string): boolean {
|
94
|
+
return this.value === value;
|
95
|
+
}
|
96
|
+
|
97
|
+
/**
|
98
|
+
* Toggle a value.
|
99
|
+
* @param value The value to toggle.
|
100
|
+
* @internal
|
101
|
+
*/
|
102
|
+
toggle(value: string): void {
|
103
|
+
if (this.disabled) {
|
104
|
+
return;
|
105
|
+
}
|
106
|
+
|
107
|
+
this.value = this.value === value ? null : value;
|
108
|
+
this.valueChange.emit(this.value);
|
109
|
+
this.onChange?.(this.value);
|
110
|
+
}
|
111
|
+
|
112
|
+
/**
|
113
|
+
* Select a value from Angular forms.
|
114
|
+
* @param value The value to select.
|
115
|
+
* @internal
|
116
|
+
*/
|
117
|
+
writeValue(value: string): void {
|
118
|
+
this.value = value;
|
119
|
+
}
|
120
|
+
|
121
|
+
/**
|
122
|
+
* Register a callback to be called when the value changes.
|
123
|
+
* @param fn The callback to register.
|
124
|
+
* @internal
|
125
|
+
*/
|
126
|
+
registerOnChange(fn: (value: string | null) => void): void {
|
127
|
+
this.onChange = fn;
|
128
|
+
}
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Register a callback to be called when the toggle group is touched.
|
132
|
+
* @param fn The callback to register.
|
133
|
+
* @internal
|
134
|
+
*/
|
135
|
+
registerOnTouched(fn: () => void): void {
|
136
|
+
this.onTouched = fn;
|
137
|
+
}
|
138
|
+
|
139
|
+
/**
|
140
|
+
* Set the disabled state of the toggle group.
|
141
|
+
* @param isDisabled Whether the toggle group is disabled.
|
142
|
+
* @internal
|
143
|
+
*/
|
144
|
+
setDisabledState(isDisabled: boolean): void {
|
145
|
+
this.disabled = isDisabled;
|
146
|
+
this.buttons?.forEach((button) => button.updateDisabled());
|
147
|
+
}
|
148
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
import { inject, InjectionToken } from '@angular/core';
|
2
|
+
import type { RdxToggleGroupMultiDirective } from './toggle-group-multi.directive';
|
3
|
+
import type { RdxToggleGroupDirective } from './toggle-group.directive';
|
4
|
+
|
5
|
+
export const RdxToggleGroupToken = new InjectionToken<RdxToggleGroupDirective | RdxToggleGroupMultiDirective>(
|
6
|
+
'RdxToggleGroupToken'
|
7
|
+
);
|
8
|
+
|
9
|
+
export function injectToggleGroup(): RdxToggleGroupDirective | RdxToggleGroupMultiDirective {
|
10
|
+
return inject(RdxToggleGroupToken);
|
11
|
+
}
|
@@ -0,0 +1,87 @@
|
|
1
|
+
import { ArgTypes, Canvas, Markdown, Meta } from '@storybook/blocks';
|
2
|
+
import * as ToggleGroupDirectiveStories from './toggle-group.stories';
|
3
|
+
import { RdxToggleGroupDirective } from '../src/toggle-group.directive';
|
4
|
+
import { RdxToggleGroupButtonDirective } from '../src/toggle-group-button.directive';
|
5
|
+
|
6
|
+
<Meta title="Primitives/Toggle Group" />
|
7
|
+
|
8
|
+
# Toggle Group
|
9
|
+
|
10
|
+
#### A set of two-\_state buttons that can be toggled on or off.
|
11
|
+
|
12
|
+
<Canvas sourceState="hidden" of={ToggleGroupDirectiveStories.Default} />
|
13
|
+
|
14
|
+
## Features
|
15
|
+
|
16
|
+
- ✅ Full keyboard navigation.
|
17
|
+
- ✅ Supports horizontal/vertical orientation.
|
18
|
+
- ✅ Support single and multiple pressed buttons.
|
19
|
+
- ✅ Can be controlled or uncontrolled.
|
20
|
+
|
21
|
+
## Import
|
22
|
+
|
23
|
+
Get started with importing the directives:
|
24
|
+
|
25
|
+
```typescript
|
26
|
+
import {
|
27
|
+
RdxToggleGroupDirective,
|
28
|
+
RdxToggleGroupButtonDirective,
|
29
|
+
RdxToggleGroupMultiDirective
|
30
|
+
} from '@radix-ng/primitives/toggle-group';
|
31
|
+
```
|
32
|
+
|
33
|
+
## Examples
|
34
|
+
|
35
|
+
```html
|
36
|
+
<div class="ToggleGroup" rdxToggleGroup value="center" aria-label="Text alignment">
|
37
|
+
<button class="ToggleGroupItem" rdxToggleGroupButton value="left" aria-label="Left aligned">
|
38
|
+
<lucide-icon name="align-left" size="16"></lucide-icon>
|
39
|
+
</button>
|
40
|
+
<button class="ToggleGroupItem" rdxToggleGroupButton value="center" aria-label="Center aligned">
|
41
|
+
<lucide-icon name="align-center" size="16"></lucide-icon>
|
42
|
+
</button>
|
43
|
+
<button class="ToggleGroupItem" rdxToggleGroupButton value="right" aria-label="Right aligned">
|
44
|
+
<lucide-icon name="align-right" size="16"></lucide-icon>
|
45
|
+
</button>
|
46
|
+
</div>
|
47
|
+
```
|
48
|
+
|
49
|
+
## API Reference
|
50
|
+
|
51
|
+
### RdxToggleGroupDirective
|
52
|
+
|
53
|
+
<ArgTypes of={RdxToggleGroupDirective} />
|
54
|
+
|
55
|
+
<Markdown>
|
56
|
+
{`
|
57
|
+
| Data Attribute | Value |
|
58
|
+
| ----------- | --------- |
|
59
|
+
| [data-orientation] | "vertical" or "horizontal" |
|
60
|
+
`}
|
61
|
+
</Markdown>
|
62
|
+
|
63
|
+
### RdxToggleGroupButtonDirective
|
64
|
+
|
65
|
+
<ArgTypes of={RdxToggleGroupButtonDirective} />
|
66
|
+
|
67
|
+
## Accessibility
|
68
|
+
|
69
|
+
Uses [roving tabindex](https://www.w3.org/TR/wai-aria-practices-1.2/examples/radio/radio.html) to manage focus movement among items.
|
70
|
+
|
71
|
+
### Keyboard Interactions
|
72
|
+
|
73
|
+
<Markdown>
|
74
|
+
{`
|
75
|
+
| Key | Description |
|
76
|
+
| ----------- | --------- |
|
77
|
+
| Tab | Moves focus to either the pressed item or the first item in the group. |
|
78
|
+
| Space | Activates/deactivates the item. |
|
79
|
+
| Enter | Activates/deactivates the item. |
|
80
|
+
| ArrowDown | Moves focus to the next item in the group. |
|
81
|
+
| ArrowRight | Moves focus to the next item in the group. |
|
82
|
+
| ArrowUp | Moves focus to the previous item in the group. |
|
83
|
+
| ArrowLeft | Moves focus to the previous item in the group. |
|
84
|
+
| Home | Moves focus to the first item. |
|
85
|
+
| End | Moves focus to the last item. |
|
86
|
+
`}
|
87
|
+
</Markdown>
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import { componentWrapperDecorator, Meta, moduleMetadata, StoryObj } from '@storybook/angular';
|
2
|
+
import { AlignCenter, AlignLeft, AlignRight, LucideAngularModule } from 'lucide-angular';
|
3
|
+
import { RdxToggleGroupButtonDirective } from '../src/toggle-group-button.directive';
|
4
|
+
import { RdxToggleGroupMultiDirective } from '../src/toggle-group-multi.directive';
|
5
|
+
import { RdxToggleGroupDirective } from '../src/toggle-group.directive';
|
6
|
+
|
7
|
+
export default {
|
8
|
+
title: 'Primitives/Toggle Group',
|
9
|
+
decorators: [
|
10
|
+
moduleMetadata({
|
11
|
+
imports: [
|
12
|
+
RdxToggleGroupDirective,
|
13
|
+
RdxToggleGroupButtonDirective,
|
14
|
+
RdxToggleGroupMultiDirective,
|
15
|
+
LucideAngularModule,
|
16
|
+
LucideAngularModule.pick({ AlignRight, AlignLeft, AlignCenter })
|
17
|
+
]
|
18
|
+
}),
|
19
|
+
componentWrapperDecorator(
|
20
|
+
(story) =>
|
21
|
+
`<div class="radix-themes light light-theme"
|
22
|
+
data-radius="medium"
|
23
|
+
data-scaling="100%">${story}
|
24
|
+
|
25
|
+
<style>
|
26
|
+
button {
|
27
|
+
all: unset;
|
28
|
+
}
|
29
|
+
.ToggleGroup {
|
30
|
+
display: inline-flex;
|
31
|
+
background-color: var(--mauve-6);
|
32
|
+
border-radius: 4px;
|
33
|
+
box-shadow: 0 2px 10px var(--black-a7);
|
34
|
+
}
|
35
|
+
|
36
|
+
.ToggleGroupItem {
|
37
|
+
background-color: white;
|
38
|
+
color: var(--mauve-11);
|
39
|
+
height: 35px;
|
40
|
+
width: 35px;
|
41
|
+
display: flex;
|
42
|
+
font-size: 15px;
|
43
|
+
line-height: 1;
|
44
|
+
align-items: center;
|
45
|
+
justify-content: center;
|
46
|
+
margin-left: 1px;
|
47
|
+
}
|
48
|
+
.ToggleGroupItem:first-child {
|
49
|
+
margin-left: 0;
|
50
|
+
border-top-left-radius: 4px;
|
51
|
+
border-bottom-left-radius: 4px;
|
52
|
+
}
|
53
|
+
.ToggleGroupItem:last-child {
|
54
|
+
border-top-right-radius: 4px;
|
55
|
+
border-bottom-right-radius: 4px;
|
56
|
+
}
|
57
|
+
.ToggleGroupItem:hover {
|
58
|
+
background-color: var(--violet-3);
|
59
|
+
}
|
60
|
+
.ToggleGroupItem[data-state='on'] {
|
61
|
+
background-color: var(--violet-5);
|
62
|
+
color: var(--violet-11);
|
63
|
+
}
|
64
|
+
.ToggleGroupItem:focus {
|
65
|
+
position: relative;
|
66
|
+
box-shadow: 0 0 0 2px black;
|
67
|
+
}
|
68
|
+
</style>
|
69
|
+
|
70
|
+
</div>`
|
71
|
+
)
|
72
|
+
]
|
73
|
+
} as Meta;
|
74
|
+
|
75
|
+
type Story = StoryObj;
|
76
|
+
|
77
|
+
export const Default: Story = {
|
78
|
+
render: () => ({
|
79
|
+
template: `
|
80
|
+
|
81
|
+
<div rdxToggleGroup value="center" aria-label="Text alignment" class="ToggleGroup">
|
82
|
+
<button rdxToggleGroupButton value="left" aria-label="Left aligned" class="ToggleGroupItem" >
|
83
|
+
<lucide-icon name="align-left" size="16"></lucide-icon>
|
84
|
+
</button>
|
85
|
+
<button rdxToggleGroupButton value="center" aria-label="Center aligned" class="ToggleGroupItem">
|
86
|
+
<lucide-icon name="align-center" size="16"></lucide-icon>
|
87
|
+
</button>
|
88
|
+
<button rdxToggleGroupButton value="right" aria-label="Right aligned" class="ToggleGroupItem">
|
89
|
+
<lucide-icon name="align-right" size="16"></lucide-icon>
|
90
|
+
</button>
|
91
|
+
</div>
|
92
|
+
|
93
|
+
`
|
94
|
+
})
|
95
|
+
};
|
package/tsconfig.json
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"compilerOptions": {
|
3
|
+
"target": "es2022",
|
4
|
+
"useDefineForClassFields": false,
|
5
|
+
"forceConsistentCasingInFileNames": true,
|
6
|
+
"strict": true,
|
7
|
+
"noImplicitOverride": true,
|
8
|
+
"noPropertyAccessFromIndexSignature": true,
|
9
|
+
"noImplicitReturns": true,
|
10
|
+
"noFallthroughCasesInSwitch": true
|
11
|
+
},
|
12
|
+
"files": [],
|
13
|
+
"include": [],
|
14
|
+
"references": [
|
15
|
+
{
|
16
|
+
"path": "./tsconfig.lib.json"
|
17
|
+
},
|
18
|
+
{
|
19
|
+
"path": "./tsconfig.spec.json"
|
20
|
+
}
|
21
|
+
],
|
22
|
+
"extends": "../../tsconfig.base.json",
|
23
|
+
"angularCompilerOptions": {
|
24
|
+
"enableI18nLegacyMessageIdFormat": false,
|
25
|
+
"strictInjectionParameters": true,
|
26
|
+
"strictInputAccessModifiers": true,
|
27
|
+
"strictTemplates": true
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,19 @@
|
|
1
|
+
{
|
2
|
+
"extends": "./tsconfig.json",
|
3
|
+
"compilerOptions": {
|
4
|
+
"outDir": "../../dist/out-tsc",
|
5
|
+
"declaration": true,
|
6
|
+
"declarationMap": true,
|
7
|
+
"inlineSources": true,
|
8
|
+
"types": []
|
9
|
+
},
|
10
|
+
"exclude": [
|
11
|
+
"**/*.spec.ts",
|
12
|
+
"test-setup.ts",
|
13
|
+
"jest.config.ts",
|
14
|
+
"**/*.test.ts",
|
15
|
+
"**/*.stories.ts",
|
16
|
+
"**/*.stories.js"
|
17
|
+
],
|
18
|
+
"include": ["**/*.ts"]
|
19
|
+
}
|
@@ -0,0 +1,11 @@
|
|
1
|
+
{
|
2
|
+
"extends": "./tsconfig.json",
|
3
|
+
"compilerOptions": {
|
4
|
+
"outDir": "../../dist/out-tsc",
|
5
|
+
"module": "commonjs",
|
6
|
+
"target": "es2016",
|
7
|
+
"types": ["jest", "node"]
|
8
|
+
},
|
9
|
+
"files": ["test-setup.ts"],
|
10
|
+
"include": ["jest.config.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.d.ts"]
|
11
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
import { Meta } from '@storybook/blocks';
|
2
|
+
|
3
|
+
<Meta title="Utilities/Visually Hidden" />
|
4
|
+
|
5
|
+
# Visually Hidden
|
6
|
+
|
7
|
+
#### Hides content from the screen in an accessible way.
|
8
|
+
|
9
|
+
#### You can use also [a11y](https://material.angular.io/cdk/a11y), they also have an auxiliary class for this.
|
10
|
+
|
11
|
+
## Features
|
12
|
+
|
13
|
+
- ✅ Visually hides content while preserving it for assistive technology.
|
14
|
+
|
15
|
+
## Import
|
16
|
+
|
17
|
+
Screen readers and other assistive technology skip elements that have display: none, visibility: hidden, opacity: 0, height: 0, or width: 0. In some cases you may need to visually hide an element while keeping it available to assistive technology.
|
18
|
+
You can do so using the a11y-visually-hidden Sass mixin, which emits the .cdk-visually-hidden CSS class:
|
19
|
+
|
20
|
+
```scss
|
21
|
+
@use '@angular/cdk';
|
22
|
+
|
23
|
+
@include cdk.a11y-visually-hidden();
|
24
|
+
```
|
25
|
+
|
26
|
+
## Examples
|
27
|
+
|
28
|
+
```html
|
29
|
+
<div class="custom-checkbox">
|
30
|
+
<input class="cdk-visually-hidden" type="checkbox" />
|
31
|
+
</div>
|
32
|
+
```
|
33
|
+
|
34
|
+
## Accessibility
|
35
|
+
|
36
|
+
This is useful in certain scenarios as an alternative to traditional labelling with aria-label or aria-labelledby.
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
2
|
-
import { RdxAccordionItemDirective } from './accordion-item.directive';
|
3
|
-
import * as i0 from "@angular/core";
|
4
|
-
export declare const RdxAccordionContentToken: InjectionToken<RdxAccordionContentDirective>;
|
5
|
-
export declare class RdxAccordionContentDirective {
|
6
|
-
protected readonly item: RdxAccordionItemDirective;
|
7
|
-
get style(): {
|
8
|
-
width: string | number;
|
9
|
-
height?: undefined;
|
10
|
-
} | {
|
11
|
-
height: string | number;
|
12
|
-
width?: undefined;
|
13
|
-
};
|
14
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionContentDirective, never>;
|
15
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionContentDirective, "[rdxAccordionContent]", ["rdxAccordionContent"], {}, {}, never, never, true, never>;
|
16
|
-
}
|
@@ -1,7 +0,0 @@
|
|
1
|
-
import { RdxAccordionItemDirective } from './accordion-item.directive';
|
2
|
-
import * as i0 from "@angular/core";
|
3
|
-
export declare class RdxAccordionHeaderDirective {
|
4
|
-
protected readonly item: RdxAccordionItemDirective;
|
5
|
-
static ɵfac: i0.ɵɵFactoryDeclaration<RdxAccordionHeaderDirective, never>;
|
6
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<RdxAccordionHeaderDirective, "[rdxAccordionHeader]", never, {}, {}, never, never, true, never>;
|
7
|
-
}
|