@ojiepermana/angular 22.1.11 → 22.1.12
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/README.md +32 -26
- package/chart/README.md +272 -0
- package/component/README.md +89 -0
- package/component/accordion/README.md +195 -0
- package/component/alert/README.md +184 -0
- package/component/alert-dialog/README.md +255 -0
- package/component/aspect-ratio/README.md +116 -0
- package/component/avatar/README.md +182 -0
- package/component/badge/README.md +143 -0
- package/component/breadcrumb/README.md +223 -0
- package/component/button/README.md +141 -0
- package/component/button-group/README.md +214 -0
- package/component/calendar/README.md +137 -0
- package/component/card/README.md +232 -0
- package/component/carousel/README.md +276 -0
- package/component/checkbox/README.md +153 -0
- package/component/collapsible/README.md +216 -0
- package/component/combobox/README.md +202 -0
- package/component/command/README.md +287 -0
- package/component/composer/README.md +241 -0
- package/component/context-menu/README.md +268 -0
- package/component/date-picker/README.md +202 -0
- package/component/dialog/README.md +276 -0
- package/component/drawer/README.md +147 -0
- package/component/dropdown-menu/README.md +336 -0
- package/component/editor/README.md +152 -0
- package/component/empty/README.md +193 -0
- package/component/form/README.md +216 -0
- package/component/hover-card/README.md +150 -0
- package/component/icon/README.md +25 -0
- package/component/input/README.md +160 -0
- package/component/input-group/README.md +245 -0
- package/component/input-otp/README.md +331 -0
- package/component/item/README.md +254 -0
- package/component/kanban/README.md +81 -0
- package/component/kbd/README.md +141 -0
- package/component/label/README.md +137 -0
- package/component/menubar/README.md +270 -0
- package/component/native-select/README.md +176 -0
- package/component/navigation-menu/README.md +165 -0
- package/component/pagination/README.md +151 -0
- package/component/pillbox/README.md +68 -0
- package/component/popover/README.md +54 -0
- package/component/progress/README.md +160 -0
- package/component/radio/README.md +212 -0
- package/component/resizable/README.md +178 -0
- package/component/scroll-area/README.md +150 -0
- package/component/select/README.md +228 -0
- package/component/separator/README.md +175 -0
- package/component/sheet/README.md +190 -0
- package/component/skeleton/README.md +158 -0
- package/component/slider/README.md +207 -0
- package/component/spinner/README.md +160 -0
- package/component/switch/README.md +170 -0
- package/component/table/README.md +292 -0
- package/component/tabs/README.md +220 -0
- package/component/textarea/README.md +169 -0
- package/component/timeline/README.md +94 -0
- package/component/toast/README.md +173 -0
- package/component/toggle/README.md +133 -0
- package/component/toggle-group/README.md +234 -0
- package/component/tooltip/README.md +230 -0
- package/fesm2022/ojiepermana-angular-chart-area.mjs +289 -3
- package/fesm2022/ojiepermana-angular-chart-bar.mjs +722 -3
- package/fesm2022/ojiepermana-angular-chart-core.mjs +1482 -3
- package/fesm2022/ojiepermana-angular-chart-line.mjs +294 -3
- package/fesm2022/ojiepermana-angular-chart-pie.mjs +291 -3
- package/fesm2022/ojiepermana-angular-chart-primitives.mjs +1301 -3
- package/fesm2022/ojiepermana-angular-chart-radar.mjs +421 -3
- package/fesm2022/ojiepermana-angular-chart-radial.mjs +295 -3
- package/fesm2022/ojiepermana-angular-chart-scatter.mjs +306 -3
- package/fesm2022/ojiepermana-angular-chart.mjs +12 -3
- package/fesm2022/ojiepermana-angular-component-accordion.mjs +267 -3
- package/fesm2022/ojiepermana-angular-component-alert-dialog.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-alert.mjs +101 -3
- package/fesm2022/ojiepermana-angular-component-aspect-ratio.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-avatar.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-badge.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-breadcrumb.mjs +192 -3
- package/fesm2022/ojiepermana-angular-component-button-group.mjs +95 -3
- package/fesm2022/ojiepermana-angular-component-button.mjs +73 -3
- package/fesm2022/ojiepermana-angular-component-calendar.mjs +718 -3
- package/fesm2022/ojiepermana-angular-component-card.mjs +167 -3
- package/fesm2022/ojiepermana-angular-component-carousel.mjs +326 -3
- package/fesm2022/ojiepermana-angular-component-checkbox.mjs +190 -3
- package/fesm2022/ojiepermana-angular-component-collapsible.mjs +117 -3
- package/fesm2022/ojiepermana-angular-component-combobox.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-command.mjs +351 -3
- package/fesm2022/ojiepermana-angular-component-composer.mjs +359 -3
- package/fesm2022/ojiepermana-angular-component-context-menu.mjs +158 -3
- package/fesm2022/ojiepermana-angular-component-date-picker.mjs +482 -3
- package/fesm2022/ojiepermana-angular-component-dialog.mjs +400 -3
- package/fesm2022/ojiepermana-angular-component-drawer.mjs +1 -3
- package/fesm2022/ojiepermana-angular-component-dropdown-menu.mjs +689 -3
- package/fesm2022/ojiepermana-angular-component-editor.mjs +511 -3
- package/fesm2022/ojiepermana-angular-component-empty.mjs +134 -3
- package/fesm2022/ojiepermana-angular-component-form.mjs +438 -3
- package/fesm2022/ojiepermana-angular-component-hover-card.mjs +273 -3
- package/fesm2022/ojiepermana-angular-component-icon.mjs +139 -3
- package/fesm2022/ojiepermana-angular-component-input-group.mjs +176 -3
- package/fesm2022/ojiepermana-angular-component-input-otp.mjs +550 -3
- package/fesm2022/ojiepermana-angular-component-input.mjs +52 -3
- package/fesm2022/ojiepermana-angular-component-item.mjs +264 -3
- package/fesm2022/ojiepermana-angular-component-kanban.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-kbd.mjs +48 -3
- package/fesm2022/ojiepermana-angular-component-label.mjs +27 -3
- package/fesm2022/ojiepermana-angular-component-menubar.mjs +327 -3
- package/fesm2022/ojiepermana-angular-component-native-select.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-navigation-menu.mjs +378 -3
- package/fesm2022/ojiepermana-angular-component-pagination.mjs +238 -3
- package/fesm2022/ojiepermana-angular-component-pillbox.mjs +999 -3
- package/fesm2022/ojiepermana-angular-component-popover.mjs +201 -3
- package/fesm2022/ojiepermana-angular-component-progress.mjs +57 -3
- package/fesm2022/ojiepermana-angular-component-radio.mjs +180 -3
- package/fesm2022/ojiepermana-angular-component-resizable.mjs +493 -3
- package/fesm2022/ojiepermana-angular-component-scroll-area.mjs +51 -3
- package/fesm2022/ojiepermana-angular-component-segmented-control.mjs +227 -3
- package/fesm2022/ojiepermana-angular-component-select.mjs +609 -3
- package/fesm2022/ojiepermana-angular-component-separator.mjs +31 -3
- package/fesm2022/ojiepermana-angular-component-sheet.mjs +407 -3
- package/fesm2022/ojiepermana-angular-component-skeleton.mjs +25 -3
- package/fesm2022/ojiepermana-angular-component-slider.mjs +456 -3
- package/fesm2022/ojiepermana-angular-component-spinner.mjs +56 -3
- package/fesm2022/ojiepermana-angular-component-switch.mjs +145 -3
- package/fesm2022/ojiepermana-angular-component-table.mjs +155 -3
- package/fesm2022/ojiepermana-angular-component-tabs.mjs +315 -3
- package/fesm2022/ojiepermana-angular-component-textarea.mjs +46 -3
- package/fesm2022/ojiepermana-angular-component-timeline.mjs +237 -3
- package/fesm2022/ojiepermana-angular-component-toast.mjs +241 -3
- package/fesm2022/ojiepermana-angular-component-toggle-group.mjs +290 -3
- package/fesm2022/ojiepermana-angular-component-toggle.mjs +76 -3
- package/fesm2022/ojiepermana-angular-component-tooltip.mjs +519 -3
- package/fesm2022/ojiepermana-angular-component-utils-core.mjs +310 -3
- package/fesm2022/ojiepermana-angular-component-utils-overlay.mjs +62 -3
- package/fesm2022/ojiepermana-angular-component-utils-scale.mjs +34 -3
- package/fesm2022/ojiepermana-angular-component-utils.mjs +3 -2
- package/fesm2022/ojiepermana-angular-component.mjs +4 -4
- package/fesm2022/ojiepermana-angular-navigation-core.mjs +21 -3
- package/fesm2022/ojiepermana-angular-navigation-icon.mjs +20 -3
- package/fesm2022/ojiepermana-angular-navigation-navigation-badge-count.component-CDBxQ8rk.mjs +91 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-dockbar-menu.component-DBQHdvGa.mjs +512 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-entry-grid.component-Cd-jh6tg.mjs +623 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-flyout-menu.component-BCGvhoYj.mjs +404 -0
- package/fesm2022/ojiepermana-angular-navigation-navigation-horizontal.component-Dk_03e-6.mjs +466 -0
- package/fesm2022/ojiepermana-angular-navigation-ojiepermana-angular-navigation-DNKU6viC.mjs +2642 -0
- package/fesm2022/ojiepermana-angular-navigation-service.mjs +725 -3
- package/fesm2022/ojiepermana-angular-navigation-types.mjs +65 -4
- package/fesm2022/ojiepermana-angular-navigation.mjs +4 -10
- package/fesm2022/ojiepermana-angular-sdk.mjs +204 -4
- package/fesm2022/ojiepermana-angular-theme-component-settings.mjs +1387 -3
- package/fesm2022/ojiepermana-angular-theme-layout-services.mjs +331 -3
- package/fesm2022/ojiepermana-angular-theme-layout-types.mjs +45 -4
- package/fesm2022/ojiepermana-angular-theme-layout-wrapper.mjs +1044 -3
- package/fesm2022/ojiepermana-angular-theme-layout.mjs +729 -3
- package/fesm2022/ojiepermana-angular-theme-page-core.mjs +381 -3
- package/fesm2022/ojiepermana-angular-theme-page-filter.mjs +267 -3
- package/fesm2022/ojiepermana-angular-theme-page-root.mjs +361 -3
- package/fesm2022/ojiepermana-angular-theme-page-side.mjs +198 -3
- package/fesm2022/ojiepermana-angular-theme-page-slots.mjs +110 -3
- package/fesm2022/ojiepermana-angular-theme-page.mjs +7 -2
- package/fesm2022/ojiepermana-angular-theme-shell-services.mjs +338 -3
- package/fesm2022/ojiepermana-angular-theme-shell-types.mjs +160 -4
- package/fesm2022/ojiepermana-angular-theme-shell.mjs +811 -3
- package/fesm2022/ojiepermana-angular-theme-styles.mjs +783 -3
- package/fesm2022/ojiepermana-angular-theme.mjs +4 -4
- package/fesm2022/ojiepermana-angular.mjs +6 -11
- package/navigation/README.md +374 -0
- package/package.json +81 -20
- package/sdk/README.md +212 -0
- package/sdk/schematics/collection.json +20 -0
- package/sdk/schematics/init/index.js +83 -0
- package/sdk/schematics/init/schema.json +19 -0
- package/sdk/schematics/ng-add/index.js +147 -0
- package/sdk/schematics/ng-add/schema.json +14 -0
- package/sdk/schematics/package.json +3 -0
- package/sdk/schematics/sdk/index.js +175 -0
- package/sdk/schematics/sdk/schema.json +19 -0
- package/sdk/sdk.config.example.json +24 -0
- package/sdk/src/config/loader.js +43 -0
- package/sdk/src/config/schema.js +59 -0
- package/sdk/src/emit/client.js +251 -0
- package/sdk/src/emit/metadata.js +310 -0
- package/sdk/src/emit/models.js +104 -0
- package/sdk/src/emit/navigation.js +56 -0
- package/sdk/src/emit/operations.js +118 -0
- package/sdk/src/emit/public-api.js +54 -0
- package/sdk/src/emit/services.js +110 -0
- package/sdk/src/engine.js +67 -0
- package/sdk/src/layout/per-domain.js +360 -0
- package/sdk/src/package.json +3 -0
- package/sdk/src/parser/bundle.js +25 -0
- package/sdk/src/parser/ir.js +429 -0
- package/sdk/src/parser/types.js +7 -0
- package/sdk/src/render/template.js +152 -0
- package/sdk/src/writer/index.js +286 -0
- package/theme/README.md +126 -0
- package/theme/component/settings/README.md +135 -0
- package/theme/layout/README.md +539 -0
- package/theme/page/README.md +453 -0
- package/theme/shell/README.md +340 -0
- package/theme/styles/README.md +178 -0
- package/theme/styles/css/base/components.css +553 -0
- package/theme/styles/css/base/index.css +14 -0
- package/theme/styles/css/base/package.css +9 -0
- package/theme/styles/css/base/prefers-dark.css +86 -0
- package/theme/styles/css/base/print.css +62 -0
- package/theme/styles/css/base/status.css +38 -0
- package/theme/styles/css/base/tailwind.css +165 -0
- package/theme/styles/css/base/theme.css +373 -0
- package/theme/styles/css/base/tokens.css +361 -0
- package/theme/styles/css/color/amber.css +72 -0
- package/theme/styles/css/color/blue.css +72 -0
- package/theme/styles/css/color/brand.css +38 -0
- package/theme/styles/css/color/cyan.css +72 -0
- package/theme/styles/css/color/emerald.css +72 -0
- package/theme/styles/css/color/fuchsia.css +72 -0
- package/theme/styles/css/color/green.css +72 -0
- package/theme/styles/css/color/index.css +19 -0
- package/theme/styles/css/color/indigo.css +72 -0
- package/theme/styles/css/color/lime.css +72 -0
- package/theme/styles/css/color/orange.css +72 -0
- package/theme/styles/css/color/pink.css +72 -0
- package/theme/styles/css/color/purple.css +72 -0
- package/theme/styles/css/color/red.css +72 -0
- package/theme/styles/css/color/rose.css +72 -0
- package/theme/styles/css/color/sky.css +72 -0
- package/theme/styles/css/color/teal.css +72 -0
- package/theme/styles/css/color/violet.css +72 -0
- package/theme/styles/css/color/yellow.css +72 -0
- package/theme/styles/css/index.css +18 -0
- package/theme/styles/css/neutral/gray.css +63 -0
- package/theme/styles/css/neutral/index.css +11 -0
- package/theme/styles/css/neutral/mauve.css +63 -0
- package/theme/styles/css/neutral/mist.css +63 -0
- package/theme/styles/css/neutral/neutral.css +63 -0
- package/theme/styles/css/neutral/olive.css +63 -0
- package/theme/styles/css/neutral/slate.css +63 -0
- package/theme/styles/css/neutral/stone.css +63 -0
- package/theme/styles/css/neutral/taupe.css +63 -0
- package/theme/styles/css/neutral/zinc.css +63 -0
- package/theme/styles/css/radius/index.css +30 -0
- package/theme/styles/css/space/index.css +20 -0
- package/types/ojiepermana-angular-chart-area.d.ts +76 -1
- package/types/ojiepermana-angular-chart-bar.d.ts +201 -1
- package/types/ojiepermana-angular-chart-core.d.ts +811 -1
- package/types/ojiepermana-angular-chart-line.d.ts +75 -1
- package/types/ojiepermana-angular-chart-pie.d.ts +131 -1
- package/types/ojiepermana-angular-chart-primitives.d.ts +291 -1
- package/types/ojiepermana-angular-chart-radar.d.ts +116 -1
- package/types/ojiepermana-angular-chart-radial.d.ts +116 -1
- package/types/ojiepermana-angular-chart-scatter.d.ts +125 -1
- package/types/ojiepermana-angular-chart.d.ts +2 -1
- package/types/ojiepermana-angular-component-accordion.d.ts +85 -1
- package/types/ojiepermana-angular-component-alert-dialog.d.ts +140 -1
- package/types/ojiepermana-angular-component-alert.d.ts +42 -1
- package/types/ojiepermana-angular-component-aspect-ratio.d.ts +12 -1
- package/types/ojiepermana-angular-component-avatar.d.ts +56 -1
- package/types/ojiepermana-angular-component-badge.d.ts +24 -1
- package/types/ojiepermana-angular-component-breadcrumb.d.ts +46 -1
- package/types/ojiepermana-angular-component-button-group.d.ts +26 -1
- package/types/ojiepermana-angular-component-button.d.ts +27 -1
- package/types/ojiepermana-angular-component-calendar.d.ts +111 -1
- package/types/ojiepermana-angular-component-card.d.ts +69 -1
- package/types/ojiepermana-angular-component-carousel.d.ts +86 -1
- package/types/ojiepermana-angular-component-checkbox.d.ts +42 -1
- package/types/ojiepermana-angular-component-collapsible.d.ts +42 -1
- package/types/ojiepermana-angular-component-combobox.d.ts +60 -1
- package/types/ojiepermana-angular-component-command.d.ts +130 -1
- package/types/ojiepermana-angular-component-composer.d.ts +90 -1
- package/types/ojiepermana-angular-component-context-menu.d.ts +54 -1
- package/types/ojiepermana-angular-component-date-picker.d.ts +109 -1
- package/types/ojiepermana-angular-component-dialog.d.ts +136 -1
- package/types/ojiepermana-angular-component-drawer.d.ts +1 -1
- package/types/ojiepermana-angular-component-dropdown-menu.d.ts +248 -1
- package/types/ojiepermana-angular-component-editor.d.ts +135 -1
- package/types/ojiepermana-angular-component-empty.d.ts +50 -1
- package/types/ojiepermana-angular-component-form.d.ts +159 -1
- package/types/ojiepermana-angular-component-hover-card.d.ts +75 -1
- package/types/ojiepermana-angular-component-icon.d.ts +89 -1
- package/types/ojiepermana-angular-component-input-group.d.ts +51 -1
- package/types/ojiepermana-angular-component-input-otp.d.ts +155 -1
- package/types/ojiepermana-angular-component-input.d.ts +21 -1
- package/types/ojiepermana-angular-component-item.d.ts +93 -1
- package/types/ojiepermana-angular-component-kanban.d.ts +70 -1
- package/types/ojiepermana-angular-component-kbd.d.ts +16 -1
- package/types/ojiepermana-angular-component-label.d.ts +11 -1
- package/types/ojiepermana-angular-component-menubar.d.ts +93 -1
- package/types/ojiepermana-angular-component-native-select.d.ts +26 -1
- package/types/ojiepermana-angular-component-navigation-menu.d.ts +104 -1
- package/types/ojiepermana-angular-component-pagination.d.ts +33 -1
- package/types/ojiepermana-angular-component-pillbox.d.ts +222 -1
- package/types/ojiepermana-angular-component-popover.d.ts +66 -1
- package/types/ojiepermana-angular-component-progress.d.ts +17 -1
- package/types/ojiepermana-angular-component-radio.d.ts +60 -1
- package/types/ojiepermana-angular-component-resizable.d.ts +117 -1
- package/types/ojiepermana-angular-component-scroll-area.d.ts +19 -1
- package/types/ojiepermana-angular-component-segmented-control.d.ts +58 -1
- package/types/ojiepermana-angular-component-select.d.ts +122 -1
- package/types/ojiepermana-angular-component-separator.d.ts +14 -1
- package/types/ojiepermana-angular-component-sheet.d.ts +130 -1
- package/types/ojiepermana-angular-component-skeleton.d.ts +10 -1
- package/types/ojiepermana-angular-component-slider.d.ts +83 -1
- package/types/ojiepermana-angular-component-spinner.d.ts +13 -1
- package/types/ojiepermana-angular-component-switch.d.ts +44 -1
- package/types/ojiepermana-angular-component-table.d.ts +57 -1
- package/types/ojiepermana-angular-component-tabs.d.ts +124 -1
- package/types/ojiepermana-angular-component-textarea.d.ts +17 -1
- package/types/ojiepermana-angular-component-timeline.d.ts +64 -1
- package/types/ojiepermana-angular-component-toast.d.ts +64 -1
- package/types/ojiepermana-angular-component-toggle-group.d.ts +90 -1
- package/types/ojiepermana-angular-component-toggle.d.ts +25 -1
- package/types/ojiepermana-angular-component-tooltip.d.ts +143 -1
- package/types/ojiepermana-angular-component-utils-core.d.ts +184 -1
- package/types/ojiepermana-angular-component-utils-overlay.d.ts +21 -1
- package/types/ojiepermana-angular-component-utils-scale.d.ts +19 -1
- package/types/ojiepermana-angular-component-utils.d.ts +2 -1
- package/types/ojiepermana-angular-component.d.ts +2 -1
- package/types/ojiepermana-angular-navigation-core.d.ts +59 -1
- package/types/ojiepermana-angular-navigation-icon.d.ts +12 -1
- package/types/ojiepermana-angular-navigation-service.d.ts +116 -1
- package/types/ojiepermana-angular-navigation-types.d.ts +144 -1
- package/types/ojiepermana-angular-navigation.d.ts +507 -1
- package/types/ojiepermana-angular-sdk.d.ts +89 -1
- package/types/ojiepermana-angular-theme-component-settings.d.ts +154 -1
- package/types/ojiepermana-angular-theme-layout-services.d.ts +147 -1
- package/types/ojiepermana-angular-theme-layout-types.d.ts +40 -1
- package/types/ojiepermana-angular-theme-layout-wrapper.d.ts +299 -1
- package/types/ojiepermana-angular-theme-layout.d.ts +129 -1
- package/types/ojiepermana-angular-theme-page-core.d.ts +157 -1
- package/types/ojiepermana-angular-theme-page-filter.d.ts +77 -1
- package/types/ojiepermana-angular-theme-page-root.d.ts +88 -1
- package/types/ojiepermana-angular-theme-page-side.d.ts +50 -1
- package/types/ojiepermana-angular-theme-page-slots.d.ts +40 -1
- package/types/ojiepermana-angular-theme-page.d.ts +5 -1
- package/types/ojiepermana-angular-theme-shell-services.d.ts +193 -1
- package/types/ojiepermana-angular-theme-shell-types.d.ts +105 -1
- package/types/ojiepermana-angular-theme-shell.d.ts +100 -1
- package/types/ojiepermana-angular-theme-styles.d.ts +319 -1
- package/types/ojiepermana-angular-theme.d.ts +2 -1
- package/types/ojiepermana-angular.d.ts +5 -5
|
@@ -1,7 +1,554 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { Directive, input, computed, Component, inject, numberAttribute, booleanAttribute, viewChild, ElementRef, Injector, output, linkedSignal, signal, contentChildren, forwardRef } from '@angular/core';
|
|
3
|
+
import { NgControl, NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import { FormFieldContext } from '@ojiepermana/angular/component/form';
|
|
5
|
+
import { cn, injectUniqueId } from '@ojiepermana/angular/component/utils/core';
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
const REGEXP_ONLY_DIGITS = /^[0-9]$/;
|
|
8
|
+
const REGEXP_ONLY_DIGITS_AND_CHARS = /^[A-Za-z0-9]$/;
|
|
9
|
+
class InputOtpContextBase {
|
|
10
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputOtpContextBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
11
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: InputOtpContextBase, isStandalone: true, ngImport: i0 });
|
|
12
|
+
}
|
|
13
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputOtpContextBase, decorators: [{
|
|
14
|
+
type: Directive
|
|
15
|
+
}] });
|
|
16
|
+
class InputOtpGroupComponent {
|
|
17
|
+
class = input('', /* @ts-ignore */
|
|
18
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
19
|
+
classes = computed(() => cn('flex items-center overflow-hidden rounded-md border border-input bg-background shadow-sm', this.class()), /* @ts-ignore */
|
|
20
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
21
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputOtpGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
22
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: InputOtpGroupComponent, isStandalone: true, selector: "InputOtpGroup", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.data-slot": "\"input-otp-group\"" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
23
|
+
}
|
|
24
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputOtpGroupComponent, decorators: [{
|
|
25
|
+
type: Component,
|
|
26
|
+
args: [{
|
|
27
|
+
selector: 'InputOtpGroup',
|
|
28
|
+
host: {
|
|
29
|
+
'[class]': 'classes()',
|
|
30
|
+
'[attr.data-slot]': '"input-otp-group"',
|
|
31
|
+
},
|
|
32
|
+
template: `<ng-content />`,
|
|
33
|
+
}]
|
|
34
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
35
|
+
class InputOtpSeparatorComponent {
|
|
36
|
+
class = input('', /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
38
|
+
classes = computed(() => cn('inline-flex h-control-10 w-6 items-center justify-center text-muted-foreground [&>svg]:h-4 [&>svg]:w-4', this.class()), /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
40
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputOtpSeparatorComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
41
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: InputOtpSeparatorComponent, isStandalone: true, selector: "InputOtpSeparator", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "class": "classes()", "attr.data-slot": "\"input-otp-separator\"" } }, ngImport: i0, template: `
|
|
42
|
+
<svg
|
|
43
|
+
viewBox="0 0 24 24"
|
|
44
|
+
fill="none"
|
|
45
|
+
stroke="currentColor"
|
|
46
|
+
stroke-width="2"
|
|
47
|
+
stroke-linecap="round"
|
|
48
|
+
stroke-linejoin="round"
|
|
49
|
+
>
|
|
50
|
+
<path d="M5 12h14" />
|
|
51
|
+
</svg>
|
|
52
|
+
`, isInline: true });
|
|
53
|
+
}
|
|
54
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputOtpSeparatorComponent, decorators: [{
|
|
55
|
+
type: Component,
|
|
56
|
+
args: [{
|
|
57
|
+
selector: 'InputOtpSeparator',
|
|
58
|
+
host: {
|
|
59
|
+
'[class]': 'classes()',
|
|
60
|
+
'[attr.data-slot]': '"input-otp-separator"',
|
|
61
|
+
'aria-hidden': 'true',
|
|
62
|
+
},
|
|
63
|
+
template: `
|
|
64
|
+
<svg
|
|
65
|
+
viewBox="0 0 24 24"
|
|
66
|
+
fill="none"
|
|
67
|
+
stroke="currentColor"
|
|
68
|
+
stroke-width="2"
|
|
69
|
+
stroke-linecap="round"
|
|
70
|
+
stroke-linejoin="round"
|
|
71
|
+
>
|
|
72
|
+
<path d="M5 12h14" />
|
|
73
|
+
</svg>
|
|
74
|
+
`,
|
|
75
|
+
}]
|
|
76
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
77
|
+
class InputOtpSlotComponent {
|
|
78
|
+
ctx = inject(InputOtpContextBase);
|
|
79
|
+
index = input(0, { ...(ngDevMode ? { debugName: "index" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
80
|
+
class = input('', /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
82
|
+
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), alias: 'aria-invalid', transform: booleanAttribute });
|
|
83
|
+
inputRef = viewChild.required('inputRef', /* @ts-ignore */
|
|
84
|
+
...(ngDevMode ? [{ debugName: "inputRef" }] : /* istanbul ignore next */ []));
|
|
85
|
+
maxLength = computed(() => this.ctx.maxLength(), /* @ts-ignore */
|
|
86
|
+
...(ngDevMode ? [{ debugName: "maxLength" }] : /* istanbul ignore next */ []));
|
|
87
|
+
character = computed(() => this.ctx.slotValue(this.index()), /* @ts-ignore */
|
|
88
|
+
...(ngDevMode ? [{ debugName: "character" }] : /* istanbul ignore next */ []));
|
|
89
|
+
active = computed(() => this.ctx.isActive(this.index()), /* @ts-ignore */
|
|
90
|
+
...(ngDevMode ? [{ debugName: "active" }] : /* istanbul ignore next */ []));
|
|
91
|
+
filled = computed(() => this.character() !== '', /* @ts-ignore */
|
|
92
|
+
...(ngDevMode ? [{ debugName: "filled" }] : /* istanbul ignore next */ []));
|
|
93
|
+
disabled = computed(() => this.ctx.isDisabled(), /* @ts-ignore */
|
|
94
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
95
|
+
required = computed(() => this.ctx.isRequired(), /* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
97
|
+
inputId = computed(() => this.ctx.slotId(this.index()), /* @ts-ignore */
|
|
98
|
+
...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
99
|
+
inputMode = computed(() => this.ctx.slotInputMode(), /* @ts-ignore */
|
|
100
|
+
...(ngDevMode ? [{ debugName: "inputMode" }] : /* istanbul ignore next */ []));
|
|
101
|
+
autocomplete = computed(() => this.ctx.slotAutocomplete(this.index()), /* @ts-ignore */
|
|
102
|
+
...(ngDevMode ? [{ debugName: "autocomplete" }] : /* istanbul ignore next */ []));
|
|
103
|
+
ariaLabel = computed(() => this.ctx.slotAriaLabel(this.index()), /* @ts-ignore */
|
|
104
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
105
|
+
ariaLabelledBy = computed(() => this.ctx.slotAriaLabelledBy(this.index()), /* @ts-ignore */
|
|
106
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledBy" }] : /* istanbul ignore next */ []));
|
|
107
|
+
ariaDescribedBy = computed(() => this.ctx.slotAriaDescribedBy(), /* @ts-ignore */
|
|
108
|
+
...(ngDevMode ? [{ debugName: "ariaDescribedBy" }] : /* istanbul ignore next */ []));
|
|
109
|
+
effectiveInvalid = computed(() => this.invalid() || this.ctx.isInvalid(), /* @ts-ignore */
|
|
110
|
+
...(ngDevMode ? [{ debugName: "effectiveInvalid" }] : /* istanbul ignore next */ []));
|
|
111
|
+
classes = computed(() => cn('relative flex h-control-10 w-control-10 items-center justify-center border-r border-border text-sm font-medium transition-[background-color,box-shadow,opacity] last:border-r-0', this.active() && !this.effectiveInvalid() && 'z-10 ring-1 ring-inset ring-ring', this.effectiveInvalid() &&
|
|
112
|
+
'bg-destructive/5 text-destructive ring-1 ring-inset ring-destructive/50', this.disabled() && 'opacity-50', this.class()), /* @ts-ignore */
|
|
113
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
114
|
+
focus(select = true) {
|
|
115
|
+
const input = this.inputRef().nativeElement;
|
|
116
|
+
input.focus();
|
|
117
|
+
if (select) {
|
|
118
|
+
input.select();
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
handleFocus() {
|
|
122
|
+
this.ctx.handleSlotFocus(this.index());
|
|
123
|
+
this.inputRef().nativeElement.select();
|
|
124
|
+
}
|
|
125
|
+
handleInput(event) {
|
|
126
|
+
const target = event.target;
|
|
127
|
+
this.ctx.handleSlotInput(this.index(), target.value);
|
|
128
|
+
this.syncElementValue(target);
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Push the model back onto the element the browser just wrote to.
|
|
132
|
+
*
|
|
133
|
+
* `[value]` only repaints when `character()` CHANGES, and a character the
|
|
134
|
+
* pattern rejects leaves the model exactly as it was — so without this the
|
|
135
|
+
* rejected character stays on screen until some later, unrelated value change.
|
|
136
|
+
* It covers the paste of an entirely unacceptable string too: that one is not
|
|
137
|
+
* prevented, so the browser drops it in and the `input` event lands here.
|
|
138
|
+
*/
|
|
139
|
+
syncElementValue(target) {
|
|
140
|
+
const character = this.character();
|
|
141
|
+
if (target.value !== character) {
|
|
142
|
+
target.value = character;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
handleKeydown(event) {
|
|
146
|
+
this.ctx.handleSlotKeydown(this.index(), event);
|
|
147
|
+
}
|
|
148
|
+
handlePaste(event) {
|
|
149
|
+
this.ctx.handleSlotPaste(this.index(), event);
|
|
150
|
+
}
|
|
151
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputOtpSlotComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
152
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.4", type: InputOtpSlotComponent, isStandalone: true, selector: "InputOtpSlot", inputs: { index: { classPropertyName: "index", publicName: "index", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.data-slot": "\"input-otp-slot\"", "attr.data-active": "active() ? \"\" : null", "attr.data-filled": "filled() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-invalid": "effectiveInvalid() ? \"\" : null" } }, viewQueries: [{ propertyName: "inputRef", first: true, predicate: ["inputRef"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
153
|
+
<input
|
|
154
|
+
#inputRef
|
|
155
|
+
class="h-full w-full border-0 bg-transparent px-0 text-center text-inherit font-inherit outline-none disabled:cursor-not-allowed"
|
|
156
|
+
type="text"
|
|
157
|
+
spellcheck="false"
|
|
158
|
+
autocapitalize="none"
|
|
159
|
+
[value]="character()"
|
|
160
|
+
[attr.id]="inputId()"
|
|
161
|
+
[attr.maxlength]="maxLength()"
|
|
162
|
+
[attr.inputmode]="inputMode()"
|
|
163
|
+
[attr.autocomplete]="autocomplete()"
|
|
164
|
+
[attr.aria-label]="ariaLabel()"
|
|
165
|
+
[attr.aria-labelledby]="ariaLabelledBy()"
|
|
166
|
+
[attr.aria-describedby]="ariaDescribedBy()"
|
|
167
|
+
[attr.aria-invalid]="effectiveInvalid() ? 'true' : null"
|
|
168
|
+
[disabled]="disabled()"
|
|
169
|
+
[required]="required() || null"
|
|
170
|
+
(focus)="handleFocus()"
|
|
171
|
+
(input)="handleInput($event)"
|
|
172
|
+
(keydown)="handleKeydown($event)"
|
|
173
|
+
(paste)="handlePaste($event)"
|
|
174
|
+
/>
|
|
175
|
+
`, isInline: true });
|
|
176
|
+
}
|
|
177
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputOtpSlotComponent, decorators: [{
|
|
178
|
+
type: Component,
|
|
179
|
+
args: [{
|
|
180
|
+
selector: 'InputOtpSlot',
|
|
181
|
+
host: {
|
|
182
|
+
'[class]': 'classes()',
|
|
183
|
+
'[attr.data-slot]': '"input-otp-slot"',
|
|
184
|
+
'[attr.data-active]': 'active() ? "" : null',
|
|
185
|
+
'[attr.data-filled]': 'filled() ? "" : null',
|
|
186
|
+
'[attr.data-disabled]': 'disabled() ? "" : null',
|
|
187
|
+
'[attr.data-invalid]': 'effectiveInvalid() ? "" : null',
|
|
188
|
+
},
|
|
189
|
+
template: `
|
|
190
|
+
<input
|
|
191
|
+
#inputRef
|
|
192
|
+
class="h-full w-full border-0 bg-transparent px-0 text-center text-inherit font-inherit outline-none disabled:cursor-not-allowed"
|
|
193
|
+
type="text"
|
|
194
|
+
spellcheck="false"
|
|
195
|
+
autocapitalize="none"
|
|
196
|
+
[value]="character()"
|
|
197
|
+
[attr.id]="inputId()"
|
|
198
|
+
[attr.maxlength]="maxLength()"
|
|
199
|
+
[attr.inputmode]="inputMode()"
|
|
200
|
+
[attr.autocomplete]="autocomplete()"
|
|
201
|
+
[attr.aria-label]="ariaLabel()"
|
|
202
|
+
[attr.aria-labelledby]="ariaLabelledBy()"
|
|
203
|
+
[attr.aria-describedby]="ariaDescribedBy()"
|
|
204
|
+
[attr.aria-invalid]="effectiveInvalid() ? 'true' : null"
|
|
205
|
+
[disabled]="disabled()"
|
|
206
|
+
[required]="required() || null"
|
|
207
|
+
(focus)="handleFocus()"
|
|
208
|
+
(input)="handleInput($event)"
|
|
209
|
+
(keydown)="handleKeydown($event)"
|
|
210
|
+
(paste)="handlePaste($event)"
|
|
211
|
+
/>
|
|
212
|
+
`,
|
|
213
|
+
}]
|
|
214
|
+
}], propDecorators: { index: [{ type: i0.Input, args: [{ isSignal: true, alias: "index", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-invalid", required: false }] }], inputRef: [{ type: i0.ViewChild, args: ['inputRef', { isSignal: true }] }] } });
|
|
215
|
+
class InputOtpComponent extends InputOtpContextBase {
|
|
216
|
+
host = inject(ElementRef);
|
|
217
|
+
injector = inject(Injector);
|
|
218
|
+
formFieldContext = inject(FormFieldContext, { optional: true });
|
|
219
|
+
maxLengthInput = input(6, { ...(ngDevMode ? { debugName: "maxLengthInput" } : /* istanbul ignore next */ {}), alias: 'maxLength', transform: numberAttribute });
|
|
220
|
+
value = input(undefined, /* @ts-ignore */
|
|
221
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
222
|
+
pattern = input(null, /* @ts-ignore */
|
|
223
|
+
...(ngDevMode ? [{ debugName: "pattern" }] : /* istanbul ignore next */ []));
|
|
224
|
+
id = input(null, { ...(ngDevMode ? { debugName: "id" } : /* istanbul ignore next */ {}), alias: 'id' });
|
|
225
|
+
ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
226
|
+
ariaLabelledby = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
|
|
227
|
+
ariaDescribedby = input(null, { ...(ngDevMode ? { debugName: "ariaDescribedby" } : /* istanbul ignore next */ {}), alias: 'aria-describedby' });
|
|
228
|
+
inputMode = input('numeric', { ...(ngDevMode ? { debugName: "inputMode" } : /* istanbul ignore next */ {}), alias: 'inputmode' });
|
|
229
|
+
autocomplete = input('one-time-code', { ...(ngDevMode ? { debugName: "autocomplete" } : /* istanbul ignore next */ {}), alias: 'autocomplete' });
|
|
230
|
+
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
231
|
+
disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
|
|
232
|
+
invalidInput = input(false, { ...(ngDevMode ? { debugName: "invalidInput" } : /* istanbul ignore next */ {}), alias: 'aria-invalid', transform: booleanAttribute });
|
|
233
|
+
class = input('', /* @ts-ignore */
|
|
234
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
235
|
+
valueChange = output();
|
|
236
|
+
generatedId = injectUniqueId('InputOtp');
|
|
237
|
+
/**
|
|
238
|
+
* Single source of truth for the rendered value. Re-seeds from the `value`
|
|
239
|
+
* binding when it changes, but writes from typing or the Forms API
|
|
240
|
+
* (writeValue) win until the binding changes again — so `form.reset()` is
|
|
241
|
+
* never shadowed by a stale `[value]` binding.
|
|
242
|
+
*/
|
|
243
|
+
internalValue = linkedSignal(() => this.normalizeValue(this.value() ?? ''), {
|
|
244
|
+
debugName: 'InputOtp.internalValue',
|
|
245
|
+
set: (value, rawSet) => rawSet(this.normalizeValue(value)),
|
|
246
|
+
});
|
|
247
|
+
disabledState = signal(false, /* @ts-ignore */
|
|
248
|
+
...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
|
|
249
|
+
activeIndex = signal(0, /* @ts-ignore */
|
|
250
|
+
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
251
|
+
slots = contentChildren(InputOtpSlotComponent, { ...(ngDevMode ? { debugName: "slots" } : /* istanbul ignore next */ {}), descendants: true });
|
|
252
|
+
compiledPattern = computed(() => {
|
|
253
|
+
const pattern = this.pattern();
|
|
254
|
+
if (!pattern) {
|
|
255
|
+
return [];
|
|
256
|
+
}
|
|
257
|
+
if (pattern instanceof RegExp) {
|
|
258
|
+
return [pattern];
|
|
259
|
+
}
|
|
260
|
+
if (typeof pattern !== 'string') {
|
|
261
|
+
return pattern;
|
|
262
|
+
}
|
|
263
|
+
try {
|
|
264
|
+
return [new RegExp(pattern)];
|
|
265
|
+
}
|
|
266
|
+
catch {
|
|
267
|
+
return [];
|
|
268
|
+
}
|
|
269
|
+
}, /* @ts-ignore */
|
|
270
|
+
...(ngDevMode ? [{ debugName: "compiledPattern" }] : /* istanbul ignore next */ []));
|
|
271
|
+
classes = computed(() => cn('inline-flex flex-wrap items-center gap-2', this.class()), /* @ts-ignore */
|
|
272
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
273
|
+
disabled = computed(() => this.disabledInput() || this.disabledState(), /* @ts-ignore */
|
|
274
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
275
|
+
displayValue = computed(() => this.internalValue(), /* @ts-ignore */
|
|
276
|
+
...(ngDevMode ? [{ debugName: "displayValue" }] : /* istanbul ignore next */ []));
|
|
277
|
+
ngControl = null;
|
|
278
|
+
onChange = () => { };
|
|
279
|
+
onTouched = () => { };
|
|
280
|
+
ngOnInit() {
|
|
281
|
+
this.ngControl = this.injector.get(NgControl, null, { optional: true, self: true });
|
|
282
|
+
this.publishControl();
|
|
283
|
+
}
|
|
284
|
+
ngAfterViewInit() {
|
|
285
|
+
// `formControlName` assigns `.control` in FormControlName.ngOnChanges, which
|
|
286
|
+
// Angular runs AFTER this component's ngOnInit — both are pre-order hooks,
|
|
287
|
+
// and the component's are registered first. Reading it once at init would
|
|
288
|
+
// park `null` in the FormField forever, so the field could never surface the
|
|
289
|
+
// control's invalid state. By now the node is fully set up, whichever
|
|
290
|
+
// directive owns the binding.
|
|
291
|
+
this.publishControl();
|
|
292
|
+
}
|
|
293
|
+
maxLength() {
|
|
294
|
+
return Math.max(1, this.maxLengthInput());
|
|
295
|
+
}
|
|
296
|
+
slotId(index) {
|
|
297
|
+
const baseId = this.id() ?? this.formFieldContext?.controlId ?? this.generatedId;
|
|
298
|
+
return index === 0 ? baseId : `${baseId}-${index + 1}`;
|
|
299
|
+
}
|
|
300
|
+
slotValue(index) {
|
|
301
|
+
return this.toCharArray()[index] ?? '';
|
|
302
|
+
}
|
|
303
|
+
slotAriaLabel(index) {
|
|
304
|
+
const baseLabel = this.ariaLabel() ?? 'One-time password';
|
|
305
|
+
return `${baseLabel} character ${index + 1} of ${this.maxLength()}`;
|
|
306
|
+
}
|
|
307
|
+
slotAriaLabelledBy(index) {
|
|
308
|
+
return index === 0 ? this.ariaLabelledby() : null;
|
|
309
|
+
}
|
|
310
|
+
slotAriaDescribedBy() {
|
|
311
|
+
return this.describedBy();
|
|
312
|
+
}
|
|
313
|
+
slotInputMode() {
|
|
314
|
+
return this.inputMode();
|
|
315
|
+
}
|
|
316
|
+
slotAutocomplete(index) {
|
|
317
|
+
return index === 0 ? this.autocomplete() : 'off';
|
|
318
|
+
}
|
|
319
|
+
isDisabled() {
|
|
320
|
+
return this.disabled();
|
|
321
|
+
}
|
|
322
|
+
isRequired() {
|
|
323
|
+
return this.required();
|
|
324
|
+
}
|
|
325
|
+
isInvalid() {
|
|
326
|
+
return this.invalidInput() || this.formFieldContext?.invalid() || false;
|
|
327
|
+
}
|
|
328
|
+
isActive(index) {
|
|
329
|
+
return this.activeIndex() === index;
|
|
330
|
+
}
|
|
331
|
+
handleSlotFocus(index) {
|
|
332
|
+
this.activeIndex.set(index);
|
|
333
|
+
}
|
|
334
|
+
handleSlotInput(index, value) {
|
|
335
|
+
if (this.disabled()) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
const accepted = this.filterCharacters(value);
|
|
339
|
+
if (accepted.length === 0) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
if (accepted.length > 1) {
|
|
343
|
+
this.applyFragment(index, accepted);
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
const next = this.replaceAt(index, accepted[0]);
|
|
347
|
+
this.commitValue(next);
|
|
348
|
+
this.focusSlot(Math.min(index + 1, this.maxLength() - 1));
|
|
349
|
+
}
|
|
350
|
+
handleSlotKeydown(index, event) {
|
|
351
|
+
if (this.disabled()) {
|
|
352
|
+
return;
|
|
353
|
+
}
|
|
354
|
+
const isRtl = this.isRtl();
|
|
355
|
+
switch (event.key) {
|
|
356
|
+
case 'ArrowLeft':
|
|
357
|
+
event.preventDefault();
|
|
358
|
+
this.focusSlot(Math.max(0, index + (isRtl ? 1 : -1)));
|
|
359
|
+
return;
|
|
360
|
+
case 'ArrowRight':
|
|
361
|
+
event.preventDefault();
|
|
362
|
+
this.focusSlot(Math.min(this.maxLength() - 1, index + (isRtl ? -1 : 1)));
|
|
363
|
+
return;
|
|
364
|
+
case 'Home':
|
|
365
|
+
event.preventDefault();
|
|
366
|
+
this.focusSlot(0);
|
|
367
|
+
return;
|
|
368
|
+
case 'End':
|
|
369
|
+
event.preventDefault();
|
|
370
|
+
this.focusSlot(this.maxLength() - 1);
|
|
371
|
+
return;
|
|
372
|
+
case 'Backspace': {
|
|
373
|
+
event.preventDefault();
|
|
374
|
+
const current = this.slotValue(index);
|
|
375
|
+
const deleteIndex = current === '' ? index - 1 : index;
|
|
376
|
+
if (deleteIndex < 0) {
|
|
377
|
+
return;
|
|
378
|
+
}
|
|
379
|
+
this.commitValue(this.removeAt(deleteIndex));
|
|
380
|
+
this.focusSlot(Math.max(0, deleteIndex));
|
|
381
|
+
return;
|
|
382
|
+
}
|
|
383
|
+
case 'Delete':
|
|
384
|
+
event.preventDefault();
|
|
385
|
+
this.commitValue(this.removeAt(index));
|
|
386
|
+
this.focusSlot(index);
|
|
387
|
+
return;
|
|
388
|
+
default:
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
handleSlotPaste(index, event) {
|
|
393
|
+
if (this.disabled()) {
|
|
394
|
+
return;
|
|
395
|
+
}
|
|
396
|
+
const pasted = event.clipboardData?.getData('text') ?? '';
|
|
397
|
+
const accepted = this.filterCharacters(pasted);
|
|
398
|
+
if (accepted.length === 0) {
|
|
399
|
+
return;
|
|
400
|
+
}
|
|
401
|
+
event.preventDefault();
|
|
402
|
+
this.applyFragment(index, accepted);
|
|
403
|
+
}
|
|
404
|
+
focus() {
|
|
405
|
+
const index = Math.min(this.displayValue().length, this.maxLength() - 1);
|
|
406
|
+
this.focusSlot(Math.max(index, 0));
|
|
407
|
+
}
|
|
408
|
+
writeValue(value) {
|
|
409
|
+
this.internalValue.set(typeof value === 'string' ? value : '');
|
|
410
|
+
}
|
|
411
|
+
registerOnChange(fn) {
|
|
412
|
+
this.onChange = fn;
|
|
413
|
+
}
|
|
414
|
+
registerOnTouched(fn) {
|
|
415
|
+
this.onTouched = fn;
|
|
416
|
+
}
|
|
417
|
+
setDisabledState(disabled) {
|
|
418
|
+
this.disabledState.set(disabled);
|
|
419
|
+
}
|
|
420
|
+
describedBy() {
|
|
421
|
+
const rawIds = [this.ariaDescribedby(), this.formFieldContext?.describedBy() ?? null].filter((value) => !!value);
|
|
422
|
+
const ids = [...new Set(rawIds.flatMap((value) => value.split(/\s+/)).filter(Boolean))];
|
|
423
|
+
return ids.length > 0 ? ids.join(' ') : null;
|
|
424
|
+
}
|
|
425
|
+
handleFocusOut(event) {
|
|
426
|
+
const nextTarget = event.relatedTarget;
|
|
427
|
+
if (!(nextTarget instanceof Node) || !this.host.nativeElement.contains(nextTarget)) {
|
|
428
|
+
this.onTouched();
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
/** Hand the bound control to `<FormField>`, if this OTP is inside one. */
|
|
432
|
+
publishControl() {
|
|
433
|
+
const context = this.formFieldContext;
|
|
434
|
+
if (!context) {
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
const control = this.ngControl?.control ?? null;
|
|
438
|
+
if (control !== context.control()) {
|
|
439
|
+
context.control.set(control);
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
commitValue(value) {
|
|
443
|
+
this.internalValue.set(value);
|
|
444
|
+
const nextValue = this.internalValue();
|
|
445
|
+
this.onChange(nextValue);
|
|
446
|
+
this.valueChange.emit(nextValue);
|
|
447
|
+
}
|
|
448
|
+
replaceAt(index, character) {
|
|
449
|
+
const chars = this.toCharArray();
|
|
450
|
+
chars[index] = character;
|
|
451
|
+
return this.serialize(chars);
|
|
452
|
+
}
|
|
453
|
+
removeAt(index) {
|
|
454
|
+
const chars = this.toCharArray();
|
|
455
|
+
if (index < 0 || index >= chars.length) {
|
|
456
|
+
return this.displayValue();
|
|
457
|
+
}
|
|
458
|
+
chars.splice(index, 1);
|
|
459
|
+
chars.push('');
|
|
460
|
+
return this.serialize(chars);
|
|
461
|
+
}
|
|
462
|
+
applyFragment(index, characters) {
|
|
463
|
+
const chars = this.toCharArray();
|
|
464
|
+
let cursor = index;
|
|
465
|
+
for (const character of characters) {
|
|
466
|
+
if (cursor >= chars.length) {
|
|
467
|
+
break;
|
|
468
|
+
}
|
|
469
|
+
chars[cursor] = character;
|
|
470
|
+
cursor += 1;
|
|
471
|
+
}
|
|
472
|
+
this.commitValue(this.serialize(chars));
|
|
473
|
+
this.focusSlot(Math.min(cursor, this.maxLength() - 1));
|
|
474
|
+
}
|
|
475
|
+
focusSlot(index) {
|
|
476
|
+
const slot = this.slots().find((candidate) => candidate.index() === index);
|
|
477
|
+
if (!slot) {
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
this.activeIndex.set(index);
|
|
481
|
+
slot.focus();
|
|
482
|
+
}
|
|
483
|
+
toCharArray() {
|
|
484
|
+
const chars = Array.from({ length: this.maxLength() }, () => '');
|
|
485
|
+
for (const [index, character] of Array.from(this.displayValue()).entries()) {
|
|
486
|
+
if (index >= chars.length) {
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
chars[index] = character;
|
|
490
|
+
}
|
|
491
|
+
return chars;
|
|
492
|
+
}
|
|
493
|
+
serialize(chars) {
|
|
494
|
+
let lastFilledIndex = -1;
|
|
495
|
+
for (let index = chars.length - 1; index >= 0; index -= 1) {
|
|
496
|
+
if (chars[index] !== '') {
|
|
497
|
+
lastFilledIndex = index;
|
|
498
|
+
break;
|
|
499
|
+
}
|
|
500
|
+
}
|
|
501
|
+
return lastFilledIndex === -1 ? '' : chars.slice(0, lastFilledIndex + 1).join('');
|
|
502
|
+
}
|
|
503
|
+
normalizeValue(value) {
|
|
504
|
+
return this.filterCharacters(value).slice(0, this.maxLength()).join('');
|
|
505
|
+
}
|
|
506
|
+
filterCharacters(value) {
|
|
507
|
+
return Array.from(value).filter((character) => this.acceptsCharacter(character));
|
|
508
|
+
}
|
|
509
|
+
acceptsCharacter(character) {
|
|
510
|
+
return this.compiledPattern().every((pattern) => {
|
|
511
|
+
pattern.lastIndex = 0;
|
|
512
|
+
return pattern.test(character);
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
isRtl() {
|
|
516
|
+
return getComputedStyle(this.host.nativeElement).direction === 'rtl';
|
|
517
|
+
}
|
|
518
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputOtpComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
519
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "22.1.4", type: InputOtpComponent, isStandalone: true, selector: "InputOtp", inputs: { maxLengthInput: { classPropertyName: "maxLengthInput", publicName: "maxLength", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, pattern: { classPropertyName: "pattern", publicName: "pattern", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, inputMode: { classPropertyName: "inputMode", publicName: "inputmode", isSignal: true, isRequired: false, transformFunction: null }, autocomplete: { classPropertyName: "autocomplete", publicName: "autocomplete", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalidInput: { classPropertyName: "invalidInput", publicName: "aria-invalid", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange" }, host: { listeners: { "focusout": "handleFocusOut($event)" }, properties: { "class": "classes()", "attr.id": "null", "attr.role": "\"group\"", "attr.data-slot": "\"input-otp\"", "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-invalid": "isInvalid() ? \"\" : null", "attr.aria-label": "ariaLabel()", "attr.aria-labelledby": "ariaLabelledby()", "attr.aria-describedby": "describedBy()", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.aria-invalid": "isInvalid() ? \"true\" : null" } }, providers: [
|
|
520
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => InputOtpComponent), multi: true },
|
|
521
|
+
{ provide: InputOtpContextBase, useExisting: forwardRef(() => InputOtpComponent) },
|
|
522
|
+
], queries: [{ propertyName: "slots", predicate: InputOtpSlotComponent, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
523
|
+
}
|
|
524
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputOtpComponent, decorators: [{
|
|
525
|
+
type: Component,
|
|
526
|
+
args: [{
|
|
527
|
+
selector: 'InputOtp',
|
|
528
|
+
providers: [
|
|
529
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => InputOtpComponent), multi: true },
|
|
530
|
+
{ provide: InputOtpContextBase, useExisting: forwardRef(() => InputOtpComponent) },
|
|
531
|
+
],
|
|
532
|
+
host: {
|
|
533
|
+
'[class]': 'classes()',
|
|
534
|
+
'[attr.id]': 'null',
|
|
535
|
+
'[attr.role]': '"group"',
|
|
536
|
+
'[attr.data-slot]': '"input-otp"',
|
|
537
|
+
'[attr.data-disabled]': 'disabled() ? "" : null',
|
|
538
|
+
'[attr.data-invalid]': 'isInvalid() ? "" : null',
|
|
539
|
+
'[attr.aria-label]': 'ariaLabel()',
|
|
540
|
+
'[attr.aria-labelledby]': 'ariaLabelledby()',
|
|
541
|
+
'[attr.aria-describedby]': 'describedBy()',
|
|
542
|
+
'[attr.aria-disabled]': 'disabled() ? "true" : null',
|
|
543
|
+
'[attr.aria-invalid]': 'isInvalid() ? "true" : null',
|
|
544
|
+
'(focusout)': 'handleFocusOut($event)',
|
|
545
|
+
},
|
|
546
|
+
template: `<ng-content />`,
|
|
547
|
+
}]
|
|
548
|
+
}], propDecorators: { maxLengthInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLength", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], pattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "pattern", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], inputMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputmode", required: false }] }], autocomplete: [{ type: i0.Input, args: [{ isSignal: true, alias: "autocomplete", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], disabledInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalidInput: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-invalid", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], slots: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => InputOtpSlotComponent), { ...{ descendants: true }, isSignal: true }] }] } });
|
|
4
549
|
|
|
5
550
|
/**
|
|
6
551
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
552
|
+
*/
|
|
553
|
+
|
|
554
|
+
export { InputOtpComponent, InputOtpGroupComponent, InputOtpSeparatorComponent, InputOtpSlotComponent, REGEXP_ONLY_DIGITS, REGEXP_ONLY_DIGITS_AND_CHARS };
|
|
@@ -1,7 +1,56 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, input, computed, Component } from '@angular/core';
|
|
3
|
+
import { cn } from '@ojiepermana/angular/component/utils/core';
|
|
4
|
+
import * as i1 from '@ojiepermana/angular/component/utils/scale';
|
|
5
|
+
import { ComponentScaleDirective } from '@ojiepermana/angular/component/utils/scale';
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
const BASE = [
|
|
8
|
+
'flex h-control-md w-full rounded-md border border-input bg-transparent px-3 py-1',
|
|
9
|
+
'text-sm shadow-sm transition-colors',
|
|
10
|
+
'file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground',
|
|
11
|
+
'placeholder:text-muted-foreground',
|
|
12
|
+
'focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring',
|
|
13
|
+
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
14
|
+
'aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-visible:ring-destructive',
|
|
15
|
+
].join(' ');
|
|
16
|
+
/**
|
|
17
|
+
* Styled native `<input>`. Works with Angular's DefaultValueAccessor,
|
|
18
|
+
* so `ngModel` and reactive forms just work.
|
|
19
|
+
*/
|
|
20
|
+
class InputComponent {
|
|
21
|
+
componentScale = inject(ComponentScaleDirective);
|
|
22
|
+
radius = this.componentScale.radius;
|
|
23
|
+
density = this.componentScale.density;
|
|
24
|
+
el = inject(ElementRef);
|
|
25
|
+
class = input('', /* @ts-ignore */
|
|
26
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
27
|
+
classes = computed(() => cn(BASE, this.class()), /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
29
|
+
focus() {
|
|
30
|
+
this.el.nativeElement.focus();
|
|
31
|
+
}
|
|
32
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
33
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: InputComponent, isStandalone: true, selector: "input[Input]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, hostDirectives: [{ directive: i1.ComponentScaleDirective, inputs: ["radius", "radius", "density", "density"] }], ngImport: i0, template: '', isInline: true });
|
|
34
|
+
}
|
|
35
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: InputComponent, decorators: [{
|
|
36
|
+
type: Component,
|
|
37
|
+
args: [{
|
|
38
|
+
selector: 'input[Input]',
|
|
39
|
+
hostDirectives: [
|
|
40
|
+
{
|
|
41
|
+
directive: ComponentScaleDirective,
|
|
42
|
+
inputs: ['radius', 'density'],
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
host: {
|
|
46
|
+
'[class]': 'classes()',
|
|
47
|
+
},
|
|
48
|
+
template: '',
|
|
49
|
+
}]
|
|
50
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
4
51
|
|
|
5
52
|
/**
|
|
6
53
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
54
|
+
*/
|
|
55
|
+
|
|
56
|
+
export { InputComponent };
|