// Emulate styled components v6 props behavior - pass down all non-transient components by default
export const emulateStyledComponentsV6Props = () => {
  jest.mock('styled-components', () => {
    const originalModule = jest.requireActual('styled-components')

    const styledProxy = new Proxy(originalModule.default, {
      get(target, prop) {
        if (typeof target[prop] === 'function') {
          return target[prop].withConfig({
            shouldForwardProp: (propName) => !propName.startsWith('$'),
          })
        }
        return target[prop]
      },
    })

    return {
      __esModule: true,
      ...originalModule,
      default: styledProxy,
    }
  })
}
