@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.
Files changed (159) hide show
  1. package/CHANGELOG.md +38 -288
  2. package/es/InlineList/{InlineListItem → v1/InlineListItem}/index.js +2 -2
  3. package/es/InlineList/{index.js → v1/index.js} +1 -1
  4. package/es/InlineList/v2/InlineListItem/index.js +97 -0
  5. package/es/InlineList/v2/InlineListItem/styles.js +143 -0
  6. package/es/InlineList/v2/index.js +93 -0
  7. package/es/{index.js → InlineList/v2/props.js} +3 -3
  8. package/es/List/{ListItem → v1/ListItem}/index.js +2 -2
  9. package/es/List/v1/ListItem/props.js +28 -0
  10. package/es/List/{index.js → v1/index.js} +2 -2
  11. package/es/List/v2/ListItem/index.js +91 -0
  12. package/es/List/v2/ListItem/props.js +28 -0
  13. package/es/List/v2/ListItem/styles.js +131 -0
  14. package/es/List/v2/index.js +100 -0
  15. package/es/List/v2/props.js +26 -0
  16. package/es/List/v2/styles.js +66 -0
  17. package/es/exports/a.js +26 -0
  18. package/es/exports/b.js +26 -0
  19. package/lib/InlineList/{InlineListItem → v1/InlineListItem}/index.js +3 -3
  20. package/lib/InlineList/{index.js → v1/index.js} +2 -2
  21. package/lib/InlineList/v2/InlineListItem/index.js +102 -0
  22. package/lib/InlineList/v2/InlineListItem/styles.js +149 -0
  23. package/lib/InlineList/v2/index.js +101 -0
  24. package/lib/InlineList/v2/props.js +31 -0
  25. package/lib/List/{ListItem → v1/ListItem}/index.js +3 -3
  26. package/lib/List/v1/ListItem/props.js +33 -0
  27. package/lib/List/v1/index.js +114 -0
  28. package/lib/List/v2/ListItem/index.js +96 -0
  29. package/lib/List/v2/ListItem/props.js +33 -0
  30. package/lib/List/v2/ListItem/styles.js +137 -0
  31. package/lib/List/{index.js → v2/index.js} +4 -5
  32. package/lib/List/v2/props.js +31 -0
  33. package/lib/List/v2/styles.js +72 -0
  34. package/lib/{index.js → exports/a.js} +6 -6
  35. package/lib/exports/b.js +32 -0
  36. package/package.json +39 -17
  37. package/src/InlineList/{InlineListItem → v1/InlineListItem}/index.tsx +2 -2
  38. package/src/InlineList/{index.tsx → v1/index.tsx} +1 -1
  39. package/src/InlineList/v2/InlineListItem/index.tsx +110 -0
  40. package/src/InlineList/v2/InlineListItem/props.ts +99 -0
  41. package/src/InlineList/v2/InlineListItem/styles.ts +142 -0
  42. package/src/InlineList/v2/README.md +146 -0
  43. package/src/InlineList/v2/index.tsx +102 -0
  44. package/src/InlineList/v2/props.ts +80 -0
  45. package/src/List/{ListItem → v1/ListItem}/index.tsx +2 -2
  46. package/src/List/{index.tsx → v1/index.tsx} +2 -2
  47. package/src/List/v2/ListItem/index.tsx +104 -0
  48. package/src/List/v2/ListItem/props.ts +94 -0
  49. package/src/List/v2/ListItem/styles.ts +136 -0
  50. package/src/List/v2/README.md +142 -0
  51. package/src/List/v2/index.tsx +109 -0
  52. package/src/List/v2/props.ts +95 -0
  53. package/src/List/v2/styles.ts +77 -0
  54. package/src/exports/a.ts +32 -0
  55. package/src/exports/b.ts +32 -0
  56. package/tsconfig.build.tsbuildinfo +1 -1
  57. package/types/InlineList/v1/InlineListItem/index.d.ts.map +1 -0
  58. package/types/InlineList/v1/InlineListItem/props.d.ts.map +1 -0
  59. package/types/InlineList/v1/InlineListItem/styles.d.ts.map +1 -0
  60. package/types/InlineList/v1/InlineListItem/theme.d.ts.map +1 -0
  61. package/types/InlineList/v1/index.d.ts.map +1 -0
  62. package/types/InlineList/v1/props.d.ts.map +1 -0
  63. package/types/InlineList/v2/InlineListItem/index.d.ts +27 -0
  64. package/types/InlineList/v2/InlineListItem/index.d.ts.map +1 -0
  65. package/types/InlineList/v2/InlineListItem/props.d.ts +42 -0
  66. package/types/InlineList/v2/InlineListItem/props.d.ts.map +1 -0
  67. package/types/InlineList/v2/InlineListItem/styles.d.ts +14 -0
  68. package/types/InlineList/v2/InlineListItem/styles.d.ts.map +1 -0
  69. package/types/InlineList/v2/index.d.ts +35 -0
  70. package/types/InlineList/v2/index.d.ts.map +1 -0
  71. package/types/InlineList/v2/props.d.ts +33 -0
  72. package/types/InlineList/v2/props.d.ts.map +1 -0
  73. package/types/List/v1/ListItem/index.d.ts.map +1 -0
  74. package/types/List/v1/ListItem/props.d.ts.map +1 -0
  75. package/types/List/v1/ListItem/styles.d.ts.map +1 -0
  76. package/types/List/v1/ListItem/theme.d.ts.map +1 -0
  77. package/types/List/v1/index.d.ts.map +1 -0
  78. package/types/List/v1/props.d.ts.map +1 -0
  79. package/types/List/v1/styles.d.ts.map +1 -0
  80. package/types/List/v1/theme.d.ts.map +1 -0
  81. package/types/List/v2/ListItem/index.d.ts +26 -0
  82. package/types/List/v2/ListItem/index.d.ts.map +1 -0
  83. package/types/List/v2/ListItem/props.d.ts +38 -0
  84. package/types/List/v2/ListItem/props.d.ts.map +1 -0
  85. package/types/List/v2/ListItem/styles.d.ts +14 -0
  86. package/types/List/v2/ListItem/styles.d.ts.map +1 -0
  87. package/types/List/v2/index.d.ts +38 -0
  88. package/types/List/v2/index.d.ts.map +1 -0
  89. package/types/List/v2/props.d.ts +41 -0
  90. package/types/List/v2/props.d.ts.map +1 -0
  91. package/types/List/v2/styles.d.ts +15 -0
  92. package/types/List/v2/styles.d.ts.map +1 -0
  93. package/types/exports/a.d.ts +8 -0
  94. package/types/exports/a.d.ts.map +1 -0
  95. package/types/exports/b.d.ts +8 -0
  96. package/types/exports/b.d.ts.map +1 -0
  97. package/src/index.ts +0 -32
  98. package/types/InlineList/InlineListItem/index.d.ts.map +0 -1
  99. package/types/InlineList/InlineListItem/props.d.ts.map +0 -1
  100. package/types/InlineList/InlineListItem/styles.d.ts.map +0 -1
  101. package/types/InlineList/InlineListItem/theme.d.ts.map +0 -1
  102. package/types/InlineList/index.d.ts.map +0 -1
  103. package/types/InlineList/props.d.ts.map +0 -1
  104. package/types/List/ListItem/index.d.ts.map +0 -1
  105. package/types/List/ListItem/props.d.ts.map +0 -1
  106. package/types/List/ListItem/styles.d.ts.map +0 -1
  107. package/types/List/ListItem/theme.d.ts.map +0 -1
  108. package/types/List/index.d.ts.map +0 -1
  109. package/types/List/props.d.ts.map +0 -1
  110. package/types/List/styles.d.ts.map +0 -1
  111. package/types/List/theme.d.ts.map +0 -1
  112. package/types/index.d.ts +0 -8
  113. package/types/index.d.ts.map +0 -1
  114. /package/es/InlineList/{InlineListItem → v1/InlineListItem}/props.js +0 -0
  115. /package/es/InlineList/{InlineListItem → v1/InlineListItem}/styles.js +0 -0
  116. /package/es/InlineList/{InlineListItem → v1/InlineListItem}/theme.js +0 -0
  117. /package/es/InlineList/{props.js → v1/props.js} +0 -0
  118. /package/es/{List/ListItem → InlineList/v2/InlineListItem}/props.js +0 -0
  119. /package/es/List/{ListItem → v1/ListItem}/styles.js +0 -0
  120. /package/es/List/{ListItem → v1/ListItem}/theme.js +0 -0
  121. /package/es/List/{props.js → v1/props.js} +0 -0
  122. /package/es/List/{styles.js → v1/styles.js} +0 -0
  123. /package/es/List/{theme.js → v1/theme.js} +0 -0
  124. /package/lib/InlineList/{InlineListItem → v1/InlineListItem}/props.js +0 -0
  125. /package/lib/InlineList/{InlineListItem → v1/InlineListItem}/styles.js +0 -0
  126. /package/lib/InlineList/{InlineListItem → v1/InlineListItem}/theme.js +0 -0
  127. /package/lib/InlineList/{props.js → v1/props.js} +0 -0
  128. /package/lib/{List/ListItem → InlineList/v2/InlineListItem}/props.js +0 -0
  129. /package/lib/List/{ListItem → v1/ListItem}/styles.js +0 -0
  130. /package/lib/List/{ListItem → v1/ListItem}/theme.js +0 -0
  131. /package/lib/List/{props.js → v1/props.js} +0 -0
  132. /package/lib/List/{styles.js → v1/styles.js} +0 -0
  133. /package/lib/List/{theme.js → v1/theme.js} +0 -0
  134. /package/src/InlineList/{InlineListItem → v1/InlineListItem}/props.ts +0 -0
  135. /package/src/InlineList/{InlineListItem → v1/InlineListItem}/styles.ts +0 -0
  136. /package/src/InlineList/{InlineListItem → v1/InlineListItem}/theme.ts +0 -0
  137. /package/src/InlineList/{README.md → v1/README.md} +0 -0
  138. /package/src/InlineList/{props.ts → v1/props.ts} +0 -0
  139. /package/src/List/{ListItem → v1/ListItem}/props.ts +0 -0
  140. /package/src/List/{ListItem → v1/ListItem}/styles.ts +0 -0
  141. /package/src/List/{ListItem → v1/ListItem}/theme.ts +0 -0
  142. /package/src/List/{README.md → v1/README.md} +0 -0
  143. /package/src/List/{props.ts → v1/props.ts} +0 -0
  144. /package/src/List/{styles.ts → v1/styles.ts} +0 -0
  145. /package/src/List/{theme.ts → v1/theme.ts} +0 -0
  146. /package/types/InlineList/{InlineListItem → v1/InlineListItem}/index.d.ts +0 -0
  147. /package/types/InlineList/{InlineListItem → v1/InlineListItem}/props.d.ts +0 -0
  148. /package/types/InlineList/{InlineListItem → v1/InlineListItem}/styles.d.ts +0 -0
  149. /package/types/InlineList/{InlineListItem → v1/InlineListItem}/theme.d.ts +0 -0
  150. /package/types/InlineList/{index.d.ts → v1/index.d.ts} +0 -0
  151. /package/types/InlineList/{props.d.ts → v1/props.d.ts} +0 -0
  152. /package/types/List/{ListItem → v1/ListItem}/index.d.ts +0 -0
  153. /package/types/List/{ListItem → v1/ListItem}/props.d.ts +0 -0
  154. /package/types/List/{ListItem → v1/ListItem}/styles.d.ts +0 -0
  155. /package/types/List/{ListItem → v1/ListItem}/theme.d.ts +0 -0
  156. /package/types/List/{index.d.ts → v1/index.d.ts} +0 -0
  157. /package/types/List/{props.d.ts → v1/props.d.ts} +0 -0
  158. /package/types/List/{styles.d.ts → v1/styles.d.ts} +0 -0
  159. /package/types/List/{theme.d.ts → v1/theme.d.ts} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-list",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
