@kouji-ui/components 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-components.mjs +17668 -0
- package/fesm2022/kouji-ui-components.mjs.map +1 -0
- package/package.json +17 -10
- package/types/kouji-ui-components.d.ts +8032 -0
- package/.turbo/turbo-build.log +0 -29
- package/CHANGELOG.md +0 -192
- package/ng-package.json +0 -7
- package/src/accordion/_examples/accordion.default.example.ts +0 -31
- package/src/accordion/_examples/accordion.disabled.example.ts +0 -38
- package/src/accordion/_examples/accordion.multiple.example.ts +0 -31
- package/src/accordion/_examples/accordion.rich-content.example.ts +0 -49
- package/src/accordion/_examples/index.ts +0 -6
- package/src/accordion/accordion.arrow-nav.example.ts +0 -39
- package/src/accordion/accordion.css +0 -68
- package/src/accordion/accordion.playground.ts +0 -119
- package/src/accordion/accordion.spec.ts +0 -117
- package/src/accordion/accordion.ts +0 -153
- package/src/accordion/accordion.usage.example.ts +0 -38
- package/src/accordion/accordion.value.example.ts +0 -60
- package/src/accordion/index.ts +0 -1
- package/src/alert/_examples/alert.banner.example.ts +0 -56
- package/src/alert/_examples/alert.dismissible.example.ts +0 -53
- package/src/alert/_examples/alert.example.ts +0 -40
- package/src/alert/_examples/alert.variants.example.ts +0 -66
- package/src/alert/_examples/alert.with-actions.example.ts +0 -57
- package/src/alert/_examples/index.ts +0 -7
- package/src/alert/alert.css +0 -133
- package/src/alert/alert.playground.ts +0 -111
- package/src/alert/alert.spec.ts +0 -167
- package/src/alert/alert.ts +0 -250
- package/src/alert/alert.usage.example.ts +0 -58
- package/src/alert/index.ts +0 -8
- package/src/avatar/_examples/avatar-group.example.ts +0 -31
- package/src/avatar/_examples/avatar-group.list.example.ts +0 -45
- package/src/avatar/_examples/avatar-group.overflow.example.ts +0 -33
- package/src/avatar/_examples/avatar-group.shapes.example.ts +0 -39
- package/src/avatar/_examples/avatar-group.sizes.example.ts +0 -44
- package/src/avatar/_examples/avatar.default.example.ts +0 -18
- package/src/avatar/_examples/avatar.initials.example.ts +0 -20
- package/src/avatar/_examples/avatar.shapes.example.ts +0 -22
- package/src/avatar/_examples/avatar.sizes.example.ts +0 -26
- package/src/avatar/_examples/avatar.with-image.example.ts +0 -20
- package/src/avatar/_examples/index.ts +0 -12
- package/src/avatar/avatar-group.spec.ts +0 -138
- package/src/avatar/avatar-group.ts +0 -127
- package/src/avatar/avatar-group.usage.example.ts +0 -30
- package/src/avatar/avatar.css +0 -58
- package/src/avatar/avatar.playground.ts +0 -95
- package/src/avatar/avatar.ts +0 -123
- package/src/avatar/index.ts +0 -2
- package/src/badge/_examples/badge.default.example.ts +0 -18
- package/src/badge/_examples/badge.sizes.example.ts +0 -25
- package/src/badge/_examples/badge.variants.example.ts +0 -24
- package/src/badge/_examples/badge.with-dot.example.ts +0 -31
- package/src/badge/_examples/badge.with-icon.example.ts +0 -23
- package/src/badge/_examples/index.ts +0 -7
- package/src/badge/badge.css +0 -59
- package/src/badge/badge.playground.ts +0 -49
- package/src/badge/badge.ts +0 -86
- package/src/badge/badge.usage.example.ts +0 -22
- package/src/badge/index.ts +0 -1
- package/src/breadcrumb/_examples/breadcrumb.custom-separator.example.ts +0 -53
- package/src/breadcrumb/_examples/breadcrumb.example.ts +0 -48
- package/src/breadcrumb/_examples/breadcrumb.long-path.example.ts +0 -58
- package/src/breadcrumb/_examples/breadcrumb.truncated.example.ts +0 -59
- package/src/breadcrumb/_examples/breadcrumb.with-icons.example.ts +0 -66
- package/src/breadcrumb/_examples/index.ts +0 -7
- package/src/breadcrumb/breadcrumb.css +0 -121
- package/src/breadcrumb/breadcrumb.playground.ts +0 -93
- package/src/breadcrumb/breadcrumb.spec.ts +0 -230
- package/src/breadcrumb/breadcrumb.ts +0 -272
- package/src/breadcrumb/breadcrumb.usage.example.ts +0 -45
- package/src/breadcrumb/index.ts +0 -1
- package/src/button/_examples/button.anchor.example.ts +0 -18
- package/src/button/_examples/button.configured.example.ts +0 -43
- package/src/button/_examples/button.disabled.example.ts +0 -25
- package/src/button/_examples/button.example.ts +0 -22
- package/src/button/_examples/button.icon.example.ts +0 -27
- package/src/button/_examples/button.loading.example.ts +0 -31
- package/src/button/_examples/button.pressed.example.ts +0 -24
- package/src/button/_examples/button.sizes.example.ts +0 -26
- package/src/button/_examples/button.usage.example.ts +0 -66
- package/src/button/_examples/button.variants.example.ts +0 -26
- package/src/button/_examples/index.ts +0 -12
- package/src/button/button.css +0 -263
- package/src/button/button.playground.ts +0 -79
- package/src/button/button.spec.ts +0 -100
- package/src/button/button.ts +0 -150
- package/src/button/index.ts +0 -1
- package/src/button-group/_examples/button-group.example.ts +0 -30
- package/src/button-group/_examples/button-group.icon-only.example.ts +0 -30
- package/src/button-group/_examples/button-group.toggle.example.ts +0 -36
- package/src/button-group/_examples/button-group.variants.example.ts +0 -40
- package/src/button-group/_examples/button-group.vertical.example.ts +0 -29
- package/src/button-group/_examples/index.ts +0 -7
- package/src/button-group/button-group.css +0 -80
- package/src/button-group/button-group.playground.ts +0 -94
- package/src/button-group/button-group.spec.ts +0 -119
- package/src/button-group/button-group.ts +0 -130
- package/src/button-group/button-group.usage.example.ts +0 -35
- package/src/button-group/index.ts +0 -1
- package/src/calendar/_examples/calendar.example.ts +0 -33
- package/src/calendar/_examples/index.ts +0 -3
- package/src/calendar/calendar.css +0 -129
- package/src/calendar/calendar.playground.ts +0 -84
- package/src/calendar/calendar.spec.ts +0 -50
- package/src/calendar/calendar.ts +0 -171
- package/src/calendar/calendar.usage.example.ts +0 -33
- package/src/calendar/index.ts +0 -1
- package/src/card/_examples/card.cover.example.ts +0 -53
- package/src/card/_examples/card.example.ts +0 -27
- package/src/card/_examples/card.full.example.ts +0 -51
- package/src/card/_examples/index.ts +0 -5
- package/src/card/card.css +0 -120
- package/src/card/card.playground.ts +0 -116
- package/src/card/card.spec.ts +0 -50
- package/src/card/card.ts +0 -194
- package/src/card/card.usage.example.ts +0 -46
- package/src/card/index.ts +0 -1
- package/src/carousel/_examples/carousel.autoplay.example.ts +0 -69
- package/src/carousel/_examples/carousel.example.ts +0 -60
- package/src/carousel/_examples/carousel.indicators.example.ts +0 -64
- package/src/carousel/_examples/carousel.lazy-load.example.ts +0 -85
- package/src/carousel/_examples/carousel.tabs-pattern.example.ts +0 -61
- package/src/carousel/_examples/index.ts +0 -7
- package/src/carousel/carousel.css +0 -181
- package/src/carousel/carousel.playground.ts +0 -135
- package/src/carousel/carousel.spec.ts +0 -211
- package/src/carousel/carousel.ts +0 -399
- package/src/carousel/carousel.usage.example.ts +0 -46
- package/src/carousel/index.ts +0 -1
- package/src/cascade-select/_examples/cascade-select.data-driven.example.ts +0 -119
- package/src/cascade-select/_examples/cascade-select.disabled.example.ts +0 -74
- package/src/cascade-select/_examples/cascade-select.example.ts +0 -80
- package/src/cascade-select/_examples/cascade-select.field.example.ts +0 -73
- package/src/cascade-select/_examples/cascade-select.path.example.ts +0 -85
- package/src/cascade-select/_examples/index.ts +0 -7
- package/src/cascade-select/cascade-select.css +0 -120
- package/src/cascade-select/cascade-select.playground.ts +0 -133
- package/src/cascade-select/cascade-select.ts +0 -201
- package/src/cascade-select/cascade-select.usage.example.ts +0 -44
- package/src/cascade-select/index.ts +0 -5
- package/src/chat/_examples/chat-bubble.example.ts +0 -71
- package/src/chat/_examples/chat-bubble.grouped.example.ts +0 -69
- package/src/chat/_examples/chat-bubble.sides.example.ts +0 -41
- package/src/chat/_examples/chat-bubble.variants.example.ts +0 -58
- package/src/chat/_examples/chat-bubble.with-state.example.ts +0 -57
- package/src/chat/_examples/index.ts +0 -7
- package/src/chat/chat.css +0 -231
- package/src/chat/chat.playground.ts +0 -171
- package/src/chat/chat.spec.ts +0 -343
- package/src/chat/chat.ts +0 -269
- package/src/chat/chat.usage.example.ts +0 -49
- package/src/chat/index.ts +0 -13
- package/src/checkbox/_examples/checkbox.checked.example.ts +0 -20
- package/src/checkbox/_examples/checkbox.default.example.ts +0 -20
- package/src/checkbox/_examples/checkbox.disabled.example.ts +0 -26
- package/src/checkbox/_examples/checkbox.indeterminate.example.ts +0 -20
- package/src/checkbox/_examples/checkbox.usage.example.ts +0 -62
- package/src/checkbox/_examples/index.ts +0 -7
- package/src/checkbox/checkbox.css +0 -74
- package/src/checkbox/checkbox.playground.ts +0 -68
- package/src/checkbox/checkbox.ts +0 -122
- package/src/checkbox/index.ts +0 -1
- package/src/color-picker/_examples/color-picker.alpha.example.ts +0 -36
- package/src/color-picker/_examples/color-picker.example.ts +0 -34
- package/src/color-picker/_examples/color-picker.hex-input.example.ts +0 -53
- package/src/color-picker/_examples/color-picker.in-form.example.ts +0 -60
- package/src/color-picker/_examples/color-picker.usage.example.ts +0 -58
- package/src/color-picker/_examples/color-picker.with-presets.example.ts +0 -45
- package/src/color-picker/_examples/index.ts +0 -8
- package/src/color-picker/color-picker.css +0 -183
- package/src/color-picker/color-picker.playground.ts +0 -83
- package/src/color-picker/color-picker.spec.ts +0 -94
- package/src/color-picker/color-picker.ts +0 -234
- package/src/color-picker/index.ts +0 -1
- package/src/combobox/_examples/combobox.async.example.ts +0 -85
- package/src/combobox/_examples/combobox.empty-state.example.ts +0 -36
- package/src/combobox/_examples/combobox.example.ts +0 -36
- package/src/combobox/_examples/combobox.free-text.example.ts +0 -42
- package/src/combobox/_examples/combobox.usage.example.ts +0 -51
- package/src/combobox/_examples/combobox.with-icons.example.ts +0 -49
- package/src/combobox/_examples/index.ts +0 -8
- package/src/combobox/combobox.css +0 -101
- package/src/combobox/combobox.playground.ts +0 -90
- package/src/combobox/combobox.spec.ts +0 -111
- package/src/combobox/combobox.ts +0 -219
- package/src/combobox/index.ts +0 -6
- package/src/command-palette/_examples/command-palette.async.example.ts +0 -99
- package/src/command-palette/_examples/command-palette.dialog.example.ts +0 -90
- package/src/command-palette/_examples/command-palette.example.ts +0 -40
- package/src/command-palette/_examples/command-palette.fuzzy.example.ts +0 -54
- package/src/command-palette/_examples/command-palette.groups.example.ts +0 -55
- package/src/command-palette/_examples/command-palette.usage.example.ts +0 -49
- package/src/command-palette/_examples/index.ts +0 -8
- package/src/command-palette/command-palette.css +0 -234
- package/src/command-palette/command-palette.playground.ts +0 -119
- package/src/command-palette/command-palette.ts +0 -448
- package/src/command-palette/index.ts +0 -10
- package/src/confirm-popup/_examples/confirm-popup.destructive.example.ts +0 -72
- package/src/confirm-popup/_examples/confirm-popup.example.ts +0 -82
- package/src/confirm-popup/_examples/confirm-popup.placement.example.ts +0 -97
- package/src/confirm-popup/_examples/confirm-popup.usage.example.ts +0 -94
- package/src/confirm-popup/_examples/confirm-popup.with-message.example.ts +0 -76
- package/src/confirm-popup/_examples/index.ts +0 -7
- package/src/confirm-popup/confirm-popup.css +0 -47
- package/src/confirm-popup/confirm-popup.playground.ts +0 -109
- package/src/confirm-popup/confirm-popup.spec.ts +0 -209
- package/src/confirm-popup/confirm-popup.ts +0 -279
- package/src/confirm-popup/index.ts +0 -1
- package/src/date-picker/_examples/date-picker.disabled-dates.example.ts +0 -44
- package/src/date-picker/_examples/date-picker.example.ts +0 -38
- package/src/date-picker/_examples/date-picker.locale.example.ts +0 -50
- package/src/date-picker/_examples/date-picker.readonly.example.ts +0 -32
- package/src/date-picker/_examples/date-picker.usage.example.ts +0 -60
- package/src/date-picker/_examples/date-picker.with-min-max.example.ts +0 -47
- package/src/date-picker/_examples/index.ts +0 -8
- package/src/date-picker/date-picker.css +0 -61
- package/src/date-picker/date-picker.playground.ts +0 -79
- package/src/date-picker/date-picker.spec.ts +0 -71
- package/src/date-picker/date-picker.ts +0 -185
- package/src/date-picker/index.ts +0 -1
- package/src/dialog/_examples/dialog.confirmation.example.ts +0 -30
- package/src/dialog/_examples/dialog.default.example.ts +0 -30
- package/src/dialog/_examples/dialog.nested.example.ts +0 -86
- package/src/dialog/_examples/dialog.scrollable.example.ts +0 -30
- package/src/dialog/_examples/dialog.usage.example.ts +0 -57
- package/src/dialog/_examples/dialog.with-form.example.ts +0 -48
- package/src/dialog/_examples/index.ts +0 -8
- package/src/dialog/dialog.css +0 -56
- package/src/dialog/dialog.playground.ts +0 -136
- package/src/dialog/dialog.ts +0 -82
- package/src/dialog/index.ts +0 -1
- package/src/divider/_examples/divider.example.ts +0 -27
- package/src/divider/_examples/divider.sizes.example.ts +0 -33
- package/src/divider/_examples/divider.structural.example.ts +0 -55
- package/src/divider/_examples/divider.usage.example.ts +0 -48
- package/src/divider/_examples/divider.variants.example.ts +0 -33
- package/src/divider/_examples/divider.vertical.example.ts +0 -38
- package/src/divider/_examples/divider.with-content.example.ts +0 -38
- package/src/divider/_examples/index.ts +0 -9
- package/src/divider/divider.css +0 -93
- package/src/divider/divider.playground.ts +0 -97
- package/src/divider/divider.spec.ts +0 -207
- package/src/divider/divider.ts +0 -220
- package/src/divider/index.ts +0 -1
- package/src/drawer/_examples/drawer.example.ts +0 -30
- package/src/drawer/_examples/drawer.modal-vs-non-modal.example.ts +0 -27
- package/src/drawer/_examples/drawer.scrollable.example.ts +0 -30
- package/src/drawer/_examples/drawer.sides.example.ts +0 -32
- package/src/drawer/_examples/drawer.usage.example.ts +0 -56
- package/src/drawer/_examples/drawer.with-form.example.ts +0 -48
- package/src/drawer/_examples/index.ts +0 -8
- package/src/drawer/drawer.css +0 -130
- package/src/drawer/drawer.playground.ts +0 -107
- package/src/drawer/drawer.spec.ts +0 -216
- package/src/drawer/drawer.ts +0 -85
- package/src/drawer/index.ts +0 -1
- package/src/dropdown-menu/_examples/dropdown-menu.disabled.example.ts +0 -19
- package/src/dropdown-menu/_examples/dropdown-menu.example.ts +0 -20
- package/src/dropdown-menu/_examples/dropdown-menu.shortcuts.example.ts +0 -31
- package/src/dropdown-menu/_examples/dropdown-menu.sides.example.ts +0 -18
- package/src/dropdown-menu/_examples/dropdown-menu.usage.example.ts +0 -56
- package/src/dropdown-menu/_examples/dropdown-menu.with-icons.example.ts +0 -31
- package/src/dropdown-menu/_examples/dropdown-menu.with-separator.example.ts +0 -41
- package/src/dropdown-menu/_examples/index.ts +0 -9
- package/src/dropdown-menu/dropdown-menu.css +0 -108
- package/src/dropdown-menu/dropdown-menu.playground.ts +0 -109
- package/src/dropdown-menu/dropdown-menu.spec.ts +0 -5
- package/src/dropdown-menu/dropdown-menu.ts +0 -128
- package/src/dropdown-menu/index.ts +0 -1
- package/src/empty-state/_examples/empty-state.error.example.ts +0 -63
- package/src/empty-state/_examples/empty-state.example.ts +0 -59
- package/src/empty-state/_examples/empty-state.search.example.ts +0 -82
- package/src/empty-state/_examples/empty-state.sizes.example.ts +0 -76
- package/src/empty-state/_examples/empty-state.usage.example.ts +0 -66
- package/src/empty-state/_examples/empty-state.with-actions.example.ts +0 -68
- package/src/empty-state/_examples/index.ts +0 -8
- package/src/empty-state/empty-state.css +0 -114
- package/src/empty-state/empty-state.playground.ts +0 -87
- package/src/empty-state/empty-state.spec.ts +0 -211
- package/src/empty-state/empty-state.ts +0 -276
- package/src/empty-state/index.ts +0 -1
- package/src/example-components.ts +0 -396
- package/src/field/_examples/field.disabled.example.ts +0 -49
- package/src/field/_examples/field.example.ts +0 -51
- package/src/field/_examples/field.required.example.ts +0 -46
- package/src/field/_examples/field.with-error.example.ts +0 -73
- package/src/field/_examples/field.with-prefix-suffix.example.ts +0 -63
- package/src/field/_examples/index.ts +0 -7
- package/src/field/field.css +0 -138
- package/src/field/field.playground.ts +0 -108
- package/src/field/field.spec.ts +0 -132
- package/src/field/field.ts +0 -232
- package/src/field/field.usage.example.ts +0 -63
- package/src/field/index.ts +0 -7
- package/src/file-upload/_examples/file-upload.dropzone.example.ts +0 -32
- package/src/file-upload/_examples/file-upload.example.ts +0 -29
- package/src/file-upload/_examples/file-upload.image-preview.example.ts +0 -31
- package/src/file-upload/_examples/file-upload.multiple.example.ts +0 -23
- package/src/file-upload/_examples/file-upload.with-progress.example.ts +0 -59
- package/src/file-upload/_examples/index.ts +0 -7
- package/src/file-upload/file-upload.css +0 -207
- package/src/file-upload/file-upload.playground.ts +0 -84
- package/src/file-upload/file-upload.spec.ts +0 -94
- package/src/file-upload/file-upload.ts +0 -301
- package/src/file-upload/file-upload.usage.example.ts +0 -45
- package/src/file-upload/index.ts +0 -1
- package/src/form/_examples/form.async-submit.example.ts +0 -72
- package/src/form/_examples/form.compound.example.ts +0 -93
- package/src/form/_examples/form.example.ts +0 -70
- package/src/form/_examples/form.validation.example.ts +0 -67
- package/src/form/_examples/index.ts +0 -6
- package/src/form/form.css +0 -63
- package/src/form/form.playground.ts +0 -145
- package/src/form/form.spec.ts +0 -96
- package/src/form/form.ts +0 -216
- package/src/form/form.usage.example.ts +0 -63
- package/src/form/index.ts +0 -5
- package/src/icon/_examples/icon.gallery.example.ts +0 -199
- package/src/icon/_examples/icon.usage.example.ts +0 -46
- package/src/icon/_examples/index.ts +0 -4
- package/src/icon/icon.playground.ts +0 -63
- package/src/icon/index.ts +0 -5
- package/src/icon/lucide/icon-names.generated.ts +0 -1708
- package/src/icon/lucide/icon-names.ts +0 -18
- package/src/icon/lucide/index.ts +0 -2
- package/src/icon/lucide/provide-lucide-icons.ts +0 -96
- package/src/input/_examples/index.ts +0 -4
- package/src/input/_examples/input.color.example.ts +0 -33
- package/src/input/_examples/input.example.ts +0 -22
- package/src/input/index.ts +0 -1
- package/src/input/input.css +0 -70
- package/src/input/input.playground.ts +0 -79
- package/src/input/input.spec.ts +0 -98
- package/src/input/input.ts +0 -158
- package/src/input/input.usage.example.ts +0 -40
- package/src/input-group/_examples/index.ts +0 -7
- package/src/input-group/_examples/input-group.button.example.ts +0 -43
- package/src/input-group/_examples/input-group.example.ts +0 -39
- package/src/input-group/_examples/input-group.icon.example.ts +0 -49
- package/src/input-group/_examples/input-group.url.example.ts +0 -36
- package/src/input-group/_examples/input-group.variants.example.ts +0 -39
- package/src/input-group/index.ts +0 -1
- package/src/input-group/input-group.css +0 -125
- package/src/input-group/input-group.playground.ts +0 -90
- package/src/input-group/input-group.ts +0 -142
- package/src/input-group/input-group.usage.example.ts +0 -47
- package/src/input-mask/_examples/index.ts +0 -8
- package/src/input-mask/_examples/input-mask.credit-card.example.ts +0 -90
- package/src/input-mask/_examples/input-mask.custom-tokens.example.ts +0 -87
- package/src/input-mask/_examples/input-mask.date.example.ts +0 -61
- package/src/input-mask/_examples/input-mask.example.ts +0 -61
- package/src/input-mask/_examples/input-mask.usage.example.ts +0 -44
- package/src/input-mask/_examples/input-mask.validation.example.ts +0 -80
- package/src/input-mask/index.ts +0 -9
- package/src/input-mask/input-mask.css +0 -39
- package/src/input-mask/input-mask.playground.ts +0 -79
- package/src/input-mask/input-mask.ts +0 -130
- package/src/input-otp/_examples/index.ts +0 -8
- package/src/input-otp/_examples/input-otp.autosubmit.example.ts +0 -71
- package/src/input-otp/_examples/input-otp.example.ts +0 -47
- package/src/input-otp/_examples/input-otp.lengths.example.ts +0 -67
- package/src/input-otp/_examples/input-otp.masked.example.ts +0 -46
- package/src/input-otp/_examples/input-otp.reactive.example.ts +0 -58
- package/src/input-otp/_examples/input-otp.separator.example.ts +0 -49
- package/src/input-otp/index.ts +0 -1
- package/src/input-otp/input-otp.css +0 -87
- package/src/input-otp/input-otp.playground.ts +0 -107
- package/src/input-otp/input-otp.ts +0 -244
- package/src/input-otp/input-otp.usage.example.ts +0 -45
- package/src/kbd/_examples/index.ts +0 -6
- package/src/kbd/_examples/kbd.combo.example.ts +0 -24
- package/src/kbd/_examples/kbd.example.ts +0 -22
- package/src/kbd/_examples/kbd.in-tooltip.example.ts +0 -43
- package/src/kbd/_examples/kbd.sizes.example.ts +0 -31
- package/src/kbd/index.ts +0 -1
- package/src/kbd/kbd.css +0 -67
- package/src/kbd/kbd.playground.ts +0 -51
- package/src/kbd/kbd.spec.ts +0 -123
- package/src/kbd/kbd.ts +0 -123
- package/src/kbd/kbd.usage.example.ts +0 -38
- package/src/link/_examples/index.ts +0 -8
- package/src/link/_examples/link.disabled.example.ts +0 -23
- package/src/link/_examples/link.example.ts +0 -26
- package/src/link/_examples/link.external.example.ts +0 -33
- package/src/link/_examples/link.in-prose.example.ts +0 -36
- package/src/link/_examples/link.sizes.example.ts +0 -28
- package/src/link/_examples/link.variants.example.ts +0 -25
- package/src/link/index.ts +0 -1
- package/src/link/link.css +0 -104
- package/src/link/link.playground.ts +0 -98
- package/src/link/link.spec.ts +0 -146
- package/src/link/link.ts +0 -133
- package/src/link/link.usage.example.ts +0 -37
- package/src/list/_examples/index.ts +0 -7
- package/src/list/_examples/list.divided.example.ts +0 -32
- package/src/list/_examples/list.example.ts +0 -31
- package/src/list/_examples/list.interactive.example.ts +0 -51
- package/src/list/_examples/list.nav.example.ts +0 -44
- package/src/list/_examples/list.with-icons.example.ts +0 -97
- package/src/list/index.ts +0 -1
- package/src/list/list.css +0 -166
- package/src/list/list.playground.ts +0 -90
- package/src/list/list.spec.ts +0 -121
- package/src/list/list.ts +0 -227
- package/src/list/list.usage.example.ts +0 -45
- package/src/menubar/_examples/index.ts +0 -6
- package/src/menubar/_examples/menubar.disabled-item.example.ts +0 -23
- package/src/menubar/_examples/menubar.example.ts +0 -22
- package/src/menubar/_examples/menubar.with-shortcuts.example.ts +0 -33
- package/src/menubar/_examples/menubar.with-submenu.example.ts +0 -76
- package/src/menubar/index.ts +0 -1
- package/src/menubar/menubar.css +0 -62
- package/src/menubar/menubar.playground.ts +0 -96
- package/src/menubar/menubar.ts +0 -160
- package/src/menubar/menubar.usage.example.ts +0 -33
- package/src/number-input/_examples/index.ts +0 -7
- package/src/number-input/_examples/number-input.currency.example.ts +0 -35
- package/src/number-input/_examples/number-input.decimal.example.ts +0 -34
- package/src/number-input/_examples/number-input.example.ts +0 -24
- package/src/number-input/_examples/number-input.min-max.example.ts +0 -33
- package/src/number-input/_examples/number-input.with-stepper.example.ts +0 -45
- package/src/number-input/index.ts +0 -1
- package/src/number-input/number-input.css +0 -115
- package/src/number-input/number-input.playground.ts +0 -92
- package/src/number-input/number-input.spec.ts +0 -102
- package/src/number-input/number-input.ts +0 -212
- package/src/number-input/number-input.usage.example.ts +0 -73
- package/src/overlay/overlay.css +0 -32
- package/src/overlay-badge/_examples/index.ts +0 -7
- package/src/overlay-badge/_examples/overlay-badge.described.example.ts +0 -36
- package/src/overlay-badge/_examples/overlay-badge.dot.example.ts +0 -28
- package/src/overlay-badge/_examples/overlay-badge.example.ts +0 -34
- package/src/overlay-badge/_examples/overlay-badge.on-avatar.example.ts +0 -38
- package/src/overlay-badge/_examples/overlay-badge.positions.example.ts +0 -39
- package/src/overlay-badge/index.ts +0 -1
- package/src/overlay-badge/overlay-badge.css +0 -118
- package/src/overlay-badge/overlay-badge.playground.ts +0 -92
- package/src/overlay-badge/overlay-badge.spec.ts +0 -174
- package/src/overlay-badge/overlay-badge.ts +0 -232
- package/src/overlay-badge/overlay-badge.usage.example.ts +0 -44
- package/src/pagination/_examples/index.ts +0 -7
- package/src/pagination/_examples/pagination.boundaries.example.ts +0 -56
- package/src/pagination/_examples/pagination.compact.example.ts +0 -42
- package/src/pagination/_examples/pagination.example.ts +0 -55
- package/src/pagination/_examples/pagination.large.example.ts +0 -54
- package/src/pagination/_examples/pagination.with-info.example.ts +0 -49
- package/src/pagination/index.ts +0 -1
- package/src/pagination/pagination.css +0 -146
- package/src/pagination/pagination.playground.ts +0 -107
- package/src/pagination/pagination.spec.ts +0 -202
- package/src/pagination/pagination.ts +0 -432
- package/src/pagination/pagination.usage.example.ts +0 -50
- package/src/password-input/_examples/index.ts +0 -6
- package/src/password-input/_examples/password-input.example.ts +0 -24
- package/src/password-input/_examples/password-input.strength.example.ts +0 -45
- package/src/password-input/_examples/password-input.toggle.example.ts +0 -43
- package/src/password-input/_examples/password-input.with-rules.example.ts +0 -78
- package/src/password-input/index.ts +0 -1
- package/src/password-input/password-input.css +0 -155
- package/src/password-input/password-input.playground.ts +0 -81
- package/src/password-input/password-input.spec.ts +0 -129
- package/src/password-input/password-input.ts +0 -254
- package/src/password-input/password-input.usage.example.ts +0 -55
- package/src/playground-types.ts +0 -47
- package/src/popover/_examples/index.ts +0 -7
- package/src/popover/_examples/popover.cancellable.example.ts +0 -20
- package/src/popover/_examples/popover.example.ts +0 -20
- package/src/popover/_examples/popover.modal.example.ts +0 -22
- package/src/popover/_examples/popover.sides.example.ts +0 -37
- package/src/popover/_examples/popover.with-form.example.ts +0 -38
- package/src/popover/index.ts +0 -1
- package/src/popover/popover.css +0 -71
- package/src/popover/popover.playground.ts +0 -86
- package/src/popover/popover.spec.ts +0 -5
- package/src/popover/popover.ts +0 -94
- package/src/popover/popover.usage.example.ts +0 -48
- package/src/progress-bar/_examples/index.ts +0 -7
- package/src/progress-bar/_examples/progress-bar.example.ts +0 -22
- package/src/progress-bar/_examples/progress-bar.indeterminate.example.ts +0 -23
- package/src/progress-bar/_examples/progress-bar.sizes.example.ts +0 -29
- package/src/progress-bar/_examples/progress-bar.variants.example.ts +0 -30
- package/src/progress-bar/_examples/progress-bar.with-label.example.ts +0 -30
- package/src/progress-bar/index.ts +0 -1
- package/src/progress-bar/progress-bar.css +0 -113
- package/src/progress-bar/progress-bar.playground.ts +0 -87
- package/src/progress-bar/progress-bar.spec.ts +0 -233
- package/src/progress-bar/progress-bar.ts +0 -155
- package/src/progress-bar/progress-bar.usage.example.ts +0 -52
- package/src/public-api.ts +0 -61
- package/src/radio/_examples/index.ts +0 -6
- package/src/radio/_examples/radio.default.example.ts +0 -26
- package/src/radio/_examples/radio.disabled.example.ts +0 -26
- package/src/radio/_examples/radio.group.example.ts +0 -27
- package/src/radio/_examples/radio.inline.example.ts +0 -26
- package/src/radio/index.ts +0 -1
- package/src/radio/radio.css +0 -58
- package/src/radio/radio.playground.ts +0 -90
- package/src/radio/radio.ts +0 -143
- package/src/radio/radio.usage.example.ts +0 -54
- package/src/select/_examples/index.ts +0 -6
- package/src/select/_examples/select.default.example.ts +0 -26
- package/src/select/_examples/select.disabled.example.ts +0 -24
- package/src/select/_examples/select.grouped.example.ts +0 -37
- package/src/select/_examples/select.placeholder.example.ts +0 -26
- package/src/select/index.ts +0 -1
- package/src/select/select.css +0 -65
- package/src/select/select.playground.ts +0 -81
- package/src/select/select.ts +0 -176
- package/src/select/select.usage.example.ts +0 -64
- package/src/skeleton/_examples/index.ts +0 -6
- package/src/skeleton/_examples/skeleton.animations.example.ts +0 -52
- package/src/skeleton/_examples/skeleton.card.example.ts +0 -68
- package/src/skeleton/_examples/skeleton.example.ts +0 -24
- package/src/skeleton/_examples/skeleton.shapes.example.ts +0 -55
- package/src/skeleton/index.ts +0 -1
- package/src/skeleton/skeleton.css +0 -111
- package/src/skeleton/skeleton.playground.ts +0 -80
- package/src/skeleton/skeleton.spec.ts +0 -126
- package/src/skeleton/skeleton.ts +0 -155
- package/src/skeleton/skeleton.usage.example.ts +0 -49
- package/src/slider/_examples/index.ts +0 -7
- package/src/slider/_examples/slider.example.ts +0 -41
- package/src/slider/_examples/slider.formatted.example.ts +0 -53
- package/src/slider/_examples/slider.range.example.ts +0 -48
- package/src/slider/_examples/slider.vertical.example.ts +0 -48
- package/src/slider/_examples/slider.with-marks.example.ts +0 -46
- package/src/slider/index.ts +0 -1
- package/src/slider/slider.css +0 -172
- package/src/slider/slider.playground.ts +0 -88
- package/src/slider/slider.spec.ts +0 -139
- package/src/slider/slider.ts +0 -246
- package/src/slider/slider.usage.example.ts +0 -68
- package/src/speed-dial/_examples/index.ts +0 -7
- package/src/speed-dial/_examples/speed-dial.directions.example.ts +0 -85
- package/src/speed-dial/_examples/speed-dial.disabled.example.ts +0 -71
- package/src/speed-dial/_examples/speed-dial.example.ts +0 -48
- package/src/speed-dial/_examples/speed-dial.usage.example.ts +0 -59
- package/src/speed-dial/_examples/speed-dial.with-tooltips.example.ts +0 -65
- package/src/speed-dial/index.ts +0 -1
- package/src/speed-dial/speed-dial.css +0 -137
- package/src/speed-dial/speed-dial.playground.ts +0 -137
- package/src/speed-dial/speed-dial.spec.ts +0 -191
- package/src/speed-dial/speed-dial.ts +0 -257
- package/src/spinner/_examples/index.ts +0 -8
- package/src/spinner/_examples/spinner.animations.example.ts +0 -54
- package/src/spinner/_examples/spinner.example.ts +0 -26
- package/src/spinner/_examples/spinner.in-button.example.ts +0 -51
- package/src/spinner/_examples/spinner.sizes.example.ts +0 -31
- package/src/spinner/_examples/spinner.usage.example.ts +0 -45
- package/src/spinner/_examples/spinner.variants.example.ts +0 -34
- package/src/spinner/index.ts +0 -1
- package/src/spinner/spinner.css +0 -161
- package/src/spinner/spinner.playground.ts +0 -68
- package/src/spinner/spinner.spec.ts +0 -184
- package/src/spinner/spinner.ts +0 -185
- package/src/stepper/_examples/index.ts +0 -8
- package/src/stepper/_examples/stepper.example.ts +0 -62
- package/src/stepper/_examples/stepper.non-linear.example.ts +0 -63
- package/src/stepper/_examples/stepper.optional-step.example.ts +0 -62
- package/src/stepper/_examples/stepper.usage.example.ts +0 -73
- package/src/stepper/_examples/stepper.vertical.example.ts +0 -66
- package/src/stepper/_examples/stepper.with-error.example.ts +0 -63
- package/src/stepper/index.ts +0 -1
- package/src/stepper/stepper.css +0 -147
- package/src/stepper/stepper.playground.ts +0 -88
- package/src/stepper/stepper.spec.ts +0 -200
- package/src/stepper/stepper.ts +0 -242
- package/src/table/_examples/index.ts +0 -23
- package/src/table/_examples/table.column-pinning.example.ts +0 -55
- package/src/table/_examples/table.column-resize.example.ts +0 -49
- package/src/table/_examples/table.column-visibility.example.ts +0 -52
- package/src/table/_examples/table.density.example.ts +0 -71
- package/src/table/_examples/table.editable.example.ts +0 -85
- package/src/table/_examples/table.empty-and-error.example.ts +0 -112
- package/src/table/_examples/table.example.ts +0 -45
- package/src/table/_examples/table.export.example.ts +0 -82
- package/src/table/_examples/table.filterable.example.ts +0 -67
- package/src/table/_examples/table.grouping.example.ts +0 -63
- package/src/table/_examples/table.keyboard.example.ts +0 -115
- package/src/table/_examples/table.master-detail.example.ts +0 -102
- package/src/table/_examples/table.persistence.example.ts +0 -85
- package/src/table/_examples/table.playground.ts +0 -154
- package/src/table/_examples/table.row-pinning.example.ts +0 -71
- package/src/table/_examples/table.selection.example.ts +0 -67
- package/src/table/_examples/table.server-mode.example.ts +0 -120
- package/src/table/_examples/table.sortable.example.ts +0 -49
- package/src/table/_examples/table.theming.example.ts +0 -64
- package/src/table/_examples/table.usage.example.ts +0 -90
- package/src/table/_examples/table.virtualized.example.ts +0 -122
- package/src/table/index.ts +0 -11
- package/src/table/table-cell-editor-outlet.ts +0 -111
- package/src/table/table-editors/boolean-editor.ts +0 -71
- package/src/table/table-editors/date-editor.ts +0 -117
- package/src/table/table-editors/editors.spec.ts +0 -147
- package/src/table/table-editors/index.ts +0 -41
- package/src/table/table-editors/number-editor.ts +0 -89
- package/src/table/table-editors/select-editor.ts +0 -107
- package/src/table/table-editors/text-editor.ts +0 -82
- package/src/table/table-export.spec.ts +0 -33
- package/src/table/table-export.ts +0 -53
- package/src/table/table-filter-outlet.ts +0 -137
- package/src/table/table-filters/date-filter.ts +0 -122
- package/src/table/table-filters/filters.css +0 -53
- package/src/table/table-filters/filters.spec.ts +0 -277
- package/src/table/table-filters/index.ts +0 -11
- package/src/table/table-filters/number-filter.ts +0 -232
- package/src/table/table-filters/select-filter.ts +0 -129
- package/src/table/table-filters/text-filter.ts +0 -110
- package/src/table/table-pagination.spec.ts +0 -118
- package/src/table/table-pagination.ts +0 -191
- package/src/table/table-side-panel.spec.ts +0 -170
- package/src/table/table-side-panel.ts +0 -263
- package/src/table/table-status-bar.spec.ts +0 -78
- package/src/table/table-status-bar.ts +0 -70
- package/src/table/table-toolbar.spec.ts +0 -180
- package/src/table/table-toolbar.ts +0 -244
- package/src/table/table-virtual.spec.ts +0 -103
- package/src/table/table-virtual.ts +0 -180
- package/src/table/table.css +0 -468
- package/src/table/table.spec.ts +0 -175
- package/src/table/table.ts +0 -1009
- package/src/tabs/_examples/index.ts +0 -8
- package/src/tabs/_examples/tabs.controlled.example.ts +0 -59
- package/src/tabs/_examples/tabs.disabled.example.ts +0 -34
- package/src/tabs/_examples/tabs.example.ts +0 -34
- package/src/tabs/_examples/tabs.manual-activation.example.ts +0 -34
- package/src/tabs/_examples/tabs.usage.example.ts +0 -43
- package/src/tabs/_examples/tabs.vertical.example.ts +0 -33
- package/src/tabs/index.ts +0 -1
- package/src/tabs/tabs.css +0 -80
- package/src/tabs/tabs.playground.ts +0 -88
- package/src/tabs/tabs.spec.ts +0 -135
- package/src/tabs/tabs.ts +0 -204
- package/src/tag/_examples/index.ts +0 -9
- package/src/tag/_examples/tag.example.ts +0 -22
- package/src/tag/_examples/tag.list.example.ts +0 -38
- package/src/tag/_examples/tag.removable.example.ts +0 -39
- package/src/tag/_examples/tag.selectable.example.ts +0 -33
- package/src/tag/_examples/tag.sizes.example.ts +0 -25
- package/src/tag/_examples/tag.usage.example.ts +0 -62
- package/src/tag/_examples/tag.variants.example.ts +0 -29
- package/src/tag/index.ts +0 -1
- package/src/tag/tag.css +0 -167
- package/src/tag/tag.playground.ts +0 -63
- package/src/tag/tag.spec.ts +0 -153
- package/src/tag/tag.ts +0 -186
- package/src/test-setup.ts +0 -5
- package/src/textarea/_examples/index.ts +0 -8
- package/src/textarea/_examples/textarea.autoresize.example.ts +0 -37
- package/src/textarea/_examples/textarea.character-count.example.ts +0 -34
- package/src/textarea/_examples/textarea.example.ts +0 -22
- package/src/textarea/_examples/textarea.no-resize.example.ts +0 -28
- package/src/textarea/_examples/textarea.usage.example.ts +0 -50
- package/src/textarea/_examples/textarea.with-field.example.ts +0 -66
- package/src/textarea/index.ts +0 -1
- package/src/textarea/textarea.css +0 -117
- package/src/textarea/textarea.playground.ts +0 -70
- package/src/textarea/textarea.spec.ts +0 -161
- package/src/textarea/textarea.ts +0 -339
- package/src/time-picker/_examples/index.ts +0 -8
- package/src/time-picker/_examples/time-picker.12-hour.example.ts +0 -24
- package/src/time-picker/_examples/time-picker.example.ts +0 -24
- package/src/time-picker/_examples/time-picker.formatted.example.ts +0 -32
- package/src/time-picker/_examples/time-picker.range.example.ts +0 -54
- package/src/time-picker/_examples/time-picker.usage.example.ts +0 -53
- package/src/time-picker/_examples/time-picker.with-seconds.example.ts +0 -24
- package/src/time-picker/index.ts +0 -1
- package/src/time-picker/time-picker.css +0 -126
- package/src/time-picker/time-picker.playground.ts +0 -72
- package/src/time-picker/time-picker.spec.ts +0 -77
- package/src/time-picker/time-picker.ts +0 -207
- package/src/toast/_examples/index.ts +0 -7
- package/src/toast/_examples/toast.default.example.ts +0 -37
- package/src/toast/_examples/toast.dismissible.example.ts +0 -38
- package/src/toast/_examples/toast.usage.example.ts +0 -57
- package/src/toast/_examples/toast.variants.example.ts +0 -43
- package/src/toast/_examples/toast.with-action.example.ts +0 -46
- package/src/toast/index.ts +0 -1
- package/src/toast/toast.css +0 -115
- package/src/toast/toast.playground.ts +0 -61
- package/src/toast/toast.ts +0 -168
- package/src/toggle/_examples/index.ts +0 -7
- package/src/toggle/_examples/toggle.checked.example.ts +0 -20
- package/src/toggle/_examples/toggle.default.example.ts +0 -20
- package/src/toggle/_examples/toggle.disabled.example.ts +0 -26
- package/src/toggle/_examples/toggle.usage.example.ts +0 -51
- package/src/toggle/_examples/toggle.with-label.example.ts +0 -30
- package/src/toggle/index.ts +0 -1
- package/src/toggle/toggle.css +0 -123
- package/src/toggle/toggle.playground.ts +0 -65
- package/src/toggle/toggle.ts +0 -113
- package/src/tooltip/_examples/index.ts +0 -9
- package/src/tooltip/_examples/tooltip.delays.example.ts +0 -16
- package/src/tooltip/_examples/tooltip.disabled.example.ts +0 -16
- package/src/tooltip/_examples/tooltip.example.ts +0 -16
- package/src/tooltip/_examples/tooltip.group.example.ts +0 -20
- package/src/tooltip/_examples/tooltip.rich.example.ts +0 -19
- package/src/tooltip/_examples/tooltip.sides.example.ts +0 -18
- package/src/tooltip/_examples/tooltip.usage.example.ts +0 -50
- package/src/tooltip/index.ts +0 -1
- package/src/tooltip/tooltip.css +0 -61
- package/src/tooltip/tooltip.playground.ts +0 -79
- package/src/tooltip/tooltip.spec.ts +0 -5
- package/src/tooltip/tooltip.ts +0 -102
- package/src/tree-select/_examples/index.ts +0 -8
- package/src/tree-select/_examples/tree-select.disabled.example.ts +0 -106
- package/src/tree-select/_examples/tree-select.example.ts +0 -65
- package/src/tree-select/_examples/tree-select.expanded.example.ts +0 -72
- package/src/tree-select/_examples/tree-select.field.example.ts +0 -77
- package/src/tree-select/_examples/tree-select.multi.example.ts +0 -73
- package/src/tree-select/_examples/tree-select.usage.example.ts +0 -85
- package/src/tree-select/index.ts +0 -1
- package/src/tree-select/tree-select.css +0 -220
- package/src/tree-select/tree-select.playground.ts +0 -83
- package/src/tree-select/tree-select.ts +0 -348
- package/src/typography/_examples/index.ts +0 -9
- package/src/typography/_examples/typography.blockquote.example.ts +0 -34
- package/src/typography/_examples/typography.code.example.ts +0 -32
- package/src/typography/_examples/typography.example.ts +0 -42
- package/src/typography/_examples/typography.lead.example.ts +0 -37
- package/src/typography/_examples/typography.muted.example.ts +0 -27
- package/src/typography/_examples/typography.truncate.example.ts +0 -41
- package/src/typography/_examples/typography.usage.example.ts +0 -44
- package/src/typography/index.ts +0 -8
- package/src/typography/typography.playground.ts +0 -101
- package/src/typography/typography.spec.ts +0 -70
- package/src/typography/typography.ts +0 -105
- package/tsconfig.lib.json +0 -25
- package/tsconfig.lib.prod.json +0 -17
- package/tsconfig.spec.json +0 -16
- package/vite.config.ts +0 -33
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
DestroyRef,
|
|
5
|
-
InjectionToken,
|
|
6
|
-
ViewEncapsulation,
|
|
7
|
-
computed,
|
|
8
|
-
inject,
|
|
9
|
-
} from '@angular/core';
|
|
10
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
11
|
-
import { FormControl, ReactiveFormsModule } from '@angular/forms';
|
|
12
|
-
import { debounceTime } from 'rxjs/operators';
|
|
13
|
-
import type { Column, Table } from '@tanstack/angular-table';
|
|
14
|
-
import { KjVisuallyHidden, type KjTextFilterModel } from '@kouji-ui/core';
|
|
15
|
-
import { KjInputComponent } from '../../input/input';
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Context passed to every built-in filter UI. Resolves the TanStack
|
|
19
|
-
* `Column` whose filter value the input writes, and the parent `Table`
|
|
20
|
-
* for cross-column wiring (e.g. faceted unique values).
|
|
21
|
-
*/
|
|
22
|
-
export interface KjFilterContext<TData = unknown> {
|
|
23
|
-
readonly column: Column<TData, unknown>;
|
|
24
|
-
readonly table: Table<TData>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/** DI token used to inject the `KjFilterContext` into filter components. */
|
|
28
|
-
export const KJ_FILTER_CONTEXT = new InjectionToken<KjFilterContext>(
|
|
29
|
-
'kj.filter.context',
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
/** Default debounce window for the text filter, in milliseconds. */
|
|
33
|
-
const DEFAULT_DEBOUNCE_MS = 300;
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Text filter UI. Renders a styled `<kj-input>` that writes the typed
|
|
37
|
-
* string to `column.setFilterValue(...)` after a 300ms debounce so
|
|
38
|
-
* keystrokes don't flood the table's filter model.
|
|
39
|
-
*
|
|
40
|
-
* Initial render seeds from `column.getFilterValue()` so the input
|
|
41
|
-
* round-trips when the filter is restored from URL/state.
|
|
42
|
-
*
|
|
43
|
-
* The input is labelled via a wrapping `<label>` carrying a visually
|
|
44
|
-
* hidden caption (`Filter by <header>`) so screen readers announce the
|
|
45
|
-
* column the filter targets.
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* ```html
|
|
49
|
-
* <kj-text-filter /> <!-- KJ_FILTER_CONTEXT must be provided in the host -->
|
|
50
|
-
* ```
|
|
51
|
-
*/
|
|
52
|
-
@Component({
|
|
53
|
-
selector: 'kj-text-filter',
|
|
54
|
-
standalone: true,
|
|
55
|
-
imports: [ReactiveFormsModule, KjInputComponent, KjVisuallyHidden],
|
|
56
|
-
styleUrl: './filters.css',
|
|
57
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
58
|
-
encapsulation: ViewEncapsulation.None,
|
|
59
|
-
host: {
|
|
60
|
-
class: 'kj-text-filter',
|
|
61
|
-
},
|
|
62
|
-
template: `
|
|
63
|
-
<div class="kj-text-filter__label">
|
|
64
|
-
<span kjVisuallyHidden>{{ ariaLabel() }}</span>
|
|
65
|
-
<kj-input
|
|
66
|
-
class="kj-text-filter__input"
|
|
67
|
-
type="search"
|
|
68
|
-
kjSize="xs"
|
|
69
|
-
[formControl]="control"
|
|
70
|
-
/>
|
|
71
|
-
</div>
|
|
72
|
-
`,
|
|
73
|
-
})
|
|
74
|
-
export class KjTextFilter<TData = unknown> {
|
|
75
|
-
private readonly ctx = inject<KjFilterContext<TData>>(KJ_FILTER_CONTEXT);
|
|
76
|
-
private readonly destroyRef = inject(DestroyRef);
|
|
77
|
-
|
|
78
|
-
/** Reactive form control driving the styled `<kj-input>`. */
|
|
79
|
-
protected readonly control = new FormControl<string>(
|
|
80
|
-
(() => {
|
|
81
|
-
const v = this.ctx.column.getFilterValue();
|
|
82
|
-
if (typeof v === 'string') return v;
|
|
83
|
-
if (v && typeof v === 'object' && (v as { filterType?: string }).filterType === 'text') {
|
|
84
|
-
return (v as KjTextFilterModel).filter ?? '';
|
|
85
|
-
}
|
|
86
|
-
return '';
|
|
87
|
-
})(),
|
|
88
|
-
{ nonNullable: true },
|
|
89
|
-
);
|
|
90
|
-
|
|
91
|
-
/** Accessible label derived from the column header. */
|
|
92
|
-
protected readonly ariaLabel = computed(() => {
|
|
93
|
-
const header = this.ctx.column.columnDef.header;
|
|
94
|
-
const label = typeof header === 'string' ? header : this.ctx.column.id;
|
|
95
|
-
return `Filter by ${label}`;
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
constructor() {
|
|
99
|
-
this.control.valueChanges
|
|
100
|
-
.pipe(debounceTime(DEFAULT_DEBOUNCE_MS), takeUntilDestroyed(this.destroyRef))
|
|
101
|
-
.subscribe((value) => {
|
|
102
|
-
if (value === '') {
|
|
103
|
-
this.ctx.column.setFilterValue(undefined);
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
const model: KjTextFilterModel = { filterType: 'text', type: 'contains', filter: value };
|
|
107
|
-
this.ctx.column.setFilterValue(model);
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { Component, signal, viewChild, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
-
import { fireEvent, render } from '@testing-library/angular';
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
import { KjTable, kjColumn } from '@kouji-ui/core';
|
|
5
|
-
import { KjTablePaginationComponent } from './table-pagination';
|
|
6
|
-
|
|
7
|
-
interface Row {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function makeRows(n: number): Row[] {
|
|
13
|
-
return Array.from({ length: n }, (_, i) => ({ id: String(i + 1), name: `Row ${i + 1}` }));
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
// KJ_TABLE is provided on the element hosting the `kjTable` directive. The
|
|
17
|
-
// pagination component must therefore be projected *inside* that element so
|
|
18
|
-
// it can inject the token via element-injector inheritance. We park it in a
|
|
19
|
-
// dedicated `<td>` so the markup remains valid `<table>` content.
|
|
20
|
-
@Component({
|
|
21
|
-
standalone: true,
|
|
22
|
-
imports: [KjTable, KjTablePaginationComponent],
|
|
23
|
-
changeDetection: ChangeDetectionStrategy.Eager,
|
|
24
|
-
template: `
|
|
25
|
-
<table [kjTable]="cols" [kjTableData]="data()" #t="kjTable">
|
|
26
|
-
<tbody>
|
|
27
|
-
<tr>
|
|
28
|
-
<td>
|
|
29
|
-
<kj-table-pagination [kjPageSizes]="pageSizes()" [kjShowSummary]="showSummary()" />
|
|
30
|
-
</td>
|
|
31
|
-
</tr>
|
|
32
|
-
</tbody>
|
|
33
|
-
</table>
|
|
34
|
-
`,
|
|
35
|
-
})
|
|
36
|
-
class Host {
|
|
37
|
-
protected readonly data = signal<Row[]>(makeRows(25));
|
|
38
|
-
protected readonly cols = [kjColumn<Row>({ accessorKey: 'name', header: 'Name' })];
|
|
39
|
-
protected readonly pageSizes = signal<readonly number[]>([10, 25, 50]);
|
|
40
|
-
protected readonly showSummary = signal(true);
|
|
41
|
-
readonly tableRef = viewChild.required(KjTable);
|
|
42
|
-
|
|
43
|
-
setShowSummary(v: boolean): void {
|
|
44
|
-
this.showSummary.set(v);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
describe('KjTablePaginationComponent', () => {
|
|
49
|
-
it('renders summary "Showing 1–10 of 25" when pageIndex=0, pageSize=10, total=25', async () => {
|
|
50
|
-
const { fixture, getByText } = await render(Host);
|
|
51
|
-
fixture.componentInstance.tableRef().setState({ pagination: { pageIndex: 0, pageSize: 10 } });
|
|
52
|
-
fixture.detectChanges();
|
|
53
|
-
expect(getByText(/Showing 1.10 of 25/)).toBeInTheDocument();
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('changing the page-size <kj-select> calls setPageSize on the table', async () => {
|
|
57
|
-
const { fixture, container } = await render(Host);
|
|
58
|
-
fixture.componentInstance.tableRef().setState({ pagination: { pageIndex: 0, pageSize: 10 } });
|
|
59
|
-
fixture.detectChanges();
|
|
60
|
-
|
|
61
|
-
// Open the kj-select trigger.
|
|
62
|
-
const trigger = container.querySelector('kj-select button') as HTMLButtonElement;
|
|
63
|
-
fireEvent.click(trigger);
|
|
64
|
-
fixture.detectChanges();
|
|
65
|
-
|
|
66
|
-
// Options are portalled to document.body via kj-select-content. Pick the
|
|
67
|
-
// one whose visible text is "25" and click it.
|
|
68
|
-
const options = Array.from(document.querySelectorAll('[role="option"]')) as HTMLElement[];
|
|
69
|
-
const opt25 = options.find((o) => o.textContent?.trim() === '25');
|
|
70
|
-
expect(opt25).toBeDefined();
|
|
71
|
-
fireEvent.click(opt25!);
|
|
72
|
-
fixture.detectChanges();
|
|
73
|
-
|
|
74
|
-
expect(fixture.componentInstance.tableRef().state.pagination().pageSize).toBe(25);
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('clicking Next moves pageIndex forward', async () => {
|
|
78
|
-
const { fixture, getByLabelText } = await render(Host);
|
|
79
|
-
fixture.componentInstance.tableRef().setState({ pagination: { pageIndex: 0, pageSize: 10 } });
|
|
80
|
-
fixture.detectChanges();
|
|
81
|
-
|
|
82
|
-
fireEvent.click(getByLabelText('Next page'));
|
|
83
|
-
fixture.detectChanges();
|
|
84
|
-
|
|
85
|
-
expect(fixture.componentInstance.tableRef().state.pagination().pageIndex).toBe(1);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('Previous button is disabled on page 0', async () => {
|
|
89
|
-
const { fixture, getByLabelText } = await render(Host);
|
|
90
|
-
fixture.componentInstance.tableRef().setState({ pagination: { pageIndex: 0, pageSize: 10 } });
|
|
91
|
-
fixture.detectChanges();
|
|
92
|
-
|
|
93
|
-
const prev = getByLabelText('Previous page') as HTMLButtonElement;
|
|
94
|
-
expect(prev.getAttribute('aria-disabled')).toBe('true');
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
it('Last jumps to final page, First returns to page 0', async () => {
|
|
98
|
-
const { fixture, getByLabelText } = await render(Host);
|
|
99
|
-
fixture.componentInstance.tableRef().setState({ pagination: { pageIndex: 0, pageSize: 10 } });
|
|
100
|
-
fixture.detectChanges();
|
|
101
|
-
|
|
102
|
-
fireEvent.click(getByLabelText('Last page'));
|
|
103
|
-
fixture.detectChanges();
|
|
104
|
-
expect(fixture.componentInstance.tableRef().state.pagination().pageIndex).toBe(2);
|
|
105
|
-
|
|
106
|
-
fireEvent.click(getByLabelText('First page'));
|
|
107
|
-
fixture.detectChanges();
|
|
108
|
-
expect(fixture.componentInstance.tableRef().state.pagination().pageIndex).toBe(0);
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
it('summary is hidden when [kjShowSummary]="false"', async () => {
|
|
112
|
-
const { fixture, queryByText } = await render(Host);
|
|
113
|
-
fixture.componentInstance.tableRef().setState({ pagination: { pageIndex: 0, pageSize: 10 } });
|
|
114
|
-
fixture.componentInstance.setShowSummary(false);
|
|
115
|
-
fixture.detectChanges();
|
|
116
|
-
expect(queryByText(/Showing /)).toBeNull();
|
|
117
|
-
});
|
|
118
|
-
});
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
ViewEncapsulation,
|
|
5
|
-
computed,
|
|
6
|
-
inject,
|
|
7
|
-
input,
|
|
8
|
-
} from '@angular/core';
|
|
9
|
-
import { KJ_TABLE, KjTable } from '@kouji-ui/core';
|
|
10
|
-
import {
|
|
11
|
-
KjPaginationComponent,
|
|
12
|
-
KjPaginationFirstComponent,
|
|
13
|
-
KjPaginationPreviousComponent,
|
|
14
|
-
KjPaginationNextComponent,
|
|
15
|
-
KjPaginationLastComponent,
|
|
16
|
-
} from '../pagination';
|
|
17
|
-
import { KjSelectComponent, KjOptionComponent } from '../select';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Pagination footer for `<kj-table>`. Reads the active TanStack table
|
|
21
|
-
* instance via `KJ_TABLE` and writes through its mutation API
|
|
22
|
-
* (`setPageIndex`, `setPageSize`). Composes `<kj-pagination>` for the
|
|
23
|
-
* navigation row (First / Previous / Next / Last) and `<kj-select>` for the
|
|
24
|
-
* page-size control, plus a "Showing X–Y of Z" `aria-live` summary.
|
|
25
|
-
*
|
|
26
|
-
* Index translation: `KjPagination` is 1-indexed (page 1..N) whereas
|
|
27
|
-
* TanStack's `pageIndex` is 0-indexed. The component translates at the
|
|
28
|
-
* boundary — `kjPage` bound to `pageIndex() + 1`, and `(kjPageChange)`
|
|
29
|
-
* writes `next - 1` back to `setPageIndex`. `kjTotalPages` is clamped to a
|
|
30
|
-
* minimum of `1` to satisfy the pagination directive's clamp invariant when
|
|
31
|
-
* the dataset is empty (zero rows still yields one empty page).
|
|
32
|
-
*
|
|
33
|
-
* Project into a `<kj-table>` (or any element hosting the `KjTable`
|
|
34
|
-
* directive) so the component can resolve the shared table state.
|
|
35
|
-
*
|
|
36
|
-
* @example
|
|
37
|
-
* ```html
|
|
38
|
-
* <kj-table [kjData]="rows()" [kjColumns]="cols">
|
|
39
|
-
* <kj-table-pagination [kjPageSizes]="[10, 25, 50]" />
|
|
40
|
-
* </kj-table>
|
|
41
|
-
* ```
|
|
42
|
-
*
|
|
43
|
-
* @doc-category Components/Data
|
|
44
|
-
* @doc
|
|
45
|
-
* @doc-name table-pagination
|
|
46
|
-
* @doc-description Page-size selector, First/Prev/Next/Last nav, and "Showing N–M of total" summary bound to the parent table.
|
|
47
|
-
*/
|
|
48
|
-
@Component({
|
|
49
|
-
selector: 'kj-table-pagination',
|
|
50
|
-
standalone: true,
|
|
51
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
52
|
-
imports: [
|
|
53
|
-
KjPaginationComponent,
|
|
54
|
-
KjPaginationFirstComponent,
|
|
55
|
-
KjPaginationPreviousComponent,
|
|
56
|
-
KjPaginationNextComponent,
|
|
57
|
-
KjPaginationLastComponent,
|
|
58
|
-
KjSelectComponent,
|
|
59
|
-
KjOptionComponent,
|
|
60
|
-
],
|
|
61
|
-
host: {
|
|
62
|
-
class: 'kj-table-pagination',
|
|
63
|
-
'[attr.data-size]': "kjSize() === 'md' ? null : kjSize()",
|
|
64
|
-
},
|
|
65
|
-
styles: [`
|
|
66
|
-
/* Three-column footer:
|
|
67
|
-
[ page-size ] [ Showing N–M of T ] [ « ‹ — › » ]
|
|
68
|
-
The nav row uses justify-content: space-between so the prev/next
|
|
69
|
-
cluster doesn't bunch against the boundary buttons — the row reads
|
|
70
|
-
as separate jump-to-edge and step-by-one controls. */
|
|
71
|
-
.kj-table-pagination {
|
|
72
|
-
display: flex;
|
|
73
|
-
align-items: center;
|
|
74
|
-
gap: var(--kj-space-md);
|
|
75
|
-
padding: var(--kj-space-sm) var(--kj-space-md);
|
|
76
|
-
border-top: 1px solid var(--kj-border-default);
|
|
77
|
-
background: var(--kj-bg-surface);
|
|
78
|
-
font-size: var(--kj-text-sm);
|
|
79
|
-
color: var(--kj-fg-default);
|
|
80
|
-
}
|
|
81
|
-
.kj-table-pagination__page-size {
|
|
82
|
-
display: inline-flex;
|
|
83
|
-
align-items: center;
|
|
84
|
-
gap: var(--kj-space-xs);
|
|
85
|
-
color: var(--kj-fg-muted);
|
|
86
|
-
white-space: nowrap;
|
|
87
|
-
}
|
|
88
|
-
.kj-table-pagination__summary {
|
|
89
|
-
flex: 1 1 auto;
|
|
90
|
-
text-align: center;
|
|
91
|
-
color: var(--kj-fg-muted);
|
|
92
|
-
white-space: nowrap;
|
|
93
|
-
}
|
|
94
|
-
/* The nav row carries the four boundary/step buttons. space-between
|
|
95
|
-
splits them into two visual clusters — «‹ on one side, ›» on the
|
|
96
|
-
other — when the row is given a fixed width. */
|
|
97
|
-
.kj-table-pagination__nav {
|
|
98
|
-
display: inline-flex;
|
|
99
|
-
align-items: center;
|
|
100
|
-
gap: var(--kj-space-xs);
|
|
101
|
-
justify-content: space-between;
|
|
102
|
-
min-width: 8rem;
|
|
103
|
-
}
|
|
104
|
-
`],
|
|
105
|
-
template: `
|
|
106
|
-
<div class="kj-table-pagination__page-size">
|
|
107
|
-
<span class="kj-table-pagination__page-size-label">Rows per page</span>
|
|
108
|
-
<kj-select
|
|
109
|
-
class="kj-table-pagination__select"
|
|
110
|
-
[kjSize]="kjSize()"
|
|
111
|
-
[value]="pageSize()"
|
|
112
|
-
(valueChange)="onPageSizeChange($event)"
|
|
113
|
-
>
|
|
114
|
-
@for (size of kjPageSizes(); track size) {
|
|
115
|
-
<kj-option [value]="size">{{ size }}</kj-option>
|
|
116
|
-
}
|
|
117
|
-
</kj-select>
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
@if (kjShowSummary()) {
|
|
121
|
-
<span class="kj-table-pagination__summary" aria-live="polite">
|
|
122
|
-
Showing {{ summary().start }}–{{ summary().end }} of {{ summary().total }}
|
|
123
|
-
</span>
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
<kj-pagination
|
|
127
|
-
class="kj-table-pagination__nav"
|
|
128
|
-
[kjSize]="kjSize()"
|
|
129
|
-
[kjPage]="page1Indexed()"
|
|
130
|
-
[kjTotalPages]="totalPages()"
|
|
131
|
-
(kjPageChange)="onPageChange($event)"
|
|
132
|
-
>
|
|
133
|
-
<kj-pagination-first [kjSize]="kjSize()">«</kj-pagination-first>
|
|
134
|
-
<kj-pagination-previous [kjSize]="kjSize()">‹</kj-pagination-previous>
|
|
135
|
-
<kj-pagination-next [kjSize]="kjSize()">›</kj-pagination-next>
|
|
136
|
-
<kj-pagination-last [kjSize]="kjSize()">»</kj-pagination-last>
|
|
137
|
-
</kj-pagination>
|
|
138
|
-
`,
|
|
139
|
-
encapsulation: ViewEncapsulation.None,
|
|
140
|
-
})
|
|
141
|
-
export class KjTablePaginationComponent {
|
|
142
|
-
/** Available page sizes for the selector. */
|
|
143
|
-
readonly kjPageSizes = input<readonly number[]>([10, 25, 50, 100]);
|
|
144
|
-
/** Show the "Showing N–M of total" summary. Default `true`. */
|
|
145
|
-
readonly kjShowSummary = input<boolean>(true);
|
|
146
|
-
/** Size tier — matches the rest of the design system. `xs` for dense
|
|
147
|
-
* footers, `lg` for touch-first. Forwarded to both the page-size select
|
|
148
|
-
* and the nav buttons so the row stays visually consistent. */
|
|
149
|
-
readonly kjSize = input<'xs' | 'sm' | 'md' | 'lg'>('md');
|
|
150
|
-
|
|
151
|
-
protected readonly tableCtx = inject(KJ_TABLE) as KjTable<unknown>;
|
|
152
|
-
|
|
153
|
-
protected readonly pageSize = computed(() => this.tableCtx.state.pagination().pageSize);
|
|
154
|
-
protected readonly pageIndex = computed(() => this.tableCtx.state.pagination().pageIndex);
|
|
155
|
-
|
|
156
|
-
/** TanStack `pageIndex` (0-indexed) translated to `KjPagination`'s 1-indexed model. */
|
|
157
|
-
protected readonly page1Indexed = computed(() => this.pageIndex() + 1);
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Total pages reported by TanStack, clamped to a minimum of 1. The
|
|
161
|
-
* pagination directive treats `kjTotalPages <= 0` as "no pages" and locks
|
|
162
|
-
* `kjPage` to 1 — passing 1 here avoids the clamp on empty datasets.
|
|
163
|
-
*/
|
|
164
|
-
protected readonly totalPages = computed(() =>
|
|
165
|
-
Math.max(1, this.tableCtx.table().getPageCount()),
|
|
166
|
-
);
|
|
167
|
-
|
|
168
|
-
protected readonly summary = computed(() => {
|
|
169
|
-
const t = this.tableCtx.table();
|
|
170
|
-
const total = t.getRowCount();
|
|
171
|
-
const size = this.pageSize();
|
|
172
|
-
const idx = this.pageIndex();
|
|
173
|
-
if (total === 0) return { start: 0, end: 0, total: 0 };
|
|
174
|
-
const start = idx * size + 1;
|
|
175
|
-
const end = Math.min(start + size - 1, total);
|
|
176
|
-
return { start, end, total };
|
|
177
|
-
});
|
|
178
|
-
|
|
179
|
-
/** Receive 1-indexed page from `KjPagination` and translate to 0-indexed `setPageIndex`. */
|
|
180
|
-
protected onPageChange(next1Indexed: number): void {
|
|
181
|
-
const next = next1Indexed - 1;
|
|
182
|
-
if (next === this.pageIndex()) return;
|
|
183
|
-
this.tableCtx.table().setPageIndex(next);
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
protected onPageSizeChange(value: unknown): void {
|
|
187
|
-
const next = Number(value);
|
|
188
|
-
if (!Number.isFinite(next) || next === this.pageSize()) return;
|
|
189
|
-
this.tableCtx.table().setPageSize(next);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
import { Component, signal, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
-
import { render, fireEvent } from '@testing-library/angular';
|
|
3
|
-
import { afterEach, describe, expect, it } from 'vitest';
|
|
4
|
-
import { KjTable, kjColumn } from '@kouji-ui/core';
|
|
5
|
-
import { KjTableSidePanelComponent } from './table-side-panel';
|
|
6
|
-
|
|
7
|
-
interface User {
|
|
8
|
-
id: string;
|
|
9
|
-
name: string;
|
|
10
|
-
email: string;
|
|
11
|
-
role: string;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const COLS = [
|
|
15
|
-
kjColumn<User>({ accessorKey: 'name', header: 'Name', id: 'name' }),
|
|
16
|
-
kjColumn<User>({ accessorKey: 'email', header: 'Email', id: 'email' }),
|
|
17
|
-
kjColumn<User>({ accessorKey: 'role', header: 'Role', id: 'role' }),
|
|
18
|
-
];
|
|
19
|
-
|
|
20
|
-
@Component({
|
|
21
|
-
standalone: true,
|
|
22
|
-
imports: [KjTable, KjTableSidePanelComponent],
|
|
23
|
-
changeDetection: ChangeDetectionStrategy.Eager,
|
|
24
|
-
template: `
|
|
25
|
-
<table [kjTable]="cols" [kjTableData]="data()">
|
|
26
|
-
<kj-table-side-panel [(kjOpen)]="open" [kjTitle]="title()" />
|
|
27
|
-
</table>
|
|
28
|
-
`,
|
|
29
|
-
})
|
|
30
|
-
class Host {
|
|
31
|
-
readonly data = signal<User[]>([
|
|
32
|
-
{ id: '1', name: 'Ada', email: 'a@x', role: 'admin' },
|
|
33
|
-
{ id: '2', name: 'Linus', email: 'l@x', role: 'user' },
|
|
34
|
-
]);
|
|
35
|
-
readonly cols = COLS;
|
|
36
|
-
readonly open = signal(false);
|
|
37
|
-
readonly title = signal('Columns');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
/** Drawer is portaled — query the body, not the host fixture. */
|
|
41
|
-
function getDrawer(): HTMLElement | null {
|
|
42
|
-
return document.body.querySelector<HTMLElement>('kj-drawer');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function getDrawerOrThrow(): HTMLElement {
|
|
46
|
-
const el = getDrawer();
|
|
47
|
-
if (!el) throw new Error('drawer not rendered');
|
|
48
|
-
return el;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
function cleanupOverlays(): void {
|
|
52
|
-
document.body
|
|
53
|
-
.querySelectorAll('kj-drawer-shell, kj-overlay-wrapper, .kj-overlay-container')
|
|
54
|
-
.forEach((el) => el.remove());
|
|
55
|
-
document.body.querySelectorAll('kj-drawer').forEach((el) => el.remove());
|
|
56
|
-
document.documentElement.style.overflow = '';
|
|
57
|
-
document.documentElement.style.paddingRight = '';
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
describe('KjTableSidePanelComponent', () => {
|
|
61
|
-
afterEach(() => {
|
|
62
|
-
cleanupOverlays();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
it('mounts no drawer DOM when kjOpen=false; mounts a portaled drawer when true', async () => {
|
|
66
|
-
const { fixture } = await render(Host);
|
|
67
|
-
expect(getDrawer()).toBeNull();
|
|
68
|
-
|
|
69
|
-
fixture.componentInstance.open.set(true);
|
|
70
|
-
fixture.detectChanges();
|
|
71
|
-
await fixture.whenStable();
|
|
72
|
-
|
|
73
|
-
const drawer = getDrawerOrThrow();
|
|
74
|
-
expect(drawer.getAttribute('data-kj-side')).toBe('right');
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
it('lists every leaf column from the table', async () => {
|
|
78
|
-
const { fixture } = await render(Host);
|
|
79
|
-
fixture.componentInstance.open.set(true);
|
|
80
|
-
fixture.detectChanges();
|
|
81
|
-
await fixture.whenStable();
|
|
82
|
-
|
|
83
|
-
const drawer = getDrawerOrThrow();
|
|
84
|
-
expect(drawer.textContent).toContain('Name');
|
|
85
|
-
expect(drawer.textContent).toContain('Email');
|
|
86
|
-
expect(drawer.textContent).toContain('Role');
|
|
87
|
-
|
|
88
|
-
const checkboxes = drawer.querySelectorAll('input[type="checkbox"]');
|
|
89
|
-
expect(checkboxes.length).toBe(3);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('toggling a column checkbox flips column visibility', async () => {
|
|
93
|
-
const { fixture } = await render(Host);
|
|
94
|
-
fixture.componentInstance.open.set(true);
|
|
95
|
-
fixture.detectChanges();
|
|
96
|
-
await fixture.whenStable();
|
|
97
|
-
|
|
98
|
-
const drawer = getDrawerOrThrow();
|
|
99
|
-
const emailCheckbox = drawer.querySelectorAll('input[type="checkbox"]')[1] as HTMLInputElement;
|
|
100
|
-
expect(emailCheckbox.checked).toBe(true);
|
|
101
|
-
|
|
102
|
-
fireEvent.click(emailCheckbox);
|
|
103
|
-
fixture.detectChanges();
|
|
104
|
-
await fixture.whenStable();
|
|
105
|
-
|
|
106
|
-
const after = getDrawerOrThrow().querySelectorAll(
|
|
107
|
-
'input[type="checkbox"]',
|
|
108
|
-
)[1] as HTMLInputElement;
|
|
109
|
-
expect(after.checked).toBe(false);
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('clicking "Pin left" pushes the column id into columnPinning.left', async () => {
|
|
113
|
-
const { fixture } = await render(Host);
|
|
114
|
-
fixture.componentInstance.open.set(true);
|
|
115
|
-
fixture.detectChanges();
|
|
116
|
-
await fixture.whenStable();
|
|
117
|
-
|
|
118
|
-
const drawer = getDrawerOrThrow();
|
|
119
|
-
const pinLeftBtn = drawer.querySelectorAll(
|
|
120
|
-
'button[data-action="pin-left"]',
|
|
121
|
-
)[0] as HTMLButtonElement;
|
|
122
|
-
fireEvent.click(pinLeftBtn);
|
|
123
|
-
fixture.detectChanges();
|
|
124
|
-
await fixture.whenStable();
|
|
125
|
-
|
|
126
|
-
const after = getDrawerOrThrow().querySelectorAll(
|
|
127
|
-
'button[data-action="pin-left"]',
|
|
128
|
-
)[0] as HTMLButtonElement;
|
|
129
|
-
expect(after.getAttribute('aria-pressed')).toBe('true');
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
it('clicking "Group by" pushes the column id into grouping', async () => {
|
|
133
|
-
const { fixture } = await render(Host);
|
|
134
|
-
fixture.componentInstance.open.set(true);
|
|
135
|
-
fixture.detectChanges();
|
|
136
|
-
await fixture.whenStable();
|
|
137
|
-
|
|
138
|
-
const findRoleGroupBtn = (): HTMLButtonElement => {
|
|
139
|
-
const drawer = getDrawerOrThrow();
|
|
140
|
-
const rows = Array.from(drawer.querySelectorAll('.kj-table-side-panel-row'));
|
|
141
|
-
const roleRow = rows.find((r) => r.textContent?.includes('Role'));
|
|
142
|
-
if (!roleRow) throw new Error('Role row missing');
|
|
143
|
-
return roleRow.querySelector('button[data-action="group"]') as HTMLButtonElement;
|
|
144
|
-
};
|
|
145
|
-
|
|
146
|
-
fireEvent.click(findRoleGroupBtn());
|
|
147
|
-
fixture.detectChanges();
|
|
148
|
-
await fixture.whenStable();
|
|
149
|
-
|
|
150
|
-
expect(findRoleGroupBtn().getAttribute('aria-pressed')).toBe('true');
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
it('renders the kjTitle in the drawer header', async () => {
|
|
154
|
-
const { fixture } = await render(Host);
|
|
155
|
-
fixture.componentInstance.title.set('Pick your columns');
|
|
156
|
-
fixture.componentInstance.open.set(true);
|
|
157
|
-
fixture.detectChanges();
|
|
158
|
-
await fixture.whenStable();
|
|
159
|
-
|
|
160
|
-
const drawer = getDrawerOrThrow();
|
|
161
|
-
const title = drawer.querySelector('.kj-drawer-title') as HTMLElement;
|
|
162
|
-
expect(title).toBeTruthy();
|
|
163
|
-
expect(title.textContent).toBe('Pick your columns');
|
|
164
|
-
// The host element of the content component (parent of `<kj-drawer>`)
|
|
165
|
-
// carries the accessible name via `aria-label`.
|
|
166
|
-
const content = document.body.querySelector('kj-table-side-panel-content') as HTMLElement;
|
|
167
|
-
expect(content).toBeTruthy();
|
|
168
|
-
expect(content.getAttribute('aria-label')).toBe('Pick your columns');
|
|
169
|
-
});
|
|
170
|
-
});
|