@kouji-ui/core 0.1.1 → 0.1.3
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/fesm2022/kouji-ui-core.mjs +26789 -0
- package/fesm2022/kouji-ui-core.mjs.map +1 -0
- package/package.json +15 -7
- package/types/kouji-ui-core.d.ts +13545 -0
- package/.turbo/turbo-build.log +0 -30
- package/CHANGELOG.md +0 -190
- package/ng-package.json +0 -11
- package/src/a11y/.gitkeep +0 -0
- package/src/a11y/aria-describedby.spec.ts +0 -55
- package/src/a11y/aria-describedby.ts +0 -37
- package/src/a11y/aria-labelledby.spec.ts +0 -55
- package/src/a11y/aria-labelledby.ts +0 -38
- package/src/a11y/focus-trap.spec.ts +0 -86
- package/src/a11y/focus-trap.ts +0 -72
- package/src/a11y/index.ts +0 -10
- package/src/a11y/live-region.spec.ts +0 -58
- package/src/a11y/live-region.ts +0 -50
- package/src/a11y/roving-tabindex.spec.ts +0 -201
- package/src/a11y/roving-tabindex.ts +0 -153
- package/src/a11y/visually-hidden.spec.ts +0 -34
- package/src/a11y/visually-hidden.ts +0 -26
- package/src/accordion/accordion.context.ts +0 -44
- package/src/accordion/accordion.spec.ts +0 -242
- package/src/accordion/accordion.ts +0 -401
- package/src/accordion/index.ts +0 -8
- package/src/alert/alert.context.ts +0 -28
- package/src/alert/alert.spec.ts +0 -217
- package/src/alert/alert.ts +0 -417
- package/src/alert/config.ts +0 -46
- package/src/alert/index.ts +0 -19
- package/src/avatar/avatar-group.context.ts +0 -45
- package/src/avatar/avatar-group.spec.ts +0 -358
- package/src/avatar/avatar-group.ts +0 -259
- package/src/avatar/avatar.spec.ts +0 -18
- package/src/avatar/avatar.ts +0 -39
- package/src/avatar/index.ts +0 -11
- package/src/badge/badge.spec.ts +0 -28
- package/src/badge/badge.ts +0 -35
- package/src/badge/index.ts +0 -1
- package/src/breadcrumb/breadcrumb-current.ts +0 -38
- package/src/breadcrumb/breadcrumb-ellipsis.ts +0 -71
- package/src/breadcrumb/breadcrumb-item.ts +0 -41
- package/src/breadcrumb/breadcrumb-link.ts +0 -44
- package/src/breadcrumb/breadcrumb-list.ts +0 -42
- package/src/breadcrumb/breadcrumb-separator.ts +0 -45
- package/src/breadcrumb/breadcrumb.context.ts +0 -45
- package/src/breadcrumb/breadcrumb.spec.ts +0 -354
- package/src/breadcrumb/breadcrumb.ts +0 -239
- package/src/breadcrumb/config.ts +0 -84
- package/src/breadcrumb/index.ts +0 -18
- package/src/button/_examples/button.example.ts +0 -71
- package/src/button/_examples/button.finance.example.ts +0 -83
- package/src/button/_examples/button.retro.example.ts +0 -91
- package/src/button/_examples/button.sizes.example.ts +0 -60
- package/src/button/_examples/index.ts +0 -6
- package/src/button/button.spec.ts +0 -163
- package/src/button/button.ts +0 -142
- package/src/button/config.spec.ts +0 -33
- package/src/button/config.ts +0 -45
- package/src/button/index.ts +0 -2
- package/src/button-group/button-group.context.ts +0 -28
- package/src/button-group/button-group.spec.ts +0 -99
- package/src/button-group/button-group.ts +0 -99
- package/src/button-group/index.ts +0 -2
- package/src/calendar/calendar-day.ts +0 -102
- package/src/calendar/calendar-grid.ts +0 -90
- package/src/calendar/calendar-header.ts +0 -65
- package/src/calendar/calendar.context.ts +0 -53
- package/src/calendar/calendar.spec.ts +0 -225
- package/src/calendar/calendar.ts +0 -233
- package/src/calendar/date-utils.ts +0 -225
- package/src/calendar/index.ts +0 -28
- package/src/carousel/carousel.context.ts +0 -81
- package/src/carousel/carousel.spec.ts +0 -337
- package/src/carousel/carousel.ts +0 -919
- package/src/carousel/index.ts +0 -22
- package/src/cascade-select/cascade-select-option.ts +0 -205
- package/src/cascade-select/cascade-select-panel.ts +0 -106
- package/src/cascade-select/cascade-select-root.ts +0 -265
- package/src/cascade-select/cascade-select-sub-panel.ts +0 -168
- package/src/cascade-select/cascade-select-trigger.ts +0 -44
- package/src/cascade-select/cascade-select.context.ts +0 -71
- package/src/cascade-select/cascade-select.spec.ts +0 -241
- package/src/cascade-select/cascade-select.ts +0 -5
- package/src/cascade-select/index.ts +0 -11
- package/src/chart/chart.spec.ts +0 -27
- package/src/chart/chart.ts +0 -52
- package/src/chart/index.ts +0 -1
- package/src/chat/chat-avatar.ts +0 -31
- package/src/chat/chat-bubble.ts +0 -49
- package/src/chat/chat-footer.ts +0 -67
- package/src/chat/chat-header.ts +0 -41
- package/src/chat/chat-log.ts +0 -43
- package/src/chat/chat.context.ts +0 -64
- package/src/chat/chat.spec.ts +0 -341
- package/src/chat/chat.ts +0 -191
- package/src/chat/config.ts +0 -53
- package/src/chat/index.ts +0 -21
- package/src/checkbox/checkbox.spec.ts +0 -35
- package/src/checkbox/checkbox.ts +0 -89
- package/src/checkbox/index.ts +0 -1
- package/src/color-picker/color-picker.context.ts +0 -74
- package/src/color-picker/color-picker.spec.ts +0 -241
- package/src/color-picker/color-picker.ts +0 -698
- package/src/color-picker/color-picker.utils.ts +0 -140
- package/src/color-picker/index.ts +0 -28
- package/src/combobox/combobox-input.ts +0 -143
- package/src/combobox/combobox-listbox.ts +0 -49
- package/src/combobox/combobox-option.ts +0 -43
- package/src/combobox/combobox-root.ts +0 -281
- package/src/combobox/combobox.spec.ts +0 -75
- package/src/combobox/combobox.ts +0 -4
- package/src/combobox/index.ts +0 -4
- package/src/command-palette/command-empty.ts +0 -36
- package/src/command-palette/command-group.ts +0 -21
- package/src/command-palette/command-input.ts +0 -70
- package/src/command-palette/command-item.ts +0 -60
- package/src/command-palette/command-list.ts +0 -25
- package/src/command-palette/command-palette-dialog.ts +0 -74
- package/src/command-palette/command-palette-trigger.ts +0 -64
- package/src/command-palette/command-palette.filters.ts +0 -53
- package/src/command-palette/command-palette.spec.ts +0 -349
- package/src/command-palette/command-palette.ts +0 -204
- package/src/command-palette/command-separator.ts +0 -18
- package/src/command-palette/index.ts +0 -15
- package/src/confirm-popup/confirm-popup-action.ts +0 -39
- package/src/confirm-popup/confirm-popup-cancel.ts +0 -38
- package/src/confirm-popup/confirm-popup-content.ts +0 -113
- package/src/confirm-popup/confirm-popup-message.ts +0 -36
- package/src/confirm-popup/confirm-popup-trigger.ts +0 -31
- package/src/confirm-popup/confirm-popup.context.ts +0 -41
- package/src/confirm-popup/confirm-popup.spec.ts +0 -337
- package/src/confirm-popup/confirm-popup.ts +0 -109
- package/src/confirm-popup/index.ts +0 -12
- package/src/date-picker/date-picker-calendar.ts +0 -65
- package/src/date-picker/date-picker-trigger.ts +0 -215
- package/src/date-picker/date-picker.context.ts +0 -50
- package/src/date-picker/date-picker.spec.ts +0 -117
- package/src/date-picker/date-picker.ts +0 -127
- package/src/date-picker/index.ts +0 -7
- package/src/dialog/_examples/dialog.confirm.example.ts +0 -145
- package/src/dialog/_examples/dialog.example.ts +0 -106
- package/src/dialog/_examples/dialog.finance.example.ts +0 -121
- package/src/dialog/_examples/dialog.retro.example.ts +0 -126
- package/src/dialog/_examples/index.ts +0 -6
- package/src/dialog/dialog.ref.ts +0 -42
- package/src/dialog/dialog.service.ts +0 -66
- package/src/dialog/dialog.spec.ts +0 -37
- package/src/dialog/dialog.ts +0 -26
- package/src/dialog/index.ts +0 -3
- package/src/divider/divider.spec.ts +0 -223
- package/src/divider/divider.ts +0 -137
- package/src/divider/index.ts +0 -5
- package/src/drawer/drawer.ref.ts +0 -63
- package/src/drawer/drawer.service.ts +0 -106
- package/src/drawer/drawer.spec.ts +0 -117
- package/src/drawer/drawer.ts +0 -122
- package/src/drawer/index.ts +0 -10
- package/src/dropdown-menu/dropdown-menu-content.ts +0 -258
- package/src/dropdown-menu/dropdown-menu-group.ts +0 -31
- package/src/dropdown-menu/dropdown-menu-item.ts +0 -51
- package/src/dropdown-menu/dropdown-menu-label.ts +0 -41
- package/src/dropdown-menu/dropdown-menu-separator.ts +0 -27
- package/src/dropdown-menu/dropdown-menu-trigger.ts +0 -140
- package/src/dropdown-menu/dropdown-menu.spec.ts +0 -265
- package/src/dropdown-menu/dropdown-menu.ts +0 -60
- package/src/dropdown-menu/index.ts +0 -15
- package/src/example-components.ts +0 -42
- package/src/field/field-error.ts +0 -49
- package/src/field/field-group.ts +0 -39
- package/src/field/field-help.ts +0 -47
- package/src/field/field-label.ts +0 -30
- package/src/field/field.context.ts +0 -28
- package/src/field/field.spec.ts +0 -179
- package/src/field/field.ts +0 -121
- package/src/field/index.ts +0 -6
- package/src/file-upload/file-upload.context.ts +0 -89
- package/src/file-upload/file-upload.spec.ts +0 -290
- package/src/file-upload/file-upload.ts +0 -639
- package/src/file-upload/file-upload.types.ts +0 -59
- package/src/file-upload/index.ts +0 -23
- package/src/form/form-error-summary.ts +0 -87
- package/src/form/form-field.context.ts +0 -3
- package/src/form/form-field.spec.ts +0 -25
- package/src/form/form-field.ts +0 -52
- package/src/form/form.context.ts +0 -53
- package/src/form/form.spec.ts +0 -162
- package/src/form/form.ts +0 -326
- package/src/form/index.ts +0 -11
- package/src/icon/E2E.md +0 -14
- package/src/icon/icon.directive.spec.ts +0 -198
- package/src/icon/icon.directive.ts +0 -113
- package/src/icon/icon.mode.spec.ts +0 -29
- package/src/icon/icon.mode.ts +0 -23
- package/src/icon/icon.providers.spec.ts +0 -63
- package/src/icon/icon.providers.ts +0 -47
- package/src/icon/icon.resolver.spec.ts +0 -96
- package/src/icon/icon.resolver.ts +0 -49
- package/src/icon/icon.tokens.ts +0 -88
- package/src/icon/icon.types.ts +0 -48
- package/src/icon/index.ts +0 -21
- package/src/input/index.ts +0 -1
- package/src/input/input.spec.ts +0 -43
- package/src/input/input.ts +0 -89
- package/src/input-group/index.ts +0 -3
- package/src/input-group/input-group-addon.ts +0 -92
- package/src/input-group/input-group.context.ts +0 -27
- package/src/input-group/input-group.spec.ts +0 -186
- package/src/input-group/input-group.ts +0 -136
- package/src/input-mask/index.ts +0 -11
- package/src/input-mask/input-mask.compile.ts +0 -69
- package/src/input-mask/input-mask.engine.ts +0 -376
- package/src/input-mask/input-mask.presets.ts +0 -24
- package/src/input-mask/input-mask.spec.ts +0 -304
- package/src/input-mask/input-mask.tokens.ts +0 -49
- package/src/input-mask/input-mask.ts +0 -280
- package/src/input-otp/index.ts +0 -2
- package/src/input-otp/input-otp.context.ts +0 -41
- package/src/input-otp/input-otp.spec.ts +0 -308
- package/src/input-otp/input-otp.ts +0 -470
- package/src/kbd/index.ts +0 -1
- package/src/kbd/kbd.spec.ts +0 -127
- package/src/kbd/kbd.ts +0 -132
- package/src/link/config.ts +0 -44
- package/src/link/index.ts +0 -2
- package/src/link/link.spec.ts +0 -246
- package/src/link/link.ts +0 -226
- package/src/list/index.ts +0 -11
- package/src/list/list.spec.ts +0 -237
- package/src/list/list.ts +0 -277
- package/src/menubar/index.ts +0 -7
- package/src/menubar/menubar-item.ts +0 -204
- package/src/menubar/menubar.context.ts +0 -43
- package/src/menubar/menubar.spec.ts +0 -433
- package/src/menubar/menubar.ts +0 -309
- package/src/number-input/index.ts +0 -4
- package/src/number-input/number-input-group.ts +0 -64
- package/src/number-input/number-input.context.ts +0 -31
- package/src/number-input/number-input.format.ts +0 -148
- package/src/number-input/number-input.spec.ts +0 -170
- package/src/number-input/number-input.ts +0 -457
- package/src/number-input/number-stepper.ts +0 -193
- package/src/overlay-badge/index.ts +0 -7
- package/src/overlay-badge/overlay-badge-content.ts +0 -73
- package/src/overlay-badge/overlay-badge.context.ts +0 -37
- package/src/overlay-badge/overlay-badge.spec.ts +0 -220
- package/src/overlay-badge/overlay-badge.ts +0 -128
- package/src/pagination/config.ts +0 -82
- package/src/pagination/index.ts +0 -19
- package/src/pagination/page-tokens.ts +0 -78
- package/src/pagination/pagination-ellipsis.ts +0 -69
- package/src/pagination/pagination-first.ts +0 -84
- package/src/pagination/pagination-info.ts +0 -70
- package/src/pagination/pagination-item.ts +0 -81
- package/src/pagination/pagination-last.ts +0 -85
- package/src/pagination/pagination-next.ts +0 -86
- package/src/pagination/pagination-previous.ts +0 -90
- package/src/pagination/pagination.context.ts +0 -52
- package/src/pagination/pagination.spec.ts +0 -388
- package/src/pagination/pagination.ts +0 -288
- package/src/password-input/index.ts +0 -15
- package/src/password-input/password-input.context.ts +0 -65
- package/src/password-input/password-input.scorer.ts +0 -34
- package/src/password-input/password-input.spec.ts +0 -274
- package/src/password-input/password-input.ts +0 -488
- package/src/popover/_examples/index.ts +0 -5
- package/src/popover/_examples/popover.example.ts +0 -92
- package/src/popover/_examples/popover.finance.example.ts +0 -106
- package/src/popover/_examples/popover.retro.example.ts +0 -103
- package/src/popover/index.ts +0 -5
- package/src/popover/popover-arrow.ts +0 -30
- package/src/popover/popover-close.ts +0 -36
- package/src/popover/popover-content.ts +0 -41
- package/src/popover/popover-title.ts +0 -39
- package/src/popover/popover-trigger.ts +0 -40
- package/src/popover/popover.spec.ts +0 -59
- package/src/popover/popover.ts +0 -5
- package/src/presets/bind-presets.spec.ts +0 -50
- package/src/presets/bind-presets.ts +0 -43
- package/src/presets/index.ts +0 -3
- package/src/presets/size.spec.ts +0 -67
- package/src/presets/size.ts +0 -59
- package/src/presets/variant.spec.ts +0 -72
- package/src/presets/variant.ts +0 -62
- package/src/primitives/.gitkeep +0 -0
- package/src/primitives/directionality/directionality.spec.ts +0 -112
- package/src/primitives/directionality/directionality.ts +0 -89
- package/src/primitives/directionality/index.ts +0 -1
- package/src/primitives/forms/form-control.spec.ts +0 -67
- package/src/primitives/forms/form-control.ts +0 -94
- package/src/primitives/forms/index.ts +0 -1
- package/src/primitives/index.ts +0 -6
- package/src/primitives/interaction/disabled.spec.ts +0 -47
- package/src/primitives/interaction/disabled.ts +0 -31
- package/src/primitives/interaction/focus-ring.spec.ts +0 -62
- package/src/primitives/interaction/focus-ring.ts +0 -59
- package/src/primitives/interaction/index.ts +0 -2
- package/src/primitives/list/filterable-list.spec.ts +0 -114
- package/src/primitives/list/filterable-list.ts +0 -126
- package/src/primitives/list/group.spec.ts +0 -99
- package/src/primitives/list/group.ts +0 -139
- package/src/primitives/list/index.ts +0 -8
- package/src/primitives/list/inject-helpers.ts +0 -8
- package/src/primitives/list/item.spec.ts +0 -173
- package/src/primitives/list/item.ts +0 -222
- package/src/primitives/list/navigator.spec.ts +0 -286
- package/src/primitives/list/navigator.ts +0 -238
- package/src/primitives/list/selection.spec.ts +0 -214
- package/src/primitives/list/selection.ts +0 -339
- package/src/primitives/list/tokens.ts +0 -106
- package/src/primitives/list/type-ahead.spec.ts +0 -58
- package/src/primitives/list/type-ahead.ts +0 -46
- package/src/primitives/overlay/backdrop.spec.ts +0 -54
- package/src/primitives/overlay/backdrop.ts +0 -31
- package/src/primitives/overlay/builder.spec.ts +0 -38
- package/src/primitives/overlay/builder.ts +0 -151
- package/src/primitives/overlay/container.ts +0 -42
- package/src/primitives/overlay/context.ts +0 -14
- package/src/primitives/overlay/controller.spec.ts +0 -86
- package/src/primitives/overlay/controller.ts +0 -190
- package/src/primitives/overlay/id.spec.ts +0 -24
- package/src/primitives/overlay/id.ts +0 -17
- package/src/primitives/overlay/index.ts +0 -18
- package/src/primitives/overlay/overlay.css +0 -42
- package/src/primitives/overlay/panel.spec.ts +0 -52
- package/src/primitives/overlay/panel.ts +0 -102
- package/src/primitives/overlay/stack.spec.ts +0 -55
- package/src/primitives/overlay/stack.ts +0 -113
- package/src/primitives/overlay/strategies/backdrop/blurred.spec.ts +0 -11
- package/src/primitives/overlay/strategies/backdrop/blurred.ts +0 -5
- package/src/primitives/overlay/strategies/backdrop/none.spec.ts +0 -10
- package/src/primitives/overlay/strategies/backdrop/none.ts +0 -9
- package/src/primitives/overlay/strategies/backdrop/solid.spec.ts +0 -18
- package/src/primitives/overlay/strategies/backdrop/solid.ts +0 -23
- package/src/primitives/overlay/strategies/focus-trap/inert-based.spec.ts +0 -28
- package/src/primitives/overlay/strategies/focus-trap/inert-based.ts +0 -38
- package/src/primitives/overlay/strategies/focus-trap/no-trap.spec.ts +0 -9
- package/src/primitives/overlay/strategies/focus-trap/no-trap.ts +0 -8
- package/src/primitives/overlay/strategies/focus-trap/tab-cycle.spec.ts +0 -49
- package/src/primitives/overlay/strategies/focus-trap/tab-cycle.ts +0 -85
- package/src/primitives/overlay/strategies/index.ts +0 -34
- package/src/primitives/overlay/strategies/live-announcer/_announce.ts +0 -35
- package/src/primitives/overlay/strategies/live-announcer/assertive.spec.ts +0 -21
- package/src/primitives/overlay/strategies/live-announcer/assertive.ts +0 -11
- package/src/primitives/overlay/strategies/live-announcer/polite.spec.ts +0 -21
- package/src/primitives/overlay/strategies/live-announcer/polite.ts +0 -11
- package/src/primitives/overlay/strategies/live-announcer/silent.spec.ts +0 -12
- package/src/primitives/overlay/strategies/live-announcer/silent.ts +0 -5
- package/src/primitives/overlay/strategies/mount/body-portal.spec.ts +0 -40
- package/src/primitives/overlay/strategies/mount/body-portal.ts +0 -91
- package/src/primitives/overlay/strategies/mount/in-container.spec.ts +0 -43
- package/src/primitives/overlay/strategies/mount/in-container.ts +0 -39
- package/src/primitives/overlay/strategies/mount/in-place.spec.ts +0 -40
- package/src/primitives/overlay/strategies/mount/in-place.ts +0 -20
- package/src/primitives/overlay/strategies/position/anchored-to.spec.ts +0 -56
- package/src/primitives/overlay/strategies/position/anchored-to.ts +0 -248
- package/src/primitives/overlay/strategies/position/corner.spec.ts +0 -36
- package/src/primitives/overlay/strategies/position/corner.ts +0 -33
- package/src/primitives/overlay/strategies/position/edge-sheet.spec.ts +0 -32
- package/src/primitives/overlay/strategies/position/edge-sheet.ts +0 -36
- package/src/primitives/overlay/strategies/position/in-place-sibling.spec.ts +0 -25
- package/src/primitives/overlay/strategies/position/in-place-sibling.ts +0 -13
- package/src/primitives/overlay/strategies/position/point-at.spec.ts +0 -40
- package/src/primitives/overlay/strategies/position/point-at.ts +0 -34
- package/src/primitives/overlay/strategies/position/viewport-centered.spec.ts +0 -31
- package/src/primitives/overlay/strategies/position/viewport-centered.ts +0 -31
- package/src/primitives/overlay/strategies/scroll-lock/css-clip.spec.ts +0 -15
- package/src/primitives/overlay/strategies/scroll-lock/css-clip.ts +0 -39
- package/src/primitives/overlay/strategies/scroll-lock/html-overflow.spec.ts +0 -21
- package/src/primitives/overlay/strategies/scroll-lock/html-overflow.ts +0 -44
- package/src/primitives/overlay/strategies/scroll-lock/none.spec.ts +0 -9
- package/src/primitives/overlay/strategies/scroll-lock/none.ts +0 -5
- package/src/primitives/overlay/strategies/trigger-event/on-click.spec.ts +0 -32
- package/src/primitives/overlay/strategies/trigger-event/on-click.ts +0 -28
- package/src/primitives/overlay/strategies/trigger-event/on-context-menu.spec.ts +0 -45
- package/src/primitives/overlay/strategies/trigger-event/on-context-menu.ts +0 -70
- package/src/primitives/overlay/strategies/trigger-event/on-focus-or-input.spec.ts +0 -35
- package/src/primitives/overlay/strategies/trigger-event/on-focus-or-input.ts +0 -34
- package/src/primitives/overlay/strategies/trigger-event/on-focus.spec.ts +0 -64
- package/src/primitives/overlay/strategies/trigger-event/on-focus.ts +0 -37
- package/src/primitives/overlay/strategies/trigger-event/on-hotkey.spec.ts +0 -37
- package/src/primitives/overlay/strategies/trigger-event/on-hotkey.ts +0 -59
- package/src/primitives/overlay/strategies/trigger-event/on-hover.spec.ts +0 -34
- package/src/primitives/overlay/strategies/trigger-event/on-hover.ts +0 -86
- package/src/primitives/overlay/strategies/trigger-event/programmatic.spec.ts +0 -16
- package/src/primitives/overlay/strategies/trigger-event/programmatic.ts +0 -12
- package/src/primitives/overlay/tokens.ts +0 -54
- package/src/primitives/overlay/trigger.spec.ts +0 -103
- package/src/primitives/overlay/trigger.ts +0 -75
- package/src/primitives/overlay/types.ts +0 -24
- package/src/primitives/overlay/wrapper.ts +0 -50
- package/src/primitives/signals/deep-signal.ts +0 -109
- package/src/primitives/signals/index.ts +0 -1
- package/src/progress-bar/config.ts +0 -48
- package/src/progress-bar/index.ts +0 -12
- package/src/progress-bar/progress-bar-fill.ts +0 -37
- package/src/progress-bar/progress-bar.context.ts +0 -34
- package/src/progress-bar/progress-bar.spec.ts +0 -423
- package/src/progress-bar/progress-bar.ts +0 -217
- package/src/public-api.ts +0 -84
- package/src/radio/index.ts +0 -2
- package/src/radio/radio.context.ts +0 -3
- package/src/radio/radio.spec.ts +0 -36
- package/src/radio/radio.ts +0 -66
- package/src/select/index.ts +0 -4
- package/src/select/select-content.ts +0 -69
- package/src/select/select-option.ts +0 -35
- package/src/select/select-root.ts +0 -129
- package/src/select/select-trigger.ts +0 -93
- package/src/select/select.spec.ts +0 -138
- package/src/select/select.ts +0 -4
- package/src/skeleton/index.ts +0 -5
- package/src/skeleton/skeleton.spec.ts +0 -115
- package/src/skeleton/skeleton.ts +0 -56
- package/src/slider/index.ts +0 -10
- package/src/slider/slider-range.ts +0 -49
- package/src/slider/slider-thumb.ts +0 -335
- package/src/slider/slider-track.ts +0 -70
- package/src/slider/slider.context.ts +0 -79
- package/src/slider/slider.geometry.ts +0 -73
- package/src/slider/slider.spec.ts +0 -216
- package/src/slider/slider.ts +0 -443
- package/src/speed-dial/index.ts +0 -10
- package/src/speed-dial/speed-dial-action.ts +0 -40
- package/src/speed-dial/speed-dial-actions.ts +0 -31
- package/src/speed-dial/speed-dial-trigger.ts +0 -55
- package/src/speed-dial/speed-dial.context.ts +0 -36
- package/src/speed-dial/speed-dial.spec.ts +0 -143
- package/src/speed-dial/speed-dial.ts +0 -127
- package/src/spinner/config.ts +0 -48
- package/src/spinner/index.ts +0 -8
- package/src/spinner/spinner.spec.ts +0 -262
- package/src/spinner/spinner.ts +0 -129
- package/src/stepper/index.ts +0 -15
- package/src/stepper/stepper.context.ts +0 -63
- package/src/stepper/stepper.spec.ts +0 -403
- package/src/stepper/stepper.ts +0 -544
- package/src/styles/docs-themes.css +0 -82
- package/src/styles.css +0 -17
- package/src/table/column-helpers.spec.ts +0 -74
- package/src/table/column-helpers.ts +0 -68
- package/src/table/filter-fns.ts +0 -230
- package/src/table/filter-models.spec.ts +0 -240
- package/src/table/filter-models.ts +0 -124
- package/src/table/filter-params.ts +0 -90
- package/src/table/grid-api-impl.ts +0 -321
- package/src/table/grid-api.spec.ts +0 -178
- package/src/table/grid-api.ts +0 -285
- package/src/table/index.ts +0 -73
- package/src/table/table-cell.spec.ts +0 -43
- package/src/table/table-cell.ts +0 -38
- package/src/table/table-filter-outlet.ts +0 -120
- package/src/table/table-header.spec.ts +0 -54
- package/src/table/table-header.ts +0 -63
- package/src/table/table-keyboard.spec.ts +0 -68
- package/src/table/table-keyboard.ts +0 -107
- package/src/table/table-resource.spec.ts +0 -37
- package/src/table/table-resource.ts +0 -36
- package/src/table/table-row.spec.ts +0 -54
- package/src/table/table-row.ts +0 -31
- package/src/table/table-storage.spec.ts +0 -67
- package/src/table/table-storage.ts +0 -76
- package/src/table/table.spec.ts +0 -172
- package/src/table/table.ts +0 -281
- package/src/table/table.types.ts +0 -83
- package/src/tabs/index.ts +0 -7
- package/src/tabs/tabs.context.ts +0 -32
- package/src/tabs/tabs.spec.ts +0 -352
- package/src/tabs/tabs.ts +0 -364
- package/src/tag/config.ts +0 -53
- package/src/tag/index.ts +0 -7
- package/src/tag/tag-list.ts +0 -76
- package/src/tag/tag-remove.ts +0 -61
- package/src/tag/tag.context.ts +0 -36
- package/src/tag/tag.spec.ts +0 -240
- package/src/tag/tag.ts +0 -203
- package/src/test-setup.ts +0 -5
- package/src/textarea/config.ts +0 -42
- package/src/textarea/index.ts +0 -8
- package/src/textarea/textarea.spec.ts +0 -176
- package/src/textarea/textarea.ts +0 -235
- package/src/time-picker/index.ts +0 -15
- package/src/time-picker/time-picker-meridiem.ts +0 -123
- package/src/time-picker/time-picker-segment.ts +0 -318
- package/src/time-picker/time-picker.context.ts +0 -38
- package/src/time-picker/time-picker.format.ts +0 -181
- package/src/time-picker/time-picker.spec.ts +0 -189
- package/src/time-picker/time-picker.ts +0 -274
- package/src/toast/_examples/index.ts +0 -5
- package/src/toast/_examples/toast.example.ts +0 -282
- package/src/toast/_examples/toast.finance.example.ts +0 -180
- package/src/toast/_examples/toast.retro.example.ts +0 -161
- package/src/toast/index.ts +0 -28
- package/src/toast/toast.ref.ts +0 -26
- package/src/toast/toast.service.ts +0 -339
- package/src/toast/toast.spec.ts +0 -247
- package/src/toast/toast.strategy.ts +0 -112
- package/src/toast/toast.ts +0 -463
- package/src/toast/toast.types.ts +0 -5
- package/src/toggle/index.ts +0 -1
- package/src/toggle/toggle.spec.ts +0 -24
- package/src/toggle/toggle.ts +0 -48
- package/src/tooltip/_examples/index.ts +0 -6
- package/src/tooltip/_examples/tooltip.example.ts +0 -82
- package/src/tooltip/_examples/tooltip.finance.example.ts +0 -97
- package/src/tooltip/_examples/tooltip.placements.example.ts +0 -83
- package/src/tooltip/_examples/tooltip.retro.example.ts +0 -107
- package/src/tooltip/index.ts +0 -4
- package/src/tooltip/tooltip-arrow.ts +0 -31
- package/src/tooltip/tooltip-content.ts +0 -38
- package/src/tooltip/tooltip-group.ts +0 -32
- package/src/tooltip/tooltip-trigger.ts +0 -47
- package/src/tooltip/tooltip.spec.ts +0 -40
- package/src/tooltip/tooltip.ts +0 -5
- package/src/tree-select/index.ts +0 -12
- package/src/tree-select/tree-select-content.ts +0 -199
- package/src/tree-select/tree-select-node.ts +0 -132
- package/src/tree-select/tree-select-root.ts +0 -272
- package/src/tree-select/tree-select-trigger.ts +0 -90
- package/src/tree-select/tree-select.context.ts +0 -63
- package/src/tree-select/tree-select.spec.ts +0 -433
- package/src/tree-select/tree-select.ts +0 -2
- package/src/typography/blockquote.ts +0 -57
- package/src/typography/code.ts +0 -53
- package/src/typography/index.ts +0 -22
- package/src/typography/lead.ts +0 -49
- package/src/typography/muted.ts +0 -29
- package/src/typography/truncate.ts +0 -99
- package/src/typography/typography.spec.ts +0 -203
- package/tsconfig.lib.json +0 -21
- package/tsconfig.lib.prod.json +0 -17
- package/tsconfig.spec.json +0 -18
- package/vite.config.ts +0 -27
- /package/{src/icon → icon}/icon.css +0 -0
- /package/{src/typography → typography}/prose.css +0 -0
package/src/drawer/drawer.ts
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
ElementRef,
|
|
5
|
-
HostListener,
|
|
6
|
-
ViewEncapsulation,
|
|
7
|
-
computed,
|
|
8
|
-
inject,
|
|
9
|
-
} from '@angular/core';
|
|
10
|
-
import { KjOverlayPanel } from '../primitives/overlay/panel';
|
|
11
|
-
import { DRAWER_DRAG, DRAWER_SIDE, type KjDrawerSide } from './drawer.service';
|
|
12
|
-
import { KjDrawerRef } from './drawer.ref';
|
|
13
|
-
|
|
14
|
-
/** Downward drag fraction past which release dismisses (bottom side). */
|
|
15
|
-
const DEFAULT_DISMISS_THRESHOLD = 0.4;
|
|
16
|
-
/** Downward velocity (px/s) past which release dismisses (bottom side). */
|
|
17
|
-
const DEFAULT_DISMISS_VELOCITY = 600;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Drawer body component. Composes {@link KjOverlayPanel} so the host element
|
|
21
|
-
* inherits `role`, `[data-state]`, and the configured side strategy from
|
|
22
|
-
* `KjDrawer.open()`. Preserves the optional drag-to-dismiss behaviour: when
|
|
23
|
-
* `KjDrawer.open({ drag: true, side: 'bottom' })`, pointer-down on the host
|
|
24
|
-
* starts a drag that calls `ref.close()` once the threshold is crossed.
|
|
25
|
-
*
|
|
26
|
-
* @doc-category Core/Overlay
|
|
27
|
-
*/
|
|
28
|
-
@Component({
|
|
29
|
-
selector: 'kj-drawer',
|
|
30
|
-
standalone: true,
|
|
31
|
-
hostDirectives: [{ directive: KjOverlayPanel }],
|
|
32
|
-
host: {
|
|
33
|
-
'class': 'kj-drawer',
|
|
34
|
-
'[attr.data-kj-side]': 'side',
|
|
35
|
-
'[attr.data-kj-dragging]': 'dragging() ? "" : null',
|
|
36
|
-
'[style.touch-action]': 'dragging() ? "none" : null',
|
|
37
|
-
'(pointerdown)': 'onPointerDown($event)',
|
|
38
|
-
'(pointermove)': 'onPointerMove($event)',
|
|
39
|
-
'(pointerup)': 'onPointerUp($event)',
|
|
40
|
-
'(pointercancel)': 'onPointerCancel($event)',
|
|
41
|
-
},
|
|
42
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
43
|
-
encapsulation: ViewEncapsulation.None,
|
|
44
|
-
template: `<ng-content />`,
|
|
45
|
-
})
|
|
46
|
-
export class KjDrawer {
|
|
47
|
-
/** Resolved drawer side (provided by `KjDrawer.open`). */
|
|
48
|
-
readonly side = inject<KjDrawerSide>(DRAWER_SIDE, { optional: true }) ?? 'right';
|
|
49
|
-
/** Whether drag-to-dismiss is active for this drawer. */
|
|
50
|
-
readonly drag = inject<boolean>(DRAWER_DRAG, { optional: true }) ?? false;
|
|
51
|
-
|
|
52
|
-
private readonly ref = inject<KjDrawerRef<unknown>>(KjDrawerRef, { optional: true });
|
|
53
|
-
private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);
|
|
54
|
-
|
|
55
|
-
private startY = 0;
|
|
56
|
-
private startTime = 0;
|
|
57
|
-
private pointerId: number | null = null;
|
|
58
|
-
private _dragging = false;
|
|
59
|
-
|
|
60
|
-
/** Reactive flag for `data-kj-dragging` host binding. */
|
|
61
|
-
protected dragging = computed(() => this._dragging);
|
|
62
|
-
|
|
63
|
-
/** @internal */
|
|
64
|
-
onPointerDown(event: PointerEvent): void {
|
|
65
|
-
if (!this.drag) return;
|
|
66
|
-
if (this.side !== 'bottom') return;
|
|
67
|
-
if (event.button !== undefined && event.button !== 0) return;
|
|
68
|
-
this.pointerId = event.pointerId;
|
|
69
|
-
this.startY = event.clientY;
|
|
70
|
-
this.startTime = typeof performance !== 'undefined' ? performance.now() : Date.now();
|
|
71
|
-
this._dragging = true;
|
|
72
|
-
(event.target as Element | null)?.setPointerCapture?.(event.pointerId);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/** @internal */
|
|
76
|
-
onPointerMove(event: PointerEvent): void {
|
|
77
|
-
if (!this._dragging) return;
|
|
78
|
-
if (this.pointerId !== null && event.pointerId !== this.pointerId) return;
|
|
79
|
-
const offset = Math.max(0, event.clientY - this.startY);
|
|
80
|
-
this.el.nativeElement.style.setProperty('--kj-drawer-drag-offset', `${offset}px`);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/** @internal */
|
|
84
|
-
onPointerUp(event: PointerEvent): void {
|
|
85
|
-
if (!this._dragging) return;
|
|
86
|
-
if (this.pointerId !== null && event.pointerId !== this.pointerId) return;
|
|
87
|
-
const now = typeof performance !== 'undefined' ? performance.now() : Date.now();
|
|
88
|
-
const dy = Math.max(0, event.clientY - this.startY);
|
|
89
|
-
const dt = Math.max(1, now - this.startTime);
|
|
90
|
-
const velocity = (dy / dt) * 1000;
|
|
91
|
-
this.endDrag();
|
|
92
|
-
const panelHeight = this.el.nativeElement.getBoundingClientRect().height || 200;
|
|
93
|
-
if (
|
|
94
|
-
velocity > DEFAULT_DISMISS_VELOCITY
|
|
95
|
-
|| dy / panelHeight >= DEFAULT_DISMISS_THRESHOLD
|
|
96
|
-
) {
|
|
97
|
-
this.ref?.close();
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/** @internal */
|
|
102
|
-
onPointerCancel(_event: PointerEvent): void {
|
|
103
|
-
this.endDrag();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
private endDrag(): void {
|
|
107
|
-
this._dragging = false;
|
|
108
|
-
this.pointerId = null;
|
|
109
|
-
this.el.nativeElement.style.removeProperty('--kj-drawer-drag-offset');
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/** Close the drawer with an optional payload. */
|
|
113
|
-
close(result?: unknown): void {
|
|
114
|
-
(this.ref as KjDrawerRef<unknown, unknown> | null)?.close(result);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/** Esc closes via the overlay-stack coordinator on the controller. */
|
|
118
|
-
@HostListener('keydown.escape')
|
|
119
|
-
onEscape(): void {
|
|
120
|
-
this.ref?.close();
|
|
121
|
-
}
|
|
122
|
-
}
|
package/src/drawer/index.ts
DELETED
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Component,
|
|
3
|
-
ChangeDetectionStrategy,
|
|
4
|
-
ViewEncapsulation,
|
|
5
|
-
Injector,
|
|
6
|
-
computed,
|
|
7
|
-
contentChildren,
|
|
8
|
-
effect,
|
|
9
|
-
forwardRef,
|
|
10
|
-
inject,
|
|
11
|
-
input,
|
|
12
|
-
signal,
|
|
13
|
-
untracked,
|
|
14
|
-
} from '@angular/core';
|
|
15
|
-
import { KjOverlayPanel } from '../primitives/overlay/panel';
|
|
16
|
-
import {
|
|
17
|
-
KJ_OVERLAY_MOUNT_STRATEGY,
|
|
18
|
-
KJ_OVERLAY_POSITION_STRATEGY,
|
|
19
|
-
KJ_OVERLAY_PANEL_ROLE,
|
|
20
|
-
} from '../primitives/overlay/tokens';
|
|
21
|
-
import type {
|
|
22
|
-
KjMountStrategy,
|
|
23
|
-
KjPositionStrategy,
|
|
24
|
-
} from '../primitives/overlay/tokens';
|
|
25
|
-
import type { KjOverlayContext } from '../primitives/overlay/context';
|
|
26
|
-
import type { KjSide, KjAlign } from '../primitives/overlay/types';
|
|
27
|
-
import { bodyPortal } from '../primitives/overlay/strategies/mount/body-portal';
|
|
28
|
-
import { inPlace } from '../primitives/overlay/strategies/mount/in-place';
|
|
29
|
-
import { anchoredTo } from '../primitives/overlay/strategies/position/anchored-to';
|
|
30
|
-
import { pointAt } from '../primitives/overlay/strategies/position/point-at';
|
|
31
|
-
import { inPlaceSibling } from '../primitives/overlay/strategies/position/in-place-sibling';
|
|
32
|
-
import {
|
|
33
|
-
KJ_LIST_FOCUS_MODE,
|
|
34
|
-
KJ_LIST_NAVIGATOR_CONFIG,
|
|
35
|
-
KjListItem,
|
|
36
|
-
KjListNavigator,
|
|
37
|
-
KjTypeAhead,
|
|
38
|
-
type KjCompareFn,
|
|
39
|
-
type KjListFocusMode,
|
|
40
|
-
type KjListNavigatorConfig,
|
|
41
|
-
} from '../primitives/list';
|
|
42
|
-
import {
|
|
43
|
-
KjDropdownMenuTrigger,
|
|
44
|
-
KJ_DROPDOWN_MENU,
|
|
45
|
-
type KjDropdownMenuCloseReason,
|
|
46
|
-
type KjDropdownMenuContext,
|
|
47
|
-
} from './dropdown-menu-trigger';
|
|
48
|
-
|
|
49
|
-
type KjDeferredMount = KjMountStrategy & { setDelegate(d: KjMountStrategy): void };
|
|
50
|
-
type KjDeferredPosition = KjPositionStrategy & { setDelegate(d: KjPositionStrategy): void };
|
|
51
|
-
|
|
52
|
-
function deferredMount(): KjDeferredMount {
|
|
53
|
-
let ctx: KjOverlayContext | null = null;
|
|
54
|
-
let delegate: KjMountStrategy | null = null;
|
|
55
|
-
let attached = false;
|
|
56
|
-
let opened = false;
|
|
57
|
-
return {
|
|
58
|
-
get portalled() { return delegate?.portalled ?? true; },
|
|
59
|
-
attach(c) { ctx = c; attached = true; if (delegate) delegate.attach(c); },
|
|
60
|
-
onOpen() { opened = true; delegate?.onOpen?.(); },
|
|
61
|
-
onClose() { opened = false; delegate?.onClose?.(); },
|
|
62
|
-
detach() { delegate?.detach(); ctx = null; attached = false; },
|
|
63
|
-
resolveContainer() {
|
|
64
|
-
const from = delegate?.resolveContainer();
|
|
65
|
-
if (from) return from;
|
|
66
|
-
if (typeof document === 'undefined') return null as unknown as HTMLElement;
|
|
67
|
-
return document.body;
|
|
68
|
-
},
|
|
69
|
-
setDelegate(d) {
|
|
70
|
-
delegate = d;
|
|
71
|
-
if (attached && ctx) d.attach(ctx);
|
|
72
|
-
if (opened) d.onOpen?.();
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function deferredPosition(): KjDeferredPosition {
|
|
78
|
-
let ctx: KjOverlayContext | null = null;
|
|
79
|
-
let delegate: KjPositionStrategy | null = null;
|
|
80
|
-
let attached = false;
|
|
81
|
-
let opened = false;
|
|
82
|
-
return {
|
|
83
|
-
attach(c) { ctx = c; attached = true; if (delegate) delegate.attach(c); },
|
|
84
|
-
onOpen() { opened = true; delegate?.onOpen?.(); },
|
|
85
|
-
onClose() { opened = false; delegate?.onClose?.(); },
|
|
86
|
-
update() { delegate?.update(); },
|
|
87
|
-
detach() { delegate?.detach(); ctx = null; attached = false; },
|
|
88
|
-
setDelegate(d) {
|
|
89
|
-
delegate = d;
|
|
90
|
-
if (attached && ctx) d.attach(ctx);
|
|
91
|
-
if (opened) d.onOpen?.();
|
|
92
|
-
},
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/**
|
|
97
|
-
* The dropdown-menu content panel. Composes `KjOverlayPanel` and dispatches
|
|
98
|
-
* mount + position strategies based on `kjMount`:
|
|
99
|
-
*
|
|
100
|
-
* - `'portal'` (default) — `bodyPortal()` + `anchoredTo(trigger, side, align)`
|
|
101
|
-
* - `'point'` — `bodyPortal()` + `pointAt({x, y})` (right-click / context-menu)
|
|
102
|
-
* - `'inline'` — `inPlace()` + `inPlaceSibling()`
|
|
103
|
-
*
|
|
104
|
-
* Sets `role="menu"` via the panel role token. Composes
|
|
105
|
-
* `KjListNavigator{kjOrientation:'vertical', kjFocusMode:'roving'}` and
|
|
106
|
-
* provides `KjTypeAhead`, so projected `[kjDropdownMenuItem]`s get the
|
|
107
|
-
* full WAI-ARIA APG menu keyboard contract (Up/Down/Home/End/type-ahead)
|
|
108
|
-
* + roving DOM focus for free. Implements {@link KjListNavigatorConfig}
|
|
109
|
-
* — items are actions, no selection model.
|
|
110
|
-
*
|
|
111
|
-
* @doc-category Core/Overlay
|
|
112
|
-
*/
|
|
113
|
-
@Component({
|
|
114
|
-
selector: 'kj-dropdown-menu-content',
|
|
115
|
-
standalone: true,
|
|
116
|
-
hostDirectives: [
|
|
117
|
-
{ directive: KjOverlayPanel, inputs: ['kjFor'] },
|
|
118
|
-
{
|
|
119
|
-
directive: KjListNavigator,
|
|
120
|
-
inputs: ['kjOrientation', 'kjFocusMode'],
|
|
121
|
-
},
|
|
122
|
-
],
|
|
123
|
-
providers: [
|
|
124
|
-
{ provide: KJ_OVERLAY_PANEL_ROLE, useValue: 'menu' as const },
|
|
125
|
-
{ provide: KJ_OVERLAY_MOUNT_STRATEGY, useFactory: () => deferredMount() },
|
|
126
|
-
{ provide: KJ_OVERLAY_POSITION_STRATEGY, useFactory: () => deferredPosition() },
|
|
127
|
-
{ provide: KJ_DROPDOWN_MENU, useExisting: KjDropdownMenuContent },
|
|
128
|
-
{ provide: KJ_LIST_NAVIGATOR_CONFIG, useExisting: forwardRef(() => KjDropdownMenuContent) },
|
|
129
|
-
// Force roving focus mode at the element injector. `KjListNavigator`
|
|
130
|
-
// also provides this token (driven by its own `kjFocusMode` input,
|
|
131
|
-
// which defaults to `'activedescendant'`). Overriding here means
|
|
132
|
-
// `KjListItem`s under this content compute their `tabindex` from a
|
|
133
|
-
// signal that always reads `'roving'` — independent of whether the
|
|
134
|
-
// consumer remembered to set `kjFocusMode` on the navigator.
|
|
135
|
-
{
|
|
136
|
-
provide: KJ_LIST_FOCUS_MODE,
|
|
137
|
-
useFactory: () => signal<KjListFocusMode>('roving'),
|
|
138
|
-
},
|
|
139
|
-
KjTypeAhead,
|
|
140
|
-
],
|
|
141
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
142
|
-
encapsulation: ViewEncapsulation.None,
|
|
143
|
-
host: {
|
|
144
|
-
'class': 'kj-dropdown-menu',
|
|
145
|
-
// The KjListNavigator host directive reads `kjOrientation` and
|
|
146
|
-
// `kjFocusMode` as signal inputs; setting the matching static
|
|
147
|
-
// attributes here seeds their initial values for the menu pattern
|
|
148
|
-
// (vertical orientation + roving DOM focus per WAI-ARIA APG).
|
|
149
|
-
'kjOrientation': 'vertical',
|
|
150
|
-
'kjFocusMode': 'roving',
|
|
151
|
-
'(keydown.escape)': 'onEscape($event)',
|
|
152
|
-
},
|
|
153
|
-
template: `<ng-content />`,
|
|
154
|
-
})
|
|
155
|
-
export class KjDropdownMenuContent implements KjDropdownMenuContext, KjListNavigatorConfig {
|
|
156
|
-
readonly kjSide = input<KjSide>('bottom');
|
|
157
|
-
readonly kjAlign = input<KjAlign>('start');
|
|
158
|
-
readonly kjMount = input<'portal' | 'point' | 'inline'>('portal');
|
|
159
|
-
|
|
160
|
-
// ── KjListNavigatorConfig ────────────────────────────────────────────
|
|
161
|
-
/** All `KjListItem`s projected into the menu panel. */
|
|
162
|
-
readonly items = contentChildren(KjListItem, { descendants: true });
|
|
163
|
-
/** Menu items are actions — no selection model. Kept as `Object.is`. */
|
|
164
|
-
readonly compareBy = signal<KjCompareFn<unknown>>(Object.is as KjCompareFn<unknown>);
|
|
165
|
-
/**
|
|
166
|
-
* Universal menu UX: any item activation closes the menu. `KjListItem`
|
|
167
|
-
* calls this with `closeRequested=false` since no `KjSelectionModel` is
|
|
168
|
-
* provided — we override the flag and always close.
|
|
169
|
-
*/
|
|
170
|
-
afterSelect(_value: unknown, _closeRequested: boolean): void {
|
|
171
|
-
this.hide('item');
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
private readonly _injector = inject(Injector);
|
|
175
|
-
private _panelCache: KjOverlayPanel | null | undefined = undefined;
|
|
176
|
-
private get _panel(): KjOverlayPanel | null {
|
|
177
|
-
if (this._panelCache === undefined) {
|
|
178
|
-
this._panelCache = this._injector.get(KjOverlayPanel, null);
|
|
179
|
-
}
|
|
180
|
-
return this._panelCache;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/** Mirror of trigger's closeOnSelect — defaults to true; trigger overrides via its own provider. */
|
|
184
|
-
readonly closeOnSelect = computed(() => true);
|
|
185
|
-
|
|
186
|
-
/** Item-driven close. Routes through the panel's controller (resolved via `kjFor`). */
|
|
187
|
-
hide(_reason: KjDropdownMenuCloseReason): void {
|
|
188
|
-
this._panel?.controller?.close('programmatic');
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/** Escape key — closes the menu. KjListNavigator does not own Escape. */
|
|
192
|
-
protected onEscape(event: Event): void {
|
|
193
|
-
event.preventDefault();
|
|
194
|
-
event.stopPropagation();
|
|
195
|
-
this.hide('escape');
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
/**
|
|
199
|
-
* Lazily-resolved reference to the composed `KjListNavigator`. Resolved
|
|
200
|
-
* inside effects (not at construction) to avoid the
|
|
201
|
-
* `KjListNavigator <-> KJ_LIST_NAVIGATOR_CONFIG (useExisting this) <-> KjListNavigator`
|
|
202
|
-
* NG0200 cycle that synchronous injection of `KjListNavigator` would
|
|
203
|
-
* trigger at the element injector.
|
|
204
|
-
*/
|
|
205
|
-
private _navCache: KjListNavigator | null = null;
|
|
206
|
-
private getNav(): KjListNavigator | null {
|
|
207
|
-
if (this._navCache) return this._navCache;
|
|
208
|
-
this._navCache = this._injector.get(KjListNavigator, null, { self: true });
|
|
209
|
-
return this._navCache;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
constructor() {
|
|
213
|
-
const mount = inject(KJ_OVERLAY_MOUNT_STRATEGY) as KjDeferredMount;
|
|
214
|
-
const position = inject(KJ_OVERLAY_POSITION_STRATEGY) as KjDeferredPosition;
|
|
215
|
-
const trigDir = inject(KjDropdownMenuTrigger, { optional: true });
|
|
216
|
-
const m = this.kjMount();
|
|
217
|
-
if (m === 'inline') {
|
|
218
|
-
mount.setDelegate(inPlace());
|
|
219
|
-
position.setDelegate(inPlaceSibling());
|
|
220
|
-
} else if (m === 'point' && trigDir) {
|
|
221
|
-
mount.setDelegate(bodyPortal());
|
|
222
|
-
position.setDelegate(pointAt({ x: trigDir.kjPointX, y: trigDir.kjPointY }));
|
|
223
|
-
} else {
|
|
224
|
-
mount.setDelegate(bodyPortal());
|
|
225
|
-
position.setDelegate(anchoredTo({ side: this.kjSide, align: this.kjAlign }));
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
// Roving seed: when nothing is active yet (e.g. just-opened menu),
|
|
229
|
-
// point the navigator at the first non-disabled item so its host
|
|
230
|
-
// gets `tabindex=0` and is reachable by Tab. Mirrors the seed effect
|
|
231
|
-
// inside `KjListNavigator` for the `'roving'` focus mode — needed
|
|
232
|
-
// here because the navigator's own seed gates on `kjFocusMode()`,
|
|
233
|
-
// which stays at the directive's default `'activedescendant'`
|
|
234
|
-
// (host-directive inputs cannot be defaulted from this component).
|
|
235
|
-
effect(() => {
|
|
236
|
-
const items = this.items();
|
|
237
|
-
const nav = this.getNav();
|
|
238
|
-
if (!nav) return;
|
|
239
|
-
if (nav.activeId() !== null) return;
|
|
240
|
-
const first = items.find(i => !i.disabled());
|
|
241
|
-
if (first) untracked(() => nav.setActive(first.id));
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
// Roving focus follow: move DOM focus onto the active item's host.
|
|
245
|
-
// Same rationale as the seed effect — the navigator's own
|
|
246
|
-
// focus-follow effect gates on `kjFocusMode() === 'roving'`.
|
|
247
|
-
effect(() => {
|
|
248
|
-
const nav = this.getNav();
|
|
249
|
-
if (!nav) return;
|
|
250
|
-
const item = nav.activeItem();
|
|
251
|
-
if (!item) return;
|
|
252
|
-
const host = item._host();
|
|
253
|
-
if (host && typeof document !== 'undefined' && document.activeElement !== host) {
|
|
254
|
-
untracked(() => host.focus());
|
|
255
|
-
}
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { Directive } from '@angular/core';
|
|
2
|
-
import { KjListGroup } from '../primitives/list';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A logical grouping of items inside a `[kjDropdownMenu]` panel.
|
|
6
|
-
*
|
|
7
|
-
* Composes the shared `KjListGroup` primitive — `role="group"`,
|
|
8
|
-
* auto-`aria-labelledby` wiring to a child `[kjDropdownMenuLabel]`, and
|
|
9
|
-
* auto-hide when every child item is filter-hidden.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```html
|
|
13
|
-
* <div kjDropdownMenuGroup>
|
|
14
|
-
* <span kjDropdownMenuLabel>Account</span>
|
|
15
|
-
* <button kjDropdownMenuItem>Profile</button>
|
|
16
|
-
* <button kjDropdownMenuItem>Settings</button>
|
|
17
|
-
* </div>
|
|
18
|
-
* ```
|
|
19
|
-
* @doc-category Core/Overlay
|
|
20
|
-
*/
|
|
21
|
-
@Directive({
|
|
22
|
-
selector: '[kjDropdownMenuGroup]',
|
|
23
|
-
standalone: true,
|
|
24
|
-
hostDirectives: [
|
|
25
|
-
{ directive: KjListGroup, inputs: ['kjId'] },
|
|
26
|
-
],
|
|
27
|
-
host: {
|
|
28
|
-
'class': 'kj-dropdown-menu-group',
|
|
29
|
-
},
|
|
30
|
-
})
|
|
31
|
-
export class KjDropdownMenuGroup {}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Directive,
|
|
3
|
-
output,
|
|
4
|
-
} from '@angular/core';
|
|
5
|
-
import { KjListItem, injectListItem } from '../primitives/list';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* An individual item inside a `[kjDropdownMenu]` panel.
|
|
9
|
-
*
|
|
10
|
-
* Apply on a `<button>`. Sets `role="menuitem"` and composes `KjListItem`
|
|
11
|
-
* for id, value, label, disabled state, click + Enter/Space activation,
|
|
12
|
-
* `aria-disabled`, and (via the surrounding `KjListNavigator` in roving
|
|
13
|
-
* mode) `tabindex` driven by the active-item state.
|
|
14
|
-
*
|
|
15
|
-
* Activation flows through `KjListItem._activate` → root config's
|
|
16
|
-
* `afterSelect` hook → overlay close. This directive only contributes
|
|
17
|
-
* `role="menuitem"`, the `kj-dropdown-menu-item` class, the `kj*` input
|
|
18
|
-
* aliases, and re-emits the composed `activate` output as `kjSelect`.
|
|
19
|
-
*
|
|
20
|
-
* @doc-category Core/Overlay
|
|
21
|
-
*/
|
|
22
|
-
@Directive({
|
|
23
|
-
selector: '[kjDropdownMenuItem]',
|
|
24
|
-
standalone: true,
|
|
25
|
-
hostDirectives: [
|
|
26
|
-
{
|
|
27
|
-
directive: KjListItem,
|
|
28
|
-
inputs: [
|
|
29
|
-
'kjItemLabel:kjLabel',
|
|
30
|
-
'kjShortcut:kjShortcut',
|
|
31
|
-
'kjDisabled:kjDisabled',
|
|
32
|
-
],
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
host: {
|
|
36
|
-
'class': 'kj-dropdown-menu-item',
|
|
37
|
-
'role': 'menuitem',
|
|
38
|
-
},
|
|
39
|
-
})
|
|
40
|
-
export class KjDropdownMenuItem {
|
|
41
|
-
private readonly item = injectListItem<unknown>();
|
|
42
|
-
|
|
43
|
-
/** Emitted when the item is activated (click / Enter / Space). */
|
|
44
|
-
readonly kjSelect = output<void>();
|
|
45
|
-
|
|
46
|
-
constructor() {
|
|
47
|
-
// Forward the primitive's activation output so consumers can keep
|
|
48
|
-
// listening to `(kjSelect)` exactly as before.
|
|
49
|
-
this.item.activate.subscribe(() => this.kjSelect.emit());
|
|
50
|
-
}
|
|
51
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Directive, inject } from '@angular/core';
|
|
2
|
-
import { KjListGroupLabel } from '../primitives/list';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A non-interactive heading inside a `[kjDropdownMenu]` panel.
|
|
6
|
-
*
|
|
7
|
-
* Composes the shared `KjListGroupLabel` primitive, which mints a stable
|
|
8
|
-
* id and registers it with the surrounding `[kjDropdownMenuGroup]`
|
|
9
|
-
* (composing `KjListGroup`) so screen readers announce the group with
|
|
10
|
-
* the label's text content via `aria-labelledby`.
|
|
11
|
-
*
|
|
12
|
-
* Sets `role="presentation"` — the label is heading text, not a
|
|
13
|
-
* focusable item, and the surrounding navigator skips it.
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* ```html
|
|
17
|
-
* <span kjDropdownMenuLabel>Account</span>
|
|
18
|
-
* ```
|
|
19
|
-
* @doc-category Core/Overlay
|
|
20
|
-
*/
|
|
21
|
-
@Directive({
|
|
22
|
-
selector: '[kjDropdownMenuLabel]',
|
|
23
|
-
standalone: true,
|
|
24
|
-
exportAs: 'kjDropdownMenuLabel',
|
|
25
|
-
hostDirectives: [
|
|
26
|
-
{ directive: KjListGroupLabel, inputs: ['kjId'] },
|
|
27
|
-
],
|
|
28
|
-
host: {
|
|
29
|
-
'class': 'kj-dropdown-menu-label',
|
|
30
|
-
'role': 'presentation',
|
|
31
|
-
},
|
|
32
|
-
})
|
|
33
|
-
export class KjDropdownMenuLabel {
|
|
34
|
-
/** Composed label primitive — exposes the resolved id. */
|
|
35
|
-
private readonly label = inject(KjListGroupLabel, { self: true });
|
|
36
|
-
|
|
37
|
-
/** Stable id used by a wrapping `[kjDropdownMenuGroup]` for `aria-labelledby`. */
|
|
38
|
-
get id(): string {
|
|
39
|
-
return this.label.id();
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Directive } from '@angular/core';
|
|
2
|
-
import { KjListSeparator } from '../primitives/list';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* A non-focusable horizontal divider between groups of menu items.
|
|
6
|
-
*
|
|
7
|
-
* Composes the shared `KjListSeparator` primitive — sets
|
|
8
|
-
* `role="separator"` and `aria-orientation="horizontal"`. The roving
|
|
9
|
-
* navigator / type-ahead in `[kjDropdownMenu]` skips it because it isn't
|
|
10
|
-
* a `KjListItem`.
|
|
11
|
-
*
|
|
12
|
-
* @example
|
|
13
|
-
* ```html
|
|
14
|
-
* <div kjDropdownMenuSeparator></div>
|
|
15
|
-
* ```
|
|
16
|
-
* @doc-category Core/Overlay
|
|
17
|
-
*/
|
|
18
|
-
@Directive({
|
|
19
|
-
selector: '[kjDropdownMenuSeparator]',
|
|
20
|
-
standalone: true,
|
|
21
|
-
hostDirectives: [KjListSeparator],
|
|
22
|
-
host: {
|
|
23
|
-
'class': 'kj-dropdown-menu-separator',
|
|
24
|
-
'tabindex': '-1',
|
|
25
|
-
},
|
|
26
|
-
})
|
|
27
|
-
export class KjDropdownMenuSeparator {}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Directive,
|
|
3
|
-
ElementRef,
|
|
4
|
-
InjectionToken,
|
|
5
|
-
booleanAttribute,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
output,
|
|
9
|
-
signal,
|
|
10
|
-
type Signal,
|
|
11
|
-
} from '@angular/core';
|
|
12
|
-
import { KjOverlayTrigger } from '../primitives/overlay/trigger';
|
|
13
|
-
import type { KjOverlayPanel } from '../primitives/overlay/panel';
|
|
14
|
-
import { KjOverlayController } from '../primitives/overlay/controller';
|
|
15
|
-
import {
|
|
16
|
-
KJ_OVERLAY_TRIGGER_EVENT_STRATEGY,
|
|
17
|
-
KJ_OVERLAY_PANEL_ROLE,
|
|
18
|
-
} from '../primitives/overlay/tokens';
|
|
19
|
-
import { onClick } from '../primitives/overlay/strategies/trigger-event/on-click';
|
|
20
|
-
import { onContextMenu } from '../primitives/overlay/strategies/trigger-event/on-context-menu';
|
|
21
|
-
|
|
22
|
-
/** Trigger event mode. `'click'` (default) or `'contextmenu'` (right-click / long-press). */
|
|
23
|
-
export type KjDropdownMenuTriggerKind = 'click' | 'contextmenu';
|
|
24
|
-
|
|
25
|
-
/** How and where the panel mounts: portal (default), at a point, or inline (in-place). */
|
|
26
|
-
export type KjDropdownMenuMount = 'portal' | 'point' | 'inline';
|
|
27
|
-
|
|
28
|
-
/** Reason a dropdown menu close was requested. */
|
|
29
|
-
export type KjDropdownMenuCloseReason =
|
|
30
|
-
| 'item'
|
|
31
|
-
| 'escape'
|
|
32
|
-
| 'tab'
|
|
33
|
-
| 'click-outside'
|
|
34
|
-
| 'programmatic';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Minimal context surface consumed by item-level directives
|
|
38
|
-
* (`KjDropdownMenuItem`, etc.). The trigger directive provides this token.
|
|
39
|
-
*/
|
|
40
|
-
export interface KjDropdownMenuContext {
|
|
41
|
-
readonly closeOnSelect: Signal<boolean>;
|
|
42
|
-
hide(reason: KjDropdownMenuCloseReason): void;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/** DI token for the dropdown menu shared context (item-level). */
|
|
46
|
-
export const KJ_DROPDOWN_MENU = new InjectionToken<KjDropdownMenuContext>(
|
|
47
|
-
'KjDropdownMenu',
|
|
48
|
-
);
|
|
49
|
-
|
|
50
|
-
let _labelIdCounter = 0;
|
|
51
|
-
/** Allocate a stable label id for `aria-labelledby` wiring on a group. */
|
|
52
|
-
export function nextDropdownMenuLabelId(): string {
|
|
53
|
-
return `kj-dropdown-menu-label-${++_labelIdCounter}`;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* The button that opens a dropdown menu. Composes `KjOverlayTrigger`.
|
|
58
|
-
*
|
|
59
|
-
* `kjTrigger` switches between `onClick()` (default) and `onContextMenu()`
|
|
60
|
-
* (replacement for the old `KjContextMenuTrigger`). For `kjMount="point"`,
|
|
61
|
-
* the trigger captures the originating pointer coords into signals consumed
|
|
62
|
-
* by `pointAt()` in the content component.
|
|
63
|
-
*
|
|
64
|
-
* Wires `aria-haspopup="menu"`, `aria-expanded`, `aria-controls` via the
|
|
65
|
-
* underlying `KjOverlayTrigger` host directive.
|
|
66
|
-
*
|
|
67
|
-
* @doc-category Core/Overlay
|
|
68
|
-
*/
|
|
69
|
-
@Directive({
|
|
70
|
-
selector: '[kjDropdownMenuTrigger]',
|
|
71
|
-
exportAs: 'kjDropdownMenuTrigger',
|
|
72
|
-
standalone: true,
|
|
73
|
-
hostDirectives: [{ directive: KjOverlayTrigger, inputs: ['kjOpen'] }],
|
|
74
|
-
providers: [
|
|
75
|
-
KjOverlayController,
|
|
76
|
-
{
|
|
77
|
-
provide: KJ_OVERLAY_TRIGGER_EVENT_STRATEGY,
|
|
78
|
-
// MVP: resolve at construction. `contextmenu` consumers should set
|
|
79
|
-
// `kjTrigger="contextmenu"` declaratively at construction time.
|
|
80
|
-
useFactory: () => {
|
|
81
|
-
// Read input attribute on the host element synchronously to pick the
|
|
82
|
-
// strategy. Falls back to click.
|
|
83
|
-
const el = inject(ElementRef<HTMLElement>).nativeElement as HTMLElement;
|
|
84
|
-
const kind = el.getAttribute('kjTrigger') ?? el.getAttribute('kjtrigger');
|
|
85
|
-
return kind === 'contextmenu' ? onContextMenu({ longPressMs: 500 }) : onClick();
|
|
86
|
-
},
|
|
87
|
-
},
|
|
88
|
-
{ provide: KJ_OVERLAY_PANEL_ROLE, useValue: 'menu' as const },
|
|
89
|
-
{ provide: KJ_DROPDOWN_MENU, useExisting: KjDropdownMenuTrigger },
|
|
90
|
-
],
|
|
91
|
-
host: {
|
|
92
|
-
'(click)': 'onPointer($event)',
|
|
93
|
-
'(contextmenu)': 'onPointer($event)',
|
|
94
|
-
},
|
|
95
|
-
})
|
|
96
|
-
export class KjDropdownMenuTrigger implements KjDropdownMenuContext {
|
|
97
|
-
/** Public — read by sibling `[kjFor]` panels. */
|
|
98
|
-
readonly controller = inject(KjOverlayController);
|
|
99
|
-
|
|
100
|
-
/** Trigger event kind. */
|
|
101
|
-
readonly kjTrigger = input<KjDropdownMenuTriggerKind>('click');
|
|
102
|
-
|
|
103
|
-
/** Mount mode for the content panel. */
|
|
104
|
-
readonly kjMount = input<KjDropdownMenuMount>('portal');
|
|
105
|
-
|
|
106
|
-
/** Suppresses opening entirely. */
|
|
107
|
-
readonly kjDisabled = input(false, { transform: booleanAttribute });
|
|
108
|
-
|
|
109
|
-
/** Whether item activation closes the menu by default. */
|
|
110
|
-
readonly kjCloseOnSelect = input(true, { transform: booleanAttribute });
|
|
111
|
-
|
|
112
|
-
/** Emitted when the menu closes, with the reason. */
|
|
113
|
-
readonly kjMenuClosed = output<KjDropdownMenuCloseReason>();
|
|
114
|
-
|
|
115
|
-
/** Captured pointer coordinates for `kjMount="point"`. */
|
|
116
|
-
readonly kjPointX = signal<number>(0);
|
|
117
|
-
readonly kjPointY = signal<number>(0);
|
|
118
|
-
|
|
119
|
-
/** Mirror exposed to item directives via `KJ_DROPDOWN_MENU`. */
|
|
120
|
-
readonly closeOnSelect = this.kjCloseOnSelect;
|
|
121
|
-
|
|
122
|
-
/** Capture pointer coords for point-mount; the strategy reads them. */
|
|
123
|
-
protected onPointer(e: MouseEvent): void {
|
|
124
|
-
if (this.kjMount() === 'point') {
|
|
125
|
-
this.kjPointX.set(e.clientX);
|
|
126
|
-
this.kjPointY.set(e.clientY);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/** Item-driven close (`KJ_DROPDOWN_MENU.hide`). */
|
|
131
|
-
hide(reason: KjDropdownMenuCloseReason): void {
|
|
132
|
-
this.controller.close('programmatic');
|
|
133
|
-
this.kjMenuClosed.emit(reason);
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
private readonly _overlayTrigger = inject(KjOverlayTrigger, { self: true });
|
|
137
|
-
attachPanel(panel: KjOverlayPanel): void {
|
|
138
|
-
this._overlayTrigger.attachPanel(panel);
|
|
139
|
-
}
|
|
140
|
-
}
|