@instructure/ui-drilldown 8.21.1-snapshot.10

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 (89) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/LICENSE.md +27 -0
  3. package/README.md +30 -0
  4. package/es/Drilldown/DrilldownGroup/index.js +56 -0
  5. package/es/Drilldown/DrilldownGroup/props.js +42 -0
  6. package/es/Drilldown/DrilldownLocator.js +144 -0
  7. package/es/Drilldown/DrilldownOption/index.js +59 -0
  8. package/es/Drilldown/DrilldownOption/props.js +46 -0
  9. package/es/Drilldown/DrilldownPage/index.js +56 -0
  10. package/es/Drilldown/DrilldownPage/props.js +41 -0
  11. package/es/Drilldown/DrilldownSeparator/index.js +52 -0
  12. package/es/Drilldown/DrilldownSeparator/props.js +30 -0
  13. package/es/Drilldown/__examples__/Drilldown.examples.js +299 -0
  14. package/es/Drilldown/index.js +1241 -0
  15. package/es/Drilldown/locator.js +26 -0
  16. package/es/Drilldown/props.js +67 -0
  17. package/es/Drilldown/styles.js +82 -0
  18. package/es/Drilldown/theme.js +43 -0
  19. package/es/index.js +24 -0
  20. package/lib/Drilldown/DrilldownGroup/index.js +42 -0
  21. package/lib/Drilldown/DrilldownGroup/props.js +56 -0
  22. package/lib/Drilldown/DrilldownLocator.js +157 -0
  23. package/lib/Drilldown/DrilldownOption/index.js +45 -0
  24. package/lib/Drilldown/DrilldownOption/props.js +57 -0
  25. package/lib/Drilldown/DrilldownPage/index.js +66 -0
  26. package/lib/Drilldown/DrilldownPage/props.js +56 -0
  27. package/lib/Drilldown/DrilldownSeparator/index.js +38 -0
  28. package/lib/Drilldown/DrilldownSeparator/props.js +41 -0
  29. package/lib/Drilldown/__examples__/Drilldown.examples.js +289 -0
  30. package/lib/Drilldown/index.js +1253 -0
  31. package/lib/Drilldown/locator.js +40 -0
  32. package/lib/Drilldown/props.js +83 -0
  33. package/lib/Drilldown/styles.js +90 -0
  34. package/lib/Drilldown/theme.js +51 -0
  35. package/lib/index.js +13 -0
  36. package/lib/package.json +1 -0
  37. package/package.json +58 -0
  38. package/src/Drilldown/DrilldownGroup/index.tsx +64 -0
  39. package/src/Drilldown/DrilldownGroup/props.ts +149 -0
  40. package/src/Drilldown/DrilldownLocator.ts +101 -0
  41. package/src/Drilldown/DrilldownOption/index.tsx +68 -0
  42. package/src/Drilldown/DrilldownOption/props.ts +224 -0
  43. package/src/Drilldown/DrilldownPage/index.tsx +58 -0
  44. package/src/Drilldown/DrilldownPage/props.ts +129 -0
  45. package/src/Drilldown/DrilldownSeparator/index.tsx +60 -0
  46. package/src/Drilldown/DrilldownSeparator/props.ts +65 -0
  47. package/src/Drilldown/README.md +1515 -0
  48. package/src/Drilldown/__examples__/Drilldown.examples.tsx +318 -0
  49. package/src/Drilldown/index.tsx +1492 -0
  50. package/src/Drilldown/locator.ts +28 -0
  51. package/src/Drilldown/props.ts +378 -0
  52. package/src/Drilldown/styles.ts +95 -0
  53. package/src/Drilldown/theme.ts +47 -0
  54. package/src/index.ts +26 -0
  55. package/tsconfig.build.json +30 -0
  56. package/tsconfig.build.tsbuildinfo +1 -0
  57. package/tsconfig.json +4 -0
  58. package/types/Drilldown/DrilldownGroup/index.d.ts +59 -0
  59. package/types/Drilldown/DrilldownGroup/index.d.ts.map +1 -0
  60. package/types/Drilldown/DrilldownGroup/props.d.ts +65 -0
  61. package/types/Drilldown/DrilldownGroup/props.d.ts.map +1 -0
  62. package/types/Drilldown/DrilldownLocator.d.ts +652 -0
  63. package/types/Drilldown/DrilldownLocator.d.ts.map +1 -0
  64. package/types/Drilldown/DrilldownOption/index.d.ts +134 -0
  65. package/types/Drilldown/DrilldownOption/index.d.ts.map +1 -0
  66. package/types/Drilldown/DrilldownOption/props.d.ts +116 -0
  67. package/types/Drilldown/DrilldownOption/props.d.ts.map +1 -0
  68. package/types/Drilldown/DrilldownPage/index.d.ts +45 -0
  69. package/types/Drilldown/DrilldownPage/index.d.ts.map +1 -0
  70. package/types/Drilldown/DrilldownPage/props.d.ts +51 -0
  71. package/types/Drilldown/DrilldownPage/props.d.ts.map +1 -0
  72. package/types/Drilldown/DrilldownSeparator/index.d.ts +27 -0
  73. package/types/Drilldown/DrilldownSeparator/index.d.ts.map +1 -0
  74. package/types/Drilldown/DrilldownSeparator/props.d.ts +18 -0
  75. package/types/Drilldown/DrilldownSeparator/props.d.ts.map +1 -0
  76. package/types/Drilldown/__examples__/Drilldown.examples.d.ts +5 -0
  77. package/types/Drilldown/__examples__/Drilldown.examples.d.ts.map +1 -0
  78. package/types/Drilldown/index.d.ts +246 -0
  79. package/types/Drilldown/index.d.ts.map +1 -0
  80. package/types/Drilldown/locator.d.ts +4 -0
  81. package/types/Drilldown/locator.d.ts.map +1 -0
  82. package/types/Drilldown/props.d.ts +189 -0
  83. package/types/Drilldown/props.d.ts.map +1 -0
  84. package/types/Drilldown/styles.d.ts +15 -0
  85. package/types/Drilldown/styles.d.ts.map +1 -0
  86. package/types/Drilldown/theme.d.ts +10 -0
  87. package/types/Drilldown/theme.d.ts.map +1 -0
  88. package/types/index.d.ts +3 -0
  89. package/types/index.d.ts.map +1 -0
