@instructure/ui-list 11.6.0 → 11.6.1-snapshot-129
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 +38 -288
- package/es/InlineList/{InlineListItem → v1/InlineListItem}/index.js +2 -2
- package/es/InlineList/{index.js → v1/index.js} +1 -1
- package/es/InlineList/v2/InlineListItem/index.js +97 -0
- package/es/InlineList/v2/InlineListItem/styles.js +143 -0
- package/es/InlineList/v2/index.js +93 -0
- package/es/{index.js → InlineList/v2/props.js} +3 -3
- package/es/List/{ListItem → v1/ListItem}/index.js +2 -2
- package/es/List/v1/ListItem/props.js +28 -0
- package/es/List/{index.js → v1/index.js} +2 -2
- package/es/List/v2/ListItem/index.js +91 -0
- package/es/List/v2/ListItem/props.js +28 -0
- package/es/List/v2/ListItem/styles.js +131 -0
- package/es/List/v2/index.js +100 -0
- package/es/List/v2/props.js +26 -0
- package/es/List/v2/styles.js +66 -0
- package/es/exports/a.js +26 -0
- package/es/exports/b.js +26 -0
- package/lib/InlineList/{InlineListItem → v1/InlineListItem}/index.js +3 -3
- package/lib/InlineList/{index.js → v1/index.js} +2 -2
- package/lib/InlineList/v2/InlineListItem/index.js +102 -0
- package/lib/InlineList/v2/InlineListItem/styles.js +149 -0
- package/lib/InlineList/v2/index.js +101 -0
- package/lib/InlineList/v2/props.js +31 -0
- package/lib/List/{ListItem → v1/ListItem}/index.js +3 -3
- package/lib/List/v1/ListItem/props.js +33 -0
- package/lib/List/v1/index.js +114 -0
- package/lib/List/v2/ListItem/index.js +96 -0
- package/lib/List/v2/ListItem/props.js +33 -0
- package/lib/List/v2/ListItem/styles.js +137 -0
- package/lib/List/{index.js → v2/index.js} +4 -5
- package/lib/List/v2/props.js +31 -0
- package/lib/List/v2/styles.js +72 -0
- package/lib/{index.js → exports/a.js} +6 -6
- package/lib/exports/b.js +32 -0
- package/package.json +39 -17
- package/src/InlineList/{InlineListItem → v1/InlineListItem}/index.tsx +2 -2
- package/src/InlineList/{index.tsx → v1/index.tsx} +1 -1
- package/src/InlineList/v2/InlineListItem/index.tsx +110 -0
- package/src/InlineList/v2/InlineListItem/props.ts +99 -0
- package/src/InlineList/v2/InlineListItem/styles.ts +142 -0
- package/src/InlineList/v2/README.md +146 -0
- package/src/InlineList/v2/index.tsx +102 -0
- package/src/InlineList/v2/props.ts +80 -0
- package/src/List/{ListItem → v1/ListItem}/index.tsx +2 -2
- package/src/List/{index.tsx → v1/index.tsx} +2 -2
- package/src/List/v2/ListItem/index.tsx +104 -0
- package/src/List/v2/ListItem/props.ts +94 -0
- package/src/List/v2/ListItem/styles.ts +136 -0
- package/src/List/v2/README.md +142 -0
- package/src/List/v2/index.tsx +109 -0
- package/src/List/v2/props.ts +95 -0
- package/src/List/v2/styles.ts +77 -0
- package/src/exports/a.ts +32 -0
- package/src/exports/b.ts +32 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/InlineList/v1/InlineListItem/index.d.ts.map +1 -0
- package/types/InlineList/v1/InlineListItem/props.d.ts.map +1 -0
- package/types/InlineList/v1/InlineListItem/styles.d.ts.map +1 -0
- package/types/InlineList/v1/InlineListItem/theme.d.ts.map +1 -0
- package/types/InlineList/v1/index.d.ts.map +1 -0
- package/types/InlineList/v1/props.d.ts.map +1 -0
- package/types/InlineList/v2/InlineListItem/index.d.ts +27 -0
- package/types/InlineList/v2/InlineListItem/index.d.ts.map +1 -0
- package/types/InlineList/v2/InlineListItem/props.d.ts +42 -0
- package/types/InlineList/v2/InlineListItem/props.d.ts.map +1 -0
- package/types/InlineList/v2/InlineListItem/styles.d.ts +14 -0
- package/types/InlineList/v2/InlineListItem/styles.d.ts.map +1 -0
- package/types/InlineList/v2/index.d.ts +35 -0
- package/types/InlineList/v2/index.d.ts.map +1 -0
- package/types/InlineList/v2/props.d.ts +33 -0
- package/types/InlineList/v2/props.d.ts.map +1 -0
- package/types/List/v1/ListItem/index.d.ts.map +1 -0
- package/types/List/v1/ListItem/props.d.ts.map +1 -0
- package/types/List/v1/ListItem/styles.d.ts.map +1 -0
- package/types/List/v1/ListItem/theme.d.ts.map +1 -0
- package/types/List/v1/index.d.ts.map +1 -0
- package/types/List/v1/props.d.ts.map +1 -0
- package/types/List/v1/styles.d.ts.map +1 -0
- package/types/List/v1/theme.d.ts.map +1 -0
- package/types/List/v2/ListItem/index.d.ts +26 -0
- package/types/List/v2/ListItem/index.d.ts.map +1 -0
- package/types/List/v2/ListItem/props.d.ts +38 -0
- package/types/List/v2/ListItem/props.d.ts.map +1 -0
- package/types/List/v2/ListItem/styles.d.ts +14 -0
- package/types/List/v2/ListItem/styles.d.ts.map +1 -0
- package/types/List/v2/index.d.ts +38 -0
- package/types/List/v2/index.d.ts.map +1 -0
- package/types/List/v2/props.d.ts +41 -0
- package/types/List/v2/props.d.ts.map +1 -0
- package/types/List/v2/styles.d.ts +15 -0
- package/types/List/v2/styles.d.ts.map +1 -0
- package/types/exports/a.d.ts +8 -0
- package/types/exports/a.d.ts.map +1 -0
- package/types/exports/b.d.ts +8 -0
- package/types/exports/b.d.ts.map +1 -0
- package/src/index.ts +0 -32
- package/types/InlineList/InlineListItem/index.d.ts.map +0 -1
- package/types/InlineList/InlineListItem/props.d.ts.map +0 -1
- package/types/InlineList/InlineListItem/styles.d.ts.map +0 -1
- package/types/InlineList/InlineListItem/theme.d.ts.map +0 -1
- package/types/InlineList/index.d.ts.map +0 -1
- package/types/InlineList/props.d.ts.map +0 -1
- package/types/List/ListItem/index.d.ts.map +0 -1
- package/types/List/ListItem/props.d.ts.map +0 -1
- package/types/List/ListItem/styles.d.ts.map +0 -1
- package/types/List/ListItem/theme.d.ts.map +0 -1
- package/types/List/index.d.ts.map +0 -1
- package/types/List/props.d.ts.map +0 -1
- package/types/List/styles.d.ts.map +0 -1
- package/types/List/theme.d.ts.map +0 -1
- package/types/index.d.ts +0 -8
- package/types/index.d.ts.map +0 -1
- /package/es/InlineList/{InlineListItem → v1/InlineListItem}/props.js +0 -0
- /package/es/InlineList/{InlineListItem → v1/InlineListItem}/styles.js +0 -0
- /package/es/InlineList/{InlineListItem → v1/InlineListItem}/theme.js +0 -0
- /package/es/InlineList/{props.js → v1/props.js} +0 -0
- /package/es/{List/ListItem → InlineList/v2/InlineListItem}/props.js +0 -0
- /package/es/List/{ListItem → v1/ListItem}/styles.js +0 -0
- /package/es/List/{ListItem → v1/ListItem}/theme.js +0 -0
- /package/es/List/{props.js → v1/props.js} +0 -0
- /package/es/List/{styles.js → v1/styles.js} +0 -0
- /package/es/List/{theme.js → v1/theme.js} +0 -0
- /package/lib/InlineList/{InlineListItem → v1/InlineListItem}/props.js +0 -0
- /package/lib/InlineList/{InlineListItem → v1/InlineListItem}/styles.js +0 -0
- /package/lib/InlineList/{InlineListItem → v1/InlineListItem}/theme.js +0 -0
- /package/lib/InlineList/{props.js → v1/props.js} +0 -0
- /package/lib/{List/ListItem → InlineList/v2/InlineListItem}/props.js +0 -0
- /package/lib/List/{ListItem → v1/ListItem}/styles.js +0 -0
- /package/lib/List/{ListItem → v1/ListItem}/theme.js +0 -0
- /package/lib/List/{props.js → v1/props.js} +0 -0
- /package/lib/List/{styles.js → v1/styles.js} +0 -0
- /package/lib/List/{theme.js → v1/theme.js} +0 -0
- /package/src/InlineList/{InlineListItem → v1/InlineListItem}/props.ts +0 -0
- /package/src/InlineList/{InlineListItem → v1/InlineListItem}/styles.ts +0 -0
- /package/src/InlineList/{InlineListItem → v1/InlineListItem}/theme.ts +0 -0
- /package/src/InlineList/{README.md → v1/README.md} +0 -0
- /package/src/InlineList/{props.ts → v1/props.ts} +0 -0
- /package/src/List/{ListItem → v1/ListItem}/props.ts +0 -0
- /package/src/List/{ListItem → v1/ListItem}/styles.ts +0 -0
- /package/src/List/{ListItem → v1/ListItem}/theme.ts +0 -0
- /package/src/List/{README.md → v1/README.md} +0 -0
- /package/src/List/{props.ts → v1/props.ts} +0 -0
- /package/src/List/{styles.ts → v1/styles.ts} +0 -0
- /package/src/List/{theme.ts → v1/theme.ts} +0 -0
- /package/types/InlineList/{InlineListItem → v1/InlineListItem}/index.d.ts +0 -0
- /package/types/InlineList/{InlineListItem → v1/InlineListItem}/props.d.ts +0 -0
- /package/types/InlineList/{InlineListItem → v1/InlineListItem}/styles.d.ts +0 -0
- /package/types/InlineList/{InlineListItem → v1/InlineListItem}/theme.d.ts +0 -0
- /package/types/InlineList/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/InlineList/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/List/{ListItem → v1/ListItem}/index.d.ts +0 -0
- /package/types/List/{ListItem → v1/ListItem}/props.d.ts +0 -0
- /package/types/List/{ListItem → v1/ListItem}/styles.d.ts +0 -0
- /package/types/List/{ListItem → v1/ListItem}/theme.d.ts +0 -0
- /package/types/List/{index.d.ts → v1/index.d.ts} +0 -0
- /package/types/List/{props.d.ts → v1/props.d.ts} +0 -0
- /package/types/List/{styles.d.ts → v1/styles.d.ts} +0 -0
- /package/types/List/{theme.d.ts → v1/theme.d.ts} +0 -0
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { Children, Component, ReactElement } from 'react'
|
|
26
|
+
|
|
27
|
+
import { View } from '@instructure/ui-view/latest'
|
|
28
|
+
import { passthroughProps, safeCloneElement } from '@instructure/ui-react-utils'
|
|
29
|
+
import { withStyle } from '@instructure/emotion'
|
|
30
|
+
|
|
31
|
+
import { ListItem } from './ListItem'
|
|
32
|
+
import generateStyle from './styles'
|
|
33
|
+
import { allowedProps } from './props'
|
|
34
|
+
import type { ListProps } from './props'
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
---
|
|
38
|
+
category: components
|
|
39
|
+
---
|
|
40
|
+
**/
|
|
41
|
+
@withStyle(generateStyle)
|
|
42
|
+
class List extends Component<ListProps> {
|
|
43
|
+
static readonly componentId = 'List'
|
|
44
|
+
|
|
45
|
+
static allowedProps = allowedProps
|
|
46
|
+
static defaultProps = {
|
|
47
|
+
as: 'ul',
|
|
48
|
+
delimiter: 'none',
|
|
49
|
+
isUnstyled: false,
|
|
50
|
+
size: 'medium',
|
|
51
|
+
itemSpacing: 'none'
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static Item = ListItem
|
|
55
|
+
|
|
56
|
+
ref: Element | null = null
|
|
57
|
+
|
|
58
|
+
handleRef = (el: Element | null) => {
|
|
59
|
+
const { elementRef } = this.props
|
|
60
|
+
|
|
61
|
+
this.ref = el
|
|
62
|
+
|
|
63
|
+
if (typeof elementRef === 'function') {
|
|
64
|
+
elementRef(el)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
componentDidMount() {
|
|
69
|
+
this.props.makeStyles?.()
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
componentDidUpdate() {
|
|
73
|
+
this.props.makeStyles?.()
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
renderChildren() {
|
|
77
|
+
return Children.map(this.props.children, (child) => {
|
|
78
|
+
if (!child) return // ignore null, falsy children
|
|
79
|
+
|
|
80
|
+
return safeCloneElement(child as ReactElement, {
|
|
81
|
+
isUnstyled: this.props.isUnstyled,
|
|
82
|
+
delimiter: this.props.delimiter,
|
|
83
|
+
size: this.props.size,
|
|
84
|
+
spacing: this.props.itemSpacing
|
|
85
|
+
})
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
render() {
|
|
90
|
+
const { as, margin, isUnstyled, elementRef, styles, ...rest } = this.props
|
|
91
|
+
|
|
92
|
+
return (
|
|
93
|
+
<View
|
|
94
|
+
{...passthroughProps(rest)}
|
|
95
|
+
css={styles?.list}
|
|
96
|
+
as={as}
|
|
97
|
+
margin={margin}
|
|
98
|
+
elementRef={this.handleRef}
|
|
99
|
+
display="block"
|
|
100
|
+
data-cid="List"
|
|
101
|
+
>
|
|
102
|
+
{this.renderChildren()}
|
|
103
|
+
</View>
|
|
104
|
+
)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export default List
|
|
109
|
+
export { List, ListItem }
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import React from 'react'
|
|
26
|
+
|
|
27
|
+
import type {
|
|
28
|
+
Spacing,
|
|
29
|
+
WithStyleProps,
|
|
30
|
+
ComponentStyle
|
|
31
|
+
} from '@instructure/emotion'
|
|
32
|
+
import type { ListTheme, OtherHTMLAttributes } from '@instructure/shared-types'
|
|
33
|
+
|
|
34
|
+
type ListOwnProps = {
|
|
35
|
+
/**
|
|
36
|
+
* Only accepts `<List.Item>` as a child
|
|
37
|
+
*/
|
|
38
|
+
children?: React.ReactNode // TODO: oneOf([ListItem])
|
|
39
|
+
as?: 'ul' | 'ol'
|
|
40
|
+
/**
|
|
41
|
+
* One of: none, dashed, solid
|
|
42
|
+
*/
|
|
43
|
+
delimiter?: 'none' | 'dashed' | 'solid'
|
|
44
|
+
/**
|
|
45
|
+
* When set, renders the List Items without a list style type.
|
|
46
|
+
*/
|
|
47
|
+
isUnstyled?: boolean
|
|
48
|
+
/**
|
|
49
|
+
* Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
|
|
50
|
+
* `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
|
|
51
|
+
* familiar CSS-like shorthand. For example: `margin="small auto large"`.
|
|
52
|
+
*/
|
|
53
|
+
margin?: Spacing
|
|
54
|
+
size?: 'small' | 'medium' | 'large'
|
|
55
|
+
/**
|
|
56
|
+
* Sets the margin separating each ListItem.
|
|
57
|
+
*/
|
|
58
|
+
itemSpacing?:
|
|
59
|
+
| 'none'
|
|
60
|
+
| 'xxx-small'
|
|
61
|
+
| 'xx-small'
|
|
62
|
+
| 'x-small'
|
|
63
|
+
| 'small'
|
|
64
|
+
| 'medium'
|
|
65
|
+
| 'large'
|
|
66
|
+
| 'x-large'
|
|
67
|
+
| 'xx-large'
|
|
68
|
+
/**
|
|
69
|
+
* provides a reference to the underlying html root element
|
|
70
|
+
*/
|
|
71
|
+
elementRef?: (element: Element | null) => void
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
type PropKeys = keyof ListOwnProps
|
|
75
|
+
|
|
76
|
+
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
77
|
+
|
|
78
|
+
type ListProps = ListOwnProps &
|
|
79
|
+
WithStyleProps<ListTheme, ListStyle> &
|
|
80
|
+
OtherHTMLAttributes<ListOwnProps>
|
|
81
|
+
|
|
82
|
+
type ListStyle = ComponentStyle<'list'>
|
|
83
|
+
const allowedProps: AllowedPropKeys = [
|
|
84
|
+
'children',
|
|
85
|
+
'as',
|
|
86
|
+
'delimiter',
|
|
87
|
+
'isUnstyled',
|
|
88
|
+
'margin',
|
|
89
|
+
'size',
|
|
90
|
+
'itemSpacing',
|
|
91
|
+
'elementRef'
|
|
92
|
+
]
|
|
93
|
+
|
|
94
|
+
export type { ListProps, ListStyle }
|
|
95
|
+
export { allowedProps }
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { ListProps, ListStyle } from './props'
|
|
26
|
+
import type { NewComponentTypes } from '@instructure/ui-themes'
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* ---
|
|
30
|
+
* private: true
|
|
31
|
+
* ---
|
|
32
|
+
* Generates the style object from the theme and provided additional information
|
|
33
|
+
* @param {Object} componentTheme The theme variable object.
|
|
34
|
+
* @param {Object} props the props of the component, the style is applied to
|
|
35
|
+
* @param {Object} state the state of the component, the style is applied to
|
|
36
|
+
* @return {Object} The final style object, which will be used in the component
|
|
37
|
+
*/
|
|
38
|
+
const generateStyle = (
|
|
39
|
+
componentTheme: NewComponentTypes['List'],
|
|
40
|
+
props: ListProps
|
|
41
|
+
): ListStyle => {
|
|
42
|
+
const { isUnstyled, as } = props
|
|
43
|
+
|
|
44
|
+
const ordered = as === 'ol'
|
|
45
|
+
|
|
46
|
+
return {
|
|
47
|
+
list: {
|
|
48
|
+
label: 'list',
|
|
49
|
+
paddingInlineStart: componentTheme.listPadding,
|
|
50
|
+
paddingInlineEnd: 0,
|
|
51
|
+
|
|
52
|
+
...(ordered && {
|
|
53
|
+
listStyleType: 'none',
|
|
54
|
+
// 1.3 rem is removed to have the ordered list start at the same point
|
|
55
|
+
// as the unordered vertically
|
|
56
|
+
paddingInlineStart: `calc(${componentTheme.listPadding} - 1.3rem)`,
|
|
57
|
+
paddingInlineEnd: 0,
|
|
58
|
+
counterReset: 'ol-counter',
|
|
59
|
+
|
|
60
|
+
'&>li::before': {
|
|
61
|
+
fontWeight: componentTheme.orderedNumberFontWeight,
|
|
62
|
+
counterIncrement: 'ol-counter',
|
|
63
|
+
content: 'counters(ol-counter, ".") "."',
|
|
64
|
+
marginInlineEnd: componentTheme.orderedNumberMargin,
|
|
65
|
+
marginInlineStart: 0
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
|
|
69
|
+
...(isUnstyled && {
|
|
70
|
+
listStyleType: 'none',
|
|
71
|
+
paddingInlineStart: 0
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export default generateStyle
|
package/src/exports/a.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export { InlineList } from '../InlineList/v1'
|
|
26
|
+
export { List, ListItem } from '../List/v1'
|
|
27
|
+
export { InlineListItem } from '../InlineList/v1/InlineListItem'
|
|
28
|
+
|
|
29
|
+
export type { InlineListProps } from '../InlineList/v1/props'
|
|
30
|
+
export type { InlineListItemProps } from '../InlineList/v1/InlineListItem/props'
|
|
31
|
+
export type { ListProps } from '../List/v1/props'
|
|
32
|
+
export type { ListItemProps } from '../List/v1/ListItem/props'
|
package/src/exports/b.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The MIT License (MIT)
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2015 - present Instructure, Inc.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
export { InlineList } from '../InlineList/v2'
|
|
26
|
+
export { List, ListItem } from '../List/v2'
|
|
27
|
+
export { InlineListItem } from '../InlineList/v2/InlineListItem'
|
|
28
|
+
|
|
29
|
+
export type { InlineListProps } from '../InlineList/v2/props'
|
|
30
|
+
export type { InlineListItemProps } from '../InlineList/v2/InlineListItem/props'
|
|
31
|
+
export type { ListProps } from '../List/v2/props'
|
|
32
|
+
export type { ListItemProps } from '../List/v2/ListItem/props'
|