@instructure/ui-drilldown 10.20.2-snapshot-5 → 10.20.2-snapshot-7

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.
@@ -1,329 +0,0 @@
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 { StoryConfig } from '@instructure/ui-test-utils'
26
-
27
- import { Drilldown } from '../index'
28
- import type { DrilldownProps } from '../props'
29
-
30
- const triggerButton = (
31
- <button
32
- key={1}
33
- style={{ marginLeft: '72px', position: 'absolute', top: '45%' }}
34
- >
35
- a drilldown trigger
36
- </button>
37
- )
38
-
39
- export default {
40
- maxExamplesPerPage: 10,
41
- propValues: {
42
- // these are non-existing props, we just pass them to getComponentProps()
43
- customProps: [
44
- { text: 'all custom props are undefined' },
45
- { text: 'disabled', defaultShow: false, disabled: true },
46
- {
47
- text: 'no overflow setting',
48
- defaultShow: true,
49
- disabled: false,
50
- separator: true,
51
- groupDisabled: true,
52
- renderGroupTitle: 'groupTitle',
53
- contentVAlign: 'start'
54
- },
55
- // overflowX tests
56
- {
57
- text: 'overflowX auto',
58
- defaultShow: true,
59
- width: '12rem',
60
- overflowX: 'auto',
61
- disabled: false,
62
- separator: true,
63
- groupDisabled: true,
64
- renderGroupTitle: 'groupTitle',
65
- contentVAlign: 'start'
66
- },
67
- {
68
- text: 'overflowX hidden',
69
- defaultShow: true,
70
- width: '12rem',
71
- overflowX: 'hidden',
72
- disabled: true,
73
- separator: false,
74
- groupDisabled: false,
75
- renderGroupTitle: undefined,
76
- contentVAlign: 'center'
77
- },
78
- {
79
- text: 'overflowX visible',
80
- defaultShow: true,
81
- width: '12rem',
82
- overflowX: 'visible',
83
- disabled: false,
84
- separator: false,
85
- groupDisabled: false,
86
- renderGroupTitle: undefined,
87
- contentVAlign: 'end'
88
- },
89
- // overflowY tests
90
- {
91
- text: 'overflowY auto',
92
- defaultShow: true,
93
- height: '20rem',
94
- overflowY: 'auto',
95
- disabled: false,
96
- separator: true,
97
- groupDisabled: true,
98
- renderGroupTitle: 'groupTitle',
99
- contentVAlign: 'start'
100
- },
101
- {
102
- text: 'overflowY hidden',
103
- defaultShow: true,
104
- height: '20rem',
105
- overflowY: 'hidden',
106
- disabled: true,
107
- separator: false,
108
- groupDisabled: false,
109
- renderGroupTitle: undefined,
110
- contentVAlign: 'center'
111
- },
112
- {
113
- text: 'overflowY visible',
114
- defaultShow: true,
115
- height: '20rem',
116
- overflowY: 'visible',
117
- disabled: false,
118
- separator: false,
119
- groupDisabled: false,
120
- renderGroupTitle: undefined,
121
- contentVAlign: 'end'
122
- },
123
- // tests for Drilldown.Page
124
- { page: 'pageWithSubpages' },
125
- { page: 'pageWithSubpages2' },
126
- // Popover version
127
- {
128
- text: 'with trigger',
129
- trigger: triggerButton,
130
- defaultShow: false,
131
- disabled: false
132
- },
133
- {
134
- text: 'with trigger disabled',
135
- trigger: triggerButton,
136
- defaultShow: false,
137
- disabled: true
138
- },
139
- {
140
- text: 'with trigger and defaultShow',
141
- trigger: triggerButton,
142
- defaultShow: true,
143
- disabled: false
144
- },
145
- {
146
- text: 'with trigger, defaultShow and disabled',
147
- trigger: triggerButton,
148
- defaultShow: true,
149
- disabled: true
150
- },
151
- {
152
- text: 'with trigger and withArrow',
153
- trigger: triggerButton,
154
- defaultShow: true,
155
- withArrow: true
156
- },
157
- {
158
- text: 'with trigger and withArrow="false"',
159
- trigger: triggerButton,
160
- defaultShow: true,
161
- withArrow: false
162
- },
163
- {
164
- text: 'with trigger and placement + offset',
165
- trigger: triggerButton,
166
- defaultShow: true,
167
- placement: 'end top',
168
- offsetX: 10,
169
- offsetY: -20,
170
- width: '20rem'
171
- },
172
- {
173
- text: 'with trigger and width + height',
174
- trigger: triggerButton,
175
- defaultShow: true,
176
- width: '20rem',
177
- height: '20rem'
178
- },
179
- {
180
- text: 'with display="block" container',
181
- trigger: (
182
- <button key={1} style={{ margin: '30px auto', width: '100%' }}>
183
- a drilldown trigger
184
- </button>
185
- ),
186
- defaultShow: false,
187
- width: '20rem',
188
- height: '20rem',
189
- positionContainerDisplay: 'block'
190
- }
191
- ]
192
- },
193
- getExampleProps(props) {
194
- return {
195
- height:
196
- props.customProps.defaultShow || !props.customProps.trigger
197
- ? '57rem'
198
- : '5rem',
199
- width: '38rem',
200
- padding: '0 0 0 small',
201
- withVisualDebug: true,
202
- position: 'relative'
203
- }
204
- },
205
- getComponentProps: (props) => {
206
- return {
207
- rootPageId: 'page0',
208
- children: generateDrilldownChildren(props, props.customProps.page),
209
- rotateFocus: true,
210
- overflowX: props.customProps.overflowX,
211
- overflowY: props.customProps.overflowY,
212
- shouldHideOnSelect: true,
213
- shouldFocusTriggerOnClose: true,
214
- shouldContainFocus: false,
215
- shouldReturnFocus: true,
216
- width: props.customProps.width,
217
- height: props.customProps.height,
218
- disabled: props.customProps.disabled,
219
- trigger: props.customProps.trigger,
220
- positionContainerDisplay: props.customProps.positionContainerDisplay,
221
- ...(props.customProps.trigger
222
- ? {
223
- defaultShow: props.customProps.defaultShow,
224
- withArrow: props.customProps.withArrow,
225
- placement: props.customProps.placement,
226
- offsetX: props.customProps.offsetX,
227
- offsetY: props.customProps.offsetY
228
- }
229
- : {
230
- defaultShow: false,
231
- withArrow: false,
232
- placement: 'bottom center',
233
- offsetX: 0,
234
- offsetY: 0
235
- })
236
- }
237
- }
238
- } as StoryConfig<DrilldownProps>
239
-
240
- function generateDrilldownChildren(
241
- props: Record<string, any>,
242
- variant: string
243
- ) {
244
- if (variant == 'pageWithSubpages') {
245
- return [
246
- <Drilldown.Page id="page0" key="page0" renderTitle="pageWithSubpages">
247
- <Drilldown.Option id="o1" subPageId="subpage">
248
- has subpage
249
- </Drilldown.Option>
250
- <Drilldown.Separator id="s1" />
251
- <Drilldown.Option id="o2">does not have subpage</Drilldown.Option>
252
- <Drilldown.Option id="o3" href="#">
253
- this is a link
254
- </Drilldown.Option>
255
- </Drilldown.Page>,
256
- <Drilldown.Page id="subpage" renderTitle="aaa" key={1}>
257
- <Drilldown.Option id="tmp">not shown</Drilldown.Option>
258
- </Drilldown.Page>
259
- ]
260
- } else if (variant == 'pageWithSubpages2') {
261
- return [
262
- <Drilldown.Page
263
- id="page0"
264
- key="page0"
265
- renderTitle="pageWithSubpages2"
266
- renderActionLabel="action label"
267
- withoutHeaderSeparator
268
- renderBackButtonLabel="go back"
269
- >
270
- <Drilldown.Option id="o1" subPageId="subpage">
271
- has subpage
272
- </Drilldown.Option>
273
- <Drilldown.Separator id="s1" />
274
- <Drilldown.Option id="o2">does not have subpage</Drilldown.Option>
275
- </Drilldown.Page>,
276
- <Drilldown.Page id="subpage" renderTitle="aaa" key={1}>
277
- <Drilldown.Option id="tmp">subpage option</Drilldown.Option>
278
- </Drilldown.Page>
279
- ]
280
- }
281
- return [
282
- <Drilldown.Page id="page0" key="page0">
283
- <Drilldown.Option id="otext">{props.customProps.text}</Drilldown.Option>
284
- <Drilldown.Option id="o">
285
- <div style={{ whiteSpace: 'nowrap' }}>
286
- this should be an option with very very super very very long label
287
- </div>
288
- </Drilldown.Option>
289
- <Drilldown.Group
290
- id="g1"
291
- disabled={props.customProps.groupDisabled}
292
- renderGroupTitle={props.customProps.renderGroupTitle}
293
- withoutSeparators={props.customProps.separator}
294
- selectableType="multiple"
295
- >
296
- <Drilldown.Option id="o2" renderLabelInfo="li" defaultSelected>
297
- defaultSelected
298
- </Drilldown.Option>
299
- <Drilldown.Option id="o3">minimal</Drilldown.Option>
300
- </Drilldown.Group>
301
- <Drilldown.Option id="o4" disabled>
302
- disabled
303
- </Drilldown.Option>
304
- <Drilldown.Option
305
- id="o5"
306
- renderBeforeLabel="be"
307
- renderAfterLabel="af"
308
- renderLabelInfo="li"
309
- >
310
- extra labels
311
- </Drilldown.Option>
312
- <Drilldown.Option
313
- id="o6"
314
- beforeLabelContentVAlign={props.customProps.contentVAlign}
315
- renderBeforeLabel="bef"
316
- afterLabelContentVAlign={props.customProps.contentVAlign}
317
- renderAfterLabel="after"
318
- >
319
- <br />
320
- valign settings
321
- <br />
322
- <br />
323
- </Drilldown.Option>
324
- <Drilldown.Option id="o7" description="the description">
325
- has description
326
- </Drilldown.Option>
327
- </Drilldown.Page>
328
- ]
329
- }
@@ -1,5 +0,0 @@
1
- import type { StoryConfig } from '@instructure/ui-test-utils';
2
- import type { DrilldownProps } from '../props';
3
- declare const _default: StoryConfig<DrilldownProps>;
4
- export default _default;
5
- //# sourceMappingURL=Drilldown.examples.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Drilldown.examples.d.ts","sourceRoot":"","sources":["../../../src/Drilldown/__examples__/Drilldown.examples.tsx"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAG7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;wBAkNzC,WAAW,CAAC,cAAc,CAAC;AAvMhC,wBAuMgC"}