@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/toast/toast.ts
DELETED
|
@@ -1,463 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy, Component, DestroyRef, Directive, ElementRef, TemplateRef, ViewEncapsulation,
|
|
3
|
-
afterNextRender, booleanAttribute, computed, inject, input, signal,
|
|
4
|
-
} from '@angular/core';
|
|
5
|
-
import { KjOverlayPanel } from '../primitives/overlay/panel';
|
|
6
|
-
import { KjToastService, KjToastTemplateContext, KjToastVariant } from './toast.service';
|
|
7
|
-
import { KJ_TOAST_STRATEGY } from './toast.strategy';
|
|
8
|
-
import { KjToastPositionX, KjToastPositionY } from './toast.types';
|
|
9
|
-
|
|
10
|
-
export type { KjToastVariant, KjToastContext, KjToastOptions } from './toast.service';
|
|
11
|
-
export type { KjToastPositionX, KjToastPositionY } from './toast.types';
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Marks an element as a single toast item. Sets `role`, `aria-atomic`, `data-variant`,
|
|
15
|
-
* `data-front`, and exposes positional state as CSS custom properties so client CSS
|
|
16
|
-
* can drive stacking, scaling, or spread-out animations.
|
|
17
|
-
*
|
|
18
|
-
* **CSS variables exposed (when `[kjToastId]` is bound):**
|
|
19
|
-
* - `--kj-toast-index` — 1-based position from the front (newest = 1)
|
|
20
|
-
* - `--kj-toast-before` — number of toasts behind this one
|
|
21
|
-
* - `--kj-toast-after` — number of toasts in front of this one
|
|
22
|
-
* - `--kj-toast-height` — measured pixel height (kept in sync via ResizeObserver)
|
|
23
|
-
*
|
|
24
|
-
* @doc
|
|
25
|
-
* @doc-example Basic
|
|
26
|
-
* @doc-theme default
|
|
27
|
-
* @doc-file toast.example.ts
|
|
28
|
-
* @doc-theme retro
|
|
29
|
-
* @doc-file toast.retro.example.ts
|
|
30
|
-
* @doc-theme finance
|
|
31
|
-
* @doc-file toast.finance.example.ts
|
|
32
|
-
*
|
|
33
|
-
* @example
|
|
34
|
-
* ```html
|
|
35
|
-
* <ng-template #defaultTpl let-ctx>
|
|
36
|
-
* <div kjToast [kjToastVariant]="ctx.variant" [kjToastId]="ctx.id">
|
|
37
|
-
* <span>{{ ctx.message }}</span>
|
|
38
|
-
* <button (click)="ctx.dismiss()" aria-label="Dismiss">×</button>
|
|
39
|
-
* </div>
|
|
40
|
-
* </ng-template>
|
|
41
|
-
* ```
|
|
42
|
-
* @doc-category Core/Overlay
|
|
43
|
-
*/
|
|
44
|
-
@Directive({
|
|
45
|
-
selector: '[kjToast]',
|
|
46
|
-
standalone: true,
|
|
47
|
-
host: {
|
|
48
|
-
'[attr.role]': 'role()',
|
|
49
|
-
'[attr.aria-atomic]': '"true"',
|
|
50
|
-
'[attr.data-variant]': 'kjToastVariant()',
|
|
51
|
-
'[attr.data-front]': 'isFront()',
|
|
52
|
-
'[attr.data-toast-id]': 'kjToastId()',
|
|
53
|
-
'[style.--kj-toast-index]': 'index()',
|
|
54
|
-
'[style.--kj-toast-before]': 'before()',
|
|
55
|
-
'[style.--kj-toast-after]': 'after()',
|
|
56
|
-
'[style.--kj-toast-height]': 'heightPx()',
|
|
57
|
-
},
|
|
58
|
-
})
|
|
59
|
-
export class KjToast {
|
|
60
|
-
/** Visual / semantic variant. Defaults to `'default'`. */
|
|
61
|
-
kjToastVariant = input<KjToastVariant>('default');
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* The toast id this element renders. Bind from the template context (`ctx.id`)
|
|
65
|
-
* so the directive can compute its position in the live queue and expose
|
|
66
|
-
* `--kj-toast-index`, `--kj-toast-before`, `--kj-toast-after`, and `data-front`.
|
|
67
|
-
* Optional — without it, the toast still renders with role/variant only.
|
|
68
|
-
*/
|
|
69
|
-
kjToastId = input<string | null>(null);
|
|
70
|
-
|
|
71
|
-
private readonly svc = inject(KjToastService);
|
|
72
|
-
private readonly el = inject(ElementRef<HTMLElement>);
|
|
73
|
-
private readonly destroyRef = inject(DestroyRef);
|
|
74
|
-
private readonly _height = signal<number>(0);
|
|
75
|
-
|
|
76
|
-
readonly role = computed(() =>
|
|
77
|
-
this.kjToastVariant() === 'destructive' ? 'alert' : 'status',
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
/** 1-based position from the front (1 = newest). `null` when no id is bound. */
|
|
81
|
-
readonly index = computed<number | null>(() => {
|
|
82
|
-
const id = this.kjToastId();
|
|
83
|
-
if (!id) return null;
|
|
84
|
-
const list = this.svc.toasts();
|
|
85
|
-
const i = list.findIndex(t => t.id === id);
|
|
86
|
-
return i >= 0 ? list.length - i : null;
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
/** Toasts older than this one (behind in the stack). */
|
|
90
|
-
readonly before = computed<number | null>(() => {
|
|
91
|
-
const idx = this.index();
|
|
92
|
-
return idx == null ? null : idx - 1;
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
/** Toasts newer than this one (in front of it). */
|
|
96
|
-
readonly after = computed<number | null>(() => {
|
|
97
|
-
const idx = this.index();
|
|
98
|
-
if (idx == null) return null;
|
|
99
|
-
return this.svc.toasts().length - idx;
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
/** True when this is the front-most (newest) toast. */
|
|
103
|
-
readonly isFront = computed(() => this.index() === 1);
|
|
104
|
-
|
|
105
|
-
/** Measured height as a pixel string (`"42px"`). Empty when unmeasured. */
|
|
106
|
-
readonly heightPx = computed(() => {
|
|
107
|
-
const h = this._height();
|
|
108
|
-
return h > 0 ? `${h}px` : '';
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
constructor() {
|
|
112
|
-
afterNextRender(() => {
|
|
113
|
-
const node = this.el.nativeElement;
|
|
114
|
-
const measure = () => this._height.set(Math.round(node.getBoundingClientRect().height));
|
|
115
|
-
measure();
|
|
116
|
-
// Use border-box geometry via getBoundingClientRect — contentRect strips padding.
|
|
117
|
-
// Guard ResizeObserver for SSR / older test environments.
|
|
118
|
-
if (typeof ResizeObserver !== 'undefined') {
|
|
119
|
-
const ro = new ResizeObserver(measure);
|
|
120
|
-
ro.observe(node);
|
|
121
|
-
this.destroyRef.onDestroy(() => ro.disconnect());
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/** Per-toast renderable: the resolved template + the bound context to render with. */
|
|
128
|
-
export interface KjToastRenderable<TData = unknown> {
|
|
129
|
-
readonly id: string;
|
|
130
|
-
readonly template: TemplateRef<KjToastTemplateContext<TData>> | null;
|
|
131
|
-
readonly context: KjToastTemplateContext<TData>;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
* Container for active toasts. Reads the queue from `KjToastService`, applies
|
|
136
|
-
* a visibility cap (`kjToastMaxVisible`), and exposes layout state both as
|
|
137
|
-
* inputs-driven CSS variables and `data-position-x` / `data-position-y`
|
|
138
|
-
* attributes so client CSS can drive position, gap, stacking strategy, and
|
|
139
|
-
* z-index.
|
|
140
|
-
*
|
|
141
|
-
* **CSS variables exposed on the host:**
|
|
142
|
-
* - `--kj-toast-gap` — gap between stacked toasts
|
|
143
|
-
* - `--kj-toast-z-index` — base z-index for toasts
|
|
144
|
-
* - `--kj-toasts-count` — number of currently-rendered toasts
|
|
145
|
-
* - `--kj-toast-front-height` — measured height of the front-most toast
|
|
146
|
-
*
|
|
147
|
-
* **Data attributes:**
|
|
148
|
-
* - `data-position-x="start|center|end"`
|
|
149
|
-
* - `data-position-y="top|bottom"`
|
|
150
|
-
* - `data-expanded="true|false"`
|
|
151
|
-
*
|
|
152
|
-
* @example
|
|
153
|
-
* ```html
|
|
154
|
-
* <ol kjToastViewport
|
|
155
|
-
* [kjToastDefaultTemplate]="defaultTpl"
|
|
156
|
-
* [kjToastMaxVisible]="3"
|
|
157
|
-
* [kjToastGap]="8"
|
|
158
|
-
* kjToastPositionX="end"
|
|
159
|
-
* kjToastPositionY="bottom"
|
|
160
|
-
* #vp="kjToastViewport"
|
|
161
|
-
* aria-label="Notifications">
|
|
162
|
-
* @for (r of vp.renderable(); track r.id) {
|
|
163
|
-
* <li><ng-container *ngTemplateOutlet="r.template; context: { $implicit: r.context }" /></li>
|
|
164
|
-
* }
|
|
165
|
-
* </ol>
|
|
166
|
-
* ```
|
|
167
|
-
* @doc-category Core/Overlay
|
|
168
|
-
*/
|
|
169
|
-
@Directive({
|
|
170
|
-
selector: '[kjToastViewport]',
|
|
171
|
-
standalone: true,
|
|
172
|
-
exportAs: 'kjToastViewport',
|
|
173
|
-
host: {
|
|
174
|
-
'role': 'region',
|
|
175
|
-
'tabindex': '-1',
|
|
176
|
-
'[attr.aria-live]': '"polite"',
|
|
177
|
-
'[attr.aria-atomic]': '"false"',
|
|
178
|
-
'[attr.aria-relevant]': '"additions removals"',
|
|
179
|
-
'[attr.data-position-x]': 'kjToastPositionX()',
|
|
180
|
-
'[attr.data-position-y]': 'kjToastPositionY()',
|
|
181
|
-
'[attr.data-expanded]': 'expanded()',
|
|
182
|
-
'[style.--kj-toast-gap]': 'gapPx()',
|
|
183
|
-
'[style.--kj-toast-z-index]': 'kjToastBaseZIndex()',
|
|
184
|
-
'[style.--kj-toasts-count]': 'renderable().length',
|
|
185
|
-
'[style.--kj-toast-front-height]': 'frontHeightPx()',
|
|
186
|
-
'(mouseenter)': 'onPointerEnter()',
|
|
187
|
-
'(mouseleave)': 'onPointerLeave()',
|
|
188
|
-
'(focusin)': 'onFocusIn($event)',
|
|
189
|
-
'(focusout)': 'onFocusOut($event)',
|
|
190
|
-
},
|
|
191
|
-
})
|
|
192
|
-
export class KjToastViewport {
|
|
193
|
-
private readonly svc = inject(KjToastService);
|
|
194
|
-
private readonly el = inject(ElementRef<HTMLElement>);
|
|
195
|
-
private readonly destroyRef = inject(DestroyRef);
|
|
196
|
-
private readonly strategy = inject(KJ_TOAST_STRATEGY);
|
|
197
|
-
|
|
198
|
-
/** Default template used for string-based toasts. Per-call templates override this. */
|
|
199
|
-
readonly kjToastDefaultTemplate = input<TemplateRef<KjToastTemplateContext> | null>(null);
|
|
200
|
-
|
|
201
|
-
/** Cap on simultaneously-rendered toasts. Excess stays queued and surfaces as space frees. Defaults from the active `KjToastStrategy`. */
|
|
202
|
-
readonly kjToastMaxVisible = input<number>(this.strategy.maxVisible);
|
|
203
|
-
|
|
204
|
-
/** Pixel gap between stacked toasts — exposed as `--kj-toast-gap`. Defaults from the active `KjToastStrategy`. */
|
|
205
|
-
readonly kjToastGap = input<number>(this.strategy.gap);
|
|
206
|
-
|
|
207
|
-
/** Base `z-index` exposed as `--kj-toast-z-index`. Defaults from the active `KjToastStrategy`. */
|
|
208
|
-
readonly kjToastBaseZIndex = input<number>(this.strategy.baseZIndex);
|
|
209
|
-
|
|
210
|
-
/** Horizontal anchor — written as `data-position-x` for client CSS. Defaults from the active `KjToastStrategy`. */
|
|
211
|
-
readonly kjToastPositionX = input<KjToastPositionX>(this.strategy.positionX);
|
|
212
|
-
|
|
213
|
-
/** Vertical anchor — written as `data-position-y` for client CSS. Defaults from the active `KjToastStrategy`. */
|
|
214
|
-
readonly kjToastPositionY = input<KjToastPositionY>(this.strategy.positionY);
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Manual override for the spread-out state. When unset (`undefined`) and the active
|
|
218
|
-
* strategy has `expandOnHover: true`, the viewport flips automatically on hover/focus.
|
|
219
|
-
* Set explicitly to force one state or to drive expansion from custom logic.
|
|
220
|
-
*/
|
|
221
|
-
readonly kjToastExpand = input<boolean | undefined>(undefined);
|
|
222
|
-
|
|
223
|
-
/**
|
|
224
|
-
* When `true` (default), hover/focus on the viewport pauses every in-flight
|
|
225
|
-
* auto-dismiss timer via `KjToastService.pause('hover'|'focus')`. Required
|
|
226
|
-
* for WCAG 2.2.1 (AAA) and 1.4.13. Distinct from visual stacking expansion
|
|
227
|
-
* (`kjToastExpand` / `strategy.expandOnHover`). Defaults from the active
|
|
228
|
-
* `KjToastStrategy.pauseOnHover`.
|
|
229
|
-
*/
|
|
230
|
-
readonly kjToastPauseOnHover = input<boolean, unknown>(this.strategy.pauseOnHover, {
|
|
231
|
-
transform: booleanAttribute,
|
|
232
|
-
});
|
|
233
|
-
|
|
234
|
-
private readonly _hovered = signal(false);
|
|
235
|
-
/** Tracks pointer-driven pause state so resume() runs exactly once per enter/leave pair. */
|
|
236
|
-
private pointerPauseHeld = false;
|
|
237
|
-
/** Tracks focus-driven pause state — independent ref so blur after re-enter doesn't double-resume. */
|
|
238
|
-
private focusPauseHeld = false;
|
|
239
|
-
/** Element to restore focus to when F6/Escape leaves the viewport. */
|
|
240
|
-
private previouslyFocused: HTMLElement | null = null;
|
|
241
|
-
|
|
242
|
-
/** Resolved expand state — explicit input wins; otherwise falls back to hover when the strategy enables it. */
|
|
243
|
-
readonly expanded = computed(() => {
|
|
244
|
-
const override = this.kjToastExpand();
|
|
245
|
-
if (override !== undefined) return override;
|
|
246
|
-
return this.strategy.expandOnHover && this._hovered();
|
|
247
|
-
});
|
|
248
|
-
|
|
249
|
-
protected onPointerEnter(): void {
|
|
250
|
-
if (this.strategy.expandOnHover) this._hovered.set(true);
|
|
251
|
-
if (this.kjToastPauseOnHover() && !this.pointerPauseHeld) {
|
|
252
|
-
this.pointerPauseHeld = true;
|
|
253
|
-
this.svc.pause('hover');
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
protected onPointerLeave(): void {
|
|
258
|
-
if (this.strategy.expandOnHover) this._hovered.set(false);
|
|
259
|
-
if (this.pointerPauseHeld) {
|
|
260
|
-
this.pointerPauseHeld = false;
|
|
261
|
-
this.svc.resume('hover');
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
protected onFocusIn(event: FocusEvent): void {
|
|
266
|
-
if (this.strategy.expandOnHover) this._hovered.set(true);
|
|
267
|
-
// Capture the *external* focus owner so F6/Escape can restore. Only the
|
|
268
|
-
// first focusin counts — subsequent focus moves *within* the viewport
|
|
269
|
-
// (e.g. Tab between toasts) must not overwrite the restore target.
|
|
270
|
-
if (!this.focusPauseHeld) {
|
|
271
|
-
const previous = event.relatedTarget as HTMLElement | null;
|
|
272
|
-
const root = this.el.nativeElement;
|
|
273
|
-
// relatedTarget can be null on programmatic focus; fall back to
|
|
274
|
-
// document.activeElement if it's outside the viewport.
|
|
275
|
-
if (previous && !root.contains(previous)) {
|
|
276
|
-
this.previouslyFocused = previous;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
if (this.kjToastPauseOnHover() && !this.focusPauseHeld) {
|
|
280
|
-
this.focusPauseHeld = true;
|
|
281
|
-
this.svc.pause('focus');
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
protected onFocusOut(event: FocusEvent): void {
|
|
286
|
-
const root = this.el.nativeElement;
|
|
287
|
-
const next = event.relatedTarget as HTMLElement | null;
|
|
288
|
-
// focusout fires for every internal focus move; only count *real* exits
|
|
289
|
-
// — the new focus target is null or outside the viewport root.
|
|
290
|
-
if (next && root.contains(next)) return;
|
|
291
|
-
if (this.strategy.expandOnHover) this._hovered.set(false);
|
|
292
|
-
if (this.focusPauseHeld) {
|
|
293
|
-
this.focusPauseHeld = false;
|
|
294
|
-
this.svc.resume('focus');
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
private focusFrontToast(): void {
|
|
299
|
-
const root = this.el.nativeElement as HTMLElement;
|
|
300
|
-
// Front-most toast is the *last* in DOM order (newest). Prefer the first
|
|
301
|
-
// focusable inside it; fall back to the toast element itself.
|
|
302
|
-
const fronts = root.querySelectorAll('[kjToast][data-front="true"]');
|
|
303
|
-
const front = fronts.length > 0 ? (fronts[fronts.length - 1] as HTMLElement) : null;
|
|
304
|
-
if (!front) return;
|
|
305
|
-
const focusable = front.querySelector(
|
|
306
|
-
'button:not([disabled]), [href], input:not([disabled]), [tabindex]:not([tabindex="-1"])',
|
|
307
|
-
) as HTMLElement | null;
|
|
308
|
-
(focusable ?? front).focus();
|
|
309
|
-
}
|
|
310
|
-
|
|
311
|
-
private restorePreviousFocus(): void {
|
|
312
|
-
const target = this.previouslyFocused;
|
|
313
|
-
this.previouslyFocused = null;
|
|
314
|
-
if (target && typeof target.focus === 'function') target.focus();
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
/** Live list of queued toasts (uncapped). */
|
|
318
|
-
readonly toasts = this.svc.toasts;
|
|
319
|
-
|
|
320
|
-
/** Renderables — capped by `kjToastMaxVisible`, paired with a template + bound context. */
|
|
321
|
-
readonly renderable = computed<KjToastRenderable[]>(() => {
|
|
322
|
-
const fallback = this.kjToastDefaultTemplate();
|
|
323
|
-
const cap = this.kjToastMaxVisible();
|
|
324
|
-
const list = this.toasts();
|
|
325
|
-
// Newest are at the END of the service array; the front of the stack is the
|
|
326
|
-
// last item. When capping, drop the OLDEST first.
|
|
327
|
-
const visible = Number.isFinite(cap) && list.length > cap
|
|
328
|
-
? list.slice(list.length - cap)
|
|
329
|
-
: list;
|
|
330
|
-
return visible.map(t => ({
|
|
331
|
-
id: t.id,
|
|
332
|
-
template: t.template ?? fallback,
|
|
333
|
-
context: this.svc.contextFor(t),
|
|
334
|
-
}));
|
|
335
|
-
});
|
|
336
|
-
|
|
337
|
-
private readonly _frontHeight = signal<number>(0);
|
|
338
|
-
|
|
339
|
-
/** `--kj-toast-gap` value (`"8px"`). */
|
|
340
|
-
readonly gapPx = computed(() => `${this.kjToastGap()}px`);
|
|
341
|
-
|
|
342
|
-
/** `--kj-toast-front-height` value (`"42px"`) — the measured height of the front toast. */
|
|
343
|
-
readonly frontHeightPx = computed(() => {
|
|
344
|
-
const h = this._frontHeight();
|
|
345
|
-
return h > 0 ? `${h}px` : '';
|
|
346
|
-
});
|
|
347
|
-
|
|
348
|
-
constructor() {
|
|
349
|
-
// Register the F6 / Escape document-level listener eagerly — registering
|
|
350
|
-
// from `afterNextRender` was too late for tests that dispatch immediately
|
|
351
|
-
// after `service.show()`. Sonner uses the same pattern of a long-lived
|
|
352
|
-
// top-level listener. Handles both directions of F6 (outside → in,
|
|
353
|
-
// inside → out) and Escape (dismiss focused toast + restore focus) so
|
|
354
|
-
// there is exactly one source of truth — host listeners would race the
|
|
355
|
-
// document listener over the same event.
|
|
356
|
-
const doc = (typeof document !== 'undefined' ? document : null);
|
|
357
|
-
if (doc) {
|
|
358
|
-
const onDocKeydown = (event: KeyboardEvent) => {
|
|
359
|
-
if (event.key !== 'F6' && event.key !== 'Escape') return;
|
|
360
|
-
if (this.svc.toasts().length === 0) return;
|
|
361
|
-
const root = this.el.nativeElement as HTMLElement;
|
|
362
|
-
const active = doc.activeElement as HTMLElement | null;
|
|
363
|
-
const inside = active != null && root.contains(active);
|
|
364
|
-
if (event.key === 'F6') {
|
|
365
|
-
if (inside) {
|
|
366
|
-
event.preventDefault();
|
|
367
|
-
this.restorePreviousFocus();
|
|
368
|
-
return;
|
|
369
|
-
}
|
|
370
|
-
event.preventDefault();
|
|
371
|
-
this.previouslyFocused = active;
|
|
372
|
-
this.focusFrontToast();
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
// Escape: only act when focus is inside the viewport so we don't
|
|
376
|
-
// hijack the consumer's other Escape affordances.
|
|
377
|
-
if (event.key === 'Escape' && inside) {
|
|
378
|
-
event.preventDefault();
|
|
379
|
-
const target = event.target as HTMLElement | null;
|
|
380
|
-
const toastEl = (target?.closest('[kjToast]')) as HTMLElement | null;
|
|
381
|
-
const id = toastEl?.getAttribute('data-toast-id')
|
|
382
|
-
?? this.svc.toasts().at(-1)?.id
|
|
383
|
-
?? null;
|
|
384
|
-
this.restorePreviousFocus();
|
|
385
|
-
if (id) this.svc.dismiss(id);
|
|
386
|
-
}
|
|
387
|
-
};
|
|
388
|
-
doc.addEventListener('keydown', onDocKeydown);
|
|
389
|
-
this.destroyRef.onDestroy(() => doc.removeEventListener('keydown', onDocKeydown));
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
afterNextRender(() => {
|
|
393
|
-
const root = this.el.nativeElement as HTMLElement;
|
|
394
|
-
const measure = () => {
|
|
395
|
-
const front = root.querySelector('[kjToast][data-front="true"]') as HTMLElement | null;
|
|
396
|
-
if (!front) { this._frontHeight.set(0); return; }
|
|
397
|
-
this._frontHeight.set(Math.round(front.getBoundingClientRect().height));
|
|
398
|
-
};
|
|
399
|
-
measure();
|
|
400
|
-
// Guard ResizeObserver / MutationObserver for SSR + older test envs.
|
|
401
|
-
let ro: ResizeObserver | undefined;
|
|
402
|
-
let mo: MutationObserver | undefined;
|
|
403
|
-
if (typeof ResizeObserver !== 'undefined') {
|
|
404
|
-
ro = new ResizeObserver(measure);
|
|
405
|
-
// Observe the viewport — children added/resized trigger remeasure.
|
|
406
|
-
ro.observe(root);
|
|
407
|
-
}
|
|
408
|
-
if (typeof MutationObserver !== 'undefined') {
|
|
409
|
-
// MutationObserver picks up new children (data-front="true" added on a new toast).
|
|
410
|
-
mo = new MutationObserver(measure);
|
|
411
|
-
mo.observe(root, { childList: true, subtree: true, attributes: true, attributeFilter: ['data-front'] });
|
|
412
|
-
}
|
|
413
|
-
this.destroyRef.onDestroy(() => { ro?.disconnect(); mo?.disconnect(); });
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
/**
|
|
419
|
-
* Optional dismiss button. Use `(click)="ctx.dismiss()"` directly in the template
|
|
420
|
-
* for new code — this directive is for cases where the dismiss target id is
|
|
421
|
-
* known outside the template context.
|
|
422
|
-
*
|
|
423
|
-
* @example
|
|
424
|
-
* ```html
|
|
425
|
-
* <button [kjToastClose]="toast.id" aria-label="Dismiss">×</button>
|
|
426
|
-
* ```
|
|
427
|
-
* @doc-category Core/Overlay
|
|
428
|
-
*/
|
|
429
|
-
@Directive({
|
|
430
|
-
selector: '[kjToastClose]',
|
|
431
|
-
standalone: true,
|
|
432
|
-
host: {
|
|
433
|
-
'class': 'kj-toast-close',
|
|
434
|
-
'(click)': 'dismiss()',
|
|
435
|
-
},
|
|
436
|
-
})
|
|
437
|
-
export class KjToastClose {
|
|
438
|
-
private readonly svc = inject(KjToastService);
|
|
439
|
-
/** The id of the toast to dismiss on click. */
|
|
440
|
-
kjToastClose = input.required<string>();
|
|
441
|
-
|
|
442
|
-
dismiss(): void {
|
|
443
|
-
this.svc.dismiss(this.kjToastClose());
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
/**
|
|
448
|
-
* Service-launched toast panel. Composes `KjOverlayPanel` as a host directive
|
|
449
|
-
* so the overlay primitives wire role/state/aria management. The role is
|
|
450
|
-
* decided by the service via `KJ_OVERLAY_PANEL_ROLE` (`status` or `alert`).
|
|
451
|
-
*
|
|
452
|
-
* @doc-category Core/Overlay
|
|
453
|
-
*/
|
|
454
|
-
@Component({
|
|
455
|
-
selector: 'kj-toast',
|
|
456
|
-
standalone: true,
|
|
457
|
-
hostDirectives: [{ directive: KjOverlayPanel }],
|
|
458
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
459
|
-
encapsulation: ViewEncapsulation.None,
|
|
460
|
-
host: { class: 'kj-toast' },
|
|
461
|
-
template: `<ng-content />`,
|
|
462
|
-
})
|
|
463
|
-
export class KjToastPanel {}
|
package/src/toast/toast.types.ts
DELETED
package/src/toggle/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { KjToggle } from './toggle';
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { render, fireEvent } from '@testing-library/angular';
|
|
2
|
-
import { axe, toHaveNoViolations } from 'jest-axe';
|
|
3
|
-
import { KjToggle } from './toggle';
|
|
4
|
-
|
|
5
|
-
expect.extend(toHaveNoViolations);
|
|
6
|
-
|
|
7
|
-
describe('KjToggle', () => {
|
|
8
|
-
it('has aria-pressed=false by default', async () => {
|
|
9
|
-
const { getByRole } = await render(`<button kjToggle>Bold</button>`, { imports: [KjToggle] });
|
|
10
|
-
expect(getByRole('button')).toHaveAttribute('aria-pressed', 'false');
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
it('toggles aria-pressed on click', async () => {
|
|
14
|
-
const { getByRole } = await render(`<button kjToggle>Bold</button>`, { imports: [KjToggle] });
|
|
15
|
-
fireEvent.click(getByRole('button'));
|
|
16
|
-
expect(getByRole('button')).toHaveAttribute('aria-pressed', 'true');
|
|
17
|
-
expect(getByRole('button')).toHaveAttribute('data-pressed', '');
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
it('passes axe audit', async () => {
|
|
21
|
-
const { container } = await render(`<button kjToggle>Bold</button>`, { imports: [KjToggle] });
|
|
22
|
-
expect(await axe(container)).toHaveNoViolations();
|
|
23
|
-
});
|
|
24
|
-
});
|
package/src/toggle/toggle.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Directive, inject, model } from '@angular/core';
|
|
2
|
-
import { KjDisabled, KjFocusRing, KjFormControl } from '../primitives';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Adds toggle (press) behavior with Angular forms integration.
|
|
6
|
-
*
|
|
7
|
-
* Reflects `aria-pressed` and `data-pressed` and integrates with reactive and
|
|
8
|
-
* template-driven forms so the pressed state participates as a regular form
|
|
9
|
-
* value alongside other inputs.
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```html
|
|
13
|
-
* <button kjToggle [(kjPressed)]="isBold" aria-label="Bold">B</button>
|
|
14
|
-
* ```
|
|
15
|
-
* @doc-category Core/Inputs
|
|
16
|
-
* @doc
|
|
17
|
-
* @doc-name toggle
|
|
18
|
-
* @doc-description Adds press/unpress toggle behaviour to any focusable element with Angular forms support.
|
|
19
|
-
* @doc-is-main
|
|
20
|
-
*/
|
|
21
|
-
@Directive({
|
|
22
|
-
selector: '[kjToggle]',
|
|
23
|
-
standalone: true,
|
|
24
|
-
hostDirectives: [
|
|
25
|
-
{ directive: KjDisabled, inputs: ['kjDisabled'] },
|
|
26
|
-
KjFocusRing,
|
|
27
|
-
KjFormControl,
|
|
28
|
-
],
|
|
29
|
-
host: {
|
|
30
|
-
'[attr.aria-pressed]': 'kjPressed().toString()',
|
|
31
|
-
'[attr.data-pressed]': 'kjPressed() ? "" : null',
|
|
32
|
-
'(click)': 'toggle()',
|
|
33
|
-
'(blur)': 'formCtrl.notifyTouched()',
|
|
34
|
-
},
|
|
35
|
-
})
|
|
36
|
-
export class KjToggle {
|
|
37
|
-
readonly formCtrl = inject(KjFormControl);
|
|
38
|
-
|
|
39
|
-
/** Whether the toggle is pressed. Supports two-way binding. */
|
|
40
|
-
kjPressed = model<boolean>(false);
|
|
41
|
-
|
|
42
|
-
/** @internal */
|
|
43
|
-
toggle(): void {
|
|
44
|
-
const next = !this.kjPressed();
|
|
45
|
-
this.kjPressed.set(next);
|
|
46
|
-
this.formCtrl.notifyChange(next);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
// AUTO-GENERATED by scripts/migrate-examples.mjs
|
|
2
|
-
// One barrel per component folder — used by the docs app as a lazy chunk.
|
|
3
|
-
export { TooltipBasicExample } from './tooltip.example';
|
|
4
|
-
export { TooltipFinanceExample } from './tooltip.finance.example';
|
|
5
|
-
export { TooltipPlacementsExample } from './tooltip.placements.example';
|
|
6
|
-
export { TooltipRetroExample } from './tooltip.retro.example';
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
-
import { KjTooltipTrigger, KjTooltipContent } from '../tooltip';
|
|
3
|
-
import { KjButton } from '../../button/button';
|
|
4
|
-
|
|
5
|
-
@Component({
|
|
6
|
-
selector: 'kj-example-tooltip-basic',
|
|
7
|
-
standalone: true,
|
|
8
|
-
imports: [KjTooltipTrigger, KjTooltipContent, KjButton],
|
|
9
|
-
styleUrls: ['../../styles/docs-themes.css'],
|
|
10
|
-
styles: [
|
|
11
|
-
`
|
|
12
|
-
:host {
|
|
13
|
-
display: flex;
|
|
14
|
-
align-items: center;
|
|
15
|
-
justify-content: center;
|
|
16
|
-
padding: 5rem 3rem;
|
|
17
|
-
background: var(--kj-bg);
|
|
18
|
-
font-family: var(--kj-font);
|
|
19
|
-
min-height: 180px;
|
|
20
|
-
}
|
|
21
|
-
.row {
|
|
22
|
-
display: flex;
|
|
23
|
-
gap: 1.5rem;
|
|
24
|
-
flex-wrap: wrap;
|
|
25
|
-
align-items: center;
|
|
26
|
-
justify-content: center;
|
|
27
|
-
}
|
|
28
|
-
button[kjButton] {
|
|
29
|
-
padding: 0.5rem 1.25rem;
|
|
30
|
-
font-family: var(--kj-font);
|
|
31
|
-
font-size: 0.875rem;
|
|
32
|
-
border: var(--kj-btn-border);
|
|
33
|
-
cursor: pointer;
|
|
34
|
-
transition: var(--kj-transition);
|
|
35
|
-
}
|
|
36
|
-
[data-variant='default'] {
|
|
37
|
-
background: var(--kj-accent);
|
|
38
|
-
color: var(--kj-accent-on);
|
|
39
|
-
}
|
|
40
|
-
[data-variant='link'] {
|
|
41
|
-
background: transparent;
|
|
42
|
-
color: var(--kj-accent);
|
|
43
|
-
border: none;
|
|
44
|
-
padding: 0.5rem 0.5rem;
|
|
45
|
-
text-decoration: none;
|
|
46
|
-
text-underline-offset: 4px;
|
|
47
|
-
}
|
|
48
|
-
[data-variant='link']:hover {
|
|
49
|
-
text-decoration: underline;
|
|
50
|
-
}
|
|
51
|
-
[data-variant='ghost'] {
|
|
52
|
-
background: transparent;
|
|
53
|
-
color: var(--kj-btn-ghost-color);
|
|
54
|
-
}
|
|
55
|
-
:global(kj-tooltip-content) {
|
|
56
|
-
background: var(--kj-accent);
|
|
57
|
-
color: var(--kj-accent-on);
|
|
58
|
-
padding: 0.25rem 0.625rem;
|
|
59
|
-
font-size: 0.75rem;
|
|
60
|
-
white-space: nowrap;
|
|
61
|
-
pointer-events: none;
|
|
62
|
-
transition: var(--kj-transition);
|
|
63
|
-
}
|
|
64
|
-
`,
|
|
65
|
-
],
|
|
66
|
-
changeDetection: ChangeDetectionStrategy.Eager,
|
|
67
|
-
template: `
|
|
68
|
-
<div class="row">
|
|
69
|
-
<button kjButton [kjVariant]="'default'" kjTooltipTrigger #t1="kjTooltipTrigger">
|
|
70
|
-
Default
|
|
71
|
-
</button>
|
|
72
|
-
<kj-tooltip-content [kjFor]="t1">Copy to clipboard</kj-tooltip-content>
|
|
73
|
-
|
|
74
|
-
<button kjButton [kjVariant]="'link'" kjTooltipTrigger #t2="kjTooltipTrigger">Link</button>
|
|
75
|
-
<kj-tooltip-content [kjFor]="t2" [kjSide]="'bottom'">Opens below</kj-tooltip-content>
|
|
76
|
-
|
|
77
|
-
<button kjButton [kjVariant]="'ghost'" kjTooltipTrigger #t3="kjTooltipTrigger">Ghost</button>
|
|
78
|
-
<kj-tooltip-content [kjFor]="t3" [kjSide]="'right'">Opens right</kj-tooltip-content>
|
|
79
|
-
</div>
|
|
80
|
-
`,
|
|
81
|
-
})
|
|
82
|
-
export class TooltipBasicExample {}
|