@dhis2-ui/select 8.16.0-alpha.2 → 8.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +16 -19
  2. package/types/index.d.ts +0 -415
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhis2-ui/select",
3
- "version": "8.16.0-alpha.2",
3
+ "version": "8.16.0",
4
4
  "description": "UI Select",
5
5
  "repository": {
6
6
  "type": "git",
@@ -13,7 +13,6 @@
13
13
  "main": "./build/cjs/index.js",
14
14
  "module": "./build/es/index.js",
15
15
  "exports": {
16
- "types": "./types/index.d.ts",
17
16
  "import": "./build/es/index.js",
18
17
  "require": "./build/cjs/index.js"
19
18
  },
@@ -34,31 +33,29 @@
34
33
  },
35
34
  "dependencies": {
36
35
  "@dhis2/prop-types": "^3.1.2",
37
- "@dhis2-ui/box": "8.16.0-alpha.2",
38
- "@dhis2-ui/button": "8.16.0-alpha.2",
39
- "@dhis2-ui/card": "8.16.0-alpha.2",
40
- "@dhis2-ui/checkbox": "8.16.0-alpha.2",
41
- "@dhis2-ui/chip": "8.16.0-alpha.2",
42
- "@dhis2-ui/field": "8.16.0-alpha.2",
43
- "@dhis2-ui/input": "8.16.0-alpha.2",
44
- "@dhis2-ui/layer": "8.16.0-alpha.2",
45
- "@dhis2-ui/loader": "8.16.0-alpha.2",
46
- "@dhis2-ui/popper": "8.16.0-alpha.2",
47
- "@dhis2-ui/status-icon": "8.16.0-alpha.2",
48
- "@dhis2/ui-constants": "8.16.0-alpha.2",
49
- "@dhis2/ui-icons": "8.16.0-alpha.2",
36
+ "@dhis2-ui/box": "8.16.0",
37
+ "@dhis2-ui/button": "8.16.0",
38
+ "@dhis2-ui/card": "8.16.0",
39
+ "@dhis2-ui/checkbox": "8.16.0",
40
+ "@dhis2-ui/chip": "8.16.0",
41
+ "@dhis2-ui/field": "8.16.0",
42
+ "@dhis2-ui/input": "8.16.0",
43
+ "@dhis2-ui/layer": "8.16.0",
44
+ "@dhis2-ui/loader": "8.16.0",
45
+ "@dhis2-ui/popper": "8.16.0",
46
+ "@dhis2-ui/status-icon": "8.16.0",
47
+ "@dhis2/ui-constants": "8.16.0",
48
+ "@dhis2/ui-icons": "8.16.0",
50
49
  "classnames": "^2.3.1",
51
50
  "prop-types": "^15.7.2"
52
51
  },
53
52
  "files": [
54
- "build",
55
- "types"
53
+ "build"
56
54
  ],
57
55
  "devDependencies": {
58
56
  "@dhis2/d2-i18n": "^1.1.0",
59
57
  "react": "16.13",
60
58
  "react-dom": "16.13",
61
59
  "styled-jsx": "^4.0.1"
62
- },
63
- "types": "types"
60
+ }
64
61
  }
