@jpmorganchase/elemental 1.0.0 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/__fixtures__/api-descriptions/Instagram.d.ts +1547 -0
  2. package/__fixtures__/api-descriptions/badgesForSchema.d.ts +1 -0
  3. package/__fixtures__/api-descriptions/simpleApiWithInternalOperations.d.ts +224 -0
  4. package/__fixtures__/api-descriptions/simpleApiWithoutDescription.d.ts +212 -0
  5. package/__fixtures__/api-descriptions/todosApiBundled.d.ts +1 -0
  6. package/__fixtures__/api-descriptions/zoomApiYaml.d.ts +1 -0
  7. package/components/API/APIWithSidebarLayout.d.ts +17 -0
  8. package/components/API/APIWithStackedLayout.d.ts +15 -0
  9. package/components/API/utils.d.ts +18 -0
  10. package/containers/API.d.ts +23 -0
  11. package/containers/API.spec.d.ts +3 -0
  12. package/containers/API.stories.d.ts +57 -0
  13. package/hooks/useExportDocumentProps.d.ts +11 -0
  14. package/hooks/useExportDocumentProps.spec.d.ts +1 -0
  15. package/index.esm.js +516 -0
  16. package/index.js +549 -0
  17. package/index.mjs +516 -0
  18. package/package.json +17 -76
  19. package/styles.min.css +1 -0
  20. package/utils/oas/index.d.ts +3 -0
  21. package/utils/oas/oas2.d.ts +2 -0
  22. package/utils/oas/oas3.d.ts +2 -0
  23. package/utils/oas/types.d.ts +30 -0
  24. package/web-components/components.d.ts +1 -0
  25. package/web-components/index.d.ts +1 -0
  26. package/web-components.min.js +2 -0
  27. package/web-components.min.js.LICENSE.txt +189 -0
  28. package/.storybook/main.js +0 -1
  29. package/.storybook/manager.js +0 -1
  30. package/.storybook/preview.jsx +0 -3
  31. package/jest.config.js +0 -7
  32. package/src/__fixtures__/api-descriptions/Instagram.ts +0 -1859
  33. package/src/__fixtures__/api-descriptions/badgesForSchema.ts +0 -36
  34. package/src/__fixtures__/api-descriptions/simpleApiWithInternalOperations.ts +0 -253
  35. package/src/__fixtures__/api-descriptions/simpleApiWithoutDescription.ts +0 -243
  36. package/src/__fixtures__/api-descriptions/todosApiBundled.ts +0 -430
  37. package/src/__fixtures__/api-descriptions/zoomApiYaml.ts +0 -6083
  38. package/src/components/API/APIWithSidebarLayout.tsx +0 -111
  39. package/src/components/API/APIWithStackedLayout.tsx +0 -220
  40. package/src/components/API/__tests__/utils.test.ts +0 -848
  41. package/src/components/API/utils.ts +0 -174
  42. package/src/containers/API.spec.tsx +0 -131
  43. package/src/containers/API.stories.tsx +0 -99
  44. package/src/containers/API.tsx +0 -200
  45. package/src/hooks/useExportDocumentProps.spec.tsx +0 -68
  46. package/src/hooks/useExportDocumentProps.tsx +0 -48
  47. package/src/styles.css +0 -1
  48. package/src/utils/oas/__tests__/oas.spec.ts +0 -272
  49. package/src/utils/oas/index.ts +0 -150
  50. package/src/utils/oas/oas2.ts +0 -31
  51. package/src/utils/oas/oas3.ts +0 -37
  52. package/src/utils/oas/types.ts +0 -31
  53. package/src/web-components/__stories__/Api.stories.tsx +0 -63
  54. package/src/web-components/components.ts +0 -20
  55. package/src/web-components/index.ts +0 -3
  56. package/tsconfig.build.json +0 -18
  57. package/tsconfig.json +0 -7
  58. package/web-components.config.js +0 -1
  59. /package/{src/index.ts → index.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ export declare const badgesForSchema = "\nopenapi: 3.1.0\ninfo:\n title: Schema Badges Sample\n description: 'Sample with deprecated and internal badges on schema component'\n contact:\n url: 'https://example.com'\n email: example@example.com\n name: John Johnson\n version: 0.0.0\ncomponents:\n schemas:\n ValidationParams:\n description: Validation parameters\n deprecated: true\n properties:\n groupName:\n type: string\n version:\n type: string\n enum:\n - ok\n - error\n ValidationReport:\n description: Validation report\n deprecated: true\n x-internal: true\n properties:\n validationId:\n type: string\n status:\n type: string\n enum:\n - ok\n - error\n";
@@ -0,0 +1,224 @@
1
+ export declare const simpleApiWithInternalOperations: {
2
+ swagger: string;
3
+ info: {
4
+ title: string;
5
+ description: string;
6
+ version: string;
7
+ contact: {
8
+ name: string;
9
+ url: string;
10
+ };
11
+ license: {
12
+ name: string;
13
+ };
14
+ };
15
+ host: string;
16
+ schemes: string[];
17
+ consumes: string[];
18
+ produces: string[];
19
+ securityDefinitions: {
20
+ apikey: {
21
+ name: string;
22
+ type: string;
23
+ in: string;
24
+ description: string;
25
+ };
26
+ };
27
+ tags: {
28
+ name: string;
29
+ }[];
30
+ paths: {
31
+ '/todos/{todoId}': {
32
+ parameters: {
33
+ name: string;
34
+ in: string;
35
+ required: boolean;
36
+ type: string;
37
+ }[];
38
+ get: {
39
+ operationId: string;
40
+ summary: string;
41
+ tags: string[];
42
+ 'x-internal': boolean;
43
+ responses: {
44
+ '200': {
45
+ description: string;
46
+ schema: {
47
+ $ref: string;
48
+ };
49
+ examples: {
50
+ 'application/json': {
51
+ id: number;
52
+ name: string;
53
+ completed: boolean;
54
+ completed_at: string;
55
+ created_at: string;
56
+ updated_at: string;
57
+ };
58
+ };
59
+ };
60
+ '404': {
61
+ $ref: string;
62
+ };
63
+ '500': {
64
+ $ref: string;
65
+ };
66
+ };
67
+ };
68
+ put: {
69
+ operationId: string;
70
+ summary: string;
71
+ tags: string[];
72
+ parameters: {
73
+ name: string;
74
+ in: string;
75
+ schema: {
76
+ $ref: string;
77
+ example: {
78
+ name: string;
79
+ completed: boolean;
80
+ };
81
+ };
82
+ }[];
83
+ responses: {
84
+ '200': {
85
+ description: string;
86
+ schema: {
87
+ $ref: string;
88
+ };
89
+ examples: {
90
+ 'application/json': {
91
+ id: number;
92
+ name: string;
93
+ completed: boolean;
94
+ completed_at: null;
95
+ created_at: string;
96
+ updated_at: string;
97
+ };
98
+ };
99
+ };
100
+ '401': {
101
+ $ref: string;
102
+ };
103
+ '404': {
104
+ $ref: string;
105
+ };
106
+ '500': {
107
+ $ref: string;
108
+ };
109
+ };
110
+ security: {
111
+ apikey: never[];
112
+ }[];
113
+ };
114
+ delete: {
115
+ operationId: string;
116
+ summary: string;
117
+ tags: string[];
118
+ responses: {
119
+ '204': {
120
+ description: string;
121
+ };
122
+ '401': {
123
+ $ref: string;
124
+ };
125
+ '404': {
126
+ $ref: string;
127
+ };
128
+ '500': {
129
+ $ref: string;
130
+ };
131
+ };
132
+ security: {
133
+ apikey: never[];
134
+ }[];
135
+ };
136
+ };
137
+ '/todos': {
138
+ post: {
139
+ operationId: string;
140
+ summary: string;
141
+ tags: string[];
142
+ parameters: {
143
+ name: string;
144
+ in: string;
145
+ schema: {
146
+ $ref: string;
147
+ example: {
148
+ name: string;
149
+ completed: boolean;
150
+ };
151
+ };
152
+ }[];
153
+ responses: {
154
+ '201': {
155
+ description: string;
156
+ schema: {
157
+ $ref: string;
158
+ };
159
+ examples: {
160
+ 'application/json': {
161
+ id: number;
162
+ name: string;
163
+ completed: null;
164
+ completed_at: null;
165
+ created_at: string;
166
+ updated_at: string;
167
+ };
168
+ };
169
+ };
170
+ '401': {
171
+ $ref: string;
172
+ };
173
+ '500': {
174
+ $ref: string;
175
+ };
176
+ };
177
+ security: {
178
+ apikey: never[];
179
+ }[];
180
+ description: string;
181
+ };
182
+ get: {
183
+ operationId: string;
184
+ summary: string;
185
+ tags: string[];
186
+ parameters: {
187
+ $ref: string;
188
+ }[];
189
+ responses: {
190
+ '200': {
191
+ description: string;
192
+ schema: {
193
+ type: string;
194
+ items: {
195
+ $ref: string;
196
+ };
197
+ };
198
+ examples: {
199
+ 'application/json': {
200
+ id: number;
201
+ name: string;
202
+ completed: boolean;
203
+ }[];
204
+ };
205
+ };
206
+ '500': {
207
+ $ref: string;
208
+ };
209
+ };
210
+ description: string;
211
+ };
212
+ };
213
+ };
214
+ definitions: {
215
+ InternalSchema: {
216
+ title: string;
217
+ description: string;
218
+ schema: {
219
+ type: string;
220
+ };
221
+ 'x-internal': boolean;
222
+ };
223
+ };
224
+ };
@@ -0,0 +1,212 @@
1
+ export declare const simpleApiWithoutDescription: {
2
+ swagger: string;
3
+ info: {
4
+ title: string;
5
+ version: string;
6
+ contact: {
7
+ name: string;
8
+ url: string;
9
+ };
10
+ license: {
11
+ name: string;
12
+ };
13
+ };
14
+ host: string;
15
+ schemes: string[];
16
+ consumes: string[];
17
+ produces: string[];
18
+ securityDefinitions: {
19
+ apikey: {
20
+ name: string;
21
+ type: string;
22
+ in: string;
23
+ description: string;
24
+ };
25
+ };
26
+ tags: {
27
+ name: string;
28
+ }[];
29
+ paths: {
30
+ '/todos/{todoId}': {
31
+ parameters: {
32
+ name: string;
33
+ in: string;
34
+ required: boolean;
35
+ type: string;
36
+ }[];
37
+ get: {
38
+ operationId: string;
39
+ summary: string;
40
+ tags: string[];
41
+ responses: {
42
+ '200': {
43
+ description: string;
44
+ schema: {
45
+ $ref: string;
46
+ };
47
+ examples: {
48
+ 'application/json': {
49
+ id: number;
50
+ name: string;
51
+ completed: boolean;
52
+ completed_at: string;
53
+ created_at: string;
54
+ updated_at: string;
55
+ };
56
+ };
57
+ };
58
+ '404': {
59
+ $ref: string;
60
+ };
61
+ '500': {
62
+ $ref: string;
63
+ };
64
+ };
65
+ };
66
+ put: {
67
+ operationId: string;
68
+ summary: string;
69
+ tags: string[];
70
+ parameters: {
71
+ name: string;
72
+ in: string;
73
+ schema: {
74
+ $ref: string;
75
+ example: {
76
+ name: string;
77
+ completed: boolean;
78
+ };
79
+ };
80
+ }[];
81
+ responses: {
82
+ '200': {
83
+ description: string;
84
+ schema: {
85
+ $ref: string;
86
+ };
87
+ examples: {
88
+ 'application/json': {
89
+ id: number;
90
+ name: string;
91
+ completed: boolean;
92
+ completed_at: null;
93
+ created_at: string;
94
+ updated_at: string;
95
+ };
96
+ };
97
+ };
98
+ '401': {
99
+ $ref: string;
100
+ };
101
+ '404': {
102
+ $ref: string;
103
+ };
104
+ '500': {
105
+ $ref: string;
106
+ };
107
+ };
108
+ security: {
109
+ apikey: never[];
110
+ }[];
111
+ };
112
+ delete: {
113
+ operationId: string;
114
+ summary: string;
115
+ tags: string[];
116
+ responses: {
117
+ '204': {
118
+ description: string;
119
+ };
120
+ '401': {
121
+ $ref: string;
122
+ };
123
+ '404': {
124
+ $ref: string;
125
+ };
126
+ '500': {
127
+ $ref: string;
128
+ };
129
+ };
130
+ security: {
131
+ apikey: never[];
132
+ }[];
133
+ };
134
+ };
135
+ '/todos': {
136
+ post: {
137
+ operationId: string;
138
+ summary: string;
139
+ tags: string[];
140
+ parameters: {
141
+ name: string;
142
+ in: string;
143
+ schema: {
144
+ $ref: string;
145
+ example: {
146
+ name: string;
147
+ completed: boolean;
148
+ };
149
+ };
150
+ }[];
151
+ responses: {
152
+ '201': {
153
+ description: string;
154
+ schema: {
155
+ $ref: string;
156
+ };
157
+ examples: {
158
+ 'application/json': {
159
+ id: number;
160
+ name: string;
161
+ completed: null;
162
+ completed_at: null;
163
+ created_at: string;
164
+ updated_at: string;
165
+ };
166
+ };
167
+ };
168
+ '401': {
169
+ $ref: string;
170
+ };
171
+ '500': {
172
+ $ref: string;
173
+ };
174
+ };
175
+ security: {
176
+ apikey: never[];
177
+ }[];
178
+ description: string;
179
+ };
180
+ get: {
181
+ operationId: string;
182
+ summary: string;
183
+ tags: string[];
184
+ parameters: {
185
+ $ref: string;
186
+ }[];
187
+ responses: {
188
+ '200': {
189
+ description: string;
190
+ schema: {
191
+ type: string;
192
+ items: {
193
+ $ref: string;
194
+ };
195
+ };
196
+ examples: {
197
+ 'application/json': {
198
+ id: number;
199
+ name: string;
200
+ completed: boolean;
201
+ }[];
202
+ };
203
+ };
204
+ '500': {
205
+ $ref: string;
206
+ };
207
+ };
208
+ description: string;
209
+ };
210
+ };
211
+ };
212
+ };
@@ -0,0 +1 @@
1
+ export declare const todosApiBundled = "\nopenapi: 3.0.0\ninfo:\n title: To-dos\n version: 1.0.0\n description: \"![](https://i.ibb.co/v3Yt03v/todo-api-background.png)\n\n## U0001F4AB Overview\n\nTo Do API provides a simple way for people to manage their tasks and plan their day. This API can be used to create mobile and web applications.This API is documented using **OpenAPI 3.0**. The implementation lives in this [GitHub repo](https://github.com/stoplightio/studio-demo/blob/master/reference/todos/todo.v1.yaml).\n\n### U0001F9F0 Cross-Origin Resource Sharing\nThis API features Cross-Origin Resource Sharing (CORS) implemented in compliance with [W3C spec](https://www.w3.org/TR/cors/). CORS support is necessary to make calls from the request maker within the API docs.\n\n### U0001F3C1 Trying out your own API Specification\nElements can be used to generate API docs for any OpenAPI document. Replace this OpenAPI with a URL to your own OpenAPI document to get started. \"\n contact:\n name: Stoplight Support\n email: support@stoplight.io\n url: 'https://www.stoplight.io'\n license:\n name: MIT\n url: 'https://spdx.org/licenses/MIT'\n termsOfService: 'https://stoplight.io/terms/'\nservers:\n - url: 'https://todos.stoplight.io'\n description: Production\n - description: Sandbox\n url: 'https://todos-sandbox.stoplight.io'\npaths:\n /todos:\n get:\n summary: List Todos\n responses:\n '200':\n description: Returns a list of Todos\n content:\n application/json:\n schema:\n type: array\n items:\n $ref: '#/components/schemas/Todos'\n examples:\n List of Todos:\n $ref: '#/components/examples/multiple-todos'\n '403':\n $ref: '#/components/responses/Unauthorized'\n '404':\n $ref: '#/components/responses/NotFound'\n operationId: get-todos\n description: >-\n Returns a list of todos\n\n\n *Markdown is supported in descriptions. Add information here for users\n to get accustomed to endpoints*\n parameters:\n - $ref: '#/components/parameters/limit'\n - $ref: '#/components/parameters/contentType'\n security: []\n post:\n summary: Create Todo\n operationId: post-todos\n responses:\n '201':\n description: New Todo Created\n content:\n multipart/form-data:\n schema:\n $ref: '#/components/schemas/Todos'\n examples:\n Example Todo:\n $ref: '#/components/examples/todo'\n '403':\n $ref: '#/components/responses/Unauthorized'\n '404':\n $ref: '#/components/responses/NotFound'\n description: >-\n This creates a Todo object\n\n\n *Markdown is supported in descriptions. Add information here for users\n to get accustomed to endpoints*\n requestBody:\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/Todos'\n description: Name of the Todo\n parameters:\n - $ref: '#/components/parameters/contentType'\n security:\n - API Key: []\n '/todos/{id}':\n get:\n summary: Get Todo\n responses:\n '200':\n description: Returns the Todo for the ID\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/Todos'\n examples:\n Example Todo:\n $ref: '#/components/examples/todo'\n '403':\n $ref: '#/components/responses/Unauthorized'\n '404':\n $ref: '#/components/responses/NotFound'\n operationId: get-todos-id\n description: >-\n Get a single todo using an ID\n\n\n *Markdown is supported in descriptions. Add information here for users\n to get accustomed to endpoints*\n parameters: []\n security: []\n put:\n summary: Replace Todo\n operationId: put-todos-id\n responses:\n '200':\n description: Todo Updated\n '403':\n $ref: '#/components/responses/Unauthorized'\n '404':\n $ref: '#/components/responses/NotFound'\n requestBody:\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/Todos'\n description: ''\n description: >-\n Update a single todo using an ID\n\n\n *Markdown is supported in descriptions. Add information here for users\n to get accustomed to endpoints*\n parameters:\n - $ref: '#/components/parameters/contentType'\n security:\n - API Key: []\n delete:\n summary: Delete Todo\n operationId: delete-todos-id\n responses:\n '200':\n description: Todo Deleted\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/Todos'\n examples:\n Example Todo:\n $ref: '#/components/examples/todo'\n '403':\n $ref: '#/components/responses/Unauthorized'\n '404':\n $ref: '#/components/responses/NotFound'\n description: >-\n Delete a todo using an ID\n\n\n *Markdown is supported in descriptions. Add information here for users\n to get accustomed to endpoints*\n security:\n - API Key: []\n patch:\n summary: Update Todo\n operationId: patch-todos-id\n responses:\n '200':\n description: Todo Updated\n '403':\n $ref: '#/components/responses/Unauthorized'\n '404':\n $ref: '#/components/responses/NotFound'\n deprecated: true\n description: >-\n Don't use this endpoint. Notice it's deprecated.\n\n\n *Markdown is supported in descriptions. Add information here for users\n to get accustomed to endpoints*\n requestBody:\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/Todos'\n security:\n - API Key: []\n parameters:\n - $ref: '#/components/parameters/ID'\n /users:\n get:\n summary: Get User\n tags:\n - Users\n responses:\n '200':\n description: OK\n content:\n application/json:\n schema:\n type: array\n items:\n $ref: '#/components/schemas/User'\n '404':\n $ref: '#/components/responses/NotFound'\n operationId: get-users\n description: >-\n Get a user by ID\n\n\n *Markdown is supported in descriptions. Add information here for users\n to get accustomed to endpoints*\n parameters:\n - $ref: '#/components/parameters/contentType'\n security: []\n parameters: []\n delete:\n summary: Delete User\n operationId: delete-users-userID\n responses:\n '200':\n description: OK\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/User'\n description: Delete a user by ID\n tags:\n - Users\n security:\n - API Key: []\n post:\n summary: Create User\n operationId: post-users-userID\n responses:\n '201':\n description: User Created\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/User'\n examples:\n Example User:\n $ref: '#/components/examples/user'\n description: Create a User\n requestBody:\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/User'\n examples: {}\n tags:\n - Users\n parameters:\n - $ref: '#/components/parameters/contentType'\n security:\n - API Key: []\ncomponents:\n schemas:\n Todos:\n description: I'm a model's description.\n type: object\n x-examples: {}\n title: Todo\n properties:\n id:\n type: number\n minimum: 0\n maximum: 9999\n description: ID of the task\n readOnly: true\n name:\n type: string\n minLength: 1\n maxLength: 100\n description: Name of the task\n completed:\n type: boolean\n default: false\n description: Boolean indicating if the task has been completed or not\n completed_at:\n type: string\n format: date-time\n description: Time when the task was completed\n readOnly: true\n created_at:\n type: string\n format: date-time\n description: Time when the task was created\n readOnly: true\n updated_at:\n type: string\n format: date-time\n description: Time when the task was updated\n readOnly: true\n required:\n - id\n - name\n - completed_at\n - created_at\n - updated_at\n User:\n description: ''\n type: object\n title: User\n properties:\n userId:\n type: number\n description: ID of the user\n readOnly: true\n firstName:\n type: string\n minLength: 1\n description: ''\n lastName:\n type: string\n minLength: 1\n description: ''\n phoneNumber:\n type: string\n minLength: 1\n description: Official Phone Number\n emailAddress:\n type: string\n minLength: 1\n description: Work Email Address\n required:\n - userId\n - firstName\n - lastName\n - phoneNumber\n - emailAddress\n securitySchemes:\n API Key:\n name: apikey\n type: apiKey\n in: query\n description: Just use `123`. It's super secure ;)\n parameters:\n limit:\n name: limit\n in: query\n required: false\n schema:\n type: number\n description: >-\n Return a limited set of results *I'm a shared parameter. I can be reused\n in multiple endpoints!*\n contentType:\n name: Content-Type\n in: header\n required: true\n schema:\n type: string\n default: application/json\n description: application/json\n ID:\n name: id\n in: path\n required: true\n schema:\n type: string\n description: ID of the Todo\n responses:\n NotFound:\n description: Resource not found\n content:\n application/json:\n schema:\n title: Error\n type: object\n description: A standard error object.\n x-tags:\n - Common\n properties:\n status:\n type: string\n description: A code.\n error:\n type: string\n required:\n - status\n - error\n Unauthorized:\n description: Action not allowed\n content:\n application/json:\n schema:\n type: object\n properties:\n message:\n type: string\n required:\n - message\n examples:\n todo:\n value:\n id: 0\n name: string\n completed: true\n completed_at: '2019-08-24T14:15:22Z'\n created_at: '2019-08-24T14:15:22Z'\n updated_at: '2019-08-24T14:15:22Z'\n multiple-todos:\n value:\n - id: 0\n name: my todo\n completed: true\n completed_at: '2019-08-24T14:15:22Z'\n created_at: '2019-08-24T14:15:22Z'\n updated_at: '2019-08-24T14:15:22Z'\n - id: 1\n name: another todo\n completed: false\n completed_at: '2019-08-24T14:15:22Z'\n created_at: '2019-08-24T14:15:22Z'\n updated_at: '2019-08-24T14:15:22Z'\n - id: 2\n name: yet another todo\n completed: false\n completed_at: '2019-08-24T14:15:22Z'\n created_at: '2019-08-24T14:15:22Z'\n updated_at: '2019-08-24T14:15:22Z'\n user:\n value:\n userId: 2\n firstName: racks\n lastName: jacson\n phoneNumber: '123456'\n emailAddress: racks.jacson@learningcontainer.com\ntags:\n - name: Todos\n";