@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,363 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { numberAttribute, input, booleanAttribute, output, computed, Component, inject, ElementRef, signal, forwardRef } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import { cn } from '@ojiepermana/angular/component/utils/core';
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
const COMPOSER_BASE = 'block w-full min-w-0 text-sm text-foreground';
|
|
7
|
+
const COMPOSER_SHELL_BASE = [
|
|
8
|
+
'relative min-w-0 border border-input bg-background shadow-sm',
|
|
9
|
+
'transition-[border-color,box-shadow] focus-within:border-ring focus-within:ring-1 focus-within:ring-ring',
|
|
10
|
+
'aria-[invalid=true]:border-destructive aria-[invalid=true]:focus-within:ring-destructive',
|
|
11
|
+
'data-[disabled=true]:cursor-not-allowed data-[disabled=true]:opacity-50',
|
|
12
|
+
'[&>[data-slot=composer-input]]:min-w-0 [&>[data-slot=composer-input]]:flex-1',
|
|
13
|
+
].join(' ');
|
|
14
|
+
const composerShellVariantClasses = {
|
|
15
|
+
default: 'rounded-xl',
|
|
16
|
+
input: 'rounded-md',
|
|
17
|
+
};
|
|
18
|
+
const COMPOSER_BODY_BASE = '[&>[data-slot=composer-input]]:min-w-0 [&>[data-slot=composer-input]]:flex-1';
|
|
19
|
+
const nullableNumberAttribute = (value) => {
|
|
20
|
+
if (value === null || value === undefined || value === '') {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
return numberAttribute(value);
|
|
24
|
+
};
|
|
25
|
+
class ComposerComponent {
|
|
26
|
+
variant = input('default', /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
28
|
+
inline = input(false, { ...(ngDevMode ? { debugName: "inline" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
29
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
30
|
+
invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
31
|
+
submit = input('cmd-enter', /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "submit" }] : /* istanbul ignore next */ []));
|
|
33
|
+
submitForm = input(true, { ...(ngDevMode ? { debugName: "submitForm" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
34
|
+
class = input('', /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
36
|
+
submitRequested = output();
|
|
37
|
+
classes = computed(() => cn(COMPOSER_BASE, this.class()), /* @ts-ignore */
|
|
38
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
39
|
+
shellClasses = computed(() => cn(COMPOSER_SHELL_BASE, composerShellVariantClasses[this.variant()]), /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "shellClasses" }] : /* istanbul ignore next */ []));
|
|
41
|
+
bodyClasses = computed(() => cn(COMPOSER_BODY_BASE, this.inline()
|
|
42
|
+
? [
|
|
43
|
+
'flex items-end gap-1 px-1 py-1',
|
|
44
|
+
'[&>[data-slot=composer-actions-leading]]:order-10',
|
|
45
|
+
'[&>[data-slot=composer-input]]:order-20',
|
|
46
|
+
'[&>[data-slot=composer-actions-trailing]]:order-30',
|
|
47
|
+
].join(' ')
|
|
48
|
+
: [
|
|
49
|
+
'flex flex-wrap items-end gap-1.5 px-2 py-1.5',
|
|
50
|
+
'[&>[data-slot=composer-input]]:order-10 [&>[data-slot=composer-input]]:basis-full',
|
|
51
|
+
'[&>[data-slot=composer-actions-leading]]:order-20',
|
|
52
|
+
'[&>[data-slot=composer-actions-trailing]]:order-30 [&>[data-slot=composer-actions-trailing]]:ml-auto',
|
|
53
|
+
].join(' ')), /* @ts-ignore */
|
|
54
|
+
...(ngDevMode ? [{ debugName: "bodyClasses" }] : /* istanbul ignore next */ []));
|
|
55
|
+
handleInputKeydown(event) {
|
|
56
|
+
if (this.disabled() || event.key !== 'Enter' || event.defaultPrevented) {
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const shouldSubmit = this.submit() === 'enter'
|
|
60
|
+
? !event.shiftKey && !event.isComposing
|
|
61
|
+
: event.metaKey || event.ctrlKey;
|
|
62
|
+
if (!shouldSubmit) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
this.submitRequested.emit(event);
|
|
67
|
+
if (this.submitForm()) {
|
|
68
|
+
this.requestNearestFormSubmit(event.target);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
requestNearestFormSubmit(target) {
|
|
72
|
+
if (!(target instanceof Element)) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
const form = target.closest('form');
|
|
76
|
+
if (form && typeof form.requestSubmit === 'function') {
|
|
77
|
+
form.requestSubmit();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
81
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: ComposerComponent, isStandalone: true, selector: "Composer", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", 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 }, submit: { classPropertyName: "submit", publicName: "submit", isSignal: true, isRequired: false, transformFunction: null }, submitForm: { classPropertyName: "submitForm", publicName: "submitForm", isSignal: true, isRequired: false, transformFunction: null }, class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { submitRequested: "submitRequested" }, host: { properties: { "class": "classes()", "attr.data-slot": "\"composer\"", "attr.data-variant": "variant()", "attr.data-inline": "inline() ? \"true\" : null", "attr.data-disabled": "disabled() ? \"true\" : null", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.aria-invalid": "invalid() ? \"true\" : null", "attr.inert": "disabled() ? \"\" : null" } }, ngImport: i0, template: `
|
|
82
|
+
<div
|
|
83
|
+
data-slot="composer-shell"
|
|
84
|
+
[class]="shellClasses()"
|
|
85
|
+
[attr.data-disabled]="disabled() ? 'true' : null"
|
|
86
|
+
[attr.aria-invalid]="invalid() ? 'true' : null"
|
|
87
|
+
>
|
|
88
|
+
<ng-content select="ComposerHeader" />
|
|
89
|
+
<div data-slot="composer-body" [class]="bodyClasses()">
|
|
90
|
+
<ng-content select="ComposerActionsLeading" />
|
|
91
|
+
<ng-content select="textarea[ComposerInput], ComposerInput" />
|
|
92
|
+
<ng-content select="ComposerActionsTrailing" />
|
|
93
|
+
</div>
|
|
94
|
+
<ng-content select="ComposerFooter" />
|
|
95
|
+
</div>
|
|
96
|
+
`, isInline: true });
|
|
97
|
+
}
|
|
98
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerComponent, decorators: [{
|
|
99
|
+
type: Component,
|
|
100
|
+
args: [{
|
|
101
|
+
selector: 'Composer',
|
|
102
|
+
host: {
|
|
103
|
+
'[class]': 'classes()',
|
|
104
|
+
'[attr.data-slot]': '"composer"',
|
|
105
|
+
'[attr.data-variant]': 'variant()',
|
|
106
|
+
'[attr.data-inline]': 'inline() ? "true" : null',
|
|
107
|
+
'[attr.data-disabled]': 'disabled() ? "true" : null',
|
|
108
|
+
'[attr.aria-disabled]': 'disabled() ? "true" : null',
|
|
109
|
+
'[attr.aria-invalid]': 'invalid() ? "true" : null',
|
|
110
|
+
'[attr.inert]': 'disabled() ? "" : null',
|
|
111
|
+
},
|
|
112
|
+
template: `
|
|
113
|
+
<div
|
|
114
|
+
data-slot="composer-shell"
|
|
115
|
+
[class]="shellClasses()"
|
|
116
|
+
[attr.data-disabled]="disabled() ? 'true' : null"
|
|
117
|
+
[attr.aria-invalid]="invalid() ? 'true' : null"
|
|
118
|
+
>
|
|
119
|
+
<ng-content select="ComposerHeader" />
|
|
120
|
+
<div data-slot="composer-body" [class]="bodyClasses()">
|
|
121
|
+
<ng-content select="ComposerActionsLeading" />
|
|
122
|
+
<ng-content select="textarea[ComposerInput], ComposerInput" />
|
|
123
|
+
<ng-content select="ComposerActionsTrailing" />
|
|
124
|
+
</div>
|
|
125
|
+
<ng-content select="ComposerFooter" />
|
|
126
|
+
</div>
|
|
127
|
+
`,
|
|
128
|
+
}]
|
|
129
|
+
}], propDecorators: { variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], submit: [{ type: i0.Input, args: [{ isSignal: true, alias: "submit", required: false }] }], submitForm: [{ type: i0.Input, args: [{ isSignal: true, alias: "submitForm", required: false }] }], class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], submitRequested: [{ type: i0.Output, args: ["submitRequested"] }] } });
|
|
130
|
+
class ComposerHeaderComponent {
|
|
131
|
+
class = input('', /* @ts-ignore */
|
|
132
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
133
|
+
classes = computed(() => cn('flex min-w-0 flex-wrap gap-2 border-b border-[hsl(var(--border)/var(--opacity-70))] px-2.5 py-2', this.class()), /* @ts-ignore */
|
|
134
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
135
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerHeaderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
136
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: ComposerHeaderComponent, isStandalone: true, selector: "ComposerHeader", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.data-slot": "\"composer-header\"" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
137
|
+
}
|
|
138
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerHeaderComponent, decorators: [{
|
|
139
|
+
type: Component,
|
|
140
|
+
args: [{
|
|
141
|
+
selector: 'ComposerHeader',
|
|
142
|
+
host: {
|
|
143
|
+
'[class]': 'classes()',
|
|
144
|
+
'[attr.data-slot]': '"composer-header"',
|
|
145
|
+
},
|
|
146
|
+
template: `<ng-content />`,
|
|
147
|
+
}]
|
|
148
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
149
|
+
class ComposerFooterComponent {
|
|
150
|
+
class = input('', /* @ts-ignore */
|
|
151
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
152
|
+
classes = computed(() => cn('border-t border-[hsl(var(--border)/var(--opacity-70))] px-2.5 py-1.5 text-xs leading-5 text-muted-foreground', this.class()), /* @ts-ignore */
|
|
153
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
154
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerFooterComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
155
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: ComposerFooterComponent, isStandalone: true, selector: "ComposerFooter", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.data-slot": "\"composer-footer\"" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
156
|
+
}
|
|
157
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerFooterComponent, decorators: [{
|
|
158
|
+
type: Component,
|
|
159
|
+
args: [{
|
|
160
|
+
selector: 'ComposerFooter',
|
|
161
|
+
host: {
|
|
162
|
+
'[class]': 'classes()',
|
|
163
|
+
'[attr.data-slot]': '"composer-footer"',
|
|
164
|
+
},
|
|
165
|
+
template: `<ng-content />`,
|
|
166
|
+
}]
|
|
167
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
168
|
+
class ComposerActionsLeadingComponent {
|
|
169
|
+
class = input('', /* @ts-ignore */
|
|
170
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
171
|
+
classes = computed(() => cn('flex min-h-control-sm shrink-0 items-center gap-1', this.class()), /* @ts-ignore */
|
|
172
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
173
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerActionsLeadingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
174
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: ComposerActionsLeadingComponent, isStandalone: true, selector: "ComposerActionsLeading", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.data-slot": "\"composer-actions-leading\"" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
175
|
+
}
|
|
176
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerActionsLeadingComponent, decorators: [{
|
|
177
|
+
type: Component,
|
|
178
|
+
args: [{
|
|
179
|
+
selector: 'ComposerActionsLeading',
|
|
180
|
+
host: {
|
|
181
|
+
'[class]': 'classes()',
|
|
182
|
+
'[attr.data-slot]': '"composer-actions-leading"',
|
|
183
|
+
},
|
|
184
|
+
template: `<ng-content />`,
|
|
185
|
+
}]
|
|
186
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
187
|
+
class ComposerActionsTrailingComponent {
|
|
188
|
+
class = input('', /* @ts-ignore */
|
|
189
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
190
|
+
classes = computed(() => cn('flex min-h-control-sm shrink-0 items-center justify-end gap-1', this.class()), /* @ts-ignore */
|
|
191
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
192
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerActionsTrailingComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
193
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: ComposerActionsTrailingComponent, isStandalone: true, selector: "ComposerActionsTrailing", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()", "attr.data-slot": "\"composer-actions-trailing\"" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
194
|
+
}
|
|
195
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerActionsTrailingComponent, decorators: [{
|
|
196
|
+
type: Component,
|
|
197
|
+
args: [{
|
|
198
|
+
selector: 'ComposerActionsTrailing',
|
|
199
|
+
host: {
|
|
200
|
+
'[class]': 'classes()',
|
|
201
|
+
'[attr.data-slot]': '"composer-actions-trailing"',
|
|
202
|
+
},
|
|
203
|
+
template: `<ng-content />`,
|
|
204
|
+
}]
|
|
205
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
206
|
+
class ComposerInputComponent {
|
|
207
|
+
composer = inject(ComposerComponent, { optional: true });
|
|
208
|
+
disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
|
|
209
|
+
invalidInput = input(false, { ...(ngDevMode ? { debugName: "invalidInput" } : /* istanbul ignore next */ {}), alias: 'aria-invalid', transform: booleanAttribute });
|
|
210
|
+
class = input('', /* @ts-ignore */
|
|
211
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
212
|
+
disabled = computed(() => this.disabledInput() || this.composer?.disabled() === true, /* @ts-ignore */
|
|
213
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
214
|
+
invalid = computed(() => this.invalidInput() || this.composer?.invalid() === true, /* @ts-ignore */
|
|
215
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
216
|
+
classes = computed(() => cn('min-h-control-10 w-full rounded-sm bg-transparent px-2 py-2 text-sm leading-6 outline-none', 'data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50', this.class()), /* @ts-ignore */
|
|
217
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
218
|
+
// The key was typed INTO this slot, so this slot's disabled state is the one
|
|
219
|
+
// that decides. Asking the parent `Composer` alone let a disabled slot inside
|
|
220
|
+
// an enabled composer submit anyway, which is the very thing its disabled
|
|
221
|
+
// state promises not to do. `disabled()` here already folds in the parent, so
|
|
222
|
+
// both ways of turning the slot off are covered by one check.
|
|
223
|
+
handleKeydown(event) {
|
|
224
|
+
if (this.disabled()) {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
this.composer?.handleInputKeydown(event);
|
|
228
|
+
}
|
|
229
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerInputComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
230
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: ComposerInputComponent, isStandalone: true, selector: "ComposerInput", inputs: { 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 } }, host: { listeners: { "keydown": "handleKeydown($event)" }, properties: { "class": "classes()", "attr.data-slot": "\"composer-input\"", "attr.data-disabled": "disabled() ? \"true\" : null", "attr.aria-disabled": "disabled() ? \"true\" : null", "attr.aria-invalid": "invalid() ? \"true\" : null" } }, ngImport: i0, template: `<ng-content />`, isInline: true });
|
|
231
|
+
}
|
|
232
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerInputComponent, decorators: [{
|
|
233
|
+
type: Component,
|
|
234
|
+
args: [{
|
|
235
|
+
selector: 'ComposerInput',
|
|
236
|
+
host: {
|
|
237
|
+
'[class]': 'classes()',
|
|
238
|
+
'[attr.data-slot]': '"composer-input"',
|
|
239
|
+
'[attr.data-disabled]': 'disabled() ? "true" : null',
|
|
240
|
+
'[attr.aria-disabled]': 'disabled() ? "true" : null',
|
|
241
|
+
'[attr.aria-invalid]': 'invalid() ? "true" : null',
|
|
242
|
+
'(keydown)': 'handleKeydown($event)',
|
|
243
|
+
},
|
|
244
|
+
template: `<ng-content />`,
|
|
245
|
+
}]
|
|
246
|
+
}], propDecorators: { 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 }] }] } });
|
|
247
|
+
class ComposerTextareaComponent {
|
|
248
|
+
el = inject(ElementRef);
|
|
249
|
+
composer = inject(ComposerComponent, { optional: true });
|
|
250
|
+
rows = input(2, { ...(ngDevMode ? { debugName: "rows" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
251
|
+
maxRows = input(null, { ...(ngDevMode ? { debugName: "maxRows" } : /* istanbul ignore next */ {}), transform: nullableNumberAttribute });
|
|
252
|
+
disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled', transform: booleanAttribute });
|
|
253
|
+
invalidInput = input(false, { ...(ngDevMode ? { debugName: "invalidInput" } : /* istanbul ignore next */ {}), alias: 'aria-invalid', transform: booleanAttribute });
|
|
254
|
+
class = input('', /* @ts-ignore */
|
|
255
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
256
|
+
disabledState = signal(false, /* @ts-ignore */
|
|
257
|
+
...(ngDevMode ? [{ debugName: "disabledState" }] : /* istanbul ignore next */ []));
|
|
258
|
+
disabled = computed(() => this.disabledInput() || this.disabledState() || this.composer?.disabled() === true, /* @ts-ignore */
|
|
259
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
260
|
+
invalid = computed(() => this.invalidInput() || this.composer?.invalid() === true, /* @ts-ignore */
|
|
261
|
+
...(ngDevMode ? [{ debugName: "invalid" }] : /* istanbul ignore next */ []));
|
|
262
|
+
classes = computed(() => cn([
|
|
263
|
+
'max-h-none min-h-control-10 w-full resize-none bg-transparent px-2 py-2 text-sm leading-6 text-foreground shadow-none outline-none',
|
|
264
|
+
'placeholder:text-muted-foreground',
|
|
265
|
+
'disabled:cursor-not-allowed disabled:opacity-50',
|
|
266
|
+
].join(' '), this.class()), /* @ts-ignore */
|
|
267
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
268
|
+
onChange = () => { };
|
|
269
|
+
onTouched = () => { };
|
|
270
|
+
ngAfterViewInit() {
|
|
271
|
+
queueMicrotask(() => this.resizeToContent());
|
|
272
|
+
}
|
|
273
|
+
writeValue(value) {
|
|
274
|
+
this.el.nativeElement.value = value ?? '';
|
|
275
|
+
queueMicrotask(() => this.resizeToContent());
|
|
276
|
+
}
|
|
277
|
+
registerOnChange(fn) {
|
|
278
|
+
this.onChange = fn;
|
|
279
|
+
}
|
|
280
|
+
registerOnTouched(fn) {
|
|
281
|
+
this.onTouched = fn;
|
|
282
|
+
}
|
|
283
|
+
setDisabledState(isDisabled) {
|
|
284
|
+
this.disabledState.set(isDisabled);
|
|
285
|
+
}
|
|
286
|
+
resizeToContent() {
|
|
287
|
+
const textarea = this.el.nativeElement;
|
|
288
|
+
textarea.style.height = 'auto';
|
|
289
|
+
const maxRows = this.maxRows();
|
|
290
|
+
if (!maxRows) {
|
|
291
|
+
textarea.style.height = `${textarea.scrollHeight}px`;
|
|
292
|
+
textarea.style.overflowY = 'hidden';
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
const lineHeight = this.getLineHeight(textarea);
|
|
296
|
+
const maxHeight = lineHeight * Math.max(maxRows, this.rows());
|
|
297
|
+
const nextHeight = Math.min(textarea.scrollHeight, maxHeight);
|
|
298
|
+
textarea.style.height = `${nextHeight}px`;
|
|
299
|
+
textarea.style.overflowY = textarea.scrollHeight > maxHeight ? 'auto' : 'hidden';
|
|
300
|
+
}
|
|
301
|
+
focus() {
|
|
302
|
+
this.el.nativeElement.focus();
|
|
303
|
+
}
|
|
304
|
+
handleInput() {
|
|
305
|
+
this.resizeToContent();
|
|
306
|
+
this.onChange(this.el.nativeElement.value);
|
|
307
|
+
}
|
|
308
|
+
handleBlur() {
|
|
309
|
+
this.onTouched();
|
|
310
|
+
}
|
|
311
|
+
// Same rule as the slot part: this textarea's own disabled state decides. A
|
|
312
|
+
// native `disabled` textarea does not fire keydown in a browser, but one
|
|
313
|
+
// disabled through a reactive control is reached by anything that dispatches
|
|
314
|
+
// the event directly, and the guard costs nothing.
|
|
315
|
+
handleKeydown(event) {
|
|
316
|
+
if (this.disabled()) {
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
this.composer?.handleInputKeydown(event);
|
|
320
|
+
}
|
|
321
|
+
getLineHeight(textarea) {
|
|
322
|
+
const lineHeight = Number.parseFloat(getComputedStyle(textarea).lineHeight);
|
|
323
|
+
return Number.isFinite(lineHeight) ? lineHeight : 24;
|
|
324
|
+
}
|
|
325
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerTextareaComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
326
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: ComposerTextareaComponent, isStandalone: true, selector: "textarea[ComposerInput]", inputs: { rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, maxRows: { classPropertyName: "maxRows", publicName: "maxRows", 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 } }, host: { listeners: { "input": "handleInput()", "blur": "handleBlur()", "keydown": "handleKeydown($event)" }, properties: { "class": "classes()", "attr.data-slot": "\"composer-input\"", "attr.rows": "rows()", "attr.disabled": "disabled() ? \"\" : null", "attr.aria-invalid": "invalid() ? \"true\" : null" } }, providers: [
|
|
327
|
+
{
|
|
328
|
+
provide: NG_VALUE_ACCESSOR,
|
|
329
|
+
useExisting: forwardRef(() => ComposerTextareaComponent),
|
|
330
|
+
multi: true,
|
|
331
|
+
},
|
|
332
|
+
], ngImport: i0, template: '', isInline: true });
|
|
333
|
+
}
|
|
334
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ComposerTextareaComponent, decorators: [{
|
|
335
|
+
type: Component,
|
|
336
|
+
args: [{
|
|
337
|
+
selector: 'textarea[ComposerInput]',
|
|
338
|
+
providers: [
|
|
339
|
+
{
|
|
340
|
+
provide: NG_VALUE_ACCESSOR,
|
|
341
|
+
useExisting: forwardRef(() => ComposerTextareaComponent),
|
|
342
|
+
multi: true,
|
|
343
|
+
},
|
|
344
|
+
],
|
|
345
|
+
host: {
|
|
346
|
+
'[class]': 'classes()',
|
|
347
|
+
'[attr.data-slot]': '"composer-input"',
|
|
348
|
+
'[attr.rows]': 'rows()',
|
|
349
|
+
'[attr.disabled]': 'disabled() ? "" : null',
|
|
350
|
+
'[attr.aria-invalid]': 'invalid() ? "true" : null',
|
|
351
|
+
'(input)': 'handleInput()',
|
|
352
|
+
'(blur)': 'handleBlur()',
|
|
353
|
+
'(keydown)': 'handleKeydown($event)',
|
|
354
|
+
},
|
|
355
|
+
template: '',
|
|
356
|
+
}]
|
|
357
|
+
}], propDecorators: { rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], maxRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxRows", 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 }] }] } });
|
|
4
358
|
|
|
5
359
|
/**
|
|
6
360
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
361
|
+
*/
|
|
362
|
+
|
|
363
|
+
export { ComposerActionsLeadingComponent, ComposerActionsTrailingComponent, ComposerComponent, ComposerFooterComponent, ComposerHeaderComponent, ComposerInputComponent, ComposerTextareaComponent };
|
|
@@ -1,7 +1,162 @@
|
|
|
1
|
-
|
|
1
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
2
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
3
|
+
import * as i0 from '@angular/core';
|
|
4
|
+
import { inject, ViewContainerRef, ElementRef, DestroyRef, Injector, input, output, signal, Directive } from '@angular/core';
|
|
5
|
+
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
6
|
+
import { filter } from 'rxjs/operators';
|
|
7
|
+
import { injectUniqueId } from '@ojiepermana/angular/component/utils/core';
|
|
8
|
+
import { overlayDismissals } from '@ojiepermana/angular/component/utils/overlay';
|
|
9
|
+
import { MENU_OVERLAY } from '@ojiepermana/angular/component/dropdown-menu';
|
|
2
10
|
|
|
3
|
-
|
|
11
|
+
/** `MouseEvent.button` for the secondary (right) button. */
|
|
12
|
+
const SECONDARY_BUTTON = 2;
|
|
13
|
+
/**
|
|
14
|
+
* Opens a menu anchored to the cursor when the host fires `contextmenu`.
|
|
15
|
+
* Reuses `<ng-template MenuContent>` from the dropdown-menu entry.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* <div [ContextMenuTrigger]="menu" class="p-12 border">Right-click me</div>
|
|
19
|
+
* <ng-template MenuContent #menu>
|
|
20
|
+
* <MenuSurface>
|
|
21
|
+
* <button MenuItem>Copy</button>
|
|
22
|
+
* <button MenuItem>Paste</button>
|
|
23
|
+
* </MenuSurface>
|
|
24
|
+
* </ng-template>
|
|
25
|
+
*/
|
|
26
|
+
class ContextMenuTriggerDirective {
|
|
27
|
+
overlay = inject(Overlay);
|
|
28
|
+
vcr = inject(ViewContainerRef);
|
|
29
|
+
el = inject(ElementRef);
|
|
30
|
+
destroyRef = inject(DestroyRef);
|
|
31
|
+
injector = inject(Injector);
|
|
32
|
+
ContextMenuTrigger = input.required(/* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "ContextMenuTrigger" }] : /* istanbul ignore next */ []));
|
|
34
|
+
disabled = input(false, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
36
|
+
/** Ties `aria-controls` here to `aria-labelledby` on the surface. */
|
|
37
|
+
triggerId = this.el.nativeElement.id || injectUniqueId('ContextMenuTrigger');
|
|
38
|
+
surfaceId = injectUniqueId('MenuSurface');
|
|
39
|
+
openedChange = output();
|
|
40
|
+
overlayRef = null;
|
|
41
|
+
/** Set while the right click that opened the menu is still waiting on its `auxclick`. */
|
|
42
|
+
pendingGestureRelease = false;
|
|
43
|
+
isOpen = signal(false, /* @ts-ignore */
|
|
44
|
+
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
45
|
+
constructor() {
|
|
46
|
+
this.destroyRef.onDestroy(() => this.close(false));
|
|
47
|
+
}
|
|
48
|
+
onContextMenu(event) {
|
|
49
|
+
if (this.disabled())
|
|
50
|
+
return;
|
|
51
|
+
event.preventDefault();
|
|
52
|
+
this.close();
|
|
53
|
+
this.openAt(event.clientX, event.clientY);
|
|
54
|
+
// `contextmenu` arrives at mouse *down*; this press has an `auxclick` still
|
|
55
|
+
// to come at mouse *up*. Arm the guard after `openAt`, which disarms it.
|
|
56
|
+
this.pendingGestureRelease = true;
|
|
57
|
+
}
|
|
58
|
+
onKeyDown(event) {
|
|
59
|
+
const isContextMenuKey = event.key === 'ContextMenu' || (event.shiftKey && event.key === 'F10');
|
|
60
|
+
if (!isContextMenuKey || this.disabled()) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
event.preventDefault();
|
|
64
|
+
const rect = this.el.nativeElement.getBoundingClientRect();
|
|
65
|
+
this.close();
|
|
66
|
+
this.openAt(rect.left + rect.width / 2, rect.top + rect.height / 2);
|
|
67
|
+
}
|
|
68
|
+
openAt(x, y) {
|
|
69
|
+
this.pendingGestureRelease = false;
|
|
70
|
+
this.overlayRef = this.overlay.create({
|
|
71
|
+
positionStrategy: this.overlay
|
|
72
|
+
.position()
|
|
73
|
+
.flexibleConnectedTo({ x, y })
|
|
74
|
+
.withPositions([
|
|
75
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top' },
|
|
76
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom' },
|
|
77
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top' },
|
|
78
|
+
{ originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom' },
|
|
79
|
+
]),
|
|
80
|
+
scrollStrategy: this.overlay.scrollStrategies.close(),
|
|
81
|
+
hasBackdrop: false,
|
|
82
|
+
panelClass: 'menu-panel',
|
|
83
|
+
});
|
|
84
|
+
// The surface is rendered from a template declared in the CONSUMER's
|
|
85
|
+
// component, so its injector chain never reaches this directive. Handing it
|
|
86
|
+
// a controller is what makes it a real menu rather than a floating panel:
|
|
87
|
+
// without one it cannot name itself, cannot close after a pick, and -- the
|
|
88
|
+
// reason the shared conformance suite caught it -- a nested `[MenuTrigger]`
|
|
89
|
+
// inside it does not know it is a submenu, so ArrowLeft leaves the user
|
|
90
|
+
// stuck one level in. `MenuTrigger` has always done this; this surface was
|
|
91
|
+
// simply never wired the same way.
|
|
92
|
+
const controller = {
|
|
93
|
+
surfaceId: this.surfaceId,
|
|
94
|
+
triggerId: this.triggerId,
|
|
95
|
+
// A context menu is opened by a pointer or a key on its own host, never
|
|
96
|
+
// from an item of another menu, so it is always a root menu.
|
|
97
|
+
isSubmenu: false,
|
|
98
|
+
close: () => this.close(),
|
|
99
|
+
closeAfterSelect: () => this.close(),
|
|
100
|
+
};
|
|
101
|
+
const portal = new TemplatePortal(this.ContextMenuTrigger().template, this.vcr, undefined, Injector.create({
|
|
102
|
+
parent: this.injector,
|
|
103
|
+
providers: [{ provide: MENU_OVERLAY, useValue: controller }],
|
|
104
|
+
}));
|
|
105
|
+
this.overlayRef.attach(portal);
|
|
106
|
+
overlayDismissals(this.overlayRef)
|
|
107
|
+
.pipe(filter((event) => !this.isOpeningGestureRelease(event)), takeUntilDestroyed(this.destroyRef))
|
|
108
|
+
.subscribe(() => this.close());
|
|
109
|
+
this.isOpen.set(true);
|
|
110
|
+
this.openedChange.emit(true);
|
|
111
|
+
}
|
|
112
|
+
close(emitOpenedChange = true) {
|
|
113
|
+
if (!this.overlayRef)
|
|
114
|
+
return;
|
|
115
|
+
const overlayRef = this.overlayRef;
|
|
116
|
+
this.overlayRef = null;
|
|
117
|
+
this.isOpen.set(false);
|
|
118
|
+
overlayRef.dispose();
|
|
119
|
+
if (emitOpenedChange) {
|
|
120
|
+
this.openedChange.emit(false);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* A right click delivers `contextmenu` at mouse down and a trailing `auxclick`
|
|
125
|
+
* at mouse up. The overlay is created on the first, so the CDK outside-pointer
|
|
126
|
+
* dispatcher hands the second to the menu that very press just opened and it
|
|
127
|
+
* dismisses itself before the user releases the button.
|
|
128
|
+
*
|
|
129
|
+
* Swallow that one release, and only that one: the guard is armed by
|
|
130
|
+
* `onContextMenu` alone (never by the Shift+F10 path) and is spent on the next
|
|
131
|
+
* dismissal whatever it is, so a left click, a middle click, or a later right
|
|
132
|
+
* click on the trigger still closes the menu.
|
|
133
|
+
*/
|
|
134
|
+
isOpeningGestureRelease(event) {
|
|
135
|
+
if (!this.pendingGestureRelease) {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
this.pendingGestureRelease = false;
|
|
139
|
+
return (event instanceof MouseEvent && event.type === 'auxclick' && event.button === SECONDARY_BUTTON);
|
|
140
|
+
}
|
|
141
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ContextMenuTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
142
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.1.4", type: ContextMenuTriggerDirective, isStandalone: true, selector: "[ContextMenuTrigger]", inputs: { ContextMenuTrigger: { classPropertyName: "ContextMenuTrigger", publicName: "ContextMenuTrigger", isSignal: true, isRequired: true, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { openedChange: "openedChange" }, host: { listeners: { "contextmenu": "onContextMenu($event)", "keydown": "onKeyDown($event)" }, properties: { "attr.id": "triggerId", "attr.aria-controls": "isOpen() ? surfaceId : null" } }, exportAs: ["ContextMenuTrigger"], ngImport: i0 });
|
|
143
|
+
}
|
|
144
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: ContextMenuTriggerDirective, decorators: [{
|
|
145
|
+
type: Directive,
|
|
146
|
+
args: [{
|
|
147
|
+
selector: '[ContextMenuTrigger]',
|
|
148
|
+
exportAs: 'ContextMenuTrigger',
|
|
149
|
+
host: {
|
|
150
|
+
'[attr.id]': 'triggerId',
|
|
151
|
+
'[attr.aria-controls]': 'isOpen() ? surfaceId : null',
|
|
152
|
+
'(contextmenu)': 'onContextMenu($event)',
|
|
153
|
+
'(keydown)': 'onKeyDown($event)',
|
|
154
|
+
},
|
|
155
|
+
}]
|
|
156
|
+
}], ctorParameters: () => [], propDecorators: { ContextMenuTrigger: [{ type: i0.Input, args: [{ isSignal: true, alias: "ContextMenuTrigger", required: true }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], openedChange: [{ type: i0.Output, args: ["openedChange"] }] } });
|
|
4
157
|
|
|
5
158
|
/**
|
|
6
159
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
export { ContextMenuTriggerDirective };
|