Skip to content

Commit

Permalink
feat(dropdown): add toggle prop to trigger slot (#1086)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlmoravek authored Oct 30, 2024
1 parent 6466757 commit c9b51f3
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`OAutocomplete tests > render correctly 1`] = `
<!--
@slot Override the trigger element, default is label prop
@binding {boolean} active - dropdown active state
@binding {() => void} toggle - toggle dropdown active state
-->
<div data-oruga="input" class="o-input__wrapper"><input role="combobox" aria-autocomplete="list" aria-controls="v-0" aria-expanded="false" id="v-1" data-oruga-input="text" type="text" class="o-input" autocomplete="off">
<!--v-if-->
Expand All @@ -20,7 +21,7 @@ exports[`OAutocomplete tests > render correctly 1`] = `
<!--
@slot Place dropdown items here
@binding {boolean} active - dropdown active state
@binding {boolean} toggle - toggle active state function
@binding {() => void} toggle - toggle dropdown active state
-->
<!--v-if-->
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`ODatepicker > render correctly 1`] = `
<!--
@slot Override the trigger element, default is label prop
@binding {boolean} active - dropdown active state
@binding {() => void} toggle - toggle dropdown active state
-->
<div data-oruga="input" class="o-input__wrapper"><input id="v-0" data-oruga-input="text" type="text" class="o-input" autocomplete="off">
<!--v-if-->
Expand All @@ -21,7 +22,7 @@ exports[`ODatepicker > render correctly 1`] = `
<!--
@slot Place dropdown items here
@binding {boolean} active - dropdown active state
@binding {boolean} toggle - toggle active state function
@binding {() => void} toggle - toggle dropdown active state
-->
<div class="o-dpck__box" role="listitem" tabindex="0" data-oruga="dropdown-item" aria-selected="false" aria-disabled="false">
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`ODatetimepicker tests > render correctly 1`] = `
<!--
@slot Override the trigger element, default is label prop
@binding {boolean} active - dropdown active state
@binding {() => void} toggle - toggle dropdown active state
-->
<div data-oruga="input" class="o-input__wrapper"><input class="o-dtpck__date o-input" id="v-0" data-oruga-input="text" type="text" autocomplete="off">
<!--v-if-->
Expand All @@ -21,7 +22,7 @@ exports[`ODatetimepicker tests > render correctly 1`] = `
<!--
@slot Place dropdown items here
@binding {boolean} active - dropdown active state
@binding {boolean} toggle - toggle active state function
@binding {() => void} toggle - toggle dropdown active state
-->
<div class="o-dpck__box" role="listitem" tabindex="0" data-oruga="dropdown-item" aria-selected="false" aria-disabled="false">
<!--
Expand Down Expand Up @@ -333,7 +334,7 @@ exports[`ODatetimepicker tests > render correctly 1`] = `
<!--
@slot Place dropdown items here
@binding {boolean} active - dropdown active state
@binding {boolean} toggle - toggle active state function
@binding {() => void} toggle - toggle dropdown active state
-->
<div class="o-tpck__box" role="listitem" tabindex="0" data-oruga="dropdown-item" aria-selected="false" aria-disabled="false">
<!--
Expand Down
5 changes: 3 additions & 2 deletions packages/oruga/src/components/dropdown/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,9 @@ defineExpose({ $trigger: triggerRef, $content: contentRef, value: vmodel });
<!--
@slot Override the trigger element, default is label prop
@binding {boolean} active - dropdown active state
@binding {() => void} toggle - toggle dropdown active state
-->
<slot name="trigger" :active="isActive">
<slot name="trigger" :active="isActive" :toggle="onClick">
{{ label }}
</slot>
</component>
Expand Down Expand Up @@ -471,7 +472,7 @@ defineExpose({ $trigger: triggerRef, $content: contentRef, value: vmodel });
<!--
@slot Place dropdown items here
@binding {boolean} active - dropdown active state
@binding {boolean} toggle - toggle active state function
@binding {() => void} toggle - toggle dropdown active state
-->
<slot :active="isActive" :toggle="toggle">
<template v-for="group in groupedOptions">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`Dropdown integration tests > render correctly 1`] = `
<!--
@slot Override the trigger element, default is label prop
@binding {boolean} active - dropdown active state
@binding {() => void} toggle - toggle dropdown active state
--><button class="trigger">trigger</button>
</div>
<!--teleport start-->
Expand All @@ -15,7 +16,7 @@ exports[`Dropdown integration tests > render correctly 1`] = `
<!--
@slot Place dropdown items here
@binding {boolean} active - dropdown active state
@binding {boolean} toggle - toggle active state function
@binding {() => void} toggle - toggle dropdown active state
-->
<div class="o-drop__item o-drop__item--clickable text-break" role="listitem" tabindex="0" data-oruga="dropdown-item" aria-selected="false" aria-disabled="false">
<!--
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ exports[`Dropdown tests > render correctly 1`] = `
<!--
@slot Override the trigger element, default is label prop
@binding {boolean} active - dropdown active state
@binding {() => void} toggle - toggle dropdown active state
-->
</div>
<!--teleport start-->
Expand All @@ -15,7 +16,7 @@ exports[`Dropdown tests > render correctly 1`] = `
<!--
@slot Place dropdown items here
@binding {boolean} active - dropdown active state
@binding {boolean} toggle - toggle active state function
@binding {() => void} toggle - toggle dropdown active state
-->
<!--v-if-->
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ exports[`OTaginput tests > render correctly 1`] = `
<!--
@slot Override the trigger element, default is label prop
@binding {boolean} active - dropdown active state
@binding {() => void} toggle - toggle dropdown active state
-->
<div data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded"><input has-counter="false" role="combobox" aria-autocomplete="list" aria-controls="v-0" aria-expanded="false" id="v-1" data-oruga-input="text" type="text" class="o-input o-taginput__input" autocomplete="off">
<!--v-if-->
Expand All @@ -27,7 +28,7 @@ exports[`OTaginput tests > render correctly 1`] = `
<!--
@slot Place dropdown items here
@binding {boolean} active - dropdown active state
@binding {boolean} toggle - toggle active state function
@binding {() => void} toggle - toggle dropdown active state
-->
<!--v-if-->
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ exports[`OTimepicker tests > render correctly 1`] = `
<!--
@slot Override the trigger element, default is label prop
@binding {boolean} active - dropdown active state
@binding {() => void} toggle - toggle dropdown active state
-->
<div data-oruga="input" class="o-input__wrapper"><input id="v-0" data-oruga-input="text" type="text" class="o-input" autocomplete="off">
<!--v-if-->
Expand All @@ -21,7 +22,7 @@ exports[`OTimepicker tests > render correctly 1`] = `
<!--
@slot Place dropdown items here
@binding {boolean} active - dropdown active state
@binding {boolean} toggle - toggle active state function
@binding {() => void} toggle - toggle dropdown active state
-->
<div class="o-tpck__box" role="listitem" tabindex="0" data-oruga="dropdown-item" aria-selected="false" aria-disabled="false">
<!--
Expand Down

0 comments on commit c9b51f3

Please sign in to comment.