4
4
  "description": "Components for displaying vertical or horizontal lists.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -15,20 +15,20 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/shared-types": "11.6.0",
19
- "@instructure/emotion": "11.6.0",
20
- "@instructure/ui-react-utils": "11.6.0",
21
- "@instructure/ui-view": "11.6.0",
22
- "@instructure/console": "11.6.0"
18
+ "@instructure/console": "11.6.1-snapshot-129",
19
+ "@instructure/emotion": "11.6.1-snapshot-129",
20
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129",
21
+ "@instructure/shared-types": "11.6.1-snapshot-129",
22
+ "@instructure/ui-view": "11.6.1-snapshot-129"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@testing-library/jest-dom": "^6.6.3",
26
26
  "@testing-library/react": "15.0.7",
27
27
  "vitest": "^3.2.2",
28
- "@instructure/ui-axe-check": "11.6.0",
29
- "@instructure/ui-babel-preset": "11.6.0",
30
- "@instructure/ui-themes": "11.6.0",
31
- "@instructure/ui-color-utils": "11.6.0"
28
+ "@instructure/ui-axe-check": "11.6.1-snapshot-129",
29
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129",
30
+ "@instructure/ui-themes": "11.6.1-snapshot-129",
31
+ "@instructure/ui-color-utils": "11.6.1-snapshot-129"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": ">=18 <=19"
@@ -38,17 +38,39 @@
38
38
  },
