@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,103 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
-
import { KjPopoverTrigger } from '../popover-trigger';
|
|
3
|
-
import { KjPopoverContent } from '../popover-content';
|
|
4
|
-
import { KjPopoverTitle } from '../popover-title';
|
|
5
|
-
import { KjPopoverClose } from '../popover-close';
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
selector: 'kj-example-popover-retro',
|
|
9
|
-
standalone: true,
|
|
10
|
-
imports: [KjPopoverTrigger, KjPopoverContent, KjPopoverTitle, KjPopoverClose],
|
|
11
|
-
styleUrls: ['../../styles/docs-themes.css'],
|
|
12
|
-
host: { class: 'kj-theme-retro' },
|
|
13
|
-
styles: [
|
|
14
|
-
`
|
|
15
|
-
:host {
|
|
16
|
-
display: flex;
|
|
17
|
-
align-items: flex-start;
|
|
18
|
-
justify-content: center;
|
|
19
|
-
padding: 3rem 2rem 10rem;
|
|
20
|
-
background: var(--kj-bg);
|
|
21
|
-
font-family: var(--kj-font);
|
|
22
|
-
min-height: 220px;
|
|
23
|
-
color: var(--kj-text);
|
|
24
|
-
}
|
|
25
|
-
button {
|
|
26
|
-
padding: 0.4rem 1rem;
|
|
27
|
-
font-family: var(--kj-font);
|
|
28
|
-
font-size: 0.8rem;
|
|
29
|
-
font-weight: 700;
|
|
30
|
-
letter-spacing: 0.06em;
|
|
31
|
-
text-transform: uppercase;
|
|
32
|
-
background: var(--kj-surface);
|
|
33
|
-
color: var(--kj-text);
|
|
34
|
-
border: var(--kj-btn-border);
|
|
35
|
-
border-radius: 0;
|
|
36
|
-
cursor: pointer;
|
|
37
|
-
box-shadow: var(--kj-shadow-sm);
|
|
38
|
-
transition: var(--kj-transition);
|
|
39
|
-
}
|
|
40
|
-
button:hover {
|
|
41
|
-
transform: translate(-1px, -1px);
|
|
42
|
-
box-shadow: var(--kj-shadow-md);
|
|
43
|
-
}
|
|
44
|
-
kj-popover-content {
|
|
45
|
-
display: block;
|
|
46
|
-
z-index: 20;
|
|
47
|
-
background: var(--kj-bg);
|
|
48
|
-
border: var(--kj-btn-border);
|
|
49
|
-
box-shadow: var(--kj-shadow-hard);
|
|
50
|
-
padding: 1rem;
|
|
51
|
-
min-width: 14rem;
|
|
52
|
-
font-family: var(--kj-font);
|
|
53
|
-
}
|
|
54
|
-
.popover-title {
|
|
55
|
-
font-size: 0.75rem;
|
|
56
|
-
font-weight: 700;
|
|
57
|
-
text-transform: uppercase;
|
|
58
|
-
letter-spacing: 0.08em;
|
|
59
|
-
margin: 0 0 0.5rem;
|
|
60
|
-
border-bottom: var(--kj-btn-border);
|
|
61
|
-
padding-bottom: 0.375rem;
|
|
62
|
-
color: var(--kj-text);
|
|
63
|
-
}
|
|
64
|
-
.popover-body {
|
|
65
|
-
font-size: 0.75rem;
|
|
66
|
-
color: var(--kj-text-muted);
|
|
67
|
-
margin: 0.5rem 0 1rem;
|
|
68
|
-
line-height: 1.6;
|
|
69
|
-
}
|
|
70
|
-
.popover-footer {
|
|
71
|
-
display: flex;
|
|
72
|
-
justify-content: flex-end;
|
|
73
|
-
gap: 0.5rem;
|
|
74
|
-
}
|
|
75
|
-
.popover-footer button {
|
|
76
|
-
padding: 0.3rem 0.75rem;
|
|
77
|
-
font-size: 0.7rem;
|
|
78
|
-
box-shadow: var(--kj-shadow-sm);
|
|
79
|
-
}
|
|
80
|
-
.popover-footer button:hover {
|
|
81
|
-
box-shadow: var(--kj-shadow-md);
|
|
82
|
-
}
|
|
83
|
-
.btn-primary {
|
|
84
|
-
background: var(--kj-accent);
|
|
85
|
-
color: var(--kj-accent-on);
|
|
86
|
-
border-color: var(--kj-border);
|
|
87
|
-
}
|
|
88
|
-
`,
|
|
89
|
-
],
|
|
90
|
-
changeDetection: ChangeDetectionStrategy.Eager,
|
|
91
|
-
template: `
|
|
92
|
-
<button kjPopoverTrigger #t="kjPopoverTrigger">Settings</button>
|
|
93
|
-
<kj-popover-content [kjFor]="t">
|
|
94
|
-
<h3 kjPopoverTitle class="popover-title">Notifications</h3>
|
|
95
|
-
<p class="popover-body">Configure notification frequency and delivery preferences.</p>
|
|
96
|
-
<div class="popover-footer">
|
|
97
|
-
<button kjPopoverClose>Cancel</button>
|
|
98
|
-
<button kjPopoverClose class="btn-primary">Save</button>
|
|
99
|
-
</div>
|
|
100
|
-
</kj-popover-content>
|
|
101
|
-
`,
|
|
102
|
-
})
|
|
103
|
-
export class PopoverRetroExample {}
|
package/src/popover/index.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Directive } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Optional decorative arrow rendered inside `[kjPopoverContent]`.
|
|
5
|
-
*
|
|
6
|
-
* Pure styling hook — has no behaviour. Consumer CSS reads `data-side` from
|
|
7
|
-
* the parent panel host (set by the position strategy) to position and
|
|
8
|
-
* rotate the arrow. `aria-hidden="true"` keeps it out of the AT tree
|
|
9
|
-
* (matches `KjTooltipArrow`).
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```html
|
|
13
|
-
* <kj-popover-content [kjFor]="t">
|
|
14
|
-
* <h3 kjPopoverTitle>Profile</h3>
|
|
15
|
-
* <span kjPopoverArrow></span>
|
|
16
|
-
* </kj-popover-content>
|
|
17
|
-
* ```
|
|
18
|
-
*
|
|
19
|
-
* @doc-category Core/Overlay
|
|
20
|
-
*/
|
|
21
|
-
@Directive({
|
|
22
|
-
selector: '[kjPopoverArrow]',
|
|
23
|
-
standalone: true,
|
|
24
|
-
host: {
|
|
25
|
-
'class': 'kj-popover-arrow',
|
|
26
|
-
'aria-hidden': 'true',
|
|
27
|
-
'data-kj-popover-arrow': '',
|
|
28
|
-
},
|
|
29
|
-
})
|
|
30
|
-
export class KjPopoverArrow {}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Directive, inject } from '@angular/core';
|
|
2
|
-
import { KjOverlayController } from '../primitives/overlay/controller';
|
|
3
|
-
import { KjOverlayPanel } from '../primitives/overlay/panel';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Convenience close button. Place inside a `[kjPopoverContent]` panel.
|
|
7
|
-
* Calls the overlay controller's `close('programmatic')` on click.
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```html
|
|
11
|
-
* <kj-popover-content [kjFor]="t">
|
|
12
|
-
* …
|
|
13
|
-
* <button kjPopoverClose>Close</button>
|
|
14
|
-
* </kj-popover-content>
|
|
15
|
-
* ```
|
|
16
|
-
*
|
|
17
|
-
* @doc-category Core/Overlay
|
|
18
|
-
*/
|
|
19
|
-
@Directive({
|
|
20
|
-
selector: '[kjPopoverClose]',
|
|
21
|
-
standalone: true,
|
|
22
|
-
host: {
|
|
23
|
-
'(click)': 'onClick($event)',
|
|
24
|
-
},
|
|
25
|
-
})
|
|
26
|
-
export class KjPopoverClose {
|
|
27
|
-
private readonly _panel = inject(KjOverlayPanel, { optional: true });
|
|
28
|
-
private get controller(): KjOverlayController | null {
|
|
29
|
-
return this._panel?.controller ?? null;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
protected onClick(event: MouseEvent): void {
|
|
33
|
-
event.stopPropagation();
|
|
34
|
-
this.controller?.close('programmatic');
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy, ViewEncapsulation, booleanAttribute, inject, input } from '@angular/core';
|
|
2
|
-
import { KjOverlayPanel } from '../primitives/overlay/panel';
|
|
3
|
-
import {
|
|
4
|
-
KJ_OVERLAY_MOUNT_STRATEGY,
|
|
5
|
-
KJ_OVERLAY_POSITION_STRATEGY,
|
|
6
|
-
KJ_OVERLAY_FOCUS_TRAP_STRATEGY,
|
|
7
|
-
KJ_OVERLAY_PANEL_ROLE,
|
|
8
|
-
} from '../primitives/overlay/tokens';
|
|
9
|
-
import type { KjSide, KjAlign } from '../primitives/overlay/types';
|
|
10
|
-
import { bodyPortal } from '../primitives/overlay/strategies/mount/body-portal';
|
|
11
|
-
import { anchoredTo } from '../primitives/overlay/strategies/position/anchored-to';
|
|
12
|
-
import { tabCycle } from '../primitives/overlay/strategies/focus-trap/tab-cycle';
|
|
13
|
-
|
|
14
|
-
@Component({
|
|
15
|
-
selector: 'kj-popover-content',
|
|
16
|
-
standalone: true,
|
|
17
|
-
hostDirectives: [{ directive: KjOverlayPanel, inputs: ['kjFor'] }],
|
|
18
|
-
providers: [
|
|
19
|
-
{ provide: KJ_OVERLAY_PANEL_ROLE, useValue: 'dialog' as const },
|
|
20
|
-
{ provide: KJ_OVERLAY_MOUNT_STRATEGY, useFactory: () => bodyPortal() },
|
|
21
|
-
{ provide: KJ_OVERLAY_POSITION_STRATEGY, useFactory: () => anchoredTo() },
|
|
22
|
-
{ provide: KJ_OVERLAY_FOCUS_TRAP_STRATEGY, useFactory: () => tabCycle({ returnFocus: true }) },
|
|
23
|
-
],
|
|
24
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
25
|
-
encapsulation: ViewEncapsulation.None,
|
|
26
|
-
host: { class: 'kj-popover-content' },
|
|
27
|
-
template: `<ng-content />`,
|
|
28
|
-
})
|
|
29
|
-
export class KjPopoverContent {
|
|
30
|
-
readonly kjSide = input<KjSide>('bottom');
|
|
31
|
-
readonly kjAlign = input<KjAlign>('center');
|
|
32
|
-
readonly kjOffset = input<number, unknown>(8, { transform: (v) => Number(v) || 8 });
|
|
33
|
-
readonly kjTrap = input(false, { transform: booleanAttribute });
|
|
34
|
-
|
|
35
|
-
constructor() {
|
|
36
|
-
const pos = inject(KJ_OVERLAY_POSITION_STRATEGY) as ReturnType<typeof anchoredTo>;
|
|
37
|
-
pos.configure({ side: this.kjSide, align: this.kjAlign, offset: this.kjOffset });
|
|
38
|
-
const trap = inject(KJ_OVERLAY_FOCUS_TRAP_STRATEGY) as ReturnType<typeof tabCycle>;
|
|
39
|
-
trap.configure({ enabled: () => this.kjTrap() });
|
|
40
|
-
}
|
|
41
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { Directive } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
let _popoverTitleIdCounter = 0;
|
|
4
|
-
/** Allocate a stable id used for the panel's `aria-labelledby`. */
|
|
5
|
-
export function nextPopoverTitleId(): string {
|
|
6
|
-
return `kj-popover-title-${++_popoverTitleIdCounter}`;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Marks the heading element inside the popover content. Generates a stable
|
|
11
|
-
* id so consumer code (or a future panel-level hook) can wire
|
|
12
|
-
* `aria-labelledby`.
|
|
13
|
-
*
|
|
14
|
-
* Mirrors `KjDialogTitle` in the dialog family — applied to whatever heading
|
|
15
|
-
* level the consumer's information architecture wants (`<h2>` … `<h4>`),
|
|
16
|
-
* the directive does not override `role`.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```html
|
|
20
|
-
* <kj-popover-content [kjFor]="t">
|
|
21
|
-
* <h2 kjPopoverTitle>Profile settings</h2>
|
|
22
|
-
* …
|
|
23
|
-
* </kj-popover-content>
|
|
24
|
-
* ```
|
|
25
|
-
*
|
|
26
|
-
* @doc-category Core/Overlay
|
|
27
|
-
*/
|
|
28
|
-
@Directive({
|
|
29
|
-
selector: '[kjPopoverTitle]',
|
|
30
|
-
standalone: true,
|
|
31
|
-
host: {
|
|
32
|
-
'class': 'kj-popover-title',
|
|
33
|
-
'[attr.id]': 'titleId',
|
|
34
|
-
},
|
|
35
|
-
})
|
|
36
|
-
export class KjPopoverTitle {
|
|
37
|
-
/** Auto-generated id used for the panel's `aria-labelledby`. */
|
|
38
|
-
readonly titleId = nextPopoverTitleId();
|
|
39
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { Directive, booleanAttribute, inject, input } from '@angular/core';
|
|
2
|
-
import { KjOverlayTrigger } from '../primitives/overlay/trigger';
|
|
3
|
-
import type { KjOverlayPanel } from '../primitives/overlay/panel';
|
|
4
|
-
import { KjOverlayController } from '../primitives/overlay/controller';
|
|
5
|
-
import {
|
|
6
|
-
KJ_OVERLAY_TRIGGER_EVENT_STRATEGY,
|
|
7
|
-
KJ_OVERLAY_PANEL_ROLE,
|
|
8
|
-
} from '../primitives/overlay/tokens';
|
|
9
|
-
import { onClick } from '../primitives/overlay/strategies/trigger-event/on-click';
|
|
10
|
-
|
|
11
|
-
export type KjPopoverTriggerKind = 'click' | 'hover';
|
|
12
|
-
|
|
13
|
-
@Directive({
|
|
14
|
-
selector: '[kjPopoverTrigger]',
|
|
15
|
-
exportAs: 'kjPopoverTrigger',
|
|
16
|
-
standalone: true,
|
|
17
|
-
hostDirectives: [{ directive: KjOverlayTrigger, inputs: ['kjOpen'] }],
|
|
18
|
-
providers: [
|
|
19
|
-
KjOverlayController,
|
|
20
|
-
// For an MVP we resolve at construction; reactive switch is a follow-up.
|
|
21
|
-
{
|
|
22
|
-
provide: KJ_OVERLAY_TRIGGER_EVENT_STRATEGY,
|
|
23
|
-
useFactory: () => onClick(),
|
|
24
|
-
},
|
|
25
|
-
{ provide: KJ_OVERLAY_PANEL_ROLE, useValue: 'dialog' as const },
|
|
26
|
-
],
|
|
27
|
-
})
|
|
28
|
-
export class KjPopoverTrigger {
|
|
29
|
-
readonly kjTrigger = input<KjPopoverTriggerKind>('click');
|
|
30
|
-
readonly kjDisabled = input(false, { transform: booleanAttribute });
|
|
31
|
-
|
|
32
|
-
private readonly _overlayTrigger = inject(KjOverlayTrigger, { self: true });
|
|
33
|
-
/** The controller of the composed `KjOverlayTrigger`, exposed for sibling `[kjFor]` panels. */
|
|
34
|
-
get controller(): KjOverlayController {
|
|
35
|
-
return this._overlayTrigger.controller;
|
|
36
|
-
}
|
|
37
|
-
attachPanel(panel: KjOverlayPanel): void {
|
|
38
|
-
this._overlayTrigger.attachPanel(panel);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Component } from '@angular/core';
|
|
2
|
-
import { render } from '@testing-library/angular';
|
|
3
|
-
import { describe, it, expect } from 'vitest';
|
|
4
|
-
import { KjPopoverTrigger } from './popover-trigger';
|
|
5
|
-
import { KjPopoverContent } from './popover-content';
|
|
6
|
-
|
|
7
|
-
describe('KjPopover', () => {
|
|
8
|
-
it('trigger has aria-haspopup=dialog and aria-expanded=false initially', async () => {
|
|
9
|
-
@Component({
|
|
10
|
-
selector: 'kj-pop-host',
|
|
11
|
-
standalone: true,
|
|
12
|
-
imports: [KjPopoverTrigger, KjPopoverContent],
|
|
13
|
-
template: `
|
|
14
|
-
<button kjPopoverTrigger #t="kjPopoverTrigger">Open</button>
|
|
15
|
-
<kj-popover-content [kjFor]="t">Hi</kj-popover-content>
|
|
16
|
-
`,
|
|
17
|
-
})
|
|
18
|
-
class Host {}
|
|
19
|
-
const { container } = await render(Host);
|
|
20
|
-
const btn = container.querySelector('button')!;
|
|
21
|
-
expect(btn.getAttribute('aria-haspopup')).toBe('dialog');
|
|
22
|
-
expect(btn.getAttribute('aria-expanded')).toBe('false');
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('panel has role=dialog and is hidden initially', async () => {
|
|
26
|
-
@Component({
|
|
27
|
-
selector: 'kj-pop-host',
|
|
28
|
-
standalone: true,
|
|
29
|
-
imports: [KjPopoverTrigger, KjPopoverContent],
|
|
30
|
-
template: `
|
|
31
|
-
<button kjPopoverTrigger #t="kjPopoverTrigger">Open</button>
|
|
32
|
-
<kj-popover-content [kjFor]="t">Hi</kj-popover-content>
|
|
33
|
-
`,
|
|
34
|
-
})
|
|
35
|
-
class Host {}
|
|
36
|
-
const { container } = await render(Host);
|
|
37
|
-
const panel = container.querySelector('kj-popover-content') as HTMLElement;
|
|
38
|
-
expect(panel.getAttribute('role')).toBe('dialog');
|
|
39
|
-
expect(panel.hasAttribute('hidden')).toBe(true);
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
it('kjTrigger="hover" keeps role=dialog and aria-haspopup=dialog', async () => {
|
|
43
|
-
@Component({
|
|
44
|
-
selector: 'kj-pop-host',
|
|
45
|
-
standalone: true,
|
|
46
|
-
imports: [KjPopoverTrigger, KjPopoverContent],
|
|
47
|
-
template: `
|
|
48
|
-
<button kjPopoverTrigger kjTrigger="hover" #t="kjPopoverTrigger">Open</button>
|
|
49
|
-
<kj-popover-content [kjFor]="t">Hi</kj-popover-content>
|
|
50
|
-
`,
|
|
51
|
-
})
|
|
52
|
-
class Host {}
|
|
53
|
-
const { container } = await render(Host);
|
|
54
|
-
const btn = container.querySelector('button')!;
|
|
55
|
-
const panel = container.querySelector('kj-popover-content') as HTMLElement;
|
|
56
|
-
expect(btn.getAttribute('aria-haspopup')).toBe('dialog');
|
|
57
|
-
expect(panel.getAttribute('role')).toBe('dialog');
|
|
58
|
-
});
|
|
59
|
-
});
|
package/src/popover/popover.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { InjectionToken } from '@angular/core';
|
|
2
|
-
import { TestBed } from '@angular/core/testing';
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
import { KJ_VARIANT_PRESET } from './variant';
|
|
5
|
-
import { KJ_SIZE_PRESET } from './size';
|
|
6
|
-
import { bindPresets } from './bind-presets';
|
|
7
|
-
|
|
8
|
-
interface DummyConfig {
|
|
9
|
-
variants: string[];
|
|
10
|
-
sizes: string[];
|
|
11
|
-
defaults: { variant: string; size: string };
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const DUMMY_CONFIG = new InjectionToken<DummyConfig>('dummy.config');
|
|
15
|
-
|
|
16
|
-
describe('bindPresets', () => {
|
|
17
|
-
it('translates a config token into KJ_VARIANT_PRESET', () => {
|
|
18
|
-
TestBed.configureTestingModule({
|
|
19
|
-
providers: [
|
|
20
|
-
{
|
|
21
|
-
provide: DUMMY_CONFIG,
|
|
22
|
-
useValue: {
|
|
23
|
-
variants: ['a', 'b'],
|
|
24
|
-
sizes: ['s', 'm'],
|
|
25
|
-
defaults: { variant: 'b', size: 'm' },
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
...bindPresets(DUMMY_CONFIG),
|
|
29
|
-
],
|
|
30
|
-
});
|
|
31
|
-
expect(TestBed.inject(KJ_VARIANT_PRESET)).toEqual({ values: ['a', 'b'], default: 'b' });
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
it('translates a config token into KJ_SIZE_PRESET', () => {
|
|
35
|
-
TestBed.configureTestingModule({
|
|
36
|
-
providers: [
|
|
37
|
-
{
|
|
38
|
-
provide: DUMMY_CONFIG,
|
|
39
|
-
useValue: {
|
|
40
|
-
variants: ['a'],
|
|
41
|
-
sizes: ['s', 'm', 'l'],
|
|
42
|
-
defaults: { variant: 'a', size: 'l' },
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
...bindPresets(DUMMY_CONFIG),
|
|
46
|
-
],
|
|
47
|
-
});
|
|
48
|
-
expect(TestBed.inject(KJ_SIZE_PRESET)).toEqual({ values: ['s', 'm', 'l'], default: 'l' });
|
|
49
|
-
});
|
|
50
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { InjectionToken, Provider, inject } from '@angular/core';
|
|
2
|
-
import { KJ_VARIANT_PRESET } from './variant';
|
|
3
|
-
import { KJ_SIZE_PRESET } from './size';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Generic shape every per-component config must expose to be consumable by
|
|
7
|
-
* `bindPresets`. Consumers free to add fields beyond these.
|
|
8
|
-
*
|
|
9
|
-
* @internal
|
|
10
|
-
*/
|
|
11
|
-
export interface KjBindablePresetConfig {
|
|
12
|
-
variants: string[];
|
|
13
|
-
sizes: string[];
|
|
14
|
-
defaults: { variant: string; size: string };
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Returns providers that translate a per-component config token into the
|
|
19
|
-
* shared preset tokens (`KJ_VARIANT_PRESET`, `KJ_SIZE_PRESET`). Spread into a
|
|
20
|
-
* consumer directive's `providers` array.
|
|
21
|
-
*
|
|
22
|
-
* @internal
|
|
23
|
-
*/
|
|
24
|
-
export function bindPresets<T extends KjBindablePresetConfig>(
|
|
25
|
-
configToken: InjectionToken<T>,
|
|
26
|
-
): Provider[] {
|
|
27
|
-
return [
|
|
28
|
-
{
|
|
29
|
-
provide: KJ_VARIANT_PRESET,
|
|
30
|
-
useFactory: () => {
|
|
31
|
-
const c = inject(configToken);
|
|
32
|
-
return { values: c.variants, default: c.defaults.variant };
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
provide: KJ_SIZE_PRESET,
|
|
37
|
-
useFactory: () => {
|
|
38
|
-
const c = inject(configToken);
|
|
39
|
-
return { values: c.sizes, default: c.defaults.size };
|
|
40
|
-
},
|
|
41
|
-
},
|
|
42
|
-
];
|
|
43
|
-
}
|
package/src/presets/index.ts
DELETED
package/src/presets/size.spec.ts
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
-
import { TestBed } from '@angular/core/testing';
|
|
3
|
-
import { render } from '@testing-library/angular';
|
|
4
|
-
import { describe, expect, it, vi, afterEach } from 'vitest';
|
|
5
|
-
import { KJ_SIZE_PRESET, KjSize } from './size';
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [KjSize],
|
|
10
|
-
changeDetection: ChangeDetectionStrategy.Eager,
|
|
11
|
-
template: `<button kjSize [kjSize]="value">x</button>`,
|
|
12
|
-
})
|
|
13
|
-
class HostComponent {
|
|
14
|
-
value: string | undefined = undefined;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
describe('KjSize', () => {
|
|
18
|
-
afterEach(() => vi.restoreAllMocks());
|
|
19
|
-
|
|
20
|
-
it('reflects kjSize input as data-size on the host', async () => {
|
|
21
|
-
const { getByRole } = await render(`<button kjSize [kjSize]="'lg'">x</button>`, {
|
|
22
|
-
imports: [KjSize],
|
|
23
|
-
providers: [{ provide: KJ_SIZE_PRESET, useValue: { values: ['md', 'lg'], default: 'md' } }],
|
|
24
|
-
});
|
|
25
|
-
expect(getByRole('button')).toHaveAttribute('data-size', 'lg');
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('falls back to KJ_SIZE_PRESET.default when input not set', async () => {
|
|
29
|
-
TestBed.configureTestingModule({
|
|
30
|
-
providers: [{ provide: KJ_SIZE_PRESET, useValue: { values: ['xs', 'md'], default: 'md' } }],
|
|
31
|
-
});
|
|
32
|
-
const fixture = TestBed.createComponent(HostComponent);
|
|
33
|
-
fixture.detectChanges();
|
|
34
|
-
const btn = fixture.nativeElement.querySelector('button');
|
|
35
|
-
expect(btn.getAttribute('data-size')).toBe('md');
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('uses the built-in factory default when no provider is registered', async () => {
|
|
39
|
-
const fixture = TestBed.createComponent(HostComponent);
|
|
40
|
-
fixture.detectChanges();
|
|
41
|
-
const btn = fixture.nativeElement.querySelector('button');
|
|
42
|
-
expect(btn.getAttribute('data-size')).toBe('md');
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('warns once in dev mode for an unknown value', async () => {
|
|
46
|
-
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
47
|
-
TestBed.configureTestingModule({
|
|
48
|
-
providers: [{ provide: KJ_SIZE_PRESET, useValue: { values: ['xs', 'md'], default: 'md' } }],
|
|
49
|
-
});
|
|
50
|
-
const fixture = TestBed.createComponent(HostComponent);
|
|
51
|
-
fixture.componentInstance.value = 'bogus';
|
|
52
|
-
fixture.detectChanges();
|
|
53
|
-
expect(warn).toHaveBeenCalledTimes(1);
|
|
54
|
-
expect(warn.mock.calls[0][0]).toMatch(/unknown size/i);
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it('does not warn for a known value', async () => {
|
|
58
|
-
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
59
|
-
TestBed.configureTestingModule({
|
|
60
|
-
providers: [{ provide: KJ_SIZE_PRESET, useValue: { values: ['xs', 'md'], default: 'md' } }],
|
|
61
|
-
});
|
|
62
|
-
const fixture = TestBed.createComponent(HostComponent);
|
|
63
|
-
fixture.componentInstance.value = 'xs';
|
|
64
|
-
fixture.detectChanges();
|
|
65
|
-
expect(warn).not.toHaveBeenCalled();
|
|
66
|
-
});
|
|
67
|
-
});
|
package/src/presets/size.ts
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { Directive, InjectionToken, InputSignalWithTransform, effect, inject, input, isDevMode } from '@angular/core';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Shape of the preset configuration consumed by `KjSize`. One per consumer
|
|
5
|
-
* directive, provided via `bindPresets` from a per-component config token.
|
|
6
|
-
*
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export interface KjSizePreset {
|
|
10
|
-
values: string[];
|
|
11
|
-
default: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* DI token holding the size preset for the current consumer's injector scope.
|
|
16
|
-
* Resolved by `KjSize` at construction time.
|
|
17
|
-
*
|
|
18
|
-
* Default factory: `{ values: ['md'], default: 'md' }`.
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export const KJ_SIZE_PRESET = new InjectionToken<KjSizePreset>('kj.size.preset', {
|
|
23
|
-
factory: () => ({ values: ['md'], default: 'md' }),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Internal preset directive composed via `hostDirectives` by every stylistic
|
|
28
|
-
* component to expose a configurable `size` input that reflects to a
|
|
29
|
-
* `data-size` host attribute. App code does not import this directly.
|
|
30
|
-
*
|
|
31
|
-
* @internal
|
|
32
|
-
*/
|
|
33
|
-
@Directive({
|
|
34
|
-
selector: '[kjSize]',
|
|
35
|
-
standalone: true,
|
|
36
|
-
host: { '[attr.data-size]': 'kjSize()' },
|
|
37
|
-
})
|
|
38
|
-
export class KjSize {
|
|
39
|
-
private readonly preset = inject(KJ_SIZE_PRESET);
|
|
40
|
-
|
|
41
|
-
// See `KjVariant.kjVariant` for why the field type is annotated explicitly.
|
|
42
|
-
readonly kjSize: InputSignalWithTransform<string, string | undefined> = input(
|
|
43
|
-
this.preset.default,
|
|
44
|
-
{ transform: (v?: string) => v || this.preset.default },
|
|
45
|
-
);
|
|
46
|
-
|
|
47
|
-
constructor() {
|
|
48
|
-
if (isDevMode()) {
|
|
49
|
-
effect(() => {
|
|
50
|
-
const v = this.kjSize();
|
|
51
|
-
if (!this.preset.values.includes(v)) {
|
|
52
|
-
console.warn(
|
|
53
|
-
`[kj] unknown size "${v}". Allowed values: ${this.preset.values.join(', ')}.`,
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
-
import { TestBed } from '@angular/core/testing';
|
|
3
|
-
import { render } from '@testing-library/angular';
|
|
4
|
-
import { describe, expect, it, vi, afterEach } from 'vitest';
|
|
5
|
-
import { KJ_VARIANT_PRESET, KjVariant } from './variant';
|
|
6
|
-
|
|
7
|
-
@Component({
|
|
8
|
-
standalone: true,
|
|
9
|
-
imports: [KjVariant],
|
|
10
|
-
changeDetection: ChangeDetectionStrategy.Eager,
|
|
11
|
-
template: `<button kjVariant [kjVariant]="value">x</button>`,
|
|
12
|
-
})
|
|
13
|
-
class HostComponent {
|
|
14
|
-
value: string | undefined = undefined;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
describe('KjVariant', () => {
|
|
18
|
-
afterEach(() => vi.restoreAllMocks());
|
|
19
|
-
|
|
20
|
-
it('reflects kjVariant input as data-variant on the host', async () => {
|
|
21
|
-
const { getByRole } = await render(`<button kjVariant [kjVariant]="'destructive'">x</button>`, {
|
|
22
|
-
imports: [KjVariant],
|
|
23
|
-
providers: [
|
|
24
|
-
{
|
|
25
|
-
provide: KJ_VARIANT_PRESET,
|
|
26
|
-
useValue: { values: ['default', 'destructive'], default: 'default' },
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
});
|
|
30
|
-
expect(getByRole('button')).toHaveAttribute('data-variant', 'destructive');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('falls back to KJ_VARIANT_PRESET.default when input not set', async () => {
|
|
34
|
-
TestBed.configureTestingModule({
|
|
35
|
-
providers: [{ provide: KJ_VARIANT_PRESET, useValue: { values: ['a', 'b'], default: 'b' } }],
|
|
36
|
-
});
|
|
37
|
-
const fixture = TestBed.createComponent(HostComponent);
|
|
38
|
-
fixture.detectChanges();
|
|
39
|
-
const btn = fixture.nativeElement.querySelector('button');
|
|
40
|
-
expect(btn.getAttribute('data-variant')).toBe('b');
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('uses the built-in factory default when no provider is registered', async () => {
|
|
44
|
-
const fixture = TestBed.createComponent(HostComponent);
|
|
45
|
-
fixture.detectChanges();
|
|
46
|
-
const btn = fixture.nativeElement.querySelector('button');
|
|
47
|
-
expect(btn.getAttribute('data-variant')).toBe('default');
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
it('warns once in dev mode for an unknown value', async () => {
|
|
51
|
-
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
52
|
-
TestBed.configureTestingModule({
|
|
53
|
-
providers: [{ provide: KJ_VARIANT_PRESET, useValue: { values: ['a', 'b'], default: 'a' } }],
|
|
54
|
-
});
|
|
55
|
-
const fixture = TestBed.createComponent(HostComponent);
|
|
56
|
-
fixture.componentInstance.value = 'bogus';
|
|
57
|
-
fixture.detectChanges();
|
|
58
|
-
expect(warn).toHaveBeenCalledTimes(1);
|
|
59
|
-
expect(warn.mock.calls[0][0]).toMatch(/unknown variant/i);
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('does not warn for a known value', async () => {
|
|
63
|
-
const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
|
|
64
|
-
TestBed.configureTestingModule({
|
|
65
|
-
providers: [{ provide: KJ_VARIANT_PRESET, useValue: { values: ['a', 'b'], default: 'a' } }],
|
|
66
|
-
});
|
|
67
|
-
const fixture = TestBed.createComponent(HostComponent);
|
|
68
|
-
fixture.componentInstance.value = 'b';
|
|
69
|
-
fixture.detectChanges();
|
|
70
|
-
expect(warn).not.toHaveBeenCalled();
|
|
71
|
-
});
|
|
72
|
-
});
|