@kouji-ui/components 0.1.1
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/.turbo/turbo-build.log +29 -0
- package/CHANGELOG.md +192 -0
- package/ng-package.json +7 -0
- package/package.json +43 -0
- package/src/accordion/_examples/accordion.default.example.ts +31 -0
- package/src/accordion/_examples/accordion.disabled.example.ts +38 -0
- package/src/accordion/_examples/accordion.multiple.example.ts +31 -0
- package/src/accordion/_examples/accordion.rich-content.example.ts +49 -0
- package/src/accordion/_examples/index.ts +6 -0
- package/src/accordion/accordion.arrow-nav.example.ts +39 -0
- package/src/accordion/accordion.css +68 -0
- package/src/accordion/accordion.playground.ts +119 -0
- package/src/accordion/accordion.spec.ts +117 -0
- package/src/accordion/accordion.ts +153 -0
- package/src/accordion/accordion.usage.example.ts +38 -0
- package/src/accordion/accordion.value.example.ts +60 -0
- package/src/accordion/index.ts +1 -0
- package/src/alert/_examples/alert.banner.example.ts +56 -0
- package/src/alert/_examples/alert.dismissible.example.ts +53 -0
- package/src/alert/_examples/alert.example.ts +40 -0
- package/src/alert/_examples/alert.variants.example.ts +66 -0
- package/src/alert/_examples/alert.with-actions.example.ts +57 -0
- package/src/alert/_examples/index.ts +7 -0
- package/src/alert/alert.css +133 -0
- package/src/alert/alert.playground.ts +111 -0
- package/src/alert/alert.spec.ts +167 -0
- package/src/alert/alert.ts +250 -0
- package/src/alert/alert.usage.example.ts +58 -0
- package/src/alert/index.ts +8 -0
- package/src/avatar/_examples/avatar-group.example.ts +31 -0
- package/src/avatar/_examples/avatar-group.list.example.ts +45 -0
- package/src/avatar/_examples/avatar-group.overflow.example.ts +33 -0
- package/src/avatar/_examples/avatar-group.shapes.example.ts +39 -0
- package/src/avatar/_examples/avatar-group.sizes.example.ts +44 -0
- package/src/avatar/_examples/avatar.default.example.ts +18 -0
- package/src/avatar/_examples/avatar.initials.example.ts +20 -0
- package/src/avatar/_examples/avatar.shapes.example.ts +22 -0
- package/src/avatar/_examples/avatar.sizes.example.ts +26 -0
- package/src/avatar/_examples/avatar.with-image.example.ts +20 -0
- package/src/avatar/_examples/index.ts +12 -0
- package/src/avatar/avatar-group.spec.ts +138 -0
- package/src/avatar/avatar-group.ts +127 -0
- package/src/avatar/avatar-group.usage.example.ts +30 -0
- package/src/avatar/avatar.css +58 -0
- package/src/avatar/avatar.playground.ts +95 -0
- package/src/avatar/avatar.ts +123 -0
- package/src/avatar/index.ts +2 -0
- package/src/badge/_examples/badge.default.example.ts +18 -0
- package/src/badge/_examples/badge.sizes.example.ts +25 -0
- package/src/badge/_examples/badge.variants.example.ts +24 -0
- package/src/badge/_examples/badge.with-dot.example.ts +31 -0
- package/src/badge/_examples/badge.with-icon.example.ts +23 -0
- package/src/badge/_examples/index.ts +7 -0
- package/src/badge/badge.css +59 -0
- package/src/badge/badge.playground.ts +49 -0
- package/src/badge/badge.ts +86 -0
- package/src/badge/badge.usage.example.ts +22 -0
- package/src/badge/index.ts +1 -0
- package/src/breadcrumb/_examples/breadcrumb.custom-separator.example.ts +53 -0
- package/src/breadcrumb/_examples/breadcrumb.example.ts +48 -0
- package/src/breadcrumb/_examples/breadcrumb.long-path.example.ts +58 -0
- package/src/breadcrumb/_examples/breadcrumb.truncated.example.ts +59 -0
- package/src/breadcrumb/_examples/breadcrumb.with-icons.example.ts +66 -0
- package/src/breadcrumb/_examples/index.ts +7 -0
- package/src/breadcrumb/breadcrumb.css +121 -0
- package/src/breadcrumb/breadcrumb.playground.ts +93 -0
- package/src/breadcrumb/breadcrumb.spec.ts +230 -0
- package/src/breadcrumb/breadcrumb.ts +272 -0
- package/src/breadcrumb/breadcrumb.usage.example.ts +45 -0
- package/src/breadcrumb/index.ts +1 -0
- package/src/button/_examples/button.anchor.example.ts +18 -0
- package/src/button/_examples/button.configured.example.ts +43 -0
- package/src/button/_examples/button.disabled.example.ts +25 -0
- package/src/button/_examples/button.example.ts +22 -0
- package/src/button/_examples/button.icon.example.ts +27 -0
- package/src/button/_examples/button.loading.example.ts +31 -0
- package/src/button/_examples/button.pressed.example.ts +24 -0
- package/src/button/_examples/button.sizes.example.ts +26 -0
- package/src/button/_examples/button.usage.example.ts +66 -0
- package/src/button/_examples/button.variants.example.ts +26 -0
- package/src/button/_examples/index.ts +12 -0
- package/src/button/button.css +263 -0
- package/src/button/button.playground.ts +79 -0
- package/src/button/button.spec.ts +100 -0
- package/src/button/button.ts +150 -0
- package/src/button/index.ts +1 -0
- package/src/button-group/_examples/button-group.example.ts +30 -0
- package/src/button-group/_examples/button-group.icon-only.example.ts +30 -0
- package/src/button-group/_examples/button-group.toggle.example.ts +36 -0
- package/src/button-group/_examples/button-group.variants.example.ts +40 -0
- package/src/button-group/_examples/button-group.vertical.example.ts +29 -0
- package/src/button-group/_examples/index.ts +7 -0
- package/src/button-group/button-group.css +80 -0
- package/src/button-group/button-group.playground.ts +94 -0
- package/src/button-group/button-group.spec.ts +119 -0
- package/src/button-group/button-group.ts +130 -0
- package/src/button-group/button-group.usage.example.ts +35 -0
- package/src/button-group/index.ts +1 -0
- package/src/calendar/_examples/calendar.example.ts +33 -0
- package/src/calendar/_examples/index.ts +3 -0
- package/src/calendar/calendar.css +129 -0
- package/src/calendar/calendar.playground.ts +84 -0
- package/src/calendar/calendar.spec.ts +50 -0
- package/src/calendar/calendar.ts +171 -0
- package/src/calendar/calendar.usage.example.ts +33 -0
- package/src/calendar/index.ts +1 -0
- package/src/card/_examples/card.cover.example.ts +53 -0
- package/src/card/_examples/card.example.ts +27 -0
- package/src/card/_examples/card.full.example.ts +51 -0
- package/src/card/_examples/index.ts +5 -0
- package/src/card/card.css +120 -0
- package/src/card/card.playground.ts +116 -0
- package/src/card/card.spec.ts +50 -0
- package/src/card/card.ts +194 -0
- package/src/card/card.usage.example.ts +46 -0
- package/src/card/index.ts +1 -0
- package/src/carousel/_examples/carousel.autoplay.example.ts +69 -0
- package/src/carousel/_examples/carousel.example.ts +60 -0
- package/src/carousel/_examples/carousel.indicators.example.ts +64 -0
- package/src/carousel/_examples/carousel.lazy-load.example.ts +85 -0
- package/src/carousel/_examples/carousel.tabs-pattern.example.ts +61 -0
- package/src/carousel/_examples/index.ts +7 -0
- package/src/carousel/carousel.css +181 -0
- package/src/carousel/carousel.playground.ts +135 -0
- package/src/carousel/carousel.spec.ts +211 -0
- package/src/carousel/carousel.ts +399 -0
- package/src/carousel/carousel.usage.example.ts +46 -0
- package/src/carousel/index.ts +1 -0
- package/src/cascade-select/_examples/cascade-select.data-driven.example.ts +119 -0
- package/src/cascade-select/_examples/cascade-select.disabled.example.ts +74 -0
- package/src/cascade-select/_examples/cascade-select.example.ts +80 -0
- package/src/cascade-select/_examples/cascade-select.field.example.ts +73 -0
- package/src/cascade-select/_examples/cascade-select.path.example.ts +85 -0
- package/src/cascade-select/_examples/index.ts +7 -0
- package/src/cascade-select/cascade-select.css +120 -0
- package/src/cascade-select/cascade-select.playground.ts +133 -0
- package/src/cascade-select/cascade-select.ts +201 -0
- package/src/cascade-select/cascade-select.usage.example.ts +44 -0
- package/src/cascade-select/index.ts +5 -0
- package/src/chat/_examples/chat-bubble.example.ts +71 -0
- package/src/chat/_examples/chat-bubble.grouped.example.ts +69 -0
- package/src/chat/_examples/chat-bubble.sides.example.ts +41 -0
- package/src/chat/_examples/chat-bubble.variants.example.ts +58 -0
- package/src/chat/_examples/chat-bubble.with-state.example.ts +57 -0
- package/src/chat/_examples/index.ts +7 -0
- package/src/chat/chat.css +231 -0
- package/src/chat/chat.playground.ts +171 -0
- package/src/chat/chat.spec.ts +343 -0
- package/src/chat/chat.ts +269 -0
- package/src/chat/chat.usage.example.ts +49 -0
- package/src/chat/index.ts +13 -0
- package/src/checkbox/_examples/checkbox.checked.example.ts +20 -0
- package/src/checkbox/_examples/checkbox.default.example.ts +20 -0
- package/src/checkbox/_examples/checkbox.disabled.example.ts +26 -0
- package/src/checkbox/_examples/checkbox.indeterminate.example.ts +20 -0
- package/src/checkbox/_examples/checkbox.usage.example.ts +62 -0
- package/src/checkbox/_examples/index.ts +7 -0
- package/src/checkbox/checkbox.css +74 -0
- package/src/checkbox/checkbox.playground.ts +68 -0
- package/src/checkbox/checkbox.ts +122 -0
- package/src/checkbox/index.ts +1 -0
- package/src/color-picker/_examples/color-picker.alpha.example.ts +36 -0
- package/src/color-picker/_examples/color-picker.example.ts +34 -0
- package/src/color-picker/_examples/color-picker.hex-input.example.ts +53 -0
- package/src/color-picker/_examples/color-picker.in-form.example.ts +60 -0
- package/src/color-picker/_examples/color-picker.usage.example.ts +58 -0
- package/src/color-picker/_examples/color-picker.with-presets.example.ts +45 -0
- package/src/color-picker/_examples/index.ts +8 -0
- package/src/color-picker/color-picker.css +183 -0
- package/src/color-picker/color-picker.playground.ts +83 -0
- package/src/color-picker/color-picker.spec.ts +94 -0
- package/src/color-picker/color-picker.ts +234 -0
- package/src/color-picker/index.ts +1 -0
- package/src/combobox/_examples/combobox.async.example.ts +85 -0
- package/src/combobox/_examples/combobox.empty-state.example.ts +36 -0
- package/src/combobox/_examples/combobox.example.ts +36 -0
- package/src/combobox/_examples/combobox.free-text.example.ts +42 -0
- package/src/combobox/_examples/combobox.usage.example.ts +51 -0
- package/src/combobox/_examples/combobox.with-icons.example.ts +49 -0
- package/src/combobox/_examples/index.ts +8 -0
- package/src/combobox/combobox.css +101 -0
- package/src/combobox/combobox.playground.ts +90 -0
- package/src/combobox/combobox.spec.ts +111 -0
- package/src/combobox/combobox.ts +219 -0
- package/src/combobox/index.ts +6 -0
- package/src/command-palette/_examples/command-palette.async.example.ts +99 -0
- package/src/command-palette/_examples/command-palette.dialog.example.ts +90 -0
- package/src/command-palette/_examples/command-palette.example.ts +40 -0
- package/src/command-palette/_examples/command-palette.fuzzy.example.ts +54 -0
- package/src/command-palette/_examples/command-palette.groups.example.ts +55 -0
- package/src/command-palette/_examples/command-palette.usage.example.ts +49 -0
- package/src/command-palette/_examples/index.ts +8 -0
- package/src/command-palette/command-palette.css +234 -0
- package/src/command-palette/command-palette.playground.ts +119 -0
- package/src/command-palette/command-palette.ts +448 -0
- package/src/command-palette/index.ts +10 -0
- package/src/confirm-popup/_examples/confirm-popup.destructive.example.ts +72 -0
- package/src/confirm-popup/_examples/confirm-popup.example.ts +82 -0
- package/src/confirm-popup/_examples/confirm-popup.placement.example.ts +97 -0
- package/src/confirm-popup/_examples/confirm-popup.usage.example.ts +94 -0
- package/src/confirm-popup/_examples/confirm-popup.with-message.example.ts +76 -0
- package/src/confirm-popup/_examples/index.ts +7 -0
- package/src/confirm-popup/confirm-popup.css +47 -0
- package/src/confirm-popup/confirm-popup.playground.ts +109 -0
- package/src/confirm-popup/confirm-popup.spec.ts +209 -0
- package/src/confirm-popup/confirm-popup.ts +279 -0
- package/src/confirm-popup/index.ts +1 -0
- package/src/date-picker/_examples/date-picker.disabled-dates.example.ts +44 -0
- package/src/date-picker/_examples/date-picker.example.ts +38 -0
- package/src/date-picker/_examples/date-picker.locale.example.ts +50 -0
- package/src/date-picker/_examples/date-picker.readonly.example.ts +32 -0
- package/src/date-picker/_examples/date-picker.usage.example.ts +60 -0
- package/src/date-picker/_examples/date-picker.with-min-max.example.ts +47 -0
- package/src/date-picker/_examples/index.ts +8 -0
- package/src/date-picker/date-picker.css +61 -0
- package/src/date-picker/date-picker.playground.ts +79 -0
- package/src/date-picker/date-picker.spec.ts +71 -0
- package/src/date-picker/date-picker.ts +185 -0
- package/src/date-picker/index.ts +1 -0
- package/src/dialog/_examples/dialog.confirmation.example.ts +30 -0
- package/src/dialog/_examples/dialog.default.example.ts +30 -0
- package/src/dialog/_examples/dialog.nested.example.ts +86 -0
- package/src/dialog/_examples/dialog.scrollable.example.ts +30 -0
- package/src/dialog/_examples/dialog.usage.example.ts +57 -0
- package/src/dialog/_examples/dialog.with-form.example.ts +48 -0
- package/src/dialog/_examples/index.ts +8 -0
- package/src/dialog/dialog.css +56 -0
- package/src/dialog/dialog.playground.ts +136 -0
- package/src/dialog/dialog.ts +82 -0
- package/src/dialog/index.ts +1 -0
- package/src/divider/_examples/divider.example.ts +27 -0
- package/src/divider/_examples/divider.sizes.example.ts +33 -0
- package/src/divider/_examples/divider.structural.example.ts +55 -0
- package/src/divider/_examples/divider.usage.example.ts +48 -0
- package/src/divider/_examples/divider.variants.example.ts +33 -0
- package/src/divider/_examples/divider.vertical.example.ts +38 -0
- package/src/divider/_examples/divider.with-content.example.ts +38 -0
- package/src/divider/_examples/index.ts +9 -0
- package/src/divider/divider.css +93 -0
- package/src/divider/divider.playground.ts +97 -0
- package/src/divider/divider.spec.ts +207 -0
- package/src/divider/divider.ts +220 -0
- package/src/divider/index.ts +1 -0
- package/src/drawer/_examples/drawer.example.ts +30 -0
- package/src/drawer/_examples/drawer.modal-vs-non-modal.example.ts +27 -0
- package/src/drawer/_examples/drawer.scrollable.example.ts +30 -0
- package/src/drawer/_examples/drawer.sides.example.ts +32 -0
- package/src/drawer/_examples/drawer.usage.example.ts +56 -0
- package/src/drawer/_examples/drawer.with-form.example.ts +48 -0
- package/src/drawer/_examples/index.ts +8 -0
- package/src/drawer/drawer.css +130 -0
- package/src/drawer/drawer.playground.ts +107 -0
- package/src/drawer/drawer.spec.ts +216 -0
- package/src/drawer/drawer.ts +85 -0
- package/src/drawer/index.ts +1 -0
- package/src/dropdown-menu/_examples/dropdown-menu.disabled.example.ts +19 -0
- package/src/dropdown-menu/_examples/dropdown-menu.example.ts +20 -0
- package/src/dropdown-menu/_examples/dropdown-menu.shortcuts.example.ts +31 -0
- package/src/dropdown-menu/_examples/dropdown-menu.sides.example.ts +18 -0
- package/src/dropdown-menu/_examples/dropdown-menu.usage.example.ts +56 -0
- package/src/dropdown-menu/_examples/dropdown-menu.with-icons.example.ts +31 -0
- package/src/dropdown-menu/_examples/dropdown-menu.with-separator.example.ts +41 -0
- package/src/dropdown-menu/_examples/index.ts +9 -0
- package/src/dropdown-menu/dropdown-menu.css +108 -0
- package/src/dropdown-menu/dropdown-menu.playground.ts +109 -0
- package/src/dropdown-menu/dropdown-menu.spec.ts +5 -0
- package/src/dropdown-menu/dropdown-menu.ts +128 -0
- package/src/dropdown-menu/index.ts +1 -0
- package/src/empty-state/_examples/empty-state.error.example.ts +63 -0
- package/src/empty-state/_examples/empty-state.example.ts +59 -0
- package/src/empty-state/_examples/empty-state.search.example.ts +82 -0
- package/src/empty-state/_examples/empty-state.sizes.example.ts +76 -0
- package/src/empty-state/_examples/empty-state.usage.example.ts +66 -0
- package/src/empty-state/_examples/empty-state.with-actions.example.ts +68 -0
- package/src/empty-state/_examples/index.ts +8 -0
- package/src/empty-state/empty-state.css +114 -0
- package/src/empty-state/empty-state.playground.ts +87 -0
- package/src/empty-state/empty-state.spec.ts +211 -0
- package/src/empty-state/empty-state.ts +276 -0
- package/src/empty-state/index.ts +1 -0
- package/src/example-components.ts +396 -0
- package/src/field/_examples/field.disabled.example.ts +49 -0
- package/src/field/_examples/field.example.ts +51 -0
- package/src/field/_examples/field.required.example.ts +46 -0
- package/src/field/_examples/field.with-error.example.ts +73 -0
- package/src/field/_examples/field.with-prefix-suffix.example.ts +63 -0
- package/src/field/_examples/index.ts +7 -0
- package/src/field/field.css +138 -0
- package/src/field/field.playground.ts +108 -0
- package/src/field/field.spec.ts +132 -0
- package/src/field/field.ts +232 -0
- package/src/field/field.usage.example.ts +63 -0
- package/src/field/index.ts +7 -0
- package/src/file-upload/_examples/file-upload.dropzone.example.ts +32 -0
- package/src/file-upload/_examples/file-upload.example.ts +29 -0
- package/src/file-upload/_examples/file-upload.image-preview.example.ts +31 -0
- package/src/file-upload/_examples/file-upload.multiple.example.ts +23 -0
- package/src/file-upload/_examples/file-upload.with-progress.example.ts +59 -0
- package/src/file-upload/_examples/index.ts +7 -0
- package/src/file-upload/file-upload.css +207 -0
- package/src/file-upload/file-upload.playground.ts +84 -0
- package/src/file-upload/file-upload.spec.ts +94 -0
- package/src/file-upload/file-upload.ts +301 -0
- package/src/file-upload/file-upload.usage.example.ts +45 -0
- package/src/file-upload/index.ts +1 -0
- package/src/form/_examples/form.async-submit.example.ts +72 -0
- package/src/form/_examples/form.compound.example.ts +93 -0
- package/src/form/_examples/form.example.ts +70 -0
- package/src/form/_examples/form.validation.example.ts +67 -0
- package/src/form/_examples/index.ts +6 -0
- package/src/form/form.css +63 -0
- package/src/form/form.playground.ts +145 -0
- package/src/form/form.spec.ts +96 -0
- package/src/form/form.ts +216 -0
- package/src/form/form.usage.example.ts +63 -0
- package/src/form/index.ts +5 -0
- package/src/icon/_examples/icon.gallery.example.ts +199 -0
- package/src/icon/_examples/icon.usage.example.ts +46 -0
- package/src/icon/_examples/index.ts +4 -0
- package/src/icon/icon.playground.ts +63 -0
- package/src/icon/index.ts +5 -0
- package/src/icon/lucide/icon-names.generated.ts +1708 -0
- package/src/icon/lucide/icon-names.ts +18 -0
- package/src/icon/lucide/index.ts +2 -0
- package/src/icon/lucide/provide-lucide-icons.ts +96 -0
- package/src/input/_examples/index.ts +4 -0
- package/src/input/_examples/input.color.example.ts +33 -0
- package/src/input/_examples/input.example.ts +22 -0
- package/src/input/index.ts +1 -0
- package/src/input/input.css +70 -0
- package/src/input/input.playground.ts +79 -0
- package/src/input/input.spec.ts +98 -0
- package/src/input/input.ts +158 -0
- package/src/input/input.usage.example.ts +40 -0
- package/src/input-group/_examples/index.ts +7 -0
- package/src/input-group/_examples/input-group.button.example.ts +43 -0
- package/src/input-group/_examples/input-group.example.ts +39 -0
- package/src/input-group/_examples/input-group.icon.example.ts +49 -0
- package/src/input-group/_examples/input-group.url.example.ts +36 -0
- package/src/input-group/_examples/input-group.variants.example.ts +39 -0
- package/src/input-group/index.ts +1 -0
- package/src/input-group/input-group.css +125 -0
- package/src/input-group/input-group.playground.ts +90 -0
- package/src/input-group/input-group.ts +142 -0
- package/src/input-group/input-group.usage.example.ts +47 -0
- package/src/input-mask/_examples/index.ts +8 -0
- package/src/input-mask/_examples/input-mask.credit-card.example.ts +90 -0
- package/src/input-mask/_examples/input-mask.custom-tokens.example.ts +87 -0
- package/src/input-mask/_examples/input-mask.date.example.ts +61 -0
- package/src/input-mask/_examples/input-mask.example.ts +61 -0
- package/src/input-mask/_examples/input-mask.usage.example.ts +44 -0
- package/src/input-mask/_examples/input-mask.validation.example.ts +80 -0
- package/src/input-mask/index.ts +9 -0
- package/src/input-mask/input-mask.css +39 -0
- package/src/input-mask/input-mask.playground.ts +79 -0
- package/src/input-mask/input-mask.ts +130 -0
- package/src/input-otp/_examples/index.ts +8 -0
- package/src/input-otp/_examples/input-otp.autosubmit.example.ts +71 -0
- package/src/input-otp/_examples/input-otp.example.ts +47 -0
- package/src/input-otp/_examples/input-otp.lengths.example.ts +67 -0
- package/src/input-otp/_examples/input-otp.masked.example.ts +46 -0
- package/src/input-otp/_examples/input-otp.reactive.example.ts +58 -0
- package/src/input-otp/_examples/input-otp.separator.example.ts +49 -0
- package/src/input-otp/index.ts +1 -0
- package/src/input-otp/input-otp.css +87 -0
- package/src/input-otp/input-otp.playground.ts +107 -0
- package/src/input-otp/input-otp.ts +244 -0
- package/src/input-otp/input-otp.usage.example.ts +45 -0
- package/src/kbd/_examples/index.ts +6 -0
- package/src/kbd/_examples/kbd.combo.example.ts +24 -0
- package/src/kbd/_examples/kbd.example.ts +22 -0
- package/src/kbd/_examples/kbd.in-tooltip.example.ts +43 -0
- package/src/kbd/_examples/kbd.sizes.example.ts +31 -0
- package/src/kbd/index.ts +1 -0
- package/src/kbd/kbd.css +67 -0
- package/src/kbd/kbd.playground.ts +51 -0
- package/src/kbd/kbd.spec.ts +123 -0
- package/src/kbd/kbd.ts +123 -0
- package/src/kbd/kbd.usage.example.ts +38 -0
- package/src/link/_examples/index.ts +8 -0
- package/src/link/_examples/link.disabled.example.ts +23 -0
- package/src/link/_examples/link.example.ts +26 -0
- package/src/link/_examples/link.external.example.ts +33 -0
- package/src/link/_examples/link.in-prose.example.ts +36 -0
- package/src/link/_examples/link.sizes.example.ts +28 -0
- package/src/link/_examples/link.variants.example.ts +25 -0
- package/src/link/index.ts +1 -0
- package/src/link/link.css +104 -0
- package/src/link/link.playground.ts +98 -0
- package/src/link/link.spec.ts +146 -0
- package/src/link/link.ts +133 -0
- package/src/link/link.usage.example.ts +37 -0
- package/src/list/_examples/index.ts +7 -0
- package/src/list/_examples/list.divided.example.ts +32 -0
- package/src/list/_examples/list.example.ts +31 -0
- package/src/list/_examples/list.interactive.example.ts +51 -0
- package/src/list/_examples/list.nav.example.ts +44 -0
- package/src/list/_examples/list.with-icons.example.ts +97 -0
- package/src/list/index.ts +1 -0
- package/src/list/list.css +166 -0
- package/src/list/list.playground.ts +90 -0
- package/src/list/list.spec.ts +121 -0
- package/src/list/list.ts +227 -0
- package/src/list/list.usage.example.ts +45 -0
- package/src/menubar/_examples/index.ts +6 -0
- package/src/menubar/_examples/menubar.disabled-item.example.ts +23 -0
- package/src/menubar/_examples/menubar.example.ts +22 -0
- package/src/menubar/_examples/menubar.with-shortcuts.example.ts +33 -0
- package/src/menubar/_examples/menubar.with-submenu.example.ts +76 -0
- package/src/menubar/index.ts +1 -0
- package/src/menubar/menubar.css +62 -0
- package/src/menubar/menubar.playground.ts +96 -0
- package/src/menubar/menubar.ts +160 -0
- package/src/menubar/menubar.usage.example.ts +33 -0
- package/src/number-input/_examples/index.ts +7 -0
- package/src/number-input/_examples/number-input.currency.example.ts +35 -0
- package/src/number-input/_examples/number-input.decimal.example.ts +34 -0
- package/src/number-input/_examples/number-input.example.ts +24 -0
- package/src/number-input/_examples/number-input.min-max.example.ts +33 -0
- package/src/number-input/_examples/number-input.with-stepper.example.ts +45 -0
- package/src/number-input/index.ts +1 -0
- package/src/number-input/number-input.css +115 -0
- package/src/number-input/number-input.playground.ts +92 -0
- package/src/number-input/number-input.spec.ts +102 -0
- package/src/number-input/number-input.ts +212 -0
- package/src/number-input/number-input.usage.example.ts +73 -0
- package/src/overlay/overlay.css +32 -0
- package/src/overlay-badge/_examples/index.ts +7 -0
- package/src/overlay-badge/_examples/overlay-badge.described.example.ts +36 -0
- package/src/overlay-badge/_examples/overlay-badge.dot.example.ts +28 -0
- package/src/overlay-badge/_examples/overlay-badge.example.ts +34 -0
- package/src/overlay-badge/_examples/overlay-badge.on-avatar.example.ts +38 -0
- package/src/overlay-badge/_examples/overlay-badge.positions.example.ts +39 -0
- package/src/overlay-badge/index.ts +1 -0
- package/src/overlay-badge/overlay-badge.css +118 -0
- package/src/overlay-badge/overlay-badge.playground.ts +92 -0
- package/src/overlay-badge/overlay-badge.spec.ts +174 -0
- package/src/overlay-badge/overlay-badge.ts +232 -0
- package/src/overlay-badge/overlay-badge.usage.example.ts +44 -0
- package/src/pagination/_examples/index.ts +7 -0
- package/src/pagination/_examples/pagination.boundaries.example.ts +56 -0
- package/src/pagination/_examples/pagination.compact.example.ts +42 -0
- package/src/pagination/_examples/pagination.example.ts +55 -0
- package/src/pagination/_examples/pagination.large.example.ts +54 -0
- package/src/pagination/_examples/pagination.with-info.example.ts +49 -0
- package/src/pagination/index.ts +1 -0
- package/src/pagination/pagination.css +146 -0
- package/src/pagination/pagination.playground.ts +107 -0
- package/src/pagination/pagination.spec.ts +202 -0
- package/src/pagination/pagination.ts +432 -0
- package/src/pagination/pagination.usage.example.ts +50 -0
- package/src/password-input/_examples/index.ts +6 -0
- package/src/password-input/_examples/password-input.example.ts +24 -0
- package/src/password-input/_examples/password-input.strength.example.ts +45 -0
- package/src/password-input/_examples/password-input.toggle.example.ts +43 -0
- package/src/password-input/_examples/password-input.with-rules.example.ts +78 -0
- package/src/password-input/index.ts +1 -0
- package/src/password-input/password-input.css +155 -0
- package/src/password-input/password-input.playground.ts +81 -0
- package/src/password-input/password-input.spec.ts +129 -0
- package/src/password-input/password-input.ts +254 -0
- package/src/password-input/password-input.usage.example.ts +55 -0
- package/src/playground-types.ts +47 -0
- package/src/popover/_examples/index.ts +7 -0
- package/src/popover/_examples/popover.cancellable.example.ts +20 -0
- package/src/popover/_examples/popover.example.ts +20 -0
- package/src/popover/_examples/popover.modal.example.ts +22 -0
- package/src/popover/_examples/popover.sides.example.ts +37 -0
- package/src/popover/_examples/popover.with-form.example.ts +38 -0
- package/src/popover/index.ts +1 -0
- package/src/popover/popover.css +71 -0
- package/src/popover/popover.playground.ts +86 -0
- package/src/popover/popover.spec.ts +5 -0
- package/src/popover/popover.ts +94 -0
- package/src/popover/popover.usage.example.ts +48 -0
- package/src/progress-bar/_examples/index.ts +7 -0
- package/src/progress-bar/_examples/progress-bar.example.ts +22 -0
- package/src/progress-bar/_examples/progress-bar.indeterminate.example.ts +23 -0
- package/src/progress-bar/_examples/progress-bar.sizes.example.ts +29 -0
- package/src/progress-bar/_examples/progress-bar.variants.example.ts +30 -0
- package/src/progress-bar/_examples/progress-bar.with-label.example.ts +30 -0
- package/src/progress-bar/index.ts +1 -0
- package/src/progress-bar/progress-bar.css +113 -0
- package/src/progress-bar/progress-bar.playground.ts +87 -0
- package/src/progress-bar/progress-bar.spec.ts +233 -0
- package/src/progress-bar/progress-bar.ts +155 -0
- package/src/progress-bar/progress-bar.usage.example.ts +52 -0
- package/src/public-api.ts +61 -0
- package/src/radio/_examples/index.ts +6 -0
- package/src/radio/_examples/radio.default.example.ts +26 -0
- package/src/radio/_examples/radio.disabled.example.ts +26 -0
- package/src/radio/_examples/radio.group.example.ts +27 -0
- package/src/radio/_examples/radio.inline.example.ts +26 -0
- package/src/radio/index.ts +1 -0
- package/src/radio/radio.css +58 -0
- package/src/radio/radio.playground.ts +90 -0
- package/src/radio/radio.ts +143 -0
- package/src/radio/radio.usage.example.ts +54 -0
- package/src/select/_examples/index.ts +6 -0
- package/src/select/_examples/select.default.example.ts +26 -0
- package/src/select/_examples/select.disabled.example.ts +24 -0
- package/src/select/_examples/select.grouped.example.ts +37 -0
- package/src/select/_examples/select.placeholder.example.ts +26 -0
- package/src/select/index.ts +1 -0
- package/src/select/select.css +65 -0
- package/src/select/select.playground.ts +81 -0
- package/src/select/select.ts +176 -0
- package/src/select/select.usage.example.ts +64 -0
- package/src/skeleton/_examples/index.ts +6 -0
- package/src/skeleton/_examples/skeleton.animations.example.ts +52 -0
- package/src/skeleton/_examples/skeleton.card.example.ts +68 -0
- package/src/skeleton/_examples/skeleton.example.ts +24 -0
- package/src/skeleton/_examples/skeleton.shapes.example.ts +55 -0
- package/src/skeleton/index.ts +1 -0
- package/src/skeleton/skeleton.css +111 -0
- package/src/skeleton/skeleton.playground.ts +80 -0
- package/src/skeleton/skeleton.spec.ts +126 -0
- package/src/skeleton/skeleton.ts +155 -0
- package/src/skeleton/skeleton.usage.example.ts +49 -0
- package/src/slider/_examples/index.ts +7 -0
- package/src/slider/_examples/slider.example.ts +41 -0
- package/src/slider/_examples/slider.formatted.example.ts +53 -0
- package/src/slider/_examples/slider.range.example.ts +48 -0
- package/src/slider/_examples/slider.vertical.example.ts +48 -0
- package/src/slider/_examples/slider.with-marks.example.ts +46 -0
- package/src/slider/index.ts +1 -0
- package/src/slider/slider.css +172 -0
- package/src/slider/slider.playground.ts +88 -0
- package/src/slider/slider.spec.ts +139 -0
- package/src/slider/slider.ts +246 -0
- package/src/slider/slider.usage.example.ts +68 -0
- package/src/speed-dial/_examples/index.ts +7 -0
- package/src/speed-dial/_examples/speed-dial.directions.example.ts +85 -0
- package/src/speed-dial/_examples/speed-dial.disabled.example.ts +71 -0
- package/src/speed-dial/_examples/speed-dial.example.ts +48 -0
- package/src/speed-dial/_examples/speed-dial.usage.example.ts +59 -0
- package/src/speed-dial/_examples/speed-dial.with-tooltips.example.ts +65 -0
- package/src/speed-dial/index.ts +1 -0
- package/src/speed-dial/speed-dial.css +137 -0
- package/src/speed-dial/speed-dial.playground.ts +137 -0
- package/src/speed-dial/speed-dial.spec.ts +191 -0
- package/src/speed-dial/speed-dial.ts +257 -0
- package/src/spinner/_examples/index.ts +8 -0
- package/src/spinner/_examples/spinner.animations.example.ts +54 -0
- package/src/spinner/_examples/spinner.example.ts +26 -0
- package/src/spinner/_examples/spinner.in-button.example.ts +51 -0
- package/src/spinner/_examples/spinner.sizes.example.ts +31 -0
- package/src/spinner/_examples/spinner.usage.example.ts +45 -0
- package/src/spinner/_examples/spinner.variants.example.ts +34 -0
- package/src/spinner/index.ts +1 -0
- package/src/spinner/spinner.css +161 -0
- package/src/spinner/spinner.playground.ts +68 -0
- package/src/spinner/spinner.spec.ts +184 -0
- package/src/spinner/spinner.ts +185 -0
- package/src/stepper/_examples/index.ts +8 -0
- package/src/stepper/_examples/stepper.example.ts +62 -0
- package/src/stepper/_examples/stepper.non-linear.example.ts +63 -0
- package/src/stepper/_examples/stepper.optional-step.example.ts +62 -0
- package/src/stepper/_examples/stepper.usage.example.ts +73 -0
- package/src/stepper/_examples/stepper.vertical.example.ts +66 -0
- package/src/stepper/_examples/stepper.with-error.example.ts +63 -0
- package/src/stepper/index.ts +1 -0
- package/src/stepper/stepper.css +147 -0
- package/src/stepper/stepper.playground.ts +88 -0
- package/src/stepper/stepper.spec.ts +200 -0
- package/src/stepper/stepper.ts +242 -0
- package/src/table/_examples/index.ts +23 -0
- package/src/table/_examples/table.column-pinning.example.ts +55 -0
- package/src/table/_examples/table.column-resize.example.ts +49 -0
- package/src/table/_examples/table.column-visibility.example.ts +52 -0
- package/src/table/_examples/table.density.example.ts +71 -0
- package/src/table/_examples/table.editable.example.ts +85 -0
- package/src/table/_examples/table.empty-and-error.example.ts +112 -0
- package/src/table/_examples/table.example.ts +45 -0
- package/src/table/_examples/table.export.example.ts +82 -0
- package/src/table/_examples/table.filterable.example.ts +67 -0
- package/src/table/_examples/table.grouping.example.ts +63 -0
- package/src/table/_examples/table.keyboard.example.ts +115 -0
- package/src/table/_examples/table.master-detail.example.ts +102 -0
- package/src/table/_examples/table.persistence.example.ts +85 -0
- package/src/table/_examples/table.playground.ts +154 -0
- package/src/table/_examples/table.row-pinning.example.ts +71 -0
- package/src/table/_examples/table.selection.example.ts +67 -0
- package/src/table/_examples/table.server-mode.example.ts +120 -0
- package/src/table/_examples/table.sortable.example.ts +49 -0
- package/src/table/_examples/table.theming.example.ts +64 -0
- package/src/table/_examples/table.usage.example.ts +90 -0
- package/src/table/_examples/table.virtualized.example.ts +122 -0
- package/src/table/index.ts +11 -0
- package/src/table/table-cell-editor-outlet.ts +111 -0
- package/src/table/table-editors/boolean-editor.ts +71 -0
- package/src/table/table-editors/date-editor.ts +117 -0
- package/src/table/table-editors/editors.spec.ts +147 -0
- package/src/table/table-editors/index.ts +41 -0
- package/src/table/table-editors/number-editor.ts +89 -0
- package/src/table/table-editors/select-editor.ts +107 -0
- package/src/table/table-editors/text-editor.ts +82 -0
- package/src/table/table-export.spec.ts +33 -0
- package/src/table/table-export.ts +53 -0
- package/src/table/table-filter-outlet.ts +137 -0
- package/src/table/table-filters/date-filter.ts +122 -0
- package/src/table/table-filters/filters.css +53 -0
- package/src/table/table-filters/filters.spec.ts +277 -0
- package/src/table/table-filters/index.ts +11 -0
- package/src/table/table-filters/number-filter.ts +232 -0
- package/src/table/table-filters/select-filter.ts +129 -0
- package/src/table/table-filters/text-filter.ts +110 -0
- package/src/table/table-pagination.spec.ts +118 -0
- package/src/table/table-pagination.ts +191 -0
- package/src/table/table-side-panel.spec.ts +170 -0
- package/src/table/table-side-panel.ts +263 -0
- package/src/table/table-status-bar.spec.ts +78 -0
- package/src/table/table-status-bar.ts +70 -0
- package/src/table/table-toolbar.spec.ts +180 -0
- package/src/table/table-toolbar.ts +244 -0
- package/src/table/table-virtual.spec.ts +103 -0
- package/src/table/table-virtual.ts +180 -0
- package/src/table/table.css +468 -0
- package/src/table/table.spec.ts +175 -0
- package/src/table/table.ts +1009 -0
- package/src/tabs/_examples/index.ts +8 -0
- package/src/tabs/_examples/tabs.controlled.example.ts +59 -0
- package/src/tabs/_examples/tabs.disabled.example.ts +34 -0
- package/src/tabs/_examples/tabs.example.ts +34 -0
- package/src/tabs/_examples/tabs.manual-activation.example.ts +34 -0
- package/src/tabs/_examples/tabs.usage.example.ts +43 -0
- package/src/tabs/_examples/tabs.vertical.example.ts +33 -0
- package/src/tabs/index.ts +1 -0
- package/src/tabs/tabs.css +80 -0
- package/src/tabs/tabs.playground.ts +88 -0
- package/src/tabs/tabs.spec.ts +135 -0
- package/src/tabs/tabs.ts +204 -0
- package/src/tag/_examples/index.ts +9 -0
- package/src/tag/_examples/tag.example.ts +22 -0
- package/src/tag/_examples/tag.list.example.ts +38 -0
- package/src/tag/_examples/tag.removable.example.ts +39 -0
- package/src/tag/_examples/tag.selectable.example.ts +33 -0
- package/src/tag/_examples/tag.sizes.example.ts +25 -0
- package/src/tag/_examples/tag.usage.example.ts +62 -0
- package/src/tag/_examples/tag.variants.example.ts +29 -0
- package/src/tag/index.ts +1 -0
- package/src/tag/tag.css +167 -0
- package/src/tag/tag.playground.ts +63 -0
- package/src/tag/tag.spec.ts +153 -0
- package/src/tag/tag.ts +186 -0
- package/src/test-setup.ts +5 -0
- package/src/textarea/_examples/index.ts +8 -0
- package/src/textarea/_examples/textarea.autoresize.example.ts +37 -0
- package/src/textarea/_examples/textarea.character-count.example.ts +34 -0
- package/src/textarea/_examples/textarea.example.ts +22 -0
- package/src/textarea/_examples/textarea.no-resize.example.ts +28 -0
- package/src/textarea/_examples/textarea.usage.example.ts +50 -0
- package/src/textarea/_examples/textarea.with-field.example.ts +66 -0
- package/src/textarea/index.ts +1 -0
- package/src/textarea/textarea.css +117 -0
- package/src/textarea/textarea.playground.ts +70 -0
- package/src/textarea/textarea.spec.ts +161 -0
- package/src/textarea/textarea.ts +339 -0
- package/src/time-picker/_examples/index.ts +8 -0
- package/src/time-picker/_examples/time-picker.12-hour.example.ts +24 -0
- package/src/time-picker/_examples/time-picker.example.ts +24 -0
- package/src/time-picker/_examples/time-picker.formatted.example.ts +32 -0
- package/src/time-picker/_examples/time-picker.range.example.ts +54 -0
- package/src/time-picker/_examples/time-picker.usage.example.ts +53 -0
- package/src/time-picker/_examples/time-picker.with-seconds.example.ts +24 -0
- package/src/time-picker/index.ts +1 -0
- package/src/time-picker/time-picker.css +126 -0
- package/src/time-picker/time-picker.playground.ts +72 -0
- package/src/time-picker/time-picker.spec.ts +77 -0
- package/src/time-picker/time-picker.ts +207 -0
- package/src/toast/_examples/index.ts +7 -0
- package/src/toast/_examples/toast.default.example.ts +37 -0
- package/src/toast/_examples/toast.dismissible.example.ts +38 -0
- package/src/toast/_examples/toast.usage.example.ts +57 -0
- package/src/toast/_examples/toast.variants.example.ts +43 -0
- package/src/toast/_examples/toast.with-action.example.ts +46 -0
- package/src/toast/index.ts +1 -0
- package/src/toast/toast.css +115 -0
- package/src/toast/toast.playground.ts +61 -0
- package/src/toast/toast.ts +168 -0
- package/src/toggle/_examples/index.ts +7 -0
- package/src/toggle/_examples/toggle.checked.example.ts +20 -0
- package/src/toggle/_examples/toggle.default.example.ts +20 -0
- package/src/toggle/_examples/toggle.disabled.example.ts +26 -0
- package/src/toggle/_examples/toggle.usage.example.ts +51 -0
- package/src/toggle/_examples/toggle.with-label.example.ts +30 -0
- package/src/toggle/index.ts +1 -0
- package/src/toggle/toggle.css +123 -0
- package/src/toggle/toggle.playground.ts +65 -0
- package/src/toggle/toggle.ts +113 -0
- package/src/tooltip/_examples/index.ts +9 -0
- package/src/tooltip/_examples/tooltip.delays.example.ts +16 -0
- package/src/tooltip/_examples/tooltip.disabled.example.ts +16 -0
- package/src/tooltip/_examples/tooltip.example.ts +16 -0
- package/src/tooltip/_examples/tooltip.group.example.ts +20 -0
- package/src/tooltip/_examples/tooltip.rich.example.ts +19 -0
- package/src/tooltip/_examples/tooltip.sides.example.ts +18 -0
- package/src/tooltip/_examples/tooltip.usage.example.ts +50 -0
- package/src/tooltip/index.ts +1 -0
- package/src/tooltip/tooltip.css +61 -0
- package/src/tooltip/tooltip.playground.ts +79 -0
- package/src/tooltip/tooltip.spec.ts +5 -0
- package/src/tooltip/tooltip.ts +102 -0
- package/src/tree-select/_examples/index.ts +8 -0
- package/src/tree-select/_examples/tree-select.disabled.example.ts +106 -0
- package/src/tree-select/_examples/tree-select.example.ts +65 -0
- package/src/tree-select/_examples/tree-select.expanded.example.ts +72 -0
- package/src/tree-select/_examples/tree-select.field.example.ts +77 -0
- package/src/tree-select/_examples/tree-select.multi.example.ts +73 -0
- package/src/tree-select/_examples/tree-select.usage.example.ts +85 -0
- package/src/tree-select/index.ts +1 -0
- package/src/tree-select/tree-select.css +220 -0
- package/src/tree-select/tree-select.playground.ts +83 -0
- package/src/tree-select/tree-select.ts +348 -0
- package/src/typography/_examples/index.ts +9 -0
- package/src/typography/_examples/typography.blockquote.example.ts +34 -0
- package/src/typography/_examples/typography.code.example.ts +32 -0
- package/src/typography/_examples/typography.example.ts +42 -0
- package/src/typography/_examples/typography.lead.example.ts +37 -0
- package/src/typography/_examples/typography.muted.example.ts +27 -0
- package/src/typography/_examples/typography.truncate.example.ts +41 -0
- package/src/typography/_examples/typography.usage.example.ts +44 -0
- package/src/typography/index.ts +8 -0
- package/src/typography/typography.playground.ts +101 -0
- package/src/typography/typography.spec.ts +70 -0
- package/src/typography/typography.ts +105 -0
- package/tsconfig.lib.json +25 -0
- package/tsconfig.lib.prod.json +17 -0
- package/tsconfig.spec.json +16 -0
- package/vite.config.ts +33 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { Component, ElementRef, signal, viewChild, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { KjInputMask, KJ_INPUT_MASK_PRESETS } from '@kouji-ui/core';
|
|
4
|
+
import { KjFieldComponent, KjFieldLabelComponent } from '../../field/field';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Credit-card form using `KJ_INPUT_MASK_PRESETS`. The `(kjComplete)` event on
|
|
8
|
+
* each field auto-advances focus to the next field — a common UX pattern for
|
|
9
|
+
* payment entry.
|
|
10
|
+
*/
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'kj-input-mask-credit-card-example',
|
|
13
|
+
standalone: true,
|
|
14
|
+
imports: [FormsModule, KjInputMask, KjFieldComponent, KjFieldLabelComponent],
|
|
15
|
+
styles: [
|
|
16
|
+
`
|
|
17
|
+
:host {
|
|
18
|
+
display: block;
|
|
19
|
+
max-width: 400px;
|
|
20
|
+
}
|
|
21
|
+
.card-form {
|
|
22
|
+
display: flex;
|
|
23
|
+
flex-direction: column;
|
|
24
|
+
gap: var(--kj-space-md);
|
|
25
|
+
}
|
|
26
|
+
.card-row {
|
|
27
|
+
display: flex;
|
|
28
|
+
gap: var(--kj-space-md);
|
|
29
|
+
}
|
|
30
|
+
.card-row kj-field {
|
|
31
|
+
flex: 1;
|
|
32
|
+
}
|
|
33
|
+
input[kjInputMask] {
|
|
34
|
+
color: var(--kj-fg-default);
|
|
35
|
+
border: 1px solid var(--kj-border-default);
|
|
36
|
+
border-radius: var(--kj-radius-field, 0.375rem);
|
|
37
|
+
padding: var(--kj-space-sm) var(--kj-space-md);
|
|
38
|
+
font: var(--kj-text-sm) / 1.4 var(--kj-font-sans);
|
|
39
|
+
font-variant-numeric: tabular-nums;
|
|
40
|
+
width: 100%;
|
|
41
|
+
}
|
|
42
|
+
input[kjInputMask]:focus-visible {
|
|
43
|
+
outline: 2px solid var(--kj-fg-primary);
|
|
44
|
+
outline-offset: 2px;
|
|
45
|
+
border-color: var(--kj-fg-primary);
|
|
46
|
+
}
|
|
47
|
+
`,
|
|
48
|
+
],
|
|
49
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
50
|
+
template: `
|
|
51
|
+
<div class="card-form">
|
|
52
|
+
<kj-field>
|
|
53
|
+
<kj-field-label>Card number</kj-field-label>
|
|
54
|
+
<input
|
|
55
|
+
#cardNumber
|
|
56
|
+
kjInputMask
|
|
57
|
+
[kjMask]="presets.cardNumber"
|
|
58
|
+
[(ngModel)]="cardNumberValue"
|
|
59
|
+
(kjComplete)="expiryInput().nativeElement.focus()"
|
|
60
|
+
/>
|
|
61
|
+
</kj-field>
|
|
62
|
+
<div class="card-row">
|
|
63
|
+
<kj-field>
|
|
64
|
+
<kj-field-label>Expiry (MM/YY)</kj-field-label>
|
|
65
|
+
<input
|
|
66
|
+
#expiry
|
|
67
|
+
kjInputMask
|
|
68
|
+
[kjMask]="presets.cardExpiry"
|
|
69
|
+
[(ngModel)]="expiryValue"
|
|
70
|
+
(kjComplete)="cvvInput().nativeElement.focus()"
|
|
71
|
+
/>
|
|
72
|
+
</kj-field>
|
|
73
|
+
<kj-field>
|
|
74
|
+
<kj-field-label>CVV</kj-field-label>
|
|
75
|
+
<input #cvv kjInputMask kjMask="999" [(ngModel)]="cvvValue" />
|
|
76
|
+
</kj-field>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
`,
|
|
80
|
+
})
|
|
81
|
+
export class KjInputMaskCreditCardExample {
|
|
82
|
+
readonly presets = KJ_INPUT_MASK_PRESETS;
|
|
83
|
+
|
|
84
|
+
readonly cardNumberValue = signal('');
|
|
85
|
+
readonly expiryValue = signal('');
|
|
86
|
+
readonly cvvValue = signal('');
|
|
87
|
+
|
|
88
|
+
readonly expiryInput = viewChild.required<ElementRef<HTMLInputElement>>('expiry');
|
|
89
|
+
readonly cvvInput = viewChild.required<ElementRef<HTMLInputElement>>('cvv');
|
|
90
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { Component, signal, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { KjInputMask } from '@kouji-ui/core';
|
|
4
|
+
import { KjFieldComponent, KjFieldHelpComponent, KjFieldLabelComponent } from '../../field/field';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Custom-tokens example — hex colour code `#HHHHHH` using a per-instance
|
|
8
|
+
* token `H` for `/[0-9A-Fa-f]/`.
|
|
9
|
+
*
|
|
10
|
+
* The `#` is treated as a literal (not in the token map), and the remaining
|
|
11
|
+
* six positions accept only hexadecimal characters.
|
|
12
|
+
*/
|
|
13
|
+
@Component({
|
|
14
|
+
selector: 'kj-input-mask-custom-tokens-example',
|
|
15
|
+
standalone: true,
|
|
16
|
+
imports: [
|
|
17
|
+
FormsModule,
|
|
18
|
+
KjInputMask,
|
|
19
|
+
KjFieldComponent,
|
|
20
|
+
KjFieldHelpComponent,
|
|
21
|
+
KjFieldLabelComponent,
|
|
22
|
+
],
|
|
23
|
+
styles: [
|
|
24
|
+
`
|
|
25
|
+
:host {
|
|
26
|
+
display: block;
|
|
27
|
+
max-width: 400px;
|
|
28
|
+
}
|
|
29
|
+
input[kjInputMask] {
|
|
30
|
+
color: var(--kj-fg-default);
|
|
31
|
+
border: 1px solid var(--kj-border-default);
|
|
32
|
+
border-radius: var(--kj-radius-field, 0.375rem);
|
|
33
|
+
padding: var(--kj-space-sm) var(--kj-space-md);
|
|
34
|
+
font: var(--kj-text-sm) / 1.4 var(--kj-font-mono, monospace);
|
|
35
|
+
font-variant-numeric: tabular-nums;
|
|
36
|
+
width: 100%;
|
|
37
|
+
}
|
|
38
|
+
input[kjInputMask]:focus-visible {
|
|
39
|
+
outline: 2px solid var(--kj-fg-primary);
|
|
40
|
+
outline-offset: 2px;
|
|
41
|
+
border-color: var(--kj-fg-primary);
|
|
42
|
+
}
|
|
43
|
+
.preview {
|
|
44
|
+
margin-top: var(--kj-space-md);
|
|
45
|
+
display: flex;
|
|
46
|
+
align-items: center;
|
|
47
|
+
gap: var(--kj-space-sm);
|
|
48
|
+
font-size: var(--kj-text-sm);
|
|
49
|
+
color: var(--kj-fg-default);
|
|
50
|
+
}
|
|
51
|
+
.swatch {
|
|
52
|
+
display: inline-block;
|
|
53
|
+
width: 1.5rem;
|
|
54
|
+
height: 1.5rem;
|
|
55
|
+
border-radius: 0.25rem;
|
|
56
|
+
border: 1px solid var(--kj-border-default);
|
|
57
|
+
flex-shrink: 0;
|
|
58
|
+
}
|
|
59
|
+
`,
|
|
60
|
+
],
|
|
61
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
62
|
+
template: `
|
|
63
|
+
<kj-field>
|
|
64
|
+
<kj-field-label>Hex colour</kj-field-label>
|
|
65
|
+
<input
|
|
66
|
+
kjInputMask
|
|
67
|
+
kjMask="#HHHHHH"
|
|
68
|
+
[kjMaskTokens]="hexTokens"
|
|
69
|
+
kjMaskMode="masked"
|
|
70
|
+
[(ngModel)]="hex"
|
|
71
|
+
/>
|
|
72
|
+
<kj-field-help>Six hexadecimal digits, e.g. #1A2B3C</kj-field-help>
|
|
73
|
+
</kj-field>
|
|
74
|
+
<div class="preview">
|
|
75
|
+
<span class="swatch" [style.background]="hex().length === 7 ? hex() : 'transparent'"></span>
|
|
76
|
+
<span>{{ hex() }}</span>
|
|
77
|
+
</div>
|
|
78
|
+
`,
|
|
79
|
+
})
|
|
80
|
+
export class KjInputMaskCustomTokensExample {
|
|
81
|
+
readonly hex = signal('#______');
|
|
82
|
+
|
|
83
|
+
/** Per-instance token map: H = hex digit. */
|
|
84
|
+
readonly hexTokens: Record<string, RegExp> = {
|
|
85
|
+
H: /[0-9A-Fa-f]/,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Component, signal, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { KjInputMask, KJ_INPUT_MASK_PRESETS } from '@kouji-ui/core';
|
|
4
|
+
import { KjFieldComponent, KjFieldHelpComponent, KjFieldLabelComponent } from '../../field/field';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Date field using the `usDate` preset (`99/99/9999`).
|
|
8
|
+
* Demonstrates a common calendar-adjacent use case.
|
|
9
|
+
*/
|
|
10
|
+
@Component({
|
|
11
|
+
selector: 'kj-input-mask-date-example',
|
|
12
|
+
standalone: true,
|
|
13
|
+
imports: [
|
|
14
|
+
FormsModule,
|
|
15
|
+
KjInputMask,
|
|
16
|
+
KjFieldComponent,
|
|
17
|
+
KjFieldHelpComponent,
|
|
18
|
+
KjFieldLabelComponent,
|
|
19
|
+
],
|
|
20
|
+
styles: [
|
|
21
|
+
`
|
|
22
|
+
:host {
|
|
23
|
+
display: block;
|
|
24
|
+
max-width: 400px;
|
|
25
|
+
}
|
|
26
|
+
input[kjInputMask] {
|
|
27
|
+
color: var(--kj-fg-default);
|
|
28
|
+
border: 1px solid var(--kj-border-default);
|
|
29
|
+
border-radius: var(--kj-radius-field, 0.375rem);
|
|
30
|
+
padding: var(--kj-space-sm) var(--kj-space-md);
|
|
31
|
+
font: var(--kj-text-sm) / 1.4 var(--kj-font-sans);
|
|
32
|
+
font-variant-numeric: tabular-nums;
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
input[kjInputMask]:focus-visible {
|
|
36
|
+
outline: 2px solid var(--kj-fg-primary);
|
|
37
|
+
outline-offset: 2px;
|
|
38
|
+
border-color: var(--kj-fg-primary);
|
|
39
|
+
}
|
|
40
|
+
.value-display {
|
|
41
|
+
margin-top: var(--kj-space-md);
|
|
42
|
+
font-size: var(--kj-text-xs);
|
|
43
|
+
color: var(--kj-fg-muted);
|
|
44
|
+
font-family: var(--kj-font-mono, monospace);
|
|
45
|
+
}
|
|
46
|
+
`,
|
|
47
|
+
],
|
|
48
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
49
|
+
template: `
|
|
50
|
+
<kj-field>
|
|
51
|
+
<kj-field-label>Date of birth</kj-field-label>
|
|
52
|
+
<input kjInputMask [kjMask]="presets.usDate" [(ngModel)]="date" />
|
|
53
|
+
<kj-field-help>MM/DD/YYYY</kj-field-help>
|
|
54
|
+
</kj-field>
|
|
55
|
+
<p class="value-display">Raw value: {{ date() }}</p>
|
|
56
|
+
`,
|
|
57
|
+
})
|
|
58
|
+
export class KjInputMaskDateExample {
|
|
59
|
+
readonly presets = KJ_INPUT_MASK_PRESETS;
|
|
60
|
+
readonly date = signal('');
|
|
61
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Component, signal, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { KjInputMask } from '@kouji-ui/core';
|
|
4
|
+
import { KjFieldComponent, KjFieldHelpComponent, KjFieldLabelComponent } from '../../field/field';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Default usage example — phone number mask.
|
|
8
|
+
* Demonstrates `kjMaskMode="unmasked"` (default): the model value is raw
|
|
9
|
+
* digits; the mask shape is only a display concern.
|
|
10
|
+
*/
|
|
11
|
+
@Component({
|
|
12
|
+
selector: 'kj-input-mask-example',
|
|
13
|
+
standalone: true,
|
|
14
|
+
imports: [
|
|
15
|
+
FormsModule,
|
|
16
|
+
KjInputMask,
|
|
17
|
+
KjFieldComponent,
|
|
18
|
+
KjFieldLabelComponent,
|
|
19
|
+
KjFieldHelpComponent,
|
|
20
|
+
],
|
|
21
|
+
styles: [
|
|
22
|
+
`
|
|
23
|
+
:host {
|
|
24
|
+
display: block;
|
|
25
|
+
max-width: 400px;
|
|
26
|
+
}
|
|
27
|
+
input[kjInputMask] {
|
|
28
|
+
color: var(--kj-fg-default);
|
|
29
|
+
border: 1px solid var(--kj-border-default);
|
|
30
|
+
border-radius: var(--kj-radius-field, 0.375rem);
|
|
31
|
+
padding: var(--kj-space-sm) var(--kj-space-md);
|
|
32
|
+
font: var(--kj-text-sm) / 1.4 var(--kj-font-sans);
|
|
33
|
+
font-variant-numeric: tabular-nums;
|
|
34
|
+
width: 100%;
|
|
35
|
+
}
|
|
36
|
+
input[kjInputMask]:focus-visible {
|
|
37
|
+
outline: 2px solid var(--kj-fg-primary);
|
|
38
|
+
outline-offset: 2px;
|
|
39
|
+
border-color: var(--kj-fg-primary);
|
|
40
|
+
}
|
|
41
|
+
.value-display {
|
|
42
|
+
margin-top: var(--kj-space-md);
|
|
43
|
+
font-size: var(--kj-text-xs);
|
|
44
|
+
color: var(--kj-fg-muted);
|
|
45
|
+
font-family: var(--kj-font-mono, monospace);
|
|
46
|
+
}
|
|
47
|
+
`,
|
|
48
|
+
],
|
|
49
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
50
|
+
template: `
|
|
51
|
+
<kj-field>
|
|
52
|
+
<kj-field-label>Phone number</kj-field-label>
|
|
53
|
+
<input kjInputMask kjMask="(999) 999-9999" [(ngModel)]="phone" />
|
|
54
|
+
<kj-field-help>Format: (###) ###-####</kj-field-help>
|
|
55
|
+
</kj-field>
|
|
56
|
+
<p class="value-display">Value: {{ phone() }}</p>
|
|
57
|
+
`,
|
|
58
|
+
})
|
|
59
|
+
export class KjInputMaskExample {
|
|
60
|
+
readonly phone = signal('');
|
|
61
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
|
|
2
|
+
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { KjInputMaskComponent } from '../input-mask';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Common mask patterns assembled into one screen — phone, date, and credit
|
|
7
|
+
* card. Copy-paste starting point for masked forms.
|
|
8
|
+
*/
|
|
9
|
+
@Component({
|
|
10
|
+
selector: 'kj-input-mask-usage-example',
|
|
11
|
+
standalone: true,
|
|
12
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
13
|
+
imports: [KjInputMaskComponent, FormsModule],
|
|
14
|
+
styles: [`
|
|
15
|
+
:host { display: flex; flex-direction: column; gap: var(--kj-space-md); max-width: 360px; }
|
|
16
|
+
label { font: 500 var(--kj-text-sm)/1.4 var(--kj-font-sans); }
|
|
17
|
+
.row { display: flex; flex-direction: column; gap: var(--kj-space-xs); }
|
|
18
|
+
code { font: var(--kj-text-xs)/1 var(--kj-font-mono); color: var(--kj-fg-muted); }
|
|
19
|
+
`],
|
|
20
|
+
template: `
|
|
21
|
+
<div class="row">
|
|
22
|
+
<label for="usage-phone">Phone</label>
|
|
23
|
+
<kj-input-mask id="usage-phone" kjMask="(999) 999-9999" [(ngModel)]="phone" />
|
|
24
|
+
<code>{{ phone() || '—' }}</code>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
<div class="row">
|
|
28
|
+
<label for="usage-date">Date</label>
|
|
29
|
+
<kj-input-mask id="usage-date" kjMask="9999-99-99" [(ngModel)]="date" />
|
|
30
|
+
<code>{{ date() || '—' }}</code>
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
<div class="row">
|
|
34
|
+
<label for="usage-card">Card</label>
|
|
35
|
+
<kj-input-mask id="usage-card" kjMask="9999 9999 9999 9999" [(ngModel)]="card" />
|
|
36
|
+
<code>{{ card() || '—' }}</code>
|
|
37
|
+
</div>
|
|
38
|
+
`,
|
|
39
|
+
})
|
|
40
|
+
export class KjInputMaskUsageExample {
|
|
41
|
+
readonly phone = signal('');
|
|
42
|
+
readonly date = signal('');
|
|
43
|
+
readonly card = signal('');
|
|
44
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Component, ChangeDetectionStrategy } from '@angular/core';
|
|
2
|
+
import { FormControl, ReactiveFormsModule, Validators } from '@angular/forms';
|
|
3
|
+
import { KjInputMask } from '@kouji-ui/core';
|
|
4
|
+
import {
|
|
5
|
+
KjFieldComponent,
|
|
6
|
+
KjFieldErrorComponent,
|
|
7
|
+
KjFieldHelpComponent,
|
|
8
|
+
KjFieldLabelComponent,
|
|
9
|
+
} from '../../field/field';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Reactive form with `Validators.required` and the built-in `mask` validator.
|
|
13
|
+
*
|
|
14
|
+
* The mask validator fires automatically when the field has been partially
|
|
15
|
+
* filled — no extra wiring needed. Read `ctrl.errors?.mask` in your template
|
|
16
|
+
* to show a custom "incomplete" message.
|
|
17
|
+
*/
|
|
18
|
+
@Component({
|
|
19
|
+
selector: 'kj-input-mask-validation-example',
|
|
20
|
+
standalone: true,
|
|
21
|
+
imports: [
|
|
22
|
+
ReactiveFormsModule,
|
|
23
|
+
KjInputMask,
|
|
24
|
+
KjFieldComponent,
|
|
25
|
+
KjFieldLabelComponent,
|
|
26
|
+
KjFieldHelpComponent,
|
|
27
|
+
KjFieldErrorComponent,
|
|
28
|
+
],
|
|
29
|
+
styles: [
|
|
30
|
+
`
|
|
31
|
+
:host {
|
|
32
|
+
display: block;
|
|
33
|
+
max-width: 400px;
|
|
34
|
+
}
|
|
35
|
+
input[kjInputMask] {
|
|
36
|
+
color: var(--kj-fg-default);
|
|
37
|
+
border: 1px solid var(--kj-border-default);
|
|
38
|
+
border-radius: var(--kj-radius-field, 0.375rem);
|
|
39
|
+
padding: var(--kj-space-sm) var(--kj-space-md);
|
|
40
|
+
font: var(--kj-text-sm) / 1.4 var(--kj-font-sans);
|
|
41
|
+
font-variant-numeric: tabular-nums;
|
|
42
|
+
width: 100%;
|
|
43
|
+
}
|
|
44
|
+
input[kjInputMask]:focus-visible {
|
|
45
|
+
outline: 2px solid var(--kj-fg-primary);
|
|
46
|
+
outline-offset: 2px;
|
|
47
|
+
border-color: var(--kj-fg-primary);
|
|
48
|
+
}
|
|
49
|
+
input[kjInputMask][aria-invalid='true'] {
|
|
50
|
+
border-color: var(--kj-fg-danger, #ef4444);
|
|
51
|
+
}
|
|
52
|
+
`,
|
|
53
|
+
],
|
|
54
|
+
changeDetection: ChangeDetectionStrategy.Eager,
|
|
55
|
+
template: `
|
|
56
|
+
<kj-field [kjInvalid]="phoneCtrl.invalid && phoneCtrl.touched">
|
|
57
|
+
<kj-field-label>Phone number</kj-field-label>
|
|
58
|
+
<input
|
|
59
|
+
kjInputMask
|
|
60
|
+
kjMask="(999) 999-9999"
|
|
61
|
+
[formControl]="phoneCtrl"
|
|
62
|
+
[kjInvalid]="phoneCtrl.invalid && phoneCtrl.touched"
|
|
63
|
+
/>
|
|
64
|
+
<kj-field-help>US phone, e.g. (415) 555-0123</kj-field-help>
|
|
65
|
+
@if (phoneCtrl.touched && phoneCtrl.errors?.['required']) {
|
|
66
|
+
<kj-field-error>Phone number is required.</kj-field-error>
|
|
67
|
+
} @else if (phoneCtrl.touched && phoneCtrl.errors?.['mask']) {
|
|
68
|
+
<kj-field-error>
|
|
69
|
+
Please enter all {{ $any(phoneCtrl.errors)['mask']?.required }} digits ({{
|
|
70
|
+
$any(phoneCtrl.errors)['mask']?.filled
|
|
71
|
+
}}
|
|
72
|
+
of {{ $any(phoneCtrl.errors)['mask']?.required }} filled).
|
|
73
|
+
</kj-field-error>
|
|
74
|
+
}
|
|
75
|
+
</kj-field>
|
|
76
|
+
`,
|
|
77
|
+
})
|
|
78
|
+
export class KjInputMaskValidationExample {
|
|
79
|
+
readonly phoneCtrl = new FormControl('', [Validators.required]);
|
|
80
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/* Input mask wrapper — inherits base input visual tokens */
|
|
2
|
+
|
|
3
|
+
.kj-input-mask {
|
|
4
|
+
display: contents;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.kj-input-mask__input {
|
|
8
|
+
/* Inherits the same base-input tokens used by .kj-input. Explicit height
|
|
9
|
+
contract (matches input.css / button.css) so masked inputs line up with
|
|
10
|
+
sibling inputs in a form row. */
|
|
11
|
+
--kj-input-mask-height: 2.25rem;
|
|
12
|
+
background: var(--kj-bg-field);
|
|
13
|
+
color: var(--kj-fg-default);
|
|
14
|
+
border: var(--kj-border, 1px) solid var(--kj-border-default);
|
|
15
|
+
border-radius: var(--kj-radius-field, 0.375rem);
|
|
16
|
+
padding: 0 var(--kj-space-md, 0.75rem);
|
|
17
|
+
font: var(--kj-text-sm, 0.875rem) / 1.4 var(--kj-font-sans, sans-serif);
|
|
18
|
+
width: 100%;
|
|
19
|
+
height: var(--kj-input-mask-height);
|
|
20
|
+
font-variant-numeric: tabular-nums;
|
|
21
|
+
}
|
|
22
|
+
.kj-input-mask__input[data-size="sm"] { --kj-input-mask-height: 2rem; font-size: 0.8125rem; }
|
|
23
|
+
.kj-input-mask__input[data-size="lg"] { --kj-input-mask-height: 2.75rem; font-size: 1rem; }
|
|
24
|
+
|
|
25
|
+
.kj-input-mask__input:focus-visible {
|
|
26
|
+
outline: 2px solid var(--kj-fg-primary);
|
|
27
|
+
outline-offset: 2px;
|
|
28
|
+
border-color: var(--kj-fg-primary);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.kj-input-mask__input[aria-invalid='true'] {
|
|
32
|
+
border-color: var(--kj-fg-danger, #ef4444);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.kj-input-mask__input[data-disabled],
|
|
36
|
+
.kj-input-mask__input:disabled {
|
|
37
|
+
opacity: 0.5;
|
|
38
|
+
cursor: not-allowed;
|
|
39
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
|
|
2
|
+
import { FormsModule } from '@angular/forms';
|
|
3
|
+
import { KjInputMaskComponent } from './input-mask';
|
|
4
|
+
import type { PlaygroundFile } from '@kouji-ui/components/playground-types';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Playground state — module-scope signals. Mask preset, mode, disabled,
|
|
8
|
+
* invalid, and auto-clear cover the surface the wrapper exposes. The
|
|
9
|
+
* mask preset is a chips list since the playground engine doesn't yet
|
|
10
|
+
* ship a free-text control validated against a token regex.
|
|
11
|
+
*/
|
|
12
|
+
const mask = signal<'(999) 999-9999' | '99/99/9999' | '9999 9999 9999 9999' | 'aaa-999'>(
|
|
13
|
+
'(999) 999-9999',
|
|
14
|
+
);
|
|
15
|
+
const maskMode = signal<'unmasked' | 'masked'>('unmasked');
|
|
16
|
+
const disabled = signal(false);
|
|
17
|
+
const invalid = signal(false);
|
|
18
|
+
const autoClear = signal(false);
|
|
19
|
+
|
|
20
|
+
@Component({
|
|
21
|
+
selector: 'kj-input-mask-playground',
|
|
22
|
+
standalone: true,
|
|
23
|
+
imports: [KjInputMaskComponent, FormsModule],
|
|
24
|
+
styles: [`:host { display: block; max-width: 360px; }`],
|
|
25
|
+
template: `
|
|
26
|
+
<kj-input-mask
|
|
27
|
+
[kjMask]="mask()"
|
|
28
|
+
[kjMaskMode]="maskMode()"
|
|
29
|
+
[kjDisabled]="disabled()"
|
|
30
|
+
[kjInvalid]="invalid()"
|
|
31
|
+
[kjAutoClear]="autoClear()"
|
|
32
|
+
/>
|
|
33
|
+
`,
|
|
34
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
35
|
+
})
|
|
36
|
+
export class KjInputMaskPlaygroundDemo {
|
|
37
|
+
protected readonly mask = mask;
|
|
38
|
+
protected readonly maskMode = maskMode;
|
|
39
|
+
protected readonly disabled = disabled;
|
|
40
|
+
protected readonly invalid = invalid;
|
|
41
|
+
protected readonly autoClear = autoClear;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export const PLAYGROUND: PlaygroundFile = {
|
|
45
|
+
component: KjInputMaskPlaygroundDemo,
|
|
46
|
+
state: {
|
|
47
|
+
mask: mask as unknown as ReturnType<typeof signal>,
|
|
48
|
+
maskMode: maskMode as unknown as ReturnType<typeof signal>,
|
|
49
|
+
disabled: disabled as unknown as ReturnType<typeof signal>,
|
|
50
|
+
invalid: invalid as unknown as ReturnType<typeof signal>,
|
|
51
|
+
autoClear: autoClear as unknown as ReturnType<typeof signal>,
|
|
52
|
+
},
|
|
53
|
+
controls: [
|
|
54
|
+
{
|
|
55
|
+
kind: 'chips',
|
|
56
|
+
name: 'mask',
|
|
57
|
+
label: 'mask',
|
|
58
|
+
options: ['(999) 999-9999', '99/99/9999', '9999 9999 9999 9999', 'aaa-999'],
|
|
59
|
+
},
|
|
60
|
+
{ kind: 'chips', name: 'maskMode', label: 'mode', options: ['unmasked', 'masked'] },
|
|
61
|
+
{ kind: 'toggle', name: 'disabled', label: 'disabled' },
|
|
62
|
+
{ kind: 'toggle', name: 'invalid', label: 'invalid' },
|
|
63
|
+
{ kind: 'toggle', name: 'autoClear', label: 'auto clear' },
|
|
64
|
+
],
|
|
65
|
+
snippet: (values) => {
|
|
66
|
+
const s = values as {
|
|
67
|
+
mask: string;
|
|
68
|
+
maskMode: string;
|
|
69
|
+
disabled: boolean;
|
|
70
|
+
invalid: boolean;
|
|
71
|
+
autoClear: boolean;
|
|
72
|
+
};
|
|
73
|
+
const attrs: string[] = [`kjMask="${s.mask}"`, `kjMaskMode="${s.maskMode}"`];
|
|
74
|
+
if (s.disabled) attrs.push('[kjDisabled]="true"');
|
|
75
|
+
if (s.invalid) attrs.push('[kjInvalid]="true"');
|
|
76
|
+
if (s.autoClear) attrs.push('[kjAutoClear]="true"');
|
|
77
|
+
return `<kj-input-mask\n ${attrs.join('\n ')}\n/>`;
|
|
78
|
+
},
|
|
79
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
ChangeDetectionStrategy,
|
|
3
|
+
Component,
|
|
4
|
+
ViewEncapsulation,
|
|
5
|
+
booleanAttribute,
|
|
6
|
+
input,
|
|
7
|
+
output,
|
|
8
|
+
} from '@angular/core';
|
|
9
|
+
import { FormsModule } from '@angular/forms';
|
|
10
|
+
import { KjInputMask } from '@kouji-ui/core';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Styled wrapper around the headless `KjInputMask` directive. Owns the visual
|
|
14
|
+
* shape of a masked text input. The inner `<input>` carries native input
|
|
15
|
+
* semantics (focus, form integration, validation).
|
|
16
|
+
*
|
|
17
|
+
* The component proxies all `KjInputMask` inputs and the `kjComplete` output.
|
|
18
|
+
* Use `[(ngModel)]` or `[formControl]` on the inner `<input>` for form wiring.
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```html
|
|
22
|
+
* <kj-input-mask kjMask="(999) 999-9999" [(ngModel)]="phone" />
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @doc-example Default
|
|
26
|
+
* Phone number mask — anchors the chrome and the `kjMaskMode="unmasked"` default.
|
|
27
|
+
* @doc-file input-mask.example.ts
|
|
28
|
+
* @doc-example Usage
|
|
29
|
+
* Common mask patterns assembled into one screen — phone, date, and credit card.
|
|
30
|
+
* @doc-file input-mask.usage.example.ts
|
|
31
|
+
* @doc-example Credit card
|
|
32
|
+
* 16-digit mask with grouped quads.
|
|
33
|
+
* @doc-file input-mask.credit-card.example.ts
|
|
34
|
+
* @doc-example Date
|
|
35
|
+
* ISO `YYYY-MM-DD` mask with format-hint announcement for AT.
|
|
36
|
+
* @doc-file input-mask.date.example.ts
|
|
37
|
+
* @doc-example Validation
|
|
38
|
+
* Pairs `kjComplete` with reactive form validators to flag incomplete masks.
|
|
39
|
+
* @doc-file input-mask.validation.example.ts
|
|
40
|
+
* @doc-example Custom tokens
|
|
41
|
+
* Per-instance token map for masks beyond `9` / `A` / `*`.
|
|
42
|
+
* @doc-file input-mask.custom-tokens.example.ts
|
|
43
|
+
*
|
|
44
|
+
* @doc-keyboard
|
|
45
|
+
* Tab — Moves focus into and out of the masked input (native semantics)
|
|
46
|
+
* Backspace — Removes the previous variable slot; static separators are skipped
|
|
47
|
+
* Arrow keys — Move the caret across slots; the directive snaps over static chars
|
|
48
|
+
*
|
|
49
|
+
* @doc-aria
|
|
50
|
+
* aria-invalid — Reflected when [kjInvalid] is true (via the composed KjInput plumbing)
|
|
51
|
+
* aria-describedby— Auto-augmented with the auto-generated format hint unless [kjFormatHint] is empty
|
|
52
|
+
* data-mask-mode — Mirrors [kjMaskMode] ("unmasked" | "masked") for CSS hooks
|
|
53
|
+
*
|
|
54
|
+
* @doc-touch
|
|
55
|
+
* Height inherits the `kj-input` defaults — `md` is 36 px; use `data-size="lg"`
|
|
56
|
+
* for primary touch fields so the slot-tap surface meets WCAG 2.5.5.
|
|
57
|
+
*
|
|
58
|
+
* @doc-a11y
|
|
59
|
+
* `KjInputMask` auto-generates a screen-reader format hint from the mask
|
|
60
|
+
* template (e.g. `'(999) 999-9999'` → "Format: (___) ___-____") and wires
|
|
61
|
+
* it through `aria-describedby`. Override or suppress with `[kjFormatHint]`.
|
|
62
|
+
* The native `<input>` underneath keeps full focus + caret semantics.
|
|
63
|
+
*
|
|
64
|
+
* @doc-related input,field,form,number-input
|
|
65
|
+
*
|
|
66
|
+
* @doc-css-var
|
|
67
|
+
* --kj-input-mask-height — Explicit height of the masked input. Sizes (sm/lg via data-size) override.
|
|
68
|
+
*
|
|
69
|
+
* @doc-category Library/Data input
|
|
70
|
+
* @doc
|
|
71
|
+
* @doc-name input-mask
|
|
72
|
+
* @doc-description Themed masked text input for phone numbers, dates, credit cards, and custom formats.
|
|
73
|
+
* @doc-is-main
|
|
74
|
+
*/
|
|
75
|
+
@Component({
|
|
76
|
+
selector: 'kj-input-mask',
|
|
77
|
+
standalone: true,
|
|
78
|
+
imports: [KjInputMask, FormsModule],
|
|
79
|
+
template: `
|
|
80
|
+
<input
|
|
81
|
+
kjInputMask
|
|
82
|
+
class="kj-input-mask__input"
|
|
83
|
+
[kjMask]="kjMask()"
|
|
84
|
+
[kjMaskTokens]="kjMaskTokens()"
|
|
85
|
+
[kjMaskMode]="kjMaskMode()"
|
|
86
|
+
[kjSlotChar]="kjSlotChar()"
|
|
87
|
+
[kjDisabled]="kjDisabled()"
|
|
88
|
+
[kjInvalid]="kjInvalid()"
|
|
89
|
+
[kjAutoClear]="kjAutoClear()"
|
|
90
|
+
[kjFormatHint]="kjFormatHint()"
|
|
91
|
+
(kjComplete)="kjComplete.emit()"
|
|
92
|
+
/>
|
|
93
|
+
`,
|
|
94
|
+
styleUrl: './input-mask.css',
|
|
95
|
+
encapsulation: ViewEncapsulation.None,
|
|
96
|
+
host: { class: 'kj-input-mask' },
|
|
97
|
+
changeDetection: ChangeDetectionStrategy.OnPush,
|
|
98
|
+
})
|
|
99
|
+
export class KjInputMaskComponent {
|
|
100
|
+
/** Mask template. Required. e.g. `'(999) 999-9999'`. */
|
|
101
|
+
readonly kjMask = input.required<string>();
|
|
102
|
+
|
|
103
|
+
/** Per-instance token overrides merged with the app-wide defaults. */
|
|
104
|
+
readonly kjMaskTokens = input<Record<string, RegExp>>({});
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* What value is committed to the FormControl.
|
|
108
|
+
* - `'unmasked'` (default) — raw alphanumerics.
|
|
109
|
+
* - `'masked'` — full display string.
|
|
110
|
+
*/
|
|
111
|
+
readonly kjMaskMode = input<'unmasked' | 'masked'>('unmasked');
|
|
112
|
+
|
|
113
|
+
/** Placeholder char for empty variable slots. @default '_' */
|
|
114
|
+
readonly kjSlotChar = input<string>('_');
|
|
115
|
+
|
|
116
|
+
/** Disabled state. @default false */
|
|
117
|
+
readonly kjDisabled = input(false, { transform: booleanAttribute });
|
|
118
|
+
|
|
119
|
+
/** Invalid state — wires to `aria-invalid` via the inner `KjInput`. @default false */
|
|
120
|
+
readonly kjInvalid = input(false, { transform: booleanAttribute });
|
|
121
|
+
|
|
122
|
+
/** Clear on blur if incomplete. @default false */
|
|
123
|
+
readonly kjAutoClear = input(false, { transform: booleanAttribute });
|
|
124
|
+
|
|
125
|
+
/** Override or suppress the auto-generated screen-reader format hint. */
|
|
126
|
+
readonly kjFormatHint = input<string>('');
|
|
127
|
+
|
|
128
|
+
/** Emits when every variable slot is filled. */
|
|
129
|
+
readonly kjComplete = output<void>();
|
|
130
|
+
}
|