39
39
  "sideEffects": false,
40
40
  "exports": {
41
- ".": {
42
- "types": "./types/index.d.ts",
43
- "import": "./es/index.js",
44
- "require": "./lib/index.js",
45
- "default": "./es/index.js"
46
- },
47
41
  "./lib/*": "./lib/*",
48
42
  "./es/*": "./es/*",
49
43
  "./types/*": "./types/*",
50
44
  "./package.json": "./package.json",
51
- "./src/*": "./src/*"
45
+ "./src/*": "./src/*",
46
+ ".": {
47
+ "src": "./src/exports/a.ts",
48
+ "types": "./types/exports/a.d.ts",
49
+ "import": "./es/exports/a.js",
50
+ "require": "./lib/exports/a.js",
51
+ "default": "./es/exports/a.js"
52
+ },
53
+ "./v11_6": {
54
+ "src": "./src/exports/a.ts",
55
+ "types": "./types/exports/a.d.ts",
56
+ "import": "./es/exports/a.js",
57
+ "require": "./lib/exports/a.js",
58
+ "default": "./es/exports/a.js"
59
+ },
60
+ "./v11_7": {
61
+ "src": "./src/exports/b.ts",
62
+ "types": "./types/exports/b.d.ts",
63
+ "import": "./es/exports/b.js",
64
+ "require": "./lib/exports/b.js",
65
+ "default": "./es/exports/b.js"
66
+ },
67
+ "./latest": {
68
+ "src": "./src/exports/b.ts",
69
+ "types": "./types/exports/b.d.ts",
70
+ "import": "./es/exports/b.js",
71
+ "require": "./lib/exports/b.js",
72
+ "default": "./es/exports/b.js"
73
+ }
52
74
  },
