@emuanalytics/flow-rdf-ui 4.0.5 → 4.0.7
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/dist/components/alert/alert.component.mjs +202 -0
- package/dist/components/alert/alert.mjs +5 -0
- package/dist/components/alert/alert.styles.mjs +107 -0
- package/dist/components/animation/animation.component.mjs +207 -0
- package/dist/components/animation/animation.mjs +5 -0
- package/dist/components/animation/animation.styles.mjs +12 -0
- package/dist/components/animation/animations.mjs +11 -0
- package/dist/components/avatar/avatar.component.mjs +95 -0
- package/dist/components/avatar/avatar.mjs +5 -0
- package/dist/components/avatar/avatar.styles.mjs +70 -0
- package/dist/components/badge/badge.component.mjs +62 -0
- package/dist/components/badge/badge.mjs +5 -0
- package/dist/components/badge/badge.styles.mjs +105 -0
- package/dist/components/breadcrumb/breadcrumb.component.mjs +82 -0
- package/dist/components/breadcrumb/breadcrumb.mjs +5 -0
- package/dist/components/breadcrumb/breadcrumb.styles.mjs +14 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.component.mjs +73 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.mjs +5 -0
- package/dist/components/breadcrumb-item/breadcrumb-item.styles.mjs +90 -0
- package/dist/components/button/button.component.mjs +310 -0
- package/dist/components/button/button.mjs +5 -0
- package/dist/components/button/button.styles.mjs +690 -0
- package/dist/components/button-group/button-group.component.mjs +108 -0
- package/dist/components/button-group/button-group.mjs +5 -0
- package/dist/components/button-group/button-group.styles.mjs +21 -0
- package/dist/components/calendar/calendar.component.mjs +320 -0
- package/dist/components/calendar/calendar.mjs +5 -0
- package/dist/components/calendar/calendar.styles.mjs +145 -0
- package/dist/components/card/card.component.mjs +33 -0
- package/dist/components/card/card.mjs +5 -0
- package/dist/components/card/card.styles.mjs +73 -0
- package/dist/components/carousel/autoplay-controller.mjs +56 -0
- package/dist/components/carousel/carousel.component.mjs +406 -0
- package/dist/components/carousel/carousel.mjs +5 -0
- package/dist/components/carousel/carousel.styles.mjs +162 -0
- package/dist/components/carousel/scroll-controller.mjs +148 -0
- package/dist/components/carousel-item/carousel-item.component.mjs +22 -0
- package/dist/components/carousel-item/carousel-item.mjs +5 -0
- package/dist/components/carousel-item/carousel-item.styles.mjs +28 -0
- package/dist/components/chart/chart.component.mjs +82 -0
- package/dist/components/chart/chart.mjs +5 -0
- package/dist/components/chart/chart.styles.mjs +80 -0
- package/dist/components/chart/chartjs-plugins/interaction.interpolate.mjs +80 -0
- package/dist/components/chart/chartjs-plugins/plugin.flow-ui-colors.mjs +135 -0
- package/dist/components/chart/chartjs-plugins/positioner.cursor.mjs +14 -0
- package/dist/components/chart/chartjs-plugins/symlog.scale.mjs +42 -0
- package/dist/components/chart/chartjs-support.mjs +59 -0
- package/dist/components/checkbox/checkbox.component.mjs +246 -0
- package/dist/components/checkbox/checkbox.mjs +5 -0
- package/dist/components/checkbox/checkbox.styles.mjs +177 -0
- package/dist/components/color-mapper/color-mapper.component.mjs +260 -0
- package/dist/components/color-mapper/color-mapper.mjs +5 -0
- package/dist/components/color-mapper/color-mapper.styles.mjs +92 -0
- package/dist/components/color-mapper/helpers.mjs +55 -0
- package/dist/components/color-picker/color-picker.component.mjs +919 -0
- package/dist/components/color-picker/color-picker.mjs +5 -0
- package/dist/components/color-picker/color-picker.styles.mjs +337 -0
- package/dist/components/color-stop/color-stop.component.mjs +289 -0
- package/dist/components/color-stop/color-stop.mjs +5 -0
- package/dist/components/color-stop/color-stop.styles.mjs +103 -0
- package/dist/components/date-time-picker/date-time-picker.component.mjs +532 -0
- package/dist/components/date-time-picker/date-time-picker.mjs +5 -0
- package/dist/components/date-time-picker/date-time-picker.styles.mjs +260 -0
- package/dist/components/details/details.component.mjs +194 -0
- package/dist/components/details/details.mjs +5 -0
- package/dist/components/details/details.styles.mjs +85 -0
- package/dist/components/dialog/dialog.component.mjs +256 -0
- package/dist/components/dialog/dialog.mjs +5 -0
- package/dist/components/dialog/dialog.styles.mjs +125 -0
- package/dist/components/divider/divider.component.mjs +45 -0
- package/dist/components/divider/divider.mjs +5 -0
- package/dist/components/divider/divider.styles.mjs +34 -0
- package/dist/components/drawer/drawer.component.mjs +354 -0
- package/dist/components/drawer/drawer.mjs +5 -0
- package/dist/components/drawer/drawer.styles.mjs +161 -0
- package/dist/components/dropdown/dropdown.component.mjs +381 -0
- package/dist/components/dropdown/dropdown.mjs +5 -0
- package/dist/components/dropdown/dropdown.styles.mjs +56 -0
- package/dist/components/gauge/gauge.component.mjs +151 -0
- package/dist/components/gauge/gauge.mjs +5 -0
- package/dist/components/gauge/gauge.styles.mjs +127 -0
- package/dist/components/icon/icon.component.mjs +146 -0
- package/dist/components/icon/icon.mjs +5 -0
- package/dist/components/icon/icon.styles.mjs +35 -0
- package/dist/components/icon/library.default.mjs +38 -0
- package/dist/components/icon/library.mjs +38 -0
- package/dist/components/icon/library.system.mjs +158 -0
- package/dist/components/icon-button/icon-button.component.mjs +239 -0
- package/dist/components/icon-button/icon-button.mjs +5 -0
- package/dist/components/icon-button/icon-button.styles.mjs +81 -0
- package/dist/components/input/input.component.mjs +574 -0
- package/dist/components/input/input.mjs +5 -0
- package/dist/components/input/input.styles.mjs +310 -0
- package/dist/components/map/map.component.mjs +196 -0
- package/dist/components/map/map.mjs +5 -0
- package/dist/components/map/map.styles.mjs +90 -0
- package/dist/components/menu/menu.component.mjs +125 -0
- package/dist/components/menu/menu.mjs +5 -0
- package/dist/components/menu/menu.styles.mjs +23 -0
- package/dist/components/menu-item/menu-item.component.mjs +143 -0
- package/dist/components/menu-item/menu-item.mjs +5 -0
- package/dist/components/menu-item/menu-item.styles.mjs +103 -0
- package/dist/components/menu-label/menu-label.component.mjs +14 -0
- package/dist/components/menu-label/menu-label.mjs +5 -0
- package/dist/components/menu-label/menu-label.styles.mjs +24 -0
- package/dist/components/mutation-observer/mutation-observer.component.mjs +115 -0
- package/dist/components/mutation-observer/mutation-observer.mjs +5 -0
- package/dist/components/mutation-observer/mutation-observer.styles.mjs +12 -0
- package/dist/components/option/option.component.mjs +152 -0
- package/dist/components/option/option.mjs +5 -0
- package/dist/components/option/option.styles.mjs +102 -0
- package/dist/components/panel/panel.component.mjs +90 -0
- package/dist/components/panel/panel.mjs +5 -0
- package/dist/components/panel/panel.styles.mjs +51 -0
- package/dist/components/panel-header/panel-header.component.mjs +131 -0
- package/dist/components/panel-header/panel-header.mjs +5 -0
- package/dist/components/panel-header/panel-header.styles.mjs +67 -0
- package/dist/components/popup/popup.component.mjs +420 -0
- package/dist/components/popup/popup.mjs +5 -0
- package/dist/components/popup/popup.styles.mjs +63 -0
- package/dist/components/progress-bar/progress-bar.component.mjs +70 -0
- package/dist/components/progress-bar/progress-bar.mjs +5 -0
- package/dist/components/progress-bar/progress-bar.styles.mjs +87 -0
- package/dist/components/progress-ring/progress-ring.component.mjs +71 -0
- package/dist/components/progress-ring/progress-ring.mjs +5 -0
- package/dist/components/progress-ring/progress-ring.styles.mjs +72 -0
- package/dist/components/query-builder/converters/flow-query-converters.mjs +111 -0
- package/dist/components/query-builder/converters/map-layer-filter-converter.mjs +99 -0
- package/dist/components/query-builder/default-value-templates.mjs +151 -0
- package/dist/components/query-builder/helpers.mjs +42 -0
- package/dist/components/query-builder/query-builder.component.mjs +466 -0
- package/dist/components/query-builder/query-builder.mjs +5 -0
- package/dist/components/query-builder/query-builder.styles.mjs +261 -0
- package/dist/components/radio/radio.component.mjs +144 -0
- package/dist/components/radio/radio.mjs +5 -0
- package/dist/components/radio/radio.styles.mjs +164 -0
- package/dist/components/radio-group/radio-group.component.mjs +310 -0
- package/dist/components/radio-group/radio-group.mjs +5 -0
- package/dist/components/radio-group/radio-group.styles.mjs +49 -0
- package/dist/components/range/range.component.mjs +324 -0
- package/dist/components/range/range.mjs +5 -0
- package/dist/components/range/range.styles.mjs +233 -0
- package/dist/components/resize-observer/resize-observer.component.mjs +80 -0
- package/dist/components/resize-observer/resize-observer.mjs +5 -0
- package/dist/components/resize-observer/resize-observer.styles.mjs +12 -0
- package/dist/components/scroll-view/overlay-scrollbar.styles.mjs +686 -0
- package/dist/components/scroll-view/scroll-view.component.mjs +128 -0
- package/dist/components/scroll-view/scroll-view.mjs +5 -0
- package/dist/components/scroll-view/scroll-view.styles.mjs +57 -0
- package/dist/components/select/select.component.mjs +785 -0
- package/dist/components/select/select.mjs +5 -0
- package/dist/components/select/select.styles.mjs +339 -0
- package/dist/components/spinner/spinner.component.mjs +22 -0
- package/dist/components/spinner/spinner.mjs +5 -0
- package/dist/components/spinner/spinner.styles.mjs +64 -0
- package/dist/components/split-view/split-view.component.mjs +500 -0
- package/dist/components/split-view/split-view.mjs +5 -0
- package/dist/components/split-view/split-view.styles.mjs +33 -0
- package/dist/components/split-view-divider/split-view-divider.component.mjs +98 -0
- package/dist/components/split-view-divider/split-view-divider.mjs +5 -0
- package/dist/components/split-view-divider/split-view-divider.styles.mjs +96 -0
- package/dist/components/split-view-pane/split-view-pane.component.mjs +126 -0
- package/dist/components/split-view-pane/split-view-pane.mjs +5 -0
- package/dist/components/split-view-pane/split-view-pane.styles.mjs +49 -0
- package/dist/components/split-view-toggle-button/split-view-toggle-button.component.mjs +76 -0
- package/dist/components/split-view-toggle-button/split-view-toggle-button.mjs +5 -0
- package/dist/components/split-view-toggle-button/split-view-toggle-button.styles.mjs +40 -0
- package/dist/components/stepper/stepper.component.mjs +139 -0
- package/dist/components/stepper/stepper.mjs +5 -0
- package/dist/components/stepper/stepper.styles.mjs +103 -0
- package/dist/components/stepper-panel/stepper-panel.component.mjs +76 -0
- package/dist/components/stepper-panel/stepper-panel.mjs +5 -0
- package/dist/components/stepper-panel/stepper-panel.styles.mjs +22 -0
- package/dist/components/switch/switch.component.mjs +211 -0
- package/dist/components/switch/switch.mjs +5 -0
- package/dist/components/switch/switch.styles.mjs +166 -0
- package/dist/components/tab/tab.component.mjs +159 -0
- package/dist/components/tab/tab.mjs +5 -0
- package/dist/components/tab/tab.styles.mjs +107 -0
- package/dist/components/tab-group/tab-group.component.mjs +402 -0
- package/dist/components/tab-group/tab-group.mjs +5 -0
- package/dist/components/tab-group/tab-group.styles.mjs +386 -0
- package/dist/components/tab-panel/tab-panel.component.mjs +72 -0
- package/dist/components/tab-panel/tab-panel.mjs +5 -0
- package/dist/components/tab-panel/tab-panel.styles.mjs +55 -0
- package/dist/components/tag/tag.component.mjs +94 -0
- package/dist/components/tag/tag.mjs +5 -0
- package/dist/components/tag/tag.styles.mjs +130 -0
- package/dist/components/textarea/textarea.component.mjs +359 -0
- package/dist/components/textarea/textarea.mjs +5 -0
- package/dist/components/textarea/textarea.styles.mjs +171 -0
- package/dist/components/timer/ticker.mjs +78 -0
- package/dist/components/timer/timer.component.mjs +297 -0
- package/dist/components/timer/timer.mjs +5 -0
- package/dist/components/timer/timer.styles.mjs +95 -0
- package/dist/components/tool-button/tool-button.component.mjs +208 -0
- package/dist/components/tool-button/tool-button.mjs +5 -0
- package/dist/components/tool-button/tool-button.styles.mjs +251 -0
- package/dist/components/tool-button-group/tool-button-group.component.mjs +347 -0
- package/dist/components/tool-button-group/tool-button-group.mjs +5 -0
- package/dist/components/tool-button-group/tool-button-group.styles.mjs +59 -0
- package/dist/components/tooltip/tooltip.component.mjs +259 -0
- package/dist/components/tooltip/tooltip.mjs +5 -0
- package/dist/components/tooltip/tooltip.styles.mjs +57 -0
- package/dist/components/tree/tree.component.mjs +368 -0
- package/dist/components/tree/tree.mjs +5 -0
- package/dist/components/tree/tree.styles.mjs +41 -0
- package/dist/components/tree-item/tree-item.component.mjs +324 -0
- package/dist/components/tree-item/tree-item.mjs +5 -0
- package/dist/components/tree-item/tree-item.styles.mjs +178 -0
- package/dist/components/visually-hidden/visually-hidden.component.mjs +14 -0
- package/dist/components/visually-hidden/visually-hidden.mjs +5 -0
- package/dist/components/visually-hidden/visually-hidden.styles.mjs +20 -0
- package/dist/custom-elements.json +1535 -1530
- package/dist/index.d.mts +145 -132
- package/dist/index.d.ts +145 -132
- package/dist/index.mjs +78 -25094
- package/dist/internal/animate.mjs +47 -0
- package/dist/internal/animations/attention_seekers/bounce.mjs +17 -0
- package/dist/internal/animations/attention_seekers/flash.mjs +9 -0
- package/dist/internal/animations/attention_seekers/headShake.mjs +10 -0
- package/dist/internal/animations/attention_seekers/heartBeat.mjs +9 -0
- package/dist/internal/animations/attention_seekers/jello.mjs +14 -0
- package/dist/internal/animations/attention_seekers/pulse.mjs +7 -0
- package/dist/internal/animations/attention_seekers/rubberBand.mjs +11 -0
- package/dist/internal/animations/attention_seekers/shake.mjs +15 -0
- package/dist/internal/animations/attention_seekers/shakeX.mjs +15 -0
- package/dist/internal/animations/attention_seekers/shakeY.mjs +15 -0
- package/dist/internal/animations/attention_seekers/swing.mjs +9 -0
- package/dist/internal/animations/attention_seekers/tada.mjs +15 -0
- package/dist/internal/animations/attention_seekers/wobble.mjs +11 -0
- package/dist/internal/animations/back_entrances/backInDown.mjs +7 -0
- package/dist/internal/animations/back_entrances/backInLeft.mjs +7 -0
- package/dist/internal/animations/back_entrances/backInRight.mjs +7 -0
- package/dist/internal/animations/back_entrances/backInUp.mjs +7 -0
- package/dist/internal/animations/back_exits/backOutDown.mjs +7 -0
- package/dist/internal/animations/back_exits/backOutLeft.mjs +7 -0
- package/dist/internal/animations/back_exits/backOutRight.mjs +7 -0
- package/dist/internal/animations/back_exits/backOutUp.mjs +7 -0
- package/dist/internal/animations/bouncing_entrances/bounceIn.mjs +16 -0
- package/dist/internal/animations/bouncing_entrances/bounceInDown.mjs +14 -0
- package/dist/internal/animations/bouncing_entrances/bounceInLeft.mjs +14 -0
- package/dist/internal/animations/bouncing_entrances/bounceInRight.mjs +14 -0
- package/dist/internal/animations/bouncing_entrances/bounceInUp.mjs +14 -0
- package/dist/internal/animations/bouncing_exits/bounceOut.mjs +8 -0
- package/dist/internal/animations/bouncing_exits/bounceOutDown.mjs +8 -0
- package/dist/internal/animations/bouncing_exits/bounceOutLeft.mjs +6 -0
- package/dist/internal/animations/bouncing_exits/bounceOutRight.mjs +6 -0
- package/dist/internal/animations/bouncing_exits/bounceOutUp.mjs +8 -0
- package/dist/internal/animations/easings/easings.mjs +33 -0
- package/dist/internal/animations/fading_entrances/fadeIn.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInBottomLeft.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInBottomRight.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInDown.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInDownBig.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInLeft.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInLeftBig.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInRight.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInRightBig.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInTopLeft.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInTopRight.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInUp.mjs +6 -0
- package/dist/internal/animations/fading_entrances/fadeInUpBig.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOut.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutBottomLeft.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutBottomRight.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutDown.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutDownBig.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutLeft.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutLeftBig.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutRight.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutRightBig.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutTopLeft.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutTopRight.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutUp.mjs +6 -0
- package/dist/internal/animations/fading_exits/fadeOutUpBig.mjs +6 -0
- package/dist/internal/animations/flippers/flip.mjs +29 -0
- package/dist/internal/animations/flippers/flipInX.mjs +9 -0
- package/dist/internal/animations/flippers/flipInY.mjs +9 -0
- package/dist/internal/animations/flippers/flipOutX.mjs +7 -0
- package/dist/internal/animations/flippers/flipOutY.mjs +7 -0
- package/dist/internal/animations/index.mjs +99 -0
- package/dist/internal/animations/lightspeed/lightSpeedInLeft.mjs +8 -0
- package/dist/internal/animations/lightspeed/lightSpeedInRight.mjs +8 -0
- package/dist/internal/animations/lightspeed/lightSpeedOutLeft.mjs +6 -0
- package/dist/internal/animations/lightspeed/lightSpeedOutRight.mjs +6 -0
- package/dist/internal/animations/rotating_entrances/rotateIn.mjs +6 -0
- package/dist/internal/animations/rotating_entrances/rotateInDownLeft.mjs +6 -0
- package/dist/internal/animations/rotating_entrances/rotateInDownRight.mjs +6 -0
- package/dist/internal/animations/rotating_entrances/rotateInUpLeft.mjs +6 -0
- package/dist/internal/animations/rotating_entrances/rotateInUpRight.mjs +6 -0
- package/dist/internal/animations/rotating_exits/rotateOut.mjs +6 -0
- package/dist/internal/animations/rotating_exits/rotateOutDownLeft.mjs +6 -0
- package/dist/internal/animations/rotating_exits/rotateOutDownRight.mjs +6 -0
- package/dist/internal/animations/rotating_exits/rotateOutUpLeft.mjs +6 -0
- package/dist/internal/animations/rotating_exits/rotateOutUpRight.mjs +6 -0
- package/dist/internal/animations/sliding_entrances/slideInDown.mjs +6 -0
- package/dist/internal/animations/sliding_entrances/slideInLeft.mjs +6 -0
- package/dist/internal/animations/sliding_entrances/slideInRight.mjs +6 -0
- package/dist/internal/animations/sliding_entrances/slideInUp.mjs +6 -0
- package/dist/internal/animations/sliding_exits/slideOutDown.mjs +6 -0
- package/dist/internal/animations/sliding_exits/slideOutLeft.mjs +6 -0
- package/dist/internal/animations/sliding_exits/slideOutRight.mjs +6 -0
- package/dist/internal/animations/sliding_exits/slideOutUp.mjs +6 -0
- package/dist/internal/animations/specials/hinge.mjs +10 -0
- package/dist/internal/animations/specials/jackInTheBox.mjs +8 -0
- package/dist/internal/animations/specials/rollIn.mjs +6 -0
- package/dist/internal/animations/specials/rollOut.mjs +6 -0
- package/dist/internal/animations/zooming_entrances/zoomIn.mjs +6 -0
- package/dist/internal/animations/zooming_entrances/zoomInDown.mjs +16 -0
- package/dist/internal/animations/zooming_entrances/zoomInLeft.mjs +16 -0
- package/dist/internal/animations/zooming_entrances/zoomInRight.mjs +16 -0
- package/dist/internal/animations/zooming_entrances/zoomInUp.mjs +16 -0
- package/dist/internal/animations/zooming_exits/zoomOut.mjs +7 -0
- package/dist/internal/animations/zooming_exits/zoomOutDown.mjs +16 -0
- package/dist/internal/animations/zooming_exits/zoomOutLeft.mjs +6 -0
- package/dist/internal/animations/zooming_exits/zoomOutRight.mjs +6 -0
- package/dist/internal/animations/zooming_exits/zoomOutUp.mjs +16 -0
- package/dist/internal/boolean.mjs +17 -0
- package/dist/internal/datetime.mjs +65 -0
- package/dist/internal/debounce.mjs +14 -0
- package/dist/internal/default-value.mjs +21 -0
- package/dist/internal/drag.mjs +30 -0
- package/dist/internal/ensure-array.mjs +16 -0
- package/dist/internal/event.mjs +13 -0
- package/dist/internal/flow-ui-rdf-element.mjs +61 -0
- package/dist/internal/form.mjs +264 -0
- package/dist/internal/localize.mjs +124 -0
- package/dist/internal/math.mjs +12 -0
- package/dist/internal/modal.mjs +52 -0
- package/dist/internal/offset.mjs +8 -0
- package/dist/internal/orderby.mjs +18 -0
- package/dist/internal/scroll.mjs +47 -0
- package/dist/internal/slot.mjs +59 -0
- package/dist/internal/string.mjs +5 -0
- package/dist/internal/tabbable.mjs +49 -0
- package/dist/internal/throttle.mjs +28 -0
- package/dist/internal/type-checks.mjs +16 -0
- package/dist/internal/watch.mjs +27 -0
- package/dist/package.json.mjs +3 -0
- package/dist/public-api.mjs +10 -0
- package/dist/styles/component.styles.mjs +19 -0
- package/dist/styles/form-control.styles.mjs +63 -0
- package/dist/translations/en.mjs +34 -0
- package/dist/utilities/animation-registry.mjs +33 -0
- package/dist/utilities/announce.mjs +12 -0
- package/dist/utilities/locale.mjs +10 -0
- package/dist/utilities/localize.mjs +7 -0
- package/dist/utilities/register-components.mjs +203 -0
- package/dist/vscode.html-custom-data.json +193 -181
- package/package.json +5 -8
- package/themes/dark.css +6 -2
- package/themes/dark.styles.js +6 -2
- package/themes/light.css +6 -2
- package/themes/light.styles.js +6 -2
- package/dist/icons/index.cjs +0 -4053
- package/dist/icons/index.d.cts +0 -2027
- package/dist/index.cjs +0 -25187
- package/dist/index.d.cts +0 -5678
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
import { html } from 'lit';
|
|
2
|
+
import { query, property } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
+
import { stopAnimations, animateTo } from '../../internal/animate.mjs';
|
|
6
|
+
import { boolean } from '../../internal/boolean.mjs';
|
|
7
|
+
import { waitForEvent } from '../../internal/event.mjs';
|
|
8
|
+
import FlowRdfElement from '../../internal/flow-ui-rdf-element.mjs';
|
|
9
|
+
import { getTabbableBoundary } from '../../internal/tabbable.mjs';
|
|
10
|
+
import { watch } from '../../internal/watch.mjs';
|
|
11
|
+
import componentStyles from '../../styles/component.styles.mjs';
|
|
12
|
+
import { getAnimation, setDefaultAnimation } from '../../utilities/animation-registry.mjs';
|
|
13
|
+
import { LocalizeController } from '../../utilities/localize.mjs';
|
|
14
|
+
import FlowUiPopup from '../popup/popup.component.mjs';
|
|
15
|
+
import styles from './dropdown.styles.mjs';
|
|
16
|
+
|
|
17
|
+
var __defProp = Object.defineProperty;
|
|
18
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
19
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
20
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
21
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
22
|
+
if (decorator = decorators[i])
|
|
23
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
24
|
+
if (kind && result)
|
|
25
|
+
__defProp(target, key, result);
|
|
26
|
+
return result;
|
|
27
|
+
};
|
|
28
|
+
class FlowUiDropdown extends FlowRdfElement {
|
|
29
|
+
constructor() {
|
|
30
|
+
super(...arguments);
|
|
31
|
+
this.localize = new LocalizeController(this);
|
|
32
|
+
this.open = false;
|
|
33
|
+
this.placement = "bottom-start";
|
|
34
|
+
this.disabled = false;
|
|
35
|
+
this.stayOpenOnSelect = false;
|
|
36
|
+
this.distance = 0;
|
|
37
|
+
this.skidding = 0;
|
|
38
|
+
this.hoist = false;
|
|
39
|
+
this.arrow = false;
|
|
40
|
+
this.arrowPlacement = "anchor";
|
|
41
|
+
this.arrowPadding = 10;
|
|
42
|
+
this.sync = void 0;
|
|
43
|
+
this.handleKeyDown = (event) => {
|
|
44
|
+
if (this.open && event.key === "Escape") {
|
|
45
|
+
event.stopPropagation();
|
|
46
|
+
this.hide();
|
|
47
|
+
this.focusOnTrigger();
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
this.handleDocumentKeyDown = (event) => {
|
|
51
|
+
if (event.key === "Escape" && this.open && !this.closeWatcher) {
|
|
52
|
+
event.stopPropagation();
|
|
53
|
+
this.focusOnTrigger();
|
|
54
|
+
this.hide();
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
if (event.key === "Tab") {
|
|
58
|
+
if (this.open && document.activeElement?.tagName.toLowerCase() === "flow-ui-menu-item") {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
this.hide();
|
|
61
|
+
this.focusOnTrigger();
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
setTimeout(() => {
|
|
65
|
+
const activeElement = this.containingElement?.getRootNode() instanceof ShadowRoot ? document.activeElement?.shadowRoot?.activeElement : document.activeElement;
|
|
66
|
+
if (!this.containingElement || activeElement?.closest(this.containingElement.tagName.toLowerCase()) !== this.containingElement) {
|
|
67
|
+
this.hide();
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
this.handleDocumentMouseDown = (event) => {
|
|
73
|
+
const path = event.composedPath();
|
|
74
|
+
if (this.containingElement && !path.includes(this.containingElement)) {
|
|
75
|
+
this.hide();
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
this.handlePanelSelect = (event) => {
|
|
79
|
+
const target = event.target;
|
|
80
|
+
if (!this.stayOpenOnSelect && target.tagName.toLowerCase() === "flow-ui-menu") {
|
|
81
|
+
this.hide();
|
|
82
|
+
this.focusOnTrigger();
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
connectedCallback() {
|
|
87
|
+
super.connectedCallback();
|
|
88
|
+
this.open = boolean(this.open, true);
|
|
89
|
+
this.disabled = boolean(this.disabled, true);
|
|
90
|
+
this.stayOpenOnSelect = boolean(this.stayOpenOnSelect, true);
|
|
91
|
+
this.arrow = boolean(this.arrow, true);
|
|
92
|
+
this.hoist = boolean(this.hoist, true);
|
|
93
|
+
if (!this.containingElement) {
|
|
94
|
+
this.containingElement = this;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
firstUpdated() {
|
|
98
|
+
this.panel.hidden = !this.open;
|
|
99
|
+
if (this.open) {
|
|
100
|
+
this.addOpenListeners();
|
|
101
|
+
this.popup.active = true;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
disconnectedCallback() {
|
|
105
|
+
super.disconnectedCallback();
|
|
106
|
+
this.removeOpenListeners();
|
|
107
|
+
this.hide();
|
|
108
|
+
}
|
|
109
|
+
/** @internal */
|
|
110
|
+
focusOnTrigger() {
|
|
111
|
+
const trigger = this.trigger.assignedElements({ flatten: true })[0];
|
|
112
|
+
if (typeof trigger?.focus === "function") {
|
|
113
|
+
trigger.focus();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
/** @internal */
|
|
117
|
+
getMenu() {
|
|
118
|
+
return this.panel.assignedElements({ flatten: true }).find((el) => el.tagName.toLowerCase() === "flow-ui-menu");
|
|
119
|
+
}
|
|
120
|
+
/** @internal */
|
|
121
|
+
handleTriggerClick() {
|
|
122
|
+
if (this.open) {
|
|
123
|
+
this.hide();
|
|
124
|
+
} else {
|
|
125
|
+
this.show();
|
|
126
|
+
this.focusOnTrigger();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
/** @internal */
|
|
130
|
+
async handleTriggerKeyDown(event) {
|
|
131
|
+
if ([" ", "Enter"].includes(event.key)) {
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
this.handleTriggerClick();
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
const menu = this.getMenu();
|
|
137
|
+
if (menu) {
|
|
138
|
+
const menuItems = menu.getAllItems();
|
|
139
|
+
const firstMenuItem = menuItems[0];
|
|
140
|
+
const lastMenuItem = menuItems[menuItems.length - 1];
|
|
141
|
+
if (["ArrowDown", "ArrowUp", "Home", "End"].includes(event.key)) {
|
|
142
|
+
event.preventDefault();
|
|
143
|
+
if (!this.open) {
|
|
144
|
+
this.show();
|
|
145
|
+
await this.updateComplete;
|
|
146
|
+
}
|
|
147
|
+
if (menuItems.length > 0) {
|
|
148
|
+
this.updateComplete.then(() => {
|
|
149
|
+
if (event.key === "ArrowDown" || event.key === "Home") {
|
|
150
|
+
menu.setCurrentItem(firstMenuItem);
|
|
151
|
+
firstMenuItem.focus();
|
|
152
|
+
}
|
|
153
|
+
if (event.key === "ArrowUp" || event.key === "End") {
|
|
154
|
+
menu.setCurrentItem(lastMenuItem);
|
|
155
|
+
lastMenuItem.focus();
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/** @internal */
|
|
163
|
+
handleTriggerKeyUp(event) {
|
|
164
|
+
if (event.key === " ") {
|
|
165
|
+
event.preventDefault();
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
/** @internal */
|
|
169
|
+
handleTriggerSlotChange() {
|
|
170
|
+
this.updateAccessibleTrigger();
|
|
171
|
+
}
|
|
172
|
+
//
|
|
173
|
+
// Slotted triggers can be arbitrary content, but we need to link them to the dropdown panel with `aria-haspopup` and
|
|
174
|
+
// `aria-expanded`. These must be applied to the "accessible trigger" (the tabbable portion of the trigger element
|
|
175
|
+
// that gets slotted in) so screen readers will understand them. The accessible trigger could be the slotted element,
|
|
176
|
+
// a child of the slotted element, or an element in the slotted element's shadow root.
|
|
177
|
+
//
|
|
178
|
+
// For example, the accessible trigger of an <flow-ui-button> is a <button> located inside its shadow root.
|
|
179
|
+
//
|
|
180
|
+
// To determine this, we assume the first tabbable element in the trigger slot is the "accessible trigger."
|
|
181
|
+
//
|
|
182
|
+
/** @internal */
|
|
183
|
+
updateAccessibleTrigger() {
|
|
184
|
+
const assignedElements = this.trigger.assignedElements({ flatten: true });
|
|
185
|
+
const accessibleTrigger = assignedElements.find((el) => getTabbableBoundary(el).start);
|
|
186
|
+
let target;
|
|
187
|
+
if (accessibleTrigger) {
|
|
188
|
+
switch (accessibleTrigger.tagName.toLowerCase()) {
|
|
189
|
+
case "flow-ui-button":
|
|
190
|
+
case "flow-ui-icon-button":
|
|
191
|
+
target = accessibleTrigger.button;
|
|
192
|
+
break;
|
|
193
|
+
default:
|
|
194
|
+
target = accessibleTrigger;
|
|
195
|
+
}
|
|
196
|
+
target.setAttribute("aria-haspopup", "true");
|
|
197
|
+
target.setAttribute("aria-expanded", this.open ? "true" : "false");
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/** Shows the dropdown panel. */
|
|
201
|
+
async show() {
|
|
202
|
+
if (this.open) {
|
|
203
|
+
return void 0;
|
|
204
|
+
}
|
|
205
|
+
this.open = true;
|
|
206
|
+
return waitForEvent(this, "flow-ui-after-show");
|
|
207
|
+
}
|
|
208
|
+
/** Hides the dropdown panel */
|
|
209
|
+
async hide() {
|
|
210
|
+
if (!this.open) {
|
|
211
|
+
return void 0;
|
|
212
|
+
}
|
|
213
|
+
this.open = false;
|
|
214
|
+
return waitForEvent(this, "flow-ui-after-hide");
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Instructs the dropdown menu to reposition. Useful when the position or size of the trigger changes when the menu
|
|
218
|
+
* is activated.
|
|
219
|
+
*/
|
|
220
|
+
reposition() {
|
|
221
|
+
this.popup.reposition();
|
|
222
|
+
}
|
|
223
|
+
/** @internal */
|
|
224
|
+
addOpenListeners() {
|
|
225
|
+
this.panel.addEventListener("flow-ui-select", this.handlePanelSelect);
|
|
226
|
+
if ("CloseWatcher" in window) {
|
|
227
|
+
this.closeWatcher?.destroy();
|
|
228
|
+
this.closeWatcher = new CloseWatcher();
|
|
229
|
+
this.closeWatcher.onclose = () => {
|
|
230
|
+
this.hide();
|
|
231
|
+
this.focusOnTrigger();
|
|
232
|
+
};
|
|
233
|
+
} else {
|
|
234
|
+
this.panel.addEventListener("keydown", this.handleKeyDown);
|
|
235
|
+
}
|
|
236
|
+
document.addEventListener("keydown", this.handleDocumentKeyDown);
|
|
237
|
+
document.addEventListener("mousedown", this.handleDocumentMouseDown);
|
|
238
|
+
}
|
|
239
|
+
/** @internal */
|
|
240
|
+
removeOpenListeners() {
|
|
241
|
+
if (this.panel) {
|
|
242
|
+
this.panel.removeEventListener("flow-ui-select", this.handlePanelSelect);
|
|
243
|
+
this.panel.removeEventListener("keydown", this.handleKeyDown);
|
|
244
|
+
}
|
|
245
|
+
document.removeEventListener("keydown", this.handleDocumentKeyDown);
|
|
246
|
+
document.removeEventListener("mousedown", this.handleDocumentMouseDown);
|
|
247
|
+
this.closeWatcher?.destroy();
|
|
248
|
+
}
|
|
249
|
+
async handleOpenChange() {
|
|
250
|
+
if (this.disabled) {
|
|
251
|
+
this.open = false;
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
this.updateAccessibleTrigger();
|
|
255
|
+
if (this.open) {
|
|
256
|
+
this.emit("flow-ui-show");
|
|
257
|
+
this.addOpenListeners();
|
|
258
|
+
await stopAnimations(this);
|
|
259
|
+
this.panel.hidden = false;
|
|
260
|
+
this.popup.active = true;
|
|
261
|
+
const { keyframes, options } = getAnimation(this, "dropdown.show", { dir: this.localize.dir() });
|
|
262
|
+
await animateTo(this.popup.popup, keyframes, options);
|
|
263
|
+
this.emit("flow-ui-after-show");
|
|
264
|
+
} else {
|
|
265
|
+
this.emit("flow-ui-hide");
|
|
266
|
+
this.removeOpenListeners();
|
|
267
|
+
await stopAnimations(this);
|
|
268
|
+
const { keyframes, options } = getAnimation(this, "dropdown.hide", { dir: this.localize.dir() });
|
|
269
|
+
await animateTo(this.popup.popup, keyframes, options);
|
|
270
|
+
this.panel.hidden = true;
|
|
271
|
+
this.popup.active = false;
|
|
272
|
+
this.emit("flow-ui-after-hide");
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
render() {
|
|
276
|
+
return html`
|
|
277
|
+
<flow-ui-popup
|
|
278
|
+
part="base"
|
|
279
|
+
exportparts="popup:base__popup"
|
|
280
|
+
id="dropdown"
|
|
281
|
+
placement=${this.placement}
|
|
282
|
+
distance=${this.distance}
|
|
283
|
+
skidding=${this.skidding}
|
|
284
|
+
strategy=${this.hoist ? "fixed" : "absolute"}
|
|
285
|
+
?arrow=${this.arrow}
|
|
286
|
+
arrow-placement=${ifDefined(this.arrowPlacement)}
|
|
287
|
+
arrow-padding=${ifDefined(this.arrowPadding)}
|
|
288
|
+
flip
|
|
289
|
+
shift
|
|
290
|
+
auto-size="vertical"
|
|
291
|
+
auto-size-padding="10"
|
|
292
|
+
sync=${ifDefined(this.sync ? this.sync : void 0)}
|
|
293
|
+
class=${classMap({
|
|
294
|
+
dropdown: true,
|
|
295
|
+
"dropdown--open": this.open
|
|
296
|
+
})}
|
|
297
|
+
>
|
|
298
|
+
<slot
|
|
299
|
+
name="trigger"
|
|
300
|
+
slot="anchor"
|
|
301
|
+
part="trigger"
|
|
302
|
+
class="dropdown__trigger"
|
|
303
|
+
@click=${this.handleTriggerClick}
|
|
304
|
+
@keydown=${this.handleTriggerKeyDown}
|
|
305
|
+
@keyup=${this.handleTriggerKeyUp}
|
|
306
|
+
@slotchange=${this.handleTriggerSlotChange}
|
|
307
|
+
></slot>
|
|
308
|
+
|
|
309
|
+
<div aria-hidden=${this.open ? "false" : "true"} aria-labelledby="dropdown">
|
|
310
|
+
<slot part="panel" class="dropdown__panel"></slot>
|
|
311
|
+
</div>
|
|
312
|
+
</flow-ui-popup>
|
|
313
|
+
`;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
FlowUiDropdown.styles = [componentStyles, styles];
|
|
317
|
+
FlowUiDropdown.dependencies = { "flow-ui-popup": FlowUiPopup };
|
|
318
|
+
__decorateClass([
|
|
319
|
+
query(".dropdown")
|
|
320
|
+
], FlowUiDropdown.prototype, "popup", 2);
|
|
321
|
+
__decorateClass([
|
|
322
|
+
query(".dropdown__trigger")
|
|
323
|
+
], FlowUiDropdown.prototype, "trigger", 2);
|
|
324
|
+
__decorateClass([
|
|
325
|
+
query(".dropdown__panel")
|
|
326
|
+
], FlowUiDropdown.prototype, "panel", 2);
|
|
327
|
+
__decorateClass([
|
|
328
|
+
property({ type: Boolean, reflect: true })
|
|
329
|
+
], FlowUiDropdown.prototype, "open", 2);
|
|
330
|
+
__decorateClass([
|
|
331
|
+
property({ reflect: true })
|
|
332
|
+
], FlowUiDropdown.prototype, "placement", 2);
|
|
333
|
+
__decorateClass([
|
|
334
|
+
property({ type: Boolean, reflect: true })
|
|
335
|
+
], FlowUiDropdown.prototype, "disabled", 2);
|
|
336
|
+
__decorateClass([
|
|
337
|
+
property({ attribute: "stay-open-on-select", type: Boolean, reflect: true })
|
|
338
|
+
], FlowUiDropdown.prototype, "stayOpenOnSelect", 2);
|
|
339
|
+
__decorateClass([
|
|
340
|
+
property({ attribute: false })
|
|
341
|
+
], FlowUiDropdown.prototype, "containingElement", 2);
|
|
342
|
+
__decorateClass([
|
|
343
|
+
property({ type: Number })
|
|
344
|
+
], FlowUiDropdown.prototype, "distance", 2);
|
|
345
|
+
__decorateClass([
|
|
346
|
+
property({ type: Number })
|
|
347
|
+
], FlowUiDropdown.prototype, "skidding", 2);
|
|
348
|
+
__decorateClass([
|
|
349
|
+
property({ type: Boolean })
|
|
350
|
+
], FlowUiDropdown.prototype, "hoist", 2);
|
|
351
|
+
__decorateClass([
|
|
352
|
+
property({ type: Boolean })
|
|
353
|
+
], FlowUiDropdown.prototype, "arrow", 2);
|
|
354
|
+
__decorateClass([
|
|
355
|
+
property({ attribute: "arrow-placement" })
|
|
356
|
+
], FlowUiDropdown.prototype, "arrowPlacement", 2);
|
|
357
|
+
__decorateClass([
|
|
358
|
+
property({ attribute: "arrow-padding", type: Number })
|
|
359
|
+
], FlowUiDropdown.prototype, "arrowPadding", 2);
|
|
360
|
+
__decorateClass([
|
|
361
|
+
property({ reflect: true })
|
|
362
|
+
], FlowUiDropdown.prototype, "sync", 2);
|
|
363
|
+
__decorateClass([
|
|
364
|
+
watch("open", { waitUntilFirstUpdate: true })
|
|
365
|
+
], FlowUiDropdown.prototype, "handleOpenChange", 1);
|
|
366
|
+
setDefaultAnimation("dropdown.show", {
|
|
367
|
+
keyframes: [
|
|
368
|
+
{ opacity: 0, scale: 0.9 },
|
|
369
|
+
{ opacity: 1, scale: 1 }
|
|
370
|
+
],
|
|
371
|
+
options: { duration: 100, easing: "ease" }
|
|
372
|
+
});
|
|
373
|
+
setDefaultAnimation("dropdown.hide", {
|
|
374
|
+
keyframes: [
|
|
375
|
+
{ opacity: 1, scale: 1 },
|
|
376
|
+
{ opacity: 0, scale: 0.9 }
|
|
377
|
+
],
|
|
378
|
+
options: { duration: 100, easing: "ease" }
|
|
379
|
+
});
|
|
380
|
+
|
|
381
|
+
export { FlowUiDropdown as default };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
import componentStyles from '../../styles/component.styles.mjs';
|
|
3
|
+
|
|
4
|
+
const styles = css`
|
|
5
|
+
${componentStyles}
|
|
6
|
+
|
|
7
|
+
:host {
|
|
8
|
+
display: inline-block;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.dropdown::part(popup) {
|
|
12
|
+
z-index: var(--flow-ui-z-index-dropdown);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.dropdown[data-current-placement^='top']::part(popup) {
|
|
16
|
+
transform-origin: bottom;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.dropdown[data-current-placement^='bottom']::part(popup) {
|
|
20
|
+
transform-origin: top;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
.dropdown[data-current-placement^='left']::part(popup) {
|
|
24
|
+
transform-origin: right;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.dropdown[data-current-placement^='right']::part(popup) {
|
|
28
|
+
transform-origin: left;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.dropdown__trigger {
|
|
32
|
+
display: block;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.dropdown__panel {
|
|
36
|
+
font-family: var(--flow-ui-font-sans);
|
|
37
|
+
font-size: var(--flow-ui-font-size-medium);
|
|
38
|
+
font-weight: var(--flow-ui-font-weight-normal);
|
|
39
|
+
box-shadow: var(--flow-ui-shadow-large);
|
|
40
|
+
border-radius: var(--flow-ui-border-radius-medium);
|
|
41
|
+
pointer-events: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.dropdown--open .dropdown__panel {
|
|
45
|
+
display: block;
|
|
46
|
+
pointer-events: all;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/* When users slot a menu, make sure it conforms to the popup's auto-size */
|
|
50
|
+
::slotted(flow-ui-menu) {
|
|
51
|
+
max-width: var(--auto-size-available-width) !important;
|
|
52
|
+
max-height: var(--auto-size-available-height) !important;
|
|
53
|
+
}
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
export { styles as default };
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import { format } from 'd3-format';
|
|
2
|
+
import { html, nothing } from 'lit';
|
|
3
|
+
import { query, property } from 'lit/decorators.js';
|
|
4
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
5
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
6
|
+
import FlowRdfElement from '../../internal/flow-ui-rdf-element.mjs';
|
|
7
|
+
import { HasSlotController } from '../../internal/slot.mjs';
|
|
8
|
+
import { isStringFull, isNil, isNumber, isNumeric } from '../../internal/type-checks.mjs';
|
|
9
|
+
import { watch } from '../../internal/watch.mjs';
|
|
10
|
+
import styles from './gauge.styles.mjs';
|
|
11
|
+
|
|
12
|
+
var __defProp = Object.defineProperty;
|
|
13
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
14
|
+
var __decorateClass = (decorators, target, key, kind) => {
|
|
15
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
16
|
+
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
17
|
+
if (decorator = decorators[i])
|
|
18
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
19
|
+
if (kind && result)
|
|
20
|
+
__defProp(target, key, result);
|
|
21
|
+
return result;
|
|
22
|
+
};
|
|
23
|
+
const DEFAULT_FORMATTER = (val) => isNil(val) ? "--" : val.toString();
|
|
24
|
+
class FlowUiGauge extends FlowRdfElement {
|
|
25
|
+
constructor() {
|
|
26
|
+
super(...arguments);
|
|
27
|
+
this.hasSlotController = new HasSlotController(this, "info");
|
|
28
|
+
this._formatter = DEFAULT_FORMATTER;
|
|
29
|
+
}
|
|
30
|
+
connectedCallback() {
|
|
31
|
+
super.connectedCallback();
|
|
32
|
+
}
|
|
33
|
+
disconnectedCallback() {
|
|
34
|
+
super.disconnectedCallback();
|
|
35
|
+
}
|
|
36
|
+
handleFormatChange() {
|
|
37
|
+
if (isStringFull(this.format)) {
|
|
38
|
+
const fn = format(this.format);
|
|
39
|
+
this._formatter = (val) => {
|
|
40
|
+
if (isNil(val)) {
|
|
41
|
+
return "--";
|
|
42
|
+
} else if (isNumber(val) || isNumeric(val)) {
|
|
43
|
+
return fn(+val);
|
|
44
|
+
} else {
|
|
45
|
+
return val;
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
} else {
|
|
49
|
+
this._formatter = DEFAULT_FORMATTER;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
showInfoDialog() {
|
|
53
|
+
this._infoDialog && this._infoDialog.show();
|
|
54
|
+
}
|
|
55
|
+
hideInfoDialog() {
|
|
56
|
+
this._infoDialog && this._infoDialog.hide();
|
|
57
|
+
}
|
|
58
|
+
headerIconTemplate() {
|
|
59
|
+
return this.icon ? html`
|
|
60
|
+
<flow-ui-icon
|
|
61
|
+
part="header-icon"
|
|
62
|
+
class="gauge__header-icon"
|
|
63
|
+
name=${this.icon}
|
|
64
|
+
library=${ifDefined(this.iconLibrary)}
|
|
65
|
+
></flow-ui-icon>
|
|
66
|
+
` : nothing;
|
|
67
|
+
}
|
|
68
|
+
infoButtonTemplate() {
|
|
69
|
+
return html`
|
|
70
|
+
<flow-ui-icon-button
|
|
71
|
+
part="info-button"
|
|
72
|
+
class="gauge__header-button"
|
|
73
|
+
name="circle-info"
|
|
74
|
+
library="system"
|
|
75
|
+
@click=${this.showInfoDialog}
|
|
76
|
+
></flow-ui-icon-button>
|
|
77
|
+
`;
|
|
78
|
+
}
|
|
79
|
+
infoDialogTemplate() {
|
|
80
|
+
return html`
|
|
81
|
+
<flow-ui-dialog class="gauge__info-dialog">
|
|
82
|
+
<div slot="label" class="gauge__info-dialog-label">
|
|
83
|
+
${this.headerIconTemplate()}
|
|
84
|
+
<slot name="title-text">${this.title}</slot>
|
|
85
|
+
</div>
|
|
86
|
+
<slot name="info"></slot>
|
|
87
|
+
<div slot="footer">
|
|
88
|
+
<flow-ui-button slot="footer" variant="primary" @click=${this.hideInfoDialog}>OK</flow-ui-button>
|
|
89
|
+
</div>
|
|
90
|
+
</flow-ui-dialog>
|
|
91
|
+
`;
|
|
92
|
+
}
|
|
93
|
+
render() {
|
|
94
|
+
const hasInfo = this.hasSlotController.test("info");
|
|
95
|
+
return html`
|
|
96
|
+
<div
|
|
97
|
+
part="base"
|
|
98
|
+
class=${classMap({
|
|
99
|
+
gauge: true
|
|
100
|
+
})}
|
|
101
|
+
>
|
|
102
|
+
<div part="header" class="gauge__header">
|
|
103
|
+
${this.headerIconTemplate()}
|
|
104
|
+
<span class="gauge__title-wrapper">
|
|
105
|
+
<span part="title" class="gauge__title">
|
|
106
|
+
<slot name="title">${this.title}</slot>
|
|
107
|
+
</span>
|
|
108
|
+
</span>
|
|
109
|
+
${hasInfo ? this.infoButtonTemplate() : nothing}
|
|
110
|
+
</div>
|
|
111
|
+
<div part="body" class="gauge__body">
|
|
112
|
+
<span part="value" class="gauge__value">
|
|
113
|
+
<slot name="value">${this._formatter(this.value)}</slot>
|
|
114
|
+
</span>
|
|
115
|
+
<span part="units" class="gauge__units">
|
|
116
|
+
<slot name="units">${this.units}</slot>
|
|
117
|
+
</span>
|
|
118
|
+
<span class="gauge__spacer"></span>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
${hasInfo ? this.infoDialogTemplate() : nothing}
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
FlowUiGauge.styles = styles;
|
|
126
|
+
__decorateClass([
|
|
127
|
+
query(".gauge__info-dialog")
|
|
128
|
+
], FlowUiGauge.prototype, "_infoDialog", 2);
|
|
129
|
+
__decorateClass([
|
|
130
|
+
property()
|
|
131
|
+
], FlowUiGauge.prototype, "title", 2);
|
|
132
|
+
__decorateClass([
|
|
133
|
+
property()
|
|
134
|
+
], FlowUiGauge.prototype, "units", 2);
|
|
135
|
+
__decorateClass([
|
|
136
|
+
property()
|
|
137
|
+
], FlowUiGauge.prototype, "value", 2);
|
|
138
|
+
__decorateClass([
|
|
139
|
+
property()
|
|
140
|
+
], FlowUiGauge.prototype, "icon", 2);
|
|
141
|
+
__decorateClass([
|
|
142
|
+
property({ attribute: "icon-library" })
|
|
143
|
+
], FlowUiGauge.prototype, "iconLibrary", 2);
|
|
144
|
+
__decorateClass([
|
|
145
|
+
property()
|
|
146
|
+
], FlowUiGauge.prototype, "format", 2);
|
|
147
|
+
__decorateClass([
|
|
148
|
+
watch("format")
|
|
149
|
+
], FlowUiGauge.prototype, "handleFormatChange", 1);
|
|
150
|
+
|
|
151
|
+
export { FlowUiGauge as default };
|