@spinjs/components 0.0.0-stage → 0.1.0-preview.2
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/LICENSE +21 -0
- package/README.md +61 -2
- package/dist/angle-slider/angle-slider.events.d.ts +30 -0
- package/dist/angle-slider/angle-slider.events.js +1 -0
- package/dist/angle-slider/angle-slider.machine.d.ts +9 -0
- package/dist/angle-slider/angle-slider.machine.js +56 -0
- package/dist/angle-slider/angle-slider.presentation.d.ts +194 -0
- package/dist/angle-slider/angle-slider.presentation.js +277 -0
- package/dist/angle-slider/angle-slider.state.d.ts +38 -0
- package/dist/angle-slider/angle-slider.state.js +71 -0
- package/dist/angle-slider/angle-slider.transitions.d.ts +11 -0
- package/dist/angle-slider/angle-slider.transitions.js +18 -0
- package/dist/angle-slider/examples/basic.html +42 -0
- package/dist/angle-slider/examples/knob.html +34 -0
- package/dist/angle-slider/examples/labeled.html +63 -0
- package/dist/angle-slider/examples/marks.html +42 -0
- package/dist/async-list/async-list.events.d.ts +23 -0
- package/dist/async-list/async-list.events.js +1 -0
- package/dist/async-list/async-list.machine.d.ts +5 -0
- package/dist/async-list/async-list.machine.js +96 -0
- package/dist/async-list/async-list.presentation.d.ts +294 -0
- package/dist/async-list/async-list.presentation.js +380 -0
- package/dist/async-list/async-list.state.d.ts +27 -0
- package/dist/async-list/async-list.state.js +31 -0
- package/dist/async-list/async-list.transitions.d.ts +16 -0
- package/dist/async-list/async-list.transitions.js +17 -0
- package/dist/async-list/examples/basic.html +88 -0
- package/dist/avatar/avatar.events.d.ts +18 -0
- package/dist/avatar/avatar.events.js +1 -0
- package/dist/avatar/avatar.machine.d.ts +5 -0
- package/dist/avatar/avatar.machine.js +47 -0
- package/dist/avatar/avatar.presentation.d.ts +75 -0
- package/dist/avatar/avatar.presentation.js +68 -0
- package/dist/avatar/avatar.state.d.ts +28 -0
- package/dist/avatar/avatar.state.js +20 -0
- package/dist/avatar/avatar.transitions.d.ts +7 -0
- package/dist/avatar/avatar.transitions.js +5 -0
- package/dist/avatar/examples/badge.html +24 -0
- package/dist/avatar/examples/badgeminimal.html +16 -0
- package/dist/avatar/examples/basic.html +24 -0
- package/dist/avatar/examples/count.html +29 -0
- package/dist/avatar/examples/fallback.html +24 -0
- package/dist/avatar/examples/group.html +28 -0
- package/dist/avatar/examples/icon.html +15 -0
- package/dist/avatar/examples/multiples.html +48 -0
- package/dist/avatar/examples/pills.html +58 -0
- package/dist/avatar/examples/pillsolid.html +21 -0
- package/dist/avatar/examples/rounded.html +13 -0
- package/dist/avatar/examples/status.html +24 -0
- package/dist/avatar/examples/statusminimal.html +16 -0
- package/dist/avatar/examples/trusted.html +33 -0
- package/dist/avatar/examples/verification.html +18 -0
- package/dist/carousel/carousel.events.d.ts +50 -0
- package/dist/carousel/carousel.events.js +1 -0
- package/dist/carousel/carousel.machine.d.ts +6 -0
- package/dist/carousel/carousel.machine.js +70 -0
- package/dist/carousel/carousel.presentation.d.ts +379 -0
- package/dist/carousel/carousel.presentation.js +554 -0
- package/dist/carousel/carousel.state.d.ts +61 -0
- package/dist/carousel/carousel.state.js +93 -0
- package/dist/carousel/carousel.transitions.d.ts +20 -0
- package/dist/carousel/carousel.transitions.js +49 -0
- package/dist/carousel/examples/autoplay.html +69 -0
- package/dist/carousel/examples/basic.html +56 -0
- package/dist/carousel/examples/cards.html +71 -0
- package/dist/carousel/examples/hero.html +54 -0
- package/dist/carousel/examples/infinite.html +68 -0
- package/dist/carousel/examples/minimal.html +47 -0
- package/dist/carousel/examples/testimonials.html +78 -0
- package/dist/carousel/examples/thumbnails.html +67 -0
- package/dist/carousel/examples/vertical.html +67 -0
- package/dist/cascade-select/cascade.events.d.ts +42 -0
- package/dist/cascade-select/cascade.events.js +1 -0
- package/dist/cascade-select/cascade.machine.d.ts +7 -0
- package/dist/cascade-select/cascade.machine.js +118 -0
- package/dist/cascade-select/cascade.presentation.d.ts +415 -0
- package/dist/cascade-select/cascade.presentation.js +771 -0
- package/dist/cascade-select/cascade.state.d.ts +58 -0
- package/dist/cascade-select/cascade.state.js +97 -0
- package/dist/cascade-select/cascade.transitions.d.ts +21 -0
- package/dist/cascade-select/cascade.transitions.js +54 -0
- package/dist/cascade-select/examples/basic.html +77 -0
- package/dist/color-picker/color-picker.events.d.ts +83 -0
- package/dist/color-picker/color-picker.events.js +1 -0
- package/dist/color-picker/color-picker.machine.d.ts +5 -0
- package/dist/color-picker/color-picker.machine.js +130 -0
- package/dist/color-picker/color-picker.presentation.d.ts +402 -0
- package/dist/color-picker/color-picker.presentation.js +761 -0
- package/dist/color-picker/color-picker.state.d.ts +41 -0
- package/dist/color-picker/color-picker.state.js +71 -0
- package/dist/color-picker/color-picker.transitions.d.ts +21 -0
- package/dist/color-picker/color-picker.transitions.js +99 -0
- package/dist/color-picker/examples/basic.html +106 -0
- package/dist/color-picker/examples/hue-wheel.html +57 -0
- package/dist/color-picker/examples/inline.html +61 -0
- package/dist/color-picker/examples/with-presets.html +49 -0
- package/dist/combobox/combobox.events.d.ts +61 -0
- package/dist/combobox/combobox.events.js +1 -0
- package/dist/combobox/combobox.machine.d.ts +7 -0
- package/dist/combobox/combobox.machine.js +234 -0
- package/dist/combobox/combobox.presentation.d.ts +433 -0
- package/dist/combobox/combobox.presentation.js +746 -0
- package/dist/combobox/combobox.state.d.ts +80 -0
- package/dist/combobox/combobox.state.js +71 -0
- package/dist/combobox/combobox.transitions.d.ts +28 -0
- package/dist/combobox/combobox.transitions.js +91 -0
- package/dist/combobox/examples/basic.html +61 -0
- package/dist/combobox/examples/directory.html +71 -0
- package/dist/combobox/examples/grouping.html +36 -0
- package/dist/combobox/examples/multiple.html +37 -0
- package/dist/controller.d.ts +52 -0
- package/dist/controller.js +90 -0
- package/dist/date-input/date-input.events.d.ts +37 -0
- package/dist/date-input/date-input.events.js +1 -0
- package/dist/date-input/date-input.machine.d.ts +6 -0
- package/dist/date-input/date-input.machine.js +61 -0
- package/dist/date-input/date-input.presentation.d.ts +133 -0
- package/dist/date-input/date-input.presentation.js +328 -0
- package/dist/date-input/date-input.state.d.ts +77 -0
- package/dist/date-input/date-input.state.js +260 -0
- package/dist/date-input/date-input.transitions.d.ts +22 -0
- package/dist/date-input/date-input.transitions.js +166 -0
- package/dist/date-input/examples/basic.html +18 -0
- package/dist/date-picker/date-picker.events.d.ts +42 -0
- package/dist/date-picker/date-picker.events.js +1 -0
- package/dist/date-picker/date-picker.machine.d.ts +6 -0
- package/dist/date-picker/date-picker.machine.js +102 -0
- package/dist/date-picker/date-picker.presentation.d.ts +256 -0
- package/dist/date-picker/date-picker.presentation.js +549 -0
- package/dist/date-picker/date-picker.state.d.ts +66 -0
- package/dist/date-picker/date-picker.state.js +177 -0
- package/dist/date-picker/date-picker.transitions.d.ts +23 -0
- package/dist/date-picker/date-picker.transitions.js +94 -0
- package/dist/date-picker/examples/appointment.html +49 -0
- package/dist/date-picker/examples/basic.html +6 -0
- package/dist/date-picker/examples/multiple.html +6 -0
- package/dist/date-picker/examples/pricing.html +6 -0
- package/dist/date-picker/examples/range.html +6 -0
- package/dist/date-picker/examples/unavailable.html +6 -0
- package/dist/editable/editable.events.d.ts +29 -0
- package/dist/editable/editable.events.js +1 -0
- package/dist/editable/editable.machine.d.ts +5 -0
- package/dist/editable/editable.machine.js +82 -0
- package/dist/editable/editable.presentation.d.ts +278 -0
- package/dist/editable/editable.presentation.js +388 -0
- package/dist/editable/editable.state.d.ts +54 -0
- package/dist/editable/editable.state.js +32 -0
- package/dist/editable/editable.transitions.d.ts +11 -0
- package/dist/editable/editable.transitions.js +9 -0
- package/dist/editable/examples/basic.html +43 -0
- package/dist/editable/examples/doubleclick.html +19 -0
- package/dist/editable/examples/inline-edit.html +13 -0
- package/dist/editable/examples/profile-field.html +20 -0
- package/dist/editable/examples/resize.html +19 -0
- package/dist/editable/examples/task-item.html +19 -0
- package/dist/editable/examples/title-editor.html +13 -0
- package/dist/editable/examples/with-controls.html +20 -0
- package/dist/file-upload/examples/avatar.html +34 -0
- package/dist/file-upload/examples/basic.html +34 -0
- package/dist/file-upload/examples/directory.html +34 -0
- package/dist/file-upload/examples/dragdrop.html +31 -0
- package/dist/file-upload/examples/files.html +39 -0
- package/dist/file-upload/examples/images.html +40 -0
- package/dist/file-upload/examples/paste.html +30 -0
- package/dist/file-upload/examples/table.html +39 -0
- package/dist/file-upload/file-upload.events.d.ts +27 -0
- package/dist/file-upload/file-upload.events.js +1 -0
- package/dist/file-upload/file-upload.machine.d.ts +6 -0
- package/dist/file-upload/file-upload.machine.js +59 -0
- package/dist/file-upload/file-upload.presentation.d.ts +182 -0
- package/dist/file-upload/file-upload.presentation.js +256 -0
- package/dist/file-upload/file-upload.state.d.ts +52 -0
- package/dist/file-upload/file-upload.state.js +72 -0
- package/dist/file-upload/file-upload.transitions.d.ts +11 -0
- package/dist/file-upload/file-upload.transitions.js +32 -0
- package/dist/floating-panel/examples/basic.html +42 -0
- package/dist/floating-panel/examples/calculator.html +56 -0
- package/dist/floating-panel/examples/chat.html +45 -0
- package/dist/floating-panel/examples/media-player.html +54 -0
- package/dist/floating-panel/examples/notes.html +60 -0
- package/dist/floating-panel/examples/settings.html +73 -0
- package/dist/floating-panel/examples/task.html +79 -0
- package/dist/floating-panel/examples/video-call.html +47 -0
- package/dist/floating-panel/floating-panel.events.d.ts +45 -0
- package/dist/floating-panel/floating-panel.events.js +1 -0
- package/dist/floating-panel/floating-panel.machine.d.ts +6 -0
- package/dist/floating-panel/floating-panel.machine.js +70 -0
- package/dist/floating-panel/floating-panel.presentation.d.ts +239 -0
- package/dist/floating-panel/floating-panel.presentation.js +271 -0
- package/dist/floating-panel/floating-panel.state.d.ts +67 -0
- package/dist/floating-panel/floating-panel.state.js +76 -0
- package/dist/floating-panel/floating-panel.transitions.d.ts +22 -0
- package/dist/floating-panel/floating-panel.transitions.js +114 -0
- package/dist/hover-card/examples/basic.html +19 -0
- package/dist/hover-card/examples/controlled.html +32 -0
- package/dist/hover-card/examples/custom-positioning.html +29 -0
- package/dist/hover-card/examples/link.html +10 -0
- package/dist/hover-card/examples/product.html +33 -0
- package/dist/hover-card/examples/user.html +38 -0
- package/dist/hover-card/examples/with-arrow.html +29 -0
- package/dist/hover-card/hover-card.controller-def.d.ts +50 -0
- package/dist/hover-card/hover-card.controller-def.js +134 -0
- package/dist/image-cropper/crop-geometry.d.ts +133 -0
- package/dist/image-cropper/crop-geometry.js +453 -0
- package/dist/image-cropper/examples/basic.html +44 -0
- package/dist/image-cropper/examples/circle.html +44 -0
- package/dist/image-cropper/image-cropper.events.d.ts +108 -0
- package/dist/image-cropper/image-cropper.events.js +1 -0
- package/dist/image-cropper/image-cropper.machine.d.ts +5 -0
- package/dist/image-cropper/image-cropper.machine.js +231 -0
- package/dist/image-cropper/image-cropper.presentation.d.ts +295 -0
- package/dist/image-cropper/image-cropper.presentation.js +536 -0
- package/dist/image-cropper/image-cropper.state.d.ts +94 -0
- package/dist/image-cropper/image-cropper.state.js +134 -0
- package/dist/image-cropper/image-cropper.transitions.d.ts +13 -0
- package/dist/image-cropper/image-cropper.transitions.js +11 -0
- package/dist/index.d.ts +66 -0
- package/dist/index.js +279 -0
- package/dist/listbox/examples/basic.html +50 -0
- package/dist/listbox/examples/controlled.html +54 -0
- package/dist/listbox/examples/countries.html +61 -0
- package/dist/listbox/examples/grouped.html +58 -0
- package/dist/listbox/examples/icons.html +56 -0
- package/dist/listbox/examples/multiple.html +56 -0
- package/dist/listbox/examples/priority.html +50 -0
- package/dist/listbox/examples/settings.html +64 -0
- package/dist/listbox/listbox.events.d.ts +42 -0
- package/dist/listbox/listbox.events.js +1 -0
- package/dist/listbox/listbox.machine.d.ts +6 -0
- package/dist/listbox/listbox.machine.js +51 -0
- package/dist/listbox/listbox.presentation.d.ts +294 -0
- package/dist/listbox/listbox.presentation.js +493 -0
- package/dist/listbox/listbox.state.d.ts +55 -0
- package/dist/listbox/listbox.state.js +59 -0
- package/dist/listbox/listbox.transitions.d.ts +20 -0
- package/dist/listbox/listbox.transitions.js +73 -0
- package/dist/menu/examples/basic.html +75 -0
- package/dist/menu/examples/context.html +74 -0
- package/dist/menu/examples/groups.html +88 -0
- package/dist/menu/examples/icons.html +80 -0
- package/dist/menu/examples/nested.html +83 -0
- package/dist/menu/examples/user.html +87 -0
- package/dist/menu/menu.events.d.ts +42 -0
- package/dist/menu/menu.events.js +1 -0
- package/dist/menu/menu.machine.d.ts +6 -0
- package/dist/menu/menu.machine.js +148 -0
- package/dist/menu/menu.presentation.d.ts +252 -0
- package/dist/menu/menu.presentation.js +709 -0
- package/dist/menu/menu.state.d.ts +54 -0
- package/dist/menu/menu.state.js +55 -0
- package/dist/mode-picker/examples/basic.html +17 -0
- package/dist/mode-picker/examples/minimal.html +17 -0
- package/dist/mode-picker/examples/pill.html +17 -0
- package/dist/mode-picker/mode-picker.events.d.ts +20 -0
- package/dist/mode-picker/mode-picker.events.js +1 -0
- package/dist/mode-picker/mode-picker.machine.d.ts +5 -0
- package/dist/mode-picker/mode-picker.machine.js +29 -0
- package/dist/mode-picker/mode-picker.presentation.d.ts +129 -0
- package/dist/mode-picker/mode-picker.presentation.js +175 -0
- package/dist/mode-picker/mode-picker.state.d.ts +27 -0
- package/dist/mode-picker/mode-picker.state.js +56 -0
- package/dist/mode-picker/mode-picker.transitions.d.ts +11 -0
- package/dist/mode-picker/mode-picker.transitions.js +32 -0
- package/dist/navigation-menu/examples/basic.html +72 -0
- package/dist/navigation-menu/examples/grouped.html +91 -0
- package/dist/navigation-menu/examples/minimal.html +49 -0
- package/dist/navigation-menu/navigation-menu.events.d.ts +20 -0
- package/dist/navigation-menu/navigation-menu.events.js +1 -0
- package/dist/navigation-menu/navigation-menu.machine.d.ts +6 -0
- package/dist/navigation-menu/navigation-menu.machine.js +51 -0
- package/dist/navigation-menu/navigation-menu.presentation.d.ts +132 -0
- package/dist/navigation-menu/navigation-menu.presentation.js +151 -0
- package/dist/navigation-menu/navigation-menu.state.d.ts +33 -0
- package/dist/navigation-menu/navigation-menu.state.js +49 -0
- package/dist/navigation-menu/navigation-menu.transitions.d.ts +11 -0
- package/dist/navigation-menu/navigation-menu.transitions.js +32 -0
- package/dist/number-input/examples/basic.html +49 -0
- package/dist/number-input/examples/currency.html +33 -0
- package/dist/number-input/examples/decimal.html +33 -0
- package/dist/number-input/examples/limits.html +42 -0
- package/dist/number-input/examples/percentage.html +38 -0
- package/dist/number-input/examples/quantity.html +35 -0
- package/dist/number-input/examples/scrubber.html +46 -0
- package/dist/number-input/examples/wheel.html +42 -0
- package/dist/number-input/number-input.events.d.ts +66 -0
- package/dist/number-input/number-input.events.js +1 -0
- package/dist/number-input/number-input.machine.d.ts +5 -0
- package/dist/number-input/number-input.machine.js +132 -0
- package/dist/number-input/number-input.presentation.d.ts +292 -0
- package/dist/number-input/number-input.presentation.js +449 -0
- package/dist/number-input/number-input.state.d.ts +71 -0
- package/dist/number-input/number-input.state.js +86 -0
- package/dist/number-input/number-input.transitions.d.ts +17 -0
- package/dist/number-input/number-input.transitions.js +40 -0
- package/dist/pagination/examples/basic.html +39 -0
- package/dist/pagination/examples/dropdown.html +37 -0
- package/dist/pagination/examples/info.html +41 -0
- package/dist/pagination/examples/jump.html +38 -0
- package/dist/pagination/examples/numbered.html +31 -0
- package/dist/pagination/examples/pagesize.html +46 -0
- package/dist/pagination/pagination.events.d.ts +36 -0
- package/dist/pagination/pagination.events.js +1 -0
- package/dist/pagination/pagination.machine.d.ts +6 -0
- package/dist/pagination/pagination.machine.js +45 -0
- package/dist/pagination/pagination.presentation.d.ts +161 -0
- package/dist/pagination/pagination.presentation.js +162 -0
- package/dist/pagination/pagination.state.d.ts +44 -0
- package/dist/pagination/pagination.state.js +115 -0
- package/dist/pagination/pagination.transitions.d.ts +17 -0
- package/dist/pagination/pagination.transitions.js +30 -0
- package/dist/pin-input/examples/basic.html +23 -0
- package/dist/pin-input/examples/field.html +25 -0
- package/dist/pin-input/examples/masked.html +23 -0
- package/dist/pin-input/examples/placeholder.html +24 -0
- package/dist/pin-input/examples/twofactor.html +25 -0
- package/dist/pin-input/examples/verification.html +32 -0
- package/dist/pin-input/pin-input.events.d.ts +48 -0
- package/dist/pin-input/pin-input.events.js +1 -0
- package/dist/pin-input/pin-input.machine.d.ts +5 -0
- package/dist/pin-input/pin-input.machine.js +99 -0
- package/dist/pin-input/pin-input.presentation.d.ts +204 -0
- package/dist/pin-input/pin-input.presentation.js +392 -0
- package/dist/pin-input/pin-input.state.d.ts +67 -0
- package/dist/pin-input/pin-input.state.js +63 -0
- package/dist/pin-input/pin-input.transitions.d.ts +10 -0
- package/dist/pin-input/pin-input.transitions.js +22 -0
- package/dist/popover/examples/basic.html +15 -0
- package/dist/popover/examples/feedback.html +17 -0
- package/dist/popover/examples/notifications.html +21 -0
- package/dist/popover/examples/settings.html +39 -0
- package/dist/popover/examples/share.html +18 -0
- package/dist/popover/examples/user.html +43 -0
- package/dist/popover/popover.controller-def.d.ts +39 -0
- package/dist/popover/popover.controller-def.js +74 -0
- package/dist/rating-group/examples/basic.html +39 -0
- package/dist/rating-group/examples/movie.html +45 -0
- package/dist/rating-group/examples/product-review.html +52 -0
- package/dist/rating-group/examples/service-evaluation.html +31 -0
- package/dist/rating-group/rating-group.events.d.ts +38 -0
- package/dist/rating-group/rating-group.events.js +1 -0
- package/dist/rating-group/rating-group.machine.d.ts +6 -0
- package/dist/rating-group/rating-group.machine.js +70 -0
- package/dist/rating-group/rating-group.presentation.d.ts +144 -0
- package/dist/rating-group/rating-group.presentation.js +208 -0
- package/dist/rating-group/rating-group.state.d.ts +36 -0
- package/dist/rating-group/rating-group.state.js +41 -0
- package/dist/rating-group/rating-group.transitions.d.ts +16 -0
- package/dist/rating-group/rating-group.transitions.js +15 -0
- package/dist/react/react.d.ts +29 -0
- package/dist/react/react.js +8 -0
- package/dist/select/examples/basic.html +72 -0
- package/dist/select/examples/category.html +67 -0
- package/dist/select/examples/country.html +65 -0
- package/dist/select/examples/language.html +19 -0
- package/dist/select/examples/multiple.html +20 -0
- package/dist/select/examples/profile.html +73 -0
- package/dist/select/examples/theme.html +11 -0
- package/dist/select/examples/with-overlapping-label.html +57 -0
- package/dist/select/select.events.d.ts +59 -0
- package/dist/select/select.events.js +1 -0
- package/dist/select/select.machine.d.ts +6 -0
- package/dist/select/select.machine.js +203 -0
- package/dist/select/select.presentation.d.ts +358 -0
- package/dist/select/select.presentation.js +509 -0
- package/dist/select/select.shared.d.ts +8 -0
- package/dist/select/select.shared.js +13 -0
- package/dist/select/select.state.d.ts +51 -0
- package/dist/select/select.state.js +69 -0
- package/dist/select/select.transitions.d.ts +15 -0
- package/dist/select/select.transitions.js +27 -0
- package/dist/shared/keyboard.d.ts +29 -0
- package/dist/shared/keyboard.js +13 -0
- package/dist/signature-pad/examples/basic.html +29 -0
- package/dist/signature-pad/examples/contract.html +36 -0
- package/dist/signature-pad/examples/receipt.html +40 -0
- package/dist/signature-pad/examples/with-preview.html +40 -0
- package/dist/signature-pad/signature-pad.events.d.ts +26 -0
- package/dist/signature-pad/signature-pad.events.js +1 -0
- package/dist/signature-pad/signature-pad.machine.d.ts +7 -0
- package/dist/signature-pad/signature-pad.machine.js +44 -0
- package/dist/signature-pad/signature-pad.presentation.d.ts +184 -0
- package/dist/signature-pad/signature-pad.presentation.js +236 -0
- package/dist/signature-pad/signature-pad.state.d.ts +40 -0
- package/dist/signature-pad/signature-pad.state.js +94 -0
- package/dist/signature-pad/signature-pad.transitions.d.ts +12 -0
- package/dist/signature-pad/signature-pad.transitions.js +40 -0
- package/dist/slider/examples/basic.html +32 -0
- package/dist/slider/examples/equalizer.html +119 -0
- package/dist/slider/examples/fractional.html +7 -0
- package/dist/slider/examples/marks.html +42 -0
- package/dist/slider/examples/range.html +31 -0
- package/dist/slider/examples/stepped.html +7 -0
- package/dist/slider/examples/ticks.html +72 -0
- package/dist/slider/examples/vertical.html +30 -0
- package/dist/slider/slider.events.d.ts +50 -0
- package/dist/slider/slider.events.js +1 -0
- package/dist/slider/slider.machine.d.ts +5 -0
- package/dist/slider/slider.machine.js +86 -0
- package/dist/slider/slider.presentation.d.ts +252 -0
- package/dist/slider/slider.presentation.js +322 -0
- package/dist/slider/slider.state.d.ts +72 -0
- package/dist/slider/slider.state.js +91 -0
- package/dist/slider/slider.transitions.d.ts +17 -0
- package/dist/slider/slider.transitions.js +62 -0
- package/dist/solid/solid.d.ts +36 -0
- package/dist/solid/solid.js +10 -0
- package/dist/spin-element.d.ts +13 -0
- package/dist/spin-element.js +38 -0
- package/dist/splitter/examples/basic.html +22 -0
- package/dist/splitter/examples/nested.html +41 -0
- package/dist/splitter/examples/threepanels.html +23 -0
- package/dist/splitter/examples/vertical.html +23 -0
- package/dist/splitter/splitter.events.d.ts +52 -0
- package/dist/splitter/splitter.events.js +1 -0
- package/dist/splitter/splitter.machine.d.ts +6 -0
- package/dist/splitter/splitter.machine.js +78 -0
- package/dist/splitter/splitter.presentation.d.ts +204 -0
- package/dist/splitter/splitter.presentation.js +443 -0
- package/dist/splitter/splitter.state.d.ts +48 -0
- package/dist/splitter/splitter.state.js +225 -0
- package/dist/splitter/splitter.transitions.d.ts +20 -0
- package/dist/splitter/splitter.transitions.js +132 -0
- package/dist/steps/examples/basic.html +57 -0
- package/dist/steps/examples/checkmarks.html +32 -0
- package/dist/steps/examples/content.html +45 -0
- package/dist/steps/examples/descriptions.html +26 -0
- package/dist/steps/examples/icons.html +26 -0
- package/dist/steps/examples/lines.html +26 -0
- package/dist/steps/examples/navigation.html +41 -0
- package/dist/steps/examples/onboarding.html +32 -0
- package/dist/steps/examples/progress.html +47 -0
- package/dist/steps/examples/segmented.html +40 -0
- package/dist/steps/examples/vertical.html +58 -0
- package/dist/steps/examples/verticallabels.html +27 -0
- package/dist/steps/examples/verticalnavigation.html +36 -0
- package/dist/steps/steps.events.d.ts +27 -0
- package/dist/steps/steps.events.js +1 -0
- package/dist/steps/steps.machine.d.ts +6 -0
- package/dist/steps/steps.machine.js +36 -0
- package/dist/steps/steps.presentation.d.ts +177 -0
- package/dist/steps/steps.presentation.js +248 -0
- package/dist/steps/steps.state.d.ts +39 -0
- package/dist/steps/steps.state.js +47 -0
- package/dist/steps/steps.transitions.d.ts +15 -0
- package/dist/steps/steps.transitions.js +39 -0
- package/dist/tabs/examples/basic.html +41 -0
- package/dist/tabs/examples/dashboard.html +116 -0
- package/dist/tabs/examples/ghost.html +28 -0
- package/dist/tabs/examples/icon-above.html +50 -0
- package/dist/tabs/examples/icon-only.html +37 -0
- package/dist/tabs/examples/outline-with-icons.html +50 -0
- package/dist/tabs/examples/outline.html +29 -0
- package/dist/tabs/examples/pills.html +40 -0
- package/dist/tabs/examples/project.html +87 -0
- package/dist/tabs/examples/settings.html +100 -0
- package/dist/tabs/examples/stack-with-icons.html +51 -0
- package/dist/tabs/examples/stack.html +28 -0
- package/dist/tabs/examples/underline.html +41 -0
- package/dist/tabs/examples/vertical-ghost.html +44 -0
- package/dist/tabs/examples/vertical-icons.html +44 -0
- package/dist/tabs/examples/vertical-underline.html +45 -0
- package/dist/tabs/examples/vertical-with-icons.html +53 -0
- package/dist/tabs/examples/vertical.html +42 -0
- package/dist/tabs/examples/with-badges.html +43 -0
- package/dist/tabs/examples/with-icons.html +42 -0
- package/dist/tabs/tabs.events.d.ts +19 -0
- package/dist/tabs/tabs.events.js +1 -0
- package/dist/tabs/tabs.machine.d.ts +5 -0
- package/dist/tabs/tabs.machine.js +54 -0
- package/dist/tabs/tabs.presentation.d.ts +83 -0
- package/dist/tabs/tabs.presentation.js +94 -0
- package/dist/tabs/tabs.state.d.ts +61 -0
- package/dist/tabs/tabs.state.js +53 -0
- package/dist/tabs/tabs.transitions.d.ts +8 -0
- package/dist/tabs/tabs.transitions.js +6 -0
- package/dist/tags-input/examples/basic.html +43 -0
- package/dist/tags-input/examples/with-combobox.html +64 -0
- package/dist/tags-input/tags.events.d.ts +77 -0
- package/dist/tags-input/tags.events.js +1 -0
- package/dist/tags-input/tags.machine.d.ts +6 -0
- package/dist/tags-input/tags.machine.js +311 -0
- package/dist/tags-input/tags.presentation.d.ts +376 -0
- package/dist/tags-input/tags.presentation.js +782 -0
- package/dist/tags-input/tags.state.d.ts +109 -0
- package/dist/tags-input/tags.state.js +111 -0
- package/dist/tags-input/tags.transitions.d.ts +23 -0
- package/dist/tags-input/tags.transitions.js +101 -0
- package/dist/theme-picker/examples/basic.html +52 -0
- package/dist/theme-picker/examples/cards.html +32 -0
- package/dist/theme-picker/examples/compact.html +42 -0
- package/dist/theme-picker/examples/swatches.html +31 -0
- package/dist/theme-picker/theme-picker.events.d.ts +32 -0
- package/dist/theme-picker/theme-picker.events.js +1 -0
- package/dist/theme-picker/theme-picker.machine.d.ts +5 -0
- package/dist/theme-picker/theme-picker.machine.js +65 -0
- package/dist/theme-picker/theme-picker.presentation.d.ts +198 -0
- package/dist/theme-picker/theme-picker.presentation.js +306 -0
- package/dist/theme-picker/theme-picker.state.d.ts +40 -0
- package/dist/theme-picker/theme-picker.state.js +108 -0
- package/dist/theme-picker/theme-picker.transitions.d.ts +17 -0
- package/dist/theme-picker/theme-picker.transitions.js +62 -0
- package/dist/timer/examples/basic.html +36 -0
- package/dist/timer/examples/card.html +45 -0
- package/dist/timer/examples/compact.html +32 -0
- package/dist/timer/examples/countdown.html +45 -0
- package/dist/timer/examples/labels.html +43 -0
- package/dist/timer/examples/large.html +38 -0
- package/dist/timer/examples/minimal.html +21 -0
- package/dist/timer/examples/pomodoro.html +45 -0
- package/dist/timer/examples/workout.html +47 -0
- package/dist/timer/timer.events.d.ts +18 -0
- package/dist/timer/timer.events.js +1 -0
- package/dist/timer/timer.machine.d.ts +5 -0
- package/dist/timer/timer.machine.js +50 -0
- package/dist/timer/timer.presentation.d.ts +248 -0
- package/dist/timer/timer.presentation.js +265 -0
- package/dist/timer/timer.state.d.ts +29 -0
- package/dist/timer/timer.state.js +64 -0
- package/dist/timer/timer.transitions.d.ts +11 -0
- package/dist/timer/timer.transitions.js +35 -0
- package/dist/toast/examples/action.html +40 -0
- package/dist/toast/examples/basic.html +37 -0
- package/dist/toast/examples/bottomcenter.html +37 -0
- package/dist/toast/examples/bottomleft.html +37 -0
- package/dist/toast/examples/bottomright.html +37 -0
- package/dist/toast/examples/duration.html +36 -0
- package/dist/toast/examples/promise.html +44 -0
- package/dist/toast/examples/topcenter.html +37 -0
- package/dist/toast/examples/topleft.html +37 -0
- package/dist/toast/examples/topright.html +37 -0
- package/dist/toast/examples/types.html +47 -0
- package/dist/toast/examples/updatable.html +8 -0
- package/dist/toast/toast.events.d.ts +60 -0
- package/dist/toast/toast.events.js +1 -0
- package/dist/toast/toast.machine.d.ts +6 -0
- package/dist/toast/toast.machine.js +97 -0
- package/dist/toast/toast.presentation.d.ts +284 -0
- package/dist/toast/toast.presentation.js +532 -0
- package/dist/toast/toast.state.d.ts +65 -0
- package/dist/toast/toast.state.js +88 -0
- package/dist/toast/toast.transitions.d.ts +24 -0
- package/dist/toast/toast.transitions.js +85 -0
- package/dist/toggle-group/examples/basic.html +25 -0
- package/dist/toggle-group/examples/ghost.html +22 -0
- package/dist/toggle-group/examples/icons.html +25 -0
- package/dist/toggle-group/examples/multiple.html +14 -0
- package/dist/toggle-group/examples/outline.html +25 -0
- package/dist/toggle-group/examples/toolbar.html +25 -0
- package/dist/toggle-group/toggle-group.events.d.ts +45 -0
- package/dist/toggle-group/toggle-group.events.js +1 -0
- package/dist/toggle-group/toggle-group.machine.d.ts +5 -0
- package/dist/toggle-group/toggle-group.machine.js +65 -0
- package/dist/toggle-group/toggle-group.presentation.d.ts +112 -0
- package/dist/toggle-group/toggle-group.presentation.js +217 -0
- package/dist/toggle-group/toggle-group.state.d.ts +45 -0
- package/dist/toggle-group/toggle-group.state.js +67 -0
- package/dist/toggle-group/toggle-group.transitions.d.ts +10 -0
- package/dist/toggle-group/toggle-group.transitions.js +9 -0
- package/dist/tooltip/examples/basic.html +13 -0
- package/dist/tooltip/examples/metrics.html +30 -0
- package/dist/tooltip/examples/positioning.html +26 -0
- package/dist/tooltip/examples/status.html +33 -0
- package/dist/tooltip/examples/video.html +22 -0
- package/dist/tooltip/examples/with-arrow.html +14 -0
- package/dist/tooltip/tooltip.controller-def.d.ts +42 -0
- package/dist/tooltip/tooltip.controller-def.js +110 -0
- package/dist/tour/examples/basic.html +67 -0
- package/dist/tour/tour.events.d.ts +32 -0
- package/dist/tour/tour.events.js +1 -0
- package/dist/tour/tour.machine.d.ts +5 -0
- package/dist/tour/tour.machine.js +77 -0
- package/dist/tour/tour.presentation.d.ts +260 -0
- package/dist/tour/tour.presentation.js +272 -0
- package/dist/tour/tour.state.d.ts +43 -0
- package/dist/tour/tour.state.js +60 -0
- package/dist/tour/tour.transitions.d.ts +16 -0
- package/dist/tour/tour.transitions.js +32 -0
- package/dist/tree-view/examples/basic.html +47 -0
- package/dist/tree-view/examples/loading.html +57 -0
- package/dist/tree-view/tree-view.events.d.ts +67 -0
- package/dist/tree-view/tree-view.events.js +1 -0
- package/dist/tree-view/tree-view.machine.d.ts +6 -0
- package/dist/tree-view/tree-view.machine.js +86 -0
- package/dist/tree-view/tree-view.presentation.d.ts +254 -0
- package/dist/tree-view/tree-view.presentation.js +515 -0
- package/dist/tree-view/tree-view.state.d.ts +54 -0
- package/dist/tree-view/tree-view.state.js +61 -0
- package/dist/tree-view/tree-view.transitions.d.ts +30 -0
- package/dist/tree-view/tree-view.transitions.js +107 -0
- package/package.json +245 -4
|
@@ -0,0 +1,746 @@
|
|
|
1
|
+
import { pickOutcome } from "./combobox.state.js";
|
|
2
|
+
import { combobox as combobox$1, isOpenPhase } from "./combobox.machine.js";
|
|
3
|
+
import { ariaControls, ariaHidden, ariaInvalid, ariaLabelledBy, ariaState, comboboxInput, defineComponent, disclosureTrigger, isComposing, listSurface, optionRow } from "@spinjs/runtime";
|
|
4
|
+
// src/combobox/combobox.presentation.ts
|
|
5
|
+
const toRow = (item) => {
|
|
6
|
+
if (typeof item.value !== "string" || item.value.length === 0) return;
|
|
7
|
+
const meta = typeof item.meta === "object" && item.meta !== null && !Array.isArray(item.meta) ? { ...item.meta } : void 0;
|
|
8
|
+
return {
|
|
9
|
+
value: item.value,
|
|
10
|
+
label: typeof item.label === "string" && item.label.length > 0 ? item.label : item.value,
|
|
11
|
+
disabled: item.disabled === true,
|
|
12
|
+
group: typeof item.group === "string" ? item.group : "",
|
|
13
|
+
index: 0,
|
|
14
|
+
meta
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
const toRows = (items) => {
|
|
18
|
+
const rows = [];
|
|
19
|
+
for (const item of items) {
|
|
20
|
+
const row = toRow(item);
|
|
21
|
+
if (row !== void 0) rows.push(row);
|
|
22
|
+
}
|
|
23
|
+
return rows.map((row, index) => ({
|
|
24
|
+
...row,
|
|
25
|
+
index
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
28
|
+
const parseItems = (raw) => {
|
|
29
|
+
if (!Array.isArray(raw)) return [];
|
|
30
|
+
return toRows(raw.filter((item) => typeof item === "object" && item !== null));
|
|
31
|
+
};
|
|
32
|
+
const sameKeys = (a, b) => a.length === b.length && a.every((value, index) => value === b[index]);
|
|
33
|
+
/** Why the input's text moved: the prop channel carries no `src`, so ours
|
|
34
|
+
* names the event that produced the move. */
|
|
35
|
+
const INPUT_REASON = {
|
|
36
|
+
"INPUT.CHANGE": "input-change",
|
|
37
|
+
"INPUT_VALUE.SET": "script",
|
|
38
|
+
"VALUE.SET": "value-set",
|
|
39
|
+
"VALUE.CLEAR": "clear-trigger",
|
|
40
|
+
"ITEM.SELECT": "item-select",
|
|
41
|
+
"ITEM.CLEAR": "item-clear",
|
|
42
|
+
"ITEM.CLICK": "item-select",
|
|
43
|
+
"INPUT.ENTER": "item-select",
|
|
44
|
+
"SELECTED_ITEMS.SYNC": "sync",
|
|
45
|
+
"INPUT.ESCAPE": "escape-key",
|
|
46
|
+
"LAYER.INTERACT_OUTSIDE": "interact-outside"
|
|
47
|
+
};
|
|
48
|
+
/** Why the panel opened or closed: the reasons Zag names, and `script` for
|
|
49
|
+
* everything the host asked for. */
|
|
50
|
+
const OPEN_REASON = {
|
|
51
|
+
"TRIGGER.CLICK": "trigger-click",
|
|
52
|
+
"INPUT.CLICK": "input-click",
|
|
53
|
+
"INPUT.CHANGE": "input-change",
|
|
54
|
+
"INPUT.ARROW_DOWN": "arrow-key",
|
|
55
|
+
"INPUT.ARROW_UP": "arrow-key",
|
|
56
|
+
"INPUT.ENTER": "item-select",
|
|
57
|
+
"ITEM.CLICK": "item-select",
|
|
58
|
+
"LAYER.ESCAPE": "escape-key",
|
|
59
|
+
"LAYER.INTERACT_OUTSIDE": "interact-outside",
|
|
60
|
+
"VALUE.CLEAR": "clear-trigger"
|
|
61
|
+
};
|
|
62
|
+
const rowsCache = /* @__PURE__ */ new WeakMap();
|
|
63
|
+
const rowsOf = (parsed) => {
|
|
64
|
+
const raw = parsed["items"];
|
|
65
|
+
if (!Array.isArray(raw)) return [];
|
|
66
|
+
const hit = rowsCache.get(raw);
|
|
67
|
+
if (hit !== void 0) return hit;
|
|
68
|
+
const built = toRows(raw);
|
|
69
|
+
rowsCache.set(raw, built);
|
|
70
|
+
return built;
|
|
71
|
+
};
|
|
72
|
+
/** Blocks memoized on the rows' identity: the `for` directive iterates this
|
|
73
|
+
* array, and fresh wrappers per read would re-stamp the groups. */
|
|
74
|
+
const blocksCache = /* @__PURE__ */ new WeakMap();
|
|
75
|
+
const blocksOf = (rows) => {
|
|
76
|
+
const hit = blocksCache.get(rows);
|
|
77
|
+
if (hit !== void 0) return hit;
|
|
78
|
+
const built = [];
|
|
79
|
+
let label = null;
|
|
80
|
+
let group = [];
|
|
81
|
+
const flush = () => {
|
|
82
|
+
if (group.length === 0) return;
|
|
83
|
+
built.push({
|
|
84
|
+
id: label ?? `group-${built.length}`,
|
|
85
|
+
label,
|
|
86
|
+
rows: group
|
|
87
|
+
});
|
|
88
|
+
label = null;
|
|
89
|
+
group = [];
|
|
90
|
+
};
|
|
91
|
+
let previous;
|
|
92
|
+
for (const row of rows) {
|
|
93
|
+
if ((row.group ?? "") !== (previous ?? "")) {
|
|
94
|
+
flush();
|
|
95
|
+
label = row.group === void 0 || row.group.length === 0 ? null : row.group;
|
|
96
|
+
previous = row.group;
|
|
97
|
+
}
|
|
98
|
+
group.push(row);
|
|
99
|
+
}
|
|
100
|
+
flush();
|
|
101
|
+
blocksCache.set(rows, built);
|
|
102
|
+
return built;
|
|
103
|
+
};
|
|
104
|
+
/** Zag's `getEventKey`: the only thing `dir` changes is which way the
|
|
105
|
+
* horizontal arrows point. */
|
|
106
|
+
const resolveKey = (event, dir) => {
|
|
107
|
+
if (dir !== "rtl") return event.key;
|
|
108
|
+
if (event.key === "ArrowLeft") return "ArrowRight";
|
|
109
|
+
if (event.key === "ArrowRight") return "ArrowLeft";
|
|
110
|
+
return event.key;
|
|
111
|
+
};
|
|
112
|
+
/**
|
|
113
|
+
* One step through the collection, mirroring Zag's `getNextValue`: the walk
|
|
114
|
+
* starts at the highlighted row's position — so a highlight sitting on a
|
|
115
|
+
* disabled row still moves — skips the disabled rows it passes, and returns
|
|
116
|
+
* null when it runs off the end. With no reference point at all the RAW
|
|
117
|
+
* first (or last) row is the answer, disabled or not.
|
|
118
|
+
*/
|
|
119
|
+
const step = (scope, delta) => {
|
|
120
|
+
const list = scope.context.items;
|
|
121
|
+
if (list.length === 0) return null;
|
|
122
|
+
const current = scope.context.highlightedValue;
|
|
123
|
+
if (current === null) {
|
|
124
|
+
const row = delta > 0 ? list[0] : list[list.length - 1];
|
|
125
|
+
return row === void 0 ? null : row.value;
|
|
126
|
+
}
|
|
127
|
+
const at = list.findIndex((row) => row.value === current);
|
|
128
|
+
const start = at === -1 ? 0 : at;
|
|
129
|
+
for (let index = start + delta; index >= 0 && index < list.length; index += delta) {
|
|
130
|
+
const row = list[index];
|
|
131
|
+
if (row !== void 0 && !row.disabled) return row.value;
|
|
132
|
+
}
|
|
133
|
+
return null;
|
|
134
|
+
};
|
|
135
|
+
/** The collection's extremes, disabled or not. */
|
|
136
|
+
const edge = (scope, from) => {
|
|
137
|
+
const list = scope.context.items;
|
|
138
|
+
const row = from === "first" ? list[0] : list[list.length - 1];
|
|
139
|
+
return row === void 0 ? null : row.value;
|
|
140
|
+
};
|
|
141
|
+
/** The arrow's target: the walk, wrapping only when the host loops. */
|
|
142
|
+
const walked = (scope, delta) => {
|
|
143
|
+
const value = step(scope, delta);
|
|
144
|
+
if (value !== null) return { value };
|
|
145
|
+
if (scope.context.loopFocus !== true) return {};
|
|
146
|
+
const wrapped = edge(scope, delta > 0 ? "first" : "last");
|
|
147
|
+
return wrapped === null ? {} : { value: wrapped };
|
|
148
|
+
};
|
|
149
|
+
const inputKeydown = (scope, event) => {
|
|
150
|
+
if (event.defaultPrevented) return;
|
|
151
|
+
if (scope.context.disabled === true || scope.context.readOnly === true) return;
|
|
152
|
+
if (event.ctrlKey || event.shiftKey || isComposing(event)) return;
|
|
153
|
+
const ctx = scope.context;
|
|
154
|
+
const isOpen = isOpenPhase(scope.state);
|
|
155
|
+
const valueAsString = ctx.value.map((value) => ctx.labels[value]).filter((label) => label !== void 0).join(", ");
|
|
156
|
+
const dir = event.target instanceof Element ? event.target.ownerDocument?.defaultView?.getComputedStyle(event.target).direction : "ltr";
|
|
157
|
+
switch (resolveKey(event, typeof dir === "string" ? dir : "ltr")) {
|
|
158
|
+
case "ArrowDown":
|
|
159
|
+
if (scope.context.openOnKeyPress === false && !isOpen) return;
|
|
160
|
+
event.preventDefault();
|
|
161
|
+
if (event.altKey) {
|
|
162
|
+
scope.send({ type: "OPEN" });
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
scope.send({
|
|
166
|
+
type: "INPUT.ARROW_DOWN",
|
|
167
|
+
keypress: true,
|
|
168
|
+
...isOpen ? walked(scope, 1) : {}
|
|
169
|
+
});
|
|
170
|
+
return;
|
|
171
|
+
case "ArrowUp":
|
|
172
|
+
if (scope.context.openOnKeyPress === false && !isOpen) return;
|
|
173
|
+
event.preventDefault();
|
|
174
|
+
if (event.altKey) {
|
|
175
|
+
scope.send({ type: "CLOSE" });
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
scope.send({
|
|
179
|
+
type: "INPUT.ARROW_UP",
|
|
180
|
+
keypress: true,
|
|
181
|
+
...isOpen ? walked(scope, -1) : {}
|
|
182
|
+
});
|
|
183
|
+
return;
|
|
184
|
+
case "Home": {
|
|
185
|
+
const value = edge(scope, "first");
|
|
186
|
+
scope.send({
|
|
187
|
+
type: "INPUT.HOME",
|
|
188
|
+
keypress: true,
|
|
189
|
+
...isOpen && value !== null ? { value } : {}
|
|
190
|
+
});
|
|
191
|
+
if (isOpen) event.preventDefault();
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
case "End": {
|
|
195
|
+
const value = edge(scope, "last");
|
|
196
|
+
scope.send({
|
|
197
|
+
type: "INPUT.END",
|
|
198
|
+
keypress: true,
|
|
199
|
+
...isOpen && value !== null ? { value } : {}
|
|
200
|
+
});
|
|
201
|
+
if (isOpen) event.preventDefault();
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
case "Escape":
|
|
205
|
+
scope.send({ type: "INPUT.ESCAPE" });
|
|
206
|
+
event.preventDefault();
|
|
207
|
+
return;
|
|
208
|
+
case "Enter": {
|
|
209
|
+
const wasOpen = isOpen;
|
|
210
|
+
const highlighted = ctx.highlightedValue !== null;
|
|
211
|
+
const rejected = ctx.inputValue !== valueAsString && !ctx.allowCustomValue;
|
|
212
|
+
scope.send({ type: "INPUT.ENTER" });
|
|
213
|
+
if (wasOpen && scope.context.alwaysSubmitOnEnter !== true && (highlighted || rejected)) event.preventDefault();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
default: return;
|
|
217
|
+
}
|
|
218
|
+
};
|
|
219
|
+
const rowHandlersByBridge = /* @__PURE__ */ new WeakMap();
|
|
220
|
+
const rowHandlers = (scope, row) => {
|
|
221
|
+
let byRow = rowHandlersByBridge.get(scope.send);
|
|
222
|
+
if (byRow === void 0) {
|
|
223
|
+
byRow = /* @__PURE__ */ new WeakMap();
|
|
224
|
+
rowHandlersByBridge.set(scope.send, byRow);
|
|
225
|
+
}
|
|
226
|
+
const hit = byRow.get(row);
|
|
227
|
+
if (hit !== void 0) return hit;
|
|
228
|
+
const made = {
|
|
229
|
+
onPointerMove: (event) => {
|
|
230
|
+
if (scope.context.disabled === true) return;
|
|
231
|
+
if (row.disabled || event.pointerType !== "mouse") return;
|
|
232
|
+
if (scope.context.highlightedValue === row.value) return;
|
|
233
|
+
scope.send({
|
|
234
|
+
type: "ITEM.POINTER_MOVE",
|
|
235
|
+
value: row.value
|
|
236
|
+
});
|
|
237
|
+
},
|
|
238
|
+
onPointerLeave: () => {
|
|
239
|
+
if (scope.context.disabled === true) return;
|
|
240
|
+
if (row.disabled) return;
|
|
241
|
+
scope.send({ type: "ITEM.POINTER_LEAVE" });
|
|
242
|
+
},
|
|
243
|
+
onClick: (event) => {
|
|
244
|
+
if (event.defaultPrevented) return;
|
|
245
|
+
if (scope.context.disabled === true) return;
|
|
246
|
+
if (row.disabled) return;
|
|
247
|
+
if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
|
|
248
|
+
scope.send({
|
|
249
|
+
type: "ITEM.CLICK",
|
|
250
|
+
value: row.value
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
};
|
|
254
|
+
byRow.set(row, made);
|
|
255
|
+
return made;
|
|
256
|
+
};
|
|
257
|
+
const itemStateOf = (scope, row) => ({
|
|
258
|
+
value: row.value,
|
|
259
|
+
disabled: scope.context.disabled || row.disabled === true,
|
|
260
|
+
highlighted: scope.context.highlightedValue === row.value,
|
|
261
|
+
selected: scope.context.value.includes(row.value)
|
|
262
|
+
});
|
|
263
|
+
/** The component's public state: the names the markup may key on. */
|
|
264
|
+
const def = {
|
|
265
|
+
name: "combobox",
|
|
266
|
+
machine: (props, authored) => combobox$1(props, authored),
|
|
267
|
+
start: (props) => props["open"] === true || props["defaultOpen"] === true ? "suggesting" : "idle",
|
|
268
|
+
establish: (raw, authored) => {
|
|
269
|
+
const highlight = authored("highlightedValue") ? raw["highlightedValue"] : raw["defaultHighlightedValue"];
|
|
270
|
+
if (typeof highlight !== "string" || highlight.length === 0) return [];
|
|
271
|
+
return [{
|
|
272
|
+
type: "HIGHLIGHTED_VALUE.SET",
|
|
273
|
+
value: highlight
|
|
274
|
+
}];
|
|
275
|
+
},
|
|
276
|
+
reconcile: ({ context, state, parsed, authored, send }) => {
|
|
277
|
+
const ctx = context;
|
|
278
|
+
const rows = parseItems(parsed["items"]);
|
|
279
|
+
const order = rows.map((row) => row.value);
|
|
280
|
+
const orderChanged = !sameKeys(ctx.order, order);
|
|
281
|
+
ctx.items = rows;
|
|
282
|
+
if (orderChanged) {
|
|
283
|
+
ctx.order = order;
|
|
284
|
+
ctx.labels = Object.fromEntries(rows.map((row) => [row.value, row.label]));
|
|
285
|
+
if (isOpenPhase(state)) send({ type: "CHILDREN_CHANGE" });
|
|
286
|
+
}
|
|
287
|
+
if (authored("open")) {
|
|
288
|
+
const open = parsed["open"] === true;
|
|
289
|
+
if (open !== isOpenPhase(state)) {
|
|
290
|
+
send({ type: open ? "OPEN" : "CLOSE" });
|
|
291
|
+
return true;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
return orderChanged;
|
|
295
|
+
},
|
|
296
|
+
settled: ({ event, before, after, focus }) => {
|
|
297
|
+
const wasOpen = isOpenPhase(before.state);
|
|
298
|
+
const isOpenNow = isOpenPhase(after.state);
|
|
299
|
+
if (wasOpen !== isOpenNow && (isOpenNow || event.type === "CLOSE")) focus("input");
|
|
300
|
+
},
|
|
301
|
+
parts: {
|
|
302
|
+
root: { attrs: (scope) => {
|
|
303
|
+
const open = isOpenPhase(scope.state);
|
|
304
|
+
return {
|
|
305
|
+
dir: scope.context.dir,
|
|
306
|
+
"data-phase": scope.state,
|
|
307
|
+
"data-state": open ? "open" : "closed",
|
|
308
|
+
"data-disabled": scope.attr(scope.context.disabled === true),
|
|
309
|
+
"data-readonly": scope.attr(scope.context.readOnly === true),
|
|
310
|
+
"use:dismissable": {
|
|
311
|
+
onEscape: () => {
|
|
312
|
+
if (!isOpenPhase(scope.state)) return;
|
|
313
|
+
scope.send({ type: "LAYER.ESCAPE" });
|
|
314
|
+
},
|
|
315
|
+
onOutside: () => {
|
|
316
|
+
if (!isOpenPhase(scope.state)) return;
|
|
317
|
+
scope.send({ type: "LAYER.INTERACT_OUTSIDE" });
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
} },
|
|
322
|
+
label: { attrs: (scope) => ({
|
|
323
|
+
htmlFor: scope.id("input"),
|
|
324
|
+
"data-state": isOpenPhase(scope.state) ? "open" : "closed",
|
|
325
|
+
"data-disabled": scope.attr(scope.context.disabled === true),
|
|
326
|
+
"data-invalid": scope.attr(scope.context.invalid === true),
|
|
327
|
+
"data-required": scope.attr(scope.context.required === true),
|
|
328
|
+
onClick: () => {}
|
|
329
|
+
}) },
|
|
330
|
+
control: { attrs: (scope) => ({
|
|
331
|
+
"data-state": isOpenPhase(scope.state) ? "open" : "closed",
|
|
332
|
+
"data-disabled": scope.attr(scope.context.disabled === true)
|
|
333
|
+
}) },
|
|
334
|
+
positioner: { attrs: (scope) => {
|
|
335
|
+
const _placementRaw = scope.context.placement;
|
|
336
|
+
const placement = typeof _placementRaw === "string" && _placementRaw.length > 0 ? _placementRaw : "bottom";
|
|
337
|
+
return {
|
|
338
|
+
hidden: !isOpenPhase(scope.state),
|
|
339
|
+
"data-state": isOpenPhase(scope.state) ? "open" : "closed",
|
|
340
|
+
"data-placement": placement,
|
|
341
|
+
"data-side": placement.split("-")[0] ?? placement
|
|
342
|
+
};
|
|
343
|
+
} },
|
|
344
|
+
input: { attrs: (scope) => {
|
|
345
|
+
const ctx = scope.context;
|
|
346
|
+
const display = ctx.autofill ?? ctx.inputValue;
|
|
347
|
+
return {
|
|
348
|
+
dir: scope.context.dir,
|
|
349
|
+
type: "text",
|
|
350
|
+
role: "combobox",
|
|
351
|
+
name: scope.context.name,
|
|
352
|
+
form: scope.context.form,
|
|
353
|
+
disabled: scope.context.disabled,
|
|
354
|
+
readOnly: scope.context.readOnly,
|
|
355
|
+
required: scope.context.required,
|
|
356
|
+
placeholder: scope.context.placeholder,
|
|
357
|
+
autoComplete: "off",
|
|
358
|
+
autoCorrect: "off",
|
|
359
|
+
autoCapitalize: "none",
|
|
360
|
+
spellCheck: false,
|
|
361
|
+
value: display,
|
|
362
|
+
...ariaInvalid(ariaState(scope.context.invalid)),
|
|
363
|
+
...comboboxInput(scope, {
|
|
364
|
+
autocomplete: ctx.inputBehavior === "autocomplete" ? "both" : "list",
|
|
365
|
+
controls: { part: "content" },
|
|
366
|
+
expanded: isOpenPhase(scope.state),
|
|
367
|
+
activeDescendant: ctx.highlightedValue === null ? void 0 : {
|
|
368
|
+
part: "item",
|
|
369
|
+
slot: ctx.highlightedValue
|
|
370
|
+
}
|
|
371
|
+
}),
|
|
372
|
+
"data-state": isOpenPhase(scope.state) ? "open" : "closed",
|
|
373
|
+
"data-disabled": scope.attr(scope.context.disabled === true),
|
|
374
|
+
onFocus: () => {
|
|
375
|
+
if (scope.context.disabled === true) return;
|
|
376
|
+
scope.send({ type: "INPUT.FOCUS" });
|
|
377
|
+
},
|
|
378
|
+
onBlur: () => {
|
|
379
|
+
if (scope.context.disabled === true) return;
|
|
380
|
+
scope.send({ type: "INPUT.BLUR" });
|
|
381
|
+
},
|
|
382
|
+
onClick: (event) => {
|
|
383
|
+
if (event.defaultPrevented) return;
|
|
384
|
+
if (scope.context.openOnClick === false) return;
|
|
385
|
+
if (scope.context.disabled === true || scope.context.readOnly === true) return;
|
|
386
|
+
scope.send({ type: "INPUT.CLICK" });
|
|
387
|
+
},
|
|
388
|
+
onInput: (event) => {
|
|
389
|
+
scope.send({
|
|
390
|
+
type: "INPUT.CHANGE",
|
|
391
|
+
value: event.currentTarget.value
|
|
392
|
+
});
|
|
393
|
+
},
|
|
394
|
+
onKeydown: (event) => {
|
|
395
|
+
inputKeydown(scope, event);
|
|
396
|
+
}
|
|
397
|
+
};
|
|
398
|
+
} },
|
|
399
|
+
trigger: { attrs: (scope, arg) => {
|
|
400
|
+
const focusable = typeof arg === "object" && arg !== null && "focusable" in arg && arg.focusable === true;
|
|
401
|
+
const open = isOpenPhase(scope.state);
|
|
402
|
+
return {
|
|
403
|
+
id: scope.id("trigger"),
|
|
404
|
+
type: "button",
|
|
405
|
+
...disclosureTrigger(scope, {
|
|
406
|
+
expanded: open,
|
|
407
|
+
hasPopup: scope.context.composite !== false ? "listbox" : "dialog",
|
|
408
|
+
controls: open ? { part: "content" } : void 0
|
|
409
|
+
}),
|
|
410
|
+
"aria-label": scope.context.triggerLabel,
|
|
411
|
+
disabled: scope.context.disabled,
|
|
412
|
+
tabIndex: focusable ? void 0 : -1,
|
|
413
|
+
"data-state": open ? "open" : "closed",
|
|
414
|
+
"data-focusable": scope.attr(focusable),
|
|
415
|
+
"data-disabled": scope.attr(scope.context.disabled === true),
|
|
416
|
+
onFocus: () => {
|
|
417
|
+
if (!focusable) return;
|
|
418
|
+
scope.send({ type: "INPUT.FOCUS" });
|
|
419
|
+
},
|
|
420
|
+
onClick: (event) => {
|
|
421
|
+
if (event.defaultPrevented) return;
|
|
422
|
+
if (scope.context.disabled === true || scope.context.readOnly === true) return;
|
|
423
|
+
if (event.button !== 0) return;
|
|
424
|
+
scope.send({ type: "TRIGGER.CLICK" });
|
|
425
|
+
},
|
|
426
|
+
onPointerDown: (event) => {
|
|
427
|
+
if (scope.context.disabled === true || scope.context.readOnly === true) return;
|
|
428
|
+
if (event.pointerType === "touch") return;
|
|
429
|
+
if (event.button !== 0) return;
|
|
430
|
+
event.preventDefault();
|
|
431
|
+
},
|
|
432
|
+
onKeydown: (event) => {
|
|
433
|
+
if (event.defaultPrevented) return;
|
|
434
|
+
if (scope.context.composite !== false) return;
|
|
435
|
+
if (scope.context.disabled === true || scope.context.readOnly === true) return;
|
|
436
|
+
const key = resolveKey(event, event.target instanceof Element && event.target.ownerDocument?.defaultView?.getComputedStyle(event.target).direction === "rtl" ? "rtl" : "ltr");
|
|
437
|
+
if (key !== "ArrowDown" && key !== "ArrowUp") return;
|
|
438
|
+
event.preventDefault();
|
|
439
|
+
scope.send({ type: key === "ArrowDown" ? "INPUT.ARROW_DOWN" : "INPUT.ARROW_UP" });
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
} },
|
|
443
|
+
triggerIndicator: { attrs: (scope) => ({
|
|
444
|
+
...ariaHidden(true),
|
|
445
|
+
"data-state": isOpenPhase(scope.state) ? "open" : "closed"
|
|
446
|
+
}) },
|
|
447
|
+
clearTrigger: { attrs: (scope) => ({
|
|
448
|
+
id: scope.id("clearTrigger"),
|
|
449
|
+
type: "button",
|
|
450
|
+
"aria-label": scope.context.clearTriggerLabel,
|
|
451
|
+
...ariaControls(scope, { part: "input" }),
|
|
452
|
+
disabled: scope.context.disabled,
|
|
453
|
+
tabIndex: -1,
|
|
454
|
+
"data-state": isOpenPhase(scope.state) ? "open" : "closed",
|
|
455
|
+
"data-disabled": scope.attr(scope.context.disabled === true),
|
|
456
|
+
hidden: scope.context.value.length === 0,
|
|
457
|
+
onPointerDown: (event) => {
|
|
458
|
+
if (event.button !== 0) return;
|
|
459
|
+
event.preventDefault();
|
|
460
|
+
},
|
|
461
|
+
onClick: (event) => {
|
|
462
|
+
if (event.defaultPrevented) return;
|
|
463
|
+
if (scope.context.disabled === true || scope.context.readOnly === true) return;
|
|
464
|
+
scope.send({ type: "VALUE.CLEAR" });
|
|
465
|
+
}
|
|
466
|
+
}) },
|
|
467
|
+
content: { attrs: (scope) => {
|
|
468
|
+
const ctx = scope.context;
|
|
469
|
+
const _placementRaw = scope.context.placement;
|
|
470
|
+
const placement = typeof _placementRaw === "string" && _placementRaw.length > 0 ? _placementRaw : "bottom";
|
|
471
|
+
const rows = scope.context.items;
|
|
472
|
+
return {
|
|
473
|
+
dir: scope.context.dir,
|
|
474
|
+
role: scope.context.composite !== false ? "listbox" : "dialog",
|
|
475
|
+
tabIndex: -1,
|
|
476
|
+
...listSurface(scope, {
|
|
477
|
+
labelledBy: { part: "label" },
|
|
478
|
+
multiSelectable: scope.context.composite !== false && ctx.multiple ? true : void 0
|
|
479
|
+
}),
|
|
480
|
+
"data-state": isOpenPhase(scope.state) ? "open" : "closed",
|
|
481
|
+
"data-placement": placement,
|
|
482
|
+
"data-side": placement.split("-")[0] ?? placement,
|
|
483
|
+
"data-empty": scope.attr(rows.length === 0),
|
|
484
|
+
"data-disabled": scope.attr(scope.context.disabled === true),
|
|
485
|
+
onPointerDown: (event) => {
|
|
486
|
+
if (event.button !== 0) return;
|
|
487
|
+
event.preventDefault();
|
|
488
|
+
},
|
|
489
|
+
"use:scroll-into-view": { activeId: () => {
|
|
490
|
+
const highlighted = scope.context.highlightedValue;
|
|
491
|
+
if (!isOpenPhase(scope.state) || highlighted === null) return "";
|
|
492
|
+
return scope.id("item", highlighted);
|
|
493
|
+
} }
|
|
494
|
+
};
|
|
495
|
+
} },
|
|
496
|
+
list: { attrs: (scope) => {
|
|
497
|
+
const ctx = scope.context;
|
|
498
|
+
const composite = scope.context.composite !== false;
|
|
499
|
+
return {
|
|
500
|
+
role: composite ? void 0 : "listbox",
|
|
501
|
+
...listSurface(scope, {
|
|
502
|
+
labelledBy: { part: "label" },
|
|
503
|
+
multiSelectable: composite ? void 0 : ctx.multiple ? true : void 0
|
|
504
|
+
}),
|
|
505
|
+
"data-empty": scope.attr(scope.context.items.length === 0)
|
|
506
|
+
};
|
|
507
|
+
} }
|
|
508
|
+
},
|
|
509
|
+
slots: {
|
|
510
|
+
item: {
|
|
511
|
+
id: "item",
|
|
512
|
+
indexes: (context) => context.items,
|
|
513
|
+
attrs: (scope) => {
|
|
514
|
+
const row = scope.slot;
|
|
515
|
+
const state = itemStateOf(scope, row);
|
|
516
|
+
return {
|
|
517
|
+
id: scope.id("item", row.value),
|
|
518
|
+
role: "option",
|
|
519
|
+
tabIndex: -1,
|
|
520
|
+
"data-value": row.value,
|
|
521
|
+
...optionRow({
|
|
522
|
+
selected: state.selected,
|
|
523
|
+
disabled: state.disabled ? true : void 0
|
|
524
|
+
}),
|
|
525
|
+
"data-highlighted": scope.attr(state.highlighted),
|
|
526
|
+
"data-selected": scope.attr(state.selected),
|
|
527
|
+
"data-disabled": scope.attr(state.disabled),
|
|
528
|
+
...rowHandlers(scope, row)
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
itemText: {
|
|
533
|
+
indexes: (context) => context.items,
|
|
534
|
+
attrs: (scope) => {
|
|
535
|
+
const state = itemStateOf(scope, scope.slot);
|
|
536
|
+
return {
|
|
537
|
+
"data-selected": scope.attr(state.selected),
|
|
538
|
+
"data-highlighted": scope.attr(state.highlighted),
|
|
539
|
+
"data-disabled": scope.attr(state.disabled)
|
|
540
|
+
};
|
|
541
|
+
}
|
|
542
|
+
},
|
|
543
|
+
itemIndicator: {
|
|
544
|
+
indexes: (context) => context.items,
|
|
545
|
+
attrs: (scope) => {
|
|
546
|
+
const selected = itemStateOf(scope, scope.slot).selected;
|
|
547
|
+
return {
|
|
548
|
+
...ariaHidden(true),
|
|
549
|
+
"data-selected": scope.attr(selected),
|
|
550
|
+
hidden: !selected
|
|
551
|
+
};
|
|
552
|
+
}
|
|
553
|
+
},
|
|
554
|
+
itemGroup: {
|
|
555
|
+
id: "item-group",
|
|
556
|
+
indexes: (context) => blocksOf(context.items),
|
|
557
|
+
attrs: (scope) => {
|
|
558
|
+
const block = scope.slot;
|
|
559
|
+
return {
|
|
560
|
+
id: scope.id("itemGroup", block.id),
|
|
561
|
+
role: "group",
|
|
562
|
+
...ariaLabelledBy(scope, {
|
|
563
|
+
part: "itemGroupLabel",
|
|
564
|
+
slot: block.id
|
|
565
|
+
}),
|
|
566
|
+
"data-empty": scope.attr(scope.context.items.length === 0)
|
|
567
|
+
};
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
itemGroupLabel: {
|
|
571
|
+
id: "item-group-label",
|
|
572
|
+
indexes: (context) => blocksOf(context.items),
|
|
573
|
+
attrs: (scope) => {
|
|
574
|
+
const block = scope.slot;
|
|
575
|
+
return {
|
|
576
|
+
id: scope.id("itemGroupLabel", block.id),
|
|
577
|
+
role: "presentation",
|
|
578
|
+
hidden: block.label === null
|
|
579
|
+
};
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
},
|
|
583
|
+
commands: {
|
|
584
|
+
syncSelectedItems: { event: () => ({ type: "SELECTED_ITEMS.SYNC" }) },
|
|
585
|
+
setHighlightValue: { event: (args) => {
|
|
586
|
+
const v = args[0];
|
|
587
|
+
return {
|
|
588
|
+
type: "HIGHLIGHTED_VALUE.SET",
|
|
589
|
+
value: typeof v === "string" ? v : null
|
|
590
|
+
};
|
|
591
|
+
} },
|
|
592
|
+
clearHighlightValue: { event: () => ({ type: "HIGHLIGHTED_VALUE.CLEAR" }) },
|
|
593
|
+
selectValue: { event: (args) => {
|
|
594
|
+
const v = args[0];
|
|
595
|
+
return {
|
|
596
|
+
type: "ITEM.SELECT",
|
|
597
|
+
value: typeof v === "string" ? v : ""
|
|
598
|
+
};
|
|
599
|
+
} },
|
|
600
|
+
setValue: { event: (args) => {
|
|
601
|
+
const v = args[0];
|
|
602
|
+
return {
|
|
603
|
+
type: "VALUE.SET",
|
|
604
|
+
value: Array.isArray(v) && v.every((x) => typeof x === "string") ? [...v] : []
|
|
605
|
+
};
|
|
606
|
+
} },
|
|
607
|
+
setInputValue: { event: (args) => {
|
|
608
|
+
const v = args[0];
|
|
609
|
+
return {
|
|
610
|
+
type: "INPUT_VALUE.SET",
|
|
611
|
+
value: typeof v === "string" ? v : ""
|
|
612
|
+
};
|
|
613
|
+
} },
|
|
614
|
+
clearValue: { event: (args) => args[0] === void 0 ? { type: "VALUE.CLEAR" } : (() => {
|
|
615
|
+
const v = args[0];
|
|
616
|
+
return {
|
|
617
|
+
type: "ITEM.CLEAR",
|
|
618
|
+
value: typeof v === "string" ? v : ""
|
|
619
|
+
};
|
|
620
|
+
})() },
|
|
621
|
+
focus: { view: ({ focus }) => focus("input") },
|
|
622
|
+
setOpen: { event: ([open]) => ({ type: open ? "OPEN" : "CLOSE" }) }
|
|
623
|
+
},
|
|
624
|
+
readers: {
|
|
625
|
+
open: { read: (_context, state) => isOpenPhase(state) },
|
|
626
|
+
focused: { read: (_context, state) => state !== "idle" },
|
|
627
|
+
inputValue: { read: (context) => {
|
|
628
|
+
const ctx = context;
|
|
629
|
+
return ctx.autofill ?? ctx.inputValue;
|
|
630
|
+
} },
|
|
631
|
+
highlightedValue: { read: (context) => context.highlightedValue },
|
|
632
|
+
highlightedItem: { read: (context) => {
|
|
633
|
+
const ctx = context;
|
|
634
|
+
if (ctx.highlightedValue === null) return null;
|
|
635
|
+
return ctx.items.find((row) => row.value === ctx.highlightedValue) ?? null;
|
|
636
|
+
} },
|
|
637
|
+
value: { read: (context) => [...context.value] },
|
|
638
|
+
valueAsString: { read: (context) => {
|
|
639
|
+
const ctx = context;
|
|
640
|
+
return ctx.value.map((value) => ctx.labels[value]).filter((label) => label !== void 0).join(", ");
|
|
641
|
+
} },
|
|
642
|
+
hasSelectedItems: { read: (context) => context.value.length > 0 },
|
|
643
|
+
selectedItems: { read: (context) => {
|
|
644
|
+
const ctx = context;
|
|
645
|
+
const rows = ctx.items;
|
|
646
|
+
return ctx.value.map((value) => rows.find((row) => row.value === value)).filter((row) => row !== void 0);
|
|
647
|
+
} },
|
|
648
|
+
multiple: { read: (context) => context.multiple },
|
|
649
|
+
invalid: { read: (context) => context.invalid },
|
|
650
|
+
disabled: { read: (context) => context.disabled },
|
|
651
|
+
empty: { read: (context) => context.items.length === 0 }
|
|
652
|
+
},
|
|
653
|
+
methods: {
|
|
654
|
+
getBlocks: { call: (context) => blocksOf(context.items) },
|
|
655
|
+
getRows: { call: (_context, _state, args) => {
|
|
656
|
+
const block = args[0];
|
|
657
|
+
if (typeof block !== "object" || block === null || !("rows" in block) || !Array.isArray(block.rows)) return [];
|
|
658
|
+
return block.rows.filter((row) => typeof row === "object" && row !== null);
|
|
659
|
+
} },
|
|
660
|
+
getItemState: { call: (context, _state, [row]) => {
|
|
661
|
+
return {
|
|
662
|
+
value: row.value,
|
|
663
|
+
disabled: context.disabled || row.disabled === true,
|
|
664
|
+
highlighted: context.highlightedValue === row.value,
|
|
665
|
+
selected: context.value.includes(row.value)
|
|
666
|
+
};
|
|
667
|
+
} }
|
|
668
|
+
},
|
|
669
|
+
events: {
|
|
670
|
+
"value-change": {
|
|
671
|
+
prop: "onValueChange",
|
|
672
|
+
watch: (context) => [...context.value],
|
|
673
|
+
detail: (watched, _event, props) => {
|
|
674
|
+
const rows = props === void 0 ? [] : rowsOf(props);
|
|
675
|
+
const value = watched;
|
|
676
|
+
return {
|
|
677
|
+
value: [...value],
|
|
678
|
+
items: value.map((item) => rows.find((row) => row.value === item)).filter((row) => row !== void 0)
|
|
679
|
+
};
|
|
680
|
+
}
|
|
681
|
+
},
|
|
682
|
+
"highlight-change": {
|
|
683
|
+
prop: "onHighlightChange",
|
|
684
|
+
watch: (context) => [context.highlightedValue],
|
|
685
|
+
detail: (watched, _event, props) => {
|
|
686
|
+
const highlighted = watched[0];
|
|
687
|
+
const rows = props === void 0 ? [] : rowsOf(props);
|
|
688
|
+
return {
|
|
689
|
+
highlightedValue: highlighted,
|
|
690
|
+
highlightedItem: highlighted === null ? null : rows.find((row) => row.value === highlighted) ?? null
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
},
|
|
694
|
+
"input-value-change": {
|
|
695
|
+
prop: "onInputValueChange",
|
|
696
|
+
watch: (context) => [context.inputValue],
|
|
697
|
+
detail: (watched, event) => ({
|
|
698
|
+
inputValue: watched[0],
|
|
699
|
+
reason: (event !== void 0 ? INPUT_REASON[event.type] : void 0) ?? "script"
|
|
700
|
+
})
|
|
701
|
+
},
|
|
702
|
+
"open-change": {
|
|
703
|
+
prop: "onOpenChange",
|
|
704
|
+
watch: (_context, state) => [isOpenPhase(state)],
|
|
705
|
+
detail: (watched, event, _props, context) => ({
|
|
706
|
+
open: watched[0],
|
|
707
|
+
reason: (event !== void 0 ? OPEN_REASON[event.type] : void 0) ?? "script",
|
|
708
|
+
value: [...context !== void 0 && Array.isArray(context.value) ? context.value : []]
|
|
709
|
+
})
|
|
710
|
+
},
|
|
711
|
+
select: {
|
|
712
|
+
prop: "onSelect",
|
|
713
|
+
watch: (context) => [...context.value],
|
|
714
|
+
detail: (watched) => ({
|
|
715
|
+
value: [...watched],
|
|
716
|
+
itemValue: ""
|
|
717
|
+
}),
|
|
718
|
+
select: (event, before, after) => {
|
|
719
|
+
const beforeCtx = before;
|
|
720
|
+
const afterCtx = after;
|
|
721
|
+
let outcome = null;
|
|
722
|
+
let itemValue = "";
|
|
723
|
+
if (event.type === "ITEM.SELECT" || event.type === "ITEM.CLICK") {
|
|
724
|
+
const ev = event["value"];
|
|
725
|
+
if (typeof ev !== "string") return null;
|
|
726
|
+
outcome = pickOutcome(beforeCtx, ev);
|
|
727
|
+
itemValue = ev;
|
|
728
|
+
} else if (event.type === "INPUT.ENTER") {
|
|
729
|
+
const highlighted = beforeCtx.highlightedValue;
|
|
730
|
+
if (highlighted === null || !beforeCtx.order.includes(highlighted)) return null;
|
|
731
|
+
outcome = pickOutcome(beforeCtx, highlighted);
|
|
732
|
+
itemValue = highlighted;
|
|
733
|
+
}
|
|
734
|
+
if (outcome === null || !sameKeys(outcome, afterCtx.value)) return null;
|
|
735
|
+
return {
|
|
736
|
+
value: [...outcome],
|
|
737
|
+
itemValue
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
};
|
|
743
|
+
const combobox = defineComponent(def);
|
|
744
|
+
export { combobox, def };
|
|
745
|
+
|
|
746
|
+
//# sourceMappingURL=combobox.presentation.js.map
|