53
75
  "scripts": {
54
76
  "lint": "ui-scripts lint",
@@ -24,10 +24,10 @@
24
24
 
25
25
  import { Component } from 'react'
26
26
 
27
- import { View } from '@instructure/ui-view'
27
+ import { View } from '@instructure/ui-view/v11_6'
28
28
  import { passthroughProps } from '@instructure/ui-react-utils'
29
29
 
30
- import { withStyle } from '@instructure/emotion'
30
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
31
31
 
32
32
  import generateStyle from './styles'
33
33
  import generateComponentTheme from './theme'
@@ -23,7 +23,7 @@
23
23
  */
24
24
  import { Children, Component, ReactElement } from 'react'
25
25
 
26
- import { View } from '@instructure/ui-view'
26
+ import { View } from '@instructure/ui-view/v11_6'
27
27
  import { passthroughProps, safeCloneElement } from '@instructure/ui-react-utils'
28
28
 
29
29
  import { InlineListItem } from './InlineListItem'
@@ -0,0 +1,110 @@
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 { Component } from 'react'
26
+
27
+ import { View } from '@instructure/ui-view/latest'
28
+ import { passthroughProps } from '@instructure/ui-react-utils'
29
+ import { withStyle } from '@instructure/emotion'
30
+
31
+ import generateStyle from './styles'
32
+ import { allowedProps } from './props'
33
+ import type { InlineListItemProps } from './props'
34
+
35
+ /**
36
+ ---
37
+ parent: InlineList
38
+ id: InlineList.Item
39
+ ---
40
+ **/
41
+ @withStyle(generateStyle)
42
+ class InlineListItem extends Component<InlineListItemProps> {
43
+ static readonly componentId = 'InlineList.Item'
44
+
45
+ static allowedProps = allowedProps
46
+ static defaultProps = {
47
+ padding: 'none',
48
+ spacing: 'none',
49
+ delimiter: 'none',
50
+ size: 'medium',
51
+ lastPlaceholder: false
52
+ }
53
+
54
+ ref: Element | null = null
55
+
56
+ handleRef = (el: Element | null) => {
57
+ const { elementRef } = this.props
58
+
59
+ this.ref = el
60
+
61
+ if (typeof elementRef === 'function') {
62
+ elementRef(el)
63
+ }
64
+ }
65
+
66
+ componentDidMount() {
67
+ this.props.makeStyles?.()
68
+ }
69
+
70
+ componentDidUpdate() {
71
+ this.props.makeStyles?.()
72
+ }
73
+
74
+ render() {
75
+ const {
76
+ delimiter,
77
+ size,
78
+ margin,
79
+ padding,
80
+ elementRef,
81
+ children,
82
+ spacing,
83
+ styles,
84
+ lastPlaceholder,
85
+ ...rest
86
+ } = this.props
87
+
88
+ return (
89
+ <View
90
+ {...passthroughProps(rest)}
91
+ css={styles?.inlineListItem}
92
+ as="li"
93
+ margin={margin}
94
+ padding={padding}
95
+ display="inline-block"
96
+ maxWidth="100%"
97
+ elementRef={this.handleRef}
98
+ data-cid="InlineListItem"
99
+ >
100
+ {children}
101
+ {!lastPlaceholder && (
102
+ <span css={styles?.delimiter} aria-hidden="true" />
103
+ )}
104
+ </View>
105
+ )
106
+ }
107
+ }
108
+
109
+ export default InlineListItem
110
+ export { InlineListItem }
@@ -0,0 +1,99 @@
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 { PropsWithChildren } from 'react'
26
+
27
+ import type {
28
+ Spacing,
29
+ WithStyleProps,
30
+ ComponentStyle
31
+ } from '@instructure/emotion'
32
+ import type {
33
+ InlineListItemTheme,
34
+ OtherHTMLAttributes
35
+ } from '@instructure/shared-types'
36
+
37
+ type InlineListItemOwnProps = {
38
+ /**
39
+ * Inherits delimiter from the parent InlineList component
40
+ */
41
+ delimiter?: 'none' | 'pipe' | 'slash' | 'arrow'
42
+ size?: 'small' | 'medium' | 'large'
43
+ /**
44
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
45
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
46
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
47
+ */
48
+ margin?: Spacing
49
+ /**
50
+ * Valid values are `0`, `none`, `xxx-small`, `xx-small`, `x-small`,
51
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
52
+ * familiar CSS-like shorthand. For example: `padding="small x-large large"`.
53
+ */
54
+ padding?: Spacing
55
+ /**
56
+ * Inherits itemSpacing from the parent InlineList component
57
+ */
58
+ spacing?:
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
+ * Used internally to mark the last item as a placeholder
74
+ */
75
+ lastPlaceholder?: boolean
76
+ } & PropsWithChildren<unknown> // <unknown> is needed for React 17 compatibility
77
+
78
+ type PropKeys = keyof InlineListItemOwnProps
79
+
80
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
81
+
82
+ type InlineListItemProps = InlineListItemOwnProps &
83
+ WithStyleProps<InlineListItemTheme, InlineListItemStyle> &
84
+ OtherHTMLAttributes<InlineListItemOwnProps>
85
+
86
+ type InlineListItemStyle = ComponentStyle<'inlineListItem' | 'delimiter'>
87
+
88
+ const allowedProps: AllowedPropKeys = [
89
+ 'children',
90
+ 'delimiter',
91
+ 'size',
92
+ 'margin',
93
+ 'padding',
94
+ 'spacing',
95
+ 'elementRef'
96
+ ]
97
+
98
+ export type { InlineListItemProps, InlineListItemStyle }
99
+ export { allowedProps }
@@ -0,0 +1,142 @@
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 { logError as error } from '@instructure/console'
26
+
27
+ import type { NewComponentTypes } from '@instructure/ui-themes'
28
+ import type { InlineListItemProps, InlineListItemStyle } from './props'
29
+
30
+ /**
31
+ * ---
32
+ * private: true
33
+ * ---
34
+ * Generates the style object from the theme and provided additional information
35
+ * @param {Object} componentTheme The theme variable object.
36
+ * @param {Object} props the props of the component, the style is applied to
37
+ * @return {Object} The final style object, which will be used in the component
38
+ */
39
+ const generateStyle = (
40
+ componentTheme: NewComponentTypes['InlineListItem'],
41
+ props: InlineListItemProps
42
+ ): InlineListItemStyle => {
43
+ const { size, delimiter, spacing } = props
44
+
45
+ const withDelimiter = delimiter !== 'none'
46
+ const withSpacing = spacing !== 'none'
47
+
48
+ error(
49
+ !(withDelimiter && withSpacing),
50
+ `[InlineList] \`itemSpacing\` has no effect inside Lists with the \`delimiter\` prop set to anything other than \`none\`.`
51
+ )
52
+
53
+ const sizeVariants = {
54
+ small: { fontSize: componentTheme.fontSizeSmall },
55
+ medium: { fontSize: componentTheme.fontSizeMedium },
56
+ large: { fontSize: componentTheme.fontSizeLarge }
57
+ }
58
+
59
+ const spacingVariants = {
60
+ 'xxx-small': {
61
+ marginInlineStart: componentTheme.spacingXXXSmall,
62
+ marginInlineEnd: componentTheme.spacingXXXSmall
63
+ },
64
+ 'xx-small': {
65
+ marginInlineStart: componentTheme.spacingXXSmall,
66
+ marginInlineEnd: componentTheme.spacingXXSmall
67
+ },
68
+ 'x-small': {
69
+ marginInlineStart: componentTheme.spacingXSmall,
70
+ marginInlineEnd: componentTheme.spacingXSmall
71
+ },
72
+ small: {
73
+ marginInlineStart: componentTheme.spacingSmall,
74
+ marginInlineEnd: componentTheme.spacingSmall
75
+ },
76
+ medium: {
77
+ marginInlineStart: componentTheme.spacingMedium,
78
+ marginInlineEnd: componentTheme.spacingMedium
79
+ },
80
+ large: {
81
+ marginInlineStart: componentTheme.spacingLarge,
82
+ marginInlineEnd: componentTheme.spacingLarge
83
+ },
84
+ 'x-large': {
85
+ marginInlineStart: componentTheme.spacingXLarge,
86
+ marginInlineEnd: componentTheme.spacingXLarge
87
+ },
88
+ 'xx-large': {
89
+ marginInlineStart: componentTheme.spacingXXLarge,
90
+ marginInlineEnd: componentTheme.spacingXXLarge
91
+ },
92
+ none: {}
93
+ }
94
+
95
+ const delimiterVariants = {
96
+ none: {
97
+ marginInlineStart: componentTheme.noneSpacing,
98
+ marginInlineEnd: componentTheme.noneSpacing
99
+ },
100
+ pipe: {
101
+ marginInlineStart: componentTheme.pipeSpacing,
102
+ marginInlineEnd: componentTheme.pipeSpacing,
103
+ '&::after': { content: '"\\007C"' }
104
+ },
105
+ slash: {
106
+ marginInlineStart: componentTheme.slashSpacing,
107
+ marginInlineEnd: componentTheme.slashSpacing,
108
+ '&::after': { content: '"\\002F"' }
109
+ },
110
+ arrow: {
111
+ marginInlineStart: componentTheme.arrowSpacing,
112
+ marginInlineEnd: componentTheme.arrowSpacing,
113
+ '&::after': { content: '"\\003E"' }
114
+ }
115
+ }
116
+
117
+ return {
118
+ inlineListItem: {
119
+ label: 'inlineListItem',
120
+ fontWeight: componentTheme.fontWeight,
121
+ fontFamily: componentTheme.fontFamily,
122
+ verticalAlign: 'middle',
123
+ boxSizing: 'border-box',
124
+ lineHeight: componentTheme.lineHeight,
125
+ color: componentTheme.color,
126
+ ...(withSpacing && !withDelimiter && spacingVariants[spacing!]),
127
+ ...sizeVariants[size!],
128
+ '&:first-of-type': { marginInlineStart: 0 },
129
+ '&:last-of-type': { marginInlineEnd: 0 }
130
+ },
131
+ delimiter: {
132
+ label: 'inlineListItem__delimiter',
133
+ ...delimiterVariants[delimiter!],
134
+ '[class$=-inlineListItem]:last-of-type > &:last-child::after': {
135
+ content: 'none'
136
+ },
137
+ color: componentTheme.delimiterColor
138
+ }
139
+ }
140
+ }
141
+
142
+ export default generateStyle
@@ -0,0 +1,146 @@
1
+ ---
2
+ describes: InlineList
3
+ ---
4
+
5
+ An `InlineList` component displays the list horizontally.
6
+
7
+ ```javascript
8
+ ---
9
+ type: example
10
+ ---
11
+ <InlineList>
12
+ <InlineList.Item>{lorem.sentence()}</InlineList.Item>
13
+ <InlineList.Item>10pts</InlineList.Item>
14
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
15
+ <InlineList.Item><Link href="#">Submitted</Link></InlineList.Item>
16
+ </InlineList>
17
+
18
+ ```
19
+
20
+ ### Adding a delimiter
21
+
22
+ The `delimiter` prop lets you display a separator between Items in the List. The built-in delimiter options include ['none', 'pipe', 'slash', and 'arrow'].
23
+
24
+ ```javascript
25
+ ---
26
+ type: example
27
+ ---
28
+ <div>
29
+ <InlineList delimiter="none" margin="large 0">
30
+ <InlineList.Item>{lorem.sentence()}</InlineList.Item>
31
+ <InlineList.Item>10pts</InlineList.Item>
32
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
33
+ <InlineList.Item><Link href="#">No Separator</Link></InlineList.Item>
34
+ </InlineList>
35
+ <InlineList delimiter="pipe" margin="large 0">
36
+ <InlineList.Item>{lorem.sentence()}</InlineList.Item>
37
+ <InlineList.Item>10pts</InlineList.Item>
38
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
39
+ <InlineList.Item><Link href="#">Pipe Separator</Link></InlineList.Item>
40
+ </InlineList>
41
+ <InlineList delimiter="slash" margin="large 0">
42
+ <InlineList.Item>{lorem.sentence()}</InlineList.Item>
43
+ <InlineList.Item>10pts</InlineList.Item>
44
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
45
+ <InlineList.Item><Link href="#">Slash Separator</Link></InlineList.Item>
46
+ </InlineList>
47
+ <InlineList delimiter="arrow" margin="large 0">
48
+ <InlineList.Item>{lorem.sentence()}</InlineList.Item>
49
+ <InlineList.Item>10pts</InlineList.Item>
50
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
51
+ <InlineList.Item><Link href="#">Arrow Separator</Link></InlineList.Item>
52
+ </InlineList>
53
+ </div>
54
+ ```
55
+
56
+ ### Sizing
57
+
58
+ The `size` prop lets you adjust the font-size of the List. The predefined values are aligned with other components that use a 'size' prop for overall consistency within your application. The default is 'medium'.
59
+
60
+ ```javascript
61
+ ---
62
+ type: example
63
+ ---
64
+ <div>
65
+ <InlineList size="small" margin="large 0">
66
+ <InlineList.Item>{lorem.sentence()}</InlineList.Item>
67
+ <InlineList.Item>Small Size</InlineList.Item>
68
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
69
+ <InlineList.Item><Link href="#">Submitted</Link></InlineList.Item>
70
+ </InlineList>
71
+ <InlineList margin="large 0">
72
+ <InlineList.Item>{lorem.sentence()}</InlineList.Item>
73
+ <InlineList.Item>Medium (default) Size</InlineList.Item>
74
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
75
+ <InlineList.Item><Link href="#">Submitted</Link></InlineList.Item>
76
+ </InlineList>
77
+ <InlineList size="large" margin="large 0">
78
+ <InlineList.Item>{lorem.sentence()}</InlineList.Item>
79
+ <InlineList.Item>Large Size</InlineList.Item>
80
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
81
+ <InlineList.Item><Link href="#">Submitted</Link></InlineList.Item>
82
+ </InlineList>
83
+ </div>
84
+ ```
85
+
86
+ ### Adding predefined space between each InlineList.Item
87
+
88
+ Use the `itemSpacing` prop to add space around your list’s items. To avoid unwanted excess space at the start/end of a List, the first and last InlineList.Item will not receive margin via the `itemSpacing` prop.
89
+
90
+ > NOTE: itemSpacing has no affect on an InlineList.Item that has the `delimiter` prop set to anything other than **none**.
91
+
92
+ ```javascript
93
+ ---
94
+ type: example
95
+ ---
96
+ <div>
97
+ <InlineList itemSpacing="xxx-small">
98
+ <InlineList.Item>Adding predefined space</InlineList.Item>
99
+ <InlineList.Item>10pts</InlineList.Item>
100
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
101
+ <InlineList.Item><Link href="#">Set to xxx-small</Link></InlineList.Item>
102
+ </InlineList>
103
+ <InlineList itemSpacing="xx-small">
104
+ <InlineList.Item>Adding predefined space</InlineList.Item>
105
+ <InlineList.Item>10pts</InlineList.Item>
106
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
107
+ <InlineList.Item><Link href="#">Set to xx-small</Link></InlineList.Item>
108
+ </InlineList>
109
+ <InlineList itemSpacing="x-small">
110
+ <InlineList.Item>Adding predefined space</InlineList.Item>
111
+ <InlineList.Item>10pts</InlineList.Item>
112
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
113
+ <InlineList.Item><Link href="#">Set to x-small</Link></InlineList.Item>
114
+ </InlineList>
115
+ <InlineList itemSpacing="small">
116
+ <InlineList.Item>Adding predefined space</InlineList.Item>
117
+ <InlineList.Item>10pts</InlineList.Item>
118
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
119
+ <InlineList.Item><Link href="#">Set to small</Link></InlineList.Item>
120
+ </InlineList>
121
+ <InlineList itemSpacing="medium">
122
+ <InlineList.Item>Adding predefined space</InlineList.Item>
123
+ <InlineList.Item>10pts</InlineList.Item>
124
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
125
+ <InlineList.Item><Link href="#">Set to medium</Link></InlineList.Item>
126
+ </InlineList>
127
+ <InlineList itemSpacing="large">
128
+ <InlineList.Item>Adding predefined space</InlineList.Item>
129
+ <InlineList.Item>10pts</InlineList.Item>
130
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
131
+ <InlineList.Item><Link href="#">Set to large</Link></InlineList.Item>
132
+ </InlineList>
133
+ <InlineList itemSpacing="x-large">
134
+ <InlineList.Item>Adding predefined space</InlineList.Item>
135
+ <InlineList.Item>10pts</InlineList.Item>
136
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
137
+ <InlineList.Item><Link href="#">Set to x-large</Link></InlineList.Item>
138
+ </InlineList>
139
+ <InlineList itemSpacing="xx-large">
140
+ <InlineList.Item>Adding predefined space</InlineList.Item>
141
+ <InlineList.Item>10pts</InlineList.Item>
142
+ <InlineList.Item><b>Due:</b> Oct 1, 2019</InlineList.Item>
143
+ <InlineList.Item><Link href="#">Set to xx-large</Link></InlineList.Item>
144
+ </InlineList>
145
+ </div>
146
+ ```