@@ -0,0 +1,68 @@
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
+ /** @jsx jsx */
26
+ import { Component } from 'react'
27
+
28
+ import { withStyle } from '@instructure/emotion'
29
+ import { optionsItemThemeGenerator } from '@instructure/ui-options'
30
+
31
+ import { propTypes, allowedProps } from './props'
32
+ import type { DrilldownOptionProps } from './props'
33
+
34
+ /**
35
+ ---
36
+ parent: Drilldown
37
+ id: Drilldown.Option
38
+ ---
39
+ @module DrilldownOption
40
+ @tsProps
41
+ **/
42
+ // needed for listing the available theme variables on docs page,
43
+ // we pass the themeOverrides to Options.Item
44
+ @withStyle(null, optionsItemThemeGenerator)
45
+ class DrilldownOption extends Component<DrilldownOptionProps> {
46
+ static readonly componentId = 'Drilldown.Option'
47
+
48
+ static propTypes = propTypes
49
+ static allowedProps = allowedProps
50
+
51
+ static defaultProps = {
52
+ disabled: false,
53
+ beforeLabelContentVAlign: 'start',
54
+ afterLabelContentVAlign: 'start',
55
+ descriptionRole: 'note',
56
+ as: 'li',
57
+ role: 'menuitem'
58
+ }
59
+
60
+ render() {
61
+ // this component is only used for prop validation. Drilldown.Option children
62
+ // are parsed in Drilldown and rendered as Options.Item components
63
+ return null
64
+ }
65
+ }
66
+
67
+ export default DrilldownOption
68
+ export { DrilldownOption }
@@ -0,0 +1,224 @@
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
+ import PropTypes from 'prop-types'
27
+
28
+ import type {
29
+ OtherHTMLAttributes,
30
+ PropValidators,
31
+ OptionsItemTheme,
32
+ AsElementType
33
+ } from '@instructure/shared-types'
34
+ import type { WithStyleProps } from '@instructure/emotion'
35
+ import type { OptionsItemProps } from '@instructure/ui-options'
36
+
37
+ import Drilldown from '../index'
38
+
39
+ type DrilldownOptionValue = string | number | undefined
40
+
41
+ type RenderContentVAlign = 'start' | 'center' | 'end'
42
+
43
+ type DrilldownOptionVariant = Exclude<OptionsItemProps['variant'], 'selected'>
44
+
45
+ type RenderContentProps = {
46
+ as: DrilldownOptionOwnProps['as']
47
+ role: DrilldownOptionOwnProps['role']
48
+ variant: DrilldownOptionVariant
49
+ vAlign: RenderContentVAlign
50
+ isSelected: boolean
51
+ }
52
+
53
+ type DrilldownOptionOwnProps = {
54
+ id: string
55
+
56
+ /**
57
+ * Label of the Drilldown option.
58
+ */
59
+ children?:
60
+ | React.ReactNode
61
+ | ((props: {
62
+ id: string
63
+ variant: DrilldownOptionVariant
64
+ isSelected: boolean
65
+ }) => React.ReactNode)
66
+
67
+ /**
68
+ * The id of the sub-page the option navigates to.
69
+ */
70
+ subPageId?: string
71
+
72
+ /**
73
+ * Is the option disabled.
74
+ */
75
+ disabled?: boolean
76
+
77
+ /**
78
+ * The value of the option. Should be set for options in selectable groups.
79
+ */
80
+ value?: DrilldownOptionValue
81
+
82
+ /**
83
+ * Providing href will render the option as `<a>`. Doesn't work, if subPageId is provided or is in a selectable group.
84
+ */
85
+ href?: string
86
+
87
+ /**
88
+ * Element type to render as. Will be set to `<a>` if href is provided. If the parent is "ul" or "ol", the option is forced to be "li" element.
89
+ */
90
+ as?: AsElementType
91
+
92
+ /**
93
+ * The ARIA role of the element
94
+ */
95
+ role?: string
96
+
97
+ /**
98
+ * Info content to render after the label.
99
+ *
100
+ * If a function is provided, it has a `props` parameter.
101
+ */
102
+ renderLabelInfo?:
103
+ | React.ReactNode
104
+ | ((props: RenderContentProps) => React.ReactNode)
105
+
106
+ /**
107
+ * Content to render before the label.
108
+ *
109
+ * If a function is provided, it has a `props` parameter.
110
+ */
111
+ renderBeforeLabel?:
112
+ | React.ReactNode
113
+ | ((props: RenderContentProps) => React.ReactNode)
114
+
115
+ /**
116
+ * Content to render after the label.
117
+ *
118
+ * If a function is provided, it has a `props` parameter.
119
+ */
120
+ renderAfterLabel?:
121
+ | React.ReactNode
122
+ | ((props: RenderContentProps) => React.ReactNode)
123
+
124
+ /**
125
+ * Sets the vAlign of renderBeforeLabel content
126
+ */
127
+ beforeLabelContentVAlign?: RenderContentVAlign
128
+
129
+ /**
130
+ * Sets the vAlign of renderAfterLabel content and renderLabelInfo
131
+ */
132
+ afterLabelContentVAlign?: RenderContentVAlign
133
+
134
+ /**
135
+ * Additional "secondary" description text
136
+ */
137
+ description?: React.ReactNode | (() => React.ReactNode)
138
+
139
+ /**
140
+ * The ARIA role of the description element
141
+ */
142
+ descriptionRole?: string
143
+
144
+ /**
145
+ * Callback fired when the option is clicked.
146
+ */
147
+ onOptionClick?: (
148
+ event: React.SyntheticEvent,
149
+ args: {
150
+ optionId: string
151
+ drilldown: Drilldown
152
+ pageHistory: string[]
153
+ goToPage: (
154
+ pageId: string
155
+ ) => { prevPageId: string; newPageId: string } | undefined
156
+ goToPreviousPage: () =>
157
+ | { prevPageId: string; newPageId: string }
158
+ | undefined
159
+ }
160
+ ) => void
161
+
162
+ /**
163
+ * Whether the option is selected by default.
164
+ */
165
+ defaultSelected?: boolean
166
+
167
+ /**
168
+ * Provides a reference to the underlying html root element
169
+ */
170
+ elementRef?: (element: Element | null) => void
171
+ }
172
+
173
+ type PropKeys = keyof DrilldownOptionOwnProps
174
+
175
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
176
+
177
+ type DrilldownOptionProps = DrilldownOptionOwnProps &
178
+ WithStyleProps<OptionsItemTheme, null> &
179
+ OtherHTMLAttributes<DrilldownOptionOwnProps>
180
+
181
+ const propTypes: PropValidators<PropKeys> = {
182
+ id: PropTypes.string.isRequired,
183
+ children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
184
+ subPageId: PropTypes.string,
185
+ disabled: PropTypes.bool,
186
+ value: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
187
+ href: PropTypes.string,
188
+ as: PropTypes.elementType,
189
+ role: PropTypes.string,
190
+ renderLabelInfo: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
191
+ renderBeforeLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
192
+ renderAfterLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
193
+ beforeLabelContentVAlign: PropTypes.oneOf(['start', 'center', 'end']),
194
+ afterLabelContentVAlign: PropTypes.oneOf(['start', 'center', 'end']),
195
+ description: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
196
+ descriptionRole: PropTypes.string,
197
+ onOptionClick: PropTypes.func,
198
+ defaultSelected: PropTypes.bool,
199
+ elementRef: PropTypes.func
200
+ }
201
+
202
+ const allowedProps: AllowedPropKeys = [
203
+ 'id',
204
+ 'children',
205
+ 'subPageId',
206
+ 'disabled',
207
+ 'value',
208
+ 'href',
209
+ 'as',
210
+ 'role',
211
+ 'renderLabelInfo',
212
+ 'renderBeforeLabel',
213
+ 'renderAfterLabel',
214
+ 'beforeLabelContentVAlign',
215
+ 'afterLabelContentVAlign',
216
+ 'description',
217
+ 'descriptionRole',
218
+ 'onOptionClick',
219
+ 'defaultSelected',
220
+ 'elementRef'
221
+ ]
222
+
223
+ export type { DrilldownOptionProps, DrilldownOptionValue }
224
+ export { propTypes, allowedProps }
@@ -0,0 +1,58 @@
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
+ /** @jsx jsx */
26
+ import { Component } from 'react'
27
+
28
+ import { propTypes, allowedProps } from './props'
29
+ import type { DrilldownPageProps } from './props'
30
+
31
+ /**
32
+ ---
33
+ parent: Drilldown
34
+ id: Drilldown.Page
35
+ ---
36
+ @module DrilldownPage
37
+ @tsProps
38
+ **/
39
+ class DrilldownPage extends Component<DrilldownPageProps> {
40
+ static readonly componentId = 'Drilldown.Page'
41
+
42
+ static propTypes = propTypes
43
+ static allowedProps = allowedProps
44
+ static defaultProps = {
45
+ renderBackButtonLabel: 'Back',
46
+ disabled: false,
47
+ withoutHeaderSeparator: false
48
+ }
49
+
50
+ render() {
51
+ // this component is only used for prop validation.
52
+ // Drilldown.Page children are parsed in Drilldown.
53
+ return null
54
+ }
55
+ }
56
+
57
+ export default DrilldownPage
58
+ export { DrilldownPage }
@@ -0,0 +1,129 @@
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
+ import PropTypes from 'prop-types'
27
+
28
+ import { Children } from '@instructure/ui-prop-types'
29
+
30
+ import type {
31
+ OtherHTMLAttributes,
32
+ PropValidators
33
+ } from '@instructure/shared-types'
34
+
35
+ import DrilldownGroup from '../DrilldownGroup'
36
+ import DrilldownOption from '../DrilldownOption'
37
+ import DrilldownSeparator from '../DrilldownSeparator'
38
+
39
+ import type { OptionChild, SeparatorChild, GroupChild } from '../props'
40
+
41
+ type PageChildren = GroupChild | OptionChild | SeparatorChild
42
+
43
+ type DrilldownPageOwnProps = {
44
+ id: string
45
+
46
+ /**
47
+ * Children of type:
48
+ * `<Drilldown.Option />`, `<Drilldown.Separator />`, `<Drilldown.Group />`
49
+ */
50
+ children?: PageChildren | PageChildren[] // TODO: type Children.oneOf([DrilldownOption, DrilldownSeparator, DrilldownGroup ])
51
+
52
+ /**
53
+ * The title of the page displayed in the header
54
+ */
55
+ renderTitle?: React.ReactNode | (() => React.ReactNode)
56
+
57
+ /**
58
+ * Label for the optional "action" option in the header (e.g.: "Select all")
59
+ */
60
+ renderActionLabel?: React.ReactNode | (() => React.ReactNode)
61
+
62
+ /**
63
+ * Label for the "back" navigation in the header.
64
+ *
65
+ * If a function is provided, the first parameter of the function
66
+ * is the title of the previous page.
67
+ */
68
+ renderBackButtonLabel?:
69
+ | React.ReactNode
70
+ | ((prevPageTitle?: React.ReactNode) => React.ReactNode)
71
+
72
+ /**
73
+ * Callback fired when the "action" option is clicked in the header
74
+ */
75
+ onHeaderActionClicked?: (event: React.SyntheticEvent) => void
76
+
77
+ /**
78
+ * Callback fired when the "back" navigation option is clicked in the header
79
+ */
80
+ onBackButtonClicked?: (newPageId: string, prevPageId: string) => void
81
+
82
+ /**
83
+ * Hides the separator under the page header
84
+ */
85
+ withoutHeaderSeparator?: boolean
86
+
87
+ /**
88
+ * Is the page disabled
89
+ */
90
+ disabled?: boolean
91
+ }
92
+
93
+ type PropKeys = keyof DrilldownPageOwnProps
94
+
95
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
96
+
97
+ type DrilldownPageProps = DrilldownPageOwnProps &
98
+ OtherHTMLAttributes<DrilldownPageOwnProps>
99
+
100
+ const propTypes: PropValidators<PropKeys> = {
101
+ id: PropTypes.string.isRequired,
102
+ children: Children.oneOf([
103
+ DrilldownOption,
104
+ DrilldownSeparator,
105
+ DrilldownGroup
106
+ ]),
107
+ renderTitle: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
108
+ renderActionLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
109
+ renderBackButtonLabel: PropTypes.oneOfType([PropTypes.node, PropTypes.func]),
110
+ onHeaderActionClicked: PropTypes.func,
111
+ onBackButtonClicked: PropTypes.func,
112
+ withoutHeaderSeparator: PropTypes.bool,
113
+ disabled: PropTypes.bool
114
+ }
115
+
116
+ const allowedProps: AllowedPropKeys = [
117
+ 'id',
118
+ 'children',
119
+ 'renderTitle',
120
+ 'renderActionLabel',
121
+ 'renderBackButtonLabel',
122
+ 'onHeaderActionClicked',
123
+ 'onBackButtonClicked',
124
+ 'withoutHeaderSeparator',
125
+ 'disabled'
126
+ ]
127
+
128
+ export type { DrilldownPageProps, PageChildren }
129
+ export { propTypes, allowedProps }
@@ -0,0 +1,60 @@
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
+ /** @jsx jsx */
26
+ import { Component } from 'react'
27
+
28
+ import { withStyle } from '@instructure/emotion'
29
+ import { optionsSeparatorThemeGenerator } from '@instructure/ui-options'
30
+
31
+ import { propTypes, allowedProps } from './props'
32
+ import type { DrilldownSeparatorProps } from './props'
33
+
34
+ /**
35
+ ---
36
+ parent: Drilldown
37
+ id: Drilldown.Separator
38
+ ---
39
+ @module DrilldownSeparator
40
+ @tsProps
41
+ **/
42
+ // needed for listing the available theme variables on docs page,
43
+ // we pass the themeOverrides to Options.Separator
44
+ @withStyle(null, optionsSeparatorThemeGenerator)
45
+ class DrilldownSeparator extends Component<DrilldownSeparatorProps> {
46
+ static readonly componentId = 'Drilldown.Separator'
47
+
48
+ static propTypes = propTypes
49
+ static allowedProps = allowedProps
50
+ static defaultProps = {}
51
+
52
+ render() {
53
+ // this component is only used for prop validation. Drilldown.Separator children
54
+ // are parsed in Drilldown and rendered as Options.Separator components
55
+ return null
56
+ }
57
+ }
58
+
59
+ export default DrilldownSeparator
60
+ export { DrilldownSeparator }
@@ -0,0 +1,65 @@
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 PropTypes from 'prop-types'
26
+
27
+ import type {
28
+ OtherHTMLAttributes,
29
+ PickPropsWithExceptions,
30
+ PropValidators,
31
+ AsElementType,
32
+ OptionsSeparatorTheme
33
+ } from '@instructure/shared-types'
34
+ import type { WithStyleProps } from '@instructure/emotion'
35
+ import type { OptionsSeparatorProps } from '@instructure/ui-options'
36
+
37
+ type DrilldownSeparatorOwnProps = {
38
+ id: string
39
+
40
+ /**
41
+ * Element type to render as
42
+ */
43
+ as?: AsElementType
44
+ }
45
+
46
+ type PropKeys = keyof DrilldownSeparatorOwnProps
47
+
48
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
49
+
50
+ type DrilldownSeparatorProps =
51
+ // we are passing all props to Options.Separator
52
+ PickPropsWithExceptions<OptionsSeparatorProps, 'as'> &
53
+ DrilldownSeparatorOwnProps &
54
+ WithStyleProps<OptionsSeparatorTheme, null> &
55
+ OtherHTMLAttributes<DrilldownSeparatorOwnProps>
56
+
57
+ const propTypes: PropValidators<PropKeys> = {
58
+ id: PropTypes.string.isRequired,
59
+ as: PropTypes.elementType
60
+ }
61
+
62
+ const allowedProps: AllowedPropKeys = ['id', 'as']
63
+
64
+ export type { DrilldownSeparatorProps }
65
+ export { propTypes, allowedProps }