@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/button/config.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, Provider } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
export interface KjButtonConfig {
|
|
4
|
-
variants: string[];
|
|
5
|
-
sizes: string[];
|
|
6
|
-
defaults: { variant: string; size: string };
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Default Button presets shipped by kouji-ui. Exported so consumers can spread
|
|
11
|
-
* them when extending: `[...KJ_BUTTON_DEFAULTS.variants, 'brand']`.
|
|
12
|
-
*/
|
|
13
|
-
export const KJ_BUTTON_DEFAULTS: KjButtonConfig = {
|
|
14
|
-
variants: ['default', 'destructive', 'outline', 'ghost', 'link'],
|
|
15
|
-
sizes: ['sm', 'md', 'lg', 'xl', 'icon'],
|
|
16
|
-
defaults: { variant: 'default', size: 'md' },
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* DI token for the active Button presets. Default factory yields
|
|
21
|
-
* `KJ_BUTTON_DEFAULTS`. Override via `provideKjButton(…)` at the application
|
|
22
|
-
* scope (e.g. `bootstrapApplication`'s `providers` or a route's `providers`)
|
|
23
|
-
* or at the component scope (a component's own `providers: […]`).
|
|
24
|
-
*/
|
|
25
|
-
export const KJ_BUTTON_CONFIG = new InjectionToken<KjButtonConfig>('kj.button.config', {
|
|
26
|
-
factory: () => KJ_BUTTON_DEFAULTS,
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Configures the Button presets for the enclosing injector. Replaces (does
|
|
31
|
-
* not merge) `variants` and `sizes`; spread `KJ_BUTTON_DEFAULTS.variants` to
|
|
32
|
-
* extend.
|
|
33
|
-
*
|
|
34
|
-
* Returns a `Provider[]` so it can be spread into either an environment
|
|
35
|
-
* `providers` (`bootstrapApplication`, route config) or a component-level
|
|
36
|
-
* `providers` array.
|
|
37
|
-
*/
|
|
38
|
-
export function provideKjButton(config: Partial<KjButtonConfig>): Provider[] {
|
|
39
|
-
return [
|
|
40
|
-
{
|
|
41
|
-
provide: KJ_BUTTON_CONFIG,
|
|
42
|
-
useValue: { ...KJ_BUTTON_DEFAULTS, ...config },
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
}
|
package/src/button/index.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, Signal } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
/** Layout axis for the button group. */
|
|
4
|
-
export type KjButtonGroupOrientation = 'horizontal' | 'vertical';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Shared state surfaced by `KjButtonGroup` for child buttons (in the wrapper
|
|
8
|
-
* package) and the wrapper template to read.
|
|
9
|
-
*
|
|
10
|
-
* - `orientation` drives layout / styling hooks.
|
|
11
|
-
* - `variant` / `size` are *defaults* — children may override per-instance.
|
|
12
|
-
* - `disabled` is OR-ed into each child's own disabled state.
|
|
13
|
-
*/
|
|
14
|
-
export interface KjButtonGroupContext {
|
|
15
|
-
/** Layout axis (default `'horizontal'`). */
|
|
16
|
-
readonly orientation: Signal<KjButtonGroupOrientation>;
|
|
17
|
-
/** Variant token forwarded from the group as a default for children. */
|
|
18
|
-
readonly variant: Signal<string | undefined>;
|
|
19
|
-
/** Size token forwarded from the group as a default for children. */
|
|
20
|
-
readonly size: Signal<string | undefined>;
|
|
21
|
-
/** Group-level disabled flag, OR-ed into each child's own state. */
|
|
22
|
-
readonly disabled: Signal<boolean>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
/** Injection token for `KjButtonGroupContext`. */
|
|
26
|
-
export const KJ_BUTTON_GROUP = new InjectionToken<KjButtonGroupContext>(
|
|
27
|
-
'KjButtonGroup',
|
|
28
|
-
);
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Component, inject } from '@angular/core';
|
|
2
|
-
import { render } from '@testing-library/angular';
|
|
3
|
-
import { axe, toHaveNoViolations } from 'jest-axe';
|
|
4
|
-
import { describe, expect, it } from 'vitest';
|
|
5
|
-
|
|
6
|
-
import { KjButton } from '../button/button';
|
|
7
|
-
import { KjButtonGroup } from './button-group';
|
|
8
|
-
import { KJ_BUTTON_GROUP } from './button-group.context';
|
|
9
|
-
|
|
10
|
-
expect.extend(toHaveNoViolations);
|
|
11
|
-
|
|
12
|
-
describe('KjButtonGroup', () => {
|
|
13
|
-
it('renders with role="group"', async () => {
|
|
14
|
-
const { container } = await render(
|
|
15
|
-
`<div kjButtonGroup>
|
|
16
|
-
<button kjButton>One</button>
|
|
17
|
-
<button kjButton>Two</button>
|
|
18
|
-
</div>`,
|
|
19
|
-
{ imports: [KjButtonGroup, KjButton] },
|
|
20
|
-
);
|
|
21
|
-
const host = container.querySelector('[kjButtonGroup]') as HTMLElement;
|
|
22
|
-
expect(host.getAttribute('role')).toBe('group');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('defaults to horizontal orientation', async () => {
|
|
26
|
-
const { container } = await render(
|
|
27
|
-
`<div kjButtonGroup><button kjButton>x</button></div>`,
|
|
28
|
-
{ imports: [KjButtonGroup, KjButton] },
|
|
29
|
-
);
|
|
30
|
-
const host = container.querySelector('[kjButtonGroup]') as HTMLElement;
|
|
31
|
-
expect(host.getAttribute('data-orientation')).toBe('horizontal');
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('reflects kjOrientation="vertical" to data-orientation', async () => {
|
|
35
|
-
const { container } = await render(
|
|
36
|
-
`<div kjButtonGroup [kjOrientation]="'vertical'"><button kjButton>x</button></div>`,
|
|
37
|
-
{ imports: [KjButtonGroup, KjButton] },
|
|
38
|
-
);
|
|
39
|
-
const host = container.querySelector('[kjButtonGroup]') as HTMLElement;
|
|
40
|
-
expect(host.getAttribute('data-orientation')).toBe('vertical');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('writes data-disabled when kjDisabled is true', async () => {
|
|
44
|
-
const { container } = await render(
|
|
45
|
-
`<div kjButtonGroup [kjDisabled]="true"><button kjButton>x</button></div>`,
|
|
46
|
-
{ imports: [KjButtonGroup, KjButton] },
|
|
47
|
-
);
|
|
48
|
-
const host = container.querySelector('[kjButtonGroup]') as HTMLElement;
|
|
49
|
-
expect(host.getAttribute('data-disabled')).toBe('');
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
it('omits data-disabled when kjDisabled is false', async () => {
|
|
53
|
-
const { container } = await render(
|
|
54
|
-
`<div kjButtonGroup><button kjButton>x</button></div>`,
|
|
55
|
-
{ imports: [KjButtonGroup, KjButton] },
|
|
56
|
-
);
|
|
57
|
-
const host = container.querySelector('[kjButtonGroup]') as HTMLElement;
|
|
58
|
-
expect(host.hasAttribute('data-disabled')).toBe(false);
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('provides KJ_BUTTON_GROUP context with variant and size signals', async () => {
|
|
62
|
-
let captured: ReturnType<typeof inject<typeof KJ_BUTTON_GROUP>> | undefined;
|
|
63
|
-
|
|
64
|
-
@Component({
|
|
65
|
-
selector: 'kj-bg-probe',
|
|
66
|
-
standalone: true,
|
|
67
|
-
template: '',
|
|
68
|
-
})
|
|
69
|
-
class Probe {
|
|
70
|
-
constructor() {
|
|
71
|
-
captured = inject(KJ_BUTTON_GROUP);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
await render(
|
|
76
|
-
`<div kjButtonGroup [kjVariant]="'outline'" [kjSize]="'sm'">
|
|
77
|
-
<kj-bg-probe />
|
|
78
|
-
</div>`,
|
|
79
|
-
{ imports: [KjButtonGroup, Probe] },
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
expect(captured).toBeDefined();
|
|
83
|
-
expect(captured!.variant()).toBe('outline');
|
|
84
|
-
expect(captured!.size()).toBe('sm');
|
|
85
|
-
expect(captured!.orientation()).toBe('horizontal');
|
|
86
|
-
expect(captured!.disabled()).toBe(false);
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
it('passes axe audit', async () => {
|
|
90
|
-
const { container } = await render(
|
|
91
|
-
`<div kjButtonGroup>
|
|
92
|
-
<button kjButton>Save</button>
|
|
93
|
-
<button kjButton>Cancel</button>
|
|
94
|
-
</div>`,
|
|
95
|
-
{ imports: [KjButtonGroup, KjButton] },
|
|
96
|
-
);
|
|
97
|
-
expect(await axe(container)).toHaveNoViolations();
|
|
98
|
-
});
|
|
99
|
-
});
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { Directive, Signal, booleanAttribute, input } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
KJ_BUTTON_GROUP,
|
|
4
|
-
KjButtonGroupContext,
|
|
5
|
-
KjButtonGroupOrientation,
|
|
6
|
-
} from './button-group.context';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Coordinates a visually-joined cluster of `KjButton` children. Owns the
|
|
10
|
-
* group's layout role (`role="group"`), orientation, and the per-group
|
|
11
|
-
* variant/size defaults that child buttons read via the `KJ_BUTTON_GROUP`
|
|
12
|
-
* context token (children fall back to the group's value when they don't
|
|
13
|
-
* set their own variant/size).
|
|
14
|
-
*
|
|
15
|
-
* The directive is structural-only: it sets the host role, ARIA orientation,
|
|
16
|
-
* and `data-orientation` attribute used by the wrapper package's segmented
|
|
17
|
-
* styling. It does not own selection state, dropdown wiring, or roving
|
|
18
|
-
* tabindex — keep those in dedicated directives (see `button-group.md`).
|
|
19
|
-
*
|
|
20
|
-
* Disabled propagates: when `kjDisabled` is true, every projected child
|
|
21
|
-
* `KjButton` reads it from the context and OR-s it with its own.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```html
|
|
25
|
-
* <div kjButtonGroup [kjOrientation]="'horizontal'" [kjVariant]="'outline'">
|
|
26
|
-
* <button kjButton>Save</button>
|
|
27
|
-
* <button kjButton>Cancel</button>
|
|
28
|
-
* <button kjButton>Delete</button>
|
|
29
|
-
* </div>
|
|
30
|
-
* ```
|
|
31
|
-
* @doc-category Core/Actions
|
|
32
|
-
* @doc
|
|
33
|
-
* @doc-name button-group
|
|
34
|
-
* @doc-description Unstyled button group that shares variant, size, and disabled defaults across child buttons.
|
|
35
|
-
* @doc-is-main
|
|
36
|
-
*/
|
|
37
|
-
@Directive({
|
|
38
|
-
selector: '[kjButtonGroup]',
|
|
39
|
-
standalone: true,
|
|
40
|
-
exportAs: 'kjButtonGroup',
|
|
41
|
-
providers: [{ provide: KJ_BUTTON_GROUP, useExisting: KjButtonGroup }],
|
|
42
|
-
host: {
|
|
43
|
-
'[attr.role]': '"group"',
|
|
44
|
-
// `role="group"` does not accept `aria-orientation` per WAI-ARIA, so the
|
|
45
|
-
// orientation is only surfaced as a styling hook via `data-orientation`.
|
|
46
|
-
// Roles that *do* take the attribute (e.g. `toolbar`, `radiogroup`) are
|
|
47
|
-
// out of scope for this directive — see `button-group.md` for the
|
|
48
|
-
// dedicated toolbar/radiogroup variants.
|
|
49
|
-
'[attr.data-orientation]': 'kjOrientation()',
|
|
50
|
-
'[attr.data-disabled]': 'kjDisabled() ? "" : null',
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
export class KjButtonGroup implements KjButtonGroupContext {
|
|
54
|
-
/**
|
|
55
|
-
* Layout axis. Drives `aria-orientation` and the `data-orientation`
|
|
56
|
-
* styling hook used by the wrapper package's CSS.
|
|
57
|
-
* @default 'horizontal'
|
|
58
|
-
*/
|
|
59
|
-
readonly kjOrientation = input<KjButtonGroupOrientation>('horizontal');
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Default variant forwarded to children via `KJ_BUTTON_GROUP`. Children
|
|
63
|
-
* that set their own `kjVariant` override this; children that don't read
|
|
64
|
-
* the group's value as a fallback.
|
|
65
|
-
*/
|
|
66
|
-
readonly kjVariant = input<string | undefined>(undefined);
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Default size forwarded to children via `KJ_BUTTON_GROUP`. Per-child
|
|
70
|
-
* overrides win.
|
|
71
|
-
*/
|
|
72
|
-
readonly kjSize = input<string | undefined>(undefined);
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Group-level disabled flag. OR-ed with each child button's own
|
|
76
|
-
* `kjDisabled` — if either is `true` the child is disabled.
|
|
77
|
-
*/
|
|
78
|
-
readonly kjDisabled = input(false, { transform: booleanAttribute });
|
|
79
|
-
|
|
80
|
-
/** Read-only context view — exposed for the wrapper / spec ergonomics. */
|
|
81
|
-
get orientation(): Signal<KjButtonGroupOrientation> {
|
|
82
|
-
return this.kjOrientation;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/** Read-only context view. */
|
|
86
|
-
get variant(): Signal<string | undefined> {
|
|
87
|
-
return this.kjVariant;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
/** Read-only context view. */
|
|
91
|
-
get size(): Signal<string | undefined> {
|
|
92
|
-
return this.kjSize;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
/** Read-only context view. */
|
|
96
|
-
get disabled(): Signal<boolean> {
|
|
97
|
-
return this.kjDisabled;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { DOCUMENT, isPlatformBrowser } from '@angular/common';
|
|
2
|
-
import {
|
|
3
|
-
Directive,
|
|
4
|
-
ElementRef,
|
|
5
|
-
PLATFORM_ID,
|
|
6
|
-
computed,
|
|
7
|
-
effect,
|
|
8
|
-
inject,
|
|
9
|
-
input,
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import { formatDateLong, isSameDay, isSameMonth } from './date-utils';
|
|
12
|
-
import { KJ_CALENDAR } from './calendar.context';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* A single day cell in the calendar grid. Apply to a `<button>` (preferred —
|
|
16
|
-
* native focusability) or a `<td>` containing a `<button>`. Exposes the
|
|
17
|
-
* computed flags `isSelected`, `isToday`, `isDisabled`, `isOutsideMonth` as
|
|
18
|
-
* `data-*` attributes so themes paint without re-deriving them.
|
|
19
|
-
*
|
|
20
|
-
* Roving `tabindex`: only the cell whose date matches `focusedDate()` carries
|
|
21
|
-
* `tabindex="0"`; all others are `tabindex="-1"`. Clicking a cell calls
|
|
22
|
-
* `selectDate()` on the context.
|
|
23
|
-
*
|
|
24
|
-
* The host's `aria-label` is auto-set to a locale-aware long form
|
|
25
|
-
* (`"Tuesday, April 15, 2025"`) for SR clarity. Visible text is the
|
|
26
|
-
* day-of-month only (consumer renders `{{ day.dayNumber() }}`).
|
|
27
|
-
*
|
|
28
|
-
* @doc-category Core/Data input
|
|
29
|
-
* @doc
|
|
30
|
-
* @doc-name calendar
|
|
31
|
-
*/
|
|
32
|
-
@Directive({
|
|
33
|
-
selector: '[kjCalendarDay]',
|
|
34
|
-
standalone: true,
|
|
35
|
-
exportAs: 'kjCalendarDay',
|
|
36
|
-
host: {
|
|
37
|
-
'role': 'gridcell',
|
|
38
|
-
'type': 'button',
|
|
39
|
-
'[attr.aria-label]': 'ariaLabel()',
|
|
40
|
-
'[attr.aria-selected]': 'isSelected() ? "true" : null',
|
|
41
|
-
'[attr.aria-current]': 'isToday() ? "date" : null',
|
|
42
|
-
'[attr.aria-disabled]': 'isDisabled() ? "true" : null',
|
|
43
|
-
'[attr.tabindex]': 'isFocused() ? "0" : "-1"',
|
|
44
|
-
'[attr.disabled]': 'isDisabled() ? "" : null',
|
|
45
|
-
'[attr.data-selected]': 'isSelected() ? "" : null',
|
|
46
|
-
'[attr.data-today]': 'isToday() ? "" : null',
|
|
47
|
-
'[attr.data-disabled]': 'isDisabled() ? "" : null',
|
|
48
|
-
'[attr.data-outside-month]': 'isOutsideMonth() ? "" : null',
|
|
49
|
-
'(click)': 'onClick($event)',
|
|
50
|
-
},
|
|
51
|
-
})
|
|
52
|
-
export class KjCalendarDay {
|
|
53
|
-
private readonly ctx = inject(KJ_CALENDAR);
|
|
54
|
-
private readonly el = inject<ElementRef<HTMLElement>>(ElementRef);
|
|
55
|
-
private readonly platformId = inject(PLATFORM_ID);
|
|
56
|
-
private readonly doc = inject(DOCUMENT);
|
|
57
|
-
|
|
58
|
-
/** The date this cell represents. */
|
|
59
|
-
readonly kjDate = input.required<Date>();
|
|
60
|
-
|
|
61
|
-
readonly isSelected = computed(() => {
|
|
62
|
-
const v = this.ctx.value();
|
|
63
|
-
return !!v && isSameDay(v, this.kjDate());
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
readonly isToday = computed(() => isSameDay(this.kjDate(), new Date()));
|
|
67
|
-
|
|
68
|
-
readonly isDisabled = computed(() => this.ctx.isDisabled(this.kjDate()));
|
|
69
|
-
|
|
70
|
-
readonly isFocused = computed(() => isSameDay(this.kjDate(), this.ctx.focusedDate()));
|
|
71
|
-
|
|
72
|
-
readonly isOutsideMonth = computed(
|
|
73
|
-
() => !isSameMonth(this.kjDate(), this.ctx.focusedDate()),
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
readonly ariaLabel = computed(() => formatDateLong(this.kjDate(), this.ctx.locale()));
|
|
77
|
-
|
|
78
|
-
/** Day-of-month number for the visible text. */
|
|
79
|
-
readonly dayNumber = computed(() => this.kjDate().getDate());
|
|
80
|
-
|
|
81
|
-
constructor() {
|
|
82
|
-
// Whenever this cell becomes the focused one, request focus.
|
|
83
|
-
effect(() => {
|
|
84
|
-
if (!isPlatformBrowser(this.platformId)) return;
|
|
85
|
-
if (this.isFocused() && this.doc.activeElement !== this.el.nativeElement) {
|
|
86
|
-
// Defer so the DOM has the new tabindex.
|
|
87
|
-
queueMicrotask(() => {
|
|
88
|
-
if (this.isFocused()) {
|
|
89
|
-
try { this.el.nativeElement.focus({ preventScroll: true }); } catch { /* noop */ }
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
/** @internal */
|
|
97
|
-
onClick(event: MouseEvent): void {
|
|
98
|
-
event.preventDefault();
|
|
99
|
-
if (this.isDisabled()) return;
|
|
100
|
-
this.ctx.selectDate(this.kjDate());
|
|
101
|
-
}
|
|
102
|
-
}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { Directive, computed, inject } from '@angular/core';
|
|
2
|
-
import {
|
|
3
|
-
buildMonthMatrix,
|
|
4
|
-
weekdayLongNames,
|
|
5
|
-
weekdayShortNames,
|
|
6
|
-
} from './date-utils';
|
|
7
|
-
import { KJ_CALENDAR } from './calendar.context';
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Calendar grid directive. Hosts the `<table role="grid">` and exposes the
|
|
11
|
-
* 6×7 day matrix plus locale-aware weekday headers. The `(keydown)` handler
|
|
12
|
-
* implements the APG keyboard contract — see `KjCalendar` for the full key
|
|
13
|
-
* map.
|
|
14
|
-
*
|
|
15
|
-
* @doc-category Core/Data input
|
|
16
|
-
* @doc
|
|
17
|
-
* @doc-name calendar
|
|
18
|
-
*/
|
|
19
|
-
@Directive({
|
|
20
|
-
selector: '[kjCalendarGrid]',
|
|
21
|
-
standalone: true,
|
|
22
|
-
exportAs: 'kjCalendarGrid',
|
|
23
|
-
host: {
|
|
24
|
-
'role': 'grid',
|
|
25
|
-
'[attr.aria-labelledby]': 'ctx.captionId()',
|
|
26
|
-
'(keydown)': 'onKeydown($event)',
|
|
27
|
-
},
|
|
28
|
-
})
|
|
29
|
-
export class KjCalendarGrid {
|
|
30
|
-
/** @internal */
|
|
31
|
-
readonly ctx = inject(KJ_CALENDAR);
|
|
32
|
-
|
|
33
|
-
/** 6 weeks × 7 days for the focused month. */
|
|
34
|
-
readonly weeks = computed(() =>
|
|
35
|
-
buildMonthMatrix(this.ctx.focusedDate(), this.ctx.firstDayOfWeek()),
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
/** Localised short weekday names (`['Sun','Mon',…]`). */
|
|
39
|
-
readonly weekdayShort = computed(() =>
|
|
40
|
-
weekdayShortNames(this.ctx.locale(), this.ctx.firstDayOfWeek()),
|
|
41
|
-
);
|
|
42
|
-
|
|
43
|
-
/** Localised long weekday names (used for `<th abbr>`). */
|
|
44
|
-
readonly weekdayLong = computed(() =>
|
|
45
|
-
weekdayLongNames(this.ctx.locale(), this.ctx.firstDayOfWeek()),
|
|
46
|
-
);
|
|
47
|
-
|
|
48
|
-
/** @internal — APG keyboard contract for the grid. */
|
|
49
|
-
onKeydown(event: KeyboardEvent): void {
|
|
50
|
-
if (this.ctx.disabled()) return;
|
|
51
|
-
const key = event.key;
|
|
52
|
-
let handled = true;
|
|
53
|
-
switch (key) {
|
|
54
|
-
case 'ArrowLeft':
|
|
55
|
-
this.ctx.moveFocus('day', -1);
|
|
56
|
-
break;
|
|
57
|
-
case 'ArrowRight':
|
|
58
|
-
this.ctx.moveFocus('day', 1);
|
|
59
|
-
break;
|
|
60
|
-
case 'ArrowUp':
|
|
61
|
-
this.ctx.moveFocus('week', -1);
|
|
62
|
-
break;
|
|
63
|
-
case 'ArrowDown':
|
|
64
|
-
this.ctx.moveFocus('week', 1);
|
|
65
|
-
break;
|
|
66
|
-
case 'Home':
|
|
67
|
-
this.ctx.moveFocusToWeekBoundary('start');
|
|
68
|
-
break;
|
|
69
|
-
case 'End':
|
|
70
|
-
this.ctx.moveFocusToWeekBoundary('end');
|
|
71
|
-
break;
|
|
72
|
-
case 'PageUp':
|
|
73
|
-
this.ctx.moveFocus(event.shiftKey ? 'year' : 'month', -1);
|
|
74
|
-
break;
|
|
75
|
-
case 'PageDown':
|
|
76
|
-
this.ctx.moveFocus(event.shiftKey ? 'year' : 'month', 1);
|
|
77
|
-
break;
|
|
78
|
-
case 'Enter':
|
|
79
|
-
case ' ':
|
|
80
|
-
this.ctx.selectDate(this.ctx.focusedDate());
|
|
81
|
-
break;
|
|
82
|
-
default:
|
|
83
|
-
handled = false;
|
|
84
|
-
}
|
|
85
|
-
if (handled) {
|
|
86
|
-
event.preventDefault();
|
|
87
|
-
event.stopPropagation();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Directive, computed, inject } from '@angular/core';
|
|
2
|
-
import { addMonths, formatMonthYear } from './date-utils';
|
|
3
|
-
import { KJ_CALENDAR } from './calendar.context';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Calendar header directive. Carries the auto-minted caption id so the grid's
|
|
7
|
-
* `aria-labelledby` resolves automatically. Exposes computed `label` for the
|
|
8
|
-
* caption text (locale-aware "April 2025") and `prev` / `next` methods that
|
|
9
|
-
* advance the focused date by ±1 month.
|
|
10
|
-
*
|
|
11
|
-
* Buttons inside the header are the consumer's responsibility — wire
|
|
12
|
-
* `(click)="header.prev()"` and `(click)="header.next()"` and read
|
|
13
|
-
* `header.label()` for the caption text.
|
|
14
|
-
*
|
|
15
|
-
* @doc-category Core/Data input
|
|
16
|
-
* @doc
|
|
17
|
-
* @doc-name calendar
|
|
18
|
-
*/
|
|
19
|
-
@Directive({
|
|
20
|
-
selector: '[kjCalendarHeader]',
|
|
21
|
-
standalone: true,
|
|
22
|
-
exportAs: 'kjCalendarHeader',
|
|
23
|
-
})
|
|
24
|
-
export class KjCalendarHeader {
|
|
25
|
-
private readonly ctx = inject(KJ_CALENDAR);
|
|
26
|
-
|
|
27
|
-
/** The id assigned to the header caption (mirror onto the caption's `id`). */
|
|
28
|
-
readonly captionId = this.ctx.captionId;
|
|
29
|
-
|
|
30
|
-
/** Locale-aware caption text — e.g. `"April 2025"`. */
|
|
31
|
-
readonly label = computed(() =>
|
|
32
|
-
formatMonthYear(this.ctx.focusedDate(), this.ctx.locale()),
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
/** Whether the previous-month button should be disabled (out-of-bounds month). */
|
|
36
|
-
readonly prevDisabled = computed(() => {
|
|
37
|
-
const min = this.ctx.minDate();
|
|
38
|
-
if (!min) return false;
|
|
39
|
-
const prevMonth = addMonths(this.ctx.focusedDate(), -1);
|
|
40
|
-
// Disabled when the last day of the prev month is < min.
|
|
41
|
-
const lastOfPrev = new Date(prevMonth.getFullYear(), prevMonth.getMonth() + 1, 0);
|
|
42
|
-
return lastOfPrev.getTime() < min.getTime();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
/** Whether the next-month button should be disabled. */
|
|
46
|
-
readonly nextDisabled = computed(() => {
|
|
47
|
-
const max = this.ctx.maxDate();
|
|
48
|
-
if (!max) return false;
|
|
49
|
-
const nextMonth = addMonths(this.ctx.focusedDate(), 1);
|
|
50
|
-
const firstOfNext = new Date(nextMonth.getFullYear(), nextMonth.getMonth(), 1);
|
|
51
|
-
return firstOfNext.getTime() > max.getTime();
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
/** Move focus to the previous month (same day-of-month, clamped). */
|
|
55
|
-
prev(): void {
|
|
56
|
-
if (this.prevDisabled()) return;
|
|
57
|
-
this.ctx.moveFocus('month', -1);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/** Move focus to the next month. */
|
|
61
|
-
next(): void {
|
|
62
|
-
if (this.nextDisabled()) return;
|
|
63
|
-
this.ctx.moveFocus('month', 1);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, type Signal, type WritableSignal } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Shared state contract for the Calendar family. Implemented by `KjCalendar`
|
|
5
|
-
* and consumed by `KjCalendarHeader`, `KjCalendarGrid`, and `KjCalendarDay`
|
|
6
|
-
* via DI. Headless directives never read each other's inputs directly — they
|
|
7
|
-
* always go through this context.
|
|
8
|
-
*
|
|
9
|
-
* @doc-category Core/Data input
|
|
10
|
-
*/
|
|
11
|
-
export interface KjCalendarContext {
|
|
12
|
-
/** Locale BCP-47 tag (e.g. `'en-US'`, `'fr-FR'`). Drives weekday and month names. */
|
|
13
|
-
readonly locale: Signal<string>;
|
|
14
|
-
|
|
15
|
-
/** Current selection. `null` when nothing is selected. */
|
|
16
|
-
readonly value: Signal<Date | null>;
|
|
17
|
-
|
|
18
|
-
/** The "active" date — the cell that owns `tabindex=0`. Drives keyboard focus. */
|
|
19
|
-
readonly focusedDate: WritableSignal<Date>;
|
|
20
|
-
|
|
21
|
-
/** Earliest selectable date (inclusive). `null` = open. */
|
|
22
|
-
readonly minDate: Signal<Date | null>;
|
|
23
|
-
|
|
24
|
-
/** Latest selectable date (inclusive). `null` = open. */
|
|
25
|
-
readonly maxDate: Signal<Date | null>;
|
|
26
|
-
|
|
27
|
-
/** Per-date predicate; `false` blocks selection / focus. */
|
|
28
|
-
readonly disabledDates: Signal<((date: Date) => boolean) | null>;
|
|
29
|
-
|
|
30
|
-
/** First day of the week (0=Sun … 6=Sat). Locale-derived if undefined. */
|
|
31
|
-
readonly firstDayOfWeek: Signal<number>;
|
|
32
|
-
|
|
33
|
-
/** Whether the entire calendar is disabled. */
|
|
34
|
-
readonly disabled: Signal<boolean>;
|
|
35
|
-
|
|
36
|
-
/** Auto-minted id of the header caption — used for `aria-labelledby` on the grid. */
|
|
37
|
-
readonly captionId: Signal<string>;
|
|
38
|
-
|
|
39
|
-
/** Combined disabled predicate (min/max/filter/global disabled). */
|
|
40
|
-
isDisabled(date: Date): boolean;
|
|
41
|
-
|
|
42
|
-
/** Selects a date. No-op if disabled. */
|
|
43
|
-
selectDate(date: Date): void;
|
|
44
|
-
|
|
45
|
-
/** Moves the focused date by `delta` of the given unit, skipping disabled dates. */
|
|
46
|
-
moveFocus(unit: 'day' | 'week' | 'month' | 'year', delta: number): void;
|
|
47
|
-
|
|
48
|
-
/** Snaps focus to the start or end of the focused week. */
|
|
49
|
-
moveFocusToWeekBoundary(boundary: 'start' | 'end'): void;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
/** DI token for the Calendar context. */
|
|
53
|
-
export const KJ_CALENDAR = new InjectionToken<KjCalendarContext>('KjCalendar');
|