@codeleap/web 3.18.9 → 3.20.0

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": "@codeleap/web",
3
- "version": "3.18.9",
3
+ "version": "3.20.0",
4
4
  "main": "src/index.ts",
5
5
  "repository": {
6
6
  "url": "https://github.com/codeleap-uk/internal-libs-monorepo.git",
@@ -25,7 +25,7 @@ import { StylesOf, HTMLProps, ComponentWithDefaultProps } from '../../types/util
25
25
  import { InputBase, InputBaseProps, selectInputBaseProps } from '../InputBase'
26
26
  import { TextInputPresets } from './styles'
27
27
  import { getMaskInputProps, TextInputMaskingProps } from './mask'
28
- import { getTestId } from '../../lib'
28
+ import { getTestId } from '../../lib/test'
29
29
 
30
30
  export * from './styles'
31
31
  export * from './mask'
@@ -54,8 +54,8 @@ export type TextInputProps =
54
54
  } & ComponentVariants<typeof TextInputPresets>
55
55
 
56
56
  type InputRef = {
57
- isTextInput?: boolean,
58
- focus: () => void,
57
+ isTextInput?: boolean
58
+ focus: () => void
59
59
  getInputRef: () => HTMLInputElement
60
60
  }
61
61
 
@@ -1,11 +1,11 @@
1
1
  import { AnyFunction, ComponentVariants, onMount, TypeGuards, useCodeleapContext, useDefaultComponentStyle } from '@codeleap/common'
2
2
  import React, { ComponentPropsWithRef, ElementType, forwardRef } from 'react'
3
- import { getTestId, stopPropagation } from '../../lib'
3
+ import { stopPropagation } from '../../lib'
4
4
  import { View } from '../View'
5
5
  import { TouchableComposition, TouchablePresets } from './styles'
6
6
  import { CSSInterpolation } from '@emotion/css'
7
7
  import { StylesOf, NativeHTMLElement } from '../../types'
8
-
8
+ import { getTestId } from '../../lib/test'
9
9
  export * from './styles'
10
10
 
11
11
  export type TouchableProps<T extends ElementType = 'button'> = ComponentPropsWithRef<T> & {
@@ -7,7 +7,7 @@ import { useMediaQuery } from '../../lib/hooks'
7
7
  import { NativeHTMLElement } from '../../types'
8
8
  import { motion } from 'framer-motion'
9
9
  import { ViewProps } from './types'
10
- import { getTestId } from '../../lib'
10
+ import { getTestId } from '../../lib/test'
11
11
 
12
12
  export * from './styles'
13
13
  export * from './types'
@@ -0,0 +1,11 @@
1
+ import { TypeGuards } from '@codeleap/common'
2
+
3
+ export const getTestId = (props: Record<string, any>) => {
4
+ let id = props.testId || props['data-testid'] || props.id || props.debugName
5
+
6
+ if (TypeGuards.isString(id)) {
7
+ id = id.replace(/\s/g, '_').toLowerCase()
8
+ }
9
+
10
+ return id
11
+ }
@@ -1,6 +1,5 @@
1
1
  export * from './pollyfils/scroll'
2
2
  export * from './stopPropagation'
3
- export * from './test'
4
3
  export { default as url } from 'url-parse'
5
4
  export { default as Cookies } from './cookies'
6
5
 
@@ -1,3 +0,0 @@
1
- export const getTestId = (props: Record<string, any>) => {
2
- return props.testId || props['data-testid'] || props.id || props.debugName
3
- }