@ojiepermana/angular 22.1.11 → 22.1.13
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 +374 -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,1003 @@
|
|
|
1
|
-
|
|
1
|
+
import { DOCUMENT, NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, TemplateRef, Directive, ElementRef, contentChild, input, booleanAttribute, output, computed, Component, numberAttribute, DestroyRef, signal, viewChild, contentChildren, forwardRef } from '@angular/core';
|
|
4
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
+
import { cn, injectUniqueId } from '@ojiepermana/angular/component/utils/core';
|
|
2
6
|
|
|
3
|
-
|
|
7
|
+
/**
|
|
8
|
+
* What roving focus needs from one option, whichever kind of option it is.
|
|
9
|
+
*
|
|
10
|
+
* `Pillbox` renders two things with `role="option"` into the same listbox -- a
|
|
11
|
+
* value option and the "create" affordance -- and a listbox owes exactly one tab
|
|
12
|
+
* stop across all of them. Both kinds implement this, so the roving model can
|
|
13
|
+
* treat them as one ordered list without caring which is which.
|
|
14
|
+
*/
|
|
15
|
+
class PillboxRovingOption {
|
|
16
|
+
}
|
|
17
|
+
class PillboxContext {
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
class PillboxSelectedDirective {
|
|
21
|
+
template = inject(TemplateRef);
|
|
22
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PillboxSelectedDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
23
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.1.4", type: PillboxSelectedDirective, isStandalone: true, selector: "ng-template[PillboxSelected]", exportAs: ["PillboxSelected"], ngImport: i0 });
|
|
24
|
+
}
|
|
25
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PillboxSelectedDirective, decorators: [{
|
|
26
|
+
type: Directive,
|
|
27
|
+
args: [{
|
|
28
|
+
selector: 'ng-template[PillboxSelected]',
|
|
29
|
+
exportAs: 'PillboxSelected',
|
|
30
|
+
}]
|
|
31
|
+
}] });
|
|
32
|
+
class PillboxOptionComponent extends PillboxRovingOption {
|
|
33
|
+
context = inject(PillboxContext);
|
|
34
|
+
element = inject(ElementRef);
|
|
35
|
+
selectedTemplate = contentChild(PillboxSelectedDirective, /* @ts-ignore */
|
|
36
|
+
...(ngDevMode ? [{ debugName: "selectedTemplate" }] : /* istanbul ignore next */ []));
|
|
37
|
+
value = input.required(/* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
39
|
+
label = input('', /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
41
|
+
selectedLabel = input('', /* @ts-ignore */
|
|
42
|
+
...(ngDevMode ? [{ debugName: "selectedLabel" }] : /* istanbul ignore next */ []));
|
|
43
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
44
|
+
filterable = input(true, { ...(ngDevMode ? { debugName: "filterable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
45
|
+
class = input('', /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
47
|
+
selectedChange = output();
|
|
48
|
+
selected = computed(() => this.context.optionSelected(this), /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "selected" }] : /* istanbul ignore next */ []));
|
|
50
|
+
visible = computed(() => this.context.optionVisible(this), /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
52
|
+
tabIndex = computed(() => this.context.optionTabIndex(this), /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []));
|
|
54
|
+
classes = computed(() => cn('relative flex w-full cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors', 'hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground', 'data-[selected]:bg-accent data-[selected]:text-accent-foreground', 'data-[disabled]:pointer-events-none data-[disabled]:opacity-50', this.class()), /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
56
|
+
rovingVisible() {
|
|
57
|
+
return this.visible();
|
|
58
|
+
}
|
|
59
|
+
nativeElement() {
|
|
60
|
+
return this.element.nativeElement;
|
|
61
|
+
}
|
|
62
|
+
focus() {
|
|
63
|
+
this.element.nativeElement.focus();
|
|
64
|
+
}
|
|
65
|
+
textLabel() {
|
|
66
|
+
return (this.label() || this.element.nativeElement.textContent || String(this.value())).trim();
|
|
67
|
+
}
|
|
68
|
+
pillLabel() {
|
|
69
|
+
return (this.selectedLabel() || this.textLabel()).trim();
|
|
70
|
+
}
|
|
71
|
+
pillTemplate() {
|
|
72
|
+
return this.selectedTemplate()?.template ?? null;
|
|
73
|
+
}
|
|
74
|
+
handleClick(event) {
|
|
75
|
+
this.context.chooseOption(this, event);
|
|
76
|
+
}
|
|
77
|
+
handleFocus() {
|
|
78
|
+
this.context.activateOption(this);
|
|
79
|
+
}
|
|
80
|
+
handleKeydown(event) {
|
|
81
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
82
|
+
event.preventDefault();
|
|
83
|
+
this.context.chooseOption(this, event);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
this.context.handleOptionKeydown(this, event);
|
|
87
|
+
}
|
|
88
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PillboxOptionComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
89
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: PillboxOptionComponent, isStandalone: true, selector: "PillboxOption, button[PillboxOption]", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, selectedLabel: { classPropertyName: "selectedLabel", publicName: "selectedLabel", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, filterable: { classPropertyName: "filterable", publicName: "filterable", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selectedChange: "selectedChange" }, host: { attributes: { "type": "button" }, listeners: { "click": "handleClick($event)", "focus": "handleFocus()", "keydown": "handleKeydown($any($event))" }, properties: { "class": "classes()", "attr.data-slot": "\"pillbox-option\"", "attr.data-selected": "selected() ? \"\" : null", "attr.data-disabled": "disabled() ? \"\" : null", "attr.role": "\"option\"", "attr.aria-selected": "selected()", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.tabindex": "tabIndex()", "hidden": "!visible()" } }, queries: [{ propertyName: "selectedTemplate", first: true, predicate: PillboxSelectedDirective, descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
90
|
+
<span class="min-w-0 flex-1 truncate text-left"><ng-content /></span>
|
|
91
|
+
@if (selected()) {
|
|
92
|
+
<svg
|
|
93
|
+
aria-hidden="true"
|
|
94
|
+
class="ml-auto size-4 shrink-0"
|
|
95
|
+
viewBox="0 0 24 24"
|
|
96
|
+
fill="none"
|
|
97
|
+
stroke="currentColor"
|
|
98
|
+
stroke-width="1.75"
|
|
99
|
+
stroke-linecap="round"
|
|
100
|
+
stroke-linejoin="round"
|
|
101
|
+
>
|
|
102
|
+
<path d="M20 6 9 17l-5-5" />
|
|
103
|
+
</svg>
|
|
104
|
+
}
|
|
105
|
+
`, isInline: true });
|
|
106
|
+
}
|
|
107
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PillboxOptionComponent, decorators: [{
|
|
108
|
+
type: Component,
|
|
109
|
+
args: [{
|
|
110
|
+
selector: 'PillboxOption, button[PillboxOption]',
|
|
111
|
+
host: {
|
|
112
|
+
type: 'button',
|
|
113
|
+
'[class]': 'classes()',
|
|
114
|
+
'[attr.data-slot]': '"pillbox-option"',
|
|
115
|
+
'[attr.data-selected]': 'selected() ? "" : null',
|
|
116
|
+
'[attr.data-disabled]': 'disabled() ? "" : null',
|
|
117
|
+
'[attr.role]': '"option"',
|
|
118
|
+
'[attr.aria-selected]': 'selected()',
|
|
119
|
+
'[attr.aria-disabled]': 'disabled() ? "true" : null',
|
|
120
|
+
'[attr.tabindex]': 'tabIndex()',
|
|
121
|
+
'[hidden]': '!visible()',
|
|
122
|
+
'(click)': 'handleClick($event)',
|
|
123
|
+
'(focus)': 'handleFocus()',
|
|
124
|
+
'(keydown)': 'handleKeydown($any($event))',
|
|
125
|
+
},
|
|
126
|
+
template: `
|
|
127
|
+
<span class="min-w-0 flex-1 truncate text-left"><ng-content /></span>
|
|
128
|
+
@if (selected()) {
|
|
129
|
+
<svg
|
|
130
|
+
aria-hidden="true"
|
|
131
|
+
class="ml-auto size-4 shrink-0"
|
|
132
|
+
viewBox="0 0 24 24"
|
|
133
|
+
fill="none"
|
|
134
|
+
stroke="currentColor"
|
|
135
|
+
stroke-width="1.75"
|
|
136
|
+
stroke-linecap="round"
|
|
137
|
+
stroke-linejoin="round"
|
|
138
|
+
>
|
|
139
|
+
<path d="M20 6 9 17l-5-5" />
|
|
140
|
+
</svg>
|
|
141
|
+
}
|
|
142
|
+
`,
|
|
143
|
+
}]
|
|
144
|
+
}], propDecorators: { selectedTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => PillboxSelectedDirective), { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], selectedLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedLabel", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], filterable: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterable", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], selectedChange: [{ type: i0.Output, args: ["selectedChange"] }] } });
|
|
145
|
+
class PillboxOptionCreateComponent extends PillboxRovingOption {
|
|
146
|
+
context = inject(PillboxContext);
|
|
147
|
+
element = inject(ElementRef);
|
|
148
|
+
minLength = input(1, { ...(ngDevMode ? { debugName: "minLength" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
149
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
150
|
+
class = input('', /* @ts-ignore */
|
|
151
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
152
|
+
selected = output();
|
|
153
|
+
visible = computed(() => this.context.createVisible(this), /* @ts-ignore */
|
|
154
|
+
...(ngDevMode ? [{ debugName: "visible" }] : /* istanbul ignore next */ []));
|
|
155
|
+
tabIndex = computed(() => this.context.optionTabIndex(this), /* @ts-ignore */
|
|
156
|
+
...(ngDevMode ? [{ debugName: "tabIndex" }] : /* istanbul ignore next */ []));
|
|
157
|
+
classes = computed(() => cn('relative flex w-full cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm font-medium text-primary outline-none transition-colors', 'hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground', 'aria-disabled:pointer-events-none aria-disabled:opacity-50', this.class()), /* @ts-ignore */
|
|
158
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
159
|
+
rovingVisible() {
|
|
160
|
+
return this.visible();
|
|
161
|
+
}
|
|
162
|
+
nativeElement() {
|
|
163
|
+
return this.element.nativeElement;
|
|
164
|
+
}
|
|
165
|
+
focus() {
|
|
166
|
+
this.element.nativeElement.focus();
|
|
167
|
+
}
|
|
168
|
+
handleClick(event) {
|
|
169
|
+
this.context.chooseCreate(this, event);
|
|
170
|
+
}
|
|
171
|
+
handleFocus() {
|
|
172
|
+
this.context.activateOption(this);
|
|
173
|
+
}
|
|
174
|
+
handleKeydown(event) {
|
|
175
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
176
|
+
event.preventDefault();
|
|
177
|
+
this.context.chooseCreate(this, event);
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
this.context.handleOptionKeydown(this, event);
|
|
181
|
+
}
|
|
182
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PillboxOptionCreateComponent, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
183
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: PillboxOptionCreateComponent, isStandalone: true, selector: "PillboxOptionCreate, button[PillboxOptionCreate]", inputs: { minLength: { classPropertyName: "minLength", publicName: "minLength", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selected" }, host: { attributes: { "type": "button" }, listeners: { "click": "handleClick($event)", "focus": "handleFocus()", "keydown": "handleKeydown($any($event))" }, properties: { "class": "classes()", "attr.data-slot": "\"pillbox-option-create\"", "attr.role": "\"option\"", "attr.tabindex": "tabIndex()", "attr.aria-disabled": "disabled() ? \"true\" : null", "hidden": "!visible()" } }, usesInheritance: true, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
184
|
+
}
|
|
185
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PillboxOptionCreateComponent, decorators: [{
|
|
186
|
+
type: Component,
|
|
187
|
+
args: [{
|
|
188
|
+
selector: 'PillboxOptionCreate, button[PillboxOptionCreate]',
|
|
189
|
+
host: {
|
|
190
|
+
type: 'button',
|
|
191
|
+
'[class]': 'classes()',
|
|
192
|
+
'[attr.data-slot]': '"pillbox-option-create"',
|
|
193
|
+
'[attr.role]': '"option"',
|
|
194
|
+
'[attr.tabindex]': 'tabIndex()',
|
|
195
|
+
'[attr.aria-disabled]': 'disabled() ? "true" : null',
|
|
196
|
+
'[hidden]': '!visible()',
|
|
197
|
+
'(click)': 'handleClick($event)',
|
|
198
|
+
'(focus)': 'handleFocus()',
|
|
199
|
+
'(keydown)': 'handleKeydown($any($event))',
|
|
200
|
+
},
|
|
201
|
+
template: `<ng-content />`,
|
|
202
|
+
}]
|
|
203
|
+
}], propDecorators: { minLength: [{ type: i0.Input, args: [{ isSignal: true, alias: "minLength", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], selected: [{ type: i0.Output, args: ["selected"] }] } });
|
|
204
|
+
class PillboxOptionEmptyComponent {
|
|
205
|
+
context = inject(PillboxContext);
|
|
206
|
+
whenLoading = input('', /* @ts-ignore */
|
|
207
|
+
...(ngDevMode ? [{ debugName: "whenLoading" }] : /* istanbul ignore next */ []));
|
|
208
|
+
class = input('', /* @ts-ignore */
|
|
209
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
210
|
+
classes = computed(() => cn('px-2 py-6 text-center text-sm text-muted-foreground', this.class()), /* @ts-ignore */
|
|
211
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
212
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PillboxOptionEmptyComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
213
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: PillboxOptionEmptyComponent, isStandalone: true, selector: "PillboxOptionEmpty", inputs: { whenLoading: { classPropertyName: "whenLoading", publicName: "whenLoading", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "presentation" }, properties: { "class": "classes()", "attr.data-slot": "\"pillbox-option-empty\"", "hidden": "!context.emptyVisible()" } }, ngImport: i0, template: `
|
|
214
|
+
@if (context.emptyMessage()) {
|
|
215
|
+
{{ context.emptyMessage() }}
|
|
216
|
+
} @else {
|
|
217
|
+
<ng-content />
|
|
218
|
+
}
|
|
219
|
+
`, isInline: true });
|
|
220
|
+
}
|
|
221
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PillboxOptionEmptyComponent, decorators: [{
|
|
222
|
+
type: Component,
|
|
223
|
+
args: [{
|
|
224
|
+
selector: 'PillboxOptionEmpty',
|
|
225
|
+
host: {
|
|
226
|
+
'[class]': 'classes()',
|
|
227
|
+
'[attr.data-slot]': '"pillbox-option-empty"',
|
|
228
|
+
role: 'presentation',
|
|
229
|
+
'[hidden]': '!context.emptyVisible()',
|
|
230
|
+
},
|
|
231
|
+
template: `
|
|
232
|
+
@if (context.emptyMessage()) {
|
|
233
|
+
{{ context.emptyMessage() }}
|
|
234
|
+
} @else {
|
|
235
|
+
<ng-content />
|
|
236
|
+
}
|
|
237
|
+
`,
|
|
238
|
+
}]
|
|
239
|
+
}], propDecorators: { whenLoading: [{ type: i0.Input, args: [{ isSignal: true, alias: "whenLoading", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
240
|
+
|
|
241
|
+
const pillboxTriggerSizeClasses = {
|
|
242
|
+
default: 'min-h-10 px-3 py-2 text-sm',
|
|
243
|
+
sm: 'min-h-8 px-2.5 py-1.5 text-xs',
|
|
244
|
+
};
|
|
245
|
+
const pillboxPillSizeClasses = {
|
|
246
|
+
default: 'min-h-6 px-2 text-xs',
|
|
247
|
+
sm: 'min-h-5 px-1.5 text-2xs-plus',
|
|
248
|
+
};
|
|
249
|
+
class PillboxComponent extends PillboxContext {
|
|
250
|
+
element = inject(ElementRef);
|
|
251
|
+
document = inject(DOCUMENT);
|
|
252
|
+
destroyRef = inject(DestroyRef);
|
|
253
|
+
id = input(null, /* @ts-ignore */
|
|
254
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
255
|
+
placeholder = input('Choose options...', /* @ts-ignore */
|
|
256
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
257
|
+
searchPlaceholder = input('Search...', /* @ts-ignore */
|
|
258
|
+
...(ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []));
|
|
259
|
+
size = input('default', /* @ts-ignore */
|
|
260
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
261
|
+
variant = input('default', /* @ts-ignore */
|
|
262
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
263
|
+
multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
264
|
+
searchable = input(false, { ...(ngDevMode ? { debugName: "searchable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
265
|
+
filter = input(true, { ...(ngDevMode ? { debugName: "filter" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
266
|
+
clearable = input(true, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
267
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
268
|
+
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
269
|
+
loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
270
|
+
/**
|
|
271
|
+
* How a bound value is matched against an option's value. The default is
|
|
272
|
+
* identity, which never matches objects re-fetched from a server: pass a key
|
|
273
|
+
* comparison there instead.
|
|
274
|
+
*/
|
|
275
|
+
compareWith = input(Object.is, /* @ts-ignore */
|
|
276
|
+
...(ngDevMode ? [{ debugName: "compareWith" }] : /* istanbul ignore next */ []));
|
|
277
|
+
emptyText = input('No options found.', /* @ts-ignore */
|
|
278
|
+
...(ngDevMode ? [{ debugName: "emptyText" }] : /* istanbul ignore next */ []));
|
|
279
|
+
loadingText = input('Loading...', /* @ts-ignore */
|
|
280
|
+
...(ngDevMode ? [{ debugName: "loadingText" }] : /* istanbul ignore next */ []));
|
|
281
|
+
ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
282
|
+
ariaDescribedby = input(null, { ...(ngDevMode ? { debugName: "ariaDescribedby" } : /* istanbul ignore next */ {}), alias: 'aria-describedby' });
|
|
283
|
+
ariaLabelledby = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
|
|
284
|
+
class = input('', /* @ts-ignore */
|
|
285
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
286
|
+
valueChange = output();
|
|
287
|
+
searchChange = output();
|
|
288
|
+
create = output();
|
|
289
|
+
openedChange = output();
|
|
290
|
+
query = signal('', /* @ts-ignore */
|
|
291
|
+
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
292
|
+
openState = signal(false, /* @ts-ignore */
|
|
293
|
+
...(ngDevMode ? [{ debugName: "openState" }] : /* istanbul ignore next */ []));
|
|
294
|
+
selectedValues = signal([], /* @ts-ignore */
|
|
295
|
+
...(ngDevMode ? [{ debugName: "selectedValues" }] : /* istanbul ignore next */ []));
|
|
296
|
+
activeOption = signal(null, /* @ts-ignore */
|
|
297
|
+
...(ngDevMode ? [{ debugName: "activeOption" }] : /* istanbul ignore next */ []));
|
|
298
|
+
disabledFromControl = signal(false, /* @ts-ignore */
|
|
299
|
+
...(ngDevMode ? [{ debugName: "disabledFromControl" }] : /* istanbul ignore next */ []));
|
|
300
|
+
generatedId = injectUniqueId('Pillbox');
|
|
301
|
+
trigger = viewChild.required('trigger', /* @ts-ignore */
|
|
302
|
+
...(ngDevMode ? [{ debugName: "trigger" }] : /* istanbul ignore next */ []));
|
|
303
|
+
inlineSearch = viewChild('inlineSearch', /* @ts-ignore */
|
|
304
|
+
...(ngDevMode ? [{ debugName: "inlineSearch" }] : /* istanbul ignore next */ []));
|
|
305
|
+
panelSearch = viewChild('panelSearch', /* @ts-ignore */
|
|
306
|
+
...(ngDevMode ? [{ debugName: "panelSearch" }] : /* istanbul ignore next */ []));
|
|
307
|
+
options = contentChildren(PillboxOptionComponent, { ...(ngDevMode ? { debugName: "options" } : /* istanbul ignore next */ {}), descendants: true });
|
|
308
|
+
createOptions = contentChildren(PillboxOptionCreateComponent, { ...(ngDevMode ? { debugName: "createOptions" } : /* istanbul ignore next */ {}), descendants: true });
|
|
309
|
+
emptyOptions = contentChildren(PillboxOptionEmptyComponent, { ...(ngDevMode ? { debugName: "emptyOptions" } : /* istanbul ignore next */ {}), descendants: true });
|
|
310
|
+
removeDocumentListener = null;
|
|
311
|
+
onChange = () => { };
|
|
312
|
+
onTouched = () => { };
|
|
313
|
+
panelId = `${this.generatedId}-panel`;
|
|
314
|
+
resolvedId = computed(() => this.id() ?? this.generatedId, /* @ts-ignore */
|
|
315
|
+
...(ngDevMode ? [{ debugName: "resolvedId" }] : /* istanbul ignore next */ []));
|
|
316
|
+
/**
|
|
317
|
+
* Whether the widget renders a text input. When it does, that input is the
|
|
318
|
+
* combobox -- ARIA puts the role on the field the user types into, and a
|
|
319
|
+
* combobox-roled wrapper around it would leave the field itself unannounced
|
|
320
|
+
* and add a second tab stop in front of it.
|
|
321
|
+
*/
|
|
322
|
+
hasInlineSearch = computed(() => this.variant() === 'combobox', /* @ts-ignore */
|
|
323
|
+
...(ngDevMode ? [{ debugName: "hasInlineSearch" }] : /* istanbul ignore next */ []));
|
|
324
|
+
disabledState = computed(() => this.disabled() || this.disabledFromControl(), /* @ts-ignore */
|
|
325
|
+
...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
|
|
326
|
+
classes = computed(() => cn('relative block w-full min-w-0 text-sm text-foreground', this.class()), /* @ts-ignore */
|
|
327
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
328
|
+
triggerClasses = computed(() => cn('flex w-full min-w-0 cursor-default items-center gap-2 rounded-md border border-input bg-background shadow-sm transition-colors', 'focus-within:outline-none focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background', 'hover:bg-accent/20', pillboxTriggerSizeClasses[this.size()], this.invalid() ? 'border-destructive ring-1 ring-destructive' : '', this.disabledState() ? 'pointer-events-none cursor-not-allowed opacity-50' : ''), /* @ts-ignore */
|
|
329
|
+
...(ngDevMode ? [{ debugName: "triggerClasses" }] : /* istanbul ignore next */ []));
|
|
330
|
+
pillClasses = computed(() => cn('inline-flex max-w-full shrink-0 items-center gap-1 rounded-md border border-border bg-muted font-medium text-muted-foreground', pillboxPillSizeClasses[this.size()]), /* @ts-ignore */
|
|
331
|
+
...(ngDevMode ? [{ debugName: "pillClasses" }] : /* istanbul ignore next */ []));
|
|
332
|
+
panelClasses = computed(() => cn('absolute left-0 right-0 z-50 mt-1 overflow-hidden rounded-md border border-border bg-popover text-popover-foreground shadow-md', 'min-w-full'), /* @ts-ignore */
|
|
333
|
+
...(ngDevMode ? [{ debugName: "panelClasses" }] : /* istanbul ignore next */ []));
|
|
334
|
+
selectedItems = computed(() => this.selectedValues().map((value) => {
|
|
335
|
+
const option = this.findOption(value);
|
|
336
|
+
return {
|
|
337
|
+
value,
|
|
338
|
+
label: option?.pillLabel() || String(value),
|
|
339
|
+
template: option?.pillTemplate() ?? null,
|
|
340
|
+
// Track by the option value (selected values are unique) so removing a
|
|
341
|
+
// middle pill doesn't recreate the DOM of every pill after it.
|
|
342
|
+
track: value,
|
|
343
|
+
};
|
|
344
|
+
}), /* @ts-ignore */
|
|
345
|
+
...(ngDevMode ? [{ debugName: "selectedItems" }] : /* istanbul ignore next */ []));
|
|
346
|
+
constructor() {
|
|
347
|
+
super();
|
|
348
|
+
this.destroyRef.onDestroy(() => this.removeOutsideListener());
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Every option the user can reach right now, in the order they are painted.
|
|
352
|
+
*
|
|
353
|
+
* Both kinds of `role="option"` live in the same listbox, so they rove as one
|
|
354
|
+
* list. `contentChildren` only orders within a single type, hence the document
|
|
355
|
+
* comparison: it is the rendered order that a roving model has to follow.
|
|
356
|
+
*/
|
|
357
|
+
rovingOptions = computed(() => {
|
|
358
|
+
const all = [...this.options(), ...this.createOptions()];
|
|
359
|
+
return all
|
|
360
|
+
.filter((option) => option.rovingVisible() && !option.disabled())
|
|
361
|
+
.sort((left, right) => left.nativeElement().compareDocumentPosition(right.nativeElement()) &
|
|
362
|
+
Node.DOCUMENT_POSITION_FOLLOWING
|
|
363
|
+
? -1
|
|
364
|
+
: 1);
|
|
365
|
+
}, /* @ts-ignore */
|
|
366
|
+
...(ngDevMode ? [{ debugName: "rovingOptions" }] : /* istanbul ignore next */ []));
|
|
367
|
+
/**
|
|
368
|
+
* A listbox carries exactly one tab stop, not one per option. The option that
|
|
369
|
+
* last held focus keeps it, falling back to the first reachable option -- so
|
|
370
|
+
* Tab enters the list once, and the arrows do the rest.
|
|
371
|
+
*/
|
|
372
|
+
optionTabIndex(option) {
|
|
373
|
+
const roving = this.rovingOptions();
|
|
374
|
+
if (roving.length === 0) {
|
|
375
|
+
return -1;
|
|
376
|
+
}
|
|
377
|
+
const active = this.activeOption();
|
|
378
|
+
const owner = active && roving.includes(active) ? active : roving[0];
|
|
379
|
+
return owner === option ? 0 : -1;
|
|
380
|
+
}
|
|
381
|
+
activateOption(option) {
|
|
382
|
+
this.activeOption.set(option);
|
|
383
|
+
}
|
|
384
|
+
handleOptionKeydown(option, event) {
|
|
385
|
+
if (event.key === 'Escape') {
|
|
386
|
+
event.preventDefault();
|
|
387
|
+
this.close();
|
|
388
|
+
this.focus();
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
const roving = this.rovingOptions();
|
|
392
|
+
if (roving.length === 0) {
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
const current = roving.indexOf(option);
|
|
396
|
+
const next = this.rovingTarget(event.key, current, roving.length);
|
|
397
|
+
if (next === null) {
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
event.preventDefault();
|
|
401
|
+
const target = roving[next];
|
|
402
|
+
if (!target) {
|
|
403
|
+
return;
|
|
404
|
+
}
|
|
405
|
+
this.activateOption(target);
|
|
406
|
+
target.focus();
|
|
407
|
+
}
|
|
408
|
+
/** Where one navigation key lands, or `null` when the key is not ours. */
|
|
409
|
+
rovingTarget(key, current, length) {
|
|
410
|
+
switch (key) {
|
|
411
|
+
case 'ArrowDown':
|
|
412
|
+
return current < 0 ? 0 : (current + 1) % length;
|
|
413
|
+
case 'ArrowUp':
|
|
414
|
+
return current < 0 ? length - 1 : (current - 1 + length) % length;
|
|
415
|
+
case 'Home':
|
|
416
|
+
return 0;
|
|
417
|
+
case 'End':
|
|
418
|
+
return length - 1;
|
|
419
|
+
default:
|
|
420
|
+
return null;
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
optionVisible(option) {
|
|
424
|
+
if (!this.filter() || !option.filterable()) {
|
|
425
|
+
return true;
|
|
426
|
+
}
|
|
427
|
+
const query = this.query().trim().toLowerCase();
|
|
428
|
+
if (!query) {
|
|
429
|
+
return true;
|
|
430
|
+
}
|
|
431
|
+
return option.textLabel().toLowerCase().includes(query);
|
|
432
|
+
}
|
|
433
|
+
optionSelected(option) {
|
|
434
|
+
return this.hasValue(option.value());
|
|
435
|
+
}
|
|
436
|
+
chooseOption(option, event) {
|
|
437
|
+
event.preventDefault();
|
|
438
|
+
event.stopPropagation();
|
|
439
|
+
if (this.disabledState() || option.disabled()) {
|
|
440
|
+
return;
|
|
441
|
+
}
|
|
442
|
+
if (this.multiple()) {
|
|
443
|
+
const value = option.value();
|
|
444
|
+
this.selectedValues.update((values) => values.some((entry) => this.sameValue(entry, value))
|
|
445
|
+
? values.filter((entry) => !this.sameValue(entry, value))
|
|
446
|
+
: [...values, value]);
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
this.selectedValues.set([option.value()]);
|
|
450
|
+
this.close();
|
|
451
|
+
}
|
|
452
|
+
option.selectedChange.emit(option.value());
|
|
453
|
+
this.query.set('');
|
|
454
|
+
this.emitValue();
|
|
455
|
+
}
|
|
456
|
+
createVisible(option) {
|
|
457
|
+
const query = this.query().trim();
|
|
458
|
+
if (option.disabled() || query.length < option.minLength()) {
|
|
459
|
+
return false;
|
|
460
|
+
}
|
|
461
|
+
return !this.options().some((entry) => entry.textLabel().trim().toLowerCase() === query.toLowerCase());
|
|
462
|
+
}
|
|
463
|
+
chooseCreate(option, event) {
|
|
464
|
+
event.preventDefault();
|
|
465
|
+
event.stopPropagation();
|
|
466
|
+
const query = this.query().trim();
|
|
467
|
+
if (this.disabledState() || option.disabled() || !this.createVisible(option)) {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
option.selected.emit(query);
|
|
471
|
+
this.create.emit(query);
|
|
472
|
+
}
|
|
473
|
+
emptyVisible() {
|
|
474
|
+
return this.options().length > 0 && !this.hasVisibleOptions() && !this.hasVisibleCreateOption();
|
|
475
|
+
}
|
|
476
|
+
emptyMessage() {
|
|
477
|
+
const customEmptyOption = this.emptyOptions()[0];
|
|
478
|
+
if (this.loading()) {
|
|
479
|
+
return customEmptyOption?.whenLoading() || this.loadingText();
|
|
480
|
+
}
|
|
481
|
+
return customEmptyOption ? '' : this.emptyText();
|
|
482
|
+
}
|
|
483
|
+
handleTriggerClick() {
|
|
484
|
+
this.open();
|
|
485
|
+
}
|
|
486
|
+
handleTriggerKeydown(event) {
|
|
487
|
+
if (this.disabledState()) {
|
|
488
|
+
return;
|
|
489
|
+
}
|
|
490
|
+
event.preventDefault();
|
|
491
|
+
this.open();
|
|
492
|
+
}
|
|
493
|
+
handleSearchInput(event) {
|
|
494
|
+
const inputElement = event.target;
|
|
495
|
+
this.query.set(inputElement.value);
|
|
496
|
+
this.searchChange.emit(inputElement.value);
|
|
497
|
+
this.open();
|
|
498
|
+
}
|
|
499
|
+
handleInlineBackspace(event) {
|
|
500
|
+
if (event.target.value.length > 0 || this.selectedValues().length === 0) {
|
|
501
|
+
return;
|
|
502
|
+
}
|
|
503
|
+
event.preventDefault();
|
|
504
|
+
this.selectedValues.update((values) => values.slice(0, -1));
|
|
505
|
+
this.emitValue();
|
|
506
|
+
}
|
|
507
|
+
clearSearch(event) {
|
|
508
|
+
event.preventDefault();
|
|
509
|
+
event.stopPropagation();
|
|
510
|
+
this.query.set('');
|
|
511
|
+
this.searchChange.emit('');
|
|
512
|
+
this.focusSearchInput();
|
|
513
|
+
}
|
|
514
|
+
clear(event) {
|
|
515
|
+
event.preventDefault();
|
|
516
|
+
event.stopPropagation();
|
|
517
|
+
this.selectedValues.set([]);
|
|
518
|
+
this.emitValue();
|
|
519
|
+
}
|
|
520
|
+
removeSelected(value, event) {
|
|
521
|
+
event.preventDefault();
|
|
522
|
+
event.stopPropagation();
|
|
523
|
+
this.selectedValues.update((values) => values.filter((entry) => !this.sameValue(entry, value)));
|
|
524
|
+
this.emitValue();
|
|
525
|
+
}
|
|
526
|
+
open() {
|
|
527
|
+
if (this.disabledState() || this.openState()) {
|
|
528
|
+
return;
|
|
529
|
+
}
|
|
530
|
+
this.openState.set(true);
|
|
531
|
+
this.openedChange.emit(true);
|
|
532
|
+
queueMicrotask(() => {
|
|
533
|
+
this.focusSearchInput();
|
|
534
|
+
this.bindOutsideListener();
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
close() {
|
|
538
|
+
if (!this.openState()) {
|
|
539
|
+
return;
|
|
540
|
+
}
|
|
541
|
+
this.openState.set(false);
|
|
542
|
+
this.openedChange.emit(false);
|
|
543
|
+
this.removeOutsideListener();
|
|
544
|
+
// Forget where the roving tab stop was. A panel that reopens starts at the
|
|
545
|
+
// top, and the remembered option may not even be rendered next time.
|
|
546
|
+
this.activeOption.set(null);
|
|
547
|
+
this.onTouched();
|
|
548
|
+
}
|
|
549
|
+
focus() {
|
|
550
|
+
const inlineSearch = this.inlineSearch()?.nativeElement;
|
|
551
|
+
if (inlineSearch) {
|
|
552
|
+
inlineSearch.focus();
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
this.trigger().nativeElement.focus();
|
|
556
|
+
}
|
|
557
|
+
writeValue(value) {
|
|
558
|
+
if (this.multiple()) {
|
|
559
|
+
this.selectedValues.set(Array.isArray(value) ? value : []);
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
this.selectedValues.set(value === null || value === undefined ? [] : [value]);
|
|
563
|
+
}
|
|
564
|
+
registerOnChange(fn) {
|
|
565
|
+
this.onChange = fn;
|
|
566
|
+
}
|
|
567
|
+
registerOnTouched(fn) {
|
|
568
|
+
this.onTouched = fn;
|
|
569
|
+
}
|
|
570
|
+
setDisabledState(disabled) {
|
|
571
|
+
this.disabledFromControl.set(disabled);
|
|
572
|
+
}
|
|
573
|
+
emitValue() {
|
|
574
|
+
const nextValue = this.multiple()
|
|
575
|
+
? [...this.selectedValues()]
|
|
576
|
+
: (this.selectedValues()[0] ?? null);
|
|
577
|
+
this.onChange(nextValue);
|
|
578
|
+
this.valueChange.emit(nextValue);
|
|
579
|
+
}
|
|
580
|
+
hasValue(value) {
|
|
581
|
+
return this.selectedValues().some((entry) => this.sameValue(entry, value));
|
|
582
|
+
}
|
|
583
|
+
findOption(value) {
|
|
584
|
+
return this.options().find((option) => this.sameValue(option.value(), value));
|
|
585
|
+
}
|
|
586
|
+
hasVisibleOptions() {
|
|
587
|
+
return this.options().some((option) => this.optionVisible(option));
|
|
588
|
+
}
|
|
589
|
+
hasVisibleCreateOption() {
|
|
590
|
+
return this.createOptions().some((option) => this.createVisible(option));
|
|
591
|
+
}
|
|
592
|
+
sameValue(left, right) {
|
|
593
|
+
return this.compareWith()(left, right);
|
|
594
|
+
}
|
|
595
|
+
focusSearchInput() {
|
|
596
|
+
const searchInput = this.variant() === 'combobox'
|
|
597
|
+
? this.inlineSearch()?.nativeElement
|
|
598
|
+
: this.panelSearch()?.nativeElement;
|
|
599
|
+
searchInput?.focus();
|
|
600
|
+
}
|
|
601
|
+
bindOutsideListener() {
|
|
602
|
+
this.removeOutsideListener();
|
|
603
|
+
const listener = (event) => {
|
|
604
|
+
if (!this.element.nativeElement.contains(event.target)) {
|
|
605
|
+
this.close();
|
|
606
|
+
}
|
|
607
|
+
};
|
|
608
|
+
this.document.addEventListener('pointerdown', listener, true);
|
|
609
|
+
this.removeDocumentListener = () => this.document.removeEventListener('pointerdown', listener, true);
|
|
610
|
+
}
|
|
611
|
+
removeOutsideListener() {
|
|
612
|
+
this.removeDocumentListener?.();
|
|
613
|
+
this.removeDocumentListener = null;
|
|
614
|
+
}
|
|
615
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PillboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
616
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: PillboxComponent, isStandalone: true, selector: "Pillbox", inputs: { id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, filter: { classPropertyName: "filter", publicName: "filter", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null }, emptyText: { classPropertyName: "emptyText", publicName: "emptyText", isSignal: true, isRequired: false, transformFunction: null }, loadingText: { classPropertyName: "loadingText", publicName: "loadingText", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { valueChange: "valueChange", searchChange: "searchChange", create: "create", openedChange: "openedChange" }, host: { properties: { "class": "classes()", "attr.data-slot": "\"pillbox\"", "attr.data-open": "openState() ? \"\" : null", "attr.data-size": "size()", "attr.data-variant": "variant()" } }, providers: [
|
|
617
|
+
{ provide: PillboxContext, useExisting: forwardRef(() => PillboxComponent) },
|
|
618
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => PillboxComponent), multi: true },
|
|
619
|
+
], queries: [{ propertyName: "options", predicate: PillboxOptionComponent, descendants: true, isSignal: true }, { propertyName: "createOptions", predicate: PillboxOptionCreateComponent, descendants: true, isSignal: true }, { propertyName: "emptyOptions", predicate: PillboxOptionEmptyComponent, descendants: true, isSignal: true }], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "inlineSearch", first: true, predicate: ["inlineSearch"], descendants: true, isSignal: true }, { propertyName: "panelSearch", first: true, predicate: ["panelSearch"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: `
|
|
620
|
+
<div
|
|
621
|
+
#trigger
|
|
622
|
+
[attr.id]="resolvedId()"
|
|
623
|
+
[attr.role]="hasInlineSearch() ? null : 'combobox'"
|
|
624
|
+
[attr.aria-haspopup]="hasInlineSearch() ? null : 'listbox'"
|
|
625
|
+
[attr.aria-expanded]="hasInlineSearch() ? null : openState()"
|
|
626
|
+
[attr.aria-controls]="!hasInlineSearch() && openState() ? panelId : null"
|
|
627
|
+
[attr.aria-label]="hasInlineSearch() ? null : ariaLabel()"
|
|
628
|
+
[attr.aria-labelledby]="hasInlineSearch() ? null : ariaLabelledby()"
|
|
629
|
+
[attr.aria-describedby]="hasInlineSearch() ? null : ariaDescribedby()"
|
|
630
|
+
[attr.aria-invalid]="!hasInlineSearch() && invalid() ? 'true' : null"
|
|
631
|
+
[attr.aria-disabled]="!hasInlineSearch() && disabledState() ? 'true' : null"
|
|
632
|
+
[attr.tabindex]="hasInlineSearch() ? null : disabledState() ? -1 : 0"
|
|
633
|
+
[class]="triggerClasses()"
|
|
634
|
+
(click)="handleTriggerClick()"
|
|
635
|
+
(keydown.enter)="handleTriggerKeydown($any($event))"
|
|
636
|
+
(keydown.space)="handleTriggerKeydown($any($event))"
|
|
637
|
+
(keydown.arrowDown)="handleTriggerKeydown($any($event))"
|
|
638
|
+
(keydown.escape)="close()"
|
|
639
|
+
>
|
|
640
|
+
<div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5">
|
|
641
|
+
@if (selectedItems().length > 0) {
|
|
642
|
+
@for (item of selectedItems(); track item.track) {
|
|
643
|
+
<span [class]="pillClasses()">
|
|
644
|
+
@if (item.template; as template) {
|
|
645
|
+
<span class="inline-flex min-w-0 max-w-40 items-center gap-1 truncate">
|
|
646
|
+
<ng-container *ngTemplateOutlet="template" />
|
|
647
|
+
</span>
|
|
648
|
+
} @else {
|
|
649
|
+
<span class="max-w-40 truncate">{{ item.label }}</span>
|
|
650
|
+
}
|
|
651
|
+
<button
|
|
652
|
+
type="button"
|
|
653
|
+
class="-mr-1 inline-flex size-4 items-center justify-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
654
|
+
[attr.aria-label]="'Remove ' + item.label"
|
|
655
|
+
[disabled]="disabledState() || null"
|
|
656
|
+
(click)="removeSelected(item.value, $event)"
|
|
657
|
+
>
|
|
658
|
+
<svg
|
|
659
|
+
aria-hidden="true"
|
|
660
|
+
class="size-3"
|
|
661
|
+
viewBox="0 0 24 24"
|
|
662
|
+
fill="none"
|
|
663
|
+
stroke="currentColor"
|
|
664
|
+
stroke-width="2"
|
|
665
|
+
stroke-linecap="round"
|
|
666
|
+
stroke-linejoin="round"
|
|
667
|
+
>
|
|
668
|
+
<path d="M18 6 6 18" />
|
|
669
|
+
<path d="m6 6 12 12" />
|
|
670
|
+
</svg>
|
|
671
|
+
</button>
|
|
672
|
+
</span>
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
@if (variant() === 'combobox') {
|
|
677
|
+
<input
|
|
678
|
+
#inlineSearch
|
|
679
|
+
class="min-w-28 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed"
|
|
680
|
+
role="combobox"
|
|
681
|
+
aria-haspopup="listbox"
|
|
682
|
+
aria-autocomplete="list"
|
|
683
|
+
[attr.aria-expanded]="openState()"
|
|
684
|
+
[attr.aria-controls]="openState() ? panelId : null"
|
|
685
|
+
[attr.aria-describedby]="ariaDescribedby()"
|
|
686
|
+
[attr.aria-invalid]="invalid() ? 'true' : null"
|
|
687
|
+
[attr.aria-label]="ariaLabel() ?? placeholder()"
|
|
688
|
+
[attr.aria-labelledby]="ariaLabelledby()"
|
|
689
|
+
[placeholder]="selectedItems().length === 0 ? placeholder() : ''"
|
|
690
|
+
[value]="query()"
|
|
691
|
+
[disabled]="disabledState() || null"
|
|
692
|
+
(click)="$event.stopPropagation(); open()"
|
|
693
|
+
(input)="handleSearchInput($event)"
|
|
694
|
+
(keydown.backspace)="handleInlineBackspace($any($event))"
|
|
695
|
+
(keydown.escape)="close()"
|
|
696
|
+
/>
|
|
697
|
+
} @else if (selectedItems().length === 0) {
|
|
698
|
+
<span class="truncate text-muted-foreground">{{ placeholder() }}</span>
|
|
699
|
+
}
|
|
700
|
+
</div>
|
|
701
|
+
|
|
702
|
+
@if (clearable() && selectedItems().length > 0 && !disabledState()) {
|
|
703
|
+
<button
|
|
704
|
+
type="button"
|
|
705
|
+
class="inline-flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
706
|
+
aria-label="Clear selected options"
|
|
707
|
+
(click)="clear($event)"
|
|
708
|
+
>
|
|
709
|
+
<svg
|
|
710
|
+
aria-hidden="true"
|
|
711
|
+
class="size-3.5"
|
|
712
|
+
viewBox="0 0 24 24"
|
|
713
|
+
fill="none"
|
|
714
|
+
stroke="currentColor"
|
|
715
|
+
stroke-width="2"
|
|
716
|
+
stroke-linecap="round"
|
|
717
|
+
stroke-linejoin="round"
|
|
718
|
+
>
|
|
719
|
+
<path d="M18 6 6 18" />
|
|
720
|
+
<path d="m6 6 12 12" />
|
|
721
|
+
</svg>
|
|
722
|
+
</button>
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
<svg
|
|
726
|
+
aria-hidden="true"
|
|
727
|
+
class="size-4 shrink-0 text-muted-foreground transition-transform"
|
|
728
|
+
[class.rotate-180]="openState()"
|
|
729
|
+
viewBox="0 0 24 24"
|
|
730
|
+
fill="none"
|
|
731
|
+
stroke="currentColor"
|
|
732
|
+
stroke-width="1.75"
|
|
733
|
+
stroke-linecap="round"
|
|
734
|
+
stroke-linejoin="round"
|
|
735
|
+
>
|
|
736
|
+
<path d="m6 9 6 6 6-6" />
|
|
737
|
+
</svg>
|
|
738
|
+
</div>
|
|
739
|
+
|
|
740
|
+
<div [class]="panelClasses()" [hidden]="!openState()">
|
|
741
|
+
@if (searchable() && variant() !== 'combobox') {
|
|
742
|
+
<div class="border-b border-border p-2">
|
|
743
|
+
<div class="flex items-center gap-2 rounded-md border border-input bg-background px-2">
|
|
744
|
+
<svg
|
|
745
|
+
aria-hidden="true"
|
|
746
|
+
class="size-4 shrink-0 text-muted-foreground"
|
|
747
|
+
viewBox="0 0 24 24"
|
|
748
|
+
fill="none"
|
|
749
|
+
stroke="currentColor"
|
|
750
|
+
stroke-width="1.75"
|
|
751
|
+
stroke-linecap="round"
|
|
752
|
+
stroke-linejoin="round"
|
|
753
|
+
>
|
|
754
|
+
<circle cx="11" cy="11" r="8" />
|
|
755
|
+
<path d="m21 21-4.35-4.35" />
|
|
756
|
+
</svg>
|
|
757
|
+
<input
|
|
758
|
+
#panelSearch
|
|
759
|
+
class="h-9 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
760
|
+
[attr.aria-label]="searchPlaceholder()"
|
|
761
|
+
[placeholder]="searchPlaceholder()"
|
|
762
|
+
[value]="query()"
|
|
763
|
+
(input)="handleSearchInput($event)"
|
|
764
|
+
(keydown.escape)="close()"
|
|
765
|
+
/>
|
|
766
|
+
@if (query().length > 0) {
|
|
767
|
+
<button
|
|
768
|
+
type="button"
|
|
769
|
+
class="inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
770
|
+
aria-label="Clear search"
|
|
771
|
+
(click)="clearSearch($event)"
|
|
772
|
+
>
|
|
773
|
+
<svg
|
|
774
|
+
aria-hidden="true"
|
|
775
|
+
class="size-3.5"
|
|
776
|
+
viewBox="0 0 24 24"
|
|
777
|
+
fill="none"
|
|
778
|
+
stroke="currentColor"
|
|
779
|
+
stroke-width="2"
|
|
780
|
+
stroke-linecap="round"
|
|
781
|
+
stroke-linejoin="round"
|
|
782
|
+
>
|
|
783
|
+
<path d="M18 6 6 18" />
|
|
784
|
+
<path d="m6 6 12 12" />
|
|
785
|
+
</svg>
|
|
786
|
+
</button>
|
|
787
|
+
}
|
|
788
|
+
</div>
|
|
789
|
+
</div>
|
|
790
|
+
}
|
|
791
|
+
|
|
792
|
+
<div [attr.id]="panelId" class="max-h-72 overflow-y-auto p-1" role="listbox">
|
|
793
|
+
<ng-content />
|
|
794
|
+
</div>
|
|
795
|
+
</div>
|
|
796
|
+
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
797
|
+
}
|
|
798
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: PillboxComponent, decorators: [{
|
|
799
|
+
type: Component,
|
|
800
|
+
args: [{
|
|
801
|
+
selector: 'Pillbox',
|
|
802
|
+
imports: [NgTemplateOutlet],
|
|
803
|
+
providers: [
|
|
804
|
+
{ provide: PillboxContext, useExisting: forwardRef(() => PillboxComponent) },
|
|
805
|
+
{ provide: NG_VALUE_ACCESSOR, useExisting: forwardRef(() => PillboxComponent), multi: true },
|
|
806
|
+
],
|
|
807
|
+
host: {
|
|
808
|
+
'[class]': 'classes()',
|
|
809
|
+
'[attr.data-slot]': '"pillbox"',
|
|
810
|
+
'[attr.data-open]': 'openState() ? "" : null',
|
|
811
|
+
'[attr.data-size]': 'size()',
|
|
812
|
+
'[attr.data-variant]': 'variant()',
|
|
813
|
+
},
|
|
814
|
+
template: `
|
|
815
|
+
<div
|
|
816
|
+
#trigger
|
|
817
|
+
[attr.id]="resolvedId()"
|
|
818
|
+
[attr.role]="hasInlineSearch() ? null : 'combobox'"
|
|
819
|
+
[attr.aria-haspopup]="hasInlineSearch() ? null : 'listbox'"
|
|
820
|
+
[attr.aria-expanded]="hasInlineSearch() ? null : openState()"
|
|
821
|
+
[attr.aria-controls]="!hasInlineSearch() && openState() ? panelId : null"
|
|
822
|
+
[attr.aria-label]="hasInlineSearch() ? null : ariaLabel()"
|
|
823
|
+
[attr.aria-labelledby]="hasInlineSearch() ? null : ariaLabelledby()"
|
|
824
|
+
[attr.aria-describedby]="hasInlineSearch() ? null : ariaDescribedby()"
|
|
825
|
+
[attr.aria-invalid]="!hasInlineSearch() && invalid() ? 'true' : null"
|
|
826
|
+
[attr.aria-disabled]="!hasInlineSearch() && disabledState() ? 'true' : null"
|
|
827
|
+
[attr.tabindex]="hasInlineSearch() ? null : disabledState() ? -1 : 0"
|
|
828
|
+
[class]="triggerClasses()"
|
|
829
|
+
(click)="handleTriggerClick()"
|
|
830
|
+
(keydown.enter)="handleTriggerKeydown($any($event))"
|
|
831
|
+
(keydown.space)="handleTriggerKeydown($any($event))"
|
|
832
|
+
(keydown.arrowDown)="handleTriggerKeydown($any($event))"
|
|
833
|
+
(keydown.escape)="close()"
|
|
834
|
+
>
|
|
835
|
+
<div class="flex min-w-0 flex-1 flex-wrap items-center gap-1.5">
|
|
836
|
+
@if (selectedItems().length > 0) {
|
|
837
|
+
@for (item of selectedItems(); track item.track) {
|
|
838
|
+
<span [class]="pillClasses()">
|
|
839
|
+
@if (item.template; as template) {
|
|
840
|
+
<span class="inline-flex min-w-0 max-w-40 items-center gap-1 truncate">
|
|
841
|
+
<ng-container *ngTemplateOutlet="template" />
|
|
842
|
+
</span>
|
|
843
|
+
} @else {
|
|
844
|
+
<span class="max-w-40 truncate">{{ item.label }}</span>
|
|
845
|
+
}
|
|
846
|
+
<button
|
|
847
|
+
type="button"
|
|
848
|
+
class="-mr-1 inline-flex size-4 items-center justify-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
849
|
+
[attr.aria-label]="'Remove ' + item.label"
|
|
850
|
+
[disabled]="disabledState() || null"
|
|
851
|
+
(click)="removeSelected(item.value, $event)"
|
|
852
|
+
>
|
|
853
|
+
<svg
|
|
854
|
+
aria-hidden="true"
|
|
855
|
+
class="size-3"
|
|
856
|
+
viewBox="0 0 24 24"
|
|
857
|
+
fill="none"
|
|
858
|
+
stroke="currentColor"
|
|
859
|
+
stroke-width="2"
|
|
860
|
+
stroke-linecap="round"
|
|
861
|
+
stroke-linejoin="round"
|
|
862
|
+
>
|
|
863
|
+
<path d="M18 6 6 18" />
|
|
864
|
+
<path d="m6 6 12 12" />
|
|
865
|
+
</svg>
|
|
866
|
+
</button>
|
|
867
|
+
</span>
|
|
868
|
+
}
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
@if (variant() === 'combobox') {
|
|
872
|
+
<input
|
|
873
|
+
#inlineSearch
|
|
874
|
+
class="min-w-28 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed"
|
|
875
|
+
role="combobox"
|
|
876
|
+
aria-haspopup="listbox"
|
|
877
|
+
aria-autocomplete="list"
|
|
878
|
+
[attr.aria-expanded]="openState()"
|
|
879
|
+
[attr.aria-controls]="openState() ? panelId : null"
|
|
880
|
+
[attr.aria-describedby]="ariaDescribedby()"
|
|
881
|
+
[attr.aria-invalid]="invalid() ? 'true' : null"
|
|
882
|
+
[attr.aria-label]="ariaLabel() ?? placeholder()"
|
|
883
|
+
[attr.aria-labelledby]="ariaLabelledby()"
|
|
884
|
+
[placeholder]="selectedItems().length === 0 ? placeholder() : ''"
|
|
885
|
+
[value]="query()"
|
|
886
|
+
[disabled]="disabledState() || null"
|
|
887
|
+
(click)="$event.stopPropagation(); open()"
|
|
888
|
+
(input)="handleSearchInput($event)"
|
|
889
|
+
(keydown.backspace)="handleInlineBackspace($any($event))"
|
|
890
|
+
(keydown.escape)="close()"
|
|
891
|
+
/>
|
|
892
|
+
} @else if (selectedItems().length === 0) {
|
|
893
|
+
<span class="truncate text-muted-foreground">{{ placeholder() }}</span>
|
|
894
|
+
}
|
|
895
|
+
</div>
|
|
896
|
+
|
|
897
|
+
@if (clearable() && selectedItems().length > 0 && !disabledState()) {
|
|
898
|
+
<button
|
|
899
|
+
type="button"
|
|
900
|
+
class="inline-flex size-5 shrink-0 items-center justify-center rounded-full text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
|
901
|
+
aria-label="Clear selected options"
|
|
902
|
+
(click)="clear($event)"
|
|
903
|
+
>
|
|
904
|
+
<svg
|
|
905
|
+
aria-hidden="true"
|
|
906
|
+
class="size-3.5"
|
|
907
|
+
viewBox="0 0 24 24"
|
|
908
|
+
fill="none"
|
|
909
|
+
stroke="currentColor"
|
|
910
|
+
stroke-width="2"
|
|
911
|
+
stroke-linecap="round"
|
|
912
|
+
stroke-linejoin="round"
|
|
913
|
+
>
|
|
914
|
+
<path d="M18 6 6 18" />
|
|
915
|
+
<path d="m6 6 12 12" />
|
|
916
|
+
</svg>
|
|
917
|
+
</button>
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
<svg
|
|
921
|
+
aria-hidden="true"
|
|
922
|
+
class="size-4 shrink-0 text-muted-foreground transition-transform"
|
|
923
|
+
[class.rotate-180]="openState()"
|
|
924
|
+
viewBox="0 0 24 24"
|
|
925
|
+
fill="none"
|
|
926
|
+
stroke="currentColor"
|
|
927
|
+
stroke-width="1.75"
|
|
928
|
+
stroke-linecap="round"
|
|
929
|
+
stroke-linejoin="round"
|
|
930
|
+
>
|
|
931
|
+
<path d="m6 9 6 6 6-6" />
|
|
932
|
+
</svg>
|
|
933
|
+
</div>
|
|
934
|
+
|
|
935
|
+
<div [class]="panelClasses()" [hidden]="!openState()">
|
|
936
|
+
@if (searchable() && variant() !== 'combobox') {
|
|
937
|
+
<div class="border-b border-border p-2">
|
|
938
|
+
<div class="flex items-center gap-2 rounded-md border border-input bg-background px-2">
|
|
939
|
+
<svg
|
|
940
|
+
aria-hidden="true"
|
|
941
|
+
class="size-4 shrink-0 text-muted-foreground"
|
|
942
|
+
viewBox="0 0 24 24"
|
|
943
|
+
fill="none"
|
|
944
|
+
stroke="currentColor"
|
|
945
|
+
stroke-width="1.75"
|
|
946
|
+
stroke-linecap="round"
|
|
947
|
+
stroke-linejoin="round"
|
|
948
|
+
>
|
|
949
|
+
<circle cx="11" cy="11" r="8" />
|
|
950
|
+
<path d="m21 21-4.35-4.35" />
|
|
951
|
+
</svg>
|
|
952
|
+
<input
|
|
953
|
+
#panelSearch
|
|
954
|
+
class="h-9 min-w-0 flex-1 bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
|
955
|
+
[attr.aria-label]="searchPlaceholder()"
|
|
956
|
+
[placeholder]="searchPlaceholder()"
|
|
957
|
+
[value]="query()"
|
|
958
|
+
(input)="handleSearchInput($event)"
|
|
959
|
+
(keydown.escape)="close()"
|
|
960
|
+
/>
|
|
961
|
+
@if (query().length > 0) {
|
|
962
|
+
<button
|
|
963
|
+
type="button"
|
|
964
|
+
class="inline-flex size-6 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground"
|
|
965
|
+
aria-label="Clear search"
|
|
966
|
+
(click)="clearSearch($event)"
|
|
967
|
+
>
|
|
968
|
+
<svg
|
|
969
|
+
aria-hidden="true"
|
|
970
|
+
class="size-3.5"
|
|
971
|
+
viewBox="0 0 24 24"
|
|
972
|
+
fill="none"
|
|
973
|
+
stroke="currentColor"
|
|
974
|
+
stroke-width="2"
|
|
975
|
+
stroke-linecap="round"
|
|
976
|
+
stroke-linejoin="round"
|
|
977
|
+
>
|
|
978
|
+
<path d="M18 6 6 18" />
|
|
979
|
+
<path d="m6 6 12 12" />
|
|
980
|
+
</svg>
|
|
981
|
+
</button>
|
|
982
|
+
}
|
|
983
|
+
</div>
|
|
984
|
+
</div>
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
<div [attr.id]="panelId" class="max-h-72 overflow-y-auto p-1" role="listbox">
|
|
988
|
+
<ng-content />
|
|
989
|
+
</div>
|
|
990
|
+
</div>
|
|
991
|
+
`,
|
|
992
|
+
}]
|
|
993
|
+
}], ctorParameters: () => [], propDecorators: { id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], searchable: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchable", required: false }] }], filter: [{ type: i0.Input, args: [{ isSignal: true, alias: "filter", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], compareWith: [{ type: i0.Input, args: [{ isSignal: true, alias: "compareWith", required: false }] }], emptyText: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyText", required: false }] }], loadingText: [{ type: i0.Input, args: [{ isSignal: true, alias: "loadingText", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaDescribedby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-describedby", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], valueChange: [{ type: i0.Output, args: ["valueChange"] }], searchChange: [{ type: i0.Output, args: ["searchChange"] }], create: [{ type: i0.Output, args: ["create"] }], openedChange: [{ type: i0.Output, args: ["openedChange"] }], trigger: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], inlineSearch: [{ type: i0.ViewChild, args: ['inlineSearch', { isSignal: true }] }], panelSearch: [{ type: i0.ViewChild, args: ['panelSearch', { isSignal: true }] }], options: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PillboxOptionComponent), { ...{ descendants: true }, isSignal: true }] }], createOptions: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PillboxOptionCreateComponent), { ...{
|
|
994
|
+
descendants: true,
|
|
995
|
+
}, isSignal: true }] }], emptyOptions: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => PillboxOptionEmptyComponent), { ...{
|
|
996
|
+
descendants: true,
|
|
997
|
+
}, isSignal: true }] }] } });
|
|
4
998
|
|
|
5
999
|
/**
|
|
6
1000
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
1001
|
+
*/
|
|
1002
|
+
|
|
1003
|
+
export { PillboxComponent, PillboxOptionComponent, PillboxOptionCreateComponent, PillboxOptionEmptyComponent, PillboxSelectedDirective };
|