@citizenplane/pimp 8.32.1 → 8.32.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@citizenplane/pimp",
3
- "version": "8.32.1",
3
+ "version": "8.32.2",
4
4
  "scripts": {
5
5
  "dev": "storybook dev -p 8080",
6
6
  "build-storybook": "storybook build --output-dir ./docs",
@@ -43,21 +43,20 @@ const emit = defineEmits<Emits>()
43
43
 
44
44
  const slots = useSlots()
45
45
 
46
- const dialogElement = ref()
47
- const dialogContainer = ref<HTMLElement>()
46
+ const dialogElement = ref<HTMLDialogElement | null>(null)
47
+ const dialogContainer = ref<HTMLElement | null>(null)
48
48
 
49
- const dynamicStyle = computed(() => {
50
- return { maxWidth: `${props.maxWidth}px` }
51
- })
49
+ const dynamicStyle = computed(() => ({ maxWidth: `${props.maxWidth}px` }))
52
50
 
53
51
  const hasHeaderSlot = computed(() => !!slots.header)
52
+
54
53
  const hasFooterSlot = computed(() => !!slots.footer)
55
54
 
56
55
  const onClose = () => emit('close')
57
56
  const trapFocus = (event: KeyboardEvent) => handleTrapFocus(event, dialogContainer.value)
58
57
 
59
- const openDialog = () => dialogElement.value.show()
60
- const closeDialog = () => dialogElement.value.close()
58
+ const openDialog = () => dialogElement.value?.show()
59
+ const closeDialog = () => dialogElement.value?.close()
61
60
 
62
61
  const focusOnFirstFocusableElement = () => {
63
62
  const focusableElements = getKeyboardFocusableElements(dialogContainer.value)
@@ -22,7 +22,7 @@ export const getKeyboardFocusableElements = (DOMElement: Document | HTMLElement
22
22
  })
23
23
  }
24
24
 
25
- export const handleTrapFocus = (event: KeyboardEvent, DOMElement?: HTMLElement) => {
25
+ export const handleTrapFocus = (event: KeyboardEvent, DOMElement?: HTMLElement | null) => {
26
26
  if (!DOMElement) return
27
27
 
28
28
  const childFocusableElements = getKeyboardFocusableElements(DOMElement)