Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 1bb327c

Browse files
committed
build: update build config for ci test
1 parent 9b79128 commit 1bb327c

File tree

5 files changed

+49
-48
lines changed

5 files changed

+49
-48
lines changed

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const testConfig = {
3535
[
3636
'@babel/preset-env',
3737
{
38-
targets: { node: true },
38+
targets: { node: 'current' },
3939
},
4040
],
4141
],

packages/c-focus-lock/src/use-focus-lock.ts

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -120,44 +120,45 @@ export function useFocusLock(
120120

121121
watch(
122122
lockEl,
123-
async (el) => {
124-
await nextTick()
125-
if (!el) return
126-
127-
trap = createFocusTrap(el, {
128-
initialFocus: initialFocusEl.value as FocusTarget,
129-
...focusLockOptions,
130-
onActivate() {
131-
hasFocus.value = true
132-
133-
// In some cases the initial focus element
134-
// may not yet be active. So just in case,
135-
// There's a fallback call here to focus the
136-
// element after the initial focus element is focused.
137-
const container = contentEl.value || el
138-
let initialFocus = initialFocusEl.value ?? getFirstFocusable(el)
139-
if (initialFocusEl.value) {
140-
initialFocus = initialFocusEl.value
141-
} else {
142-
const focusables = getAllFocusable(contentEl.value || el)
143-
if (focusables.length) {
144-
;[initialFocus] = focusables.filter((el) => el !== container)
123+
(el) => {
124+
nextTick().then(() => {
125+
if (!el) return
126+
127+
trap = createFocusTrap(el, {
128+
initialFocus: initialFocusEl.value as FocusTarget,
129+
...focusLockOptions,
130+
onActivate() {
131+
hasFocus.value = true
132+
133+
// In some cases the initial focus element
134+
// may not yet be active. So just in case,
135+
// There's a fallback call here to focus the
136+
// element after the initial focus element is focused.
137+
const container = contentEl.value || el
138+
let initialFocus = initialFocusEl.value ?? getFirstFocusable(el)
139+
if (initialFocusEl.value) {
140+
initialFocus = initialFocusEl.value
141+
} else {
142+
const focusables = getAllFocusable(contentEl.value || el)
143+
if (focusables.length) {
144+
;[initialFocus] = focusables.filter((el) => el !== container)
145+
}
145146
}
146-
}
147-
setTimeout(() => focus(initialFocus))
148-
149-
// Apply if consumer provides onActivate option
150-
if (options.onActivate) options.onActivate()
151-
},
152-
onDeactivate() {
153-
hasFocus.value = false
154-
// Apply if consumer provides onDeactivate option
155-
if (options.onDeactivate) options.onDeactivate()
156-
},
147+
setTimeout(() => focus(initialFocus))
148+
149+
// Apply if consumer provides onActivate option
150+
if (options.onActivate) options.onActivate()
151+
},
152+
onDeactivate() {
153+
hasFocus.value = false
154+
// Apply if consumer provides onDeactivate option
155+
if (options.onDeactivate) options.onDeactivate()
156+
},
157+
})
158+
159+
// Focus if immediate is set to true
160+
if (immediate) activate()
157161
})
158-
159-
// Focus if immediate is set to true
160-
if (immediate) activate()
161162
},
162163
{ flush: 'post', immediate: true }
163164
)

packages/c-modal/tests/__snapshots__/c-modal.test.ts.snap

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
exports[`should render properly 1`] = `
44
<DocumentFragment>
5-
<div
6-
class="css-0"
7-
/>
5+
<!--teleport start-->
6+
<!--teleport end-->
87
</DocumentFragment>
98
`;

packages/c-modal/tests/c-modal.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ import { CModal } from '../src'
44
it('should render properly', () => {
55
const { asFragment } = render(CModal)
66
expect(asFragment()).toMatchSnapshot()
7-
})
7+
})

packages/theme-tools/src/create-breakpoints.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@ export type Breakpoints<T> = T & { base: '0em' }
1414
export const createBreakpoints = <T extends BaseBreakpointConfig>(
1515
config: T
1616
): Breakpoints<T> => {
17-
warn({
18-
condition: true,
19-
message: [
20-
`[chakra-ui]: createBreakpoints(...) will be deprecated pretty soon`,
21-
`simply pass the breakpoints as an object. Remove the createBreakpoint(..) call`,
22-
].join(''),
23-
})
17+
/** TODO: Decide on whether to keep the `createBreakpoints` call. */
18+
// warn({
19+
// condition: true,
20+
// message: [
21+
// `[chakra-ui]: createBreakpoints(...) will be deprecated pretty soon`,
22+
// `simply pass the breakpoints as an object. Remove the createBreakpoint(..) call`,
23+
// ].join(''),
24+
// })
2425
return { base: '0em', ...config }
2526
}

0 commit comments

Comments
 (0)