@kouji-ui/core 0.1.1 → 0.1.2
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 +5 -6
- 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,423 +0,0 @@
|
|
|
1
|
-
import { Component, signal } from '@angular/core';
|
|
2
|
-
import { TestBed } from '@angular/core/testing';
|
|
3
|
-
import { render } from '@testing-library/angular';
|
|
4
|
-
import { axe, toHaveNoViolations } from 'jest-axe';
|
|
5
|
-
import { describe, expect, it, vi } from 'vitest';
|
|
6
|
-
|
|
7
|
-
import { KjProgressBar } from './progress-bar';
|
|
8
|
-
import { KjProgressBarFill } from './progress-bar-fill';
|
|
9
|
-
import { provideKjProgressBar } from './config';
|
|
10
|
-
|
|
11
|
-
expect.extend(toHaveNoViolations);
|
|
12
|
-
|
|
13
|
-
const imports = [KjProgressBar, KjProgressBarFill];
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Flush microtasks + the rAF that backs `afterNextRender` so the directive
|
|
17
|
-
* has a chance to subscribe to the reduced-motion media query.
|
|
18
|
-
*/
|
|
19
|
-
async function flush(): Promise<void> {
|
|
20
|
-
await new Promise<void>((resolve) => setTimeout(resolve, 0));
|
|
21
|
-
await Promise.resolve();
|
|
22
|
-
await Promise.resolve();
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
describe('KjProgressBar', () => {
|
|
26
|
-
describe('determinate mode', () => {
|
|
27
|
-
it('sets aria-valuenow from kjValue', async () => {
|
|
28
|
-
const { container } = await render(
|
|
29
|
-
`<div kjProgressBar [kjValue]="42" aria-label="Upload"></div>`,
|
|
30
|
-
{ imports },
|
|
31
|
-
);
|
|
32
|
-
await flush();
|
|
33
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
34
|
-
expect(host).toHaveAttribute('aria-valuenow', '42');
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
it('rounds aria-valuenow so sub-integer jitter does not churn the attribute', async () => {
|
|
38
|
-
const { container } = await render(
|
|
39
|
-
`<div kjProgressBar [kjValue]="47.4" aria-label="Upload"></div>`,
|
|
40
|
-
{ imports },
|
|
41
|
-
);
|
|
42
|
-
await flush();
|
|
43
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
44
|
-
expect(host).toHaveAttribute('aria-valuenow', '47');
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('sets role="progressbar" on the host', async () => {
|
|
48
|
-
const { container } = await render(
|
|
49
|
-
`<div kjProgressBar [kjValue]="50" aria-label="Upload"></div>`,
|
|
50
|
-
{ imports },
|
|
51
|
-
);
|
|
52
|
-
await flush();
|
|
53
|
-
expect(container.querySelector('[kjProgressBar]')).toHaveAttribute(
|
|
54
|
-
'role',
|
|
55
|
-
'progressbar',
|
|
56
|
-
);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
it('omits data-indeterminate when value is a number', async () => {
|
|
60
|
-
const { container } = await render(
|
|
61
|
-
`<div kjProgressBar [kjValue]="20" aria-label="x"></div>`,
|
|
62
|
-
{ imports },
|
|
63
|
-
);
|
|
64
|
-
await flush();
|
|
65
|
-
expect(
|
|
66
|
-
container.querySelector('[kjProgressBar]'),
|
|
67
|
-
).not.toHaveAttribute('data-indeterminate');
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
describe('indeterminate mode', () => {
|
|
72
|
-
it('omits aria-valuenow when kjValue is null', async () => {
|
|
73
|
-
const { container } = await render(
|
|
74
|
-
`<div kjProgressBar [kjValue]="null" aria-label="Loading"></div>`,
|
|
75
|
-
{ imports },
|
|
76
|
-
);
|
|
77
|
-
await flush();
|
|
78
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
79
|
-
// APG-correct: indeterminate must NOT carry aria-valuenow at all.
|
|
80
|
-
expect(host.hasAttribute('aria-valuenow')).toBe(false);
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
it('omits aria-valuenow by default (kjValue defaults to null)', async () => {
|
|
84
|
-
const { container } = await render(
|
|
85
|
-
`<div kjProgressBar aria-label="Loading"></div>`,
|
|
86
|
-
{ imports },
|
|
87
|
-
);
|
|
88
|
-
await flush();
|
|
89
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
90
|
-
expect(host.hasAttribute('aria-valuenow')).toBe(false);
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('reflects data-indeterminate="true" when kjValue is null', async () => {
|
|
94
|
-
const { container } = await render(
|
|
95
|
-
`<div kjProgressBar [kjValue]="null" aria-label="Loading"></div>`,
|
|
96
|
-
{ imports },
|
|
97
|
-
);
|
|
98
|
-
await flush();
|
|
99
|
-
expect(container.querySelector('[kjProgressBar]')).toHaveAttribute(
|
|
100
|
-
'data-indeterminate',
|
|
101
|
-
'true',
|
|
102
|
-
);
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it('still emits aria-valuemin and aria-valuemax', async () => {
|
|
106
|
-
const { container } = await render(
|
|
107
|
-
`<div kjProgressBar [kjValue]="null" aria-label="Loading"></div>`,
|
|
108
|
-
{ imports },
|
|
109
|
-
);
|
|
110
|
-
await flush();
|
|
111
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
112
|
-
expect(host).toHaveAttribute('aria-valuemin', '0');
|
|
113
|
-
expect(host).toHaveAttribute('aria-valuemax', '100');
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
describe('min / max defaults & overrides', () => {
|
|
118
|
-
it('defaults aria-valuemin to 0 and aria-valuemax to 100', async () => {
|
|
119
|
-
const { container } = await render(
|
|
120
|
-
`<div kjProgressBar [kjValue]="50" aria-label="x"></div>`,
|
|
121
|
-
{ imports },
|
|
122
|
-
);
|
|
123
|
-
await flush();
|
|
124
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
125
|
-
expect(host).toHaveAttribute('aria-valuemin', '0');
|
|
126
|
-
expect(host).toHaveAttribute('aria-valuemax', '100');
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
it('reflects custom min / max for absolute units', async () => {
|
|
130
|
-
const { container } = await render(
|
|
131
|
-
`<div kjProgressBar [kjMin]="0" [kjMax]="2500000" [kjValue]="1200000" aria-label="bytes"></div>`,
|
|
132
|
-
{ imports },
|
|
133
|
-
);
|
|
134
|
-
await flush();
|
|
135
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
136
|
-
expect(host).toHaveAttribute('aria-valuemin', '0');
|
|
137
|
-
expect(host).toHaveAttribute('aria-valuemax', '2500000');
|
|
138
|
-
expect(host).toHaveAttribute('aria-valuenow', '1200000');
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
describe('clamping out-of-range values', () => {
|
|
143
|
-
it('clamps below kjMin', async () => {
|
|
144
|
-
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
145
|
-
const { container } = await render(
|
|
146
|
-
`<div kjProgressBar [kjValue]="-20" aria-label="x"></div>`,
|
|
147
|
-
{ imports },
|
|
148
|
-
);
|
|
149
|
-
await flush();
|
|
150
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
151
|
-
expect(host).toHaveAttribute('aria-valuenow', '0');
|
|
152
|
-
warn.mockRestore();
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
it('clamps above kjMax', async () => {
|
|
156
|
-
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
157
|
-
const { container } = await render(
|
|
158
|
-
`<div kjProgressBar [kjValue]="150" aria-label="x"></div>`,
|
|
159
|
-
{ imports },
|
|
160
|
-
);
|
|
161
|
-
await flush();
|
|
162
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
163
|
-
expect(host).toHaveAttribute('aria-valuenow', '100');
|
|
164
|
-
warn.mockRestore();
|
|
165
|
-
});
|
|
166
|
-
|
|
167
|
-
it('clamps within custom min / max', async () => {
|
|
168
|
-
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
169
|
-
const { container } = await render(
|
|
170
|
-
`<div kjProgressBar [kjMin]="10" [kjMax]="20" [kjValue]="5" aria-label="x"></div>`,
|
|
171
|
-
{ imports },
|
|
172
|
-
);
|
|
173
|
-
await flush();
|
|
174
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
175
|
-
expect(host).toHaveAttribute('aria-valuenow', '10');
|
|
176
|
-
warn.mockRestore();
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
|
|
180
|
-
describe('aria-valuetext', () => {
|
|
181
|
-
it('reflects kjAriaValuetext when set', async () => {
|
|
182
|
-
const { container } = await render(
|
|
183
|
-
`<div kjProgressBar [kjValue]="60" kjAriaValuetext="Step 3 of 5" aria-label="x"></div>`,
|
|
184
|
-
{ imports },
|
|
185
|
-
);
|
|
186
|
-
await flush();
|
|
187
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
188
|
-
expect(host).toHaveAttribute('aria-valuetext', 'Step 3 of 5');
|
|
189
|
-
// Visual fraction is still 60% even though SR reads the phrasing.
|
|
190
|
-
expect(host).toHaveAttribute('aria-valuenow', '60');
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
it('omits aria-valuetext when not set', async () => {
|
|
194
|
-
const { container } = await render(
|
|
195
|
-
`<div kjProgressBar [kjValue]="60" aria-label="x"></div>`,
|
|
196
|
-
{ imports },
|
|
197
|
-
);
|
|
198
|
-
await flush();
|
|
199
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
200
|
-
expect(host.hasAttribute('aria-valuetext')).toBe(false);
|
|
201
|
-
});
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
describe('variant + size composition (KjVariant / KjSize)', () => {
|
|
205
|
-
it('reflects default data-variant from KJ_PROGRESS_BAR_DEFAULTS (primary)', async () => {
|
|
206
|
-
const { container } = await render(
|
|
207
|
-
`<div kjProgressBar [kjValue]="50" aria-label="x"></div>`,
|
|
208
|
-
{ imports },
|
|
209
|
-
);
|
|
210
|
-
await flush();
|
|
211
|
-
expect(container.querySelector('[kjProgressBar]')).toHaveAttribute(
|
|
212
|
-
'data-variant',
|
|
213
|
-
'primary',
|
|
214
|
-
);
|
|
215
|
-
});
|
|
216
|
-
|
|
217
|
-
it('reflects default data-size from KJ_PROGRESS_BAR_DEFAULTS (md)', async () => {
|
|
218
|
-
const { container } = await render(
|
|
219
|
-
`<div kjProgressBar [kjValue]="50" aria-label="x"></div>`,
|
|
220
|
-
{ imports },
|
|
221
|
-
);
|
|
222
|
-
await flush();
|
|
223
|
-
expect(container.querySelector('[kjProgressBar]')).toHaveAttribute(
|
|
224
|
-
'data-size',
|
|
225
|
-
'md',
|
|
226
|
-
);
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
it('forwards kjVariant via hostDirectives', async () => {
|
|
230
|
-
const { container } = await render(
|
|
231
|
-
`<div kjProgressBar [kjValue]="50" [kjVariant]="'success'" aria-label="x"></div>`,
|
|
232
|
-
{ imports },
|
|
233
|
-
);
|
|
234
|
-
await flush();
|
|
235
|
-
expect(container.querySelector('[kjProgressBar]')).toHaveAttribute(
|
|
236
|
-
'data-variant',
|
|
237
|
-
'success',
|
|
238
|
-
);
|
|
239
|
-
});
|
|
240
|
-
|
|
241
|
-
it('forwards kjSize via hostDirectives', async () => {
|
|
242
|
-
const { container } = await render(
|
|
243
|
-
`<div kjProgressBar [kjValue]="50" [kjSize]="'lg'" aria-label="x"></div>`,
|
|
244
|
-
{ imports },
|
|
245
|
-
);
|
|
246
|
-
await flush();
|
|
247
|
-
expect(container.querySelector('[kjProgressBar]')).toHaveAttribute(
|
|
248
|
-
'data-size',
|
|
249
|
-
'lg',
|
|
250
|
-
);
|
|
251
|
-
});
|
|
252
|
-
|
|
253
|
-
it('provideKjProgressBar at TestBed scope flows into directive defaults', async () => {
|
|
254
|
-
TestBed.configureTestingModule({
|
|
255
|
-
providers: [
|
|
256
|
-
provideKjProgressBar({
|
|
257
|
-
variants: ['primary', 'success', 'warning', 'error', 'brand'],
|
|
258
|
-
defaults: { variant: 'brand', size: 'lg' },
|
|
259
|
-
}),
|
|
260
|
-
],
|
|
261
|
-
});
|
|
262
|
-
const { container } = await render(
|
|
263
|
-
`<div kjProgressBar [kjValue]="50" aria-label="x"></div>`,
|
|
264
|
-
{ imports },
|
|
265
|
-
);
|
|
266
|
-
await flush();
|
|
267
|
-
const host = container.querySelector('[kjProgressBar]')!;
|
|
268
|
-
expect(host).toHaveAttribute('data-variant', 'brand');
|
|
269
|
-
expect(host).toHaveAttribute('data-size', 'lg');
|
|
270
|
-
});
|
|
271
|
-
});
|
|
272
|
-
|
|
273
|
-
describe('reduced-motion reflection', () => {
|
|
274
|
-
it('reflects data-reduced-motion="reduce" when matchMedia matches', async () => {
|
|
275
|
-
const original = window.matchMedia;
|
|
276
|
-
const listeners = new Set<(e: MediaQueryListEvent) => void>();
|
|
277
|
-
const mql: Partial<MediaQueryList> = {
|
|
278
|
-
matches: true,
|
|
279
|
-
media: '(prefers-reduced-motion: reduce)',
|
|
280
|
-
addEventListener: ((_t: string, cb: EventListener) => {
|
|
281
|
-
listeners.add(cb as (e: MediaQueryListEvent) => void);
|
|
282
|
-
}) as MediaQueryList['addEventListener'],
|
|
283
|
-
removeEventListener: ((_t: string, cb: EventListener) => {
|
|
284
|
-
listeners.delete(cb as (e: MediaQueryListEvent) => void);
|
|
285
|
-
}) as MediaQueryList['removeEventListener'],
|
|
286
|
-
};
|
|
287
|
-
window.matchMedia = (() => mql as MediaQueryList) as typeof window.matchMedia;
|
|
288
|
-
|
|
289
|
-
try {
|
|
290
|
-
const { container } = await render(
|
|
291
|
-
`<div kjProgressBar [kjValue]="50" aria-label="x"></div>`,
|
|
292
|
-
{ imports },
|
|
293
|
-
);
|
|
294
|
-
await flush();
|
|
295
|
-
expect(container.querySelector('[kjProgressBar]')).toHaveAttribute(
|
|
296
|
-
'data-reduced-motion',
|
|
297
|
-
'reduce',
|
|
298
|
-
);
|
|
299
|
-
} finally {
|
|
300
|
-
window.matchMedia = original;
|
|
301
|
-
}
|
|
302
|
-
});
|
|
303
|
-
|
|
304
|
-
it('omits data-reduced-motion when matchMedia does not match', async () => {
|
|
305
|
-
const original = window.matchMedia;
|
|
306
|
-
const mql: Partial<MediaQueryList> = {
|
|
307
|
-
matches: false,
|
|
308
|
-
media: '(prefers-reduced-motion: reduce)',
|
|
309
|
-
addEventListener: () => {},
|
|
310
|
-
removeEventListener: () => {},
|
|
311
|
-
};
|
|
312
|
-
window.matchMedia = (() => mql as MediaQueryList) as typeof window.matchMedia;
|
|
313
|
-
|
|
314
|
-
try {
|
|
315
|
-
const { container } = await render(
|
|
316
|
-
`<div kjProgressBar [kjValue]="50" aria-label="x"></div>`,
|
|
317
|
-
{ imports },
|
|
318
|
-
);
|
|
319
|
-
await flush();
|
|
320
|
-
expect(
|
|
321
|
-
container.querySelector('[kjProgressBar]'),
|
|
322
|
-
).not.toHaveAttribute('data-reduced-motion');
|
|
323
|
-
} finally {
|
|
324
|
-
window.matchMedia = original;
|
|
325
|
-
}
|
|
326
|
-
});
|
|
327
|
-
});
|
|
328
|
-
|
|
329
|
-
describe('KjProgressBarFill child', () => {
|
|
330
|
-
it('reflects --kj-progress-fraction from the parent context', async () => {
|
|
331
|
-
const { container } = await render(
|
|
332
|
-
`<div kjProgressBar [kjValue]="40" aria-label="x">
|
|
333
|
-
<div kjProgressBarFill data-testid="fill"></div>
|
|
334
|
-
</div>`,
|
|
335
|
-
{ imports },
|
|
336
|
-
);
|
|
337
|
-
await flush();
|
|
338
|
-
const fill = container.querySelector('[kjProgressBarFill]') as HTMLElement;
|
|
339
|
-
// 40 / (100 - 0) = 0.4 — the fill mirrors the parent fraction so themes
|
|
340
|
-
// can scaleX(var(--kj-progress-fraction)) on the named inner element.
|
|
341
|
-
expect(fill.style.getPropertyValue('--kj-progress-fraction')).toBe('0.4');
|
|
342
|
-
});
|
|
343
|
-
|
|
344
|
-
it('reflects data-indeterminate on the fill when parent is indeterminate', async () => {
|
|
345
|
-
const { container } = await render(
|
|
346
|
-
`<div kjProgressBar [kjValue]="null" aria-label="x">
|
|
347
|
-
<div kjProgressBarFill></div>
|
|
348
|
-
</div>`,
|
|
349
|
-
{ imports },
|
|
350
|
-
);
|
|
351
|
-
await flush();
|
|
352
|
-
const fill = container.querySelector('[kjProgressBarFill]') as HTMLElement;
|
|
353
|
-
expect(fill).toHaveAttribute('data-indeterminate', 'true');
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
it('omits data-indeterminate on the fill in determinate mode', async () => {
|
|
357
|
-
const { container } = await render(
|
|
358
|
-
`<div kjProgressBar [kjValue]="50" aria-label="x">
|
|
359
|
-
<div kjProgressBarFill></div>
|
|
360
|
-
</div>`,
|
|
361
|
-
{ imports },
|
|
362
|
-
);
|
|
363
|
-
await flush();
|
|
364
|
-
const fill = container.querySelector('[kjProgressBarFill]') as HTMLElement;
|
|
365
|
-
expect(fill).not.toHaveAttribute('data-indeterminate');
|
|
366
|
-
});
|
|
367
|
-
|
|
368
|
-
it('updates fraction reactively when the parent value changes', async () => {
|
|
369
|
-
@Component({
|
|
370
|
-
standalone: true,
|
|
371
|
-
imports,
|
|
372
|
-
template: `
|
|
373
|
-
<div kjProgressBar [kjValue]="value()" aria-label="x">
|
|
374
|
-
<div kjProgressBarFill data-testid="fill"></div>
|
|
375
|
-
</div>
|
|
376
|
-
`,
|
|
377
|
-
})
|
|
378
|
-
class Host {
|
|
379
|
-
readonly value = signal<number | null>(20);
|
|
380
|
-
}
|
|
381
|
-
const { fixture } = await render(Host);
|
|
382
|
-
await flush();
|
|
383
|
-
const fill = fixture.nativeElement.querySelector(
|
|
384
|
-
'[kjProgressBarFill]',
|
|
385
|
-
) as HTMLElement;
|
|
386
|
-
expect(fill.style.getPropertyValue('--kj-progress-fraction')).toBe('0.2');
|
|
387
|
-
|
|
388
|
-
fixture.componentInstance.value.set(80);
|
|
389
|
-
fixture.detectChanges();
|
|
390
|
-
await flush();
|
|
391
|
-
expect(fill.style.getPropertyValue('--kj-progress-fraction')).toBe('0.8');
|
|
392
|
-
|
|
393
|
-
fixture.componentInstance.value.set(null);
|
|
394
|
-
fixture.detectChanges();
|
|
395
|
-
await flush();
|
|
396
|
-
expect(fill).toHaveAttribute('data-indeterminate', 'true');
|
|
397
|
-
});
|
|
398
|
-
});
|
|
399
|
-
|
|
400
|
-
describe('a11y audits', () => {
|
|
401
|
-
it('determinate progress bar passes axe', async () => {
|
|
402
|
-
const { container } = await render(
|
|
403
|
-
`<div kjProgressBar [kjValue]="50" aria-label="Upload progress">
|
|
404
|
-
<div kjProgressBarFill></div>
|
|
405
|
-
</div>`,
|
|
406
|
-
{ imports },
|
|
407
|
-
);
|
|
408
|
-
await flush();
|
|
409
|
-
expect(await axe(container)).toHaveNoViolations();
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
it('indeterminate progress bar passes axe', async () => {
|
|
413
|
-
const { container } = await render(
|
|
414
|
-
`<div kjProgressBar [kjValue]="null" aria-label="Loading">
|
|
415
|
-
<div kjProgressBarFill></div>
|
|
416
|
-
</div>`,
|
|
417
|
-
{ imports },
|
|
418
|
-
);
|
|
419
|
-
await flush();
|
|
420
|
-
expect(await axe(container)).toHaveNoViolations();
|
|
421
|
-
});
|
|
422
|
-
});
|
|
423
|
-
});
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DestroyRef,
|
|
3
|
-
Directive,
|
|
4
|
-
PLATFORM_ID,
|
|
5
|
-
Signal,
|
|
6
|
-
afterNextRender,
|
|
7
|
-
computed,
|
|
8
|
-
effect,
|
|
9
|
-
inject,
|
|
10
|
-
input,
|
|
11
|
-
isDevMode,
|
|
12
|
-
signal,
|
|
13
|
-
} from '@angular/core';
|
|
14
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
15
|
-
|
|
16
|
-
import { KjSize, KjVariant, bindPresets } from '../presets';
|
|
17
|
-
import { KJ_PROGRESS_BAR_CONFIG } from './config';
|
|
18
|
-
import {
|
|
19
|
-
KJ_PROGRESS_BAR,
|
|
20
|
-
KjProgressBarContext,
|
|
21
|
-
} from './progress-bar.context';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Marks an element as a kouji progress bar. Owns `role="progressbar"` and the
|
|
25
|
-
* full ARIA value contract: `aria-valuemin` / `aria-valuemax` always, the
|
|
26
|
-
* rounded integer `aria-valuenow` when determinate, and **omits**
|
|
27
|
-
* `aria-valuenow` when indeterminate (the APG-correct behaviour for
|
|
28
|
-
* *"working, no measurable progress"*).
|
|
29
|
-
*
|
|
30
|
-
* `kjValue: number | null` is the single mode switch — `null` is the explicit
|
|
31
|
-
* indeterminate sentinel. Out-of-range values clamp to `[kjMin, kjMax]`; the
|
|
32
|
-
* directive computes the `0..1` fraction (`--kj-progress-fraction`) for the
|
|
33
|
-
* inner `[kjProgressBarFill]` to read, and rounds the value for AT so a
|
|
34
|
-
* 47.0 → 47.4 jitter doesn't churn the attribute.
|
|
35
|
-
*
|
|
36
|
-
* Variants and sizes are configurable via `provideKjProgressBar(…)`. The
|
|
37
|
-
* indeterminate stripe animation is theme-owned; the directive only reflects
|
|
38
|
-
* `data-indeterminate` and `data-reduced-motion` so themes can collapse the
|
|
39
|
-
* animation under `prefers-reduced-motion: reduce`.
|
|
40
|
-
*
|
|
41
|
-
* The progress bar itself is **not** a live region — APG is explicit that a
|
|
42
|
-
* `role="progressbar"` element should not carry `aria-live`. Milestone
|
|
43
|
-
* announcements (25%, 50%, …) belong on a sibling `[kjLiveRegion]` composed
|
|
44
|
-
* at the wrapper layer; the core directive does not own that wiring.
|
|
45
|
-
*
|
|
46
|
-
* @example
|
|
47
|
-
* ```html
|
|
48
|
-
* <div kjProgressBar [kjValue]="progress()" kjAriaLabel="Upload progress">
|
|
49
|
-
* <div kjProgressBarFill></div>
|
|
50
|
-
* </div>
|
|
51
|
-
* ```
|
|
52
|
-
* @doc-category Core/Feedback
|
|
53
|
-
* @doc
|
|
54
|
-
* @doc-name progress-bar
|
|
55
|
-
* @doc-description Marks an element as an accessible progress bar with determinate or indeterminate value.
|
|
56
|
-
* @doc-is-main
|
|
57
|
-
*/
|
|
58
|
-
@Directive({
|
|
59
|
-
selector: '[kjProgressBar]',
|
|
60
|
-
standalone: true,
|
|
61
|
-
exportAs: 'kjProgressBar',
|
|
62
|
-
hostDirectives: [
|
|
63
|
-
{ directive: KjVariant, inputs: ['kjVariant'] },
|
|
64
|
-
{ directive: KjSize, inputs: ['kjSize'] },
|
|
65
|
-
],
|
|
66
|
-
providers: [
|
|
67
|
-
...bindPresets(KJ_PROGRESS_BAR_CONFIG),
|
|
68
|
-
{ provide: KJ_PROGRESS_BAR, useExisting: KjProgressBar },
|
|
69
|
-
],
|
|
70
|
-
host: {
|
|
71
|
-
'role': 'progressbar',
|
|
72
|
-
'[attr.aria-valuemin]': 'min()',
|
|
73
|
-
'[attr.aria-valuemax]': 'max()',
|
|
74
|
-
'[attr.aria-valuenow]': 'valuenow()',
|
|
75
|
-
'[attr.aria-valuetext]': 'kjAriaValuetext() ?? null',
|
|
76
|
-
'[attr.data-indeterminate]': 'indeterminate() ? "true" : null',
|
|
77
|
-
'[attr.data-reduced-motion]': 'reducedMotion() ? "reduce" : null',
|
|
78
|
-
'[style.--kj-progress-fraction]': 'fraction()',
|
|
79
|
-
},
|
|
80
|
-
})
|
|
81
|
-
export class KjProgressBar implements KjProgressBarContext {
|
|
82
|
-
private readonly platformId = inject(PLATFORM_ID);
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Current progress value. `null` is the explicit indeterminate sentinel —
|
|
86
|
-
* the directive omits `aria-valuenow` and reflects `data-indeterminate`.
|
|
87
|
-
* Out-of-range values clamp to `[kjMin, kjMax]` (with a dev-mode warning).
|
|
88
|
-
* @default null
|
|
89
|
-
*/
|
|
90
|
-
readonly kjValue = input<number | null>(null);
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Lower bound, bound to `aria-valuemin`. Most consumers leave this at `0`
|
|
94
|
-
* and pass a percentage; for absolute units (`bytesUploaded` /
|
|
95
|
-
* `bytesTotal`), pass both `kjMin` and `kjMax`.
|
|
96
|
-
* @default 0
|
|
97
|
-
*/
|
|
98
|
-
readonly kjMin = input<number>(0);
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Upper bound, bound to `aria-valuemax`. Must be `> kjMin` (dev-mode
|
|
102
|
-
* throw otherwise).
|
|
103
|
-
* @default 100
|
|
104
|
-
*/
|
|
105
|
-
readonly kjMax = input<number>(100);
|
|
106
|
-
|
|
107
|
-
/**
|
|
108
|
-
* Human-readable phrasing reflected to `aria-valuetext`. Use for cases
|
|
109
|
-
* where the raw percentage is less meaningful — `"Step 3 of 5"`,
|
|
110
|
-
* `"1.2 MB of 2.5 MB"`, `"3 minutes remaining"`. AT typically reads
|
|
111
|
-
* `aria-valuetext` exclusively when both attributes are set.
|
|
112
|
-
*/
|
|
113
|
-
readonly kjAriaValuetext = input<string | undefined>(undefined);
|
|
114
|
-
|
|
115
|
-
/** True when the user prefers reduced motion. Reflects `data-reduced-motion`. */
|
|
116
|
-
protected readonly reducedMotion = signal<boolean>(false);
|
|
117
|
-
|
|
118
|
-
/** Raw value (passes through `null` for indeterminate). */
|
|
119
|
-
readonly value: Signal<number | null> = computed(() => this.kjValue());
|
|
120
|
-
|
|
121
|
-
/** True iff `kjValue()` is `null`. */
|
|
122
|
-
readonly indeterminate: Signal<boolean> = computed(
|
|
123
|
-
() => this.kjValue() === null,
|
|
124
|
-
);
|
|
125
|
-
|
|
126
|
-
readonly min: Signal<number> = computed(() => this.kjMin());
|
|
127
|
-
readonly max: Signal<number> = computed(() => this.kjMax());
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Clamped value in `[min, max]`, or `null` when indeterminate. Applies
|
|
131
|
-
* even when the consumer passes `min >= max` (degenerate config —
|
|
132
|
-
* dev-mode throws but production still flows through with clamping).
|
|
133
|
-
*/
|
|
134
|
-
readonly clampedValue: Signal<number | null> = computed(() => {
|
|
135
|
-
const v = this.kjValue();
|
|
136
|
-
if (v === null) return null;
|
|
137
|
-
const lo = this.kjMin();
|
|
138
|
-
const hi = this.kjMax();
|
|
139
|
-
if (Number.isNaN(v)) return null;
|
|
140
|
-
return Math.min(Math.max(v, lo), hi);
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
/** `0..1` fraction for CSS, or `null` when indeterminate. */
|
|
144
|
-
readonly fraction: Signal<number | null> = computed(() => {
|
|
145
|
-
const v = this.clampedValue();
|
|
146
|
-
if (v === null) return null;
|
|
147
|
-
const lo = this.kjMin();
|
|
148
|
-
const hi = this.kjMax();
|
|
149
|
-
const span = hi - lo;
|
|
150
|
-
if (span <= 0) return 0;
|
|
151
|
-
return (v - lo) / span;
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Rounded integer for `aria-valuenow`, or `null` when indeterminate. The
|
|
156
|
-
* rounding stabilises the attribute when consumers drive `kjValue` from a
|
|
157
|
-
* high-frequency source (rAF-rate observables) — a 47.0 → 47.4 update no
|
|
158
|
-
* longer triggers an attribute write that some AT engines could announce.
|
|
159
|
-
*/
|
|
160
|
-
readonly valuenow: Signal<number | null> = computed(() => {
|
|
161
|
-
const v = this.clampedValue();
|
|
162
|
-
return v === null ? null : Math.round(v);
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
constructor() {
|
|
166
|
-
const destroyRef = inject(DestroyRef);
|
|
167
|
-
|
|
168
|
-
afterNextRender(() => {
|
|
169
|
-
if (!isPlatformBrowser(this.platformId)) return;
|
|
170
|
-
if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return;
|
|
171
|
-
|
|
172
|
-
const mql = window.matchMedia('(prefers-reduced-motion: reduce)');
|
|
173
|
-
this.reducedMotion.set(mql.matches);
|
|
174
|
-
|
|
175
|
-
const onChange = (event: MediaQueryListEvent) => {
|
|
176
|
-
this.reducedMotion.set(event.matches);
|
|
177
|
-
};
|
|
178
|
-
mql.addEventListener('change', onChange);
|
|
179
|
-
destroyRef.onDestroy(() => mql.removeEventListener('change', onChange));
|
|
180
|
-
});
|
|
181
|
-
|
|
182
|
-
if (isDevMode()) {
|
|
183
|
-
effect(() => {
|
|
184
|
-
const lo = this.kjMin();
|
|
185
|
-
const hi = this.kjMax();
|
|
186
|
-
if (lo >= hi) {
|
|
187
|
-
throw new Error(
|
|
188
|
-
`[kj] KjProgressBar: kjMin (${lo}) must be less than kjMax (${hi}).`,
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
let outOfRangeWarned = false;
|
|
194
|
-
effect(() => {
|
|
195
|
-
const v = this.kjValue();
|
|
196
|
-
if (v === null) return;
|
|
197
|
-
const lo = this.kjMin();
|
|
198
|
-
const hi = this.kjMax();
|
|
199
|
-
if ((v < lo || v > hi) && !outOfRangeWarned) {
|
|
200
|
-
outOfRangeWarned = true;
|
|
201
|
-
console.warn(
|
|
202
|
-
`[kj] KjProgressBar: kjValue ${v} is outside [${lo}, ${hi}]; clamping.`,
|
|
203
|
-
);
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
|
|
207
|
-
effect(() => {
|
|
208
|
-
if (this.kjValue() === null && this.kjAriaValuetext() !== undefined) {
|
|
209
|
-
console.warn(
|
|
210
|
-
'[kj] KjProgressBar: kjAriaValuetext is set while kjValue is null (indeterminate). ' +
|
|
211
|
-
'aria-valuetext describes a value; consider moving the phrasing to a sibling text element.',
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|