package/types/index.d.ts DELETED
@@ -1,415 +0,0 @@
1
- import * as React from 'react'
2
- import { LayerBackdropClickEvent } from '@dhis2-ui/layer'
3
- import { CheckboxProps } from '@dhis2-ui/checkbox'
4
-
5
- interface BaseEventPayload {
6
- selected: string | string[]
7
- }
8
-
9
- export interface SingleSelectEventPayload extends BaseEventPayload {
10
- selected: string
11
- }
12
-
13
- export interface MultiSelectEventPayload extends BaseEventPayload {
14
- selected: string[]
15
- }
16
-
17
- type SelectEventHandler<
18
- T extends BaseEventPayload,
19
- Event extends React.SyntheticEvent
20
- > = (payload: T, event: Event) => void
21
-
22
- export type SelectOnBlurHandler<T extends BaseEventPayload> =
23
- SelectEventHandler<T, LayerBackdropClickEvent>
24
- export type SelectOnFocusHandler<T extends BaseEventPayload> =
25
- SelectEventHandler<T, React.FocusEvent<HTMLDivElement>>
26
- export type SelectKeyHandler<T extends BaseEventPayload> = SelectEventHandler<
27
- T,
28
- React.KeyboardEvent<HTMLDivElement>
29
- >
30
- export type SelectChangeHandler<T extends BaseEventPayload> =
31
- SelectEventHandler<T, React.MouseEvent>
32
-
33
- export interface MultiSelectProps {
34
- children?: React.ReactNode
35
- className?: string
36
- /**
37
- * Required if `clearable` prop is `true`
38
- */
39
- clearText?: string
40
- /**
41
- * Adds a 'clear' option to the menu
42
- */
43
- clearable?: boolean
44
- dataTest?: string
45
- dense?: boolean
46
- disabled?: boolean
47
- empty?: React.ReactNode
48
- error?: boolean
49
- filterPlaceholder?: string
50
- /**
51
- * Adds a 'filter' field to the menu
52
- */
53
- filterable?: boolean
54
- initialFocus?: boolean
55
- inputMaxHeight?: string
56
- loading?: boolean
57
- loadingText?: string
58
- maxHeight?: string
59
- /**
60
- * Required if `filterable` prop is `true`
61
- */
62
- noMatchText?: string
63
- placeholder?: string
64
- prefix?: string
65
- selected?: string[]
66
- tabIndex?: string
67
- valid?: boolean
68
- warning?: boolean
69
- onBlur?: SelectOnBlurHandler<MultiSelectEventPayload>
70
- onChange?: SelectChangeHandler<MultiSelectEventPayload>
71
- onFocus?: SelectOnFocusHandler<MultiSelectEventPayload>
72
- onKeyDown?: SelectKeyHandler<MultiSelectEventPayload>
73
- }
74
-
75
- export const MultiSelect: React.FC<MultiSelectProps>
76
-
77
- type TranslateableProp = string | ((interpolationObject: any) => string)
78
-
79
- export interface MultiSelectFieldProps {
80
- /**
81
- * Should be `MultiSelectOption` components
82
- */
83
- children?: React.ReactNode
84
- className?: string
85
- /**
86
- * Label for the button that clears selections
87
- */
88
- clearText?: TranslateableProp
89
- /**
90
- * Adds a button to the MultiSelect that clears selections when pressed
91
- */
92
- clearable?: boolean
93
- dataTest?: string
94
- /**
95
- * Makes the MultiSelect smaller
96
- */
97
- dense?: boolean
98
- /**
99
- * Disables the MultiSelect
100
- */
101
- disabled?: boolean
102
- /**
103
- * Text to display when there are no options
104
- */
105
- empty?: TranslateableProp | React.ReactNode
106
- /**
107
- * Adds 'error' appearance for validation feedback. Mutually exclusive with 'valid' and 'warning' props
108
- */
109
- error?: boolean
110
- /**
111
- * Placeholder text to show in the filter field when it is empty
112
- */
113
- filterPlaceholder?: TranslateableProp | React.ReactNode
114
- /**
115
- * Adds a field to filter options
116
- */
117
- filterable?: boolean
118
- /**
119
- * Useful guiding text to display below the MultiSelect
120
- */
121
- helpText?: string
122
- /**
123
- * Grabs initial focus on the page
124
- */
125
- initialFocus?: boolean
126
- /**
127
- * Constrains the height of the input
128
- */
129
- inputMaxHeight?: string
130
- /**
131
- * Sets the width of the input. Can be any valid CSS measurement
132
- */
133
- inputWidth?: string
134
- /**
135
- * Text for the label above the MultiSelect
136
- */
137
- label?: string
138
- /**
139
- * Applies a loading appearance to the dropdown options
140
- */
141
- loading?: boolean
142
- /**
143
- * Text to display when `loading` is true
144
- */
145
- loadingText?: TranslateableProp
146
- /**
147
- * Constrains height of the MultiSelect
148
- */
149
- maxHeight?: string
150
- /**
151
- * Text to display when there are no filter results
152
- */
153
- noMatchText?: TranslateableProp
154
- /**
155
- * Placeholder text when the MultiSelect is empty
156
- */
157
- placeholder?: string
158
- /**
159
- * Leading text to prefix selections
160
- */
161
- prefix?: string
162
- /**
163
- * Indicates that a selection is required
164
- */
165
- required?: boolean
166
- /**
167
- * Selected items in the MultiSelect (each string should refer to the item's `value` attribute)
168
- */
169
- selected?: string[]
170
- tabIndex?: string
171
- /**
172
- * Adds 'valid' appearance for validation feedback. Mutually exclusive with 'error' and 'warning' props
173
- */
174
- valid?: boolean
175
- /**
176
- * Text to provide form validation feedback. Receives styles according to validation status
177
- */
178
- validationText?: string
179
- /**
180
- * Adds 'warning' appearance for validation feedback. Mutually exclusive with 'valid' and 'error' props
181
- */
182
- warning?: boolean
183
- /**
184
- * Called with signature `({ selected: [String] }, event)`
185
- */
186
- onBlur?: MultiSelectProps['onBlur']
187
- /**
188
- * Called with signature `({ selected: [String] }, event)`
189
- */
190
- onChange?: MultiSelectProps['onChange']
191
- /**
192
- * Called with signature `({ selected: [String] }, event)`
193
- */
194
- onFocus?: MultiSelectProps['onFocus']
195
- /**
196
- * Called with signature `({ selected: [String] }, event)`
197
- */
198
- onKeyDown?: MultiSelectProps['onKeyDown']
199
- }
200
-
201
- export class MultiSelectField extends React.Component<
202
- MultiSelectFieldProps,
203
- any
204
- > {
205
- render(): JSX.Element
206
- }
207
-
208
- export interface MultiSelectOptionProps {
209
- label: string
210
- value: string
211
- active?: boolean
212
- className?: string
213
- dataTest?: string
214
- disabled?: boolean
215
- onClick?: CheckboxProps['onChange']
216
- }
217
-
218
- export const MultiSelectOption: React.FC<MultiSelectOptionProps>
219
-
220
- export interface SingleSelectProps {
221
- children?: React.ReactNode
222
- className?: string
223
- /**
224
- * Text on button that clears selection. Required if `clearable` prop is true
225
- */
226
- clearText?: string
227
- /**
228
- * Adds a button to clear selection
229
- */
230
- clearable?: boolean
231
- dataTest?: string
232
- dense?: boolean
233
- disabled?: boolean
234
- /**
235
- * Text or component to display when there are no options
236
- */
237
- empty?: React.ReactNode
238
- /**
239
- * Applies 'error' appearance for validation feedback. Mutually exclusive with `warning` and `valid` props
240
- */
241
- error?: boolean
242
- filterPlaceholder?: string
243
- /**
244
- * Adds a filter field to add text to filter options
245
- */
246
- filterable?: boolean
247
- initialFocus?: boolean
248
- inputMaxHeight?: string
249
- loading?: boolean
250
- loadingText?: string
251
- maxHeight?: string
252
- /**
253
- * Text to show when filter returns no results. Required if `filterable` prop is true
254
- */
255
- noMatchText?: string
256
- placeholder?: string
257
- prefix?: string
258
- selected?: string
259
- tabIndex?: string
260
- /**
261
- * Applies 'valid' appearance for validation feedback. Mutually exclusive with `warning` and `error` props
262
- */
263
- valid?: boolean
264
- /**
265
- * Applies 'warning' appearance for validation feedback. Mutually exclusive with `valid` and `error` props
266
- */
267
- warning?: boolean
268
- onBlur?: SelectOnBlurHandler<SingleSelectEventPayload>
269
- onChange?: SelectChangeHandler<SingleSelectEventPayload>
270
- onFocus?: SelectOnFocusHandler<SingleSelectEventPayload>
271
- onKeyDown?: SelectKeyHandler<SingleSelectEventPayload>
272
- }
273
-
274
- export const SingleSelect: React.FC<SingleSelectProps>
275
-
276
- export interface SingleSelectFieldProps {
277
- /**
278
- * Should be `SingleSelectOption` components
279
- */
280
- children?: React.ReactNode
281
- className?: string
282
- /**
283
- * Label for the button that clears selections
284
- */
285
- clearText?: TranslateableProp
286
- /**
287
- * Adds a button to the SingleSelect that clears selections when pressed
288
- */
289
- clearable?: boolean
290
- dataTest?: string
291
- /**
292
- * Makes the SingleSelect smaller
293
- */
294
- dense?: boolean
295
- /**
296
- * Disables the SingleSelect
297
- */
298
- disabled?: boolean
299
- /**
300
- * Text to display when there are no options
301
- */
302
- empty?: TranslateableProp | React.ReactNode
303
- /**
304
- * Adds 'error' appearance for validation feedback. Mutually exclusive with 'valid' and 'warning' props
305
- */
306
- error?: boolean
307
- /**
308
- * Placeholder text to show in the filter field when it is empty
309
- */
310
- filterPlaceholder?: TranslateableProp | React.ReactNode
311
- /**
312
- * Adds a field to filter options
313
- */
314
- filterable?: boolean
315
- /**
316
- * Useful guiding text to display below the SingleSelect
317
- */
318
- helpText?: string
319
- /**
320
- * Grabs initial focus on the page
321
- */
322
- initialFocus?: boolean
323
- /**
324
- * Constrains the height of the input
325
- */
326
- inputMaxHeight?: string
327
- /**
328
- * Sets the width of the input. Can be any valid CSS measurement
329
- */
330
- inputWidth?: string
331
- /**
332
- * Text for the label above the SingleSelect
333
- */
334
- label?: string
335
- /**
336
- * Applies a loading appearance to the dropdown options
337
- */
338
- loading?: boolean
339
- /**
340
- * Text to display when `loading` is true
341
- */
342
- loadingText?: TranslateableProp
343
- /**
344
- * Constrains height of the SingleSelect
345
- */
346
- maxHeight?: string
347
- /**
348
- * Text to display when there are no filter results
349
- */
350
- noMatchText?: TranslateableProp
351
- /**
352
- * Placeholder text when the SingleSelect is empty
353
- */
354
- placeholder?: string
355
- /**
356
- * Leading text to prefix selections
357
- */
358
- prefix?: string
359
- /**
360
- * Indicates that a selection is required
361
- */
362
- required?: boolean
363
- /**
364
- * Selected item in the SingleSelect (the string should refer to the item's `value` attribute)
365
- */
366
- selected?: string
367
- tabIndex?: string
368
- /**
369
- * Adds 'valid' appearance for validation feedback. Mutually exclusive with 'error' and 'warning' props
370
- */
371
- valid?: boolean
372
- /**
373
- * Text to provide form validation feedback. Receives styles according to validation status
374
- */
375
- validationText?: string
376
- /**
377
- * Adds 'warning' appearance for validation feedback. Mutually exclusive with 'valid' and 'error' props
378
- */
379
- warning?: boolean
380
- /**
381
- * Called with signature `({ selected: string }, event)`
382
- */
383
- onBlur?: SingleSelectProps['onBlur']
384
- /**
385
- * Called with signature `({ selected: string }, event)`
386
- */
387
- onChange?: SingleSelectProps['onChange']
388
- /**
389
- * Called with signature `({ selected: string }, event)`
390
- */
391
- onFocus?: SingleSelectProps['onFocus']
392
- /**
393
- * Called with signature `({ selected: string }, event)`
394
- */
395
- onKeyDown?: SingleSelectProps['onKeyDown']
396
- }
397
-
398
- export class SingleSelectField extends React.Component<
399
- SingleSelectFieldProps,
400
- any
401
- > {
402
- render(): JSX.Element
403
- }
404
-
405
- export interface SingleSelectOptionProps {
406
- label: string
407
- value: string
408
- active?: boolean
409
- className?: string
410
- dataTest?: string
411
- disabled?: boolean
412
- onClick?: (arg0: {}, event: React.MouseEvent<HTMLDivElement>) => void
413
- }
414
-
415
- export const SingleSelectOption: React.FC<SingleSelectOptionProps>