@khanacademy/wonder-blocks-form 3.1.11 → 3.1.13

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 (66) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/components/checkbox-core.d.ts +16 -0
  3. package/dist/components/checkbox-core.js.flow +26 -0
  4. package/dist/components/checkbox-group.d.ts +84 -0
  5. package/dist/components/checkbox-group.js.flow +103 -0
  6. package/dist/components/checkbox.d.ts +83 -0
  7. package/dist/components/checkbox.js.flow +106 -0
  8. package/dist/components/choice-internal.d.ts +63 -0
  9. package/dist/components/choice-internal.js.flow +100 -0
  10. package/dist/components/choice.d.ts +127 -0
  11. package/dist/components/choice.js.flow +161 -0
  12. package/dist/components/field-heading.d.ts +50 -0
  13. package/dist/components/field-heading.js.flow +64 -0
  14. package/dist/components/group-styles.d.ts +3 -0
  15. package/dist/components/group-styles.js.flow +10 -0
  16. package/dist/components/labeled-text-field.d.ts +169 -0
  17. package/dist/components/labeled-text-field.js.flow +211 -0
  18. package/dist/components/radio-core.d.ts +15 -0
  19. package/dist/components/radio-core.js.flow +26 -0
  20. package/dist/components/radio-group.d.ts +85 -0
  21. package/dist/components/radio-group.js.flow +104 -0
  22. package/dist/components/radio.d.ts +68 -0
  23. package/dist/components/radio.js.flow +92 -0
  24. package/dist/components/text-field.d.ts +146 -0
  25. package/dist/components/text-field.js.flow +186 -0
  26. package/dist/es/index.js +258 -224
  27. package/dist/index.d.ts +7 -0
  28. package/dist/index.js +281 -249
  29. package/dist/index.js.flow +21 -2
  30. package/dist/util/types.d.ts +62 -0
  31. package/dist/util/types.js.flow +138 -0
  32. package/package.json +10 -10
  33. package/src/__tests__/{custom-snapshot.test.js → custom-snapshot.test.tsx} +8 -9
  34. package/src/components/__tests__/{checkbox-group.test.js → checkbox-group.test.tsx} +5 -5
  35. package/src/components/__tests__/{field-heading.test.js → field-heading.test.tsx} +0 -1
  36. package/src/components/__tests__/{labeled-text-field.test.js → labeled-text-field.test.tsx} +4 -5
  37. package/src/components/__tests__/{radio-group.test.js → radio-group.test.tsx} +8 -8
  38. package/src/components/__tests__/{text-field.test.js → text-field.test.tsx} +22 -18
  39. package/src/components/{checkbox-core.js → checkbox-core.tsx} +12 -15
  40. package/src/components/{checkbox-group.js → checkbox-group.tsx} +20 -23
  41. package/src/components/{checkbox.js → checkbox.tsx} +18 -32
  42. package/src/components/{choice-internal.js → choice-internal.tsx} +25 -39
  43. package/src/components/{choice.js → choice.tsx} +24 -37
  44. package/src/components/{field-heading.js → field-heading.tsx} +16 -23
  45. package/src/components/{group-styles.js → group-styles.ts} +0 -1
  46. package/src/components/{labeled-text-field.js → labeled-text-field.tsx} +54 -69
  47. package/src/components/{radio-core.js → radio-core.tsx} +13 -16
  48. package/src/components/{radio-group.js → radio-group.tsx} +20 -23
  49. package/src/components/{radio.js → radio.tsx} +18 -32
  50. package/src/components/{text-field.js → text-field.tsx} +53 -64
  51. package/src/{index.js → index.ts} +0 -1
  52. package/src/util/{types.js → types.ts} +32 -35
  53. package/tsconfig.json +19 -0
  54. package/tsconfig.tsbuildinfo +1 -0
  55. package/src/__docs__/_overview_.stories.mdx +0 -15
  56. package/src/components/__docs__/checkbox-accessibility.stories.mdx +0 -147
  57. package/src/components/__docs__/checkbox-group.stories.js +0 -300
  58. package/src/components/__docs__/checkbox.stories.js +0 -167
  59. package/src/components/__docs__/choice.stories.js +0 -86
  60. package/src/components/__docs__/labeled-text-field.argtypes.js +0 -248
  61. package/src/components/__docs__/labeled-text-field.stories.js +0 -709
  62. package/src/components/__docs__/radio-group.stories.js +0 -217
  63. package/src/components/__docs__/radio.stories.js +0 -161
  64. package/src/components/__docs__/text-field.argtypes.js +0 -206
  65. package/src/components/__docs__/text-field.stories.js +0 -780
  66. /package/src/__tests__/__snapshots__/{custom-snapshot.test.js.snap → custom-snapshot.test.tsx.snap} +0 -0
