igniteui-webcomponents 7.3.0-beta.0 → 7.3.0
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/CHANGELOG.md +23 -0
- package/animations/player.d.ts +7 -2
- package/animations/player.js +1 -2
- package/animations/player.js.map +1 -1
- package/components/accordion/accordion.js +4 -16
- package/components/accordion/accordion.js.map +1 -1
- package/components/avatar/avatar.d.ts +0 -1
- package/components/avatar/avatar.js +5 -9
- package/components/avatar/avatar.js.map +1 -1
- package/components/badge/badge.d.ts +1 -3
- package/components/badge/badge.js +4 -8
- package/components/badge/badge.js.map +1 -1
- package/components/banner/banner.d.ts +6 -5
- package/components/banner/banner.js +19 -17
- package/components/banner/banner.js.map +1 -1
- package/components/button/button-base.d.ts +1 -1
- package/components/button/button-base.js.map +1 -1
- package/components/button-group/button-group.d.ts +0 -1
- package/components/button-group/button-group.js +12 -17
- package/components/button-group/button-group.js.map +1 -1
- package/components/calendar/base.d.ts +3 -13
- package/components/calendar/base.js +10 -31
- package/components/calendar/base.js.map +1 -1
- package/components/calendar/calendar.d.ts +2 -2
- package/components/calendar/months-view/months-view.d.ts +1 -1
- package/components/calendar/months-view/months-view.js.map +1 -1
- package/components/carousel/carousel-indicator.d.ts +1 -1
- package/components/carousel/carousel-indicator.js +13 -13
- package/components/carousel/carousel-indicator.js.map +1 -1
- package/components/carousel/carousel-slide.d.ts +0 -2
- package/components/carousel/carousel-slide.js +7 -9
- package/components/carousel/carousel-slide.js.map +1 -1
- package/components/carousel/carousel.d.ts +52 -35
- package/components/carousel/carousel.js +136 -122
- package/components/carousel/carousel.js.map +1 -1
- package/components/carousel/themes/carousel.base.css.js +1 -1
- package/components/carousel/themes/carousel.base.css.js.map +1 -1
- package/components/chat/chat-input.d.ts +1 -1
- package/components/chat/chat-input.js +21 -21
- package/components/chat/chat-input.js.map +1 -1
- package/components/chat/chat.d.ts +0 -2
- package/components/chat/chat.js +6 -12
- package/components/chat/chat.js.map +1 -1
- package/components/checkbox/checkbox-base.d.ts +1 -1
- package/components/checkbox/checkbox.d.ts +3 -5
- package/components/checkbox/checkbox.js +33 -44
- package/components/checkbox/checkbox.js.map +1 -1
- package/components/checkbox/switch.d.ts +1 -1
- package/components/checkbox/switch.js +23 -34
- package/components/checkbox/switch.js.map +1 -1
- package/components/chip/chip.d.ts +1 -14
- package/components/chip/chip.js +12 -33
- package/components/chip/chip.js.map +1 -1
- package/components/color-picker/color-picker.d.ts +261 -0
- package/components/color-picker/color-picker.js +620 -0
- package/components/color-picker/color-picker.js.map +1 -0
- package/components/color-picker/common.d.ts +37 -0
- package/components/color-picker/common.js +55 -0
- package/components/color-picker/common.js.map +1 -0
- package/components/color-picker/converters.d.ts +18 -0
- package/components/color-picker/converters.js +173 -0
- package/components/color-picker/converters.js.map +1 -0
- package/components/color-picker/model.d.ts +120 -0
- package/components/color-picker/model.js +174 -0
- package/components/color-picker/model.js.map +1 -0
- package/components/color-picker/picker-canvas.d.ts +95 -0
- package/components/color-picker/picker-canvas.js +154 -0
- package/components/color-picker/picker-canvas.js.map +1 -0
- package/components/color-picker/themes/color-picker.base.css.d.ts +1 -0
- package/components/color-picker/themes/color-picker.base.css.js +3 -0
- package/components/color-picker/themes/color-picker.base.css.js.map +1 -0
- package/components/color-picker/themes/dark/color-picker.bootstrap.css.d.ts +1 -0
- package/components/color-picker/themes/dark/color-picker.bootstrap.css.js +3 -0
- package/components/color-picker/themes/dark/color-picker.bootstrap.css.js.map +1 -0
- package/components/color-picker/themes/dark/color-picker.fluent.css.d.ts +1 -0
- package/components/color-picker/themes/dark/color-picker.fluent.css.js +3 -0
- package/components/color-picker/themes/dark/color-picker.fluent.css.js.map +1 -0
- package/components/color-picker/themes/dark/color-picker.indigo.css.d.ts +1 -0
- package/components/color-picker/themes/dark/color-picker.indigo.css.js +3 -0
- package/components/color-picker/themes/dark/color-picker.indigo.css.js.map +1 -0
- package/components/color-picker/themes/dark/color-picker.material.css.d.ts +1 -0
- package/components/color-picker/themes/dark/color-picker.material.css.js +3 -0
- package/components/color-picker/themes/dark/color-picker.material.css.js.map +1 -0
- package/components/color-picker/themes/light/color-picker.bootstrap.css.d.ts +1 -0
- package/components/color-picker/themes/light/color-picker.bootstrap.css.js +3 -0
- package/components/color-picker/themes/light/color-picker.bootstrap.css.js.map +1 -0
- package/components/color-picker/themes/light/color-picker.fluent.css.d.ts +1 -0
- package/components/color-picker/themes/light/color-picker.fluent.css.js +3 -0
- package/components/color-picker/themes/light/color-picker.fluent.css.js.map +1 -0
- package/components/color-picker/themes/light/color-picker.indigo.css.d.ts +1 -0
- package/components/color-picker/themes/light/color-picker.indigo.css.js +3 -0
- package/components/color-picker/themes/light/color-picker.indigo.css.js.map +1 -0
- package/components/color-picker/themes/light/color-picker.material.css.d.ts +1 -0
- package/components/color-picker/themes/light/color-picker.material.css.js +3 -0
- package/components/color-picker/themes/light/color-picker.material.css.js.map +1 -0
- package/components/color-picker/themes/light/color-picker.shared.css.d.ts +1 -0
- package/components/color-picker/themes/light/color-picker.shared.css.js +3 -0
- package/components/color-picker/themes/light/color-picker.shared.css.js.map +1 -0
- package/components/color-picker/themes/picker-canvas.base.css.d.ts +1 -0
- package/components/color-picker/themes/picker-canvas.base.css.js +3 -0
- package/components/color-picker/themes/picker-canvas.base.css.js.map +1 -0
- package/components/color-picker/themes/shared/color-picker.bootstrap.css.d.ts +1 -0
- package/components/color-picker/themes/shared/color-picker.bootstrap.css.js +3 -0
- package/components/color-picker/themes/shared/color-picker.bootstrap.css.js.map +1 -0
- package/components/color-picker/themes/shared/color-picker.common.css.d.ts +1 -0
- package/components/color-picker/themes/shared/color-picker.common.css.js +3 -0
- package/components/color-picker/themes/shared/color-picker.common.css.js.map +1 -0
- package/components/color-picker/themes/shared/color-picker.fluent.css.d.ts +1 -0
- package/components/color-picker/themes/shared/color-picker.fluent.css.js +3 -0
- package/components/color-picker/themes/shared/color-picker.fluent.css.js.map +1 -0
- package/components/color-picker/themes/shared/color-picker.indigo.css.d.ts +1 -0
- package/components/color-picker/themes/shared/color-picker.indigo.css.js +3 -0
- package/components/color-picker/themes/shared/color-picker.indigo.css.js.map +1 -0
- package/components/color-picker/themes/shared/color-picker.material.css.d.ts +1 -0
- package/components/color-picker/themes/shared/color-picker.material.css.js +3 -0
- package/components/color-picker/themes/shared/color-picker.material.css.js.map +1 -0
- package/components/color-picker/themes/themes.d.ts +2 -0
- package/components/color-picker/themes/themes.js +50 -0
- package/components/color-picker/themes/themes.js.map +1 -0
- package/components/color-picker/validators.d.ts +3 -0
- package/components/color-picker/validators.js +5 -0
- package/components/color-picker/validators.js.map +1 -0
- package/components/combo/combo-item.d.ts +1 -3
- package/components/combo/combo-item.js +5 -12
- package/components/combo/combo-item.js.map +1 -1
- package/components/combo/combo.d.ts +7 -20
- package/components/combo/combo.js +59 -81
- package/components/combo/combo.js.map +1 -1
- package/components/date-picker/date-picker.base.d.ts +12 -9
- package/components/date-picker/date-picker.base.js +24 -31
- package/components/date-picker/date-picker.base.js.map +1 -1
- package/components/date-picker/date-picker.d.ts +1 -1
- package/components/date-picker/date-picker.js +3 -5
- package/components/date-picker/date-picker.js.map +1 -1
- package/components/date-range-picker/date-range-input.d.ts +2 -4
- package/components/date-range-picker/date-range-input.js +6 -37
- package/components/date-range-picker/date-range-input.js.map +1 -1
- package/components/date-range-picker/date-range-picker.d.ts +2 -5
- package/components/date-range-picker/date-range-picker.js +15 -28
- package/components/date-range-picker/date-range-picker.js.map +1 -1
- package/components/date-range-picker/predefined-ranges-area.d.ts +2 -2
- package/components/date-range-picker/predefined-ranges-area.js +4 -6
- package/components/date-range-picker/predefined-ranges-area.js.map +1 -1
- package/components/date-range-picker/validators.d.ts +1 -1
- package/components/date-range-picker/validators.js +5 -18
- package/components/date-range-picker/validators.js.map +1 -1
- package/components/date-time-input/date-part.d.ts +2 -1
- package/components/date-time-input/date-part.js +38 -75
- package/components/date-time-input/date-part.js.map +1 -1
- package/components/date-time-input/date-time-input.base.d.ts +31 -12
- package/components/date-time-input/date-time-input.base.js +43 -11
- package/components/date-time-input/date-time-input.base.js.map +1 -1
- package/components/date-time-input/date-time-input.d.ts +1 -3
- package/components/date-time-input/date-time-input.js +7 -40
- package/components/date-time-input/date-time-input.js.map +1 -1
- package/components/date-time-input/datetime-mask-parser.d.ts +8 -0
- package/components/date-time-input/datetime-mask-parser.js +8 -8
- package/components/date-time-input/datetime-mask-parser.js.map +1 -1
- package/components/date-time-input/validators.js +3 -14
- package/components/date-time-input/validators.js.map +1 -1
- package/components/dialog/dialog.d.ts +6 -7
- package/components/dialog/dialog.js +21 -26
- package/components/dialog/dialog.js.map +1 -1
- package/components/divider/divider.d.ts +1 -4
- package/components/divider/divider.js +8 -17
- package/components/divider/divider.js.map +1 -1
- package/components/dropdown/dropdown-group.js +1 -6
- package/components/dropdown/dropdown-group.js.map +1 -1
- package/components/expansion-panel/expansion-panel.d.ts +15 -5
- package/components/expansion-panel/expansion-panel.js +23 -34
- package/components/expansion-panel/expansion-panel.js.map +1 -1
- package/components/file-input/file-input.d.ts +2 -14
- package/components/file-input/file-input.js +5 -23
- package/components/file-input/file-input.js.map +1 -1
- package/components/highlight/highlight.d.ts +6 -8
- package/components/highlight/highlight.js +12 -20
- package/components/highlight/highlight.js.map +1 -1
- package/components/icon/icon-references.js +1 -0
- package/components/icon/icon-references.js.map +1 -1
- package/components/icon/icon.d.ts +1 -1
- package/components/icon/internal-icons-lib.js +3 -0
- package/components/icon/internal-icons-lib.js.map +1 -1
- package/components/icon/registry/types.d.ts +1 -1
- package/components/icon/registry/types.js.map +1 -1
- package/components/input/input.d.ts +9 -19
- package/components/input/input.js +30 -60
- package/components/input/input.js.map +1 -1
- package/components/input/themes/shared/input.material.css.js +1 -1
- package/components/input/themes/shared/input.material.css.js.map +1 -1
- package/components/mask-input/mask-input.d.ts +1 -1
- package/components/mask-input/mask-input.js +2 -4
- package/components/mask-input/mask-input.js.map +1 -1
- package/components/nav-drawer/nav-drawer.d.ts +7 -7
- package/components/nav-drawer/nav-drawer.js +12 -23
- package/components/nav-drawer/nav-drawer.js.map +1 -1
- package/components/progress/base.d.ts +4 -7
- package/components/progress/base.js +21 -45
- package/components/progress/base.js.map +1 -1
- package/components/qr-code/qr-code.d.ts +1 -1
- package/components/qr-code/qr-code.js +3 -2
- package/components/qr-code/qr-code.js.map +1 -1
- package/components/qr-code/types.d.ts +1 -1
- package/components/qr-code/types.js.map +1 -1
- package/components/radio/controller.d.ts +2 -30
- package/components/radio/controller.js +8 -94
- package/components/radio/controller.js.map +1 -1
- package/components/radio/radio.d.ts +5 -5
- package/components/radio/radio.js +48 -58
- package/components/radio/radio.js.map +1 -1
- package/components/radio-group/radio-group.d.ts +1 -2
- package/components/radio-group/radio-group.js +2 -9
- package/components/radio-group/radio-group.js.map +1 -1
- package/components/rating/rating.d.ts +24 -12
- package/components/rating/rating.js +79 -73
- package/components/rating/rating.js.map +1 -1
- package/components/resize-container/default-ghost.js +4 -3
- package/components/resize-container/default-ghost.js.map +1 -1
- package/components/resize-container/resize-container.d.ts +1 -1
- package/components/resize-container/resize-container.js +5 -3
- package/components/resize-container/resize-container.js.map +1 -1
- package/components/resize-container/resize-controller.js +4 -3
- package/components/resize-container/resize-controller.js.map +1 -1
- package/components/select/select-group.d.ts +2 -1
- package/components/select/select-group.js +7 -11
- package/components/select/select-group.js.map +1 -1
- package/components/select/select.d.ts +3 -4
- package/components/select/select.js +23 -28
- package/components/select/select.js.map +1 -1
- package/components/slider/range-slider.d.ts +3 -2
- package/components/slider/range-slider.js +22 -70
- package/components/slider/range-slider.js.map +1 -1
- package/components/slider/slider-base.d.ts +9 -6
- package/components/slider/slider-base.js +27 -28
- package/components/slider/slider-base.js.map +1 -1
- package/components/slider/slider.js +9 -5
- package/components/slider/slider.js.map +1 -1
- package/components/splitter/splitter.d.ts +1 -1
- package/components/splitter/splitter.js.map +1 -1
- package/components/stepper/step.d.ts +3 -0
- package/components/stepper/step.js +9 -5
- package/components/stepper/step.js.map +1 -1
- package/components/stepper/stepper.d.ts +0 -11
- package/components/stepper/stepper.js +21 -86
- package/components/stepper/stepper.js.map +1 -1
- package/components/tabs/tab.d.ts +1 -1
- package/components/tabs/tab.js +6 -5
- package/components/tabs/tab.js.map +1 -1
- package/components/tabs/tabs.d.ts +1 -5
- package/components/tabs/tabs.js +12 -34
- package/components/tabs/tabs.js.map +1 -1
- package/components/textarea/textarea.d.ts +6 -7
- package/components/textarea/textarea.js +3 -10
- package/components/textarea/textarea.js.map +1 -1
- package/components/theme-provider/theme-provider.d.ts +2 -4
- package/components/theme-provider/theme-provider.js +11 -21
- package/components/theme-provider/theme-provider.js.map +1 -1
- package/components/tile-manager/tile-manager.d.ts +10 -21
- package/components/tile-manager/tile-manager.js +43 -74
- package/components/tile-manager/tile-manager.js.map +1 -1
- package/components/tile-manager/tile.d.ts +10 -18
- package/components/tile-manager/tile.js +50 -67
- package/components/tile-manager/tile.js.map +1 -1
- package/components/tooltip/tooltip.d.ts +4 -7
- package/components/tooltip/tooltip.js +20 -28
- package/components/tooltip/tooltip.js.map +1 -1
- package/components/tree/tree.d.ts +1 -14
- package/components/tree/tree.js +5 -23
- package/components/tree/tree.js.map +1 -1
- package/components/tree/tree.navigation.d.ts +1 -1
- package/components/tree/tree.navigation.js.map +1 -1
- package/components/types.d.ts +2 -0
- package/components/types.js.map +1 -1
- package/components/validation-container/validation-container.d.ts +1 -2
- package/components/validation-container/validation-container.js.map +1 -1
- package/components/virtualization/engine.d.ts +40 -38
- package/components/virtualization/engine.js.map +1 -1
- package/components/virtualization/types.d.ts +6 -5
- package/components/virtualization/types.js.map +1 -1
- package/components/virtualization/virtualization.d.ts +94 -80
- package/components/virtualization/virtualization.js +10 -2
- package/components/virtualization/virtualization.js.map +1 -1
- package/custom-elements.json +31948 -26708
- package/igniteui-webcomponents.css-data.json +1 -1
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/internals/controllers/aria-projection.d.ts +6 -6
- package/internals/controllers/aria-projection.js.map +1 -1
- package/internals/controllers/context-provider.d.ts +48 -0
- package/internals/controllers/context-provider.js +29 -0
- package/internals/controllers/context-provider.js.map +1 -0
- package/internals/controllers/drag.js +6 -6
- package/internals/controllers/drag.js.map +1 -1
- package/internals/controllers/gestures.js +3 -0
- package/internals/controllers/gestures.js.map +1 -1
- package/internals/controllers/group.d.ts +64 -0
- package/internals/controllers/group.js +104 -0
- package/internals/controllers/group.js.map +1 -0
- package/internals/controllers/internals.d.ts +16 -3
- package/internals/controllers/internals.js +10 -3
- package/internals/controllers/internals.js.map +1 -1
- package/internals/controllers/key-bindings.d.ts +6 -0
- package/internals/controllers/key-bindings.js +3 -0
- package/internals/controllers/key-bindings.js.map +1 -1
- package/internals/controllers/roving-focus.d.ts +72 -0
- package/internals/controllers/roving-focus.js +61 -0
- package/internals/controllers/roving-focus.js.map +1 -0
- package/internals/controllers/slot.d.ts +8 -0
- package/internals/controllers/slot.js +4 -0
- package/internals/controllers/slot.js.map +1 -1
- package/internals/controllers/toggle.d.ts +96 -0
- package/internals/controllers/toggle.js +65 -0
- package/internals/controllers/toggle.js.map +1 -0
- package/internals/date/converters.js +2 -5
- package/internals/date/converters.js.map +1 -1
- package/internals/date/model.d.ts +4 -0
- package/internals/date/model.js +6 -0
- package/internals/date/model.js.map +1 -1
- package/internals/decorators/coerced-property.d.ts +47 -0
- package/internals/decorators/coerced-property.js +36 -0
- package/internals/decorators/coerced-property.js.map +1 -0
- package/internals/definitions/defineAllComponents.js +2 -0
- package/internals/definitions/defineAllComponents.js.map +1 -1
- package/internals/i18n/i18n-controller.d.ts +22 -3
- package/internals/i18n/i18n-controller.js +28 -6
- package/internals/i18n/i18n-controller.js.map +1 -1
- package/internals/mixins/alert.d.ts +1 -1
- package/internals/mixins/alert.js +5 -3
- package/internals/mixins/alert.js.map +1 -1
- package/internals/mixins/combo-box.d.ts +3 -12
- package/internals/mixins/combo-box.js +6 -32
- package/internals/mixins/combo-box.js.map +1 -1
- package/internals/mixins/forms/associated.js +18 -0
- package/internals/mixins/forms/associated.js.map +1 -1
- package/internals/mixins/forms/types.d.ts +20 -1
- package/internals/mixins/forms/types.js.map +1 -1
- package/internals/mixins/i18n.d.ts +31 -0
- package/internals/mixins/i18n.js +36 -0
- package/internals/mixins/i18n.js.map +1 -0
- package/internals/mixins/mask-behavior.d.ts +6 -5
- package/internals/mixins/mask-behavior.js +1 -2
- package/internals/mixins/mask-behavior.js.map +1 -1
- package/internals/mixins/option.js +4 -2
- package/internals/mixins/option.js.map +1 -1
- package/internals/templates/masked-input.d.ts +1 -1
- package/internals/templates/masked-input.js.map +1 -1
- package/internals/templates/slotted-icon.d.ts +32 -0
- package/internals/templates/slotted-icon.js +19 -0
- package/internals/templates/slotted-icon.js.map +1 -0
- package/internals/templates/toggle-shell.d.ts +46 -0
- package/internals/templates/toggle-shell.js +38 -0
- package/internals/templates/toggle-shell.js.map +1 -0
- package/internals/timing.d.ts +32 -0
- package/internals/timing.js +20 -0
- package/internals/timing.js.map +1 -0
- package/internals/utils/arrays.d.ts +2 -2
- package/internals/utils/arrays.js.map +1 -1
- package/internals/utils/dom.d.ts +22 -0
- package/internals/utils/dom.js +15 -1
- package/internals/utils/dom.js.map +1 -1
- package/internals/utils/math.d.ts +1 -1
- package/internals/utils/math.js.map +1 -1
- package/internals/utils/types.d.ts +1 -1
- package/internals/utils/types.js.map +1 -1
- package/internals/validators.d.ts +23 -0
- package/internals/validators.js +21 -0
- package/internals/validators.js.map +1 -1
- package/package.json +3 -1
- package/theming/theming-controller.d.ts +3 -3
- package/theming/theming-controller.js.map +1 -1
- package/web-types.json +2 -2
- package/internals/decorators/watch.d.ts +0 -5
- package/internals/decorators/watch.js +0 -19
- package/internals/decorators/watch.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EA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E,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAGnD;AAaD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAGnD;AAYM;IADN,QAAQ,EAAE;oDACS;AASb;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDACrB","sourcesContent":["import { html, LitElement, nothing, type PropertyValues } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { EaseOut } from '#animations/easings.js';\nimport { addAnimationController } from '#animations/player.js';\nimport { fadeOut } from '#animations/presets/fade/index.js';\nimport { scaleInCenter } from '#animations/presets/scale/index.js';\nimport { addInternalsController } from '#internals/controllers/internals.js';\nimport { addSlotController, setSlots } from '#internals/controllers/slot.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport type { Constructor } from '#internals/mixins/constructor.js';\nimport { EventEmitterMixin } from '#internals/mixins/event-emitter.js';\nimport { partMap } from '#internals/part-map.js';\nimport { isElement, isLTR } from '#internals/utils/dom.js';\nimport { asNumber } from '#internals/utils/math.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport IgcIconComponent from '../icon/icon.js';\nimport IgcPopoverComponent, {\n type PopoverPlacement,\n} from '../popover/popover.js';\nimport { addTooltipController } from './controller.js';\nimport { styles as shared } from './themes/shared/tooltip.common.css.js';\nimport { all } from './themes/themes.js';\nimport { styles } from './themes/tooltip.base.css.js';\n\nexport interface IgcTooltipComponentEventMap {\n igcOpening: CustomEvent<void>;\n igcOpened: CustomEvent<void>;\n igcClosing: CustomEvent<void>;\n igcClosed: CustomEvent<void>;\n}\n\n/** Additional offset applied to the arrow element for aligned placements. */\nconst ARROW_OFFSET = 8;\n\ntype TooltipStateOptions = {\n show: boolean;\n withDelay?: boolean;\n withEvents?: boolean;\n};\n\n/**\n * Provides a way to display supplementary information related to an element when a user interacts with it (e.g., hover, focus).\n * It offers features such as placement customization, delays, sticky mode, and animations.\n *\n * @element igc-tooltip\n *\n * @slot - Default slot of the tooltip component.\n * @slot close-button - Slot for custom sticky-mode close action (e.g., an icon/button).\n *\n * @csspart base - The wrapping container of the tooltip content.\n * @csspart simple-text - The container where the message property of the tooltip is rendered.\n * @csspart close-button - The default sticky-mode close button.\n *\n * @fires igcOpening - Emitted before the tooltip begins to open. Can be canceled to prevent opening.\n * @fires igcOpened - Emitted after the tooltip has successfully opened and is visible.\n * @fires igcClosing - Emitted before the tooltip begins to close. Can be canceled to prevent closing.\n * @fires igcClosed - Emitted after the tooltip has been fully removed from view.\n */\nexport default class IgcTooltipComponent extends EventEmitterMixin<\n IgcTooltipComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-tooltip';\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(\n IgcTooltipComponent,\n IgcPopoverComponent,\n IgcIconComponent\n );\n }\n\n private readonly _internals = addInternalsController(this, {\n initialARIA: {\n role: 'tooltip',\n ariaAtomic: 'true',\n ariaLive: 'polite',\n },\n });\n\n private readonly _controller = addTooltipController(this, {\n onShow: () => this._showOnInteraction(),\n onHide: () => this._hideOnInteraction(),\n onEscape: () => this._hideOnEscape(),\n onClick: () => this._cancelTransition(),\n // The controller dropped the anchor the tooltip is bound to.\n onReset: () => this._cancelTransition(false),\n });\n\n private readonly _containerRef = createRef<HTMLElement>();\n private readonly _player = addAnimationController(this, this._containerRef);\n private readonly _slots = addSlotController(this, {\n slots: setSlots('close-button'),\n });\n\n private readonly _showAnimation = scaleInCenter({\n duration: 150,\n easing: EaseOut.Quad,\n });\n\n private readonly _hideAnimation = fadeOut({\n duration: 75,\n easing: EaseOut.Sine,\n });\n\n /** The queued, not yet committed transition, if a delay is in effect. */\n private _pending?: {\n timer: ReturnType<typeof setTimeout>;\n resolve: (value: boolean) => void;\n };\n\n /** A commit that finishes with a stale id has been superseded. */\n private _transitionId = 0;\n\n private _animating = false;\n\n /**\n * The state the tooltip is heading to. A show commits `open` upfront so the\n * popover renders; a hide commits it only once its animation is done.\n */\n private _requestedState = false;\n\n private _showDelay = 200;\n private _hideDelay = 300;\n\n @query('igc-popover', true)\n private readonly _popover!: IgcPopoverComponent;\n\n @query('#arrow')\n private readonly _arrowElement!: HTMLElement;\n\n private get _arrowOffset(): number {\n const [side, alignment] = this.placement.split('-');\n\n if (!alignment) {\n return 0;\n }\n\n const offset = alignment === 'start' ? -ARROW_OFFSET : ARROW_OFFSET;\n const isHorizontal = side === 'left' || side === 'right';\n\n // Only the vertical placements follow the writing direction.\n return isHorizontal || isLTR(this) ? offset : -offset;\n }\n\n /**\n * Whether the consumer projected anything into the default slot. Queried\n * without flattening, which would report the rendered `message` - the slot's\n * own fallback content - as if it came from the consumer.\n */\n private get _hasProjectedContent(): boolean {\n return this._slots\n .getAssignedNodes('[default]')\n .some(\n (node) =>\n isElement(node) ||\n (node.nodeType === Node.TEXT_NODE &&\n Boolean(node.textContent?.trim()))\n );\n }\n\n /**\n * Whether the tooltip is showing.\n *\n * @attr open\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public set open(value: boolean) {\n this._requestedState = value;\n this._controller.open = value;\n }\n\n public get open(): boolean {\n return this._controller.open;\n }\n\n /**\n * Whether to render an arrow indicator for the tooltip.\n *\n * @attr with-arrow\n * @default false\n */\n @property({ type: Boolean, reflect: true, attribute: 'with-arrow' })\n public withArrow = false;\n\n /**\n * The offset of the tooltip from the anchor in pixels.\n *\n * @attr offset\n * @default 6\n */\n @property({ type: Number })\n public offset = 6;\n\n /**\n * Where to place the tooltip relative to its anchor element.\n *\n * @attr placement\n * @default bottom\n */\n @property()\n public placement: PopoverPlacement = 'bottom';\n\n /**\n * An element instance or an IDREF to use as the anchor for the tooltip.\n *\n * @remarks\n * Trying to bind to an IDREF that does not exist in the current DOM root will not work.\n * In such scenarios, it is better to get a DOM reference and pass it to the tooltip instance.\n *\n * @attr anchor\n */\n @property()\n public anchor?: Element | string;\n\n /**\n * Which event triggers will show the tooltip.\n * Expects a comma separated string of different event triggers.\n *\n * @attr show-triggers\n * @default pointerenter,focusin\n */\n @property({ attribute: 'show-triggers' })\n public set showTriggers(value: string) {\n this._controller.showTriggers = value;\n }\n\n public get showTriggers(): string {\n return this._controller.showTriggers;\n }\n\n /**\n * Which event triggers will hide the tooltip.\n * Expects a comma separated string of different event triggers.\n *\n * @attr hide-triggers\n * @default pointerleave,click,focusout\n */\n @property({ attribute: 'hide-triggers' })\n public set hideTriggers(value: string) {\n this._controller.hideTriggers = value;\n }\n\n public get hideTriggers(): string {\n return this._controller.hideTriggers;\n }\n\n /**\n * Specifies the number of milliseconds that should pass before showing the tooltip.\n *\n * @attr show-delay\n * @default 200\n */\n @property({ attribute: 'show-delay', type: Number })\n public set showDelay(value: number) {\n this._showDelay = Math.max(0, asNumber(value));\n }\n\n public get showDelay(): number {\n return this._showDelay;\n }\n\n /**\n * Specifies the number of milliseconds that should pass before hiding the tooltip.\n *\n * @attr hide-delay\n * @default 300\n */\n @property({ attribute: 'hide-delay', type: Number })\n public set hideDelay(value: number) {\n this._hideDelay = Math.max(0, asNumber(value));\n }\n\n public get hideDelay(): number {\n return this._hideDelay;\n }\n\n /**\n * Specifies plain text as the tooltip content.\n *\n * @attr message\n */\n @property()\n public message = '';\n\n /**\n * Specifies if the tooltip remains visible until the user closes it via the close button or Esc key.\n *\n * @attr sticky\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public sticky = false;\n\n constructor() {\n super();\n addThemingController(this, all);\n }\n\n protected override firstUpdated(): void {\n if (this.open) {\n this.updateComplete.then(() => {\n this._player.playExclusive(this._showAnimation);\n });\n }\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n // The arrow is created by the render that just committed, so the popover\n // can only be handed it afterwards.\n if (changedProperties.has('withArrow')) {\n this._popover.arrow = this.withArrow ? this._arrowElement : null;\n }\n }\n\n protected override willUpdate(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('anchor')) {\n this._controller.resolveAnchor(this.anchor);\n }\n\n if (changedProperties.has('sticky')) {\n this._internals.setARIA({ role: this.sticky ? 'status' : 'tooltip' });\n }\n }\n\n private _emitEvent(name: keyof IgcTooltipComponentEventMap): boolean {\n return this.emitEvent(name, {\n cancelable: name === 'igcOpening' || name === 'igcClosing',\n });\n }\n\n /**\n * Invalidates the queued and/or running transition, resolving a delayed one\n * with `false`. The caller must settle the state it left behind.\n *\n * @returns Whether the aborted transition was mid-animation.\n */\n private _abortTransition(): boolean {\n const wasAnimating = this._animating;\n\n this._transitionId++;\n this._animating = false;\n\n clearTimeout(this._pending?.timer);\n this._pending?.resolve(false);\n this._pending = undefined;\n\n return wasAnimating;\n }\n\n /** Lands the tooltip on `state` after its transition was aborted. */\n private _settleState(state: boolean, wasAnimating: boolean): void {\n this._requestedState = state;\n\n if (wasAnimating) {\n this._player.cancelAll();\n this.inert = false;\n }\n\n // Via the accessor - it drives the reflection and the render.\n if (this.open !== state) {\n this.open = state;\n }\n }\n\n /**\n * Drops a queued or running transition and settles on `state`, by default\n * the state the tooltip is already committed to.\n */\n private _cancelTransition(state = this.open): void {\n this._settleState(state, this._abortTransition());\n }\n\n private async _applyTooltipState({\n show,\n withDelay = false,\n withEvents = false,\n }: TooltipStateOptions): Promise<boolean> {\n if (show === this._requestedState) {\n return false;\n }\n\n // Supersede whatever transition is queued or already running.\n const wasAnimating = this._abortTransition();\n this._requestedState = show;\n\n // A superseded transition that never animated leaves the tooltip already\n // in the requested state.\n if (show === this.open && !wasAnimating) {\n return false;\n }\n\n // Vetoed - the first guard proves we were at `!show`.\n if (withEvents && !this._emitEvent(show ? 'igcOpening' : 'igcClosing')) {\n this._settleState(!show, wasAnimating);\n return false;\n }\n\n const id = this._transitionId;\n\n const commitStateChange = async () => {\n if (show) {\n this.open = true;\n }\n\n // Make the tooltip ignore most interactions while the animation\n // is running. In the rare case when the popover overlaps its anchor\n // this will prevent looping between the anchor and tooltip handlers.\n this.inert = true;\n this._animating = true;\n\n const animationComplete = await this._player.playExclusive(\n show ? this._showAnimation : this._hideAnimation\n );\n\n // Superseded while animating - the newer transition owns the state now.\n if (id !== this._transitionId) {\n return false;\n }\n\n this._animating = false;\n this.inert = false;\n this.open = show;\n\n if (animationComplete && withEvents) {\n this._emitEvent(show ? 'igcOpened' : 'igcClosed');\n }\n\n return animationComplete;\n };\n\n if (!withDelay) {\n return commitStateChange();\n }\n\n return new Promise<boolean>((resolve) => {\n const timer = setTimeout(\n () => {\n this._pending = undefined;\n commitStateChange().then(resolve);\n },\n show ? this.showDelay : this.hideDelay\n );\n\n this._pending = { timer, resolve };\n });\n }\n\n /**\n * Shows the tooltip if not already showing.\n * If a target is provided, sets it as a transient anchor.\n *\n * @remarks\n * Bypasses `showDelay` and does not emit `igcOpening`/`igcOpened`.\n * Resolves with whether the tooltip transitioned to a shown state.\n */\n public async show(target?: Element | string): Promise<boolean> {\n if (target) {\n this._cancelTransition();\n this._controller.setAnchor(target, true);\n }\n\n return await this._applyTooltipState({ show: true });\n }\n\n /**\n * Hides the tooltip if not already hidden.\n *\n * @remarks\n * Bypasses `hideDelay` and does not emit `igcClosing`/`igcClosed`.\n * Resolves with whether the tooltip transitioned to a hidden state.\n */\n public async hide(): Promise<boolean> {\n return await this._applyTooltipState({ show: false });\n }\n\n /**\n * Toggles the tooltip between shown/hidden state.\n *\n * @remarks\n * Resolves with whether the tooltip transitioned to the opposite state.\n */\n public async toggle(): Promise<boolean> {\n return await (this.open ? this.hide() : this.show());\n }\n\n protected _showWithEvent(): Promise<boolean> {\n return this._applyTooltipState({\n show: true,\n withDelay: true,\n withEvents: true,\n });\n }\n\n protected _hideWithEvent(): Promise<boolean> {\n return this._applyTooltipState({\n show: false,\n withDelay: true,\n withEvents: true,\n });\n }\n\n private _showOnInteraction(): void {\n this._cancelTransition();\n this._showWithEvent();\n }\n\n private _hideOnInteraction(): void {\n if (!this.sticky) {\n this._hideWithEvent();\n }\n }\n\n /** Sticky mode close action - closes without waiting out `hideDelay`. */\n private _hideOnCloseClick(): void {\n this._applyTooltipState({ show: false, withEvents: true });\n }\n\n private async _hideOnEscape(): Promise<void> {\n // `hide()` is silent, so announce the close here - if there was one.\n if (await this.hide()) {\n this._emitEvent('igcClosed');\n }\n }\n\n protected override render() {\n const parts = {\n base: true,\n 'simple-text': !this._hasProjectedContent,\n };\n\n return html`\n <igc-popover\n .inert=${!this.open}\n .placement=${this.placement}\n .offset=${this.offset}\n .anchor=${this._controller.anchor ?? undefined}\n .arrowOffset=${this._arrowOffset}\n .shiftPadding=${8}\n ?open=${this.open}\n flip\n shift\n >\n <div ${ref(this._containerRef)} part=${partMap(parts)}>\n <slot>${this.message}</slot>\n ${\n this.sticky\n ? html`\n <slot name=\"close-button\" @click=${this._hideOnCloseClick}>\n <button\n type=\"button\"\n part=\"close-button\"\n aria-label=\"Close\"\n >\n <igc-icon\n name=\"input_clear\"\n collection=\"default\"\n aria-hidden=\"true\"\n ></igc-icon>\n </button>\n </slot>\n `\n : nothing\n }\n ${this.withArrow ? html`<div id=\"arrow\"></div>` : nothing}\n </div>\n </igc-popover>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tooltip': IgcTooltipComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../src/components/tooltip/tooltip.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC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D,CAAC;IACJ,CAAC;;AAtbgB;IADhB,KAAK,CAAC,aAAa,EAAE,IAAI,CAAC;qDACqB;AAG/B;IADhB,KAAK,CAAC,QAAQ,CAAC;0DAC6B;AAuC7C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAI1C;AAaM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;sDAC3C;AASlB;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDACT;AASX;IADN,QAAQ,EAAE;sDACmC;AAYvC;IADN,QAAQ,EAAE;mDACsB;AAUjC;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;uDAGxC;AAcD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;uDAGxC;AAcM;IAFN,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACnD,eAAe,CAAC,mBAAmB,CAAC,MAAM,CAAC;sDACrB;AAUhB;IAFN,QAAQ,CAAC,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IACnD,eAAe,CAAC,mBAAmB,CAAC,MAAM,CAAC;sDACrB;AAQhB;IADN,QAAQ,EAAE;oDACS;AASb;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDACrB","sourcesContent":["import { html, LitElement, nothing, type PropertyValues } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { createRef, ref } from 'lit/directives/ref.js';\nimport { EaseOut } from '#animations/easings.js';\nimport { addAnimationController } from '#animations/player.js';\nimport { fadeOut } from '#animations/presets/fade/index.js';\nimport { scaleInCenter } from '#animations/presets/scale/index.js';\nimport { addInternalsController } from '#internals/controllers/internals.js';\nimport { addSlotController, setSlots } from '#internals/controllers/slot.js';\nimport {\n coercedProperty,\n type CoercedPropertyConfig,\n} from '#internals/decorators/coerced-property.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport type { Constructor } from '#internals/mixins/constructor.js';\nimport { EventEmitterMixin } from '#internals/mixins/event-emitter.js';\nimport { partMap } from '#internals/part-map.js';\nimport { isElement, isLTR } from '#internals/utils/dom.js';\nimport { asNumber } from '#internals/utils/math.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport IgcIconComponent from '../icon/icon.js';\nimport IgcPopoverComponent, {\n type PopoverPlacement,\n} from '../popover/popover.js';\nimport { addTooltipController } from './controller.js';\nimport { styles as shared } from './themes/shared/tooltip.common.css.js';\nimport { all } from './themes/themes.js';\nimport { styles } from './themes/tooltip.base.css.js';\n\nexport interface IgcTooltipComponentEventMap {\n igcOpening: CustomEvent<void>;\n igcOpened: CustomEvent<void>;\n igcClosing: CustomEvent<void>;\n igcClosed: CustomEvent<void>;\n}\n\n/** Additional offset applied to the arrow element for aligned placements. */\nconst ARROW_OFFSET = 8;\n\ntype TooltipStateOptions = {\n show: boolean;\n withDelay?: boolean;\n withEvents?: boolean;\n};\n\n/**\n * Provides a way to display supplementary information related to an element when a user interacts with it (e.g., hover, focus).\n * It offers features such as placement customization, delays, sticky mode, and animations.\n *\n * @element igc-tooltip\n *\n * @slot - Default slot of the tooltip component.\n * @slot close-button - Slot for custom sticky-mode close action (e.g., an icon/button).\n *\n * @csspart base - The wrapping container of the tooltip content.\n * @csspart simple-text - The container where the message property of the tooltip is rendered.\n * @csspart close-button - The default sticky-mode close button.\n *\n * @fires igcOpening - Emitted before the tooltip begins to open. Can be canceled to prevent opening.\n * @fires igcOpened - Emitted after the tooltip has successfully opened and is visible.\n * @fires igcClosing - Emitted before the tooltip begins to close. Can be canceled to prevent closing.\n * @fires igcClosed - Emitted after the tooltip has been fully removed from view.\n */\nexport default class IgcTooltipComponent extends EventEmitterMixin<\n IgcTooltipComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-tooltip';\n public static styles = [styles, shared];\n\n /** Shared config for the delay properties - a negative delay is no delay. */\n private static readonly _delay: CoercedPropertyConfig<\n number,\n IgcTooltipComponent\n > = {\n transform: ({ value }) => Math.max(0, asNumber(value)),\n };\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(\n IgcTooltipComponent,\n IgcPopoverComponent,\n IgcIconComponent\n );\n }\n\n private readonly _controller = addTooltipController(this, {\n onShow: () => this._showOnInteraction(),\n onHide: () => this._hideOnInteraction(),\n onEscape: () => this._hideOnEscape(),\n onClick: () => this._cancelTransition(),\n // The controller dropped the anchor the tooltip is bound to.\n onReset: () => this._cancelTransition(false),\n });\n\n private readonly _containerRef = createRef<HTMLElement>();\n private readonly _player = addAnimationController(this, this._containerRef);\n private readonly _slots = addSlotController(this, {\n slots: setSlots('close-button'),\n });\n\n private readonly _showAnimation = scaleInCenter({\n duration: 150,\n easing: EaseOut.Quad,\n });\n\n private readonly _hideAnimation = fadeOut({\n duration: 75,\n easing: EaseOut.Sine,\n });\n\n /** The queued, not yet committed transition, if a delay is in effect. */\n private _pending?: {\n timer: ReturnType<typeof setTimeout>;\n resolve: (value: boolean) => void;\n };\n\n /** A commit that finishes with a stale id has been superseded. */\n private _transitionId = 0;\n\n private _animating = false;\n\n /**\n * The state the tooltip is heading to. A show commits `open` upfront so the\n * popover renders; a hide commits it only once its animation is done.\n */\n private _requestedState = false;\n\n @query('igc-popover', true)\n private readonly _popover!: IgcPopoverComponent;\n\n @query('#arrow')\n private readonly _arrowElement!: HTMLElement;\n\n private get _arrowOffset(): number {\n const [side, alignment] = this.placement.split('-');\n\n if (!alignment) {\n return 0;\n }\n\n const offset = alignment === 'start' ? -ARROW_OFFSET : ARROW_OFFSET;\n const isHorizontal = side === 'left' || side === 'right';\n\n // Only the vertical placements follow the writing direction.\n return isHorizontal || isLTR(this) ? offset : -offset;\n }\n\n /**\n * Whether the consumer projected anything into the default slot. Queried\n * without flattening, which would report the rendered `message` - the slot's\n * own fallback content - as if it came from the consumer.\n */\n private get _hasProjectedContent(): boolean {\n return this._slots\n .getAssignedNodes('[default]')\n .some(\n (node) =>\n isElement(node) ||\n (node.nodeType === Node.TEXT_NODE &&\n Boolean(node.textContent?.trim()))\n );\n }\n\n /**\n * Whether the tooltip is showing.\n *\n * @attr open\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public set open(value: boolean) {\n this._requestedState = value;\n this._controller.open = value;\n }\n\n public get open(): boolean {\n return this._controller.open;\n }\n\n /**\n * Whether to render an arrow indicator for the tooltip.\n *\n * @attr with-arrow\n * @default false\n */\n @property({ type: Boolean, reflect: true, attribute: 'with-arrow' })\n public withArrow = false;\n\n /**\n * The offset of the tooltip from the anchor in pixels.\n *\n * @attr offset\n * @default 6\n */\n @property({ type: Number })\n public offset = 6;\n\n /**\n * Where to place the tooltip relative to its anchor element.\n *\n * @attr placement\n * @default bottom\n */\n @property()\n public placement: PopoverPlacement = 'bottom';\n\n /**\n * An element instance or an IDREF to use as the anchor for the tooltip.\n *\n * @remarks\n * Trying to bind to an IDREF that does not exist in the current DOM root will not work.\n * In such scenarios, it is better to get a DOM reference and pass it to the tooltip instance.\n *\n * @attr anchor\n */\n @property()\n public anchor?: Element | string;\n\n /**\n * Which event triggers will show the tooltip.\n * Expects a comma separated string of different event triggers.\n *\n * @attr show-triggers\n * @default pointerenter,focusin\n */\n @property({ attribute: 'show-triggers' })\n public set showTriggers(value: string) {\n this._controller.showTriggers = value;\n }\n\n public get showTriggers(): string {\n return this._controller.showTriggers;\n }\n\n /**\n * Which event triggers will hide the tooltip.\n * Expects a comma separated string of different event triggers.\n *\n * @attr hide-triggers\n * @default pointerleave,click,focusout\n */\n @property({ attribute: 'hide-triggers' })\n public set hideTriggers(value: string) {\n this._controller.hideTriggers = value;\n }\n\n public get hideTriggers(): string {\n return this._controller.hideTriggers;\n }\n\n /**\n * Specifies the number of milliseconds that should pass before showing the tooltip.\n *\n * @attr show-delay\n * @default 200\n */\n @property({ attribute: 'show-delay', type: Number })\n @coercedProperty(IgcTooltipComponent._delay)\n public showDelay = 200;\n\n /**\n * Specifies the number of milliseconds that should pass before hiding the tooltip.\n *\n * @attr hide-delay\n * @default 300\n */\n @property({ attribute: 'hide-delay', type: Number })\n @coercedProperty(IgcTooltipComponent._delay)\n public hideDelay = 300;\n\n /**\n * Specifies plain text as the tooltip content.\n *\n * @attr message\n */\n @property()\n public message = '';\n\n /**\n * Specifies if the tooltip remains visible until the user closes it via the close button or Esc key.\n *\n * @attr sticky\n * @default false\n */\n @property({ type: Boolean, reflect: true })\n public sticky = false;\n\n constructor() {\n super();\n addThemingController(this, all);\n\n addInternalsController(this, {\n initialARIA: {\n role: 'tooltip',\n ariaAtomic: 'true',\n ariaLive: 'polite',\n },\n aria: () => ({ role: this.sticky ? 'status' : 'tooltip' }),\n });\n }\n\n protected override firstUpdated(): void {\n if (this.open) {\n this.updateComplete.then(() => {\n this._player.playExclusive(this._showAnimation);\n });\n }\n }\n\n protected override updated(changedProperties: PropertyValues<this>): void {\n // The arrow is created by the render that just committed, so the popover\n // can only be handed it afterwards.\n if (changedProperties.has('withArrow')) {\n this._popover.arrow = this.withArrow ? this._arrowElement : null;\n }\n }\n\n protected override willUpdate(changedProperties: PropertyValues<this>): void {\n if (changedProperties.has('anchor')) {\n this._controller.resolveAnchor(this.anchor);\n }\n }\n\n private _emitEvent(name: keyof IgcTooltipComponentEventMap): boolean {\n return this.emitEvent(name, {\n cancelable: name === 'igcOpening' || name === 'igcClosing',\n });\n }\n\n /**\n * Invalidates the queued and/or running transition, resolving a delayed one\n * with `false`. The caller must settle the state it left behind.\n *\n * @returns Whether the aborted transition was mid-animation.\n */\n private _abortTransition(): boolean {\n const wasAnimating = this._animating;\n\n this._transitionId++;\n this._animating = false;\n\n clearTimeout(this._pending?.timer);\n this._pending?.resolve(false);\n this._pending = undefined;\n\n return wasAnimating;\n }\n\n /** Lands the tooltip on `state` after its transition was aborted. */\n private _settleState(state: boolean, wasAnimating: boolean): void {\n this._requestedState = state;\n\n if (wasAnimating) {\n this._player.cancelAll();\n this.inert = false;\n }\n\n // Via the accessor - it drives the reflection and the render.\n if (this.open !== state) {\n this.open = state;\n }\n }\n\n /**\n * Drops a queued or running transition and settles on `state`, by default\n * the state the tooltip is already committed to.\n */\n private _cancelTransition(state = this.open): void {\n this._settleState(state, this._abortTransition());\n }\n\n private async _applyTooltipState({\n show,\n withDelay = false,\n withEvents = false,\n }: TooltipStateOptions): Promise<boolean> {\n if (show === this._requestedState) {\n return false;\n }\n\n // Supersede whatever transition is queued or already running.\n const wasAnimating = this._abortTransition();\n this._requestedState = show;\n\n // A superseded transition that never animated leaves the tooltip already\n // in the requested state.\n if (show === this.open && !wasAnimating) {\n return false;\n }\n\n // Vetoed - the first guard proves we were at `!show`.\n if (withEvents && !this._emitEvent(show ? 'igcOpening' : 'igcClosing')) {\n this._settleState(!show, wasAnimating);\n return false;\n }\n\n const id = this._transitionId;\n\n const commitStateChange = async () => {\n if (show) {\n this.open = true;\n }\n\n // Make the tooltip ignore most interactions while the animation\n // is running. In the rare case when the popover overlaps its anchor\n // this will prevent looping between the anchor and tooltip handlers.\n this.inert = true;\n this._animating = true;\n\n const animationComplete = await this._player.playExclusive(\n show ? this._showAnimation : this._hideAnimation\n );\n\n // Superseded while animating - the newer transition owns the state now.\n if (id !== this._transitionId) {\n return false;\n }\n\n this._animating = false;\n this.inert = false;\n this.open = show;\n\n if (animationComplete && withEvents) {\n this._emitEvent(show ? 'igcOpened' : 'igcClosed');\n }\n\n return animationComplete;\n };\n\n if (!withDelay) {\n return commitStateChange();\n }\n\n return new Promise<boolean>((resolve) => {\n const timer = setTimeout(\n () => {\n this._pending = undefined;\n commitStateChange().then(resolve);\n },\n show ? this.showDelay : this.hideDelay\n );\n\n this._pending = { timer, resolve };\n });\n }\n\n /**\n * Shows the tooltip if not already showing.\n * If a target is provided, sets it as a transient anchor.\n *\n * @remarks\n * Bypasses `showDelay` and does not emit `igcOpening`/`igcOpened`.\n * Resolves with whether the tooltip transitioned to a shown state.\n */\n public async show(target?: Element | string): Promise<boolean> {\n if (target) {\n this._cancelTransition();\n this._controller.setAnchor(target, true);\n }\n\n return await this._applyTooltipState({ show: true });\n }\n\n /**\n * Hides the tooltip if not already hidden.\n *\n * @remarks\n * Bypasses `hideDelay` and does not emit `igcClosing`/`igcClosed`.\n * Resolves with whether the tooltip transitioned to a hidden state.\n */\n public async hide(): Promise<boolean> {\n return await this._applyTooltipState({ show: false });\n }\n\n /**\n * Toggles the tooltip between shown/hidden state.\n *\n * @remarks\n * Resolves with whether the tooltip transitioned to the opposite state.\n */\n public async toggle(): Promise<boolean> {\n return await (this.open ? this.hide() : this.show());\n }\n\n protected _showWithEvent(): Promise<boolean> {\n return this._applyTooltipState({\n show: true,\n withDelay: true,\n withEvents: true,\n });\n }\n\n protected _hideWithEvent(): Promise<boolean> {\n return this._applyTooltipState({\n show: false,\n withDelay: true,\n withEvents: true,\n });\n }\n\n private _showOnInteraction(): void {\n this._cancelTransition();\n this._showWithEvent();\n }\n\n private _hideOnInteraction(): void {\n if (!this.sticky) {\n this._hideWithEvent();\n }\n }\n\n /** Sticky mode close action - closes without waiting out `hideDelay`. */\n private _hideOnCloseClick(): void {\n this._applyTooltipState({ show: false, withEvents: true });\n }\n\n private async _hideOnEscape(): Promise<void> {\n // `hide()` is silent, so announce the close here - if there was one.\n if (await this.hide()) {\n this._emitEvent('igcClosed');\n }\n }\n\n protected override render() {\n const parts = {\n base: true,\n 'simple-text': !this._hasProjectedContent,\n };\n\n return html`\n <igc-popover\n .inert=${!this.open}\n .placement=${this.placement}\n .offset=${this.offset}\n .anchor=${this._controller.anchor ?? undefined}\n .arrowOffset=${this._arrowOffset}\n .shiftPadding=${8}\n ?open=${this.open}\n flip\n shift\n >\n <div ${ref(this._containerRef)} part=${partMap(parts)}>\n <slot>${this.message}</slot>\n ${\n this.sticky\n ? html`\n <slot name=\"close-button\" @click=${this._hideOnCloseClick}>\n <button\n type=\"button\"\n part=\"close-button\"\n aria-label=\"Close\"\n >\n <igc-icon\n name=\"input_clear\"\n collection=\"default\"\n aria-hidden=\"true\"\n ></igc-icon>\n </button>\n </slot>\n `\n : nothing\n }\n ${this.withArrow ? html`<div id=\"arrow\"></div>` : nothing}\n </div>\n </igc-popover>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tooltip': IgcTooltipComponent;\n }\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import IgcTreeItemComponent from './tree-item.js';
|
|
|
6
6
|
import { type IgcTreeComponentEventMap } from './tree.common.js';
|
|
7
7
|
import { IgcTreeNavigationService } from './tree.navigation.js';
|
|
8
8
|
import { IgcTreeSelectionService } from './tree.selection.js';
|
|
9
|
-
declare const IgcTreeComponent_base: Constructor<import("#internals/mixins/event-emitter.js").EventEmitterInterface<IgcTreeComponentEventMap>> & Constructor<LitElement>;
|
|
9
|
+
declare const IgcTreeComponent_base: import("#internals/mixins/constructor.js").AbstractConstructor<import("#internals/mixins/i18n.js").I18nInterface<ITreeResourceStrings, Required<ITreeResourceStrings>>> & Constructor<import("#internals/mixins/event-emitter.js").EventEmitterInterface<IgcTreeComponentEventMap>> & Constructor<LitElement>;
|
|
10
10
|
/**
|
|
11
11
|
* The tree allows users to represent hierarchical data in a tree-view structure,
|
|
12
12
|
* maintaining parent-child relationships, as well as to define static tree-view structure without a corresponding data model.
|
|
@@ -26,7 +26,6 @@ export default class IgcTreeComponent extends IgcTreeComponent_base {
|
|
|
26
26
|
static readonly tagName = "igc-tree";
|
|
27
27
|
static styles: import("lit").CSSResult;
|
|
28
28
|
static register(): void;
|
|
29
|
-
private readonly _i18nController;
|
|
30
29
|
/** @hidden @internal */
|
|
31
30
|
selectionService: IgcTreeSelectionService;
|
|
32
31
|
/** @hidden @internal */
|
|
@@ -46,18 +45,6 @@ export default class IgcTreeComponent extends IgcTreeComponent_base {
|
|
|
46
45
|
* @attr
|
|
47
46
|
*/
|
|
48
47
|
selection: TreeSelection;
|
|
49
|
-
/**
|
|
50
|
-
* Gets/Sets the locale used for getting language, affecting resource strings.
|
|
51
|
-
* @attr locale
|
|
52
|
-
*/
|
|
53
|
-
set locale(value: string);
|
|
54
|
-
get locale(): string;
|
|
55
|
-
/**
|
|
56
|
-
* The resource strings for localization.
|
|
57
|
-
* Currently only aria-labels of the default expand/collapse icons are localized for the tree item.
|
|
58
|
-
*/
|
|
59
|
-
set resourceStrings(value: ITreeResourceStrings);
|
|
60
|
-
get resourceStrings(): ITreeResourceStrings;
|
|
61
48
|
/**
|
|
62
49
|
* @hidden @internal
|
|
63
50
|
* The tree's top-most items, i.e. its direct `igc-tree-item` light-DOM children.
|
package/components/tree/tree.js
CHANGED
|
@@ -10,8 +10,8 @@ import { html, LitElement } from 'lit';
|
|
|
10
10
|
import { property } from 'lit/decorators.js';
|
|
11
11
|
import { blazorAdditionalDependencies } from '#internals/decorators/blazorAdditionalDependencies.js';
|
|
12
12
|
import { registerComponent } from '#internals/definitions/register.js';
|
|
13
|
-
import { addI18nController } from '#internals/i18n/i18n-controller.js';
|
|
14
13
|
import { EventEmitterMixin } from '#internals/mixins/event-emitter.js';
|
|
14
|
+
import { I18nMixin } from '#internals/mixins/i18n.js';
|
|
15
15
|
import { addThemingController } from '#theming/theming-controller.js';
|
|
16
16
|
import { styles } from './themes/container.base.css.js';
|
|
17
17
|
import { all } from './themes/container.js';
|
|
@@ -20,25 +20,16 @@ import { getTreeItemChildren, setAriaState, } from './tree.common.js';
|
|
|
20
20
|
import { IgcTreeNavigationService } from './tree.navigation.js';
|
|
21
21
|
import { IgcTreeSelectionService } from './tree.selection.js';
|
|
22
22
|
const ITEM_RENDER_DEPENDENCIES = ['selection', 'resourceStrings'];
|
|
23
|
-
|
|
23
|
+
const i18n = {
|
|
24
|
+
defaultEN: TreeResourceStringsEN,
|
|
25
|
+
};
|
|
26
|
+
let IgcTreeComponent = class IgcTreeComponent extends I18nMixin(EventEmitterMixin(LitElement), i18n) {
|
|
24
27
|
static { IgcTreeComponent_1 = this; }
|
|
25
28
|
static { this.tagName = 'igc-tree'; }
|
|
26
29
|
static { this.styles = styles; }
|
|
27
30
|
static register() {
|
|
28
31
|
registerComponent(IgcTreeComponent_1, IgcTreeItemComponent);
|
|
29
32
|
}
|
|
30
|
-
set locale(value) {
|
|
31
|
-
this._i18nController.locale = value;
|
|
32
|
-
}
|
|
33
|
-
get locale() {
|
|
34
|
-
return this._i18nController.locale;
|
|
35
|
-
}
|
|
36
|
-
set resourceStrings(value) {
|
|
37
|
-
this._i18nController.resourceStrings = value;
|
|
38
|
-
}
|
|
39
|
-
get resourceStrings() {
|
|
40
|
-
return this._i18nController.resourceStrings;
|
|
41
|
-
}
|
|
42
33
|
get _rootItems() {
|
|
43
34
|
return getTreeItemChildren(this);
|
|
44
35
|
}
|
|
@@ -52,9 +43,6 @@ let IgcTreeComponent = class IgcTreeComponent extends EventEmitterMixin(LitEleme
|
|
|
52
43
|
}
|
|
53
44
|
constructor() {
|
|
54
45
|
super();
|
|
55
|
-
this._i18nController = addI18nController(this, {
|
|
56
|
-
defaultEN: TreeResourceStringsEN,
|
|
57
|
-
});
|
|
58
46
|
this.singleBranchExpand = false;
|
|
59
47
|
this.toggleNodeOnClick = false;
|
|
60
48
|
this.selection = 'none';
|
|
@@ -147,12 +135,6 @@ __decorate([
|
|
|
147
135
|
__decorate([
|
|
148
136
|
property({ reflect: true })
|
|
149
137
|
], IgcTreeComponent.prototype, "selection", void 0);
|
|
150
|
-
__decorate([
|
|
151
|
-
property()
|
|
152
|
-
], IgcTreeComponent.prototype, "locale", null);
|
|
153
|
-
__decorate([
|
|
154
|
-
property({ attribute: false })
|
|
155
|
-
], IgcTreeComponent.prototype, "resourceStrings", null);
|
|
156
138
|
IgcTreeComponent = IgcTreeComponent_1 = __decorate([
|
|
157
139
|
blazorAdditionalDependencies('IgcTreeItemComponent')
|
|
158
140
|
], IgcTreeComponent);
|
|
@@ -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M,MAAM,CAEX,KAA8B;QAE9B,KAAK,MAAM,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;IAOM,QAAQ,CAEb,KAA8B;QAE9B,KAAK,MAAM,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACvC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC;IACH,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAlNM;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4DAC5C;AAO3B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DAC7C;AAO1B;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDACa;AAOzC;IADC,QAAQ,EAAE;8CAGV;AAWD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;uDAG9B;AAlEkB,gBAAgB;IADpC,4BAA4B,CAAC,sBAAsB,CAAC;GAChC,gBAAgB,CAiPpC;eAjPoB,gBAAgB","sourcesContent":["import {\n type ITreeResourceStrings,\n TreeResourceStringsEN,\n} from 'igniteui-i18n-core';\nimport { html, LitElement, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { blazorAdditionalDependencies } from '#internals/decorators/blazorAdditionalDependencies.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport { addI18nController } from '#internals/i18n/i18n-controller.js';\nimport type { Constructor } from '#internals/mixins/constructor.js';\nimport { EventEmitterMixin } from '#internals/mixins/event-emitter.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport type { TreeSelection } from '../types.js';\nimport { styles } from './themes/container.base.css.js';\nimport { all } from './themes/container.js';\nimport IgcTreeItemComponent from './tree-item.js';\nimport {\n getTreeItemChildren,\n type IgcTreeComponentEventMap,\n setAriaState,\n} from './tree.common.js';\nimport { IgcTreeNavigationService } from './tree.navigation.js';\nimport { IgcTreeSelectionService } from './tree.selection.js';\n\n/**\n * Tree properties that items read while rendering. The tree is not a reactive\n * source for them, so changing one has to re-render the items by hand or they\n * keep rendering stale output.\n *\n * Prefer reading tree state at event time over extending this - a handler\n * always sees the current value and costs no re-render. Direction is handled in\n * CSS via `:dir()` for the same reason.\n */\nconst ITEM_RENDER_DEPENDENCIES = ['selection', 'resourceStrings'] as const;\n\n/**\n * The tree allows users to represent hierarchical data in a tree-view structure,\n * maintaining parent-child relationships, as well as to define static tree-view structure without a corresponding data model.\n *\n * @element igc-tree\n *\n * @slot - Renders the tree items inside default slot.\n *\n * @fires igcSelection - Emitted when item selection is changing, before the selection completes.\n * @fires igcItemCollapsed - Emitted when tree item is collapsed.\n * @fires igcItemCollapsing - Emitted when tree item is about to collapse.\n * @fires igcItemExpanded - Emitted when tree item is expanded.\n * @fires igcItemExpanding - Emitted when tree item is about to expand.\n * @fires igcActiveItem - Emitted when the tree's `active` item changes.\n */\n@blazorAdditionalDependencies('IgcTreeItemComponent')\nexport default class IgcTreeComponent extends EventEmitterMixin<\n IgcTreeComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-tree';\n public static styles = styles;\n\n /* blazorSuppress */\n public static register() {\n registerComponent(IgcTreeComponent, IgcTreeItemComponent);\n }\n\n private readonly _i18nController = addI18nController<ITreeResourceStrings>(\n this,\n {\n defaultEN: TreeResourceStringsEN,\n }\n );\n\n /** @hidden @internal */\n public selectionService!: IgcTreeSelectionService;\n\n /** @hidden @internal */\n public navService!: IgcTreeNavigationService;\n\n /**\n * Whether a single or multiple of a parent's child items can be expanded.\n * @attr single-branch-expand\n */\n @property({ attribute: 'single-branch-expand', reflect: true, type: Boolean })\n public singleBranchExpand = false;\n\n /**\n * Whether clicking over nodes will change their expanded state or not.\n * @attr toggle-node-on-click\n */\n @property({ attribute: 'toggle-node-on-click', reflect: true, type: Boolean })\n public toggleNodeOnClick = false;\n\n /**\n * The selection state of the tree.\n * @attr\n */\n @property({ reflect: true })\n public selection: TreeSelection = 'none';\n\n /**\n * Gets/Sets the locale used for getting language, affecting resource strings.\n * @attr locale\n */\n @property()\n public set locale(value: string) {\n this._i18nController.locale = value;\n }\n\n public get locale() {\n return this._i18nController.locale;\n }\n\n /**\n * The resource strings for localization.\n * Currently only aria-labels of the default expand/collapse icons are localized for the tree item.\n */\n @property({ attribute: false })\n public set resourceStrings(value: ITreeResourceStrings) {\n this._i18nController.resourceStrings = value;\n }\n\n public get resourceStrings(): ITreeResourceStrings {\n return this._i18nController.resourceStrings;\n }\n\n /**\n * @hidden @internal\n * The tree's top-most items, i.e. its direct `igc-tree-item` light-DOM children.\n */\n public get _rootItems(): IgcTreeItemComponent[] {\n return getTreeItemChildren(this);\n }\n\n /* blazorSuppress */\n /**\n * Returns all of the tree's items.\n */\n public get items(): IgcTreeItemComponent[] {\n // A shared accumulator, rather than spreading each root's flattened\n // descendants, which would copy every subtree an extra time.\n const result: IgcTreeItemComponent[] = [];\n\n for (const item of this._rootItems) {\n result.push(item);\n item._collectDescendants(result);\n }\n\n return result;\n }\n\n constructor() {\n super();\n\n addThemingController(this, all);\n\n this.selectionService = new IgcTreeSelectionService(this);\n this.navService = new IgcTreeNavigationService(this, this.selectionService);\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this._syncAria();\n const items = this.items;\n\n // set init to true for all items which are rendered along with the tree\n for (const item of items) {\n item.init = true;\n }\n\n // Seed the roving tabindex without moving DOM focus - connecting a tree must\n // not pull focus away from wherever the user currently is.\n const firstNotDisabledItem = items.find((i) => !i.disabled);\n if (firstNotDisabledItem) {\n firstNotDisabledItem.tabIndex = 0;\n this.navService.focusItem(firstNotDisabledItem, false);\n }\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n super.willUpdate(changed);\n\n if (this.hasUpdated && changed.has('selection')) {\n this.selectionService.clearItemsSelection();\n }\n\n if (changed.has('singleBranchExpand')) {\n this._singleBranchExpandChange();\n }\n\n if (ITEM_RENDER_DEPENDENCIES.some((prop) => changed.has(prop))) {\n for (const item of this.items) {\n item.requestUpdate();\n }\n }\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed);\n this._syncAria();\n }\n\n private _syncAria(): void {\n this.setAttribute('role', 'tree');\n\n // A tree that cannot be selected should not advertise itself as selectable.\n setAriaState(\n this,\n 'aria-multiselectable',\n this.selection === 'none' ? null : 'true'\n );\n }\n\n private _singleBranchExpandChange(): void {\n if (!this.singleBranchExpand) {\n return;\n }\n\n // The active item's branch stays open; everything else collapses.\n const active = this.navService.activeItem;\n const keepExpanded = new Set(active ? active.path.slice(0, -1) : []);\n\n for (const item of this.items) {\n if (!keepExpanded.has(item)) {\n item.collapseWithEvent();\n }\n }\n }\n\n /* blazorSuppress */\n /** @hidden @internal */\n public expandToItem(item: IgcTreeItemComponent): void {\n for (const ancestor of item.path.slice(0, -1)) {\n ancestor.expanded = true;\n }\n }\n\n /* blazorSuppress */\n /** Select all items if the items collection is empty. Otherwise, select the items in the items collection. */\n public select(\n /* alternateType: TreeItemCollection */\n items?: IgcTreeItemComponent[]\n ): void {\n if (items) {\n this.selectionService.selectItemsWithNoEvent(items);\n return;\n }\n\n // Cascading down from the roots already covers every descendant, so there\n // is no need to walk the whole tree to build the list.\n this.selectionService.selectItemsWithNoEvent(\n this.selection === 'cascade' ? this._rootItems : this.items\n );\n }\n\n /* blazorSuppress */\n /** Deselect all items if the items collection is empty. Otherwise, deselect the items in the items collection. */\n public deselect(\n /* alternateType: TreeItemCollection */\n items?: IgcTreeItemComponent[]\n ): void {\n this.selectionService.deselectItemsWithNoEvent(items);\n }\n\n /* blazorSuppress */\n /**\n * Expands all of the passed items.\n * If no items are passed, expands ALL items.\n */\n public expand(\n /* alternateType: TreeItemCollection */\n items?: IgcTreeItemComponent[]\n ): void {\n for (const item of items ?? this.items) {\n item.expanded = true;\n }\n }\n\n /* blazorSuppress */\n /**\n * Collapses all of the passed items.\n * If no items are passed, collapses ALL items.\n */\n public collapse(\n /* alternateType: TreeItemCollection */\n items?: IgcTreeItemComponent[]\n ): void {\n for (const item of items ?? this.items) {\n item.expanded = false;\n }\n }\n\n protected override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tree': IgcTreeComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tree.js","sourceRoot":"","sources":["../../../src/components/tree/tree.ts"],"names":[],"mappings":";;;;;;;AAAA,OAAO,EAEL,qBAAqB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,UAAU,EAAuB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,uDAAuD,CAAC;AACrG,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAGvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,oBAAoB,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,mBAAmB,EAEnB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAW9D,MAAM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CAAC;IACxD,CAAC;IAOM,MAAM,CAEX,KAA8B;QAE9B,KAAK,MAAM,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACvC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;QACvB,CAAC;IACH,CAAC;IAOM,QAAQ,CAEb,KAA8B;QAE9B,KAAK,MAAM,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACvC,IAAI,CAAC,QAAQ,GAAG,KAAK,CAAC;QACxB,CAAC;IACH,CAAC;IAEkB,MAAM;QACvB,OAAO,IAAI,CAAA,eAAe,CAAC;IAC7B,CAAC;;AAxLM;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;4DAC5C;AAO3B;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,sBAAsB,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2DAC7C;AAO1B;IADN,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;mDACa;AAvCtB,gBAAgB;IADpC,4BAA4B,CAAC,sBAAsB,CAAC;GAChC,gBAAgB,CAkNpC;eAlNoB,gBAAgB","sourcesContent":["import {\n type ITreeResourceStrings,\n TreeResourceStringsEN,\n} from 'igniteui-i18n-core';\nimport { html, LitElement, type PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { blazorAdditionalDependencies } from '#internals/decorators/blazorAdditionalDependencies.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport type { I18nControllerConfig } from '#internals/i18n/i18n-controller.js';\nimport type { Constructor } from '#internals/mixins/constructor.js';\nimport { EventEmitterMixin } from '#internals/mixins/event-emitter.js';\nimport { I18nMixin } from '#internals/mixins/i18n.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport type { TreeSelection } from '../types.js';\nimport { styles } from './themes/container.base.css.js';\nimport { all } from './themes/container.js';\nimport IgcTreeItemComponent from './tree-item.js';\nimport {\n getTreeItemChildren,\n type IgcTreeComponentEventMap,\n setAriaState,\n} from './tree.common.js';\nimport { IgcTreeNavigationService } from './tree.navigation.js';\nimport { IgcTreeSelectionService } from './tree.selection.js';\n\n/**\n * Tree properties that items read while rendering. The tree is not a reactive\n * source for them, so changing one has to re-render the items by hand or they\n * keep rendering stale output.\n *\n * Prefer reading tree state at event time over extending this - a handler\n * always sees the current value and costs no re-render. Direction is handled in\n * CSS via `:dir()` for the same reason.\n */\nconst ITEM_RENDER_DEPENDENCIES = ['selection', 'resourceStrings'] as const;\n\nconst i18n: I18nControllerConfig<ITreeResourceStrings> = {\n defaultEN: TreeResourceStringsEN,\n};\n\n/**\n * The tree allows users to represent hierarchical data in a tree-view structure,\n * maintaining parent-child relationships, as well as to define static tree-view structure without a corresponding data model.\n *\n * @element igc-tree\n *\n * @slot - Renders the tree items inside default slot.\n *\n * @fires igcSelection - Emitted when item selection is changing, before the selection completes.\n * @fires igcItemCollapsed - Emitted when tree item is collapsed.\n * @fires igcItemCollapsing - Emitted when tree item is about to collapse.\n * @fires igcItemExpanded - Emitted when tree item is expanded.\n * @fires igcItemExpanding - Emitted when tree item is about to expand.\n * @fires igcActiveItem - Emitted when the tree's `active` item changes.\n */\n@blazorAdditionalDependencies('IgcTreeItemComponent')\nexport default class IgcTreeComponent extends I18nMixin(\n EventEmitterMixin<IgcTreeComponentEventMap, Constructor<LitElement>>(\n LitElement\n ),\n i18n\n) {\n public static readonly tagName = 'igc-tree';\n public static styles = styles;\n\n /* blazorSuppress */\n public static register() {\n registerComponent(IgcTreeComponent, IgcTreeItemComponent);\n }\n\n /** @hidden @internal */\n public selectionService!: IgcTreeSelectionService;\n\n /** @hidden @internal */\n public navService!: IgcTreeNavigationService;\n\n /**\n * Whether a single or multiple of a parent's child items can be expanded.\n * @attr single-branch-expand\n */\n @property({ attribute: 'single-branch-expand', reflect: true, type: Boolean })\n public singleBranchExpand = false;\n\n /**\n * Whether clicking over nodes will change their expanded state or not.\n * @attr toggle-node-on-click\n */\n @property({ attribute: 'toggle-node-on-click', reflect: true, type: Boolean })\n public toggleNodeOnClick = false;\n\n /**\n * The selection state of the tree.\n * @attr\n */\n @property({ reflect: true })\n public selection: TreeSelection = 'none';\n\n /**\n * @hidden @internal\n * The tree's top-most items, i.e. its direct `igc-tree-item` light-DOM children.\n */\n public get _rootItems(): IgcTreeItemComponent[] {\n return getTreeItemChildren(this);\n }\n\n /* blazorSuppress */\n /**\n * Returns all of the tree's items.\n */\n public get items(): IgcTreeItemComponent[] {\n // A shared accumulator, rather than spreading each root's flattened\n // descendants, which would copy every subtree an extra time.\n const result: IgcTreeItemComponent[] = [];\n\n for (const item of this._rootItems) {\n result.push(item);\n item._collectDescendants(result);\n }\n\n return result;\n }\n\n constructor() {\n super();\n\n addThemingController(this, all);\n\n this.selectionService = new IgcTreeSelectionService(this);\n this.navService = new IgcTreeNavigationService(this, this.selectionService);\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this._syncAria();\n const items = this.items;\n\n // set init to true for all items which are rendered along with the tree\n for (const item of items) {\n item.init = true;\n }\n\n // Seed the roving tabindex without moving DOM focus - connecting a tree must\n // not pull focus away from wherever the user currently is.\n const firstNotDisabledItem = items.find((i) => !i.disabled);\n if (firstNotDisabledItem) {\n firstNotDisabledItem.tabIndex = 0;\n this.navService.focusItem(firstNotDisabledItem, false);\n }\n }\n\n protected override willUpdate(changed: PropertyValues<this>): void {\n super.willUpdate(changed);\n\n if (this.hasUpdated && changed.has('selection')) {\n this.selectionService.clearItemsSelection();\n }\n\n if (changed.has('singleBranchExpand')) {\n this._singleBranchExpandChange();\n }\n\n if (ITEM_RENDER_DEPENDENCIES.some((prop) => changed.has(prop))) {\n for (const item of this.items) {\n item.requestUpdate();\n }\n }\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed);\n this._syncAria();\n }\n\n private _syncAria(): void {\n this.setAttribute('role', 'tree');\n\n // A tree that cannot be selected should not advertise itself as selectable.\n setAriaState(\n this,\n 'aria-multiselectable',\n this.selection === 'none' ? null : 'true'\n );\n }\n\n private _singleBranchExpandChange(): void {\n if (!this.singleBranchExpand) {\n return;\n }\n\n // The active item's branch stays open; everything else collapses.\n const active = this.navService.activeItem;\n const keepExpanded = new Set(active ? active.path.slice(0, -1) : []);\n\n for (const item of this.items) {\n if (!keepExpanded.has(item)) {\n item.collapseWithEvent();\n }\n }\n }\n\n /* blazorSuppress */\n /** @hidden @internal */\n public expandToItem(item: IgcTreeItemComponent): void {\n for (const ancestor of item.path.slice(0, -1)) {\n ancestor.expanded = true;\n }\n }\n\n /* blazorSuppress */\n /** Select all items if the items collection is empty. Otherwise, select the items in the items collection. */\n public select(\n /* alternateType: TreeItemCollection */\n items?: IgcTreeItemComponent[]\n ): void {\n if (items) {\n this.selectionService.selectItemsWithNoEvent(items);\n return;\n }\n\n // Cascading down from the roots already covers every descendant, so there\n // is no need to walk the whole tree to build the list.\n this.selectionService.selectItemsWithNoEvent(\n this.selection === 'cascade' ? this._rootItems : this.items\n );\n }\n\n /* blazorSuppress */\n /** Deselect all items if the items collection is empty. Otherwise, deselect the items in the items collection. */\n public deselect(\n /* alternateType: TreeItemCollection */\n items?: IgcTreeItemComponent[]\n ): void {\n this.selectionService.deselectItemsWithNoEvent(items);\n }\n\n /* blazorSuppress */\n /**\n * Expands all of the passed items.\n * If no items are passed, expands ALL items.\n */\n public expand(\n /* alternateType: TreeItemCollection */\n items?: IgcTreeItemComponent[]\n ): void {\n for (const item of items ?? this.items) {\n item.expanded = true;\n }\n }\n\n /* blazorSuppress */\n /**\n * Collapses all of the passed items.\n * If no items are passed, collapses ALL items.\n */\n public collapse(\n /* alternateType: TreeItemCollection */\n items?: IgcTreeItemComponent[]\n ): void {\n for (const item of items ?? this.items) {\n item.expanded = false;\n }\n }\n\n protected override render() {\n return html`<slot></slot>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-tree': IgcTreeComponent;\n }\n}\n"]}
|
|
@@ -6,7 +6,7 @@ import type { IgcTreeSelectionService } from './tree.selection.js';
|
|
|
6
6
|
* for the tree.
|
|
7
7
|
*
|
|
8
8
|
* The navigable set is never cached. It is derived on demand, only on an actual
|
|
9
|
-
* keypress, by a lazy walk that prunes collapsed branches
|
|
9
|
+
* keypress, by a lazy walk that prunes collapsed branches - so no work happens
|
|
10
10
|
* on item mount/expand/disable, and callers needing a single item stop as soon
|
|
11
11
|
* as they have it.
|
|
12
12
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree.navigation.js","sourceRoot":"","sources":["../../../src/components/tree/tree.navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAgBhE,MAAM,OAAO,wBAAwB;IAInC,YACmB,IAAsB,EACtB,SAAkC;QADlC,SAAI,GAAJ,IAAI,CAAkB;QACtB,cAAS,GAAT,SAAS,CAAyB;QAL7C,iBAAY,GAAgC,IAAI,CAAC;QACjD,gBAAW,GAAgC,IAAI,CAAC;QAyKvC,eAAU,GAAG,GAAS,EAAE;YACvC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;gBACd,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE;gBAC9B,CAAC,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QACrC,CAAC,CAAC;QAEe,gBAAW,GAAG,GAAS,EAAE;YACxC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;gBACd,CAAC,CAAC,IAAI,CAAC,uBAAuB,EAAE;gBAChC,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACnC,C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,\n arrowLeft,\n arrowRight,\n arrowUp,\n ctrlKey,\n endKey,\n enterKey,\n homeKey,\n shiftKey,\n spaceBar,\n} from '#internals/controllers/key-bindings.js';\nimport { isLTR, scrollIntoView } from '#internals/utils/dom.js';\nimport type IgcTreeItemComponent from './tree-item.js';\nimport type IgcTreeComponent from './tree.js';\nimport type { IgcTreeSelectionService } from './tree.selection.js';\n\n/**\n * Handles roving-tabindex keyboard navigation and active/focused item tracking\n * for the tree.\n *\n * The navigable set is never cached. It is derived on demand, only on an actual\n * keypress, by a lazy walk that prunes collapsed branches — so no work happens\n * on item mount/expand/disable, and callers needing a single item stop as soon\n * as they have it.\n *\n * @hidden @internal\n */\nexport class IgcTreeNavigationService {\n private _focusedItem: IgcTreeItemComponent | null = null;\n private _activeItem: IgcTreeItemComponent | null = null;\n\n constructor(\n private readonly tree: IgcTreeComponent,\n private readonly selection: IgcTreeSelectionService\n ) {\n addKeybindings(tree, {\n bindingDefaults: { preventDefault: true, repeat: true },\n })\n .set(homeKey, () => this.setFocusedAndActiveItem(this._firstNavigable()))\n .set(endKey, () => this.setFocusedAndActiveItem(this._lastNavigable()))\n .set(arrowLeft, this._arrowLeft)\n .set(arrowRight, this._arrowRight)\n .set(arrowUp, () => this._arrowVertical(-1, true))\n .set(arrowDown, () => this._arrowVertical(1, true))\n .set([ctrlKey, arrowUp], () => this._arrowVertical(-1, false))\n .set([ctrlKey, arrowDown], () => this._arrowVertical(1, false))\n .set('*', this._asterisk)\n .set(spaceBar, () => this._space(false))\n .set([shiftKey, spaceBar], () => this._space(true))\n .set(enterKey, this._enter, { preventDefault: false });\n }\n\n public get focusedItem(): IgcTreeItemComponent | null {\n return this._focusedItem;\n }\n\n public get activeItem(): IgcTreeItemComponent | null {\n return this._activeItem;\n }\n\n public focusItem(\n value: IgcTreeItemComponent | null,\n shouldFocus = true\n ): void {\n if (this._focusedItem === value) {\n return;\n }\n\n this._focusedItem?.removeAttribute('tabindex');\n this._focusedItem = value;\n\n if (this._focusedItem && shouldFocus) {\n this._focusedItem.tabIndex = 0;\n this._focusedItem.focus({ preventScroll: true });\n scrollIntoView(this._focusedItem.wrapper);\n }\n }\n\n public setActiveItem(\n value: IgcTreeItemComponent | null,\n shouldEmit = true\n ): void {\n if (this._activeItem === value) {\n return;\n }\n\n if (this._activeItem) {\n this._activeItem.active = false;\n }\n\n this._activeItem = value;\n\n if (this._activeItem) {\n this._activeItem.active = true;\n if (shouldEmit) {\n this.tree.emitEvent('igcActiveItem', { detail: this._activeItem });\n }\n }\n }\n\n /** Sets the item as focused (and optionally active). */\n public setFocusedAndActiveItem(\n item: IgcTreeItemComponent | undefined,\n isActive = true,\n shouldFocus = true\n ): void {\n if (!item) {\n return;\n }\n if (isActive) {\n this.setActiveItem(item);\n }\n this.focusItem(item, shouldFocus);\n }\n\n /** Called by a tree item on `disconnectedCallback`. */\n public handleItemDisconnect(item: IgcTreeItemComponent): void {\n if (this._activeItem === item) {\n this.setActiveItem(null);\n }\n if (this._focusedItem === item) {\n this.focusItem(null, false);\n const next = this.tree.items.find((i) => !i.disabled);\n if (next) {\n next.tabIndex = 0;\n this.focusItem(next, false);\n }\n }\n }\n\n //#region Visible/navigable item resolution (computed on demand, not cached)\n\n /**\n * Yields the keyboard-navigable items in document order.\n *\n * A disabled item is skipped but does not hide its subtree: only a\n * *collapsed* ancestor removes descendants from the navigable set.\n */\n private *_navigable(\n items: IgcTreeItemComponent[] = this.tree._rootItems\n ): Generator<IgcTreeItemComponent, undefined> {\n for (const item of items) {\n if (!item.disabled) {\n yield item;\n }\n if (item.expanded) {\n yield* this._navigable(item.getChildren());\n }\n }\n }\n\n private _firstNavigable(): IgcTreeItemComponent | undefined {\n return this._navigable().next().value;\n }\n\n private _lastNavigable(): IgcTreeItemComponent | undefined {\n let last: IgcTreeItemComponent | undefined;\n for (const item of this._navigable()) {\n last = item;\n }\n return last;\n }\n\n /**\n * Next/previous navigable item relative to `item`, or `item` itself if there\n * isn't one.\n */\n private _adjacent(\n item: IgcTreeItemComponent,\n dir: 1 | -1\n ): IgcTreeItemComponent {\n const items = this._navigable();\n let first: IgcTreeItemComponent | undefined;\n let previous: IgcTreeItemComponent | undefined;\n\n for (const current of items) {\n first ??= current;\n\n if (current === item) {\n if (dir === -1) {\n return previous ?? item;\n }\n const next = items.next();\n return next.done ? item : next.value;\n }\n previous = current;\n }\n\n // `item` is not navigable itself - it can be focused while an ancestor is\n // collapsed out from under it. Going forward that lands on the first\n // navigable item; going backwards it stays put.\n return (dir === 1 ? first : undefined) ?? item;\n }\n\n //#endregion\n\n //#region Keyboard handlers\n\n private readonly _arrowLeft = (): void => {\n isLTR(this.tree)\n ? this._collapseOrGoToParent()\n : this._expandOrGoToFirstChild();\n };\n\n private readonly _arrowRight = (): void => {\n isLTR(this.tree)\n ? this._expandOrGoToFirstChild()\n : this._collapseOrGoToParent();\n };\n\n private _collapseOrGoToParent(): void {\n const item = this._focusedItem;\n if (!item) {\n return;\n }\n if (item.expanded && item.getChildren().length) {\n this.setActiveItem(item);\n item.collapseWithEvent();\n return;\n }\n if (item.parent && !item.parent.disabled) {\n this.setFocusedAndActiveItem(item.parent);\n }\n }\n\n private _expandOrGoToFirstChild(): void {\n const item = this._focusedItem;\n if (!item || item.getChildren().length === 0) {\n return;\n }\n if (!item.expanded) {\n this.setActiveItem(item);\n item.expandWithEvent();\n return;\n }\n const firstChild = item.getChildren().find((child) => !child.disabled);\n if (firstChild) {\n this.setFocusedAndActiveItem(firstChild);\n }\n }\n\n private _arrowVertical(dir: 1 | -1, shouldActivate: boolean): void {\n const item = this._focusedItem;\n if (!item) {\n return;\n }\n const next = this._adjacent(item, dir);\n if (next === item) {\n return;\n }\n this.setFocusedAndActiveItem(next, shouldActivate);\n }\n\n private readonly _asterisk = (): void => {\n const item = this._focusedItem;\n if (!item) {\n return;\n }\n const siblings = item.parent\n ? item.parent.getChildren()\n : this.tree._rootItems;\n\n for (const sibling of siblings) {\n if (!sibling.disabled && !sibling.expanded && sibling.hasChildren) {\n sibling.expandWithEvent();\n }\n }\n };\n\n private _space(shiftKey: boolean): void {\n const item = this._focusedItem;\n if (!item) {\n return;\n }\n\n this.setActiveItem(item);\n\n if (this.tree.selection === 'none') {\n return;\n }\n\n if (shiftKey) {\n this.selection.selectMultipleItems(item);\n return;\n }\n\n item.selected\n ? this.selection.deselectItem(item)\n : this.selection.selectItem(item);\n }\n\n private readonly _enter = (): void => {\n if (this._focusedItem) {\n this.setActiveItem(this._focusedItem);\n }\n };\n\n //#endregion\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tree.navigation.js","sourceRoot":"","sources":["../../../src/components/tree/tree.navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,SAAS,EACT,SAAS,EACT,UAAU,EACV,OAAO,EACP,OAAO,EACP,MAAM,EACN,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,QAAQ,GACT,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAgBhE,MAAM,OAAO,wBAAwB;IAInC,YACmB,IAAsB,EACtB,SAAkC;QADlC,SAAI,GAAJ,IAAI,CAAkB;QACtB,cAAS,GAAT,SAAS,CAAyB;QAL7C,iBAAY,GAAgC,IAAI,CAAC;QACjD,gBAAW,GAAgC,IAAI,CAAC;QAyKvC,eAAU,GAAG,GAAS,EAAE;YACvC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;gBACd,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE;gBAC9B,CAAC,CAAC,IAAI,CAAC,uBAAuB,EAAE,CAAC;QACrC,CAAC,CAAC;QAEe,gBAAW,GAAG,GAAS,EAAE;YACxC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;gBACd,CAAC,CAAC,IAAI,CAAC,uBAAuB,EAAE;gBAChC,CAAC,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC;QACnC,CAAC,CAAC;QA6Ce,cAAS,GAAG,GAAS,EAAE;YACtC,M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n enterKey,\n homeKey,\n shiftKey,\n spaceBar,\n} from '#internals/controllers/key-bindings.js';\nimport { isLTR, scrollIntoView } from '#internals/utils/dom.js';\nimport type IgcTreeItemComponent from './tree-item.js';\nimport type IgcTreeComponent from './tree.js';\nimport type { IgcTreeSelectionService } from './tree.selection.js';\n\n/**\n * Handles roving-tabindex keyboard navigation and active/focused item tracking\n * for the tree.\n *\n * The navigable set is never cached. It is derived on demand, only on an actual\n * keypress, by a lazy walk that prunes collapsed branches - so no work happens\n * on item mount/expand/disable, and callers needing a single item stop as soon\n * as they have it.\n *\n * @hidden @internal\n */\nexport class IgcTreeNavigationService {\n private _focusedItem: IgcTreeItemComponent | null = null;\n private _activeItem: IgcTreeItemComponent | null = null;\n\n constructor(\n private readonly tree: IgcTreeComponent,\n private readonly selection: IgcTreeSelectionService\n ) {\n addKeybindings(tree, {\n bindingDefaults: { preventDefault: true, repeat: true },\n })\n .set(homeKey, () => this.setFocusedAndActiveItem(this._firstNavigable()))\n .set(endKey, () => this.setFocusedAndActiveItem(this._lastNavigable()))\n .set(arrowLeft, this._arrowLeft)\n .set(arrowRight, this._arrowRight)\n .set(arrowUp, () => this._arrowVertical(-1, true))\n .set(arrowDown, () => this._arrowVertical(1, true))\n .set([ctrlKey, arrowUp], () => this._arrowVertical(-1, false))\n .set([ctrlKey, arrowDown], () => this._arrowVertical(1, false))\n .set('*', this._asterisk)\n .set(spaceBar, () => this._space(false))\n .set([shiftKey, spaceBar], () => this._space(true))\n .set(enterKey, this._enter, { preventDefault: false });\n }\n\n public get focusedItem(): IgcTreeItemComponent | null {\n return this._focusedItem;\n }\n\n public get activeItem(): IgcTreeItemComponent | null {\n return this._activeItem;\n }\n\n public focusItem(\n value: IgcTreeItemComponent | null,\n shouldFocus = true\n ): void {\n if (this._focusedItem === value) {\n return;\n }\n\n this._focusedItem?.removeAttribute('tabindex');\n this._focusedItem = value;\n\n if (this._focusedItem && shouldFocus) {\n this._focusedItem.tabIndex = 0;\n this._focusedItem.focus({ preventScroll: true });\n scrollIntoView(this._focusedItem.wrapper);\n }\n }\n\n public setActiveItem(\n value: IgcTreeItemComponent | null,\n shouldEmit = true\n ): void {\n if (this._activeItem === value) {\n return;\n }\n\n if (this._activeItem) {\n this._activeItem.active = false;\n }\n\n this._activeItem = value;\n\n if (this._activeItem) {\n this._activeItem.active = true;\n if (shouldEmit) {\n this.tree.emitEvent('igcActiveItem', { detail: this._activeItem });\n }\n }\n }\n\n /** Sets the item as focused (and optionally active). */\n public setFocusedAndActiveItem(\n item: IgcTreeItemComponent | undefined,\n isActive = true,\n shouldFocus = true\n ): void {\n if (!item) {\n return;\n }\n if (isActive) {\n this.setActiveItem(item);\n }\n this.focusItem(item, shouldFocus);\n }\n\n /** Called by a tree item on `disconnectedCallback`. */\n public handleItemDisconnect(item: IgcTreeItemComponent): void {\n if (this._activeItem === item) {\n this.setActiveItem(null);\n }\n if (this._focusedItem === item) {\n this.focusItem(null, false);\n const next = this.tree.items.find((i) => !i.disabled);\n if (next) {\n next.tabIndex = 0;\n this.focusItem(next, false);\n }\n }\n }\n\n //#region Visible/navigable item resolution (computed on demand, not cached)\n\n /**\n * Yields the keyboard-navigable items in document order.\n *\n * A disabled item is skipped but does not hide its subtree: only a\n * *collapsed* ancestor removes descendants from the navigable set.\n */\n private *_navigable(\n items: IgcTreeItemComponent[] = this.tree._rootItems\n ): Generator<IgcTreeItemComponent, undefined> {\n for (const item of items) {\n if (!item.disabled) {\n yield item;\n }\n if (item.expanded) {\n yield* this._navigable(item.getChildren());\n }\n }\n }\n\n private _firstNavigable(): IgcTreeItemComponent | undefined {\n return this._navigable().next().value;\n }\n\n private _lastNavigable(): IgcTreeItemComponent | undefined {\n let last: IgcTreeItemComponent | undefined;\n for (const item of this._navigable()) {\n last = item;\n }\n return last;\n }\n\n /**\n * Next/previous navigable item relative to `item`, or `item` itself if there\n * isn't one.\n */\n private _adjacent(\n item: IgcTreeItemComponent,\n dir: 1 | -1\n ): IgcTreeItemComponent {\n const items = this._navigable();\n let first: IgcTreeItemComponent | undefined;\n let previous: IgcTreeItemComponent | undefined;\n\n for (const current of items) {\n first ??= current;\n\n if (current === item) {\n if (dir === -1) {\n return previous ?? item;\n }\n const next = items.next();\n return next.done ? item : next.value;\n }\n previous = current;\n }\n\n // `item` is not navigable itself - it can be focused while an ancestor is\n // collapsed out from under it. Going forward that lands on the first\n // navigable item; going backwards it stays put.\n return (dir === 1 ? first : undefined) ?? item;\n }\n\n //#endregion\n\n //#region Keyboard handlers\n\n private readonly _arrowLeft = (): void => {\n isLTR(this.tree)\n ? this._collapseOrGoToParent()\n : this._expandOrGoToFirstChild();\n };\n\n private readonly _arrowRight = (): void => {\n isLTR(this.tree)\n ? this._expandOrGoToFirstChild()\n : this._collapseOrGoToParent();\n };\n\n private _collapseOrGoToParent(): void {\n const item = this._focusedItem;\n if (!item) {\n return;\n }\n if (item.expanded && item.getChildren().length) {\n this.setActiveItem(item);\n item.collapseWithEvent();\n return;\n }\n if (item.parent && !item.parent.disabled) {\n this.setFocusedAndActiveItem(item.parent);\n }\n }\n\n private _expandOrGoToFirstChild(): void {\n const item = this._focusedItem;\n if (!item || item.getChildren().length === 0) {\n return;\n }\n if (!item.expanded) {\n this.setActiveItem(item);\n item.expandWithEvent();\n return;\n }\n const firstChild = item.getChildren().find((child) => !child.disabled);\n if (firstChild) {\n this.setFocusedAndActiveItem(firstChild);\n }\n }\n\n private _arrowVertical(dir: 1 | -1, shouldActivate: boolean): void {\n const item = this._focusedItem;\n if (!item) {\n return;\n }\n const next = this._adjacent(item, dir);\n if (next === item) {\n return;\n }\n this.setFocusedAndActiveItem(next, shouldActivate);\n }\n\n private readonly _asterisk = (): void => {\n const item = this._focusedItem;\n if (!item) {\n return;\n }\n const siblings = item.parent\n ? item.parent.getChildren()\n : this.tree._rootItems;\n\n for (const sibling of siblings) {\n if (!sibling.disabled && !sibling.expanded && sibling.hasChildren) {\n sibling.expandWithEvent();\n }\n }\n };\n\n private _space(shiftKey: boolean): void {\n const item = this._focusedItem;\n if (!item) {\n return;\n }\n\n this.setActiveItem(item);\n\n if (this.tree.selection === 'none') {\n return;\n }\n\n if (shiftKey) {\n this.selection.selectMultipleItems(item);\n return;\n }\n\n item.selected\n ? this.selection.deselectItem(item)\n : this.selection.selectItem(item);\n }\n\n private readonly _enter = (): void => {\n if (this._focusedItem) {\n this.setActiveItem(this._focusedItem);\n }\n };\n\n //#endregion\n}\n"]}
|
package/components/types.d.ts
CHANGED
|
@@ -14,6 +14,8 @@ export type BadgeShape = 'rounded' | 'square';
|
|
|
14
14
|
export type ButtonGroupSelection = 'single' | 'single-required' | 'multiple';
|
|
15
15
|
export type ButtonVariant = 'contained' | 'flat' | 'outlined' | 'fab';
|
|
16
16
|
export type CarouselIndicatorsOrientation = 'end' | 'start';
|
|
17
|
+
export type ColorFormat = 'hex' | 'rgb' | 'hsl';
|
|
18
|
+
export type ColorPickerMode = 'default' | 'input';
|
|
17
19
|
export type DateRangeValue = {
|
|
18
20
|
start: Date | null;
|
|
19
21
|
end: Date | null;
|
package/components/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"","sourcesContent":["// Public API types\n// NOTE: use default value as first in order where possible for union types\n\n//#region shared types\nexport type AbsolutePosition = 'bottom' | 'middle' | 'top';\nexport type ContentOrientation = 'horizontal' | 'vertical';\nexport type HorizontalTransitionAnimation = 'slide' | 'fade' | 'none';\nexport type NotificationPositioning = 'viewport' | 'container';\nexport type PickerMode = 'dropdown' | 'dialog';\nexport type PopoverScrollStrategy = 'scroll' | 'block' | 'close';\nexport type RangeTextSelectMode = 'preserve' | 'select' | 'start' | 'end';\nexport type SelectionRangeDirection = 'none' | 'backward' | 'forward';\nexport type StyleVariant =\n | 'primary'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger';\nexport type ToggleLabelPosition = 'after' | 'before';\nexport type TreeSelection = 'none' | 'multiple' | 'cascade';\n//#endregion\n\n//#region component-specific\nexport type AvatarShape = 'square' | 'circle' | 'rounded';\nexport type BadgeShape = 'rounded' | 'square';\nexport type ButtonGroupSelection = 'single' | 'single-required' | 'multiple';\nexport type ButtonVariant = 'contained' | 'flat' | 'outlined' | 'fab';\nexport type CarouselIndicatorsOrientation = 'end' | 'start';\n/* jsonAPIPlainObject */\nexport type DateRangeValue = { start: Date | null; end: Date | null };\nexport type DividerType = 'solid' | 'dashed';\nexport type ExpansionPanelIndicatorPosition = 'start' | 'end' | 'none';\nexport type IconButtonVariant = 'contained' | 'flat' | 'outlined';\nexport type InputType =\n | 'text'\n | 'email'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'url';\nexport type LinearProgressLabelAlign =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'bottom-start'\n | 'bottom'\n | 'bottom-end';\nexport type MaskInputValueMode = 'raw' | 'withFormatting';\nexport type NavDrawerPosition = 'start' | 'end' | 'top' | 'bottom' | 'relative';\nexport type SliderTickLabelRotation = 0 | 90 | -90;\nexport type SliderTickOrientation = 'end' | 'mirror' | 'start';\nexport type SplitterOrientation = 'horizontal' | 'vertical';\nexport type StepperOrientation = 'horizontal' | 'vertical';\nexport type StepperStepType = 'full' | 'indicator' | 'title';\nexport type StepperTitlePosition = 'auto' | 'bottom' | 'top' | 'end' | 'start';\nexport type StepperVerticalAnimation = 'grow' | 'fade' | 'none';\nexport type TabsActivation = 'auto' | 'manual';\nexport type TabsAlignment = 'start' | 'end' | 'center' | 'justify';\nexport type TextareaResize = 'vertical' | 'auto' | 'none';\nexport type TileManagerDragMode = 'none' | 'tile-header' | 'tile';\nexport type TileManagerResizeMode = 'none' | 'hover' | 'always';\n//#endregion\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/components/types.ts"],"names":[],"mappings":"","sourcesContent":["// Public API types\n// NOTE: use default value as first in order where possible for union types\n\n//#region shared types\nexport type AbsolutePosition = 'bottom' | 'middle' | 'top';\nexport type ContentOrientation = 'horizontal' | 'vertical';\nexport type HorizontalTransitionAnimation = 'slide' | 'fade' | 'none';\nexport type NotificationPositioning = 'viewport' | 'container';\nexport type PickerMode = 'dropdown' | 'dialog';\nexport type PopoverScrollStrategy = 'scroll' | 'block' | 'close';\nexport type RangeTextSelectMode = 'preserve' | 'select' | 'start' | 'end';\nexport type SelectionRangeDirection = 'none' | 'backward' | 'forward';\nexport type StyleVariant =\n | 'primary'\n | 'info'\n | 'success'\n | 'warning'\n | 'danger';\nexport type ToggleLabelPosition = 'after' | 'before';\nexport type TreeSelection = 'none' | 'multiple' | 'cascade';\n//#endregion\n\n//#region component-specific\nexport type AvatarShape = 'square' | 'circle' | 'rounded';\nexport type BadgeShape = 'rounded' | 'square';\nexport type ButtonGroupSelection = 'single' | 'single-required' | 'multiple';\nexport type ButtonVariant = 'contained' | 'flat' | 'outlined' | 'fab';\nexport type CarouselIndicatorsOrientation = 'end' | 'start';\nexport type ColorFormat = 'hex' | 'rgb' | 'hsl';\nexport type ColorPickerMode = 'default' | 'input';\n/* jsonAPIPlainObject */\nexport type DateRangeValue = { start: Date | null; end: Date | null };\nexport type DividerType = 'solid' | 'dashed';\nexport type ExpansionPanelIndicatorPosition = 'start' | 'end' | 'none';\nexport type IconButtonVariant = 'contained' | 'flat' | 'outlined';\nexport type InputType =\n | 'text'\n | 'email'\n | 'number'\n | 'password'\n | 'search'\n | 'tel'\n | 'url';\nexport type LinearProgressLabelAlign =\n | 'top-start'\n | 'top'\n | 'top-end'\n | 'bottom-start'\n | 'bottom'\n | 'bottom-end';\nexport type MaskInputValueMode = 'raw' | 'withFormatting';\nexport type NavDrawerPosition = 'start' | 'end' | 'top' | 'bottom' | 'relative';\nexport type SliderTickLabelRotation = 0 | 90 | -90;\nexport type SliderTickOrientation = 'end' | 'mirror' | 'start';\nexport type SplitterOrientation = 'horizontal' | 'vertical';\nexport type StepperOrientation = 'horizontal' | 'vertical';\nexport type StepperStepType = 'full' | 'indicator' | 'title';\nexport type StepperTitlePosition = 'auto' | 'bottom' | 'top' | 'end' | 'start';\nexport type StepperVerticalAnimation = 'grow' | 'fade' | 'none';\nexport type TabsActivation = 'auto' | 'manual';\nexport type TabsAlignment = 'start' | 'end' | 'center' | 'justify';\nexport type TextareaResize = 'vertical' | 'auto' | 'none';\nexport type TileManagerDragMode = 'none' | 'tile-header' | 'tile';\nexport type TileManagerResizeMode = 'none' | 'hover' | 'always';\n//#endregion\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LitElement, nothing, type TemplateResult } from 'lit';
|
|
2
2
|
import { type IgcFormControl } from '#internals/mixins/forms/types.js';
|
|
3
3
|
/** Configuration for the validation container. */
|
|
4
|
-
interface ValidationContainerConfig {
|
|
4
|
+
export interface ValidationContainerConfig {
|
|
5
5
|
/** The id attribute for the validation container. */
|
|
6
6
|
id?: string;
|
|
7
7
|
/** Project the validation container to the given slot inside the host shadow DOM. */
|
|
@@ -70,4 +70,3 @@ declare global {
|
|
|
70
70
|
'igc-validator': IgcValidationContainerComponent;
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
-
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation-container.js","sourceRoot":"","sources":["../../../src/components/validation-container/validation-container.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAEL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,OAAO,E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,OAAO,EAAE;YACd,CAAC,CAAC,OAAO,CAAC;QAEd,OAAO,IAAI,CAAA;;eAEA,OAAO,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;;;UAG/D,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;;KAExD,CAAC;IACJ,CAAC;;AAlJM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gEACL;AAYvB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6DAY9B","sourcesContent":["import { html, isServer, LitElement, nothing, type TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { createAbortHandle } from '#internals/abort-handler.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport {\n type IgcFormControl,\n InternalInvalidEvent,\n InternalResetEvent,\n} from '#internals/mixins/forms/types.js';\nimport { partMap } from '#internals/part-map.js';\nimport { isEmpty } from '#internals/utils/arrays.js';\nimport { toKebabCase } from '#internals/utils/strings.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport IgcIconComponent from '../icon/icon.js';\nimport { all as inputThemes } from '../input/themes/themes.js';\nimport { styles as shared } from './themes/shared/validator.common.css.js';\nimport { styles } from './themes/validator.base.css.js';\n\n/** Configuration for the validation container. */\ninterface ValidationContainerConfig {\n /** The id attribute for the validation container. */\n id?: string;\n /** Project the validation container to the given slot inside the host shadow DOM. */\n slot?: string;\n /** Additional part(s) that should be bound to the validation container. */\n part?: string;\n /** Whether the validation container should expose a helper-text slot. */\n hasHelperText?: boolean;\n}\n\nconst ALL_SLOTS_SELECTOR = 'slot';\nconst QUERY_CONFIG: AssignedNodesOptions = { flatten: true };\n\n/**\n * Validity flags rendered as validation message slots, in a stable order so the\n * generated slots are deterministic across browsers.\n */\nconst VALIDITY_KEYS: ReadonlyArray<keyof ValidityStateFlags> = [\n 'badInput',\n 'customError',\n 'patternMismatch',\n 'rangeOverflow',\n 'rangeUnderflow',\n 'stepMismatch',\n 'tooLong',\n 'tooShort',\n 'typeMismatch',\n 'valueMissing',\n];\n\n/**\n * Yields the active validation slot names for the given validity state, in a\n * stable order (`invalid` first, then each failing constraint).\n */\nfunction* activeValidationSlots(validity: ValidityState): Generator<string> {\n if (!validity.valid) {\n yield 'invalid';\n }\n\n for (const key of VALIDITY_KEYS) {\n if (validity[key]) {\n yield toKebabCase(key);\n }\n }\n}\n\n/* blazorSuppress */\n/**\n * @element igc-validator\n *\n * @csspart helper-text - The base wrapper\n * @csspart validation-message - The validation error message container\n * @csspart validation-icon - The validation error icon\n */\nexport default class IgcValidationContainerComponent extends LitElement {\n public static readonly tagName = 'igc-validator';\n public static override styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcValidationContainerComponent, IgcIconComponent);\n }\n\n /**\n * Creates a validation container for the given form control.\n *\n * The container will render validation messages based on the control's validity state\n * and projected content, and reflect the control's `invalid` state.\n */\n public static create(\n host: IgcFormControl,\n config: ValidationContainerConfig = {\n id: 'helper-text',\n hasHelperText: true,\n }\n ): TemplateResult {\n const helperText = config.hasHelperText\n ? html`<slot name=\"helper-text\" slot=\"helper-text\"></slot>`\n : nothing;\n\n // `hasUpdated` is false during SSR and the host's hydrating render, so both\n // emit `nothing`. The real validation slots are projected post-hydration.\n const validationSlots = host.hasUpdated\n ? Iterator.from(activeValidationSlots(host.validity))\n .map((name) => html`<slot name=${name} slot=${name}></slot>`)\n .toArray()\n : nothing;\n\n return html`\n <igc-validator\n id=${ifDefined(config.id)}\n part=${ifDefined(config.part)}\n slot=${ifDefined(config.slot)}\n ?invalid=${host.invalid}\n .target=${host}\n exportparts=\"helper-text, validation-message, validation-icon\"\n >\n ${helperText}${validationSlots}\n </igc-validator>\n `;\n }\n\n private readonly _abortHandle = createAbortHandle();\n private _target!: IgcFormControl;\n\n /**\n * Whether the container is in an invalid state.\n *\n * This is reflected from the target's `invalid` property,\n * and is used to determine whether to render the validation message slots.\n */\n @property({ type: Boolean })\n public invalid = false;\n\n /**\n * The form control whose validity state is being rendered. The target's `invalid`\n * property is reflected to the container, and its validity state is used to\n * determine which validation message slots to render.\n *\n * @remarks The target must be set for the container to function, and should be\n * set before the first update cycle for SSR compatibility. When using the\n * `create` method, the target is set automatically.\n */\n @property({ attribute: false })\n public set target(value: IgcFormControl) {\n if (this._target === value) {\n return;\n }\n\n this._abortHandle.abort();\n const { signal } = this._abortHandle;\n\n this._target = value;\n this._target.addEventListener(InternalInvalidEvent, this, { signal });\n this._target.addEventListener(InternalResetEvent, this, { signal });\n }\n\n public get target(): IgcFormControl {\n return this._target;\n }\n\n constructor() {\n super();\n addThemingController(this, inputThemes);\n }\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n root.addEventListener('slotchange', this);\n return root;\n }\n\n /** @internal */\n public handleEvent(event: Event): void {\n switch (event.type) {\n case InternalInvalidEvent:\n this.invalid = true;\n break;\n case InternalResetEvent:\n this.invalid = false;\n break;\n }\n\n this.requestUpdate();\n }\n\n /**\n * Collects the projection state of the container slots in a single DOM pass.\n *\n * @returns Whether every slot is empty and the set of non-empty validation\n * slot names (i.e. excluding `helper-text`).\n */\n private _collectProjectedSlots(): {\n isProjectionEmpty: boolean;\n validation: Set<string>;\n } {\n const validation = new Set<string>();\n\n if (isServer || !this.hasUpdated) {\n return { isProjectionEmpty: false, validation };\n }\n\n const slots = Array.from(\n this.renderRoot.querySelectorAll<HTMLSlotElement>(ALL_SLOTS_SELECTOR)\n );\n let isProjectionEmpty = true;\n\n for (const slot of slots) {\n if (isEmpty(slot.assignedElements(QUERY_CONFIG))) {\n continue;\n }\n\n isProjectionEmpty = false;\n if (slot.name && slot.name !== 'helper-text') {\n validation.add(slot.name);\n }\n }\n\n return { isProjectionEmpty, validation };\n }\n\n protected _renderValidationMessage(\n slotName: string,\n projectedSlots: ReadonlySet<string>\n ): TemplateResult {\n const hasProjectedIcon = projectedSlots.has(slotName);\n const parts = { 'validation-message': true, empty: !hasProjectedIcon };\n const icon = hasProjectedIcon\n ? html`\n <igc-icon\n aria-hidden=\"true\"\n name=\"error\"\n part=\"validation-icon\"\n ></igc-icon>\n `\n : nothing;\n\n return html`<div part=${partMap(parts)}>\n ${icon}<slot name=${slotName}></slot>\n </div>`;\n }\n\n protected _renderHelper(\n hasValidationProjection: boolean\n ): TemplateResult | typeof nothing {\n return this.invalid && hasValidationProjection\n ? nothing\n : html`<slot name=\"helper-text\"></slot>`;\n }\n\n protected override firstUpdated(): void {\n // The first render is intentionally neutral to match the SSR output during\n // hydration. Only reconcile when the field hydrated in an invalid state, and\n // do it off the current update cycle so we don't schedule an update as a side\n // effect of the one in progress, projecting the real validation messages now\n // that `hasUpdated` is true.\n if (this.invalid) {\n queueMicrotask(() => this.requestUpdate());\n }\n }\n\n protected override render(): TemplateResult {\n const { isProjectionEmpty, validation } = this._collectProjectedSlots();\n const messages =\n this.hasUpdated && this.invalid\n ? Iterator.from(activeValidationSlots(this.target.validity))\n .map((name) => this._renderValidationMessage(name, validation))\n .toArray()\n : nothing;\n\n return html`\n <div\n part=${partMap({ 'helper-text': true, empty: isProjectionEmpty })}\n aria-live=\"polite\"\n >\n ${messages}${this._renderHelper(!isEmpty(validation))}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-validator': IgcValidationContainerComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"validation-container.js","sourceRoot":"","sources":["../../../src/components/validation-container/validation-container.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AAC/E,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,iBAAi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AC7B,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;iBACvD,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;iBAC9D,OAAO,EAAE;YACd,CAAC,CAAC,OAAO,CAAC;QAEd,OAAO,IAAI,CAAA;;eAEA,OAAO,CAAC,EAAE,aAAa,EAAE,IAAI,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;;;UAG/D,QAAQ,GAAG,IAAI,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;;KAExD,CAAC;IACJ,CAAC;;AAlJM;IADN,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gEACL;AAYvB;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6DAY9B","sourcesContent":["import { html, isServer, LitElement, nothing, type TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { createAbortHandle } from '#internals/abort-handler.js';\nimport { registerComponent } from '#internals/definitions/register.js';\nimport {\n type IgcFormControl,\n InternalInvalidEvent,\n InternalResetEvent,\n} from '#internals/mixins/forms/types.js';\nimport { partMap } from '#internals/part-map.js';\nimport { isEmpty } from '#internals/utils/arrays.js';\nimport { toKebabCase } from '#internals/utils/strings.js';\nimport { addThemingController } from '#theming/theming-controller.js';\nimport IgcIconComponent from '../icon/icon.js';\nimport { all as inputThemes } from '../input/themes/themes.js';\nimport { styles as shared } from './themes/shared/validator.common.css.js';\nimport { styles } from './themes/validator.base.css.js';\n\n/** Configuration for the validation container. */\nexport interface ValidationContainerConfig {\n /** The id attribute for the validation container. */\n id?: string;\n /** Project the validation container to the given slot inside the host shadow DOM. */\n slot?: string;\n /** Additional part(s) that should be bound to the validation container. */\n part?: string;\n /** Whether the validation container should expose a helper-text slot. */\n hasHelperText?: boolean;\n}\n\nconst ALL_SLOTS_SELECTOR = 'slot';\nconst QUERY_CONFIG: AssignedNodesOptions = { flatten: true };\n\n/**\n * Validity flags rendered as validation message slots, in a stable order so the\n * generated slots are deterministic across browsers.\n */\nconst VALIDITY_KEYS: ReadonlyArray<keyof ValidityStateFlags> = [\n 'badInput',\n 'customError',\n 'patternMismatch',\n 'rangeOverflow',\n 'rangeUnderflow',\n 'stepMismatch',\n 'tooLong',\n 'tooShort',\n 'typeMismatch',\n 'valueMissing',\n];\n\n/**\n * Yields the active validation slot names for the given validity state, in a\n * stable order (`invalid` first, then each failing constraint).\n */\nfunction* activeValidationSlots(validity: ValidityState): Generator<string> {\n if (!validity.valid) {\n yield 'invalid';\n }\n\n for (const key of VALIDITY_KEYS) {\n if (validity[key]) {\n yield toKebabCase(key);\n }\n }\n}\n\n/* blazorSuppress */\n/**\n * @element igc-validator\n *\n * @csspart helper-text - The base wrapper\n * @csspart validation-message - The validation error message container\n * @csspart validation-icon - The validation error icon\n */\nexport default class IgcValidationContainerComponent extends LitElement {\n public static readonly tagName = 'igc-validator';\n public static override styles = [styles, shared];\n\n /* blazorSuppress */\n public static register(): void {\n registerComponent(IgcValidationContainerComponent, IgcIconComponent);\n }\n\n /**\n * Creates a validation container for the given form control.\n *\n * The container will render validation messages based on the control's validity state\n * and projected content, and reflect the control's `invalid` state.\n */\n public static create(\n host: IgcFormControl,\n config: ValidationContainerConfig = {\n id: 'helper-text',\n hasHelperText: true,\n }\n ): TemplateResult {\n const helperText = config.hasHelperText\n ? html`<slot name=\"helper-text\" slot=\"helper-text\"></slot>`\n : nothing;\n\n // `hasUpdated` is false during SSR and the host's hydrating render, so both\n // emit `nothing`. The real validation slots are projected post-hydration.\n const validationSlots = host.hasUpdated\n ? Iterator.from(activeValidationSlots(host.validity))\n .map((name) => html`<slot name=${name} slot=${name}></slot>`)\n .toArray()\n : nothing;\n\n return html`\n <igc-validator\n id=${ifDefined(config.id)}\n part=${ifDefined(config.part)}\n slot=${ifDefined(config.slot)}\n ?invalid=${host.invalid}\n .target=${host}\n exportparts=\"helper-text, validation-message, validation-icon\"\n >\n ${helperText}${validationSlots}\n </igc-validator>\n `;\n }\n\n private readonly _abortHandle = createAbortHandle();\n private _target!: IgcFormControl;\n\n /**\n * Whether the container is in an invalid state.\n *\n * This is reflected from the target's `invalid` property,\n * and is used to determine whether to render the validation message slots.\n */\n @property({ type: Boolean })\n public invalid = false;\n\n /**\n * The form control whose validity state is being rendered. The target's `invalid`\n * property is reflected to the container, and its validity state is used to\n * determine which validation message slots to render.\n *\n * @remarks The target must be set for the container to function, and should be\n * set before the first update cycle for SSR compatibility. When using the\n * `create` method, the target is set automatically.\n */\n @property({ attribute: false })\n public set target(value: IgcFormControl) {\n if (this._target === value) {\n return;\n }\n\n this._abortHandle.abort();\n const { signal } = this._abortHandle;\n\n this._target = value;\n this._target.addEventListener(InternalInvalidEvent, this, { signal });\n this._target.addEventListener(InternalResetEvent, this, { signal });\n }\n\n public get target(): IgcFormControl {\n return this._target;\n }\n\n constructor() {\n super();\n addThemingController(this, inputThemes);\n }\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n root.addEventListener('slotchange', this);\n return root;\n }\n\n /** @internal */\n public handleEvent(event: Event): void {\n switch (event.type) {\n case InternalInvalidEvent:\n this.invalid = true;\n break;\n case InternalResetEvent:\n this.invalid = false;\n break;\n }\n\n this.requestUpdate();\n }\n\n /**\n * Collects the projection state of the container slots in a single DOM pass.\n *\n * @returns Whether every slot is empty and the set of non-empty validation\n * slot names (i.e. excluding `helper-text`).\n */\n private _collectProjectedSlots(): {\n isProjectionEmpty: boolean;\n validation: Set<string>;\n } {\n const validation = new Set<string>();\n\n if (isServer || !this.hasUpdated) {\n return { isProjectionEmpty: false, validation };\n }\n\n const slots = Array.from(\n this.renderRoot.querySelectorAll<HTMLSlotElement>(ALL_SLOTS_SELECTOR)\n );\n let isProjectionEmpty = true;\n\n for (const slot of slots) {\n if (isEmpty(slot.assignedElements(QUERY_CONFIG))) {\n continue;\n }\n\n isProjectionEmpty = false;\n if (slot.name && slot.name !== 'helper-text') {\n validation.add(slot.name);\n }\n }\n\n return { isProjectionEmpty, validation };\n }\n\n protected _renderValidationMessage(\n slotName: string,\n projectedSlots: ReadonlySet<string>\n ): TemplateResult {\n const hasProjectedIcon = projectedSlots.has(slotName);\n const parts = { 'validation-message': true, empty: !hasProjectedIcon };\n const icon = hasProjectedIcon\n ? html`\n <igc-icon\n aria-hidden=\"true\"\n name=\"error\"\n part=\"validation-icon\"\n ></igc-icon>\n `\n : nothing;\n\n return html`<div part=${partMap(parts)}>\n ${icon}<slot name=${slotName}></slot>\n </div>`;\n }\n\n protected _renderHelper(\n hasValidationProjection: boolean\n ): TemplateResult | typeof nothing {\n return this.invalid && hasValidationProjection\n ? nothing\n : html`<slot name=\"helper-text\"></slot>`;\n }\n\n protected override firstUpdated(): void {\n // The first render is intentionally neutral to match the SSR output during\n // hydration. Only reconcile when the field hydrated in an invalid state, and\n // do it off the current update cycle so we don't schedule an update as a side\n // effect of the one in progress, projecting the real validation messages now\n // that `hasUpdated` is true.\n if (this.invalid) {\n queueMicrotask(() => this.requestUpdate());\n }\n }\n\n protected override render(): TemplateResult {\n const { isProjectionEmpty, validation } = this._collectProjectedSlots();\n const messages =\n this.hasUpdated && this.invalid\n ? Iterator.from(activeValidationSlots(this.target.validity))\n .map((name) => this._renderValidationMessage(name, validation))\n .toArray()\n : nothing;\n\n return html`\n <div\n part=${partMap({ 'helper-text': true, empty: isProjectionEmpty })}\n aria-live=\"polite\"\n >\n ${messages}${this._renderHelper(!isEmpty(validation))}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'igc-validator': IgcValidationContainerComponent;\n }\n}\n"]}
|