Prefer incoming open prop over OpenClosed state (#1360)
* prefer incoming `open` prop over OpenClosed state * update changelog
This commit is contained in:
@@ -173,13 +173,6 @@ let DialogRoot = forwardRefWithAs(function Dialog<
|
||||
}
|
||||
|
||||
let dialogState = open ? DialogStates.Open : DialogStates.Closed
|
||||
let visible = (() => {
|
||||
if (usesOpenClosedState !== null) {
|
||||
return usesOpenClosedState === State.Open
|
||||
}
|
||||
|
||||
return dialogState === DialogStates.Open
|
||||
})()
|
||||
|
||||
let [state, dispatch] = useReducer(stateReducer, {
|
||||
titleId: null,
|
||||
@@ -357,7 +350,7 @@ let DialogRoot = forwardRefWithAs(function Dialog<
|
||||
slot,
|
||||
defaultTag: DEFAULT_DIALOG_TAG,
|
||||
features: DialogRenderFeatures,
|
||||
visible,
|
||||
visible: dialogState === DialogStates.Open,
|
||||
name: 'Dialog',
|
||||
})}
|
||||
</DescriptionProvider>
|
||||
|
||||
@@ -113,14 +113,6 @@ export let Dialog = defineComponent({
|
||||
}
|
||||
|
||||
let dialogState = computed(() => (open.value ? DialogStates.Open : DialogStates.Closed))
|
||||
let visible = computed(() => {
|
||||
if (usesOpenClosedState !== null) {
|
||||
return usesOpenClosedState.value === State.Open
|
||||
}
|
||||
|
||||
return dialogState.value === DialogStates.Open
|
||||
})
|
||||
|
||||
let enabled = computed(() => dialogState.value === DialogStates.Open)
|
||||
|
||||
let hasNestedDialogs = computed(() => nestedDialogCount.value > 1) // 1 is the current dialog
|
||||
@@ -307,7 +299,7 @@ export let Dialog = defineComponent({
|
||||
slot,
|
||||
attrs,
|
||||
slots,
|
||||
visible: visible.value,
|
||||
visible: dialogState.value === DialogStates.Open,
|
||||
features: Features.RenderStrategy | Features.Static,
|
||||
name: 'Dialog',
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user