@@ -1,248 +0,0 @@
1
- // @flow
2
-
3
- export default {
4
- id: {
5
- description: `An optional unique identifier for the TextField.
6
- If no id is specified, a unique id will be auto-generated.`,
7
- table: {
8
- type: {
9
- summary: "string",
10
- },
11
- },
12
- control: {
13
- type: "text",
14
- },
15
- },
16
- type: {
17
- description:
18
- "Determines the type of input. Defaults to text. This may change the appearance or type of characters allowed.",
19
- table: {
20
- type: {
21
- summary: `"text" | "password" | "email" | "number" | "tel"`,
22
- },
23
- defaultValue: {
24
- summary: "text",
25
- },
26
- },
27
- options: ["text", "password", "email", "number", "tel"],
28
- control: {
29
- type: "select",
30
- },
31
- },
32
- label: {
33
- description: "Provide a label for the TextField.",
34
- type: {required: true},
35
- table: {
36
- type: {
37
- summary: "React.Node",
38
- },
39
- },
40
- control: {
41
- type: "text",
42
- },
43
- },
44
- description: {
45
- description: "Provide a description for the TextField.",
46
- table: {
47
- type: {
48
- summary: "React.Node",
49
- },
50
- },
51
- control: {
52
- type: "text",
53
- },
54
- },
55
- value: {
56
- description: "The input value.",
57
- type: {required: true},
58
- table: {
59
- type: {
60
- summary: "string",
61
- },
62
- },
63
- control: {
64
- type: "text",
65
- },
66
- },
67
- autoComplete: {
68
- description: "Specifies if the TextField allows autocomplete.",
69
- table: {
70
- type: {
71
- summary: "string",
72
- detail: `There is a large number of options, including "on", "off", "username", "current-password", and many others.`,
73
- },
74
- },
75
- control: {
76
- type: "text",
77
- },
78
- },
79
- disabled: {
80
- description: "Makes a read-only input field that cannot be focused.",
81
- table: {
82
- type: {
83
- summary: "boolean",
84
- },
85
- defaultValue: {
86
- summary: "false",
87
- },
88
- },
89
- control: {
90
- type: "boolean",
91
- },
92
- },
93
- light: {
94
- description:
95
- "Change the field’s sub-components to fit a dark background.",
96
- table: {
97
- type: {
98
- summary: "boolean",
99
- },
100
- defaultValue: {
101
- summary: "false",
102
- },
103
- },
104
- control: {
105
- type: "boolean",
106
- },
107
- },
108
- placeholder: {
109
- description: "Provide hints or examples of what to enter.",
110
- table: {
111
- type: {
112
- summary: "string",
113
- },
114
- },
115
- control: {
116
- type: "text",
117
- },
118
- },
119
- required: {
120
- description:
121
- "Whether this field is required to to continue, or the error message to render if this field is left blank. Pass in a message instead of `true` if possible.",
122
- table: {
123
- type: {
124
- summary: "boolean | string",
125
- detail: "The string will not be used if a `validate` prop is passed in.",
126
- },
127
- },
128
- control: {
129
- type: "boolean",
130
- },
131
- },
132
- readOnly: {
133
- description: "Specifies if the TextField is read-only.",
134
- table: {
135
- type: {
136
- summary: "boolean",
137
- },
138
- },
139
- control: {
140
- type: "boolean",
141
- },
142
- },
143
- style: {
144
- description: "Custom styles for the input.",
145
- table: {
146
- type: {
147
- summary: "StyleType",
148
- },
149
- },
150
- },
151
- testId: {
152
- description: "Optional test ID for e2e testing.",
153
- table: {
154
- type: {
155
- summary: "string",
156
- },
157
- },
158
- control: {
159
- type: "text",
160
- },
161
- },
162
- validate: {
163
- description:
164
- "Provide a validation for the input value. Return a string error message or null | void for a valid input.",
165
- table: {
166
- type: {
167
- summary: "(value: string) => ?string",
168
- },
169
- },
170
- control: {
171
- type: "null",
172
- },
173
- },
174
-
175
- /**
176
- * Accessibility
177
- */
178
- ariaDescribedby: {
179
- description:
180
- "Identifies the element or elements that describes this text field.",
181
- table: {
182
- category: "Accessibility",
183
- type: {
184
- summary: "string | Array<string>",
185
- },
186
- },
187
- control: {
188
- type: "text",
189
- },
190
- },
191
-
192
- /**
193
- * Events
194
- */
195
- onValidate: {
196
- description: "Called when the TextField input is validated.",
197
- table: {
198
- category: "Events",
199
- type: {
200
- summary: "(errorMessage: ?string) => mixed",
201
- },
202
- },
203
- },
204
- onChange: {
205
- description:
206
- "Called when the value has changed. Use this in conjunction with the `value` prop to update the string rendered in the input field.",
207
- type: {required: true},
208
- table: {
209
- category: "Events",
210
- type: {
211
- summary: "(newValue: string) => mixed",
212
- },
213
- },
214
- },
215
- onKeyDown: {
216
- action: "keyDown",
217
- description: "Called when a key is pressed.",
218
- table: {
219
- category: "Events",
220
- type: {
221
- summary:
222
- "(event: SyntheticKeyboardEvent<HTMLInputElement>) => mixed",
223
- },
224
- },
225
- },
226
- onFocus: {
227
- action: "focus",
228
- description: "Called when the element has been focused.",
229
- table: {
230
- category: "Events",
231
- type: {
232
- summary:
233
- "(event: SyntheticFocusEvent<HTMLInputElement>) => mixed",
234
- },
235
- },
236
- },
237
- onBlur: {
238
- action: "blur",
239
- description: "Called when the element has been blurred.",
240
- table: {
241
- category: "Events",
242
- type: {
243
- summary:
244
- "(event: SyntheticFocusEvent<HTMLInputElement>) => mixed",
245
- },
246
- },
247
- },
248
- };