@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,89 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
ElementRef,
|
|
5
|
-
ViewEncapsulation,
|
|
6
|
-
afterNextRender,
|
|
7
|
-
inject,
|
|
8
|
-
signal,
|
|
9
|
-
viewChild,
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import { KjNumberInputComponent } from '../../number-input/number-input';
|
|
12
|
-
import { KJ_EDITOR_CONTRACT, type KjEditorContract } from './index';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Inline numeric cell editor for `<kj-table>`. Renders the styled
|
|
16
|
-
* `<kj-number-input>` component (which wraps the headless number-input
|
|
17
|
-
* directive family) so cell editors stay consistent with the rest of the
|
|
18
|
-
* design system.
|
|
19
|
-
*
|
|
20
|
-
* Commits on Enter or blur. Cancels on Escape. Non-finite drafts (e.g. an
|
|
21
|
-
* empty field) round-trip through `cancel()` rather than committing `NaN`.
|
|
22
|
-
*/
|
|
23
|
-
@Component({
|
|
24
|
-
selector: 'kj-number-editor',
|
|
25
|
-
standalone: true,
|
|
26
|
-
imports: [KjNumberInputComponent],
|
|
27
|
-
template: `
|
|
28
|
-
<kj-number-input
|
|
29
|
-
class="kj-editor kj-editor--number"
|
|
30
|
-
[(kjValue)]="draft"
|
|
31
|
-
(keydown.enter)="commit()"
|
|
32
|
-
(keydown.escape)="cancel(); $event.stopPropagation()"
|
|
33
|
-
(focusout)="onFocusOut($event)"
|
|
34
|
-
/>
|
|
35
|
-
`,
|
|
36
|
-
encapsulation: ViewEncapsulation.None,
|
|
37
|
-
host: { style: 'display: contents;' },
|
|
38
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
39
|
-
})
|
|
40
|
-
export class KjNumberEditor {
|
|
41
|
-
private readonly ctx = inject(KJ_EDITOR_CONTRACT) as KjEditorContract<number>;
|
|
42
|
-
private readonly hostEl: ElementRef<HTMLElement> = inject(ElementRef);
|
|
43
|
-
private settled = false;
|
|
44
|
-
private mounted = false;
|
|
45
|
-
|
|
46
|
-
/** Template-bound `<kj-number-input>` — exposes a public `focus()`. */
|
|
47
|
-
private readonly numberInput = viewChild(KjNumberInputComponent);
|
|
48
|
-
|
|
49
|
-
protected readonly draft = signal<number>(0);
|
|
50
|
-
|
|
51
|
-
constructor() {
|
|
52
|
-
const v = this.ctx.value;
|
|
53
|
-
this.draft.set(typeof v === 'number' && Number.isFinite(v) ? v : 0);
|
|
54
|
-
afterNextRender(() => {
|
|
55
|
-
this.numberInput()?.focus();
|
|
56
|
-
this.mounted = true;
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
protected commit(): void {
|
|
61
|
-
if (this.settled) return;
|
|
62
|
-
const value = this.draft();
|
|
63
|
-
this.settled = true;
|
|
64
|
-
if (Number.isFinite(value)) {
|
|
65
|
-
this.ctx.commit(value);
|
|
66
|
-
} else {
|
|
67
|
-
this.ctx.cancel();
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
protected cancel(): void {
|
|
72
|
-
if (this.settled) return;
|
|
73
|
-
this.settled = true;
|
|
74
|
-
this.ctx.cancel();
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
/**
|
|
78
|
-
* Commit on blur — but only when focus leaves the entire editor host
|
|
79
|
-
* (i.e. not when focus moves between the inner input and a stepper
|
|
80
|
-
* button). Without this guard, clicking a +/- stepper would fire blur
|
|
81
|
-
* and prematurely commit before the value updates.
|
|
82
|
-
*/
|
|
83
|
-
protected onFocusOut(event: FocusEvent): void {
|
|
84
|
-
if (!this.mounted || this.settled) return;
|
|
85
|
-
const next = event.relatedTarget as Node | null;
|
|
86
|
-
if (next && this.hostEl.nativeElement.contains(next)) return;
|
|
87
|
-
this.commit();
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
ElementRef,
|
|
5
|
-
ViewEncapsulation,
|
|
6
|
-
computed,
|
|
7
|
-
effect,
|
|
8
|
-
inject,
|
|
9
|
-
input,
|
|
10
|
-
signal,
|
|
11
|
-
viewChild,
|
|
12
|
-
} from '@angular/core';
|
|
13
|
-
import { KjOptionComponent, KjSelectComponent } from '../../select/select';
|
|
14
|
-
import { KJ_EDITOR_CONTRACT, type KjEditorContract } from './index';
|
|
15
|
-
|
|
16
|
-
/** Option entry accepted by `<kj-select-editor>`. */
|
|
17
|
-
export type KjSelectEditorOption = string | { value: unknown; label: string };
|
|
18
|
-
|
|
19
|
-
interface ResolvedOption {
|
|
20
|
-
readonly value: unknown;
|
|
21
|
-
readonly label: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Inline select cell editor for `<kj-table>`. Renders the styled
|
|
26
|
-
* `<kj-select>` component (trigger button + portalled listbox panel) so
|
|
27
|
-
* cell editors stay consistent with the rest of the design system.
|
|
28
|
-
*
|
|
29
|
-
* Accepts options as `string[]` or `{ value, label }[]` — strings are
|
|
30
|
-
* mapped to `{ value: s, label: s }`. The styled select closes its
|
|
31
|
-
* panel on activation; the editor commits the selected value at that
|
|
32
|
-
* point. Escape cancels.
|
|
33
|
-
*/
|
|
34
|
-
@Component({
|
|
35
|
-
selector: 'kj-select-editor',
|
|
36
|
-
standalone: true,
|
|
37
|
-
imports: [KjSelectComponent, KjOptionComponent],
|
|
38
|
-
template: `
|
|
39
|
-
<kj-select
|
|
40
|
-
class="kj-editor kj-editor--select"
|
|
41
|
-
[value]="draftValue()"
|
|
42
|
-
(valueChange)="onValueChange($event)"
|
|
43
|
-
(keydown.escape)="cancel(); $event.stopPropagation()"
|
|
44
|
-
>
|
|
45
|
-
@for (opt of resolved(); track opt.label) {
|
|
46
|
-
<kj-option [value]="opt.value">{{ opt.label }}</kj-option>
|
|
47
|
-
}
|
|
48
|
-
</kj-select>
|
|
49
|
-
`,
|
|
50
|
-
encapsulation: ViewEncapsulation.None,
|
|
51
|
-
host: { style: 'display: contents;' },
|
|
52
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
53
|
-
})
|
|
54
|
-
export class KjSelectEditor {
|
|
55
|
-
private readonly ctx = inject(KJ_EDITOR_CONTRACT) as KjEditorContract<unknown>;
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Template-bound reference to the inner `<kj-select>`. Exposes the
|
|
59
|
-
* trigger via its public `focus()` API — no DOM querying needed.
|
|
60
|
-
*/
|
|
61
|
-
private readonly select = viewChild(KjSelectComponent);
|
|
62
|
-
|
|
63
|
-
/** Direct option list. Optional — when omitted, options are pulled
|
|
64
|
-
* from `contract.meta?.options` so the cell-editor-outlet can forward
|
|
65
|
-
* the column's `kjSelectOptions` without binding inputs imperatively. */
|
|
66
|
-
readonly kjOptions = input<ReadonlyArray<KjSelectEditorOption>>([]);
|
|
67
|
-
|
|
68
|
-
protected readonly resolved = computed<ResolvedOption[]>(() => {
|
|
69
|
-
const direct = this.kjOptions();
|
|
70
|
-
const fromMeta = this.ctx.meta?.['options'] as ReadonlyArray<KjSelectEditorOption> | undefined;
|
|
71
|
-
const source = direct.length > 0 ? direct : (fromMeta ?? []);
|
|
72
|
-
return source.map(opt =>
|
|
73
|
-
typeof opt === 'string'
|
|
74
|
-
? { value: opt, label: opt }
|
|
75
|
-
: { value: opt.value, label: opt.label },
|
|
76
|
-
);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
protected readonly draftValue = signal<unknown>(undefined);
|
|
80
|
-
|
|
81
|
-
private focused = false;
|
|
82
|
-
|
|
83
|
-
constructor() {
|
|
84
|
-
this.draftValue.set(this.ctx.value);
|
|
85
|
-
// Two reactive hops: first the editor's viewChild resolves to the
|
|
86
|
-
// `<kj-select>` instance, then that instance's own `triggerEl`
|
|
87
|
-
// signal resolves to the trigger button's ElementRef. `effect` tracks
|
|
88
|
-
// both. We focus once — `focused` prevents stealing focus back if
|
|
89
|
-
// the user later clicks away and the signal re-emits.
|
|
90
|
-
effect(() => {
|
|
91
|
-
const sel = this.select();
|
|
92
|
-
const trigger = sel?.triggerEl();
|
|
93
|
-
if (!trigger || this.focused) return;
|
|
94
|
-
this.focused = true;
|
|
95
|
-
(trigger as ElementRef<HTMLElement>).nativeElement.focus();
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
protected onValueChange(next: unknown): void {
|
|
100
|
-
this.draftValue.set(next);
|
|
101
|
-
this.ctx.commit(next);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
protected cancel(): void {
|
|
105
|
-
this.ctx.cancel();
|
|
106
|
-
}
|
|
107
|
-
}
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
ElementRef,
|
|
5
|
-
ViewEncapsulation,
|
|
6
|
-
afterNextRender,
|
|
7
|
-
inject,
|
|
8
|
-
signal,
|
|
9
|
-
viewChild,
|
|
10
|
-
} from '@angular/core';
|
|
11
|
-
import { KjInputComponent } from '../../input/input';
|
|
12
|
-
import { KJ_EDITOR_CONTRACT, type KjEditorContract } from './index';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Inline text cell editor for `<kj-table>`. Renders the styled
|
|
16
|
-
* `<kj-input>` component (which wraps the headless `kjInput` directive and
|
|
17
|
-
* applies theme tokens) so cell editors stay consistent with the rest of
|
|
18
|
-
* the design system.
|
|
19
|
-
*
|
|
20
|
-
* Commits on Enter or blur. Cancels on Escape.
|
|
21
|
-
*/
|
|
22
|
-
@Component({
|
|
23
|
-
selector: 'kj-text-editor',
|
|
24
|
-
standalone: true,
|
|
25
|
-
imports: [KjInputComponent],
|
|
26
|
-
template: `
|
|
27
|
-
<kj-input
|
|
28
|
-
class="kj-editor kj-editor--text"
|
|
29
|
-
[value]="draft()"
|
|
30
|
-
(input)="onInput($event)"
|
|
31
|
-
(keydown.enter)="commit()"
|
|
32
|
-
(keydown.escape)="cancel(); $event.stopPropagation()"
|
|
33
|
-
(focusout)="onFocusOut($event)"
|
|
34
|
-
/>
|
|
35
|
-
`,
|
|
36
|
-
encapsulation: ViewEncapsulation.None,
|
|
37
|
-
host: { style: 'display: contents;' },
|
|
38
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
39
|
-
})
|
|
40
|
-
export class KjTextEditor {
|
|
41
|
-
private readonly ctx = inject(KJ_EDITOR_CONTRACT) as KjEditorContract<string>;
|
|
42
|
-
private readonly hostEl: ElementRef<HTMLElement> = inject(ElementRef);
|
|
43
|
-
private settled = false;
|
|
44
|
-
private mounted = false;
|
|
45
|
-
|
|
46
|
-
/** Template-bound `<kj-input>` instance — exposes a public `focus()`. */
|
|
47
|
-
private readonly inputCmp = viewChild(KjInputComponent);
|
|
48
|
-
|
|
49
|
-
protected readonly draft = signal<string>('');
|
|
50
|
-
|
|
51
|
-
constructor() {
|
|
52
|
-
this.draft.set(this.ctx.value ?? '');
|
|
53
|
-
afterNextRender(() => {
|
|
54
|
-
this.inputCmp()?.focus();
|
|
55
|
-
this.mounted = true;
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
protected onInput(event: Event): void {
|
|
60
|
-
const target = event.target as HTMLInputElement | null;
|
|
61
|
-
if (target) this.draft.set(target.value);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
protected commit(): void {
|
|
65
|
-
if (this.settled) return;
|
|
66
|
-
this.settled = true;
|
|
67
|
-
this.ctx.commit(this.draft());
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
protected cancel(): void {
|
|
71
|
-
if (this.settled) return;
|
|
72
|
-
this.settled = true;
|
|
73
|
-
this.ctx.cancel();
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
protected onFocusOut(event: FocusEvent): void {
|
|
77
|
-
if (!this.mounted || this.settled) return;
|
|
78
|
-
const next = event.relatedTarget as Node | null;
|
|
79
|
-
if (next && this.hostEl.nativeElement.contains(next)) return;
|
|
80
|
-
this.commit();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { exportCsv, exportJson, toTsv } from './table-export';
|
|
3
|
-
|
|
4
|
-
describe('exportCsv', () => {
|
|
5
|
-
it('escapes commas + quotes + newlines', () => {
|
|
6
|
-
const csv = exportCsv({
|
|
7
|
-
rows: [{ a: 'hi, bob', b: 'with "quotes"', c: 'line\nbreak' }],
|
|
8
|
-
columns: ['a', 'b', 'c'],
|
|
9
|
-
});
|
|
10
|
-
expect(csv).toBe('a,b,c\n"hi, bob","with ""quotes""","line\nbreak"');
|
|
11
|
-
});
|
|
12
|
-
it('uses column accessors via the getValue fn', () => {
|
|
13
|
-
const csv = exportCsv({
|
|
14
|
-
rows: [{ name: 'Alice' }],
|
|
15
|
-
columns: ['name'],
|
|
16
|
-
getValue: (row, col) => col === 'name' ? (row as { name: string }).name.toUpperCase() : '',
|
|
17
|
-
});
|
|
18
|
-
expect(csv).toBe('name\nALICE');
|
|
19
|
-
});
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
describe('exportJson', () => {
|
|
23
|
-
it('pretty-prints by default', () => {
|
|
24
|
-
const json = exportJson({ rows: [{ a: 1 }] });
|
|
25
|
-
expect(json).toBe('[\n {\n "a": 1\n }\n]');
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
describe('toTsv', () => {
|
|
30
|
-
it('returns tab-separated values', () => {
|
|
31
|
-
expect(toTsv({ rows: [{ a: 1, b: 2 }], columns: ['a', 'b'] })).toBe('a\tb\n1\t2');
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export interface ExportOptions<TRow = unknown> {
|
|
2
|
-
rows: readonly TRow[];
|
|
3
|
-
columns: readonly string[];
|
|
4
|
-
getValue?: (row: TRow, column: string) => unknown;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
function defaultGet<T>(row: T, column: string): unknown {
|
|
8
|
-
return (row as Record<string, unknown>)[column];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function csvEscape(v: unknown): string {
|
|
12
|
-
if (v == null) return '';
|
|
13
|
-
const s = String(v);
|
|
14
|
-
const needsQuotes = s.includes(',') || s.includes('"') || s.includes('\n');
|
|
15
|
-
return needsQuotes ? `"${s.replace(/"/g, '""')}"` : s;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export function exportCsv<T>(opts: ExportOptions<T>): string {
|
|
19
|
-
const get = opts.getValue ?? defaultGet;
|
|
20
|
-
const header = opts.columns.join(',');
|
|
21
|
-
const body = opts.rows.map(r =>
|
|
22
|
-
opts.columns.map(c => csvEscape(get(r, c))).join(',')
|
|
23
|
-
).join('\n');
|
|
24
|
-
return `${header}\n${body}`;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function exportJson<T>(opts: { rows: readonly T[]; pretty?: boolean }): string {
|
|
28
|
-
return JSON.stringify(opts.rows, null, opts.pretty === false ? 0 : 2);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export function toTsv<T>(opts: ExportOptions<T>): string {
|
|
32
|
-
const get = opts.getValue ?? defaultGet;
|
|
33
|
-
const header = opts.columns.join('\t');
|
|
34
|
-
const body = opts.rows.map(r =>
|
|
35
|
-
opts.columns.map(c => String(get(r, c) ?? '')).join('\t')
|
|
36
|
-
).join('\n');
|
|
37
|
-
return `${header}\n${body}`;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function downloadString(filename: string, content: string, type = 'text/plain'): void {
|
|
41
|
-
const blob = new Blob([content], { type });
|
|
42
|
-
const url = URL.createObjectURL(blob);
|
|
43
|
-
const a = document.createElement('a');
|
|
44
|
-
a.href = url; a.download = filename;
|
|
45
|
-
document.body.appendChild(a);
|
|
46
|
-
a.click();
|
|
47
|
-
document.body.removeChild(a);
|
|
48
|
-
URL.revokeObjectURL(url);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export async function copyToClipboard(text: string): Promise<void> {
|
|
52
|
-
await navigator.clipboard.writeText(text);
|
|
53
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DestroyRef,
|
|
3
|
-
Directive,
|
|
4
|
-
EnvironmentInjector,
|
|
5
|
-
Injector,
|
|
6
|
-
Type,
|
|
7
|
-
ViewContainerRef,
|
|
8
|
-
computed,
|
|
9
|
-
effect,
|
|
10
|
-
inject,
|
|
11
|
-
input,
|
|
12
|
-
type ComponentRef,
|
|
13
|
-
} from '@angular/core';
|
|
14
|
-
import type { Column, Table } from '@tanstack/angular-table';
|
|
15
|
-
import {
|
|
16
|
-
KJ_TABLE,
|
|
17
|
-
KjTable,
|
|
18
|
-
provideKjFilterParams,
|
|
19
|
-
type KjFilterParams,
|
|
20
|
-
} from '@kouji-ui/core';
|
|
21
|
-
import { KJ_FILTER_CONTEXT, type KjFilterContext } from './table-filters/text-filter';
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Cell-row outlet that mounts a built-in or user-supplied filter UI for one
|
|
25
|
-
* column. Uses its own `ViewContainerRef` for mount + destroy, so when the
|
|
26
|
-
* host `@if` removes the directive Angular destroys the filter automatically
|
|
27
|
-
* — no DOM querying, no manual lifecycle bookkeeping.
|
|
28
|
-
*
|
|
29
|
-
* The mounted component receives:
|
|
30
|
-
* - **`KJ_FILTER_CONTEXT`** (legacy) — for the four built-in filters.
|
|
31
|
-
* - **`KJ_FILTER_PARAMS`** (modern) — used via {@link injectKjFilterParams}
|
|
32
|
-
* from any user-supplied filter. Custom filters should prefer this token
|
|
33
|
-
* over an `@Input() params` field — `setInput` / `inputBinding` cannot be
|
|
34
|
-
* forwarded blindly here because we don't know whether the input is
|
|
35
|
-
* declared, and Angular's `inputBinding` errors when the target component
|
|
36
|
-
* has no matching input.
|
|
37
|
-
*
|
|
38
|
-
* Column-level options (e.g. `selectOptions`) are sourced directly from
|
|
39
|
-
* `params.column.columnDef.meta.kj` by the filter itself, not piped through
|
|
40
|
-
* this outlet — keeping the outlet free of filter-type branching.
|
|
41
|
-
*
|
|
42
|
-
* ```html
|
|
43
|
-
* <ng-container
|
|
44
|
-
* kjFilterCell
|
|
45
|
-
* [kjColumn]="h.column"
|
|
46
|
-
* [kjFilter]="filterRendererFor(h.column)"
|
|
47
|
-
* />
|
|
48
|
-
* ```
|
|
49
|
-
*/
|
|
50
|
-
@Directive({
|
|
51
|
-
selector: '[kjFilterCell]',
|
|
52
|
-
standalone: true,
|
|
53
|
-
})
|
|
54
|
-
export class KjFilterCellOutlet<TData = unknown> {
|
|
55
|
-
/** Column this filter operates on. */
|
|
56
|
-
readonly kjColumn = input.required<Column<TData, unknown>>();
|
|
57
|
-
|
|
58
|
-
/** Component class to mount. `null` mounts nothing. */
|
|
59
|
-
readonly kjFilter = input<Type<unknown> | null>(null);
|
|
60
|
-
|
|
61
|
-
private readonly vcr = inject(ViewContainerRef);
|
|
62
|
-
private readonly envInjector = inject(EnvironmentInjector);
|
|
63
|
-
private readonly parentInjector = inject(Injector);
|
|
64
|
-
private readonly destroyRef = inject(DestroyRef);
|
|
65
|
-
private readonly tableDir = inject<KjTable<TData>>(KJ_TABLE as never);
|
|
66
|
-
|
|
67
|
-
private ref: ComponentRef<unknown> | null = null;
|
|
68
|
-
|
|
69
|
-
// Cache the params used to mount the current ref. The effect compares
|
|
70
|
-
// these on each run and skips re-mounting when nothing meaningful changed
|
|
71
|
-
// — without this guard, even an identity-stable input that happens to be
|
|
72
|
-
// re-emitted (e.g. TanStack rebuilding header groups on every CD) would
|
|
73
|
-
// tear the filter down and recreate it, which broke the kj-select overlay
|
|
74
|
-
// because the kj-select got destroyed mid-open.
|
|
75
|
-
private mountedFor: { filter: Type<unknown> | null; column: Column<TData, unknown> | null } = { filter: null, column: null };
|
|
76
|
-
|
|
77
|
-
constructor() {
|
|
78
|
-
effect(() => {
|
|
79
|
-
const filter = this.kjFilter();
|
|
80
|
-
const column = this.kjColumn();
|
|
81
|
-
// Skip the re-mount when nothing meaningful changed. Without this
|
|
82
|
-
// guard, the parent template re-evaluates inputs every CD pass (the
|
|
83
|
-
// TanStack `Column` reference can be re-created during table init),
|
|
84
|
-
// so the effect would tear the filter down and rebuild it 8–12 times
|
|
85
|
-
// — destroying the kj-select mid-open and making the dropdown look
|
|
86
|
-
// broken.
|
|
87
|
-
if (this.ref && this.mountedFor.filter === filter && this.mountedFor.column === column) {
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
this.tearDown();
|
|
91
|
-
if (!filter) return;
|
|
92
|
-
|
|
93
|
-
const tbl: Table<TData> = this.tableDir.table();
|
|
94
|
-
const ctx: KjFilterContext<TData> = { column, table: tbl };
|
|
95
|
-
const modelSig = computed(() => {
|
|
96
|
-
// Subscribe to the table's filter state slice so the param signal
|
|
97
|
-
// updates whenever any column filter changes.
|
|
98
|
-
this.tableDir.state.columnFilters();
|
|
99
|
-
return (column.getFilterValue() ?? null) as unknown;
|
|
100
|
-
});
|
|
101
|
-
const params: KjFilterParams<TData, unknown> = {
|
|
102
|
-
column,
|
|
103
|
-
api: this.tableDir.gridApi,
|
|
104
|
-
columnApi: this.tableDir.columnApi,
|
|
105
|
-
model: modelSig,
|
|
106
|
-
setModel: (v) =>
|
|
107
|
-
column.setFilterValue(
|
|
108
|
-
v === '' || v === null || v === undefined ? undefined : v,
|
|
109
|
-
),
|
|
110
|
-
isActive: () => column.getIsFiltered(),
|
|
111
|
-
clear: () => column.setFilterValue(undefined),
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const childInjector = Injector.create({
|
|
115
|
-
providers: [
|
|
116
|
-
{ provide: KJ_FILTER_CONTEXT, useValue: ctx },
|
|
117
|
-
provideKjFilterParams(params),
|
|
118
|
-
],
|
|
119
|
-
parent: this.parentInjector,
|
|
120
|
-
});
|
|
121
|
-
this.ref = this.vcr.createComponent(filter, {
|
|
122
|
-
environmentInjector: this.envInjector,
|
|
123
|
-
injector: childInjector,
|
|
124
|
-
});
|
|
125
|
-
this.mountedFor = { filter, column };
|
|
126
|
-
});
|
|
127
|
-
|
|
128
|
-
this.destroyRef.onDestroy(() => this.tearDown());
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
private tearDown(): void {
|
|
132
|
-
this.ref?.destroy();
|
|
133
|
-
this.ref = null;
|
|
134
|
-
this.vcr.clear();
|
|
135
|
-
this.mountedFor = { filter: null, column: null };
|
|
136
|
-
}
|
|
137
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
ChangeDetectionStrategy,
|
|
3
|
-
Component,
|
|
4
|
-
ViewEncapsulation,
|
|
5
|
-
computed,
|
|
6
|
-
inject,
|
|
7
|
-
} from '@angular/core';
|
|
8
|
-
import type { Column } from '@tanstack/angular-table';
|
|
9
|
-
import { KjVisuallyHidden, type KjDateFilterModel } from '@kouji-ui/core';
|
|
10
|
-
import { KjDatePickerComponent } from '../../date-picker/date-picker';
|
|
11
|
-
import { KJ_FILTER_CONTEXT, type KjFilterContext } from './text-filter';
|
|
12
|
-
|
|
13
|
-
/** Filter value shape — ISO date strings (`YYYY-MM-DD`) or `undefined` per bound. */
|
|
14
|
-
export type KjDateRange = [from: string | undefined, to: string | undefined];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Date-range filter UI. Renders two styled `<kj-date-picker>` controls
|
|
18
|
-
* (from / to) and writes a `[from, to]` tuple of ISO date strings to
|
|
19
|
-
* `column.setFilterValue`. Either bound may be blank to leave it open.
|
|
20
|
-
*
|
|
21
|
-
* The wire format stays string-based (`YYYY-MM-DD`) so it serialises
|
|
22
|
-
* cleanly into URL state and round-trips without timezone surprises —
|
|
23
|
-
* conversion to / from `Date` is local to the picker boundary.
|
|
24
|
-
*
|
|
25
|
-
* Each picker is wrapped in a `<label>` carrying visually-hidden text so
|
|
26
|
-
* screen readers announce which bound the picker controls.
|
|
27
|
-
*/
|
|
28
|
-
@Component({
|
|
29
|
-
selector: 'kj-date-filter',
|
|
30
|
-
standalone: true,
|
|
31
|
-
imports: [KjDatePickerComponent, KjVisuallyHidden],
|
|
32
|
-
styleUrl: './filters.css',
|
|
33
|
-
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
34
|
-
encapsulation: ViewEncapsulation.None,
|
|
35
|
-
host: {
|
|
36
|
-
class: 'kj-date-filter',
|
|
37
|
-
},
|
|
38
|
-
template: `
|
|
39
|
-
<div class="kj-date-filter__label kj-date-filter__label--from">
|
|
40
|
-
<span kjVisuallyHidden class="kj-date-filter__caption">{{ fromAriaLabel() }}</span>
|
|
41
|
-
<kj-date-picker
|
|
42
|
-
class="kj-date-filter__input kj-date-filter__input--from"
|
|
43
|
-
kjSize="xs"
|
|
44
|
-
[kjValue]="fromDate()"
|
|
45
|
-
(kjValueChange)="onFromChange($event)"
|
|
46
|
-
/>
|
|
47
|
-
</div>
|
|
48
|
-
<div class="kj-date-filter__label kj-date-filter__label--to">
|
|
49
|
-
<span kjVisuallyHidden class="kj-date-filter__caption">{{ toAriaLabel() }}</span>
|
|
50
|
-
<kj-date-picker
|
|
51
|
-
class="kj-date-filter__input kj-date-filter__input--to"
|
|
52
|
-
kjSize="xs"
|
|
53
|
-
[kjValue]="toDate()"
|
|
54
|
-
(kjValueChange)="onToChange($event)"
|
|
55
|
-
/>
|
|
56
|
-
</div>
|
|
57
|
-
`,
|
|
58
|
-
})
|
|
59
|
-
export class KjDateFilter<TData = unknown> {
|
|
60
|
-
private readonly ctx = inject<KjFilterContext<TData>>(KJ_FILTER_CONTEXT);
|
|
61
|
-
|
|
62
|
-
private current: KjDateRange = (() => {
|
|
63
|
-
const v = this.ctx.column.getFilterValue();
|
|
64
|
-
if (Array.isArray(v)) return v as KjDateRange;
|
|
65
|
-
if (v && typeof v === 'object' && (v as { filterType?: string }).filterType === 'date') {
|
|
66
|
-
const m = v as KjDateFilterModel;
|
|
67
|
-
return [m.dateFrom, m.dateTo];
|
|
68
|
-
}
|
|
69
|
-
return [undefined, undefined];
|
|
70
|
-
})();
|
|
71
|
-
|
|
72
|
-
protected readonly fromDate = computed(() => isoToDate(this.current[0]));
|
|
73
|
-
protected readonly toDate = computed(() => isoToDate(this.current[1]));
|
|
74
|
-
|
|
75
|
-
protected readonly fromAriaLabel = computed(
|
|
76
|
-
() => `Filter by ${headerLabel(this.ctx.column)} from date`,
|
|
77
|
-
);
|
|
78
|
-
protected readonly toAriaLabel = computed(
|
|
79
|
-
() => `Filter by ${headerLabel(this.ctx.column)} to date`,
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
protected onFromChange(date: Date | null): void {
|
|
83
|
-
this.current = [dateToIso(date), this.current[1]];
|
|
84
|
-
this.commit();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
protected onToChange(date: Date | null): void {
|
|
88
|
-
this.current = [this.current[0], dateToIso(date)];
|
|
89
|
-
this.commit();
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
private commit(): void {
|
|
93
|
-
const [from, to] = this.current;
|
|
94
|
-
if (from === undefined && to === undefined) {
|
|
95
|
-
this.ctx.column.setFilterValue(undefined);
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
const model: KjDateFilterModel = { filterType: 'date', type: 'inRange', dateFrom: from, dateTo: to };
|
|
99
|
-
this.ctx.column.setFilterValue(model);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
function isoToDate(iso: string | undefined): Date | null {
|
|
104
|
-
if (!iso) return null;
|
|
105
|
-
// Parse as local-time midnight so the date round-trips without TZ drift.
|
|
106
|
-
const [y, m, d] = iso.split('-').map(Number);
|
|
107
|
-
if (!y || !m || !d) return null;
|
|
108
|
-
return new Date(y, m - 1, d);
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function dateToIso(date: Date | null | undefined): string | undefined {
|
|
112
|
-
if (!date) return undefined;
|
|
113
|
-
const y = date.getFullYear();
|
|
114
|
-
const m = String(date.getMonth() + 1).padStart(2, '0');
|
|
115
|
-
const d = String(date.getDate()).padStart(2, '0');
|
|
116
|
-
return `${y}-${m}-${d}`;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function headerLabel<TData>(column: Column<TData, unknown>): string {
|
|
120
|
-
const header = column.columnDef.header;
|
|
121
|
-
return typeof header === 'string' ? header : column.id;
|
|
122
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Filter-row layout. All sizing flows from `kjSize="xs"` applied to the inner
|
|
3
|
-
* primitives (kj-input, kj-number-input, kj-select, kj-date-picker) — no more
|
|
4
|
-
* CSS-var override fakery here. This file owns the *layout* of the filter
|
|
5
|
-
* shells (flex direction, gap, child width), nothing else.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
.kj-text-filter,
|
|
9
|
-
.kj-number-filter,
|
|
10
|
-
.kj-date-filter,
|
|
11
|
-
.kj-select-filter {
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
gap: var(--kj-base-space-xs, 0.25rem);
|
|
15
|
-
width: 100%;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
/* The text filter wraps its <kj-input> in a <label>; let the label own the
|
|
19
|
-
row so the visually-hidden caption stays in flow without inflating width. */
|
|
20
|
-
.kj-text-filter__label,
|
|
21
|
-
.kj-select-filter__label {
|
|
22
|
-
display: flex;
|
|
23
|
-
width: 100%;
|
|
24
|
-
align-items: center;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/* Number filter: operator picker keeps natural width, each number input
|
|
28
|
-
takes equal share of the rest. */
|
|
29
|
-
.kj-number-filter__operator {
|
|
30
|
-
flex: 0 0 auto;
|
|
31
|
-
min-width: 4.25rem;
|
|
32
|
-
}
|
|
33
|
-
.kj-number-filter__input {
|
|
34
|
-
flex: 1 1 0;
|
|
35
|
-
min-width: 0;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/* Date filter: both pickers split the row evenly. */
|
|
39
|
-
.kj-date-filter__label {
|
|
40
|
-
display: flex;
|
|
41
|
-
flex: 1 1 0;
|
|
42
|
-
min-width: 0;
|
|
43
|
-
align-items: center;
|
|
44
|
-
}
|
|
45
|
-
.kj-date-filter .kj-date-picker {
|
|
46
|
-
flex: 1 1 0;
|
|
47
|
-
min-width: 0;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
/* Select filter: trigger fills the cell. */
|
|
51
|
-
.kj-select-filter .kj-select {
|
|
52
|
-
width: 100%;
|
|
53
|
-
}
|