@valiantys/atlassian-app-frontend 3.0.0-alpha-18 → 3.0.0-alpha-19
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/atlassian/shared/frontend-ui-atlaskit-forms/src/lib/option/index.cjs.js +1 -0
- package/atlassian/shared/frontend-ui-atlaskit-forms/src/lib/option/index.es.js +8 -0
- package/package.json +6 -1
- package/ui-atlaskit-forms/atlassian-app-frontend-ui-atlaskit-forms.api.json +341 -0
- package/ui-atlaskit-forms/atlassian-app-frontend.api.md +19 -0
- package/ui-atlaskit-forms/index.cjs.js +1 -0
- package/ui-atlaskit-forms/index.d.ts +48 -0
- package/ui-atlaskit-forms/index.es.js +4 -0
- package/ui-atlaskit-forms/tsdoc-metadata.json +11 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function d(l,t,i,o=(e,n)=>e===n){console.log(l,t);let e;return t?(e=l.find(n=>o(n.value,t)),e||(console.log("setting undefined"),i(void 0))):l.length===1&&(e=l[0],console.log("setting ",e.value),i(e.value)),e||null}exports.getSelectedOption=d;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
function d(l, n, o, t = (e, i) => e === i) {
|
|
2
|
+
console.log(l, n);
|
|
3
|
+
let e;
|
|
4
|
+
return n ? (e = l.find((i) => t(i.value, n)), e || (console.log("setting undefined"), o(void 0))) : l.length === 1 && (e = l[0], console.log("setting ", e.value), o(e.value)), e || null;
|
|
5
|
+
}
|
|
6
|
+
export {
|
|
7
|
+
d as getSelectedOption
|
|
8
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@valiantys/atlassian-app-frontend",
|
|
3
|
-
"version": "3.0.0-alpha-
|
|
3
|
+
"version": "3.0.0-alpha-19",
|
|
4
4
|
"description": "This library provides an Atlassian Forge Custom UI wrapper component that handles all the setup necessary to support an app that can run deployed or in standalone mode",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./atlassian-app": {
|
|
@@ -68,6 +68,11 @@
|
|
|
68
68
|
"require": "./ui-app-flags/index.cjs.js",
|
|
69
69
|
"types": "./ui-app-flags/index.d.ts"
|
|
70
70
|
},
|
|
71
|
+
"./ui-atlaskit-forms": {
|
|
72
|
+
"import": "./ui-atlaskit-forms/index.es.js",
|
|
73
|
+
"require": "./ui-atlaskit-forms/index.cjs.js",
|
|
74
|
+
"types": "./ui-atlaskit-forms/index.d.ts"
|
|
75
|
+
},
|
|
71
76
|
"./ui-atlassian-product-fetch": {
|
|
72
77
|
"import": "./ui-atlassian-product-fetch/index.es.js",
|
|
73
78
|
"require": "./ui-atlassian-product-fetch/index.cjs.js",
|
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
{
|
|
2
|
+
"metadata": {
|
|
3
|
+
"toolPackage": "@microsoft/api-extractor",
|
|
4
|
+
"toolVersion": "7.52.8",
|
|
5
|
+
"schemaVersion": 1011,
|
|
6
|
+
"oldestForwardsCompatibleVersion": 1001,
|
|
7
|
+
"tsdocConfig": {
|
|
8
|
+
"$schema": "https://developer.microsoft.com/json-schemas/tsdoc/v0/tsdoc.schema.json",
|
|
9
|
+
"noStandardTags": true,
|
|
10
|
+
"tagDefinitions": [
|
|
11
|
+
{
|
|
12
|
+
"tagName": "@alpha",
|
|
13
|
+
"syntaxKind": "modifier"
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"tagName": "@beta",
|
|
17
|
+
"syntaxKind": "modifier"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"tagName": "@defaultValue",
|
|
21
|
+
"syntaxKind": "block"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"tagName": "@decorator",
|
|
25
|
+
"syntaxKind": "block",
|
|
26
|
+
"allowMultiple": true
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
"tagName": "@deprecated",
|
|
30
|
+
"syntaxKind": "block"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
"tagName": "@eventProperty",
|
|
34
|
+
"syntaxKind": "modifier"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"tagName": "@example",
|
|
38
|
+
"syntaxKind": "block",
|
|
39
|
+
"allowMultiple": true
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"tagName": "@experimental",
|
|
43
|
+
"syntaxKind": "modifier"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"tagName": "@inheritDoc",
|
|
47
|
+
"syntaxKind": "inline"
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"tagName": "@internal",
|
|
51
|
+
"syntaxKind": "modifier"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"tagName": "@label",
|
|
55
|
+
"syntaxKind": "inline"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"tagName": "@link",
|
|
59
|
+
"syntaxKind": "inline",
|
|
60
|
+
"allowMultiple": true
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"tagName": "@override",
|
|
64
|
+
"syntaxKind": "modifier"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"tagName": "@packageDocumentation",
|
|
68
|
+
"syntaxKind": "modifier"
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"tagName": "@param",
|
|
72
|
+
"syntaxKind": "block",
|
|
73
|
+
"allowMultiple": true
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"tagName": "@privateRemarks",
|
|
77
|
+
"syntaxKind": "block"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"tagName": "@public",
|
|
81
|
+
"syntaxKind": "modifier"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
"tagName": "@readonly",
|
|
85
|
+
"syntaxKind": "modifier"
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"tagName": "@remarks",
|
|
89
|
+
"syntaxKind": "block"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"tagName": "@returns",
|
|
93
|
+
"syntaxKind": "block"
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"tagName": "@sealed",
|
|
97
|
+
"syntaxKind": "modifier"
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
"tagName": "@see",
|
|
101
|
+
"syntaxKind": "block"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"tagName": "@throws",
|
|
105
|
+
"syntaxKind": "block",
|
|
106
|
+
"allowMultiple": true
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
"tagName": "@typeParam",
|
|
110
|
+
"syntaxKind": "block",
|
|
111
|
+
"allowMultiple": true
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"tagName": "@virtual",
|
|
115
|
+
"syntaxKind": "modifier"
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
"tagName": "@betaDocumentation",
|
|
119
|
+
"syntaxKind": "modifier"
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"tagName": "@internalRemarks",
|
|
123
|
+
"syntaxKind": "block"
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
"tagName": "@preapproved",
|
|
127
|
+
"syntaxKind": "modifier"
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
"supportForTags": {
|
|
131
|
+
"@alpha": true,
|
|
132
|
+
"@beta": true,
|
|
133
|
+
"@defaultValue": true,
|
|
134
|
+
"@decorator": true,
|
|
135
|
+
"@deprecated": true,
|
|
136
|
+
"@eventProperty": true,
|
|
137
|
+
"@example": true,
|
|
138
|
+
"@experimental": true,
|
|
139
|
+
"@inheritDoc": true,
|
|
140
|
+
"@internal": true,
|
|
141
|
+
"@label": true,
|
|
142
|
+
"@link": true,
|
|
143
|
+
"@override": true,
|
|
144
|
+
"@packageDocumentation": true,
|
|
145
|
+
"@param": true,
|
|
146
|
+
"@privateRemarks": true,
|
|
147
|
+
"@public": true,
|
|
148
|
+
"@readonly": true,
|
|
149
|
+
"@remarks": true,
|
|
150
|
+
"@returns": true,
|
|
151
|
+
"@sealed": true,
|
|
152
|
+
"@see": true,
|
|
153
|
+
"@throws": true,
|
|
154
|
+
"@typeParam": true,
|
|
155
|
+
"@virtual": true,
|
|
156
|
+
"@betaDocumentation": true,
|
|
157
|
+
"@internalRemarks": true,
|
|
158
|
+
"@preapproved": true
|
|
159
|
+
},
|
|
160
|
+
"reportUnsupportedHtmlElements": false
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"kind": "Package",
|
|
164
|
+
"canonicalReference": "@valiantys/atlassian-app-frontend!",
|
|
165
|
+
"docComment": "",
|
|
166
|
+
"name": "@valiantys/atlassian-app-frontend",
|
|
167
|
+
"preserveMemberOrder": false,
|
|
168
|
+
"members": [
|
|
169
|
+
{
|
|
170
|
+
"kind": "EntryPoint",
|
|
171
|
+
"canonicalReference": "@valiantys/atlassian-app-frontend!",
|
|
172
|
+
"name": "",
|
|
173
|
+
"preserveMemberOrder": false,
|
|
174
|
+
"members": [
|
|
175
|
+
{
|
|
176
|
+
"kind": "Function",
|
|
177
|
+
"canonicalReference": "@valiantys/atlassian-app-frontend!getSelectedOption:function(1)",
|
|
178
|
+
"docComment": "/**\n * Meant to be used with a useState hook, when you are controlling a <select> value directly instead of using a Form to manage it. This works well when you have multiple selects that depend on each other.\n *\n * Will search the list of options for the one that matches the current state value.\n *\n * If no matching option exists, then it will set the state value to undefined and return undefined.\n *\n * If the current state is undefined and there is only one option in the list, it will automatically select that option by setting the state to the option value and returning the lone option.\n *\n * If there is no current valid selection and the options array has more than one item, then it will return undefined as the current value of the select.\n *\n * Example usage:\n *\n * const [widget, setWidget] = useState<Widget | undefined>();\n *\n * const widgetOptions: Option<Widget>[] = allWidgets.map((w) => ({ label: w.title, value: w }));\n *\n * return ( <Label htmlFor=\"select-widget\">Select Widget</Label> <Select inputId=\"select-widget\" options={widgetOptions} value={getSelectedOption( widgetOptions, widget, setWidget )} onChange={(option) => setWidget(option?.value || undefined)} />);\n *\n * @param options - Array of Option objects whose values are of the same type as the state.\n *\n * @param value - Current value from state\n *\n * @param setter - The setState function for this value\n *\n * @param matcher - \n */\n",
|
|
179
|
+
"excerptTokens": [
|
|
180
|
+
{
|
|
181
|
+
"kind": "Content",
|
|
182
|
+
"text": "export declare function getSelectedOption<T>(options: "
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
"kind": "Reference",
|
|
186
|
+
"text": "Option",
|
|
187
|
+
"canonicalReference": "@valiantys/atlassian-app-frontend!Option_2:type"
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
"kind": "Content",
|
|
191
|
+
"text": "<T>[]"
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
"kind": "Content",
|
|
195
|
+
"text": ", value: "
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"kind": "Content",
|
|
199
|
+
"text": "T | undefined"
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
"kind": "Content",
|
|
203
|
+
"text": ", setter: "
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"kind": "Content",
|
|
207
|
+
"text": "(val: T | undefined) => void"
|
|
208
|
+
},
|
|
209
|
+
{
|
|
210
|
+
"kind": "Content",
|
|
211
|
+
"text": ", matcher?: "
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"kind": "Content",
|
|
215
|
+
"text": "(a: T | undefined, b: T | undefined) => boolean"
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
"kind": "Content",
|
|
219
|
+
"text": "): "
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
"kind": "Reference",
|
|
223
|
+
"text": "Option",
|
|
224
|
+
"canonicalReference": "@valiantys/atlassian-app-frontend!Option_2:type"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"kind": "Content",
|
|
228
|
+
"text": "<T> | null"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"kind": "Content",
|
|
232
|
+
"text": ";"
|
|
233
|
+
}
|
|
234
|
+
],
|
|
235
|
+
"fileUrlPath": "../../shared/frontend-ui-atlaskit-forms/src/lib/option.d.ts",
|
|
236
|
+
"returnTypeTokenRange": {
|
|
237
|
+
"startIndex": 10,
|
|
238
|
+
"endIndex": 12
|
|
239
|
+
},
|
|
240
|
+
"releaseTag": "Public",
|
|
241
|
+
"overloadIndex": 1,
|
|
242
|
+
"parameters": [
|
|
243
|
+
{
|
|
244
|
+
"parameterName": "options",
|
|
245
|
+
"parameterTypeTokenRange": {
|
|
246
|
+
"startIndex": 1,
|
|
247
|
+
"endIndex": 3
|
|
248
|
+
},
|
|
249
|
+
"isOptional": false
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"parameterName": "value",
|
|
253
|
+
"parameterTypeTokenRange": {
|
|
254
|
+
"startIndex": 4,
|
|
255
|
+
"endIndex": 5
|
|
256
|
+
},
|
|
257
|
+
"isOptional": false
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
"parameterName": "setter",
|
|
261
|
+
"parameterTypeTokenRange": {
|
|
262
|
+
"startIndex": 6,
|
|
263
|
+
"endIndex": 7
|
|
264
|
+
},
|
|
265
|
+
"isOptional": false
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"parameterName": "matcher",
|
|
269
|
+
"parameterTypeTokenRange": {
|
|
270
|
+
"startIndex": 8,
|
|
271
|
+
"endIndex": 9
|
|
272
|
+
},
|
|
273
|
+
"isOptional": true
|
|
274
|
+
}
|
|
275
|
+
],
|
|
276
|
+
"typeParameters": [
|
|
277
|
+
{
|
|
278
|
+
"typeParameterName": "T",
|
|
279
|
+
"constraintTokenRange": {
|
|
280
|
+
"startIndex": 0,
|
|
281
|
+
"endIndex": 0
|
|
282
|
+
},
|
|
283
|
+
"defaultTypeTokenRange": {
|
|
284
|
+
"startIndex": 0,
|
|
285
|
+
"endIndex": 0
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
"name": "getSelectedOption"
|
|
290
|
+
},
|
|
291
|
+
{
|
|
292
|
+
"kind": "TypeAlias",
|
|
293
|
+
"canonicalReference": "@valiantys/atlassian-app-frontend!Option_2:type",
|
|
294
|
+
"docComment": "",
|
|
295
|
+
"excerptTokens": [
|
|
296
|
+
{
|
|
297
|
+
"kind": "Content",
|
|
298
|
+
"text": "export type Option<T = "
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
"kind": "Content",
|
|
302
|
+
"text": "string"
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
"kind": "Content",
|
|
306
|
+
"text": "> = "
|
|
307
|
+
},
|
|
308
|
+
{
|
|
309
|
+
"kind": "Content",
|
|
310
|
+
"text": "{\n label: string;\n value: T;\n}"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"kind": "Content",
|
|
314
|
+
"text": ";"
|
|
315
|
+
}
|
|
316
|
+
],
|
|
317
|
+
"fileUrlPath": "../../shared/frontend-ui-atlaskit-forms/src/lib/option.d.ts",
|
|
318
|
+
"releaseTag": "Public",
|
|
319
|
+
"name": "Option_2",
|
|
320
|
+
"typeParameters": [
|
|
321
|
+
{
|
|
322
|
+
"typeParameterName": "T",
|
|
323
|
+
"constraintTokenRange": {
|
|
324
|
+
"startIndex": 0,
|
|
325
|
+
"endIndex": 0
|
|
326
|
+
},
|
|
327
|
+
"defaultTypeTokenRange": {
|
|
328
|
+
"startIndex": 1,
|
|
329
|
+
"endIndex": 2
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
"typeTokenRange": {
|
|
334
|
+
"startIndex": 3,
|
|
335
|
+
"endIndex": 4
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
]
|
|
339
|
+
}
|
|
340
|
+
]
|
|
341
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
## API Report File for "@valiantys/atlassian-app-frontend"
|
|
2
|
+
|
|
3
|
+
> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
|
|
7
|
+
// @public
|
|
8
|
+
export function getSelectedOption<T>(options: Option_2<T>[], value: T | undefined, setter: (val: T | undefined) => void, matcher?: (a: T | undefined, b: T | undefined) => boolean): Option_2<T> | null;
|
|
9
|
+
|
|
10
|
+
// @public (undocumented)
|
|
11
|
+
type Option_2<T = string> = {
|
|
12
|
+
label: string;
|
|
13
|
+
value: T;
|
|
14
|
+
};
|
|
15
|
+
export { Option_2 as Option }
|
|
16
|
+
|
|
17
|
+
// (No @packageDocumentation comment for this package)
|
|
18
|
+
|
|
19
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../atlassian/shared/frontend-ui-atlaskit-forms/src/lib/option/index.cjs.js");exports.getSelectedOption=e.getSelectedOption;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Meant to be used with a useState hook, when you are controlling a <select> value
|
|
3
|
+
* directly instead of using a Form to manage it. This works well when you have multiple
|
|
4
|
+
* selects that depend on each other.
|
|
5
|
+
*
|
|
6
|
+
* Will search the list of options for the one that matches the current state value.
|
|
7
|
+
*
|
|
8
|
+
* If no matching option exists, then it will set the state value to undefined and return undefined.
|
|
9
|
+
*
|
|
10
|
+
* If the current state is undefined and there is only one option in the list, it will automatically select
|
|
11
|
+
* that option by setting the state to the option value and returning the lone option.
|
|
12
|
+
*
|
|
13
|
+
* If there is no current valid selection and the options array has more than one item, then it will
|
|
14
|
+
* return undefined as the current value of the select.
|
|
15
|
+
*
|
|
16
|
+
* Example usage:
|
|
17
|
+
*
|
|
18
|
+
* const [widget, setWidget] = useState<Widget | undefined>();
|
|
19
|
+
*
|
|
20
|
+
* const widgetOptions: Option<Widget>[] = allWidgets.map((w) => ({ label: w.title, value: w }));
|
|
21
|
+
*
|
|
22
|
+
* return ( <Label htmlFor="select-widget">Select Widget</Label>
|
|
23
|
+
* <Select
|
|
24
|
+
* inputId="select-widget"
|
|
25
|
+
* options={widgetOptions}
|
|
26
|
+
* value={getSelectedOption(
|
|
27
|
+
* widgetOptions,
|
|
28
|
+
* widget,
|
|
29
|
+
* setWidget
|
|
30
|
+
* )}
|
|
31
|
+
* onChange={(option) => setWidget(option?.value || undefined)}
|
|
32
|
+
* />);
|
|
33
|
+
*
|
|
34
|
+
*
|
|
35
|
+
* @param options Array of Option objects whose values are of the same type as the state.
|
|
36
|
+
* @param value Current value from state
|
|
37
|
+
* @param setter The setState function for this value
|
|
38
|
+
* @param matcher
|
|
39
|
+
*/
|
|
40
|
+
export declare function getSelectedOption<T>(options: Option_2<T>[], value: T | undefined, setter: (val: T | undefined) => void, matcher?: (a: T | undefined, b: T | undefined) => boolean): Option_2<T> | null;
|
|
41
|
+
|
|
42
|
+
declare type Option_2<T = string> = {
|
|
43
|
+
label: string;
|
|
44
|
+
value: T;
|
|
45
|
+
};
|
|
46
|
+
export { Option_2 as Option }
|
|
47
|
+
|
|
48
|
+
export { }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.52.8"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|