@telus-uds/components-base 1.70.0 → 1.72.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/CHANGELOG.md +30 -2
- package/jest.setup.js +7 -0
- package/lib/Autocomplete/Autocomplete.js +3 -13
- package/lib/Card/Card.js +68 -7
- package/lib/Card/PressableCardBase.js +2 -0
- package/lib/ColourToggle/ColourBubble.js +135 -0
- package/lib/ColourToggle/ColourToggle.js +101 -0
- package/lib/ColourToggle/index.js +10 -0
- package/lib/FlexGrid/Col/Col.js +50 -64
- package/lib/FlexGrid/FlexGrid.js +37 -40
- package/lib/FlexGrid/Row/Row.js +43 -44
- package/lib/Icon/IconText.js +9 -2
- package/lib/Link/LinkBase.js +10 -3
- package/lib/Modal/ModalContent.js +4 -6
- package/lib/OrderedList/Item.js +180 -0
- package/lib/OrderedList/ItemBase.js +48 -0
- package/lib/OrderedList/OrderedList.js +71 -0
- package/lib/OrderedList/OrderedListBase.js +47 -0
- package/lib/OrderedList/index.js +10 -0
- package/lib/index.js +16 -0
- package/lib/utils/ssr-media-query/create-stylesheet/create-stylesheet-mobile.js +56 -0
- package/lib/utils/ssr-media-query/create-stylesheet/index.android.js +10 -0
- package/lib/utils/ssr-media-query/create-stylesheet/index.ios.js +10 -0
- package/lib/utils/ssr-media-query/create-stylesheet/index.js +44 -0
- package/lib/utils/ssr-media-query/utils/inject.js +13 -0
- package/lib-module/Autocomplete/Autocomplete.js +3 -13
- package/lib-module/Card/Card.js +71 -8
- package/lib-module/Card/PressableCardBase.js +2 -0
- package/lib-module/ColourToggle/ColourBubble.js +125 -0
- package/lib-module/ColourToggle/ColourToggle.js +92 -0
- package/lib-module/ColourToggle/index.js +2 -0
- package/lib-module/FlexGrid/Col/Col.js +51 -65
- package/lib-module/FlexGrid/FlexGrid.js +38 -41
- package/lib-module/FlexGrid/Row/Row.js +44 -45
- package/lib-module/Icon/IconText.js +9 -2
- package/lib-module/Link/LinkBase.js +10 -3
- package/lib-module/Modal/ModalContent.js +4 -6
- package/lib-module/OrderedList/Item.js +171 -0
- package/lib-module/OrderedList/ItemBase.js +37 -0
- package/lib-module/OrderedList/OrderedList.js +61 -0
- package/lib-module/OrderedList/OrderedListBase.js +36 -0
- package/lib-module/OrderedList/index.js +2 -0
- package/lib-module/index.js +2 -0
- package/lib-module/utils/ssr-media-query/create-stylesheet/create-stylesheet-mobile.js +48 -0
- package/lib-module/utils/ssr-media-query/create-stylesheet/index.android.js +2 -0
- package/lib-module/utils/ssr-media-query/create-stylesheet/index.ios.js +2 -0
- package/lib-module/utils/ssr-media-query/create-stylesheet/index.js +36 -0
- package/lib-module/utils/ssr-media-query/utils/inject.js +13 -0
- package/package.json +2 -2
- package/src/Autocomplete/Autocomplete.jsx +14 -21
- package/src/Card/Card.jsx +73 -11
- package/src/Card/PressableCardBase.jsx +2 -0
- package/src/ColourToggle/ColourBubble.jsx +111 -0
- package/src/ColourToggle/ColourToggle.jsx +83 -0
- package/src/ColourToggle/index.js +3 -0
- package/src/FlexGrid/Col/Col.jsx +48 -80
- package/src/FlexGrid/FlexGrid.jsx +36 -44
- package/src/FlexGrid/Row/Row.jsx +38 -56
- package/src/Icon/IconText.jsx +11 -1
- package/src/Link/ChevronLink.jsx +1 -0
- package/src/Link/LinkBase.jsx +16 -6
- package/src/Modal/ModalContent.jsx +4 -6
- package/src/OrderedList/Item.jsx +152 -0
- package/src/OrderedList/ItemBase.jsx +31 -0
- package/src/OrderedList/OrderedList.jsx +61 -0
- package/src/OrderedList/OrderedListBase.jsx +33 -0
- package/src/OrderedList/index.js +3 -0
- package/src/index.js +2 -0
- package/src/utils/ssr-media-query/create-stylesheet/create-stylesheet-mobile.js +41 -0
- package/src/utils/ssr-media-query/create-stylesheet/index.android.js +3 -0
- package/src/utils/ssr-media-query/create-stylesheet/index.ios.js +3 -0
- package/src/utils/ssr-media-query/create-stylesheet/index.js +33 -0
- package/src/utils/ssr-media-query/utils/inject.js +13 -0
- package/types/Badge.d.ts +28 -0
- package/types/Box.d.ts +52 -0
- package/types/ChevronLink.d.ts +47 -0
- package/types/Common.d.ts +106 -0
- package/types/Divider.d.ts +19 -0
- package/types/ExpandCollapse.d.ts +65 -0
- package/types/HorizontalScrollButton.d.ts +16 -0
- package/types/Icon.d.ts +21 -0
- package/types/Link.d.ts +48 -0
- package/types/List.d.ts +48 -0
- package/types/Search.d.ts +38 -0
- package/types/Select.d.ts +57 -0
- package/types/Spacer.d.ts +5 -0
- package/types/StackView.d.ts +28 -0
- package/types/Tabs.d.ts +46 -0
- package/types/TextButton.d.ts +11 -0
- package/types/ToggleSwitch.d.ts +54 -0
- package/types/ToolTip.d.ts +40 -0
- package/types/Typography.d.ts +39 -0
- package/types/index.d.ts +62 -0
- package/lib/utils/ssr-media-query/create-stylesheet.js +0 -76
- package/lib-module/utils/ssr-media-query/create-stylesheet.js +0 -68
- package/src/utils/ssr-media-query/create-stylesheet.js +0 -61
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/* eslint-disable react-native-a11y/has-valid-accessibility-role */
|
|
2
|
+
import React, { forwardRef } from 'react'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
import { View, StyleSheet } from 'react-native'
|
|
5
|
+
|
|
6
|
+
const Item = forwardRef(({ children, style, ...rest }, ref) => (
|
|
7
|
+
<View accessibilityRole="listitem" ref={ref} style={[staticStyles.container, style]} {...rest}>
|
|
8
|
+
{children}
|
|
9
|
+
</View>
|
|
10
|
+
))
|
|
11
|
+
|
|
12
|
+
Item.propTypes = {
|
|
13
|
+
/**
|
|
14
|
+
* Item content
|
|
15
|
+
*/
|
|
16
|
+
children: PropTypes.node.isRequired,
|
|
17
|
+
/**
|
|
18
|
+
* Item custom styles
|
|
19
|
+
*/
|
|
20
|
+
style: PropTypes.object
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
Item.displayName = 'OrderedListItem'
|
|
24
|
+
|
|
25
|
+
export default Item
|
|
26
|
+
|
|
27
|
+
const staticStyles = StyleSheet.create({
|
|
28
|
+
container: {
|
|
29
|
+
display: 'flex'
|
|
30
|
+
}
|
|
31
|
+
})
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React, { forwardRef, useMemo } from 'react'
|
|
2
|
+
import PropTypes from 'prop-types'
|
|
3
|
+
|
|
4
|
+
import { getTokensPropType, htmlAttrs, selectSystemProps, variantProp, viewProps } from '../utils'
|
|
5
|
+
import OrderedListBase from './OrderedListBase'
|
|
6
|
+
import Item from './Item'
|
|
7
|
+
|
|
8
|
+
const [selectProps, selectedSystemPropsTypes] = selectSystemProps([htmlAttrs, viewProps])
|
|
9
|
+
|
|
10
|
+
const getChildrenWithParentVariants = (variant, children, start) => {
|
|
11
|
+
if (variant)
|
|
12
|
+
return children.map((child, i) => {
|
|
13
|
+
const existingChildVariants = child.props?.variant ?? {}
|
|
14
|
+
return {
|
|
15
|
+
...child,
|
|
16
|
+
props: {
|
|
17
|
+
...child.props,
|
|
18
|
+
index: start + i,
|
|
19
|
+
isLastChild: i === children.length - 1,
|
|
20
|
+
variant: { ...existingChildVariants, ...variant }
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
return children
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const OrderedList = forwardRef(({ children, start, variant, ...rest }, ref) => {
|
|
29
|
+
const childrenWithParentVariants = useMemo(
|
|
30
|
+
() => getChildrenWithParentVariants(variant, children, start),
|
|
31
|
+
[children, variant, start]
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<OrderedListBase ref={ref} {...selectProps(rest)}>
|
|
36
|
+
{childrenWithParentVariants}
|
|
37
|
+
</OrderedListBase>
|
|
38
|
+
)
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
OrderedList.propTypes = {
|
|
42
|
+
...selectedSystemPropsTypes,
|
|
43
|
+
tokens: getTokensPropType('OrderedList'),
|
|
44
|
+
/**
|
|
45
|
+
* A list of ordered items wrapped in `OrderedList.Item`.
|
|
46
|
+
*/
|
|
47
|
+
children: PropTypes.node.isRequired,
|
|
48
|
+
/**
|
|
49
|
+
* The position to start the list with.
|
|
50
|
+
*/
|
|
51
|
+
start: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
52
|
+
variant: variantProp.propType
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
OrderedList.defaultProps = { start: 1, tokens: {}, variant: {} }
|
|
56
|
+
|
|
57
|
+
OrderedList.displayName = 'OrderedList'
|
|
58
|
+
|
|
59
|
+
OrderedList.Item = Item
|
|
60
|
+
|
|
61
|
+
export default OrderedList
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable react-native-a11y/has-valid-accessibility-role */
|
|
2
|
+
import React, { forwardRef } from 'react'
|
|
3
|
+
import PropTypes from 'prop-types'
|
|
4
|
+
import { View, StyleSheet } from 'react-native'
|
|
5
|
+
|
|
6
|
+
import ItemBase from './ItemBase'
|
|
7
|
+
|
|
8
|
+
const OrderedListBase = forwardRef(({ children, ...rest }, ref) => (
|
|
9
|
+
<View accessibilityRole="list" ref={ref} style={staticStyles.container} {...rest}>
|
|
10
|
+
{children}
|
|
11
|
+
</View>
|
|
12
|
+
))
|
|
13
|
+
|
|
14
|
+
OrderedListBase.propTypes = {
|
|
15
|
+
/**
|
|
16
|
+
* A list of ordered items wrapped in `OrderedListBase.Item`.
|
|
17
|
+
*/
|
|
18
|
+
children: PropTypes.node.isRequired
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
OrderedListBase.displayName = 'OrderedList'
|
|
22
|
+
|
|
23
|
+
OrderedListBase.Item = ItemBase
|
|
24
|
+
|
|
25
|
+
export default OrderedListBase
|
|
26
|
+
|
|
27
|
+
const staticStyles = StyleSheet.create({
|
|
28
|
+
container: {
|
|
29
|
+
flexDirection: 'column',
|
|
30
|
+
margin: 0,
|
|
31
|
+
padding: 0
|
|
32
|
+
}
|
|
33
|
+
})
|
package/src/index.js
CHANGED
|
@@ -11,6 +11,7 @@ export { default as Checkbox } from './Checkbox'
|
|
|
11
11
|
export * from './Checkbox'
|
|
12
12
|
export { default as CheckboxCard } from './CheckboxCard'
|
|
13
13
|
export { default as CheckboxCardGroup } from './CheckboxCardGroup'
|
|
14
|
+
export { default as ColourToggle } from './ColourToggle'
|
|
14
15
|
export { default as Divider } from './Divider'
|
|
15
16
|
export { default as ExpandCollapse, Accordion } from './ExpandCollapse'
|
|
16
17
|
export { default as Feedback } from './Feedback'
|
|
@@ -28,6 +29,7 @@ export { default as List, ListItem, ListBase } from './List'
|
|
|
28
29
|
export { default as Modal } from './Modal'
|
|
29
30
|
export { default as MultiSelectFilter } from './MultiSelectFilter'
|
|
30
31
|
export { default as Notification } from './Notification'
|
|
32
|
+
export { default as OrderedList } from './OrderedList'
|
|
31
33
|
export { default as Pagination } from './Pagination'
|
|
32
34
|
export { default as Progress } from './Progress'
|
|
33
35
|
export { default as QuickLinks } from './QuickLinks'
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import mediaQuery from 'css-mediaquery'
|
|
2
|
+
import { Dimensions } from 'react-native'
|
|
3
|
+
import { isMediaOrPseudo, isMedia } from '../utils/common'
|
|
4
|
+
|
|
5
|
+
const createStyleSheet = (stylesWithQuery) => {
|
|
6
|
+
if (!stylesWithQuery) return { ids: {}, styles: {}, fullStyles: {} }
|
|
7
|
+
let cleanStyles
|
|
8
|
+
const ids = {}
|
|
9
|
+
Object.keys(stylesWithQuery).forEach((key) => {
|
|
10
|
+
if (!stylesWithQuery?.[key]) return
|
|
11
|
+
|
|
12
|
+
const mediaQueriesAndPseudoClasses = Object.keys(stylesWithQuery[key]).filter(isMediaOrPseudo)
|
|
13
|
+
cleanStyles = JSON.parse(JSON.stringify(stylesWithQuery))
|
|
14
|
+
mediaQueriesAndPseudoClasses.forEach((str) => {
|
|
15
|
+
if (isMedia(str)) {
|
|
16
|
+
const mqStr = str.replace('@media', '')
|
|
17
|
+
const { width, height } = Dimensions.get('window')
|
|
18
|
+
|
|
19
|
+
const isMatchingMediaQuery = mediaQuery.match(mqStr, {
|
|
20
|
+
width,
|
|
21
|
+
height,
|
|
22
|
+
orientation: width > height ? 'landscape' : 'portrait',
|
|
23
|
+
'aspect-ratio': width / height
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
if (isMatchingMediaQuery) {
|
|
27
|
+
cleanStyles = {
|
|
28
|
+
...cleanStyles,
|
|
29
|
+
[key]: { ...cleanStyles[key], ...stylesWithQuery[key][str] }
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
delete cleanStyles[key][str]
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
return { ids, styles: cleanStyles, fullStyles: stylesWithQuery }
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default createStyleSheet
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { addCss } from '../utils/inject'
|
|
2
|
+
import createDeclarationBlock from '../utils/create-declaration-block'
|
|
3
|
+
import hash from '../hash'
|
|
4
|
+
import { isMediaOrPseudo, deepClone, createCssRule } from '../utils/common'
|
|
5
|
+
|
|
6
|
+
const createStyleSheet = (stylesWithQuery) => {
|
|
7
|
+
if (!stylesWithQuery) return { ids: {}, styles: {}, fullStyles: {} }
|
|
8
|
+
let cleanStyles
|
|
9
|
+
let ids = {}
|
|
10
|
+
Object.keys(stylesWithQuery).forEach((key) => {
|
|
11
|
+
if (!stylesWithQuery?.[key]) return
|
|
12
|
+
|
|
13
|
+
const mediaQueriesAndPseudoClasses = Object.keys(stylesWithQuery[key]).filter(isMediaOrPseudo)
|
|
14
|
+
cleanStyles = deepClone(stylesWithQuery)
|
|
15
|
+
mediaQueriesAndPseudoClasses.forEach((query) => {
|
|
16
|
+
const css = createDeclarationBlock(stylesWithQuery[key][query])
|
|
17
|
+
const stringHash = `rnmq-${hash(`${key}${query}${css}`)}`
|
|
18
|
+
const rule = createCssRule(query, stringHash, css)
|
|
19
|
+
|
|
20
|
+
addCss(`${stringHash}`, rule)
|
|
21
|
+
delete cleanStyles[key][query]
|
|
22
|
+
|
|
23
|
+
ids = {
|
|
24
|
+
...ids,
|
|
25
|
+
[key]: `${ids?.[key] ? `${ids[key]} ` : ''}${stringHash}`
|
|
26
|
+
}
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
return { ids, styles: cleanStyles, fullStyles: stylesWithQuery }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export default createStyleSheet
|
|
@@ -2,7 +2,17 @@ import React from 'react'
|
|
|
2
2
|
import { Platform } from 'react-native'
|
|
3
3
|
|
|
4
4
|
const rules = {}
|
|
5
|
+
let styleSheet
|
|
5
6
|
|
|
7
|
+
if (typeof window !== 'undefined' && typeof document !== 'undefined') {
|
|
8
|
+
styleSheet = (() => {
|
|
9
|
+
const style = document.createElement('style')
|
|
10
|
+
style.id = 'RNMQCSS'
|
|
11
|
+
style.appendChild(document.createTextNode(''))
|
|
12
|
+
document.head.appendChild(style)
|
|
13
|
+
return style.sheet
|
|
14
|
+
})()
|
|
15
|
+
}
|
|
6
16
|
export const hasCss = (id, text) => {
|
|
7
17
|
return !!rules[id] && !!rules[id].text?.includes?.(text)
|
|
8
18
|
}
|
|
@@ -11,6 +21,9 @@ export const addCss = (id, text) => {
|
|
|
11
21
|
if (!hasCss(id, text)) {
|
|
12
22
|
rules[id] = rules?.[id] || {}
|
|
13
23
|
rules[id].text = (rules[id]?.text || '') + text
|
|
24
|
+
if (styleSheet) {
|
|
25
|
+
styleSheet.insertRule(text, Object.keys(rules).length - 1)
|
|
26
|
+
}
|
|
14
27
|
}
|
|
15
28
|
}
|
|
16
29
|
|
package/types/Badge.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export interface BadgeProps {
|
|
2
|
+
text: string
|
|
3
|
+
borderColor?: string
|
|
4
|
+
textColor?: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
type BadgeVariants = {
|
|
8
|
+
alternative?: boolean
|
|
9
|
+
inverse?: boolean
|
|
10
|
+
outline?: boolean
|
|
11
|
+
purpose?: 'offer' | 'editorial'
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type BadgeTokens = {
|
|
15
|
+
backgroundColor?: string
|
|
16
|
+
borderColor?: string
|
|
17
|
+
borderRadius?: number
|
|
18
|
+
borderWidth?: number
|
|
19
|
+
color?: string
|
|
20
|
+
fontName?: string
|
|
21
|
+
fontSize?: number
|
|
22
|
+
fontWeight?: number
|
|
23
|
+
gradient?: string
|
|
24
|
+
paddingBottom?: number
|
|
25
|
+
paddingLeft?: number
|
|
26
|
+
paddingRight?: number
|
|
27
|
+
paddingTop?: number
|
|
28
|
+
}
|
package/types/Box.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ReactNode, ReactElement } from 'react'
|
|
2
|
+
import { ScrollViewProps } from 'react-native'
|
|
3
|
+
import { ResponsiveSpacing, SemanticTag } from './Common'
|
|
4
|
+
|
|
5
|
+
type BoxVariants = {
|
|
6
|
+
background?:
|
|
7
|
+
| 'lightest'
|
|
8
|
+
| 'lighter'
|
|
9
|
+
| 'light'
|
|
10
|
+
| 'dark'
|
|
11
|
+
| 'darker'
|
|
12
|
+
| 'darkest'
|
|
13
|
+
| 'critical'
|
|
14
|
+
| 'danger'
|
|
15
|
+
| 'warning'
|
|
16
|
+
| 'positive'
|
|
17
|
+
| 'black'
|
|
18
|
+
| 'featurePrimary'
|
|
19
|
+
| 'featureSecondary'
|
|
20
|
+
| 'featureNeutral'
|
|
21
|
+
| 'featureBrand'
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
type BoxTokens = {
|
|
25
|
+
backgroundColor?: string
|
|
26
|
+
gradient?: string
|
|
27
|
+
borderWidth?: number
|
|
28
|
+
borderColor?: string
|
|
29
|
+
borderTopLeftRadius?: number
|
|
30
|
+
borderTopRightRadius?: number
|
|
31
|
+
borderBottomLeftRadius?: number
|
|
32
|
+
borderBottomRightRadius?: number
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface BoxProps {
|
|
36
|
+
children: ReactNode | ReactElement
|
|
37
|
+
horizontal?: ResponsiveSpacing | number
|
|
38
|
+
vertical?: ResponsiveSpacing | number
|
|
39
|
+
top?: ResponsiveSpacing | number
|
|
40
|
+
bottom?: ResponsiveSpacing | number
|
|
41
|
+
left?: ResponsiveSpacing | number
|
|
42
|
+
right?: ResponsiveSpacing | number
|
|
43
|
+
variant?: BoxVariants
|
|
44
|
+
tokens?: BoxTokens
|
|
45
|
+
space?: ResponsiveSpacing | number
|
|
46
|
+
flex?: number
|
|
47
|
+
scroll?: boolean | ScrollViewProps
|
|
48
|
+
tag?: SemanticTag
|
|
49
|
+
testID?: string
|
|
50
|
+
accessibilityLabel?: string
|
|
51
|
+
accessible?: boolean
|
|
52
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { IconProps, IconPositionLeftRight } from './Icon'
|
|
2
|
+
import { LinkAndTextButtonVariants } from './Link'
|
|
3
|
+
|
|
4
|
+
type ChevronLinkTokens = {
|
|
5
|
+
fontSize?: number
|
|
6
|
+
color?: string
|
|
7
|
+
outerBorderColor?: string
|
|
8
|
+
leftIcon?: IconProps
|
|
9
|
+
rightIcon?: IconProps
|
|
10
|
+
iconDisplace?: number
|
|
11
|
+
iconSize?: number
|
|
12
|
+
iconSpace?: number
|
|
13
|
+
textLine?: string
|
|
14
|
+
textLineStyle?: string
|
|
15
|
+
outerBorderWidth?: number
|
|
16
|
+
outerBorderOutline?: string
|
|
17
|
+
borderRadius?: number
|
|
18
|
+
blockFontName?: string
|
|
19
|
+
blockFontWeight?: number
|
|
20
|
+
blockFontSize?: number
|
|
21
|
+
blockLineHeight?: number
|
|
22
|
+
icon?: IconProps
|
|
23
|
+
iconTranslateX?: number
|
|
24
|
+
iconTranslateY?: number
|
|
25
|
+
alignSelf?: 'auto' | 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'
|
|
26
|
+
}
|
|
27
|
+
export interface ChevronLinkProps {
|
|
28
|
+
testID?: string
|
|
29
|
+
children?: React.ReactNode
|
|
30
|
+
onPress?: () => void
|
|
31
|
+
onPressIn?: () => void
|
|
32
|
+
onPressOut?: () => void
|
|
33
|
+
disabled?: boolean
|
|
34
|
+
href?: string
|
|
35
|
+
hrefAttrs?: HrefProps
|
|
36
|
+
accessibilityRole?: string
|
|
37
|
+
accessibilityLabel?: string
|
|
38
|
+
tokens?: ChevronLinkTokens
|
|
39
|
+
direction?: IconPositionLeftRight
|
|
40
|
+
variant?: LinkAndTextButtonVariants
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface HrefProps {
|
|
44
|
+
download: string
|
|
45
|
+
rel: string
|
|
46
|
+
target: string
|
|
47
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
export type TextTransform = {
|
|
4
|
+
CAPITALIZE: 'capitalize'
|
|
5
|
+
LOWERCASE: 'lowercase'
|
|
6
|
+
UPPERCASE: 'uppercase'
|
|
7
|
+
NONE: 'none'
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type LetterSpacing = {
|
|
11
|
+
NORMAL: 'normal'
|
|
12
|
+
LENGTH: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type CopyType = {
|
|
16
|
+
EN: 'en'
|
|
17
|
+
FR: 'fr'
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type Size = {
|
|
21
|
+
margin?: number
|
|
22
|
+
padding?: number
|
|
23
|
+
height?: number | string
|
|
24
|
+
width?: number | string
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type Position = 'auto' | 'above' | 'below' | 'right' | 'left'
|
|
28
|
+
|
|
29
|
+
export type DisplaySize = {
|
|
30
|
+
LARGE: 'large'
|
|
31
|
+
MEDIUM: 'medium'
|
|
32
|
+
SMALL: 'small'
|
|
33
|
+
MICRO: 'micro'
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export enum Sizes {
|
|
37
|
+
xs = 'xs',
|
|
38
|
+
sm = 'sm',
|
|
39
|
+
md = 'md',
|
|
40
|
+
lg = 'lg',
|
|
41
|
+
xl = 'xl'
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type ResponsiveSpacing = {
|
|
45
|
+
[key in Sizes]?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export type Direction = 'column' | 'row' | 'column-reverse' | 'row-reverse'
|
|
49
|
+
|
|
50
|
+
export type ResponsiveDirection = {
|
|
51
|
+
[key in Sizes]?: Direction
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export type SemanticTag =
|
|
55
|
+
| 'h1'
|
|
56
|
+
| 'h2'
|
|
57
|
+
| 'h3'
|
|
58
|
+
| 'h4'
|
|
59
|
+
| 'h5'
|
|
60
|
+
| 'h6'
|
|
61
|
+
| 'article'
|
|
62
|
+
| 'aside'
|
|
63
|
+
| 'blockquote'
|
|
64
|
+
| 'footer'
|
|
65
|
+
| 'figure'
|
|
66
|
+
| 'form'
|
|
67
|
+
| 'header'
|
|
68
|
+
| 'ul'
|
|
69
|
+
| 'li'
|
|
70
|
+
| 'main'
|
|
71
|
+
| 'nav'
|
|
72
|
+
| 'section'
|
|
73
|
+
| 'label'
|
|
74
|
+
|
|
75
|
+
type headingType = {
|
|
76
|
+
H1: 'h1'
|
|
77
|
+
H2: 'h2'
|
|
78
|
+
H3: 'h1'
|
|
79
|
+
H4: 'h2'
|
|
80
|
+
H5: 'h1'
|
|
81
|
+
H6: 'h2'
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
type tagType = {
|
|
85
|
+
HEADING: headingType
|
|
86
|
+
BLOCKQUOTE: 'blockquote'
|
|
87
|
+
CODE: 'code'
|
|
88
|
+
DEL: 'del'
|
|
89
|
+
EM: 'em'
|
|
90
|
+
INS: 'ins'
|
|
91
|
+
LI: 'li'
|
|
92
|
+
STRONG: 'strong'
|
|
93
|
+
LABEL: 'label'
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
type alignType = {
|
|
97
|
+
AUTO: 'auto'
|
|
98
|
+
LEFT: 'left'
|
|
99
|
+
RIGHT: 'right'
|
|
100
|
+
CENTER: 'center'
|
|
101
|
+
JUSTIFY: 'justify'
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export type FlexAlign = 'flex-start' | 'flex-end' | 'center' | 'stretch' | 'baseline'
|
|
105
|
+
|
|
106
|
+
export type FlexJustify = 'flex-start' | 'flex-end' | 'center' | 'space-between' | 'space-around'
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ResponsiveSpacing, Size } from './Common'
|
|
2
|
+
type DividerVariants = {
|
|
3
|
+
weight?: 'regular' | 'thick'
|
|
4
|
+
decorative?: boolean
|
|
5
|
+
inverse?: boolean
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface DividerProps {
|
|
9
|
+
testID?: string
|
|
10
|
+
vertical?: boolean
|
|
11
|
+
space?: number | ResponsiveSpacing
|
|
12
|
+
tokens?: DividerTokens
|
|
13
|
+
variant?: DividerVariants
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface DividerTokens {
|
|
17
|
+
width?: Size
|
|
18
|
+
color?: string
|
|
19
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import React, { ReactPropTypes } from 'react'
|
|
2
|
+
|
|
3
|
+
type ExpandCollapseVariants = {
|
|
4
|
+
compact: boolean
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
type ExpandCollapseTokens = {
|
|
8
|
+
borderColor?: string
|
|
9
|
+
borderWidth?: number
|
|
10
|
+
borderStyle?: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type ExpandCollapseControlTokens = {
|
|
14
|
+
backgroundColor?: string
|
|
15
|
+
borderBottomLeftRadius?: number | string
|
|
16
|
+
borderBottomRightRadius?: number | string
|
|
17
|
+
borderColor?: string
|
|
18
|
+
borderTopLeftRadius?: number | string
|
|
19
|
+
borderTopRightRadius?: number | string
|
|
20
|
+
borderWidth?: number | string
|
|
21
|
+
icon?: string
|
|
22
|
+
iconColor?: string
|
|
23
|
+
iconGap?: number | string
|
|
24
|
+
iconPaddingTop?: number | string
|
|
25
|
+
iconPosition?: string
|
|
26
|
+
iconSize?: number
|
|
27
|
+
justifyContent?: string
|
|
28
|
+
paddingBottom?: number | string
|
|
29
|
+
paddingLeft?: number | string
|
|
30
|
+
paddingRight?: number | string
|
|
31
|
+
paddingTop?: number | string
|
|
32
|
+
textLine?: string
|
|
33
|
+
verticalAlign?: string
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type ExpandFnProps = {
|
|
37
|
+
openIds: string[]
|
|
38
|
+
onToggle: (panelId: string) => void
|
|
39
|
+
resetValues: () => void
|
|
40
|
+
setValues: (ids: string[]) => void
|
|
41
|
+
unsetValues: (ids: string[]) => void
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export type ExpandCollapseProps = {
|
|
45
|
+
tokens?: ExpandCollapseTokens
|
|
46
|
+
children: (expandProps: ExpandFnProps) => React.ReactNode
|
|
47
|
+
maxOpen?: number
|
|
48
|
+
open?: string[]
|
|
49
|
+
onChange?: (open: string[]) => void
|
|
50
|
+
initialOpen?: string[]
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type ExpandCollapsePanelProps = {
|
|
54
|
+
variant?: ExpandCollapseVariants
|
|
55
|
+
tokens?: ExpandCollapseTokens
|
|
56
|
+
openIds?: string[]
|
|
57
|
+
panelId: string
|
|
58
|
+
onToggle?: (panelId: string) => void
|
|
59
|
+
onPress?: (panelId: string) => void
|
|
60
|
+
children: React.ReactNode | ((expandProps: ExpandFnProps) => React.ReactNode)
|
|
61
|
+
control?: React.ReactNode
|
|
62
|
+
controlTokens?: ExpandCollapseControlTokens
|
|
63
|
+
controlRef?: React.Ref
|
|
64
|
+
content?: boolean
|
|
65
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface HorizontalScrollButtonTokens {
|
|
2
|
+
backgroundColor?: string
|
|
3
|
+
borderColor?: string
|
|
4
|
+
borderRadius?: number | string
|
|
5
|
+
borderWidth?: number | string
|
|
6
|
+
iconColor?: string
|
|
7
|
+
iconScale?: number | string
|
|
8
|
+
iconSize?: number | string
|
|
9
|
+
iconTranslateX?: number
|
|
10
|
+
iconTranslateY?: number
|
|
11
|
+
outerBorderColor?: string
|
|
12
|
+
outerBorderGap?: number | string
|
|
13
|
+
outerBorderWidth?: number | string
|
|
14
|
+
padding?: number | string
|
|
15
|
+
shadow?: string
|
|
16
|
+
}
|
package/types/Icon.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface IconProps {
|
|
2
|
+
scalesWithText?: boolean
|
|
3
|
+
variant?: IconVariant
|
|
4
|
+
tokens?: IconTokens
|
|
5
|
+
icon: React.ReactNode
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export interface IconTokens {
|
|
9
|
+
size?: number | string
|
|
10
|
+
color?: string
|
|
11
|
+
scale?: number
|
|
12
|
+
translateX?: number
|
|
13
|
+
translateY?: number
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type IconVariant = {
|
|
17
|
+
color?: 'default' | 'brand' | 'subtle' | 'success' | 'warning' | 'danger' | 'inverse'
|
|
18
|
+
size?: 'micro' | 'small' | 'large' | 'extraLarge'
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type IconPositionLeftRight = 'left' | 'right'
|
package/types/Link.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { IconPositionLeftRight, IconProps } from './Icon'
|
|
2
|
+
|
|
3
|
+
export interface LinkProps {
|
|
4
|
+
href: string
|
|
5
|
+
onPress: () => void
|
|
6
|
+
tokens?: LinkTokens
|
|
7
|
+
accessibilityRole?: string
|
|
8
|
+
accessibilityLabel?: string
|
|
9
|
+
variant?: LinkAndTextButtonVariants
|
|
10
|
+
iconProps?: IconProps
|
|
11
|
+
icon?: React.ReactNode
|
|
12
|
+
iconPosition?: IconPositionLeftRight
|
|
13
|
+
testID?: string
|
|
14
|
+
children?: React.ReactNode
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export enum LinkSize {
|
|
18
|
+
micro = 'micro',
|
|
19
|
+
small = 'small',
|
|
20
|
+
large = 'large'
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export type LinkAndTextButtonVariants = {
|
|
24
|
+
size?: 'large' | 'small' | 'micro'
|
|
25
|
+
alternative?: boolean
|
|
26
|
+
inverse?: boolean
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type LinkTokens = {
|
|
30
|
+
color?: string
|
|
31
|
+
textLine?: string
|
|
32
|
+
textLineStyle?: string
|
|
33
|
+
outerBorderColor?: string
|
|
34
|
+
outerBorderWidth?: number
|
|
35
|
+
outerBorderGap?: number | string
|
|
36
|
+
outerBorderOutline?: string
|
|
37
|
+
borderRadius?: number
|
|
38
|
+
blockFontName?: string
|
|
39
|
+
blockFontWeight?: number
|
|
40
|
+
blockFontSize?: number
|
|
41
|
+
blockLineHeight?: number
|
|
42
|
+
icon?: string
|
|
43
|
+
iconSize?: number
|
|
44
|
+
iconSpace?: number
|
|
45
|
+
iconTranslateX?: number
|
|
46
|
+
iconTranslateY?: number
|
|
47
|
+
alignSelf?: string
|
|
48
|
+
}
|