@dhis2-ui/select 8.14.9 → 8.15.0-alpha.1

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