@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,460 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, input, computed, Component, DestroyRef, viewChild, numberAttribute, booleanAttribute, output, signal, effect, untracked } from '@angular/core';
|
|
3
|
+
import { cn } from '@ojiepermana/angular/component/utils/core';
|
|
4
|
+
import { DOCUMENT } from '@angular/common';
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Styled native range input. Works with `ngModel` / `FormControl` via
|
|
8
|
+
* Angular's built-in `RangeValueAccessor`. Keyboard + ARIA handled by the browser.
|
|
9
|
+
*/
|
|
10
|
+
class SliderComponent {
|
|
11
|
+
el = inject(ElementRef);
|
|
12
|
+
class = input('', /* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
14
|
+
classes = computed(() => cn('Slider relative w-full appearance-none bg-transparent', 'focus-visible:outline-none', 'disabled:pointer-events-none disabled:opacity-50', this.class()), /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
16
|
+
focus() {
|
|
17
|
+
this.el.nativeElement.focus();
|
|
18
|
+
}
|
|
19
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SliderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
20
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: SliderComponent, isStandalone: true, selector: "input[type=range][Slider]", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: '', isInline: true, styles: [":host.Slider{height:calc(var(--spacing-base) * 5);cursor:pointer}:host.Slider::-webkit-slider-runnable-track{height:calc(var(--spacing-base) * 2);border-radius:var(--radius-lg);background:hsl(var(--secondary))}:host.Slider::-moz-range-track{height:calc(var(--spacing-base) * 2);border-radius:var(--radius-lg);background:hsl(var(--secondary))}:host.Slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:calc(var(--spacing-base) * -1);width:calc(var(--spacing-base) * 4);height:calc(var(--spacing-base) * 4);border-radius:var(--radius-lg);background:hsl(var(--background));border:var(--border-width) solid hsl(var(--primary));transition:box-shadow .15s cubic-bezier(.4,0,.2,1)}:host.Slider::-moz-range-thumb{width:calc(var(--spacing-base) * 4);height:calc(var(--spacing-base) * 4);border-radius:var(--radius-lg);background:hsl(var(--background));border:var(--border-width) solid hsl(var(--primary));transition:box-shadow .15s cubic-bezier(.4,0,.2,1)}:host.Slider:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host.Slider:focus-visible::-moz-range-thumb{box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host.Slider:disabled::-webkit-slider-thumb{cursor:not-allowed}:host.Slider:disabled::-moz-range-thumb{cursor:not-allowed}\n"] });
|
|
21
|
+
}
|
|
22
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SliderComponent, decorators: [{
|
|
23
|
+
type: Component,
|
|
24
|
+
args: [{ selector: 'input[type=range][Slider]', host: { '[class]': 'classes()' }, template: '', styles: [":host.Slider{height:calc(var(--spacing-base) * 5);cursor:pointer}:host.Slider::-webkit-slider-runnable-track{height:calc(var(--spacing-base) * 2);border-radius:var(--radius-lg);background:hsl(var(--secondary))}:host.Slider::-moz-range-track{height:calc(var(--spacing-base) * 2);border-radius:var(--radius-lg);background:hsl(var(--secondary))}:host.Slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;margin-top:calc(var(--spacing-base) * -1);width:calc(var(--spacing-base) * 4);height:calc(var(--spacing-base) * 4);border-radius:var(--radius-lg);background:hsl(var(--background));border:var(--border-width) solid hsl(var(--primary));transition:box-shadow .15s cubic-bezier(.4,0,.2,1)}:host.Slider::-moz-range-thumb{width:calc(var(--spacing-base) * 4);height:calc(var(--spacing-base) * 4);border-radius:var(--radius-lg);background:hsl(var(--background));border:var(--border-width) solid hsl(var(--primary));transition:box-shadow .15s cubic-bezier(.4,0,.2,1)}:host.Slider:focus-visible::-webkit-slider-thumb{box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host.Slider:focus-visible::-moz-range-thumb{box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host.Slider:disabled::-webkit-slider-thumb{cursor:not-allowed}:host.Slider:disabled::-moz-range-thumb{cursor:not-allowed}\n"] }]
|
|
25
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }] } });
|
|
26
|
+
|
|
27
|
+
class SliderRootComponent {
|
|
28
|
+
host = inject(ElementRef);
|
|
29
|
+
document = inject(DOCUMENT);
|
|
30
|
+
destroyRef = inject(DestroyRef);
|
|
31
|
+
track = viewChild.required('track', /* @ts-ignore */
|
|
32
|
+
...(ngDevMode ? [{ debugName: "track" }] : /* istanbul ignore next */ []));
|
|
33
|
+
value = input([0], /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
35
|
+
min = input(0, { ...(ngDevMode ? { debugName: "min" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
36
|
+
max = input(100, { ...(ngDevMode ? { debugName: "max" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
37
|
+
step = input(1, { ...(ngDevMode ? { debugName: "step" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
38
|
+
minStepsBetweenThumbs = input(0, { ...(ngDevMode ? { debugName: "minStepsBetweenThumbs" } : /* istanbul ignore next */ {}), transform: numberAttribute });
|
|
39
|
+
orientation = input('horizontal', /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
41
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
42
|
+
thumbLabels = input(null, /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "thumbLabels" }] : /* istanbul ignore next */ []));
|
|
44
|
+
ariaLabel = input(null, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
45
|
+
ariaDescribedby = input(null, { ...(ngDevMode ? { debugName: "ariaDescribedby" } : /* istanbul ignore next */ {}), alias: 'aria-describedby' });
|
|
46
|
+
ariaLabelledby = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
|
|
47
|
+
class = input('', /* @ts-ignore */
|
|
48
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
49
|
+
valueChange = output();
|
|
50
|
+
valueState = signal([0], /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "valueState" }] : /* istanbul ignore next */ []));
|
|
52
|
+
activeThumbIndex = signal(0, /* @ts-ignore */
|
|
53
|
+
...(ngDevMode ? [{ debugName: "activeThumbIndex" }] : /* istanbul ignore next */ []));
|
|
54
|
+
draggedThumbIndex = signal(null, /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "draggedThumbIndex" }] : /* istanbul ignore next */ []));
|
|
56
|
+
pointerId = signal(null, /* @ts-ignore */
|
|
57
|
+
...(ngDevMode ? [{ debugName: "pointerId" }] : /* istanbul ignore next */ []));
|
|
58
|
+
detachDragListeners = null;
|
|
59
|
+
config = computed(() => ({
|
|
60
|
+
min: Math.min(this.min(), this.max()),
|
|
61
|
+
max: Math.max(this.min(), this.max()),
|
|
62
|
+
step: this.step() > 0 ? this.step() : 1,
|
|
63
|
+
minStepsBetweenThumbs: Math.max(0, Math.floor(this.minStepsBetweenThumbs())),
|
|
64
|
+
}), /* @ts-ignore */
|
|
65
|
+
...(ngDevMode ? [{ debugName: "config" }] : /* istanbul ignore next */ []));
|
|
66
|
+
hostClasses = computed(() => cn('slider-root relative flex touch-none select-none', this.orientation() === 'horizontal' ? 'h-5 w-full items-center' : 'h-32 w-5 justify-center', this.disabled() ? 'opacity-50' : '', this.class()), /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
68
|
+
thumbs = computed(() => {
|
|
69
|
+
const values = this.valueState();
|
|
70
|
+
const config = this.config();
|
|
71
|
+
return values.map((value, index) => {
|
|
72
|
+
const bounds = thumbBounds(values, index, config);
|
|
73
|
+
return {
|
|
74
|
+
index,
|
|
75
|
+
value,
|
|
76
|
+
position: this.positionPercent(value),
|
|
77
|
+
min: bounds.min,
|
|
78
|
+
max: bounds.max,
|
|
79
|
+
label: this.thumbLabel(index, values.length),
|
|
80
|
+
};
|
|
81
|
+
});
|
|
82
|
+
}, /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "thumbs" }] : /* istanbul ignore next */ []));
|
|
84
|
+
rangeOffset = computed(() => {
|
|
85
|
+
const span = this.rangeSpan();
|
|
86
|
+
return span.start;
|
|
87
|
+
}, /* @ts-ignore */
|
|
88
|
+
...(ngDevMode ? [{ debugName: "rangeOffset" }] : /* istanbul ignore next */ []));
|
|
89
|
+
rangeSize = computed(() => {
|
|
90
|
+
const span = this.rangeSpan();
|
|
91
|
+
return span.end - span.start;
|
|
92
|
+
}, /* @ts-ignore */
|
|
93
|
+
...(ngDevMode ? [{ debugName: "rangeSize" }] : /* istanbul ignore next */ []));
|
|
94
|
+
syncExternalValue = effect(() => {
|
|
95
|
+
const normalized = normalizeSliderValues(this.value(), this.config());
|
|
96
|
+
untracked(() => {
|
|
97
|
+
if (!sameValues(normalized, this.valueState())) {
|
|
98
|
+
this.valueState.set(normalized);
|
|
99
|
+
}
|
|
100
|
+
this.activeThumbIndex.set(clampIndex(this.activeThumbIndex(), normalized.length));
|
|
101
|
+
});
|
|
102
|
+
}, /* @ts-ignore */
|
|
103
|
+
...(ngDevMode ? [{ debugName: "syncExternalValue" }] : /* istanbul ignore next */ []));
|
|
104
|
+
constructor() {
|
|
105
|
+
this.destroyRef.onDestroy(() => this.endDrag());
|
|
106
|
+
}
|
|
107
|
+
onTrackPointerDown(event) {
|
|
108
|
+
if (this.disabled() || event.button !== 0) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
event.preventDefault();
|
|
112
|
+
const nextValue = this.valueFromPointer(event);
|
|
113
|
+
if (nextValue == null) {
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const thumbIndex = this.closestThumbIndex(nextValue);
|
|
117
|
+
this.activeThumbIndex.set(thumbIndex);
|
|
118
|
+
this.updateThumbValue(thumbIndex, nextValue);
|
|
119
|
+
this.beginDrag(event, thumbIndex);
|
|
120
|
+
}
|
|
121
|
+
onThumbPointerDown(event, index) {
|
|
122
|
+
if (this.disabled() || event.button !== 0) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
event.preventDefault();
|
|
126
|
+
event.stopPropagation();
|
|
127
|
+
this.activeThumbIndex.set(index);
|
|
128
|
+
this.beginDrag(event, index);
|
|
129
|
+
}
|
|
130
|
+
onThumbFocus(index) {
|
|
131
|
+
this.activeThumbIndex.set(index);
|
|
132
|
+
}
|
|
133
|
+
onThumbKeydown(event, index) {
|
|
134
|
+
if (this.disabled()) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const current = this.valueState()[index];
|
|
138
|
+
const config = this.config();
|
|
139
|
+
const pageStep = config.step * 10;
|
|
140
|
+
const direction = this.resolvedDirection();
|
|
141
|
+
let nextValue = null;
|
|
142
|
+
switch (event.key) {
|
|
143
|
+
case 'ArrowRight':
|
|
144
|
+
nextValue =
|
|
145
|
+
current +
|
|
146
|
+
(direction === 'rtl' && this.orientation() === 'horizontal' ? -config.step : config.step);
|
|
147
|
+
break;
|
|
148
|
+
case 'ArrowLeft':
|
|
149
|
+
nextValue =
|
|
150
|
+
current +
|
|
151
|
+
(direction === 'rtl' && this.orientation() === 'horizontal' ? config.step : -config.step);
|
|
152
|
+
break;
|
|
153
|
+
case 'ArrowUp':
|
|
154
|
+
nextValue = current + config.step;
|
|
155
|
+
break;
|
|
156
|
+
case 'ArrowDown':
|
|
157
|
+
nextValue = current - config.step;
|
|
158
|
+
break;
|
|
159
|
+
case 'PageUp':
|
|
160
|
+
nextValue = current + pageStep;
|
|
161
|
+
break;
|
|
162
|
+
case 'PageDown':
|
|
163
|
+
nextValue = current - pageStep;
|
|
164
|
+
break;
|
|
165
|
+
case 'Home':
|
|
166
|
+
nextValue = thumbBounds(this.valueState(), index, config).min;
|
|
167
|
+
break;
|
|
168
|
+
case 'End':
|
|
169
|
+
nextValue = thumbBounds(this.valueState(), index, config).max;
|
|
170
|
+
break;
|
|
171
|
+
default:
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
event.preventDefault();
|
|
175
|
+
this.activeThumbIndex.set(index);
|
|
176
|
+
this.updateThumbValue(index, nextValue);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Pointer listeners live for exactly as long as the drag does.
|
|
180
|
+
*
|
|
181
|
+
* Angular's listener wrapper marks the view dirty BEFORE the handler runs, so
|
|
182
|
+
* a permanently bound `pointermove` made every pointer move anywhere on the
|
|
183
|
+
* page dirty every slider on screen -- the pointerId guard inside the handler
|
|
184
|
+
* came far too late to stop it.
|
|
185
|
+
*/
|
|
186
|
+
beginDrag(event, index) {
|
|
187
|
+
this.endDrag();
|
|
188
|
+
this.pointerId.set(event.pointerId);
|
|
189
|
+
this.draggedThumbIndex.set(index);
|
|
190
|
+
this.host.nativeElement.setPointerCapture(event.pointerId);
|
|
191
|
+
const move = (next) => this.onDragMove(next);
|
|
192
|
+
const end = (next) => this.endDrag(next);
|
|
193
|
+
this.document.addEventListener('pointermove', move);
|
|
194
|
+
this.document.addEventListener('pointerup', end);
|
|
195
|
+
this.document.addEventListener('pointercancel', end);
|
|
196
|
+
this.detachDragListeners = () => {
|
|
197
|
+
this.document.removeEventListener('pointermove', move);
|
|
198
|
+
this.document.removeEventListener('pointerup', end);
|
|
199
|
+
this.document.removeEventListener('pointercancel', end);
|
|
200
|
+
this.detachDragListeners = null;
|
|
201
|
+
};
|
|
202
|
+
this.focusThumb(index);
|
|
203
|
+
}
|
|
204
|
+
onDragMove(event) {
|
|
205
|
+
if (this.pointerId() !== event.pointerId) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
const thumbIndex = this.draggedThumbIndex();
|
|
209
|
+
if (thumbIndex == null) {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
const nextValue = this.valueFromPointer(event);
|
|
213
|
+
if (nextValue == null) {
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
event.preventDefault();
|
|
217
|
+
this.updateThumbValue(thumbIndex, nextValue);
|
|
218
|
+
}
|
|
219
|
+
endDrag(event) {
|
|
220
|
+
const pointerId = event ? event.pointerId : this.pointerId();
|
|
221
|
+
if (pointerId == null || (event && this.pointerId() !== pointerId)) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
const host = this.host.nativeElement;
|
|
225
|
+
if (host.hasPointerCapture(pointerId)) {
|
|
226
|
+
host.releasePointerCapture(pointerId);
|
|
227
|
+
}
|
|
228
|
+
this.detachDragListeners?.();
|
|
229
|
+
this.draggedThumbIndex.set(null);
|
|
230
|
+
this.pointerId.set(null);
|
|
231
|
+
}
|
|
232
|
+
updateThumbValue(index, rawValue) {
|
|
233
|
+
const current = this.valueState();
|
|
234
|
+
const bounds = thumbBounds(current, index, this.config());
|
|
235
|
+
const nextValues = current.slice();
|
|
236
|
+
nextValues[index] = snapWithinBounds(rawValue, bounds.min, bounds.max, this.config());
|
|
237
|
+
if (sameValues(nextValues, current)) {
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
this.valueState.set(nextValues);
|
|
241
|
+
this.valueChange.emit(nextValues);
|
|
242
|
+
}
|
|
243
|
+
valueFromPointer(event) {
|
|
244
|
+
const track = this.track().nativeElement;
|
|
245
|
+
const rect = track.getBoundingClientRect();
|
|
246
|
+
const config = this.config();
|
|
247
|
+
if (rect.width <= 0 || rect.height <= 0) {
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
let ratio = 0;
|
|
251
|
+
if (this.orientation() === 'horizontal') {
|
|
252
|
+
const physicalRatio = clamp((event.clientX - rect.left) / rect.width, 0, 1);
|
|
253
|
+
ratio = this.resolvedDirection() === 'rtl' ? 1 - physicalRatio : physicalRatio;
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
ratio = clamp((rect.bottom - event.clientY) / rect.height, 0, 1);
|
|
257
|
+
}
|
|
258
|
+
return config.min + ratio * (config.max - config.min);
|
|
259
|
+
}
|
|
260
|
+
closestThumbIndex(nextValue) {
|
|
261
|
+
const values = this.valueState();
|
|
262
|
+
let bestIndex = 0;
|
|
263
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
264
|
+
values.forEach((value, index) => {
|
|
265
|
+
const distance = Math.abs(value - nextValue);
|
|
266
|
+
if (distance < bestDistance) {
|
|
267
|
+
bestDistance = distance;
|
|
268
|
+
bestIndex = index;
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
return bestIndex;
|
|
272
|
+
}
|
|
273
|
+
rangeSpan() {
|
|
274
|
+
const positions = this.valueState().map((value) => this.positionPercent(value));
|
|
275
|
+
if (!positions.length) {
|
|
276
|
+
return { start: 0, end: 0 };
|
|
277
|
+
}
|
|
278
|
+
if (positions.length === 1) {
|
|
279
|
+
const minBoundary = this.positionPercent(this.config().min);
|
|
280
|
+
return {
|
|
281
|
+
start: Math.min(minBoundary, positions[0]),
|
|
282
|
+
end: Math.max(minBoundary, positions[0]),
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
return {
|
|
286
|
+
start: Math.min(...positions),
|
|
287
|
+
end: Math.max(...positions),
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
positionPercent(value) {
|
|
291
|
+
const config = this.config();
|
|
292
|
+
const range = config.max - config.min;
|
|
293
|
+
if (range <= 0) {
|
|
294
|
+
return this.orientation() === 'horizontal' && this.resolvedDirection() === 'rtl' ? 100 : 0;
|
|
295
|
+
}
|
|
296
|
+
const logicalRatio = (value - config.min) / range;
|
|
297
|
+
const physicalRatio = this.orientation() === 'horizontal' && this.resolvedDirection() === 'rtl'
|
|
298
|
+
? 1 - logicalRatio
|
|
299
|
+
: logicalRatio;
|
|
300
|
+
return clamp(physicalRatio * 100, 0, 100);
|
|
301
|
+
}
|
|
302
|
+
thumbLabel(index, count) {
|
|
303
|
+
const labels = this.thumbLabels();
|
|
304
|
+
if (labels?.[index]) {
|
|
305
|
+
return labels[index] ?? null;
|
|
306
|
+
}
|
|
307
|
+
if (count === 1) {
|
|
308
|
+
return this.ariaLabel();
|
|
309
|
+
}
|
|
310
|
+
return this.ariaLabel() ? `${this.ariaLabel()} ${index + 1}` : `Slider thumb ${index + 1}`;
|
|
311
|
+
}
|
|
312
|
+
focusThumb(index) {
|
|
313
|
+
const thumb = this.host.nativeElement.querySelector(`.slider__thumb[data-index="${index}"]`);
|
|
314
|
+
thumb?.focus();
|
|
315
|
+
}
|
|
316
|
+
resolvedDirection() {
|
|
317
|
+
const host = this.host.nativeElement;
|
|
318
|
+
if (host.dir === 'ltr' || host.dir === 'rtl') {
|
|
319
|
+
return host.dir;
|
|
320
|
+
}
|
|
321
|
+
const view = this.document.defaultView;
|
|
322
|
+
if (!view) {
|
|
323
|
+
return 'ltr';
|
|
324
|
+
}
|
|
325
|
+
return view.getComputedStyle(host).direction === 'rtl' ? 'rtl' : 'ltr';
|
|
326
|
+
}
|
|
327
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SliderRootComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
328
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: SliderRootComponent, isStandalone: true, selector: "Slider", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, min: { classPropertyName: "min", publicName: "min", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", isSignal: true, isRequired: false, transformFunction: null }, step: { classPropertyName: "step", publicName: "step", isSignal: true, isRequired: false, transformFunction: null }, minStepsBetweenThumbs: { classPropertyName: "minStepsBetweenThumbs", publicName: "minStepsBetweenThumbs", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, thumbLabels: { classPropertyName: "thumbLabels", publicName: "thumbLabels", 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" }, host: { properties: { "class": "hostClasses()", "attr.data-disabled": "disabled() ? \"\" : null", "attr.data-orientation": "orientation()" } }, viewQueries: [{ propertyName: "track", first: true, predicate: ["track"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
329
|
+
<div #track class="slider__track" (pointerdown)="onTrackPointerDown($event)">
|
|
330
|
+
<div
|
|
331
|
+
class="slider__range"
|
|
332
|
+
[style.left.%]="orientation() === 'horizontal' ? rangeOffset() : null"
|
|
333
|
+
[style.width.%]="orientation() === 'horizontal' ? rangeSize() : null"
|
|
334
|
+
[style.bottom.%]="orientation() === 'vertical' ? rangeOffset() : null"
|
|
335
|
+
[style.height.%]="orientation() === 'vertical' ? rangeSize() : null"
|
|
336
|
+
></div>
|
|
337
|
+
|
|
338
|
+
@for (thumb of thumbs(); track thumb.index) {
|
|
339
|
+
<button
|
|
340
|
+
type="button"
|
|
341
|
+
class="slider__thumb"
|
|
342
|
+
[style.left.%]="orientation() === 'horizontal' ? thumb.position : 50"
|
|
343
|
+
[style.top.%]="orientation() === 'horizontal' ? 50 : null"
|
|
344
|
+
[style.bottom.%]="orientation() === 'vertical' ? thumb.position : null"
|
|
345
|
+
[attr.aria-describedby]="ariaDescribedby()"
|
|
346
|
+
[attr.aria-disabled]="disabled() ? 'true' : null"
|
|
347
|
+
[attr.aria-label]="thumb.label"
|
|
348
|
+
[attr.aria-labelledby]="thumb.label ? null : ariaLabelledby()"
|
|
349
|
+
[attr.aria-orientation]="orientation()"
|
|
350
|
+
[attr.aria-valuemax]="thumb.max"
|
|
351
|
+
[attr.aria-valuemin]="thumb.min"
|
|
352
|
+
[attr.aria-valuenow]="thumb.value"
|
|
353
|
+
[attr.data-index]="thumb.index"
|
|
354
|
+
[attr.data-state]="disabled() ? 'disabled' : 'active'"
|
|
355
|
+
[tabIndex]="disabled() ? -1 : activeThumbIndex() === thumb.index ? 0 : -1"
|
|
356
|
+
role="slider"
|
|
357
|
+
(focus)="onThumbFocus(thumb.index)"
|
|
358
|
+
(keydown)="onThumbKeydown($event, thumb.index)"
|
|
359
|
+
(pointerdown)="onThumbPointerDown($event, thumb.index)"
|
|
360
|
+
></button>
|
|
361
|
+
}
|
|
362
|
+
</div>
|
|
363
|
+
`, isInline: true, styles: [":host.slider-root{--slider-thumb-size: 1rem;--slider-track-size: .5rem;display:block}.slider__track{position:relative;flex:1 1 auto;border-radius:9999px;background:hsl(var(--secondary))}:host[data-orientation=horizontal] .slider__track{height:var(--slider-track-size);width:100%}:host[data-orientation=vertical] .slider__track{height:100%;width:var(--slider-track-size)}.slider__range{position:absolute;border-radius:inherit;background:hsl(var(--primary))}:host[data-orientation=horizontal] .slider__range{top:0;height:100%}:host[data-orientation=vertical] .slider__range{left:0;width:100%}.slider__thumb{position:absolute;height:var(--slider-thumb-size);width:var(--slider-thumb-size);border:var(--border-width) solid hsl(var(--primary));border-radius:9999px;background:hsl(var(--background));box-shadow:0 1px 2px hsl(var(--foreground) / .14);transition:box-shadow .15s cubic-bezier(.4,0,.2,1),border-color .15s cubic-bezier(.4,0,.2,1),background-color .15s cubic-bezier(.4,0,.2,1)}:host[data-orientation=horizontal] .slider__thumb{transform:translate(-50%,-50%)}:host[data-orientation=vertical] .slider__thumb{transform:translate(-50%,50%)}.slider__thumb:focus-visible{outline:none;box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host[data-disabled] .slider__track,:host[data-disabled] .slider__thumb{cursor:not-allowed}\n"] });
|
|
364
|
+
}
|
|
365
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SliderRootComponent, decorators: [{
|
|
366
|
+
type: Component,
|
|
367
|
+
args: [{ selector: 'Slider', host: {
|
|
368
|
+
'[class]': 'hostClasses()',
|
|
369
|
+
'[attr.data-disabled]': 'disabled() ? "" : null',
|
|
370
|
+
'[attr.data-orientation]': 'orientation()',
|
|
371
|
+
}, template: `
|
|
372
|
+
<div #track class="slider__track" (pointerdown)="onTrackPointerDown($event)">
|
|
373
|
+
<div
|
|
374
|
+
class="slider__range"
|
|
375
|
+
[style.left.%]="orientation() === 'horizontal' ? rangeOffset() : null"
|
|
376
|
+
[style.width.%]="orientation() === 'horizontal' ? rangeSize() : null"
|
|
377
|
+
[style.bottom.%]="orientation() === 'vertical' ? rangeOffset() : null"
|
|
378
|
+
[style.height.%]="orientation() === 'vertical' ? rangeSize() : null"
|
|
379
|
+
></div>
|
|
380
|
+
|
|
381
|
+
@for (thumb of thumbs(); track thumb.index) {
|
|
382
|
+
<button
|
|
383
|
+
type="button"
|
|
384
|
+
class="slider__thumb"
|
|
385
|
+
[style.left.%]="orientation() === 'horizontal' ? thumb.position : 50"
|
|
386
|
+
[style.top.%]="orientation() === 'horizontal' ? 50 : null"
|
|
387
|
+
[style.bottom.%]="orientation() === 'vertical' ? thumb.position : null"
|
|
388
|
+
[attr.aria-describedby]="ariaDescribedby()"
|
|
389
|
+
[attr.aria-disabled]="disabled() ? 'true' : null"
|
|
390
|
+
[attr.aria-label]="thumb.label"
|
|
391
|
+
[attr.aria-labelledby]="thumb.label ? null : ariaLabelledby()"
|
|
392
|
+
[attr.aria-orientation]="orientation()"
|
|
393
|
+
[attr.aria-valuemax]="thumb.max"
|
|
394
|
+
[attr.aria-valuemin]="thumb.min"
|
|
395
|
+
[attr.aria-valuenow]="thumb.value"
|
|
396
|
+
[attr.data-index]="thumb.index"
|
|
397
|
+
[attr.data-state]="disabled() ? 'disabled' : 'active'"
|
|
398
|
+
[tabIndex]="disabled() ? -1 : activeThumbIndex() === thumb.index ? 0 : -1"
|
|
399
|
+
role="slider"
|
|
400
|
+
(focus)="onThumbFocus(thumb.index)"
|
|
401
|
+
(keydown)="onThumbKeydown($event, thumb.index)"
|
|
402
|
+
(pointerdown)="onThumbPointerDown($event, thumb.index)"
|
|
403
|
+
></button>
|
|
404
|
+
}
|
|
405
|
+
</div>
|
|
406
|
+
`, styles: [":host.slider-root{--slider-thumb-size: 1rem;--slider-track-size: .5rem;display:block}.slider__track{position:relative;flex:1 1 auto;border-radius:9999px;background:hsl(var(--secondary))}:host[data-orientation=horizontal] .slider__track{height:var(--slider-track-size);width:100%}:host[data-orientation=vertical] .slider__track{height:100%;width:var(--slider-track-size)}.slider__range{position:absolute;border-radius:inherit;background:hsl(var(--primary))}:host[data-orientation=horizontal] .slider__range{top:0;height:100%}:host[data-orientation=vertical] .slider__range{left:0;width:100%}.slider__thumb{position:absolute;height:var(--slider-thumb-size);width:var(--slider-thumb-size);border:var(--border-width) solid hsl(var(--primary));border-radius:9999px;background:hsl(var(--background));box-shadow:0 1px 2px hsl(var(--foreground) / .14);transition:box-shadow .15s cubic-bezier(.4,0,.2,1),border-color .15s cubic-bezier(.4,0,.2,1),background-color .15s cubic-bezier(.4,0,.2,1)}:host[data-orientation=horizontal] .slider__thumb{transform:translate(-50%,-50%)}:host[data-orientation=vertical] .slider__thumb{transform:translate(-50%,50%)}.slider__thumb:focus-visible{outline:none;box-shadow:0 0 0 calc(var(--border-width) + 3px) hsl(var(--ring) / .3)}:host[data-disabled] .slider__track,:host[data-disabled] .slider__thumb{cursor:not-allowed}\n"] }]
|
|
407
|
+
}], ctorParameters: () => [], propDecorators: { track: [{ type: i0.ViewChild, args: ['track', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], minStepsBetweenThumbs: [{ type: i0.Input, args: [{ isSignal: true, alias: "minStepsBetweenThumbs", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], thumbLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "thumbLabels", 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"] }] } });
|
|
408
|
+
function clamp(value, min, max) {
|
|
409
|
+
return Math.min(Math.max(value, min), max);
|
|
410
|
+
}
|
|
411
|
+
function clampIndex(index, length) {
|
|
412
|
+
return clamp(index, 0, Math.max(length - 1, 0));
|
|
413
|
+
}
|
|
414
|
+
function decimalPlaces(value) {
|
|
415
|
+
const text = `${value}`;
|
|
416
|
+
const fraction = text.split('.')[1];
|
|
417
|
+
return fraction?.length ?? 0;
|
|
418
|
+
}
|
|
419
|
+
function normalizeSliderValues(values, config) {
|
|
420
|
+
const incoming = values.length ? [...values] : [config.min];
|
|
421
|
+
const sorted = incoming
|
|
422
|
+
.map((value) => snapToStep(value, config))
|
|
423
|
+
.sort((left, right) => left - right);
|
|
424
|
+
const gap = config.step * config.minStepsBetweenThumbs;
|
|
425
|
+
const normalized = [];
|
|
426
|
+
sorted.forEach((value, index) => {
|
|
427
|
+
const remaining = sorted.length - index - 1;
|
|
428
|
+
const min = index === 0 ? config.min : normalized[index - 1] + gap;
|
|
429
|
+
const max = Math.max(min, config.max - remaining * gap);
|
|
430
|
+
normalized.push(snapWithinBounds(value, min, max, config));
|
|
431
|
+
});
|
|
432
|
+
return normalized;
|
|
433
|
+
}
|
|
434
|
+
function sameValues(left, right) {
|
|
435
|
+
return left.length === right.length && left.every((value, index) => value === right[index]);
|
|
436
|
+
}
|
|
437
|
+
function snapToStep(value, config) {
|
|
438
|
+
const ratio = (value - config.min) / config.step;
|
|
439
|
+
const snapped = config.min + Math.round(ratio) * config.step;
|
|
440
|
+
const precision = Math.max(decimalPlaces(config.step), decimalPlaces(config.min));
|
|
441
|
+
return Number(snapped.toFixed(precision));
|
|
442
|
+
}
|
|
443
|
+
function snapWithinBounds(value, min, max, config) {
|
|
444
|
+
const boundedMin = Math.min(min, max);
|
|
445
|
+
const boundedMax = Math.max(min, max);
|
|
446
|
+
const snapped = snapToStep(value, config);
|
|
447
|
+
return clamp(snapped, boundedMin, boundedMax);
|
|
448
|
+
}
|
|
449
|
+
function thumbBounds(values, index, config) {
|
|
450
|
+
const gap = config.step * config.minStepsBetweenThumbs;
|
|
451
|
+
const min = index === 0 ? config.min : values[index - 1] + gap;
|
|
452
|
+
const max = index === values.length - 1 ? config.max : values[index + 1] - gap;
|
|
453
|
+
return { min: Math.min(min, max), max: Math.max(min, max) };
|
|
454
|
+
}
|
|
4
455
|
|
|
5
456
|
/**
|
|
6
457
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
458
|
+
*/
|
|
459
|
+
|
|
460
|
+
export { SliderComponent, SliderComponent as SliderInputDirective, SliderRootComponent };
|
|
@@ -1,7 +1,60 @@
|
|
|
1
|
-
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { input, booleanAttribute, computed, Component } from '@angular/core';
|
|
3
|
+
import { cn } from '@ojiepermana/angular/component/utils/core';
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
class SpinnerComponent {
|
|
6
|
+
class = input('', /* @ts-ignore */
|
|
7
|
+
...(ngDevMode ? [{ debugName: "class" }] : /* istanbul ignore next */ []));
|
|
8
|
+
decorative = input(false, { ...(ngDevMode ? { debugName: "decorative" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
9
|
+
ariaLabel = input('Loading', { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
10
|
+
ariaLabelledby = input(null, { ...(ngDevMode ? { debugName: "ariaLabelledby" } : /* istanbul ignore next */ {}), alias: 'aria-labelledby' });
|
|
11
|
+
classes = computed(() => cn('inline-flex size-4 shrink-0 items-center justify-center align-middle text-current', this.class()), /* @ts-ignore */
|
|
12
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
13
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SpinnerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
14
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.1.4", type: SpinnerComponent, isStandalone: true, selector: "Spinner", inputs: { class: { classPropertyName: "class", publicName: "class", isSignal: true, isRequired: false, transformFunction: null }, decorative: { classPropertyName: "decorative", publicName: "decorative", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "data-slot": "spinner" }, properties: { "class": "classes()", "attr.role": "decorative() ? null : \"status\"", "attr.aria-hidden": "decorative() ? \"true\" : null", "attr.aria-label": "decorative() || ariaLabelledby() ? null : ariaLabel()", "attr.aria-labelledby": "decorative() ? null : ariaLabelledby()" } }, ngImport: i0, template: `
|
|
15
|
+
<svg
|
|
16
|
+
aria-hidden="true"
|
|
17
|
+
class="size-full animate-spin motion-reduce:animate-none"
|
|
18
|
+
viewBox="0 0 24 24"
|
|
19
|
+
fill="none"
|
|
20
|
+
stroke="currentColor"
|
|
21
|
+
stroke-width="2"
|
|
22
|
+
>
|
|
23
|
+
<circle cx="12" cy="12" r="9" class="opacity-20" />
|
|
24
|
+
<path d="M21 12a9 9 0 0 0-9-9" stroke-linecap="round" />
|
|
25
|
+
</svg>
|
|
26
|
+
`, isInline: true });
|
|
27
|
+
}
|
|
28
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: SpinnerComponent, decorators: [{
|
|
29
|
+
type: Component,
|
|
30
|
+
args: [{
|
|
31
|
+
selector: 'Spinner',
|
|
32
|
+
host: {
|
|
33
|
+
'[class]': 'classes()',
|
|
34
|
+
'[attr.role]': 'decorative() ? null : "status"',
|
|
35
|
+
'[attr.aria-hidden]': 'decorative() ? "true" : null',
|
|
36
|
+
'[attr.aria-label]': 'decorative() || ariaLabelledby() ? null : ariaLabel()',
|
|
37
|
+
'[attr.aria-labelledby]': 'decorative() ? null : ariaLabelledby()',
|
|
38
|
+
'data-slot': 'spinner',
|
|
39
|
+
},
|
|
40
|
+
template: `
|
|
41
|
+
<svg
|
|
42
|
+
aria-hidden="true"
|
|
43
|
+
class="size-full animate-spin motion-reduce:animate-none"
|
|
44
|
+
viewBox="0 0 24 24"
|
|
45
|
+
fill="none"
|
|
46
|
+
stroke="currentColor"
|
|
47
|
+
stroke-width="2"
|
|
48
|
+
>
|
|
49
|
+
<circle cx="12" cy="12" r="9" class="opacity-20" />
|
|
50
|
+
<path d="M21 12a9 9 0 0 0-9-9" stroke-linecap="round" />
|
|
51
|
+
</svg>
|
|
52
|
+
`,
|
|
53
|
+
}]
|
|
54
|
+
}], propDecorators: { class: [{ type: i0.Input, args: [{ isSignal: true, alias: "class", required: false }] }], decorative: [{ type: i0.Input, args: [{ isSignal: true, alias: "decorative", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-label", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "aria-labelledby", required: false }] }] } });
|
|
4
55
|
|
|
5
56
|
/**
|
|
6
57
|
* Generated bundle index. Do not edit.
|
|
7
|
-
*/
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
export { SpinnerComponent };
|