@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
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
// packages/core/src/primitives/list/filterable-list.spec.ts
|
|
2
|
-
import { TestBed } from '@angular/core/testing';
|
|
3
|
-
import { signal, type WritableSignal } from '@angular/core';
|
|
4
|
-
import { describe, it, expect, beforeEach } from 'vitest';
|
|
5
|
-
import { KjFilterableList } from './filterable-list';
|
|
6
|
-
import type { KjFilterFn } from './tokens';
|
|
7
|
-
import type { KjListItem } from './item';
|
|
8
|
-
|
|
9
|
-
function fakeItem(id: string, label: string, keywords: readonly string[] = []): KjListItem<unknown> {
|
|
10
|
-
const _visible = signal(true);
|
|
11
|
-
const _posInSet = signal<number | null>(null);
|
|
12
|
-
const _setSize = signal<number | null>(null);
|
|
13
|
-
return {
|
|
14
|
-
id,
|
|
15
|
-
label: () => label,
|
|
16
|
-
haystacks: () => [label, ...keywords],
|
|
17
|
-
disabled: () => false,
|
|
18
|
-
visible: _visible,
|
|
19
|
-
setVisible: (v: boolean) => _visible.set(v),
|
|
20
|
-
posInSet: _posInSet,
|
|
21
|
-
setSize: _setSize,
|
|
22
|
-
} as unknown as KjListItem<unknown>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
describe('KjFilterableList', () => {
|
|
26
|
-
let items: WritableSignal<readonly KjListItem<unknown>[]>;
|
|
27
|
-
let svc: KjFilterableList;
|
|
28
|
-
let query: WritableSignal<string>;
|
|
29
|
-
let filterFn: WritableSignal<KjFilterFn>;
|
|
30
|
-
let shouldFilter: WritableSignal<boolean>;
|
|
31
|
-
let autoActivateFirst: WritableSignal<boolean>;
|
|
32
|
-
|
|
33
|
-
beforeEach(() => {
|
|
34
|
-
items = signal<readonly KjListItem<unknown>[]>([
|
|
35
|
-
fakeItem('1', 'Apple'),
|
|
36
|
-
fakeItem('2', 'Banana'),
|
|
37
|
-
fakeItem('3', 'Apricot'),
|
|
38
|
-
]);
|
|
39
|
-
query = signal('');
|
|
40
|
-
filterFn = signal<KjFilterFn>((q, hs) => {
|
|
41
|
-
if (!q) return 1;
|
|
42
|
-
const needle = q.toLowerCase();
|
|
43
|
-
return hs.some(h => h.toLowerCase().includes(needle)) ? 1 : 0;
|
|
44
|
-
});
|
|
45
|
-
shouldFilter = signal(true);
|
|
46
|
-
autoActivateFirst = signal(true);
|
|
47
|
-
|
|
48
|
-
TestBed.configureTestingModule({
|
|
49
|
-
providers: [KjFilterableList],
|
|
50
|
-
});
|
|
51
|
-
svc = TestBed.inject(KjFilterableList);
|
|
52
|
-
svc.bind({ items, query, filterFn, shouldFilter, autoActivateFirst });
|
|
53
|
-
TestBed.flushEffects();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('default substring filter — empty query returns all items', () => {
|
|
57
|
-
expect(svc.visibleItems().length).toBe(3);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
it('substring filter narrows results when query changes', () => {
|
|
61
|
-
query.set('ap');
|
|
62
|
-
TestBed.flushEffects();
|
|
63
|
-
expect(svc.visibleItems().map(i => i.id)).toEqual(['1', '3']);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
it('marks filtered-out items as not visible via setVisible(false)', () => {
|
|
67
|
-
query.set('ap');
|
|
68
|
-
TestBed.flushEffects();
|
|
69
|
-
const all = items();
|
|
70
|
-
expect(all[0].visible()).toBe(true); // Apple
|
|
71
|
-
expect(all[1].visible()).toBe(false); // Banana
|
|
72
|
-
expect(all[2].visible()).toBe(true); // Apricot
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('isEmpty signal flips on no-result query', () => {
|
|
76
|
-
expect(svc.isEmpty()).toBe(false);
|
|
77
|
-
query.set('zzz');
|
|
78
|
-
TestBed.flushEffects();
|
|
79
|
-
expect(svc.isEmpty()).toBe(true);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('shouldFilter=false bypasses filter and shows all', () => {
|
|
83
|
-
query.set('zzz');
|
|
84
|
-
shouldFilter.set(false);
|
|
85
|
-
TestBed.flushEffects();
|
|
86
|
-
expect(svc.visibleItems().length).toBe(3);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('custom filter fn applied when the bound signal updates', () => {
|
|
90
|
-
filterFn.set((q, hs) => hs.some(h => h.endsWith(q)) ? 1 : 0);
|
|
91
|
-
query.set('cot');
|
|
92
|
-
TestBed.flushEffects();
|
|
93
|
-
expect(svc.visibleItems().map(i => i.id)).toEqual(['3']);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('stamps posInSet/setSize on visible items, clears them on hidden items', () => {
|
|
97
|
-
query.set('ap');
|
|
98
|
-
TestBed.flushEffects();
|
|
99
|
-
const all = items();
|
|
100
|
-
expect(all[0].posInSet()).toBe(1);
|
|
101
|
-
expect(all[0].setSize()).toBe(2);
|
|
102
|
-
expect(all[1].posInSet()).toBeNull();
|
|
103
|
-
expect(all[2].posInSet()).toBe(2);
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
it('announcement signal returns "N results" / "No results"', () => {
|
|
107
|
-
query.set('ap');
|
|
108
|
-
TestBed.flushEffects();
|
|
109
|
-
expect(svc.announcement()).toBe('2 results');
|
|
110
|
-
query.set('zzz');
|
|
111
|
-
TestBed.flushEffects();
|
|
112
|
-
expect(svc.announcement()).toBe('No results');
|
|
113
|
-
});
|
|
114
|
-
});
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
// packages/core/src/primitives/list/filterable-list.ts
|
|
2
|
-
import { Injectable, type Signal, computed, effect, signal } from '@angular/core';
|
|
3
|
-
import type { KjFilterFn } from './tokens';
|
|
4
|
-
import type { KjListItem } from './item';
|
|
5
|
-
|
|
6
|
-
const defaultSubstring: KjFilterFn = (q, hs) => {
|
|
7
|
-
if (!q) return 1;
|
|
8
|
-
const needle = q.toLowerCase();
|
|
9
|
-
return hs.some(h => h.toLowerCase().includes(needle)) ? 1 : 0;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const EMPTY_ITEMS = signal<readonly KjListItem<unknown>[]>([]);
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Filter / search state for a list-style consumer (KjCombobox,
|
|
16
|
-
* KjCommandPalette). Reads its items source + filter inputs through
|
|
17
|
-
* {@link bind}, so no DI lookup is needed at construction (which sidesteps
|
|
18
|
-
* the cyclic dep that arises when the root provides itself under
|
|
19
|
-
* `KJ_LIST_NAVIGATOR_CONFIG` and `KjFilterableList` together).
|
|
20
|
-
*
|
|
21
|
-
* Side effects (via `effect`):
|
|
22
|
-
* - Calls `item.setVisible(bool)` on every item to reflect filter state.
|
|
23
|
-
* - Stamps `item.posInSet` / `item.setSize` for visible items; clears
|
|
24
|
-
* them to `null` for hidden items.
|
|
25
|
-
*
|
|
26
|
-
* Exposes `visibleItems`, `visibleCount`, `isEmpty`, plus a human
|
|
27
|
-
* `announcement()` signal consumers wire into a `kjLiveRegion` so
|
|
28
|
-
* WCAG 4.1.3 (Status Messages) is honored.
|
|
29
|
-
*
|
|
30
|
-
* @doc-category Core/Primitives
|
|
31
|
-
*/
|
|
32
|
-
@Injectable()
|
|
33
|
-
export class KjFilterableList<T = unknown> {
|
|
34
|
-
/**
|
|
35
|
-
* Source signals. Replaced wholesale by {@link bind} so the consumer's
|
|
36
|
-
* reactive inputs become the canonical state. `bind` MUST be called
|
|
37
|
-
* from the consumer's constructor, before any downstream consumer
|
|
38
|
-
* (e.g. KjListNavigator) subscribes to `visibleItems`.
|
|
39
|
-
*/
|
|
40
|
-
private _items: Signal<readonly KjListItem<T>[]> = EMPTY_ITEMS as Signal<readonly KjListItem<T>[]>;
|
|
41
|
-
private _query: Signal<string> = signal('');
|
|
42
|
-
private _filterFn: Signal<KjFilterFn> = signal(defaultSubstring);
|
|
43
|
-
private _shouldFilter: Signal<boolean> = signal(true);
|
|
44
|
-
private _autoActivateFirst: Signal<boolean> = signal(true);
|
|
45
|
-
|
|
46
|
-
/** Current query string. */
|
|
47
|
-
readonly query = () => this._query();
|
|
48
|
-
|
|
49
|
-
/** Items passing the current filter. */
|
|
50
|
-
readonly visibleItems = computed<readonly KjListItem<T>[]>(() => {
|
|
51
|
-
const all = this._items();
|
|
52
|
-
if (!this._shouldFilter()) return all;
|
|
53
|
-
const q = this._query();
|
|
54
|
-
const fn = this._filterFn();
|
|
55
|
-
return all.filter(i => fn(q, i.haystacks()) > 0);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
/** Count of visible items. */
|
|
59
|
-
readonly visibleCount = computed(() => this.visibleItems().length);
|
|
60
|
-
|
|
61
|
-
/** True when no items match the current filter. */
|
|
62
|
-
readonly isEmpty = computed(() => this.visibleCount() === 0);
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* Human-readable status string for `aria-live` regions.
|
|
66
|
-
* Returns `'N results'` or `'No results'`. Wire to `kjLiveRegion`
|
|
67
|
-
* to satisfy WCAG 4.1.3 Status Messages.
|
|
68
|
-
*/
|
|
69
|
-
readonly announcement = computed(() =>
|
|
70
|
-
this.isEmpty() ? 'No results' : `${this.visibleCount()} results`,
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* Read-only view of the auto-activate-first toggle. When `true`,
|
|
75
|
-
* consumers should activate the first visible item on each query change.
|
|
76
|
-
* This service does NOT activate items itself; the consumer reads it.
|
|
77
|
-
*/
|
|
78
|
-
readonly autoActivateFirst = () => this._autoActivateFirst();
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Bind consumer-owned source signals. Each is optional; unbound keys
|
|
82
|
-
* keep their previous source (defaulting to constants on first construct).
|
|
83
|
-
*
|
|
84
|
-
* Replaces the imperative setter-in-effect pattern when the consumer
|
|
85
|
-
* holds the canonical reactive state (typically a `model()` /
|
|
86
|
-
* `input()` / `contentChildren()`). Call once in the consumer's
|
|
87
|
-
* constructor before any downstream `computed` / `effect` subscribes
|
|
88
|
-
* to `visibleItems`.
|
|
89
|
-
*/
|
|
90
|
-
bind(sources: {
|
|
91
|
-
readonly items?: Signal<readonly KjListItem<T>[]>;
|
|
92
|
-
readonly query?: Signal<string>;
|
|
93
|
-
readonly filterFn?: Signal<KjFilterFn>;
|
|
94
|
-
readonly shouldFilter?: Signal<boolean>;
|
|
95
|
-
readonly autoActivateFirst?: Signal<boolean>;
|
|
96
|
-
}): void {
|
|
97
|
-
if (sources.items) this._items = sources.items;
|
|
98
|
-
if (sources.query) this._query = sources.query;
|
|
99
|
-
if (sources.filterFn) this._filterFn = sources.filterFn;
|
|
100
|
-
if (sources.shouldFilter) this._shouldFilter = sources.shouldFilter;
|
|
101
|
-
if (sources.autoActivateFirst) this._autoActivateFirst = sources.autoActivateFirst;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
constructor() {
|
|
105
|
-
// Toggle visibility + stamp posInSet/setSize on each item whenever
|
|
106
|
-
// the filtered visible set changes.
|
|
107
|
-
effect(() => {
|
|
108
|
-
const all = this._items();
|
|
109
|
-
const visible = this.visibleItems() as readonly KjListItem<unknown>[];
|
|
110
|
-
const visibleSet = new Set(visible.map(v => v.id));
|
|
111
|
-
const total = visible.length;
|
|
112
|
-
let i = 0;
|
|
113
|
-
for (const item of all) {
|
|
114
|
-
const isVisible = visibleSet.has(item.id);
|
|
115
|
-
item.setVisible(isVisible);
|
|
116
|
-
if (isVisible) {
|
|
117
|
-
item.posInSet.set(++i);
|
|
118
|
-
item.setSize.set(total);
|
|
119
|
-
} else {
|
|
120
|
-
item.posInSet.set(null);
|
|
121
|
-
item.setSize.set(null);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
// packages/core/src/primitives/list/group.spec.ts
|
|
2
|
-
import { By } from '@angular/platform-browser';
|
|
3
|
-
import { render } from '@testing-library/angular';
|
|
4
|
-
import { describe, it, expect } from 'vitest';
|
|
5
|
-
import { KjListGroup, KjListGroupLabel, KjListSeparator } from './group';
|
|
6
|
-
import { KjListItem } from './item';
|
|
7
|
-
|
|
8
|
-
describe('KjListGroup', () => {
|
|
9
|
-
it('sets role=group and a stable id on the host', async () => {
|
|
10
|
-
const { container } = await render(
|
|
11
|
-
`<div kjListGroup></div>`,
|
|
12
|
-
{ imports: [KjListGroup] },
|
|
13
|
-
);
|
|
14
|
-
const el = container.querySelector('[kjListGroup]')!;
|
|
15
|
-
expect(el.getAttribute('role')).toBe('group');
|
|
16
|
-
expect(el.id).toMatch(/^kj-list-group-\d+$/);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it('renders without aria-labelledby when no label is projected', async () => {
|
|
20
|
-
const { container } = await render(
|
|
21
|
-
`<div kjListGroup>
|
|
22
|
-
<div kjListItem [kjItemValue]="'a'">A</div>
|
|
23
|
-
</div>`,
|
|
24
|
-
{ imports: [KjListGroup, KjListItem] },
|
|
25
|
-
);
|
|
26
|
-
const el = container.querySelector('[kjListGroup]')!;
|
|
27
|
-
expect(el.hasAttribute('aria-labelledby')).toBe(false);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('wires aria-labelledby when a [kjListGroupLabel] child is present', async () => {
|
|
31
|
-
const { container } = await render(
|
|
32
|
-
`<div kjListGroup>
|
|
33
|
-
<div kjListGroupLabel>Fruits</div>
|
|
34
|
-
<div kjListItem [kjItemValue]="'a'">Apple</div>
|
|
35
|
-
</div>`,
|
|
36
|
-
{ imports: [KjListGroup, KjListGroupLabel, KjListItem] },
|
|
37
|
-
);
|
|
38
|
-
const group = container.querySelector('[kjListGroup]')!;
|
|
39
|
-
const label = container.querySelector('[kjListGroupLabel]')!;
|
|
40
|
-
expect(label.id).toMatch(/^kj-list-group-label-\d+$/);
|
|
41
|
-
expect(group.getAttribute('aria-labelledby')).toBe(label.id);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('is visible when items are visible', async () => {
|
|
45
|
-
const { container } = await render(
|
|
46
|
-
`<div kjListGroup>
|
|
47
|
-
<div kjListItem [kjItemValue]="'a'">A</div>
|
|
48
|
-
<div kjListItem [kjItemValue]="'b'">B</div>
|
|
49
|
-
</div>`,
|
|
50
|
-
{ imports: [KjListGroup, KjListItem] },
|
|
51
|
-
);
|
|
52
|
-
expect(container.querySelector('[kjListGroup]')!.hasAttribute('hidden')).toBe(false);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('auto-hides when every projected item is filter-hidden', async () => {
|
|
56
|
-
const { container, fixture } = await render(
|
|
57
|
-
`<div kjListGroup>
|
|
58
|
-
<div kjListItem [kjItemValue]="'a'">A</div>
|
|
59
|
-
<div kjListItem [kjItemValue]="'b'">B</div>
|
|
60
|
-
</div>`,
|
|
61
|
-
{ imports: [KjListGroup, KjListItem] },
|
|
62
|
-
);
|
|
63
|
-
const items = fixture.debugElement
|
|
64
|
-
.queryAll(By.directive(KjListItem))
|
|
65
|
-
.map(d => d.injector.get(KjListItem));
|
|
66
|
-
expect(items.length).toBe(2);
|
|
67
|
-
items.forEach(i => i.setVisible(false));
|
|
68
|
-
fixture.detectChanges();
|
|
69
|
-
expect(container.querySelector('[kjListGroup]')!.hasAttribute('hidden')).toBe(true);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
it('stays visible when at least one item is still visible', async () => {
|
|
73
|
-
const { container, fixture } = await render(
|
|
74
|
-
`<div kjListGroup>
|
|
75
|
-
<div kjListItem [kjItemValue]="'a'">A</div>
|
|
76
|
-
<div kjListItem [kjItemValue]="'b'">B</div>
|
|
77
|
-
</div>`,
|
|
78
|
-
{ imports: [KjListGroup, KjListItem] },
|
|
79
|
-
);
|
|
80
|
-
const items = fixture.debugElement
|
|
81
|
-
.queryAll(By.directive(KjListItem))
|
|
82
|
-
.map(d => d.injector.get(KjListItem));
|
|
83
|
-
items[0].setVisible(false);
|
|
84
|
-
fixture.detectChanges();
|
|
85
|
-
expect(container.querySelector('[kjListGroup]')!.hasAttribute('hidden')).toBe(false);
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
describe('KjListSeparator', () => {
|
|
90
|
-
it('renders with role=separator and aria-orientation=horizontal', async () => {
|
|
91
|
-
const { container } = await render(
|
|
92
|
-
`<hr kjListSeparator />`,
|
|
93
|
-
{ imports: [KjListSeparator] },
|
|
94
|
-
);
|
|
95
|
-
const el = container.querySelector('[kjListSeparator]')!;
|
|
96
|
-
expect(el.getAttribute('role')).toBe('separator');
|
|
97
|
-
expect(el.getAttribute('aria-orientation')).toBe('horizontal');
|
|
98
|
-
});
|
|
99
|
-
});
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
// packages/core/src/primitives/list/group.ts
|
|
2
|
-
import {
|
|
3
|
-
Directive,
|
|
4
|
-
computed,
|
|
5
|
-
contentChildren,
|
|
6
|
-
effect,
|
|
7
|
-
inject,
|
|
8
|
-
input,
|
|
9
|
-
signal,
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import { KjListItem } from './item';
|
|
12
|
-
|
|
13
|
-
let _groupId = 0;
|
|
14
|
-
let _labelId = 0;
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Wraps a subset of `KjListItem`s inside a list-style container
|
|
18
|
-
* (listbox / menu / tree). Sets `role="group"` and auto-hides itself
|
|
19
|
-
* when every child item is filter-hidden — so the section header (and
|
|
20
|
-
* any visual chrome it provides) disappears with its options instead
|
|
21
|
-
* of leaving an empty gap.
|
|
22
|
-
*
|
|
23
|
-
* Pair with `[kjListGroupLabel]` on a heading element inside the group
|
|
24
|
-
* to wire `aria-labelledby` for screen readers.
|
|
25
|
-
*
|
|
26
|
-
* Items inside groups remain visible to the parent root's
|
|
27
|
-
* `contentChildren(KjListItem, { descendants: true })` query, so the
|
|
28
|
-
* navigator and filter primitives see them unchanged.
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```html
|
|
32
|
-
* <kj-select-content>
|
|
33
|
-
* <div kjListGroup>
|
|
34
|
-
* <div kjListGroupLabel>Fruits</div>
|
|
35
|
-
* <div kjOption [kjOptionValue]="'apple'">Apple</div>
|
|
36
|
-
* <div kjOption [kjOptionValue]="'banana'">Banana</div>
|
|
37
|
-
* </div>
|
|
38
|
-
* <hr kjListSeparator />
|
|
39
|
-
* <div kjListGroup>
|
|
40
|
-
* <div kjListGroupLabel>Vegetables</div>
|
|
41
|
-
* <div kjOption [kjOptionValue]="'carrot'">Carrot</div>
|
|
42
|
-
* </div>
|
|
43
|
-
* </kj-select-content>
|
|
44
|
-
* ```
|
|
45
|
-
*
|
|
46
|
-
* @doc-category Core/Primitives
|
|
47
|
-
*/
|
|
48
|
-
@Directive({
|
|
49
|
-
selector: '[kjListGroup]',
|
|
50
|
-
exportAs: 'kjListGroup',
|
|
51
|
-
standalone: true,
|
|
52
|
-
host: {
|
|
53
|
-
'role': 'group',
|
|
54
|
-
'[attr.id]': 'id()',
|
|
55
|
-
'[attr.aria-labelledby]': 'labelId()',
|
|
56
|
-
'[hidden]': 'isHidden()',
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
export class KjListGroup {
|
|
60
|
-
/** Optional override id. Falls back to a generated `kj-list-group-N`. */
|
|
61
|
-
readonly kjId = input<string>('');
|
|
62
|
-
|
|
63
|
-
private readonly _fallbackId = `kj-list-group-${++_groupId}`;
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* Resolved id used by the host `id` attribute and as the target of any
|
|
67
|
-
* child label's `aria-labelledby`. Reactively follows `kjId` when set.
|
|
68
|
-
*/
|
|
69
|
-
readonly id = computed(() => this.kjId() || this._fallbackId);
|
|
70
|
-
|
|
71
|
-
/** Items directly under this group. Source of truth for auto-hide. */
|
|
72
|
-
readonly items = contentChildren(KjListItem, { descendants: true });
|
|
73
|
-
|
|
74
|
-
private readonly _labelId = signal<string | null>(null);
|
|
75
|
-
/** id of the `[kjListGroupLabel]` child (if any), bound to `aria-labelledby`. */
|
|
76
|
-
readonly labelId = this._labelId.asReadonly();
|
|
77
|
-
|
|
78
|
-
/** @internal — registered by a `[kjListGroupLabel]` child. */
|
|
79
|
-
setLabelId(id: string | null): void { this._labelId.set(id); }
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Hidden when the group has items AND every item is filter-hidden.
|
|
83
|
-
* An empty group (no projected items) is treated as visible — the
|
|
84
|
-
* consumer may be loading content async.
|
|
85
|
-
*/
|
|
86
|
-
readonly isHidden = computed(() => {
|
|
87
|
-
const items = this.items();
|
|
88
|
-
if (items.length === 0) return false;
|
|
89
|
-
return items.every(i => !i.visible());
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
/**
|
|
94
|
-
* Heading inside a `[kjListGroup]`. Mints a stable id and registers it
|
|
95
|
-
* with the surrounding group so the wrapper picks it up via
|
|
96
|
-
* `aria-labelledby`. The host `id` attribute is bound from the resolved
|
|
97
|
-
* id — write `id="my-id"` on the element to override.
|
|
98
|
-
*
|
|
99
|
-
* @doc-category Core/Primitives
|
|
100
|
-
*/
|
|
101
|
-
@Directive({
|
|
102
|
-
selector: '[kjListGroupLabel]',
|
|
103
|
-
exportAs: 'kjListGroupLabel',
|
|
104
|
-
standalone: true,
|
|
105
|
-
host: {
|
|
106
|
-
'[attr.id]': 'id()',
|
|
107
|
-
},
|
|
108
|
-
})
|
|
109
|
-
export class KjListGroupLabel {
|
|
110
|
-
/** Optional override id. Falls back to a generated `kj-list-group-label-N`. */
|
|
111
|
-
readonly kjId = input<string>('');
|
|
112
|
-
|
|
113
|
-
private readonly _fallbackId = `kj-list-group-label-${++_labelId}`;
|
|
114
|
-
|
|
115
|
-
/** Resolved id used by the host `id` attribute and by the parent group. */
|
|
116
|
-
readonly id = computed(() => this.kjId() || this._fallbackId);
|
|
117
|
-
|
|
118
|
-
private readonly group = inject(KjListGroup);
|
|
119
|
-
|
|
120
|
-
constructor() {
|
|
121
|
-
effect(() => this.group.setLabelId(this.id()));
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
/**
|
|
126
|
-
* Visual divider between groups (or arbitrary items). Non-interactive.
|
|
127
|
-
* Sets `role="separator"` + `aria-orientation="horizontal"` per ARIA.
|
|
128
|
-
*
|
|
129
|
-
* @doc-category Core/Primitives
|
|
130
|
-
*/
|
|
131
|
-
@Directive({
|
|
132
|
-
selector: '[kjListSeparator]',
|
|
133
|
-
standalone: true,
|
|
134
|
-
host: {
|
|
135
|
-
'role': 'separator',
|
|
136
|
-
'aria-orientation': 'horizontal',
|
|
137
|
-
},
|
|
138
|
-
})
|
|
139
|
-
export class KjListSeparator {}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './tokens';
|
|
2
|
-
export { KjListItem } from './item';
|
|
3
|
-
export { KjListNavigator } from './navigator';
|
|
4
|
-
export { KjSelectionModel } from './selection';
|
|
5
|
-
export { KjFilterableList } from './filterable-list';
|
|
6
|
-
export { KjTypeAhead } from './type-ahead';
|
|
7
|
-
export { KjListGroup, KjListGroupLabel, KjListSeparator } from './group';
|
|
8
|
-
export { injectListItem, injectSelectionModel, injectFilterableList } from './inject-helpers';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { inject } from '@angular/core';
|
|
2
|
-
import { KjListItem } from './item';
|
|
3
|
-
import { KjSelectionModel } from './selection';
|
|
4
|
-
import { KjFilterableList } from './filterable-list';
|
|
5
|
-
|
|
6
|
-
export const injectListItem = <T>() => inject(KjListItem) as KjListItem<T>;
|
|
7
|
-
export const injectSelectionModel = <T>() => inject(KjSelectionModel) as KjSelectionModel<T>;
|
|
8
|
-
export const injectFilterableList = <T>() => inject(KjFilterableList) as KjFilterableList<T>;
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { By } from '@angular/platform-browser';
|
|
3
|
-
import { render } from '@testing-library/angular';
|
|
4
|
-
import { axe, toHaveNoViolations } from 'jest-axe';
|
|
5
|
-
import { describe, it, expect } from 'vitest';
|
|
6
|
-
import { KjListItem } from './item';
|
|
7
|
-
|
|
8
|
-
expect.extend(toHaveNoViolations);
|
|
9
|
-
|
|
10
|
-
describe('KjListItem', () => {
|
|
11
|
-
it('mints a stable id at construction (no afterNextRender race)', async () => {
|
|
12
|
-
const { container } = await render(
|
|
13
|
-
`<div role="option" aria-selected="false" kjListItem [kjItemValue]="'a'">A</div>`,
|
|
14
|
-
{ imports: [KjListItem] },
|
|
15
|
-
);
|
|
16
|
-
const el = container.querySelector('[kjListItem]')!;
|
|
17
|
-
expect(el.id).toMatch(/^kj-list-item-\d+$/);
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('respects existing host id attribute over the auto-generated id', async () => {
|
|
21
|
-
const { container } = await render(
|
|
22
|
-
`<div role="option" id="markup-id" kjListItem [kjItemValue]="'a'">A</div>`,
|
|
23
|
-
{ imports: [KjListItem] },
|
|
24
|
-
);
|
|
25
|
-
expect(container.querySelector('[kjListItem]')!.id).toBe('markup-id');
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('reflects aria-disabled from composed KjDisabled', async () => {
|
|
29
|
-
const { container } = await render(
|
|
30
|
-
`<div role="option" aria-selected="false" kjListItem [kjDisabled]="true" [kjItemValue]="'a'">A</div>`,
|
|
31
|
-
{ imports: [KjListItem] },
|
|
32
|
-
);
|
|
33
|
-
expect(container.querySelector('[kjListItem]')!.getAttribute('aria-disabled')).toBe('true');
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('omits aria-selected when no KjSelectionModel is provided', async () => {
|
|
37
|
-
const { container } = await render(
|
|
38
|
-
`<div role="option" aria-selected="false" kjListItem [kjItemValue]="'a'">A</div>`,
|
|
39
|
-
{ imports: [KjListItem] },
|
|
40
|
-
);
|
|
41
|
-
expect(container.querySelector('[kjListItem]')!.hasAttribute('aria-selected')).toBe(false);
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('binds aria-checked from KjSelectionModel.cascadeState when mode is cascade', async () => {
|
|
45
|
-
const { KjSelectionModel } = await import('./selection');
|
|
46
|
-
const { KJ_LIST_NAVIGATOR_CONFIG } = await import('./tokens');
|
|
47
|
-
const { signal } = await import('@angular/core');
|
|
48
|
-
const value = signal<unknown | readonly unknown[] | null>(null);
|
|
49
|
-
const { container, fixture } = await render(
|
|
50
|
-
`<div role="treeitem" kjListItem [kjItemValue]="'A1'">A1</div>`,
|
|
51
|
-
{
|
|
52
|
-
imports: [KjListItem],
|
|
53
|
-
providers: [
|
|
54
|
-
KjSelectionModel,
|
|
55
|
-
{ provide: KJ_LIST_NAVIGATOR_CONFIG, useValue: { items: signal([]), value } },
|
|
56
|
-
],
|
|
57
|
-
},
|
|
58
|
-
);
|
|
59
|
-
const m = fixture.debugElement.injector.get(KjSelectionModel);
|
|
60
|
-
m.setMode('cascade');
|
|
61
|
-
m.setTreeShape({
|
|
62
|
-
getParent: () => null,
|
|
63
|
-
getChildren: () => [],
|
|
64
|
-
isLeaf: () => true,
|
|
65
|
-
});
|
|
66
|
-
fixture.detectChanges();
|
|
67
|
-
const el = container.querySelector('[kjListItem]')!;
|
|
68
|
-
expect(el.getAttribute('aria-checked')).toBe('false');
|
|
69
|
-
expect(el.hasAttribute('aria-selected')).toBe(false);
|
|
70
|
-
m.toggle('A1' as unknown as never);
|
|
71
|
-
fixture.detectChanges();
|
|
72
|
-
expect(el.getAttribute('aria-checked')).toBe('true');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
it('emits activate on click with the value', async () => {
|
|
76
|
-
@Component({
|
|
77
|
-
standalone: true,
|
|
78
|
-
imports: [KjListItem],
|
|
79
|
-
template: `<div role="option" aria-selected="false" kjListItem [kjItemValue]="'apple'" (activate)="last = $event">A</div>`,
|
|
80
|
-
})
|
|
81
|
-
class Host { last: unknown = null; }
|
|
82
|
-
const { container, fixture } = await render(Host);
|
|
83
|
-
(container.querySelector('[kjListItem]') as HTMLElement).click();
|
|
84
|
-
expect(fixture.componentInstance.last).toBe('apple');
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
it('does NOT emit activate when disabled', async () => {
|
|
88
|
-
@Component({
|
|
89
|
-
standalone: true,
|
|
90
|
-
imports: [KjListItem],
|
|
91
|
-
template: `<div role="option" aria-selected="false" kjListItem [kjDisabled]="true" [kjItemValue]="'apple'" (activate)="fired = true">A</div>`,
|
|
92
|
-
})
|
|
93
|
-
class Host { fired = false; }
|
|
94
|
-
const { container, fixture } = await render(Host);
|
|
95
|
-
(container.querySelector('[kjListItem]') as HTMLElement).click();
|
|
96
|
-
expect(fixture.componentInstance.fired).toBe(false);
|
|
97
|
-
});
|
|
98
|
-
|
|
99
|
-
it('responds to Enter and Space', async () => {
|
|
100
|
-
@Component({
|
|
101
|
-
standalone: true,
|
|
102
|
-
imports: [KjListItem],
|
|
103
|
-
template: `<div role="option" aria-selected="false" kjListItem [kjItemValue]="'a'" (activate)="count = count + 1">A</div>`,
|
|
104
|
-
})
|
|
105
|
-
class Host { count = 0; }
|
|
106
|
-
const { container, fixture } = await render(Host);
|
|
107
|
-
const el = container.querySelector('[kjListItem]') as HTMLElement;
|
|
108
|
-
el.dispatchEvent(new KeyboardEvent('keydown', { key: 'Enter', bubbles: true }));
|
|
109
|
-
el.dispatchEvent(new KeyboardEvent('keydown', { key: ' ', bubbles: true }));
|
|
110
|
-
expect(fixture.componentInstance.count).toBe(2);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
it('exposes label fallback from text content when kjItemLabel is empty', async () => {
|
|
114
|
-
@Component({
|
|
115
|
-
standalone: true,
|
|
116
|
-
imports: [KjListItem],
|
|
117
|
-
template: `<div role="option" aria-selected="false" kjListItem #i="kjListItem" [kjItemValue]="'a'"> Apple </div>
|
|
118
|
-
<span data-test>{{ i.label() }}</span>`,
|
|
119
|
-
})
|
|
120
|
-
class Host {}
|
|
121
|
-
const { container } = await render(Host);
|
|
122
|
-
expect(container.querySelector('[data-test]')!.textContent).toBe('Apple');
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
it('hides element via [hidden] when setVisible(false)', async () => {
|
|
126
|
-
@Component({
|
|
127
|
-
standalone: true,
|
|
128
|
-
imports: [KjListItem],
|
|
129
|
-
template: `<div role="option" aria-selected="false" kjListItem [kjItemValue]="'a'">A</div>`,
|
|
130
|
-
})
|
|
131
|
-
class Host {}
|
|
132
|
-
const { container, fixture } = await render(Host);
|
|
133
|
-
const item = fixture.debugElement.query(By.directive(KjListItem)).injector.get(KjListItem);
|
|
134
|
-
item.setVisible(false);
|
|
135
|
-
fixture.detectChanges();
|
|
136
|
-
expect(container.querySelector('[kjListItem]')!.hasAttribute('hidden')).toBe(true);
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
it('binds aria-keyshortcuts when kjShortcut is set', async () => {
|
|
140
|
-
const { container } = await render(
|
|
141
|
-
`<div role="option" aria-selected="false" kjListItem [kjItemValue]="'a'" [kjShortcut]="'Mod+P'">A</div>`,
|
|
142
|
-
{ imports: [KjListItem] },
|
|
143
|
-
);
|
|
144
|
-
expect(container.querySelector('[kjListItem]')!.getAttribute('aria-keyshortcuts')).toBe('Mod+P');
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
it('binds aria-posinset and aria-setsize from posInSet/setSize signals', async () => {
|
|
148
|
-
@Component({
|
|
149
|
-
standalone: true,
|
|
150
|
-
imports: [KjListItem],
|
|
151
|
-
template: `<div role="option" aria-selected="false" kjListItem #i="kjListItem" [kjItemValue]="'a'">A</div>`,
|
|
152
|
-
})
|
|
153
|
-
class Host {}
|
|
154
|
-
const { container, fixture } = await render(Host);
|
|
155
|
-
const item = fixture.debugElement.query(By.directive(KjListItem)).injector.get(KjListItem);
|
|
156
|
-
item.posInSet.set(2);
|
|
157
|
-
item.setSize.set(5);
|
|
158
|
-
fixture.detectChanges();
|
|
159
|
-
const el = container.querySelector('[kjListItem]')!;
|
|
160
|
-
expect(el.getAttribute('aria-posinset')).toBe('2');
|
|
161
|
-
expect(el.getAttribute('aria-setsize')).toBe('5');
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
it('passes axe accessibility audit', async () => {
|
|
165
|
-
const { container } = await render(
|
|
166
|
-
`<ul role="listbox" aria-label="Options">
|
|
167
|
-
<li role="option" aria-selected="false" kjListItem [kjItemValue]="'a'">A</li>
|
|
168
|
-
</ul>`,
|
|
169
|
-
{ imports: [KjListItem] },
|
|
170
|
-
);
|
|
171
|
-
expect(await axe(container)).toHaveNoViolations();
|
|
172
|
-
});
|
|
173
|
-
});
|