open-consul/ui/packages/consul-ui/app/components/disclosure/index.hbs

29 lines
651 B
Handlebars
Raw Normal View History

2022-02-08 19:24:50 +00:00
<StateChart
@src={{state-chart 'boolean'}}
as |State Guard Action dispatch state|>
{{#let (hash
toggle=(fn dispatch 'TOGGLE')
close=(fn dispatch 'FALSE')
open=(fn dispatch 'TRUE')
expanded=(state-matches state 'true')
event=state.context
button=(unique-id)
panel=(unique-id)
) as |_api|}}
{{#let (assign _api (hash
Action=(component 'disclosure/action' disclosure=_api)
)) as |api|}}
<div
class={{class-map
'disclosure'
}}
...attributes
>
{{yield api to="button"}}
<State @matches="true">
{{yield api to="panel"}}
</State>
</div>
{{/let}}
{{/let}}
</StateChart>