@dhis2-ui/switch 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.
- package/package.json +6 -9
- package/types/index.d.ts +0 -161
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dhis2-ui/switch",
|
|
3
|
-
"version": "8.16.0
|
|
3
|
+
"version": "8.16.0",
|
|
4
4
|
"description": "UI Switch",
|
|
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
|
},
|
|
@@ -33,20 +32,18 @@
|
|
|
33
32
|
},
|
|
34
33
|
"dependencies": {
|
|
35
34
|
"@dhis2/prop-types": "^3.1.2",
|
|
36
|
-
"@dhis2-ui/field": "8.16.0
|
|
37
|
-
"@dhis2-ui/required": "8.16.0
|
|
38
|
-
"@dhis2/ui-constants": "8.16.0
|
|
35
|
+
"@dhis2-ui/field": "8.16.0",
|
|
36
|
+
"@dhis2-ui/required": "8.16.0",
|
|
37
|
+
"@dhis2/ui-constants": "8.16.0",
|
|
39
38
|
"classnames": "^2.3.1",
|
|
40
39
|
"prop-types": "^15.7.2"
|
|
41
40
|
},
|
|
42
41
|
"files": [
|
|
43
|
-
"build"
|
|
44
|
-
"types"
|
|
42
|
+
"build"
|
|
45
43
|
],
|
|
46
44
|
"devDependencies": {
|
|
47
45
|
"react": "16.13",
|
|
48
46
|
"react-dom": "16.13",
|
|
49
47
|
"styled-jsx": "^4.0.1"
|
|
50
|
-
}
|
|
51
|
-
"types": "types"
|
|
48
|
+
}
|
|
52
49
|
}
|
package/types/index.d.ts
DELETED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
import * as React from 'react'
|
|
2
|
-
|
|
3
|
-
export interface SwitchEventPayload {
|
|
4
|
-
value?: string
|
|
5
|
-
name?: string
|
|
6
|
-
checked: boolean
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
type SwitchEventHandler<Event extends React.SyntheticEvent> = (
|
|
10
|
-
arg0: SwitchEventPayload,
|
|
11
|
-
event: Event
|
|
12
|
-
) => void
|
|
13
|
-
|
|
14
|
-
type SwitchFocusHandler = SwitchEventHandler<React.FocusEvent<HTMLInputElement>>
|
|
15
|
-
type SwitchChangeHandler = SwitchEventHandler<
|
|
16
|
-
React.ChangeEvent<HTMLInputElement>
|
|
17
|
-
>
|
|
18
|
-
type SwitchKeyHandler = SwitchEventHandler<
|
|
19
|
-
React.KeyboardEvent<HTMLInputElement>
|
|
20
|
-
>
|
|
21
|
-
|
|
22
|
-
export interface SwitchProps {
|
|
23
|
-
/**
|
|
24
|
-
* Sets an aria-label attribute on the input
|
|
25
|
-
*/
|
|
26
|
-
ariaLabel?: string
|
|
27
|
-
checked?: boolean
|
|
28
|
-
className?: string
|
|
29
|
-
dataTest?: string
|
|
30
|
-
/**
|
|
31
|
-
* Makes the switch smaller for information-dense layouts
|
|
32
|
-
*/
|
|
33
|
-
dense?: boolean
|
|
34
|
-
/**
|
|
35
|
-
* Disables the switch
|
|
36
|
-
*/
|
|
37
|
-
disabled?: boolean
|
|
38
|
-
/**
|
|
39
|
-
* Applies 'error' styles for validation feedback. Mutually exclusive with `valid` and `warning` prop types
|
|
40
|
-
*/
|
|
41
|
-
error?: boolean
|
|
42
|
-
/**
|
|
43
|
-
* Grab initial focus on the page
|
|
44
|
-
*/
|
|
45
|
-
initialFocus?: boolean
|
|
46
|
-
/**
|
|
47
|
-
* Label for the switch. Can be a string or an element, for example an image
|
|
48
|
-
*/
|
|
49
|
-
label?: React.ReactNode
|
|
50
|
-
/**
|
|
51
|
-
* Name associated with the switch. Passed to event handlers in object
|
|
52
|
-
*/
|
|
53
|
-
name?: string
|
|
54
|
-
/**
|
|
55
|
-
* Sets a role attribute on the input
|
|
56
|
-
*/
|
|
57
|
-
role?: string
|
|
58
|
-
tabIndex?: string
|
|
59
|
-
/**
|
|
60
|
-
* Applies 'valid' styles for validation feedback. Mutually exclusive with `error` and `warning` prop types
|
|
61
|
-
*/
|
|
62
|
-
valid?: boolean
|
|
63
|
-
/**
|
|
64
|
-
* Value associated with the switch. Passed to event handlers in object
|
|
65
|
-
*/
|
|
66
|
-
value?: string
|
|
67
|
-
/**
|
|
68
|
-
* Applies 'warning' styles for validation feedback. Mutually exclusive with `valid` and `error` prop types
|
|
69
|
-
*/
|
|
70
|
-
warning?: boolean
|
|
71
|
-
/**
|
|
72
|
-
* Called with signature `({ name: string, value: string, checked: bool }, event)`
|
|
73
|
-
*/
|
|
74
|
-
onBlur?: SwitchFocusHandler
|
|
75
|
-
/**
|
|
76
|
-
* Called with signature `({ name: string, value: string, checked: bool }, event)`
|
|
77
|
-
*/
|
|
78
|
-
onChange?: SwitchChangeHandler
|
|
79
|
-
/**
|
|
80
|
-
* Called with signature `({ name: string, value: string, checked: bool }, event)`
|
|
81
|
-
*/
|
|
82
|
-
onFocus?: SwitchFocusHandler
|
|
83
|
-
/**
|
|
84
|
-
* Called with signature `({ name: string, value: string, checked: bool }, event)`
|
|
85
|
-
*/
|
|
86
|
-
onKeyDown?: SwitchKeyHandler
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export class Switch extends React.Component<SwitchProps, any> {
|
|
90
|
-
render(): JSX.Element
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export interface SwitchFieldProps {
|
|
94
|
-
checked?: boolean
|
|
95
|
-
className?: string
|
|
96
|
-
dataTest?: string
|
|
97
|
-
/**
|
|
98
|
-
* Smaller dimensions for information-dense layouts
|
|
99
|
-
*/
|
|
100
|
-
dense?: boolean
|
|
101
|
-
/**
|
|
102
|
-
* Disables the switch
|
|
103
|
-
*/
|
|
104
|
-
disabled?: boolean
|
|
105
|
-
/**
|
|
106
|
-
* Applies 'error' styling to switch and validation text for feedback. Mutually exclusive with `warning` and `valid` props
|
|
107
|
-
*/
|
|
108
|
-
error?: boolean
|
|
109
|
-
/**
|
|
110
|
-
* Useful instructions for the user
|
|
111
|
-
*/
|
|
112
|
-
helpText?: string
|
|
113
|
-
initialFocus?: boolean
|
|
114
|
-
/**
|
|
115
|
-
* Labels the switch
|
|
116
|
-
*/
|
|
117
|
-
label?: React.ReactNode
|
|
118
|
-
/**
|
|
119
|
-
* Name associate with the switch. Passed in object as argument to event handlers
|
|
120
|
-
*/
|
|
121
|
-
name?: string
|
|
122
|
-
/**
|
|
123
|
-
* Adds an asterisk to indicate this field is required
|
|
124
|
-
*/
|
|
125
|
-
required?: boolean
|
|
126
|
-
tabIndex?: string
|
|
127
|
-
/**
|
|
128
|
-
* Applies 'valid' styling to switch and validation text for feedback. Mutually exclusive with `warning` and `error` props
|
|
129
|
-
*/
|
|
130
|
-
valid?: boolean
|
|
131
|
-
/**
|
|
132
|
-
* Adds text below the switch to provide validation feedback. Acquires styles from `valid`, `warning` and `error` statuses
|
|
133
|
-
*/
|
|
134
|
-
validationText?: string
|
|
135
|
-
/**
|
|
136
|
-
* Value associated with the switch. Passed in object as argument to event handlers
|
|
137
|
-
*/
|
|
138
|
-
value?: string
|
|
139
|
-
/**
|
|
140
|
-
* Applies 'warning' styling to switch and validation text for feedback. Mutually exclusive with `valid` and `error` props
|
|
141
|
-
*/
|
|
142
|
-
warning?: boolean
|
|
143
|
-
/**
|
|
144
|
-
* Called with signature ({ name: string, value: string, checked: bool }, event)
|
|
145
|
-
*/
|
|
146
|
-
onBlur?: SwitchFocusHandler
|
|
147
|
-
/**
|
|
148
|
-
* Called with signature ({ name: string, value: string, checked: bool }, event)
|
|
149
|
-
*/
|
|
150
|
-
onChange?: SwitchChangeHandler
|
|
151
|
-
/**
|
|
152
|
-
* Called with signature ({ name: string, value: string, checked: bool }, event)
|
|
153
|
-
*/
|
|
154
|
-
onFocus?: SwitchFocusHandler
|
|
155
|
-
/**
|
|
156
|
-
* Called with signature ({ name: string, value: string, checked: bool }, event)
|
|
157
|
-
*/
|
|
158
|
-
onKeyDown?: SwitchKeyHandler
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
export const SwitchField: React.FC<SwitchFieldProps>
|