@nordhealth/components 1.0.0-beta.1 → 1.0.0-beta.4
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/custom-elements.json +1100 -930
- package/lib/Banner.js +2 -0
- package/lib/Banner.js.map +1 -0
- package/lib/EmptyState.js +2 -0
- package/lib/EmptyState.js.map +1 -0
- package/lib/Icon.js +1 -1
- package/lib/bundle.js +6 -6
- package/lib/bundle.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/src/banner/Banner.d.ts +25 -0
- package/lib/src/banner/Banner.test.d.ts +2 -0
- package/lib/src/empty-state/EmptyState.d.ts +21 -0
- package/lib/src/empty-state/EmptyState.test.d.ts +3 -0
- package/lib/src/index.d.ts +2 -0
- package/package.json +6 -6
package/custom-elements.json
CHANGED
|
@@ -198,6 +198,22 @@
|
|
|
198
198
|
"name": "default",
|
|
199
199
|
"module": "\"./layout/Layout.js\""
|
|
200
200
|
}
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
"kind": "js",
|
|
204
|
+
"name": "EmptyState",
|
|
205
|
+
"declaration": {
|
|
206
|
+
"name": "default",
|
|
207
|
+
"module": "\"./empty-state/EmptyState.js\""
|
|
208
|
+
}
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
"kind": "js",
|
|
212
|
+
"name": "Banner",
|
|
213
|
+
"declaration": {
|
|
214
|
+
"name": "default",
|
|
215
|
+
"module": "\"./banner/Banner.js\""
|
|
216
|
+
}
|
|
201
217
|
}
|
|
202
218
|
]
|
|
203
219
|
},
|
|
@@ -289,6 +305,94 @@
|
|
|
289
305
|
],
|
|
290
306
|
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to show a status update on a piece of information or action.\n- Use to mark something as a “draft” or “new”.\n- Use when you want to highlight something that has been added recently.\n- Use established color patterns so that users can clearly identify the importance level.\n- Always position badge so that it’s clear to understand what object it’s related to.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make badges clickable. Instead use button component’s small variant.\n- Don’t use alternatives to existing badge variants.\n\n</div>\n\n---\n\n## Content guidelines\n\nBadge labels should use a single word to describe the status of an object. Only use two words if you need to describe a complex state:\n\n<div class=\"n-usage n-usage-do\">Complete</div>\n<div class=\"n-usage n-usage-dont\">Action completed</div>\n\nWhen writing badge labels, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">Partially refunded</div>\n<div class=\"n-usage n-usage-dont\">Partially Refunded</div>\n\nAvoid unnecessary words and articles in badge labels, such as “is”, “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Pending</div>\n<div class=\"n-usage n-usage-dont\">Item is pending</div>\n\nAlways describe the status in the past tense:\n\n<div class=\"n-usage n-usage-do\">Refunded</div>\n<div class=\"n-usage n-usage-dont\">Refund</div>\n\n---\n\n## Variants\n\nThis section describes the different component variants, their purpose, and when to use each variant.\n\n| Name | Purpose |\n| ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| `info` | The default variant. Used to convey general information that isn’t critical. |\n| `success` | Used to convey success states. For example, you might want to show a badge that tells the user a payment was successful. |\n| `highlight` | Used to highlight specific items in the interface, like notifications. |\n| `danger` | Used to communicate problems that have to be resolved so that user can continue forward. Should always be used for highlighting errors. |\n| `warning` | Used to display information that needs a user’s attention attention and may require further steps. |\n"
|
|
291
307
|
},
|
|
308
|
+
{
|
|
309
|
+
"kind": "javascript-module",
|
|
310
|
+
"path": "src/banner/Banner.ts",
|
|
311
|
+
"declarations": [
|
|
312
|
+
{
|
|
313
|
+
"kind": "class",
|
|
314
|
+
"description": "Banner informs users about important changes or conditions in the\ninterface. Use this component if you need to communicate to users\nin a prominent way.",
|
|
315
|
+
"name": "Banner",
|
|
316
|
+
"slots": [
|
|
317
|
+
{
|
|
318
|
+
"description": "default slot",
|
|
319
|
+
"name": ""
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"members": [
|
|
323
|
+
{
|
|
324
|
+
"kind": "field",
|
|
325
|
+
"name": "variant",
|
|
326
|
+
"type": {
|
|
327
|
+
"text": "\"info\" | \"danger\" | \"success\" | \"warning\""
|
|
328
|
+
},
|
|
329
|
+
"default": "\"info\"",
|
|
330
|
+
"description": "The style variant of the banner.",
|
|
331
|
+
"attribute": "variant",
|
|
332
|
+
"reflects": true
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
"kind": "field",
|
|
336
|
+
"name": "_warningLogged",
|
|
337
|
+
"type": {
|
|
338
|
+
"text": "boolean"
|
|
339
|
+
},
|
|
340
|
+
"privacy": "private",
|
|
341
|
+
"static": true,
|
|
342
|
+
"default": "false",
|
|
343
|
+
"inheritedFrom": {
|
|
344
|
+
"name": "DraftComponentMixin",
|
|
345
|
+
"module": "src/common/mixins/DraftComponentMixin.ts"
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
],
|
|
349
|
+
"attributes": [
|
|
350
|
+
{
|
|
351
|
+
"name": "variant",
|
|
352
|
+
"type": {
|
|
353
|
+
"text": "\"info\" | \"danger\" | \"success\" | \"warning\""
|
|
354
|
+
},
|
|
355
|
+
"default": "\"info\"",
|
|
356
|
+
"description": "The style variant of the banner.",
|
|
357
|
+
"fieldName": "variant"
|
|
358
|
+
}
|
|
359
|
+
],
|
|
360
|
+
"mixins": [
|
|
361
|
+
{
|
|
362
|
+
"name": "DraftComponentMixin",
|
|
363
|
+
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
364
|
+
}
|
|
365
|
+
],
|
|
366
|
+
"superclass": {
|
|
367
|
+
"name": "LitElement",
|
|
368
|
+
"package": "lit"
|
|
369
|
+
},
|
|
370
|
+
"status": "draft",
|
|
371
|
+
"category": "feedback",
|
|
372
|
+
"tagName": "nord-banner",
|
|
373
|
+
"customElement": true
|
|
374
|
+
}
|
|
375
|
+
],
|
|
376
|
+
"exports": [
|
|
377
|
+
{
|
|
378
|
+
"kind": "js",
|
|
379
|
+
"name": "default",
|
|
380
|
+
"declaration": {
|
|
381
|
+
"name": "Banner",
|
|
382
|
+
"module": "src/banner/Banner.ts"
|
|
383
|
+
}
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
"kind": "custom-element-definition",
|
|
387
|
+
"name": "nord-banner",
|
|
388
|
+
"declaration": {
|
|
389
|
+
"name": "Banner",
|
|
390
|
+
"module": "src/banner/Banner.ts"
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
],
|
|
394
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use this component if you need to communicate in a prominent way.\n- Place banner at the top of the section it applies to.\n- Use for highlighting errors and success statuses.\n- Put banner close to the context it’s referring to.\n- Move focus to the banner if it’s relevant to the current workflow.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Move focus to banner if it appears on page load.\n- Use for highlighting general content or as a banner.\n- Use to replace an error page.\n\n</div>\n"
|
|
395
|
+
},
|
|
292
396
|
{
|
|
293
397
|
"kind": "javascript-module",
|
|
294
398
|
"path": "src/button/Button.ts",
|
|
@@ -1175,385 +1279,411 @@
|
|
|
1175
1279
|
},
|
|
1176
1280
|
{
|
|
1177
1281
|
"kind": "javascript-module",
|
|
1178
|
-
"path": "src/
|
|
1282
|
+
"path": "src/checkbox/Checkbox.ts",
|
|
1179
1283
|
"declarations": [
|
|
1180
1284
|
{
|
|
1181
1285
|
"kind": "class",
|
|
1182
|
-
"description": "
|
|
1183
|
-
"name": "
|
|
1286
|
+
"description": "Checkboxes allow user to choose one or more options from a limited set of options.\nIf you have more than 10 options, please use Select component instead.",
|
|
1287
|
+
"name": "Checkbox",
|
|
1184
1288
|
"slots": [
|
|
1185
1289
|
{
|
|
1186
|
-
"description": "
|
|
1187
|
-
"name": ""
|
|
1290
|
+
"description": "Use when a label requires more than plain text.",
|
|
1291
|
+
"name": "label"
|
|
1188
1292
|
},
|
|
1189
1293
|
{
|
|
1190
|
-
"description": "Optional slot that holds
|
|
1191
|
-
"name": "
|
|
1294
|
+
"description": "Optional slot that holds hint text for the input.",
|
|
1295
|
+
"name": "hint"
|
|
1192
1296
|
},
|
|
1193
1297
|
{
|
|
1194
|
-
"description": "Optional slot that holds
|
|
1195
|
-
"name": "
|
|
1298
|
+
"description": "Optional slot that holds error text for the input.",
|
|
1299
|
+
"name": "error"
|
|
1196
1300
|
}
|
|
1197
1301
|
],
|
|
1198
1302
|
"members": [
|
|
1199
1303
|
{
|
|
1200
1304
|
"kind": "field",
|
|
1201
|
-
"name": "
|
|
1202
|
-
"privacy": "
|
|
1203
|
-
"
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
"name": "footerSlot",
|
|
1208
|
-
"privacy": "private",
|
|
1209
|
-
"default": "new SlotController(this, \"footer\")"
|
|
1305
|
+
"name": "formValue",
|
|
1306
|
+
"privacy": "protected",
|
|
1307
|
+
"inheritedFrom": {
|
|
1308
|
+
"name": "FormAssociatedMixin",
|
|
1309
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1310
|
+
}
|
|
1210
1311
|
},
|
|
1211
1312
|
{
|
|
1212
1313
|
"kind": "field",
|
|
1213
|
-
"name": "
|
|
1314
|
+
"name": "checked",
|
|
1214
1315
|
"type": {
|
|
1215
|
-
"text": "
|
|
1316
|
+
"text": "boolean"
|
|
1216
1317
|
},
|
|
1217
|
-
"default": "
|
|
1218
|
-
"description": "Controls the
|
|
1219
|
-
"attribute": "
|
|
1220
|
-
"reflects": true
|
|
1318
|
+
"default": "false",
|
|
1319
|
+
"description": "Controls whether the checkbox is checked or not.",
|
|
1320
|
+
"attribute": "checked"
|
|
1221
1321
|
},
|
|
1222
1322
|
{
|
|
1223
|
-
"kind": "
|
|
1224
|
-
"name": "
|
|
1225
|
-
"
|
|
1226
|
-
|
|
1323
|
+
"kind": "method",
|
|
1324
|
+
"name": "handleChange",
|
|
1325
|
+
"privacy": "protected",
|
|
1326
|
+
"return": {
|
|
1327
|
+
"type": {
|
|
1328
|
+
"text": "void"
|
|
1329
|
+
}
|
|
1227
1330
|
},
|
|
1228
|
-
"
|
|
1229
|
-
|
|
1230
|
-
|
|
1331
|
+
"parameters": [
|
|
1332
|
+
{
|
|
1333
|
+
"name": "e",
|
|
1334
|
+
"type": {
|
|
1335
|
+
"text": "Event"
|
|
1336
|
+
}
|
|
1337
|
+
}
|
|
1338
|
+
],
|
|
1231
1339
|
"inheritedFrom": {
|
|
1232
|
-
"name": "
|
|
1233
|
-
"module": "src/common/mixins/
|
|
1340
|
+
"name": "FormAssociatedMixin",
|
|
1341
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1234
1342
|
}
|
|
1235
|
-
}
|
|
1236
|
-
],
|
|
1237
|
-
"attributes": [
|
|
1238
|
-
{
|
|
1239
|
-
"name": "padding",
|
|
1240
|
-
"type": {
|
|
1241
|
-
"text": "\"m\" | \"l\" | \"none\""
|
|
1242
|
-
},
|
|
1243
|
-
"default": "\"m\"",
|
|
1244
|
-
"description": "Controls the padding of card component. When set to “none”,\nthe header and footer slots will still have padding.",
|
|
1245
|
-
"fieldName": "padding"
|
|
1246
|
-
}
|
|
1247
|
-
],
|
|
1248
|
-
"mixins": [
|
|
1249
|
-
{
|
|
1250
|
-
"name": "DraftComponentMixin",
|
|
1251
|
-
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
1252
|
-
}
|
|
1253
|
-
],
|
|
1254
|
-
"superclass": {
|
|
1255
|
-
"name": "LitElement",
|
|
1256
|
-
"package": "lit"
|
|
1257
|
-
},
|
|
1258
|
-
"status": "draft",
|
|
1259
|
-
"category": "structure",
|
|
1260
|
-
"tagName": "nord-card",
|
|
1261
|
-
"customElement": true
|
|
1262
|
-
}
|
|
1263
|
-
],
|
|
1264
|
-
"exports": [
|
|
1265
|
-
{
|
|
1266
|
-
"kind": "js",
|
|
1267
|
-
"name": "default",
|
|
1268
|
-
"declaration": {
|
|
1269
|
-
"name": "Card",
|
|
1270
|
-
"module": "src/card/Card.ts"
|
|
1271
|
-
}
|
|
1272
|
-
},
|
|
1273
|
-
{
|
|
1274
|
-
"kind": "custom-element-definition",
|
|
1275
|
-
"name": "nord-card",
|
|
1276
|
-
"declaration": {
|
|
1277
|
-
"name": "Card",
|
|
1278
|
-
"module": "src/card/Card.ts"
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
],
|
|
1282
|
-
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to display content and actions on a single topic inside a container.\n- Use to visually separate specific parts of content in an application view.\n- Use to wrap a form into a container, for example a login form.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use when you need to capture user’s attention in a prominent way.\n- Don’t use to inform user about important changes or conditions in the interface.\n- Don’t use multiple primary buttons inside a card. A card should only contain a single primary action.\n\n</div>\n"
|
|
1283
|
-
},
|
|
1284
|
-
{
|
|
1285
|
-
"kind": "javascript-module",
|
|
1286
|
-
"path": "src/command-menu/CommandMenu.ts",
|
|
1287
|
-
"declarations": [
|
|
1288
|
-
{
|
|
1289
|
-
"kind": "class",
|
|
1290
|
-
"description": "Command Menu allows users to navigate and use an app without\ntouching the mouse and helps them transform into “power users”\nwho can harness more advanced features far faster.",
|
|
1291
|
-
"name": "CommandMenu",
|
|
1292
|
-
"slots": [
|
|
1293
|
-
{
|
|
1294
|
-
"description": "Used to replace the default footer contents.",
|
|
1295
|
-
"name": "footer"
|
|
1296
|
-
}
|
|
1297
|
-
],
|
|
1298
|
-
"members": [
|
|
1299
|
-
{
|
|
1300
|
-
"kind": "field",
|
|
1301
|
-
"name": "inputRef",
|
|
1302
|
-
"privacy": "private"
|
|
1303
1343
|
},
|
|
1304
1344
|
{
|
|
1305
1345
|
"kind": "field",
|
|
1306
|
-
"name": "
|
|
1307
|
-
"privacy": "
|
|
1346
|
+
"name": "labelSlot",
|
|
1347
|
+
"privacy": "protected",
|
|
1348
|
+
"default": "new SlotController(this, \"label\")",
|
|
1349
|
+
"inheritedFrom": {
|
|
1350
|
+
"name": "FormAssociatedMixin",
|
|
1351
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1352
|
+
}
|
|
1308
1353
|
},
|
|
1309
1354
|
{
|
|
1310
1355
|
"kind": "field",
|
|
1311
|
-
"name": "
|
|
1312
|
-
"
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1356
|
+
"name": "errorSlot",
|
|
1357
|
+
"privacy": "protected",
|
|
1358
|
+
"default": "new SlotController(this, \"error\")",
|
|
1359
|
+
"inheritedFrom": {
|
|
1360
|
+
"name": "FormAssociatedMixin",
|
|
1361
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1362
|
+
}
|
|
1316
1363
|
},
|
|
1317
1364
|
{
|
|
1318
1365
|
"kind": "field",
|
|
1319
|
-
"name": "
|
|
1320
|
-
"privacy": "
|
|
1321
|
-
"default": "new
|
|
1366
|
+
"name": "hintSlot",
|
|
1367
|
+
"privacy": "protected",
|
|
1368
|
+
"default": "new SlotController(this, \"hint\")",
|
|
1369
|
+
"inheritedFrom": {
|
|
1370
|
+
"name": "FormAssociatedMixin",
|
|
1371
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1372
|
+
}
|
|
1322
1373
|
},
|
|
1323
1374
|
{
|
|
1324
1375
|
"kind": "field",
|
|
1325
|
-
"name": "
|
|
1326
|
-
"privacy": "
|
|
1327
|
-
"default": "new
|
|
1376
|
+
"name": "formData",
|
|
1377
|
+
"privacy": "protected",
|
|
1378
|
+
"default": "new FormDataController(this, { value: () => this.formValue })",
|
|
1379
|
+
"inheritedFrom": {
|
|
1380
|
+
"name": "FormAssociatedMixin",
|
|
1381
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1382
|
+
}
|
|
1328
1383
|
},
|
|
1329
1384
|
{
|
|
1330
1385
|
"kind": "field",
|
|
1331
|
-
"name": "
|
|
1386
|
+
"name": "inputId",
|
|
1332
1387
|
"type": {
|
|
1333
|
-
"text": "
|
|
1388
|
+
"text": "string"
|
|
1334
1389
|
},
|
|
1335
|
-
"
|
|
1336
|
-
"
|
|
1337
|
-
"
|
|
1390
|
+
"privacy": "protected",
|
|
1391
|
+
"default": "\"input\"",
|
|
1392
|
+
"inheritedFrom": {
|
|
1393
|
+
"name": "FormAssociatedMixin",
|
|
1394
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1395
|
+
}
|
|
1338
1396
|
},
|
|
1339
1397
|
{
|
|
1340
1398
|
"kind": "field",
|
|
1341
|
-
"name": "
|
|
1399
|
+
"name": "errorId",
|
|
1342
1400
|
"type": {
|
|
1343
1401
|
"text": "string"
|
|
1344
1402
|
},
|
|
1345
|
-
"
|
|
1346
|
-
"
|
|
1347
|
-
"
|
|
1403
|
+
"privacy": "protected",
|
|
1404
|
+
"default": "\"error\"",
|
|
1405
|
+
"inheritedFrom": {
|
|
1406
|
+
"name": "FormAssociatedMixin",
|
|
1407
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1408
|
+
}
|
|
1348
1409
|
},
|
|
1349
1410
|
{
|
|
1350
1411
|
"kind": "field",
|
|
1351
|
-
"name": "
|
|
1412
|
+
"name": "hintId",
|
|
1352
1413
|
"type": {
|
|
1353
|
-
"text": "
|
|
1414
|
+
"text": "string"
|
|
1354
1415
|
},
|
|
1355
|
-
"
|
|
1356
|
-
"
|
|
1416
|
+
"privacy": "protected",
|
|
1417
|
+
"default": "\"hint\"",
|
|
1418
|
+
"inheritedFrom": {
|
|
1419
|
+
"name": "FormAssociatedMixin",
|
|
1420
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1421
|
+
}
|
|
1357
1422
|
},
|
|
1358
1423
|
{
|
|
1359
1424
|
"kind": "field",
|
|
1360
|
-
"name": "
|
|
1425
|
+
"name": "label",
|
|
1361
1426
|
"type": {
|
|
1362
|
-
"text": "string
|
|
1427
|
+
"text": "string"
|
|
1363
1428
|
},
|
|
1364
|
-
"
|
|
1429
|
+
"default": "\"\"",
|
|
1430
|
+
"description": "Label for the input.",
|
|
1431
|
+
"attribute": "label",
|
|
1432
|
+
"inheritedFrom": {
|
|
1433
|
+
"name": "FormAssociatedMixin",
|
|
1434
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1435
|
+
}
|
|
1365
1436
|
},
|
|
1366
1437
|
{
|
|
1367
1438
|
"kind": "field",
|
|
1368
|
-
"name": "
|
|
1439
|
+
"name": "hint",
|
|
1369
1440
|
"type": {
|
|
1370
|
-
"text": "string"
|
|
1441
|
+
"text": "string | undefined"
|
|
1371
1442
|
},
|
|
1372
|
-
"
|
|
1373
|
-
"
|
|
1443
|
+
"description": "Optional hint text to be displayed with the input. Alternatively use the hint slot.",
|
|
1444
|
+
"attribute": "hint",
|
|
1445
|
+
"inheritedFrom": {
|
|
1446
|
+
"name": "FormAssociatedMixin",
|
|
1447
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1448
|
+
}
|
|
1374
1449
|
},
|
|
1375
1450
|
{
|
|
1376
1451
|
"kind": "field",
|
|
1377
|
-
"name": "
|
|
1452
|
+
"name": "hideLabel",
|
|
1378
1453
|
"type": {
|
|
1379
1454
|
"text": "boolean"
|
|
1380
1455
|
},
|
|
1381
|
-
"
|
|
1382
|
-
"
|
|
1456
|
+
"default": "false",
|
|
1457
|
+
"description": "Visually hide the label, but still show it to assistive technologies like screen readers.",
|
|
1458
|
+
"attribute": "hide-label",
|
|
1459
|
+
"inheritedFrom": {
|
|
1460
|
+
"name": "FormAssociatedMixin",
|
|
1461
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1462
|
+
}
|
|
1383
1463
|
},
|
|
1384
1464
|
{
|
|
1385
1465
|
"kind": "field",
|
|
1386
|
-
"name": "
|
|
1466
|
+
"name": "placeholder",
|
|
1387
1467
|
"type": {
|
|
1388
|
-
"text": "
|
|
1468
|
+
"text": "string | undefined"
|
|
1389
1469
|
},
|
|
1390
|
-
"
|
|
1391
|
-
"
|
|
1470
|
+
"description": "Placeholder text to display within the input.",
|
|
1471
|
+
"attribute": "placeholder",
|
|
1472
|
+
"inheritedFrom": {
|
|
1473
|
+
"name": "FormAssociatedMixin",
|
|
1474
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1475
|
+
}
|
|
1392
1476
|
},
|
|
1393
1477
|
{
|
|
1394
1478
|
"kind": "field",
|
|
1395
|
-
"name": "
|
|
1479
|
+
"name": "error",
|
|
1396
1480
|
"type": {
|
|
1397
|
-
"text": "
|
|
1481
|
+
"text": "string | undefined"
|
|
1398
1482
|
},
|
|
1399
|
-
"
|
|
1400
|
-
"
|
|
1483
|
+
"description": "Optional error to be shown with the input. Alternatively use the error slot.",
|
|
1484
|
+
"attribute": "error",
|
|
1485
|
+
"inheritedFrom": {
|
|
1486
|
+
"name": "FormAssociatedMixin",
|
|
1487
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1488
|
+
}
|
|
1401
1489
|
},
|
|
1402
1490
|
{
|
|
1403
1491
|
"kind": "field",
|
|
1404
|
-
"name": "
|
|
1492
|
+
"name": "required",
|
|
1405
1493
|
"type": {
|
|
1406
|
-
"text": "
|
|
1494
|
+
"text": "boolean"
|
|
1407
1495
|
},
|
|
1408
|
-
"
|
|
1496
|
+
"default": "false",
|
|
1497
|
+
"description": "Determines whether the input is required or not.\nAn input marked as required will be announced as such to users of assistive technology.\nWhen using this property you need to also set “novalidate” attribute on a form element to prevent browser from displaying its own validation errors.",
|
|
1498
|
+
"attribute": "required",
|
|
1499
|
+
"inheritedFrom": {
|
|
1500
|
+
"name": "FormAssociatedMixin",
|
|
1501
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1502
|
+
}
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
"kind": "field",
|
|
1506
|
+
"name": "expand",
|
|
1507
|
+
"type": {
|
|
1508
|
+
"text": "boolean"
|
|
1509
|
+
},
|
|
1510
|
+
"default": "false",
|
|
1511
|
+
"description": "Controls whether the input expands to fill the width of its container.",
|
|
1512
|
+
"attribute": "expand",
|
|
1513
|
+
"reflects": true,
|
|
1514
|
+
"inheritedFrom": {
|
|
1515
|
+
"name": "FormAssociatedMixin",
|
|
1516
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1517
|
+
}
|
|
1409
1518
|
},
|
|
1410
1519
|
{
|
|
1411
1520
|
"kind": "method",
|
|
1412
|
-
"name": "
|
|
1521
|
+
"name": "handleInput",
|
|
1522
|
+
"privacy": "protected",
|
|
1413
1523
|
"parameters": [
|
|
1414
1524
|
{
|
|
1415
|
-
"name": "
|
|
1416
|
-
"default": "{}",
|
|
1525
|
+
"name": "e",
|
|
1417
1526
|
"type": {
|
|
1418
|
-
"text": "
|
|
1419
|
-
}
|
|
1420
|
-
"description": "allows you to open the menu filtered to a specific parent command."
|
|
1527
|
+
"text": "Event"
|
|
1528
|
+
}
|
|
1421
1529
|
}
|
|
1422
1530
|
],
|
|
1423
|
-
"
|
|
1531
|
+
"inheritedFrom": {
|
|
1532
|
+
"name": "FormAssociatedMixin",
|
|
1533
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1534
|
+
}
|
|
1424
1535
|
},
|
|
1425
1536
|
{
|
|
1426
1537
|
"kind": "method",
|
|
1427
|
-
"name": "
|
|
1428
|
-
"
|
|
1538
|
+
"name": "renderLabel",
|
|
1539
|
+
"privacy": "protected",
|
|
1540
|
+
"inheritedFrom": {
|
|
1541
|
+
"name": "FormAssociatedMixin",
|
|
1542
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1543
|
+
}
|
|
1429
1544
|
},
|
|
1430
1545
|
{
|
|
1431
1546
|
"kind": "method",
|
|
1432
|
-
"name": "
|
|
1433
|
-
"
|
|
1547
|
+
"name": "renderError",
|
|
1548
|
+
"privacy": "protected",
|
|
1549
|
+
"inheritedFrom": {
|
|
1550
|
+
"name": "FormAssociatedMixin",
|
|
1551
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1552
|
+
}
|
|
1434
1553
|
},
|
|
1435
1554
|
{
|
|
1436
1555
|
"kind": "method",
|
|
1437
|
-
"name": "
|
|
1438
|
-
"
|
|
1556
|
+
"name": "getDescribedBy",
|
|
1557
|
+
"privacy": "protected",
|
|
1558
|
+
"inheritedFrom": {
|
|
1559
|
+
"name": "FormAssociatedMixin",
|
|
1560
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1561
|
+
}
|
|
1439
1562
|
},
|
|
1440
1563
|
{
|
|
1441
1564
|
"kind": "method",
|
|
1442
|
-
"name": "
|
|
1443
|
-
"privacy": "
|
|
1565
|
+
"name": "getInvalid",
|
|
1566
|
+
"privacy": "protected",
|
|
1567
|
+
"inheritedFrom": {
|
|
1568
|
+
"name": "FormAssociatedMixin",
|
|
1569
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1570
|
+
}
|
|
1444
1571
|
},
|
|
1445
1572
|
{
|
|
1446
|
-
"kind": "
|
|
1447
|
-
"name": "
|
|
1448
|
-
"privacy": "
|
|
1449
|
-
"
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
"text": "string | undefined"
|
|
1454
|
-
}
|
|
1455
|
-
},
|
|
1456
|
-
{
|
|
1457
|
-
"name": "commands",
|
|
1458
|
-
"type": {
|
|
1459
|
-
"text": "ICommandMenuAction[]"
|
|
1460
|
-
}
|
|
1461
|
-
}
|
|
1462
|
-
]
|
|
1573
|
+
"kind": "field",
|
|
1574
|
+
"name": "hasHint",
|
|
1575
|
+
"privacy": "protected",
|
|
1576
|
+
"inheritedFrom": {
|
|
1577
|
+
"name": "FormAssociatedMixin",
|
|
1578
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1579
|
+
}
|
|
1463
1580
|
},
|
|
1464
1581
|
{
|
|
1465
|
-
"kind": "
|
|
1466
|
-
"name": "
|
|
1467
|
-
"privacy": "
|
|
1582
|
+
"kind": "field",
|
|
1583
|
+
"name": "hasError",
|
|
1584
|
+
"privacy": "protected",
|
|
1585
|
+
"inheritedFrom": {
|
|
1586
|
+
"name": "FormAssociatedMixin",
|
|
1587
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1588
|
+
}
|
|
1468
1589
|
},
|
|
1469
1590
|
{
|
|
1470
|
-
"kind": "
|
|
1471
|
-
"name": "
|
|
1472
|
-
"
|
|
1591
|
+
"kind": "field",
|
|
1592
|
+
"name": "disabled",
|
|
1593
|
+
"type": {
|
|
1594
|
+
"text": "boolean"
|
|
1595
|
+
},
|
|
1596
|
+
"default": "false",
|
|
1597
|
+
"description": "Makes the component disabled. This prevents users from\nbeing able to interact with the component, and conveys\nits inactive state to assistive technologies.",
|
|
1598
|
+
"attribute": "disabled",
|
|
1599
|
+
"reflects": true,
|
|
1600
|
+
"inheritedFrom": {
|
|
1601
|
+
"name": "InputMixin",
|
|
1602
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1603
|
+
}
|
|
1473
1604
|
},
|
|
1474
1605
|
{
|
|
1475
|
-
"kind": "
|
|
1476
|
-
"name": "
|
|
1477
|
-
"
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1606
|
+
"kind": "field",
|
|
1607
|
+
"name": "name",
|
|
1608
|
+
"type": {
|
|
1609
|
+
"text": "string | undefined"
|
|
1610
|
+
},
|
|
1611
|
+
"description": "The name of the form component.",
|
|
1612
|
+
"attribute": "name",
|
|
1613
|
+
"inheritedFrom": {
|
|
1614
|
+
"name": "InputMixin",
|
|
1615
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1616
|
+
}
|
|
1486
1617
|
},
|
|
1487
1618
|
{
|
|
1488
|
-
"kind": "
|
|
1489
|
-
"name": "
|
|
1490
|
-
"
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
},
|
|
1501
|
-
{
|
|
1502
|
-
"kind": "method",
|
|
1503
|
-
"name": "start",
|
|
1504
|
-
"privacy": "private"
|
|
1505
|
-
},
|
|
1506
|
-
{
|
|
1507
|
-
"kind": "method",
|
|
1508
|
-
"name": "end",
|
|
1509
|
-
"privacy": "private"
|
|
1510
|
-
},
|
|
1511
|
-
{
|
|
1512
|
-
"kind": "method",
|
|
1513
|
-
"name": "next",
|
|
1514
|
-
"privacy": "private"
|
|
1619
|
+
"kind": "field",
|
|
1620
|
+
"name": "value",
|
|
1621
|
+
"type": {
|
|
1622
|
+
"text": "string"
|
|
1623
|
+
},
|
|
1624
|
+
"default": "\"\"",
|
|
1625
|
+
"description": "The value of the form component.",
|
|
1626
|
+
"attribute": "value",
|
|
1627
|
+
"inheritedFrom": {
|
|
1628
|
+
"name": "InputMixin",
|
|
1629
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1630
|
+
}
|
|
1515
1631
|
},
|
|
1516
1632
|
{
|
|
1517
|
-
"kind": "
|
|
1518
|
-
"name": "
|
|
1519
|
-
"privacy": "
|
|
1633
|
+
"kind": "field",
|
|
1634
|
+
"name": "form",
|
|
1635
|
+
"privacy": "protected",
|
|
1636
|
+
"description": "Gets the form, if any, associated with the form element.",
|
|
1637
|
+
"inheritedFrom": {
|
|
1638
|
+
"name": "InputMixin",
|
|
1639
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1640
|
+
}
|
|
1520
1641
|
},
|
|
1521
1642
|
{
|
|
1522
|
-
"kind": "
|
|
1523
|
-
"name": "
|
|
1524
|
-
"privacy": "
|
|
1643
|
+
"kind": "field",
|
|
1644
|
+
"name": "focusableRef",
|
|
1645
|
+
"privacy": "protected",
|
|
1646
|
+
"inheritedFrom": {
|
|
1647
|
+
"name": "FocusableMixin",
|
|
1648
|
+
"module": "src/common/mixins/FocusableMixin.ts"
|
|
1649
|
+
}
|
|
1525
1650
|
},
|
|
1526
1651
|
{
|
|
1527
1652
|
"kind": "method",
|
|
1528
|
-
"name": "
|
|
1529
|
-
"privacy": "private",
|
|
1653
|
+
"name": "focus",
|
|
1530
1654
|
"parameters": [
|
|
1531
1655
|
{
|
|
1532
|
-
"name": "
|
|
1656
|
+
"name": "options",
|
|
1533
1657
|
"optional": true,
|
|
1534
1658
|
"type": {
|
|
1535
|
-
"text": "
|
|
1536
|
-
}
|
|
1659
|
+
"text": "FocusOptions"
|
|
1660
|
+
},
|
|
1661
|
+
"description": "An object which controls aspects of the focusing process."
|
|
1537
1662
|
}
|
|
1538
|
-
]
|
|
1663
|
+
],
|
|
1664
|
+
"description": "Programmatically move focus to the component.",
|
|
1665
|
+
"inheritedFrom": {
|
|
1666
|
+
"name": "FocusableMixin",
|
|
1667
|
+
"module": "src/common/mixins/FocusableMixin.ts"
|
|
1668
|
+
}
|
|
1539
1669
|
},
|
|
1540
1670
|
{
|
|
1541
1671
|
"kind": "method",
|
|
1542
|
-
"name": "
|
|
1543
|
-
"
|
|
1544
|
-
"
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
"text": "string"
|
|
1549
|
-
}
|
|
1550
|
-
}
|
|
1551
|
-
]
|
|
1672
|
+
"name": "blur",
|
|
1673
|
+
"description": "Programmatically remove focus from the component.",
|
|
1674
|
+
"inheritedFrom": {
|
|
1675
|
+
"name": "FocusableMixin",
|
|
1676
|
+
"module": "src/common/mixins/FocusableMixin.ts"
|
|
1677
|
+
}
|
|
1552
1678
|
},
|
|
1553
1679
|
{
|
|
1554
1680
|
"kind": "method",
|
|
1555
|
-
"name": "
|
|
1556
|
-
"
|
|
1681
|
+
"name": "click",
|
|
1682
|
+
"description": "Programmatically simulates a click on the component.",
|
|
1683
|
+
"inheritedFrom": {
|
|
1684
|
+
"name": "FocusableMixin",
|
|
1685
|
+
"module": "src/common/mixins/FocusableMixin.ts"
|
|
1686
|
+
}
|
|
1557
1687
|
},
|
|
1558
1688
|
{
|
|
1559
1689
|
"kind": "field",
|
|
@@ -1570,148 +1700,193 @@
|
|
|
1570
1700
|
}
|
|
1571
1701
|
}
|
|
1572
1702
|
],
|
|
1573
|
-
"
|
|
1703
|
+
"attributes": [
|
|
1574
1704
|
{
|
|
1575
|
-
"name": "
|
|
1705
|
+
"name": "checked",
|
|
1576
1706
|
"type": {
|
|
1577
|
-
"text": "
|
|
1707
|
+
"text": "boolean"
|
|
1578
1708
|
},
|
|
1579
|
-
"
|
|
1709
|
+
"default": "false",
|
|
1710
|
+
"description": "Controls whether the checkbox is checked or not.",
|
|
1711
|
+
"fieldName": "checked"
|
|
1580
1712
|
},
|
|
1581
1713
|
{
|
|
1582
|
-
"name": "
|
|
1714
|
+
"name": "label",
|
|
1583
1715
|
"type": {
|
|
1584
|
-
"text": "
|
|
1716
|
+
"text": "string"
|
|
1585
1717
|
},
|
|
1586
|
-
"
|
|
1718
|
+
"default": "\"\"",
|
|
1719
|
+
"description": "Label for the input.",
|
|
1720
|
+
"fieldName": "label",
|
|
1721
|
+
"inheritedFrom": {
|
|
1722
|
+
"name": "FormAssociatedMixin",
|
|
1723
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1724
|
+
}
|
|
1587
1725
|
},
|
|
1588
1726
|
{
|
|
1727
|
+
"name": "hint",
|
|
1589
1728
|
"type": {
|
|
1590
|
-
"text": "
|
|
1729
|
+
"text": "string | undefined"
|
|
1591
1730
|
},
|
|
1592
|
-
"description": "
|
|
1593
|
-
"
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1731
|
+
"description": "Optional hint text to be displayed with the input. Alternatively use the hint slot.",
|
|
1732
|
+
"fieldName": "hint",
|
|
1733
|
+
"inheritedFrom": {
|
|
1734
|
+
"name": "FormAssociatedMixin",
|
|
1735
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1736
|
+
}
|
|
1737
|
+
},
|
|
1597
1738
|
{
|
|
1598
|
-
"name": "
|
|
1739
|
+
"name": "hide-label",
|
|
1599
1740
|
"type": {
|
|
1600
1741
|
"text": "boolean"
|
|
1601
1742
|
},
|
|
1602
1743
|
"default": "false",
|
|
1603
|
-
"description": "
|
|
1604
|
-
"fieldName": "
|
|
1744
|
+
"description": "Visually hide the label, but still show it to assistive technologies like screen readers.",
|
|
1745
|
+
"fieldName": "hideLabel",
|
|
1746
|
+
"inheritedFrom": {
|
|
1747
|
+
"name": "FormAssociatedMixin",
|
|
1748
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1749
|
+
}
|
|
1605
1750
|
},
|
|
1606
1751
|
{
|
|
1607
1752
|
"name": "placeholder",
|
|
1608
1753
|
"type": {
|
|
1609
|
-
"text": "string"
|
|
1754
|
+
"text": "string | undefined"
|
|
1610
1755
|
},
|
|
1611
|
-
"
|
|
1612
|
-
"
|
|
1613
|
-
"
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
"name": "DraftComponentMixin",
|
|
1619
|
-
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
1620
|
-
}
|
|
1621
|
-
],
|
|
1622
|
-
"superclass": {
|
|
1623
|
-
"name": "LitElement",
|
|
1624
|
-
"package": "lit"
|
|
1625
|
-
},
|
|
1626
|
-
"status": "draft",
|
|
1627
|
-
"category": "action",
|
|
1628
|
-
"tagName": "nord-command-menu",
|
|
1629
|
-
"customElement": true
|
|
1630
|
-
}
|
|
1631
|
-
],
|
|
1632
|
-
"exports": [
|
|
1633
|
-
{
|
|
1634
|
-
"kind": "js",
|
|
1635
|
-
"name": "default",
|
|
1636
|
-
"declaration": {
|
|
1637
|
-
"name": "CommandMenu",
|
|
1638
|
-
"module": "src/command-menu/CommandMenu.ts"
|
|
1639
|
-
}
|
|
1640
|
-
},
|
|
1641
|
-
{
|
|
1642
|
-
"kind": "custom-element-definition",
|
|
1643
|
-
"name": "nord-command-menu",
|
|
1644
|
-
"declaration": {
|
|
1645
|
-
"name": "CommandMenu",
|
|
1646
|
-
"module": "src/command-menu/CommandMenu.ts"
|
|
1647
|
-
}
|
|
1648
|
-
}
|
|
1649
|
-
],
|
|
1650
|
-
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to provide global and contextual keyboard shortcuts for users.\n- Make command menu available everywhere. Users must be able to bring up the command menu easily.\n- Make command menu central. Users should be able to find global shortcuts from one location.\n- Make command menu omnipotent. Give users access to every possible action.\n- Group related commands logically under sections with the section setting.\n- Use `Alt` key as the modifier, since this is less likely to clash with existing shortcuts.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make command menu available only in certain views of the application.\n- Don’t define shortcuts such as `Ctrl+C`, since this will clash with the native \"Copy\" shortcut.\n- Don't create complex shortcuts, as users will struggle to remember them.\n- Avoid using `KeyboardEvent.key` for defining the shortcut keys.\n- Don’t use as a search field only.\n\n</div>\n\n---\n\n## Content guidelines\n\nCommand titles should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they execute a command:\n\n<div class=\"n-usage n-usage-do\">Start consultation</div>\n<div class=\"n-usage n-usage-dont\">Consultation</div>\n\nAlways lead with a strong verb that encourages action. To provide enough context to user, use the {verb} + {noun} content formula:\n\n<div class=\"n-usage n-usage-do\">Open dashboard</div>\n<div class=\"n-usage n-usage-dont\">Dashboard</div>\n\nWhen writing command titles, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">New appointment</div>\n<div class=\"n-usage n-usage-dont\">New Appointment</div>\n\nAvoid unnecessary words and articles in command titles, such as “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Change theme</div>\n<div class=\"n-usage n-usage-dont\">Change the theme</div>\n\nAvoid ending in punctuation:\n\n<div class=\"n-usage n-usage-do\">Switch user</div>\n<div class=\"n-usage n-usage-dont\">Switch user.</div>\n\nUse ellipsis in the title when describing sections that have commands grouped inside of them:\n\n<div class=\"n-usage n-usage-do\">Change theme…</div>\n<div class=\"n-usage n-usage-dont\">Change theme</div>\n\n---\n\n## Commands data\n\nEach command in the `commands` data array must include at least an `id` and `title`. A command may also include properties for `section`, `icon`, `handler`, `shortcut` , `parent`, and `keywords`:\n\n| Name | Purpose |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | An identifier for each command, must be unique. Example: `id: \"user\"`. |\n| `title` | The title shown to users. This is used when searching for a command. Example: `title: \"Change theme...\"`. |\n| `keywords` | Not visible in the user interface, but can make it easier to discover commands through search. Example: `keywords: \"command change log sign out in\"`. |\n| `shortcut` | The keyboard shortcut. Example: `shortcut: \"Alt+KeyU\"`. See the sections [Defining Shortcuts](#defining-shortcuts) and [Choosing shortcuts](#choosing-shortcuts) below for more information. |\n| `section` | Used for grouping many commands under a common header. Example: `section: \"Commands\"`. |\n| `icon` | A name of an icon form Nordicons to show beside the title. If not specified, default command icon will be used instead. Example: `icon: \"file-picture\"`. |\n| `parent` | The `id` of a parent command. This is used for nesting commands. Example: `parent: \"theme\"`. |\n| `handler` | A function to execute when an user triggers a command. Example: `handler: () => { alert(\"Change to light theme\") }`. In cases where a command is only used as a parent command e.g. \"Change theme\", this is not required. |\n\n---\n\n## Defining shortcuts\n\nShortcuts in the Command Menu have the following form: `[modifier]+[key]`. Shortcuts are made up of a sequence of presses. A press can be as simple as a single key which matches against [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values):\n\n```js\n// Matches: event.code:\n\"KeyD\"\n```\n\nPresses can optionally be prefixed with **_modifiers_** which match against any valid value to [`KeyboardEvent.getModifierState()`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).\n\n```js\n\"Control+KeyD\"\n\"Meta+KeyD\"\n\"Shift+KeyD\"\n\"Alt+KeyD\"\n\"Meta+Shift+KeyD\"\n```\n\nThere is also a special `$mod` modifier that makes it easy to support cross platform keybindings:\n\n- Mac: `$mod` = `Meta` (⌘)\n- Windows/Linux: `$mod` = `Control`\n\n```js\n\"$mod+KeyD\" // ⌘/Ctrl + D\n\"$mod+Shift+KeyD\" // ⌘/Ctrl + Shift + D\n```\n\nThe Command Menu itself can be opened using `⌘+k` (or `Ctrl+k` on Windows) and closed by hitting `Esc`. These are both non-configurable shortcuts in order to unify the experience across our platforms.\n\n---\n\n## Choosing shortcuts\n\nWhen choosing shortcuts, it is very important that they do not clash with native operating system or browser shortcuts.\n\nFor example, you _should not_ define a shortcut like `$mod+KeyC`, since this will clash with the native “Copy” shortcut, and will be triggered every time a user copies text in the app. Nor should you use shortcuts like `Shift+KeyA` since this will get triggered whenever a user types an uppercase “A” character. Therefore, special care and attention must be given to _each and every_ shortcut choice.\n\nIn general, we recommend using the `Alt` modifier, since this is less likely to clash with existing shortcuts. However, be aware, the `Alt` key is also used for accented characters e.g. `Alt+KeyA` produces the letter “å”. Again, it is crucial that you choose shortcuts carefully.\n\nYou should strive to choose shortcuts that are intuitive and easy to remember. The more complex a shortcut, the less likely a user is to remember it. Of course, a user can still find a command by searching the command menu, and for some users this may be their preferred way of triggering commands.\n\n---\n\n## Common keybindings\n\nKeybindings will be matched against [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) and [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values) which may have some names you don’t expect. Please note that we recommend always using `KeyboardEvent.code` for defining the keys and only using `KeyboardEvent.key` for defining modifiers.\n\n| Windows | macOS | key | code |\n| ------------- | --------------- | ------------- | ------------------------------ |\n| N/A | `Command` / `⌘` | `Meta` | `MetaLeft` / `MetaRight` |\n| `Alt` | `Option` / `⌥` | `Alt` | `AltLeft` / `AltRight` |\n| `Control` | `Control` / `^` | `Control` | `ControlLeft` / `ControlRight` |\n| `Shift` | `Shift` | `Shift` | `ShiftLeft` / `ShiftRight` |\n| `Space` | `Space` | N/A | `Space` |\n| `Enter` | `Return` | `Enter` | `Enter` |\n| `Esc` | `Esc` | `Escape` | `Escape` |\n| `1`, `2`, etc | `1`, `2`, etc | `1`, `2`, etc | `Digit1`, `Digit2`, etc |\n| `a`, `b`, etc | `a`, `b`, etc | `a`, `b`, etc | `KeyA`, `KeyB`, etc |\n| `-` | `-` | `-` | `Minus` |\n| `=` | `=` | `=` | `Equal` |\n| `+` | `+` | `+` | `Equal`\\* |\n\nIn addition to the above table, you can use [https://keycode.info/](https://keycode.info/) for checking the specific values needed. Note that some keys will have the same code as others because they appear on the same key on the keyboard. Keep in mind how this is affected by international keyboards which may have different layouts.\n\n---\n\n## Navigating with the command menu\n\n1. Use `Ctrl+K` (Windows/Linux) or `Cmd+K` (Mac) to open the command menu.\n2. Start typing the command you want to execute. The suggestions in the command menu change to match your text.\n3. Finish entering the name, or use the arrow keys to highlight the command you want from the list of suggestions.\n4. Use `Enter` to execute the chosen command.\n5. If you chose a command that has nested commands, you can use `Backspace` to return to the previous menu.\n6. When the command menu is active, you can use one of the following keyboard shortcuts to close it: `Esc`, `Ctrl+K` (Windows and Linux) or `Cmd+K` (Mac).\n"
|
|
1651
|
-
},
|
|
1652
|
-
{
|
|
1653
|
-
"kind": "javascript-module",
|
|
1654
|
-
"path": "src/command-menu/CommandMenuAction.ts",
|
|
1655
|
-
"declarations": [
|
|
1656
|
-
{
|
|
1657
|
-
"kind": "class",
|
|
1658
|
-
"description": "Command Menu Action displays a single action that can be executed by the user. For usage examples, please see Command Menu component.",
|
|
1659
|
-
"name": "CommandMenuAction",
|
|
1660
|
-
"members": [
|
|
1756
|
+
"description": "Placeholder text to display within the input.",
|
|
1757
|
+
"fieldName": "placeholder",
|
|
1758
|
+
"inheritedFrom": {
|
|
1759
|
+
"name": "FormAssociatedMixin",
|
|
1760
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1761
|
+
}
|
|
1762
|
+
},
|
|
1661
1763
|
{
|
|
1662
|
-
"
|
|
1663
|
-
"name": "command",
|
|
1764
|
+
"name": "error",
|
|
1664
1765
|
"type": {
|
|
1665
|
-
"text": "
|
|
1766
|
+
"text": "string | undefined"
|
|
1666
1767
|
},
|
|
1667
|
-
"
|
|
1768
|
+
"description": "Optional error to be shown with the input. Alternatively use the error slot.",
|
|
1769
|
+
"fieldName": "error",
|
|
1770
|
+
"inheritedFrom": {
|
|
1771
|
+
"name": "FormAssociatedMixin",
|
|
1772
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1773
|
+
}
|
|
1668
1774
|
},
|
|
1669
1775
|
{
|
|
1670
|
-
"
|
|
1671
|
-
"name": "selected",
|
|
1776
|
+
"name": "required",
|
|
1672
1777
|
"type": {
|
|
1673
1778
|
"text": "boolean"
|
|
1674
1779
|
},
|
|
1675
1780
|
"default": "false",
|
|
1676
|
-
"
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
"description": "Scroll to show element"
|
|
1781
|
+
"description": "Determines whether the input is required or not.\nAn input marked as required will be announced as such to users of assistive technology.\nWhen using this property you need to also set “novalidate” attribute on a form element to prevent browser from displaying its own validation errors.",
|
|
1782
|
+
"fieldName": "required",
|
|
1783
|
+
"inheritedFrom": {
|
|
1784
|
+
"name": "FormAssociatedMixin",
|
|
1785
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1786
|
+
}
|
|
1683
1787
|
},
|
|
1684
1788
|
{
|
|
1685
|
-
"
|
|
1686
|
-
"name": "renderShortcut",
|
|
1687
|
-
"privacy": "private"
|
|
1688
|
-
}
|
|
1689
|
-
],
|
|
1690
|
-
"attributes": [
|
|
1691
|
-
{
|
|
1692
|
-
"name": "command",
|
|
1789
|
+
"name": "expand",
|
|
1693
1790
|
"type": {
|
|
1694
|
-
"text": "
|
|
1791
|
+
"text": "boolean"
|
|
1695
1792
|
},
|
|
1696
|
-
"
|
|
1793
|
+
"default": "false",
|
|
1794
|
+
"description": "Controls whether the input expands to fill the width of its container.",
|
|
1795
|
+
"fieldName": "expand",
|
|
1796
|
+
"inheritedFrom": {
|
|
1797
|
+
"name": "FormAssociatedMixin",
|
|
1798
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1799
|
+
}
|
|
1697
1800
|
},
|
|
1698
1801
|
{
|
|
1699
|
-
"name": "
|
|
1802
|
+
"name": "disabled",
|
|
1700
1803
|
"type": {
|
|
1701
1804
|
"text": "boolean"
|
|
1702
1805
|
},
|
|
1703
1806
|
"default": "false",
|
|
1704
|
-
"
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1807
|
+
"description": "Makes the component disabled. This prevents users from\nbeing able to interact with the component, and conveys\nits inactive state to assistive technologies.",
|
|
1808
|
+
"fieldName": "disabled",
|
|
1809
|
+
"inheritedFrom": {
|
|
1810
|
+
"name": "InputMixin",
|
|
1811
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1812
|
+
}
|
|
1813
|
+
},
|
|
1814
|
+
{
|
|
1815
|
+
"name": "name",
|
|
1816
|
+
"type": {
|
|
1817
|
+
"text": "string | undefined"
|
|
1818
|
+
},
|
|
1819
|
+
"description": "The name of the form component.",
|
|
1820
|
+
"fieldName": "name",
|
|
1821
|
+
"inheritedFrom": {
|
|
1822
|
+
"name": "InputMixin",
|
|
1823
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1824
|
+
}
|
|
1825
|
+
},
|
|
1826
|
+
{
|
|
1827
|
+
"name": "value",
|
|
1828
|
+
"type": {
|
|
1829
|
+
"text": "string"
|
|
1830
|
+
},
|
|
1831
|
+
"default": "\"\"",
|
|
1832
|
+
"description": "The value of the form component.",
|
|
1833
|
+
"fieldName": "value",
|
|
1834
|
+
"inheritedFrom": {
|
|
1835
|
+
"name": "InputMixin",
|
|
1836
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1837
|
+
}
|
|
1838
|
+
}
|
|
1839
|
+
],
|
|
1840
|
+
"mixins": [
|
|
1841
|
+
{
|
|
1842
|
+
"name": "FormAssociatedMixin",
|
|
1843
|
+
"module": "/src/common/mixins/FormAssociatedMixin.js"
|
|
1844
|
+
},
|
|
1845
|
+
{
|
|
1846
|
+
"name": "InputMixin",
|
|
1847
|
+
"module": "/src/common/mixins/InputMixin.js"
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
"name": "FocusableMixin",
|
|
1851
|
+
"module": "/src/common/mixins/FocusableMixin.js"
|
|
1852
|
+
},
|
|
1853
|
+
{
|
|
1854
|
+
"name": "DraftComponentMixin",
|
|
1855
|
+
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
1856
|
+
}
|
|
1857
|
+
],
|
|
1858
|
+
"superclass": {
|
|
1859
|
+
"name": "LitElement",
|
|
1860
|
+
"package": "lit"
|
|
1710
1861
|
},
|
|
1711
|
-
"status": "
|
|
1712
|
-
"category":
|
|
1713
|
-
"tagName": "nord-
|
|
1714
|
-
"customElement": true
|
|
1862
|
+
"status": "draft",
|
|
1863
|
+
"category": "form",
|
|
1864
|
+
"tagName": "nord-checkbox",
|
|
1865
|
+
"customElement": true,
|
|
1866
|
+
"events": [
|
|
1867
|
+
{
|
|
1868
|
+
"name": "input",
|
|
1869
|
+
"type": {
|
|
1870
|
+
"text": "NordEvent"
|
|
1871
|
+
},
|
|
1872
|
+
"description": "Fired as the user types into the input.",
|
|
1873
|
+
"inheritedFrom": {
|
|
1874
|
+
"name": "FormAssociatedMixin",
|
|
1875
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1876
|
+
}
|
|
1877
|
+
},
|
|
1878
|
+
{
|
|
1879
|
+
"name": "change",
|
|
1880
|
+
"type": {
|
|
1881
|
+
"text": "NordEvent"
|
|
1882
|
+
},
|
|
1883
|
+
"description": "Fired whenever the input's value is changed via user interaction.",
|
|
1884
|
+
"inheritedFrom": {
|
|
1885
|
+
"name": "FormAssociatedMixin",
|
|
1886
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1887
|
+
}
|
|
1888
|
+
}
|
|
1889
|
+
]
|
|
1715
1890
|
}
|
|
1716
1891
|
],
|
|
1717
1892
|
"exports": [
|
|
@@ -1719,544 +1894,402 @@
|
|
|
1719
1894
|
"kind": "js",
|
|
1720
1895
|
"name": "default",
|
|
1721
1896
|
"declaration": {
|
|
1722
|
-
"name": "
|
|
1723
|
-
"module": "src/
|
|
1897
|
+
"name": "Checkbox",
|
|
1898
|
+
"module": "src/checkbox/Checkbox.ts"
|
|
1724
1899
|
}
|
|
1725
1900
|
},
|
|
1726
1901
|
{
|
|
1727
1902
|
"kind": "custom-element-definition",
|
|
1728
|
-
"name": "nord-
|
|
1903
|
+
"name": "nord-checkbox",
|
|
1729
1904
|
"declaration": {
|
|
1730
|
-
"name": "
|
|
1731
|
-
"module": "src/
|
|
1905
|
+
"name": "Checkbox",
|
|
1906
|
+
"module": "src/checkbox/Checkbox.ts"
|
|
1732
1907
|
}
|
|
1733
1908
|
}
|
|
1734
1909
|
],
|
|
1735
|
-
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to provide global and contextual keyboard shortcuts for users.\n- Make command menu available everywhere. Users must be able to bring up the command menu easily.\n- Make command menu central. Users should be able to find global shortcuts from one location.\n- Make command menu omnipotent. Give users access to every possible action.\n- Group related commands logically under sections with the section setting.\n- Use `Alt` key as the modifier, since this is less likely to clash with existing shortcuts.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make command menu available only in certain views of the application.\n- Don’t define shortcuts such as `Ctrl+C`, since this will clash with the native \"Copy\" shortcut.\n- Don't create complex shortcuts, as users will struggle to remember them.\n- Avoid using `KeyboardEvent.key` for defining the shortcut keys.\n- Don’t use as a search field only.\n\n</div>\n\n---\n\n## Content guidelines\n\nCommand titles should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they execute a command:\n\n<div class=\"n-usage n-usage-do\">Start consultation</div>\n<div class=\"n-usage n-usage-dont\">Consultation</div>\n\nAlways lead with a strong verb that encourages action. To provide enough context to user, use the {verb} + {noun} content formula:\n\n<div class=\"n-usage n-usage-do\">Open dashboard</div>\n<div class=\"n-usage n-usage-dont\">Dashboard</div>\n\nWhen writing command titles, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">New appointment</div>\n<div class=\"n-usage n-usage-dont\">New Appointment</div>\n\nAvoid unnecessary words and articles in command titles, such as “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Change theme</div>\n<div class=\"n-usage n-usage-dont\">Change the theme</div>\n\nAvoid ending in punctuation:\n\n<div class=\"n-usage n-usage-do\">Switch user</div>\n<div class=\"n-usage n-usage-dont\">Switch user.</div>\n\nUse ellipsis in the title when describing sections that have commands grouped inside of them:\n\n<div class=\"n-usage n-usage-do\">Change theme…</div>\n<div class=\"n-usage n-usage-dont\">Change theme</div>\n\n---\n\n## Commands data\n\nEach command in the `commands` data array must include at least an `id` and `title`. A command may also include properties for `section`, `icon`, `handler`, `shortcut` , `parent`, and `keywords`:\n\n| Name | Purpose |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | An identifier for each command, must be unique. Example: `id: \"user\"`. |\n| `title` | The title shown to users. This is used when searching for a command. Example: `title: \"Change theme...\"`. |\n| `keywords` | Not visible in the user interface, but can make it easier to discover commands through search. Example: `keywords: \"command change log sign out in\"`. |\n| `shortcut` | The keyboard shortcut. Example: `shortcut: \"Alt+KeyU\"`. See the sections [Defining Shortcuts](#defining-shortcuts) and [Choosing shortcuts](#choosing-shortcuts) below for more information. |\n| `section` | Used for grouping many commands under a common header. Example: `section: \"Commands\"`. |\n| `icon` | A name of an icon form Nordicons to show beside the title. If not specified, default command icon will be used instead. Example: `icon: \"file-picture\"`. |\n| `parent` | The `id` of a parent command. This is used for nesting commands. Example: `parent: \"theme\"`. |\n| `handler` | A function to execute when an user triggers a command. Example: `handler: () => { alert(\"Change to light theme\") }`. In cases where a command is only used as a parent command e.g. \"Change theme\", this is not required. |\n\n---\n\n## Defining shortcuts\n\nShortcuts in the Command Menu have the following form: `[modifier]+[key]`. Shortcuts are made up of a sequence of presses. A press can be as simple as a single key which matches against [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values):\n\n```js\n// Matches: event.code:\n\"KeyD\"\n```\n\nPresses can optionally be prefixed with **_modifiers_** which match against any valid value to [`KeyboardEvent.getModifierState()`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).\n\n```js\n\"Control+KeyD\"\n\"Meta+KeyD\"\n\"Shift+KeyD\"\n\"Alt+KeyD\"\n\"Meta+Shift+KeyD\"\n```\n\nThere is also a special `$mod` modifier that makes it easy to support cross platform keybindings:\n\n- Mac: `$mod` = `Meta` (⌘)\n- Windows/Linux: `$mod` = `Control`\n\n```js\n\"$mod+KeyD\" // ⌘/Ctrl + D\n\"$mod+Shift+KeyD\" // ⌘/Ctrl + Shift + D\n```\n\nThe Command Menu itself can be opened using `⌘+k` (or `Ctrl+k` on Windows) and closed by hitting `Esc`. These are both non-configurable shortcuts in order to unify the experience across our platforms.\n\n---\n\n## Choosing shortcuts\n\nWhen choosing shortcuts, it is very important that they do not clash with native operating system or browser shortcuts.\n\nFor example, you _should not_ define a shortcut like `$mod+KeyC`, since this will clash with the native “Copy” shortcut, and will be triggered every time a user copies text in the app. Nor should you use shortcuts like `Shift+KeyA` since this will get triggered whenever a user types an uppercase “A” character. Therefore, special care and attention must be given to _each and every_ shortcut choice.\n\nIn general, we recommend using the `Alt` modifier, since this is less likely to clash with existing shortcuts. However, be aware, the `Alt` key is also used for accented characters e.g. `Alt+KeyA` produces the letter “å”. Again, it is crucial that you choose shortcuts carefully.\n\nYou should strive to choose shortcuts that are intuitive and easy to remember. The more complex a shortcut, the less likely a user is to remember it. Of course, a user can still find a command by searching the command menu, and for some users this may be their preferred way of triggering commands.\n\n---\n\n## Common keybindings\n\nKeybindings will be matched against [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) and [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values) which may have some names you don’t expect. Please note that we recommend always using `KeyboardEvent.code` for defining the keys and only using `KeyboardEvent.key` for defining modifiers.\n\n| Windows | macOS | key | code |\n| ------------- | --------------- | ------------- | ------------------------------ |\n| N/A | `Command` / `⌘` | `Meta` | `MetaLeft` / `MetaRight` |\n| `Alt` | `Option` / `⌥` | `Alt` | `AltLeft` / `AltRight` |\n| `Control` | `Control` / `^` | `Control` | `ControlLeft` / `ControlRight` |\n| `Shift` | `Shift` | `Shift` | `ShiftLeft` / `ShiftRight` |\n| `Space` | `Space` | N/A | `Space` |\n| `Enter` | `Return` | `Enter` | `Enter` |\n| `Esc` | `Esc` | `Escape` | `Escape` |\n| `1`, `2`, etc | `1`, `2`, etc | `1`, `2`, etc | `Digit1`, `Digit2`, etc |\n| `a`, `b`, etc | `a`, `b`, etc | `a`, `b`, etc | `KeyA`, `KeyB`, etc |\n| `-` | `-` | `-` | `Minus` |\n| `=` | `=` | `=` | `Equal` |\n| `+` | `+` | `+` | `Equal`\\* |\n\nIn addition to the above table, you can use [https://keycode.info/](https://keycode.info/) for checking the specific values needed. Note that some keys will have the same code as others because they appear on the same key on the keyboard. Keep in mind how this is affected by international keyboards which may have different layouts.\n\n---\n\n## Navigating with the command menu\n\n1. Use `Ctrl+K` (Windows/Linux) or `Cmd+K` (Mac) to open the command menu.\n2. Start typing the command you want to execute. The suggestions in the command menu change to match your text.\n3. Finish entering the name, or use the arrow keys to highlight the command you want from the list of suggestions.\n4. Use `Enter` to execute the chosen command.\n5. If you chose a command that has nested commands, you can use `Backspace` to return to the previous menu.\n6. When the command menu is active, you can use one of the following keyboard shortcuts to close it: `Esc`, `Ctrl+K` (Windows and Linux) or `Cmd+K` (Mac).\n"
|
|
1736
|
-
},
|
|
1737
|
-
{
|
|
1738
|
-
"kind": "javascript-module",
|
|
1739
|
-
"path": "src/command-menu/ICommandMenuAction.ts",
|
|
1740
|
-
"declarations": [],
|
|
1741
|
-
"exports": [],
|
|
1742
|
-
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to provide global and contextual keyboard shortcuts for users.\n- Make command menu available everywhere. Users must be able to bring up the command menu easily.\n- Make command menu central. Users should be able to find global shortcuts from one location.\n- Make command menu omnipotent. Give users access to every possible action.\n- Group related commands logically under sections with the section setting.\n- Use `Alt` key as the modifier, since this is less likely to clash with existing shortcuts.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make command menu available only in certain views of the application.\n- Don’t define shortcuts such as `Ctrl+C`, since this will clash with the native \"Copy\" shortcut.\n- Don't create complex shortcuts, as users will struggle to remember them.\n- Avoid using `KeyboardEvent.key` for defining the shortcut keys.\n- Don’t use as a search field only.\n\n</div>\n\n---\n\n## Content guidelines\n\nCommand titles should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they execute a command:\n\n<div class=\"n-usage n-usage-do\">Start consultation</div>\n<div class=\"n-usage n-usage-dont\">Consultation</div>\n\nAlways lead with a strong verb that encourages action. To provide enough context to user, use the {verb} + {noun} content formula:\n\n<div class=\"n-usage n-usage-do\">Open dashboard</div>\n<div class=\"n-usage n-usage-dont\">Dashboard</div>\n\nWhen writing command titles, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">New appointment</div>\n<div class=\"n-usage n-usage-dont\">New Appointment</div>\n\nAvoid unnecessary words and articles in command titles, such as “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Change theme</div>\n<div class=\"n-usage n-usage-dont\">Change the theme</div>\n\nAvoid ending in punctuation:\n\n<div class=\"n-usage n-usage-do\">Switch user</div>\n<div class=\"n-usage n-usage-dont\">Switch user.</div>\n\nUse ellipsis in the title when describing sections that have commands grouped inside of them:\n\n<div class=\"n-usage n-usage-do\">Change theme…</div>\n<div class=\"n-usage n-usage-dont\">Change theme</div>\n\n---\n\n## Commands data\n\nEach command in the `commands` data array must include at least an `id` and `title`. A command may also include properties for `section`, `icon`, `handler`, `shortcut` , `parent`, and `keywords`:\n\n| Name | Purpose |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | An identifier for each command, must be unique. Example: `id: \"user\"`. |\n| `title` | The title shown to users. This is used when searching for a command. Example: `title: \"Change theme...\"`. |\n| `keywords` | Not visible in the user interface, but can make it easier to discover commands through search. Example: `keywords: \"command change log sign out in\"`. |\n| `shortcut` | The keyboard shortcut. Example: `shortcut: \"Alt+KeyU\"`. See the sections [Defining Shortcuts](#defining-shortcuts) and [Choosing shortcuts](#choosing-shortcuts) below for more information. |\n| `section` | Used for grouping many commands under a common header. Example: `section: \"Commands\"`. |\n| `icon` | A name of an icon form Nordicons to show beside the title. If not specified, default command icon will be used instead. Example: `icon: \"file-picture\"`. |\n| `parent` | The `id` of a parent command. This is used for nesting commands. Example: `parent: \"theme\"`. |\n| `handler` | A function to execute when an user triggers a command. Example: `handler: () => { alert(\"Change to light theme\") }`. In cases where a command is only used as a parent command e.g. \"Change theme\", this is not required. |\n\n---\n\n## Defining shortcuts\n\nShortcuts in the Command Menu have the following form: `[modifier]+[key]`. Shortcuts are made up of a sequence of presses. A press can be as simple as a single key which matches against [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values):\n\n```js\n// Matches: event.code:\n\"KeyD\"\n```\n\nPresses can optionally be prefixed with **_modifiers_** which match against any valid value to [`KeyboardEvent.getModifierState()`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).\n\n```js\n\"Control+KeyD\"\n\"Meta+KeyD\"\n\"Shift+KeyD\"\n\"Alt+KeyD\"\n\"Meta+Shift+KeyD\"\n```\n\nThere is also a special `$mod` modifier that makes it easy to support cross platform keybindings:\n\n- Mac: `$mod` = `Meta` (⌘)\n- Windows/Linux: `$mod` = `Control`\n\n```js\n\"$mod+KeyD\" // ⌘/Ctrl + D\n\"$mod+Shift+KeyD\" // ⌘/Ctrl + Shift + D\n```\n\nThe Command Menu itself can be opened using `⌘+k` (or `Ctrl+k` on Windows) and closed by hitting `Esc`. These are both non-configurable shortcuts in order to unify the experience across our platforms.\n\n---\n\n## Choosing shortcuts\n\nWhen choosing shortcuts, it is very important that they do not clash with native operating system or browser shortcuts.\n\nFor example, you _should not_ define a shortcut like `$mod+KeyC`, since this will clash with the native “Copy” shortcut, and will be triggered every time a user copies text in the app. Nor should you use shortcuts like `Shift+KeyA` since this will get triggered whenever a user types an uppercase “A” character. Therefore, special care and attention must be given to _each and every_ shortcut choice.\n\nIn general, we recommend using the `Alt` modifier, since this is less likely to clash with existing shortcuts. However, be aware, the `Alt` key is also used for accented characters e.g. `Alt+KeyA` produces the letter “å”. Again, it is crucial that you choose shortcuts carefully.\n\nYou should strive to choose shortcuts that are intuitive and easy to remember. The more complex a shortcut, the less likely a user is to remember it. Of course, a user can still find a command by searching the command menu, and for some users this may be their preferred way of triggering commands.\n\n---\n\n## Common keybindings\n\nKeybindings will be matched against [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) and [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values) which may have some names you don’t expect. Please note that we recommend always using `KeyboardEvent.code` for defining the keys and only using `KeyboardEvent.key` for defining modifiers.\n\n| Windows | macOS | key | code |\n| ------------- | --------------- | ------------- | ------------------------------ |\n| N/A | `Command` / `⌘` | `Meta` | `MetaLeft` / `MetaRight` |\n| `Alt` | `Option` / `⌥` | `Alt` | `AltLeft` / `AltRight` |\n| `Control` | `Control` / `^` | `Control` | `ControlLeft` / `ControlRight` |\n| `Shift` | `Shift` | `Shift` | `ShiftLeft` / `ShiftRight` |\n| `Space` | `Space` | N/A | `Space` |\n| `Enter` | `Return` | `Enter` | `Enter` |\n| `Esc` | `Esc` | `Escape` | `Escape` |\n| `1`, `2`, etc | `1`, `2`, etc | `1`, `2`, etc | `Digit1`, `Digit2`, etc |\n| `a`, `b`, etc | `a`, `b`, etc | `a`, `b`, etc | `KeyA`, `KeyB`, etc |\n| `-` | `-` | `-` | `Minus` |\n| `=` | `=` | `=` | `Equal` |\n| `+` | `+` | `+` | `Equal`\\* |\n\nIn addition to the above table, you can use [https://keycode.info/](https://keycode.info/) for checking the specific values needed. Note that some keys will have the same code as others because they appear on the same key on the keyboard. Keep in mind how this is affected by international keyboards which may have different layouts.\n\n---\n\n## Navigating with the command menu\n\n1. Use `Ctrl+K` (Windows/Linux) or `Cmd+K` (Mac) to open the command menu.\n2. Start typing the command you want to execute. The suggestions in the command menu change to match your text.\n3. Finish entering the name, or use the arrow keys to highlight the command you want from the list of suggestions.\n4. Use `Enter` to execute the chosen command.\n5. If you chose a command that has nested commands, you can use `Backspace` to return to the previous menu.\n6. When the command menu is active, you can use one of the following keyboard shortcuts to close it: `Esc`, `Ctrl+K` (Windows and Linux) or `Cmd+K` (Mac).\n"
|
|
1910
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use for making it possible to choose one or more options from a limited number of options.\n- Use for “accepting terms of service” and similar functionality.\n- Use in forms to toggle something on or off.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use when you have more than 10 options to choose from.\n- Don’t change the selection of another checkbox when another one is clicked. Only exception is when a checkbox is used to make a bulk selection of multiple items.\n\n</div>\n\n---\n\n## Content guidelines\n\nCheckbox labels should be clear, accurate and predictable. It should be possible for the user to understand what they are selecting:\n\n<div class=\"n-usage n-usage-do\">User settings</div>\n<div class=\"n-usage n-usage-dont\">Option 1</div>\n\nWhen writing checkbox labels, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">User settings</div>\n<div class=\"n-usage n-usage-dont\">User Settings</div>\n\nAvoid ending in punctuation if it’s a single sentence, word, or a fragment:\n\n<div class=\"n-usage n-usage-do\">Show dashboard</div>\n<div class=\"n-usage n-usage-dont\">Show dashboard.</div>\n\nDo not use commas or semicolons at the end of each line\n\n<div class=\"n-usage n-usage-do\">Patients</div>\n<div class=\"n-usage n-usage-dont\">Patients;</div>\n"
|
|
1743
1911
|
},
|
|
1744
1912
|
{
|
|
1745
1913
|
"kind": "javascript-module",
|
|
1746
|
-
"path": "src/
|
|
1914
|
+
"path": "src/card/Card.ts",
|
|
1747
1915
|
"declarations": [
|
|
1748
1916
|
{
|
|
1749
1917
|
"kind": "class",
|
|
1750
|
-
"description": "",
|
|
1751
|
-
"name": "
|
|
1918
|
+
"description": "Cards are shadowed surfaces that display content and actions on a\nsingle topic. They should be easy to scan for relevant and\nactionable information.",
|
|
1919
|
+
"name": "Card",
|
|
1920
|
+
"slots": [
|
|
1921
|
+
{
|
|
1922
|
+
"description": "The card content.",
|
|
1923
|
+
"name": ""
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
"description": "Optional slot that holds a header for the card.",
|
|
1927
|
+
"name": "header"
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
"description": "Optional slot that holds footer content for the card.",
|
|
1931
|
+
"name": "footer"
|
|
1932
|
+
}
|
|
1933
|
+
],
|
|
1752
1934
|
"members": [
|
|
1753
1935
|
{
|
|
1754
1936
|
"kind": "field",
|
|
1755
|
-
"name": "
|
|
1756
|
-
"type": {
|
|
1757
|
-
"text": "CommandMenu"
|
|
1758
|
-
},
|
|
1937
|
+
"name": "headerSlot",
|
|
1759
1938
|
"privacy": "private",
|
|
1760
|
-
"default": "
|
|
1939
|
+
"default": "new SlotController(this, \"header\")"
|
|
1761
1940
|
},
|
|
1762
1941
|
{
|
|
1763
1942
|
"kind": "field",
|
|
1764
|
-
"name": "
|
|
1765
|
-
"type": {
|
|
1766
|
-
"text": "ShortcutController"
|
|
1767
|
-
},
|
|
1943
|
+
"name": "footerSlot",
|
|
1768
1944
|
"privacy": "private",
|
|
1769
|
-
"default": "new
|
|
1945
|
+
"default": "new SlotController(this, \"footer\")"
|
|
1770
1946
|
},
|
|
1771
1947
|
{
|
|
1772
1948
|
"kind": "field",
|
|
1773
|
-
"name": "
|
|
1949
|
+
"name": "padding",
|
|
1774
1950
|
"type": {
|
|
1775
|
-
"text": "
|
|
1951
|
+
"text": "\"m\" | \"l\" | \"none\""
|
|
1776
1952
|
},
|
|
1777
|
-
"
|
|
1778
|
-
"
|
|
1953
|
+
"default": "\"m\"",
|
|
1954
|
+
"description": "Controls the padding of card component. When set to “none”,\nthe header and footer slots will still have padding.",
|
|
1955
|
+
"attribute": "padding",
|
|
1956
|
+
"reflects": true
|
|
1779
1957
|
},
|
|
1780
1958
|
{
|
|
1781
1959
|
"kind": "field",
|
|
1782
|
-
"name": "
|
|
1960
|
+
"name": "_warningLogged",
|
|
1783
1961
|
"type": {
|
|
1784
|
-
"text": "
|
|
1962
|
+
"text": "boolean"
|
|
1785
1963
|
},
|
|
1786
1964
|
"privacy": "private",
|
|
1787
|
-
"
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1965
|
+
"static": true,
|
|
1966
|
+
"default": "false",
|
|
1967
|
+
"inheritedFrom": {
|
|
1968
|
+
"name": "DraftComponentMixin",
|
|
1969
|
+
"module": "src/common/mixins/DraftComponentMixin.ts"
|
|
1970
|
+
}
|
|
1792
1971
|
}
|
|
1793
|
-
]
|
|
1794
|
-
|
|
1795
|
-
],
|
|
1796
|
-
"exports": [
|
|
1797
|
-
{
|
|
1798
|
-
"kind": "js",
|
|
1799
|
-
"name": "KeyboardController",
|
|
1800
|
-
"declaration": {
|
|
1801
|
-
"name": "KeyboardController",
|
|
1802
|
-
"module": "src/command-menu/KeyboardController.ts"
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
],
|
|
1806
|
-
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to provide global and contextual keyboard shortcuts for users.\n- Make command menu available everywhere. Users must be able to bring up the command menu easily.\n- Make command menu central. Users should be able to find global shortcuts from one location.\n- Make command menu omnipotent. Give users access to every possible action.\n- Group related commands logically under sections with the section setting.\n- Use `Alt` key as the modifier, since this is less likely to clash with existing shortcuts.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make command menu available only in certain views of the application.\n- Don’t define shortcuts such as `Ctrl+C`, since this will clash with the native \"Copy\" shortcut.\n- Don't create complex shortcuts, as users will struggle to remember them.\n- Avoid using `KeyboardEvent.key` for defining the shortcut keys.\n- Don’t use as a search field only.\n\n</div>\n\n---\n\n## Content guidelines\n\nCommand titles should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they execute a command:\n\n<div class=\"n-usage n-usage-do\">Start consultation</div>\n<div class=\"n-usage n-usage-dont\">Consultation</div>\n\nAlways lead with a strong verb that encourages action. To provide enough context to user, use the {verb} + {noun} content formula:\n\n<div class=\"n-usage n-usage-do\">Open dashboard</div>\n<div class=\"n-usage n-usage-dont\">Dashboard</div>\n\nWhen writing command titles, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">New appointment</div>\n<div class=\"n-usage n-usage-dont\">New Appointment</div>\n\nAvoid unnecessary words and articles in command titles, such as “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Change theme</div>\n<div class=\"n-usage n-usage-dont\">Change the theme</div>\n\nAvoid ending in punctuation:\n\n<div class=\"n-usage n-usage-do\">Switch user</div>\n<div class=\"n-usage n-usage-dont\">Switch user.</div>\n\nUse ellipsis in the title when describing sections that have commands grouped inside of them:\n\n<div class=\"n-usage n-usage-do\">Change theme…</div>\n<div class=\"n-usage n-usage-dont\">Change theme</div>\n\n---\n\n## Commands data\n\nEach command in the `commands` data array must include at least an `id` and `title`. A command may also include properties for `section`, `icon`, `handler`, `shortcut` , `parent`, and `keywords`:\n\n| Name | Purpose |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | An identifier for each command, must be unique. Example: `id: \"user\"`. |\n| `title` | The title shown to users. This is used when searching for a command. Example: `title: \"Change theme...\"`. |\n| `keywords` | Not visible in the user interface, but can make it easier to discover commands through search. Example: `keywords: \"command change log sign out in\"`. |\n| `shortcut` | The keyboard shortcut. Example: `shortcut: \"Alt+KeyU\"`. See the sections [Defining Shortcuts](#defining-shortcuts) and [Choosing shortcuts](#choosing-shortcuts) below for more information. |\n| `section` | Used for grouping many commands under a common header. Example: `section: \"Commands\"`. |\n| `icon` | A name of an icon form Nordicons to show beside the title. If not specified, default command icon will be used instead. Example: `icon: \"file-picture\"`. |\n| `parent` | The `id` of a parent command. This is used for nesting commands. Example: `parent: \"theme\"`. |\n| `handler` | A function to execute when an user triggers a command. Example: `handler: () => { alert(\"Change to light theme\") }`. In cases where a command is only used as a parent command e.g. \"Change theme\", this is not required. |\n\n---\n\n## Defining shortcuts\n\nShortcuts in the Command Menu have the following form: `[modifier]+[key]`. Shortcuts are made up of a sequence of presses. A press can be as simple as a single key which matches against [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values):\n\n```js\n// Matches: event.code:\n\"KeyD\"\n```\n\nPresses can optionally be prefixed with **_modifiers_** which match against any valid value to [`KeyboardEvent.getModifierState()`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).\n\n```js\n\"Control+KeyD\"\n\"Meta+KeyD\"\n\"Shift+KeyD\"\n\"Alt+KeyD\"\n\"Meta+Shift+KeyD\"\n```\n\nThere is also a special `$mod` modifier that makes it easy to support cross platform keybindings:\n\n- Mac: `$mod` = `Meta` (⌘)\n- Windows/Linux: `$mod` = `Control`\n\n```js\n\"$mod+KeyD\" // ⌘/Ctrl + D\n\"$mod+Shift+KeyD\" // ⌘/Ctrl + Shift + D\n```\n\nThe Command Menu itself can be opened using `⌘+k` (or `Ctrl+k` on Windows) and closed by hitting `Esc`. These are both non-configurable shortcuts in order to unify the experience across our platforms.\n\n---\n\n## Choosing shortcuts\n\nWhen choosing shortcuts, it is very important that they do not clash with native operating system or browser shortcuts.\n\nFor example, you _should not_ define a shortcut like `$mod+KeyC`, since this will clash with the native “Copy” shortcut, and will be triggered every time a user copies text in the app. Nor should you use shortcuts like `Shift+KeyA` since this will get triggered whenever a user types an uppercase “A” character. Therefore, special care and attention must be given to _each and every_ shortcut choice.\n\nIn general, we recommend using the `Alt` modifier, since this is less likely to clash with existing shortcuts. However, be aware, the `Alt` key is also used for accented characters e.g. `Alt+KeyA` produces the letter “å”. Again, it is crucial that you choose shortcuts carefully.\n\nYou should strive to choose shortcuts that are intuitive and easy to remember. The more complex a shortcut, the less likely a user is to remember it. Of course, a user can still find a command by searching the command menu, and for some users this may be their preferred way of triggering commands.\n\n---\n\n## Common keybindings\n\nKeybindings will be matched against [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) and [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values) which may have some names you don’t expect. Please note that we recommend always using `KeyboardEvent.code` for defining the keys and only using `KeyboardEvent.key` for defining modifiers.\n\n| Windows | macOS | key | code |\n| ------------- | --------------- | ------------- | ------------------------------ |\n| N/A | `Command` / `⌘` | `Meta` | `MetaLeft` / `MetaRight` |\n| `Alt` | `Option` / `⌥` | `Alt` | `AltLeft` / `AltRight` |\n| `Control` | `Control` / `^` | `Control` | `ControlLeft` / `ControlRight` |\n| `Shift` | `Shift` | `Shift` | `ShiftLeft` / `ShiftRight` |\n| `Space` | `Space` | N/A | `Space` |\n| `Enter` | `Return` | `Enter` | `Enter` |\n| `Esc` | `Esc` | `Escape` | `Escape` |\n| `1`, `2`, etc | `1`, `2`, etc | `1`, `2`, etc | `Digit1`, `Digit2`, etc |\n| `a`, `b`, etc | `a`, `b`, etc | `a`, `b`, etc | `KeyA`, `KeyB`, etc |\n| `-` | `-` | `-` | `Minus` |\n| `=` | `=` | `=` | `Equal` |\n| `+` | `+` | `+` | `Equal`\\* |\n\nIn addition to the above table, you can use [https://keycode.info/](https://keycode.info/) for checking the specific values needed. Note that some keys will have the same code as others because they appear on the same key on the keyboard. Keep in mind how this is affected by international keyboards which may have different layouts.\n\n---\n\n## Navigating with the command menu\n\n1. Use `Ctrl+K` (Windows/Linux) or `Cmd+K` (Mac) to open the command menu.\n2. Start typing the command you want to execute. The suggestions in the command menu change to match your text.\n3. Finish entering the name, or use the arrow keys to highlight the command you want from the list of suggestions.\n4. Use `Enter` to execute the chosen command.\n5. If you chose a command that has nested commands, you can use `Backspace` to return to the previous menu.\n6. When the command menu is active, you can use one of the following keyboard shortcuts to close it: `Esc`, `Ctrl+K` (Windows and Linux) or `Cmd+K` (Mac).\n"
|
|
1807
|
-
},
|
|
1808
|
-
{
|
|
1809
|
-
"kind": "javascript-module",
|
|
1810
|
-
"path": "src/command-menu/SelectEvent.ts",
|
|
1811
|
-
"declarations": [
|
|
1812
|
-
{
|
|
1813
|
-
"kind": "class",
|
|
1814
|
-
"description": "",
|
|
1815
|
-
"name": "SelectEvent",
|
|
1816
|
-
"members": [
|
|
1972
|
+
],
|
|
1973
|
+
"attributes": [
|
|
1817
1974
|
{
|
|
1818
|
-
"
|
|
1819
|
-
"name": "eventName",
|
|
1975
|
+
"name": "padding",
|
|
1820
1976
|
"type": {
|
|
1821
|
-
"text": "
|
|
1977
|
+
"text": "\"m\" | \"l\" | \"none\""
|
|
1822
1978
|
},
|
|
1823
|
-
"
|
|
1824
|
-
"
|
|
1825
|
-
|
|
1979
|
+
"default": "\"m\"",
|
|
1980
|
+
"description": "Controls the padding of card component. When set to “none”,\nthe header and footer slots will still have padding.",
|
|
1981
|
+
"fieldName": "padding"
|
|
1982
|
+
}
|
|
1983
|
+
],
|
|
1984
|
+
"mixins": [
|
|
1826
1985
|
{
|
|
1827
|
-
"
|
|
1828
|
-
"
|
|
1829
|
-
"type": {
|
|
1830
|
-
"text": "ICommandMenuAction"
|
|
1831
|
-
},
|
|
1832
|
-
"default": "command"
|
|
1986
|
+
"name": "DraftComponentMixin",
|
|
1987
|
+
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
1833
1988
|
}
|
|
1834
1989
|
],
|
|
1835
1990
|
"superclass": {
|
|
1836
|
-
"name": "
|
|
1837
|
-
"
|
|
1838
|
-
}
|
|
1991
|
+
"name": "LitElement",
|
|
1992
|
+
"package": "lit"
|
|
1993
|
+
},
|
|
1994
|
+
"status": "draft",
|
|
1995
|
+
"category": "structure",
|
|
1996
|
+
"tagName": "nord-card",
|
|
1997
|
+
"customElement": true
|
|
1839
1998
|
}
|
|
1840
1999
|
],
|
|
1841
2000
|
"exports": [
|
|
1842
2001
|
{
|
|
1843
2002
|
"kind": "js",
|
|
1844
|
-
"name": "
|
|
2003
|
+
"name": "default",
|
|
1845
2004
|
"declaration": {
|
|
1846
|
-
"name": "
|
|
1847
|
-
"module": "src/
|
|
2005
|
+
"name": "Card",
|
|
2006
|
+
"module": "src/card/Card.ts"
|
|
2007
|
+
}
|
|
2008
|
+
},
|
|
2009
|
+
{
|
|
2010
|
+
"kind": "custom-element-definition",
|
|
2011
|
+
"name": "nord-card",
|
|
2012
|
+
"declaration": {
|
|
2013
|
+
"name": "Card",
|
|
2014
|
+
"module": "src/card/Card.ts"
|
|
1848
2015
|
}
|
|
1849
2016
|
}
|
|
1850
2017
|
],
|
|
1851
|
-
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to provide global and contextual keyboard shortcuts for users.\n- Make command menu available everywhere. Users must be able to bring up the command menu easily.\n- Make command menu central. Users should be able to find global shortcuts from one location.\n- Make command menu omnipotent. Give users access to every possible action.\n- Group related commands logically under sections with the section setting.\n- Use `Alt` key as the modifier, since this is less likely to clash with existing shortcuts.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make command menu available only in certain views of the application.\n- Don’t define shortcuts such as `Ctrl+C`, since this will clash with the native \"Copy\" shortcut.\n- Don't create complex shortcuts, as users will struggle to remember them.\n- Avoid using `KeyboardEvent.key` for defining the shortcut keys.\n- Don’t use as a search field only.\n\n</div>\n\n---\n\n## Content guidelines\n\nCommand titles should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they execute a command:\n\n<div class=\"n-usage n-usage-do\">Start consultation</div>\n<div class=\"n-usage n-usage-dont\">Consultation</div>\n\nAlways lead with a strong verb that encourages action. To provide enough context to user, use the {verb} + {noun} content formula:\n\n<div class=\"n-usage n-usage-do\">Open dashboard</div>\n<div class=\"n-usage n-usage-dont\">Dashboard</div>\n\nWhen writing command titles, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">New appointment</div>\n<div class=\"n-usage n-usage-dont\">New Appointment</div>\n\nAvoid unnecessary words and articles in command titles, such as “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Change theme</div>\n<div class=\"n-usage n-usage-dont\">Change the theme</div>\n\nAvoid ending in punctuation:\n\n<div class=\"n-usage n-usage-do\">Switch user</div>\n<div class=\"n-usage n-usage-dont\">Switch user.</div>\n\nUse ellipsis in the title when describing sections that have commands grouped inside of them:\n\n<div class=\"n-usage n-usage-do\">Change theme…</div>\n<div class=\"n-usage n-usage-dont\">Change theme</div>\n\n---\n\n## Commands data\n\nEach command in the `commands` data array must include at least an `id` and `title`. A command may also include properties for `section`, `icon`, `handler`, `shortcut` , `parent`, and `keywords`:\n\n| Name | Purpose |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | An identifier for each command, must be unique. Example: `id: \"user\"`. |\n| `title` | The title shown to users. This is used when searching for a command. Example: `title: \"Change theme...\"`. |\n| `keywords` | Not visible in the user interface, but can make it easier to discover commands through search. Example: `keywords: \"command change log sign out in\"`. |\n| `shortcut` | The keyboard shortcut. Example: `shortcut: \"Alt+KeyU\"`. See the sections [Defining Shortcuts](#defining-shortcuts) and [Choosing shortcuts](#choosing-shortcuts) below for more information. |\n| `section` | Used for grouping many commands under a common header. Example: `section: \"Commands\"`. |\n| `icon` | A name of an icon form Nordicons to show beside the title. If not specified, default command icon will be used instead. Example: `icon: \"file-picture\"`. |\n| `parent` | The `id` of a parent command. This is used for nesting commands. Example: `parent: \"theme\"`. |\n| `handler` | A function to execute when an user triggers a command. Example: `handler: () => { alert(\"Change to light theme\") }`. In cases where a command is only used as a parent command e.g. \"Change theme\", this is not required. |\n\n---\n\n## Defining shortcuts\n\nShortcuts in the Command Menu have the following form: `[modifier]+[key]`. Shortcuts are made up of a sequence of presses. A press can be as simple as a single key which matches against [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values):\n\n```js\n// Matches: event.code:\n\"KeyD\"\n```\n\nPresses can optionally be prefixed with **_modifiers_** which match against any valid value to [`KeyboardEvent.getModifierState()`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).\n\n```js\n\"Control+KeyD\"\n\"Meta+KeyD\"\n\"Shift+KeyD\"\n\"Alt+KeyD\"\n\"Meta+Shift+KeyD\"\n```\n\nThere is also a special `$mod` modifier that makes it easy to support cross platform keybindings:\n\n- Mac: `$mod` = `Meta` (⌘)\n- Windows/Linux: `$mod` = `Control`\n\n```js\n\"$mod+KeyD\" // ⌘/Ctrl + D\n\"$mod+Shift+KeyD\" // ⌘/Ctrl + Shift + D\n```\n\nThe Command Menu itself can be opened using `⌘+k` (or `Ctrl+k` on Windows) and closed by hitting `Esc`. These are both non-configurable shortcuts in order to unify the experience across our platforms.\n\n---\n\n## Choosing shortcuts\n\nWhen choosing shortcuts, it is very important that they do not clash with native operating system or browser shortcuts.\n\nFor example, you _should not_ define a shortcut like `$mod+KeyC`, since this will clash with the native “Copy” shortcut, and will be triggered every time a user copies text in the app. Nor should you use shortcuts like `Shift+KeyA` since this will get triggered whenever a user types an uppercase “A” character. Therefore, special care and attention must be given to _each and every_ shortcut choice.\n\nIn general, we recommend using the `Alt` modifier, since this is less likely to clash with existing shortcuts. However, be aware, the `Alt` key is also used for accented characters e.g. `Alt+KeyA` produces the letter “å”. Again, it is crucial that you choose shortcuts carefully.\n\nYou should strive to choose shortcuts that are intuitive and easy to remember. The more complex a shortcut, the less likely a user is to remember it. Of course, a user can still find a command by searching the command menu, and for some users this may be their preferred way of triggering commands.\n\n---\n\n## Common keybindings\n\nKeybindings will be matched against [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) and [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values) which may have some names you don’t expect. Please note that we recommend always using `KeyboardEvent.code` for defining the keys and only using `KeyboardEvent.key` for defining modifiers.\n\n| Windows | macOS | key | code |\n| ------------- | --------------- | ------------- | ------------------------------ |\n| N/A | `Command` / `⌘` | `Meta` | `MetaLeft` / `MetaRight` |\n| `Alt` | `Option` / `⌥` | `Alt` | `AltLeft` / `AltRight` |\n| `Control` | `Control` / `^` | `Control` | `ControlLeft` / `ControlRight` |\n| `Shift` | `Shift` | `Shift` | `ShiftLeft` / `ShiftRight` |\n| `Space` | `Space` | N/A | `Space` |\n| `Enter` | `Return` | `Enter` | `Enter` |\n| `Esc` | `Esc` | `Escape` | `Escape` |\n| `1`, `2`, etc | `1`, `2`, etc | `1`, `2`, etc | `Digit1`, `Digit2`, etc |\n| `a`, `b`, etc | `a`, `b`, etc | `a`, `b`, etc | `KeyA`, `KeyB`, etc |\n| `-` | `-` | `-` | `Minus` |\n| `=` | `=` | `=` | `Equal` |\n| `+` | `+` | `+` | `Equal`\\* |\n\nIn addition to the above table, you can use [https://keycode.info/](https://keycode.info/) for checking the specific values needed. Note that some keys will have the same code as others because they appear on the same key on the keyboard. Keep in mind how this is affected by international keyboards which may have different layouts.\n\n---\n\n## Navigating with the command menu\n\n1. Use `Ctrl+K` (Windows/Linux) or `Cmd+K` (Mac) to open the command menu.\n2. Start typing the command you want to execute. The suggestions in the command menu change to match your text.\n3. Finish entering the name, or use the arrow keys to highlight the command you want from the list of suggestions.\n4. Use `Enter` to execute the chosen command.\n5. If you chose a command that has nested commands, you can use `Backspace` to return to the previous menu.\n6. When the command menu is active, you can use one of the following keyboard shortcuts to close it: `Esc`, `Ctrl+K` (Windows and Linux) or `Cmd+K` (Mac).\n"
|
|
2018
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to display content and actions on a single topic inside a container.\n- Use to visually separate specific parts of content in an application view.\n- Use to wrap a form into a container, for example a login form.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use when you need to capture user’s attention in a prominent way.\n- Don’t use to inform user about important changes or conditions in the interface.\n- Don’t use multiple primary buttons inside a card. A card should only contain a single primary action.\n\n</div>\n"
|
|
1852
2019
|
},
|
|
1853
2020
|
{
|
|
1854
2021
|
"kind": "javascript-module",
|
|
1855
|
-
"path": "src/
|
|
2022
|
+
"path": "src/command-menu/CommandMenu.ts",
|
|
1856
2023
|
"declarations": [
|
|
1857
2024
|
{
|
|
1858
2025
|
"kind": "class",
|
|
1859
|
-
"description": "
|
|
1860
|
-
"name": "
|
|
2026
|
+
"description": "Command Menu allows users to navigate and use an app without\ntouching the mouse and helps them transform into “power users”\nwho can harness more advanced features far faster.",
|
|
2027
|
+
"name": "CommandMenu",
|
|
1861
2028
|
"slots": [
|
|
1862
2029
|
{
|
|
1863
|
-
"description": "
|
|
1864
|
-
"name": "
|
|
1865
|
-
},
|
|
1866
|
-
{
|
|
1867
|
-
"description": "Optional slot that holds hint text for the input.",
|
|
1868
|
-
"name": "hint"
|
|
1869
|
-
},
|
|
1870
|
-
{
|
|
1871
|
-
"description": "Optional slot that holds error text for the input.",
|
|
1872
|
-
"name": "error"
|
|
2030
|
+
"description": "Used to replace the default footer contents.",
|
|
2031
|
+
"name": "footer"
|
|
1873
2032
|
}
|
|
1874
2033
|
],
|
|
1875
2034
|
"members": [
|
|
1876
2035
|
{
|
|
1877
2036
|
"kind": "field",
|
|
1878
|
-
"name": "
|
|
1879
|
-
"privacy": "
|
|
1880
|
-
"inheritedFrom": {
|
|
1881
|
-
"name": "FormAssociatedMixin",
|
|
1882
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1883
|
-
}
|
|
1884
|
-
},
|
|
1885
|
-
{
|
|
1886
|
-
"kind": "field",
|
|
1887
|
-
"name": "checked",
|
|
1888
|
-
"type": {
|
|
1889
|
-
"text": "boolean"
|
|
1890
|
-
},
|
|
1891
|
-
"default": "false",
|
|
1892
|
-
"description": "Controls whether the checkbox is checked or not.",
|
|
1893
|
-
"attribute": "checked"
|
|
1894
|
-
},
|
|
1895
|
-
{
|
|
1896
|
-
"kind": "method",
|
|
1897
|
-
"name": "handleChange",
|
|
1898
|
-
"privacy": "protected",
|
|
1899
|
-
"return": {
|
|
1900
|
-
"type": {
|
|
1901
|
-
"text": "void"
|
|
1902
|
-
}
|
|
1903
|
-
},
|
|
1904
|
-
"parameters": [
|
|
1905
|
-
{
|
|
1906
|
-
"name": "e",
|
|
1907
|
-
"type": {
|
|
1908
|
-
"text": "Event"
|
|
1909
|
-
}
|
|
1910
|
-
}
|
|
1911
|
-
],
|
|
1912
|
-
"inheritedFrom": {
|
|
1913
|
-
"name": "FormAssociatedMixin",
|
|
1914
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1915
|
-
}
|
|
1916
|
-
},
|
|
1917
|
-
{
|
|
1918
|
-
"kind": "field",
|
|
1919
|
-
"name": "labelSlot",
|
|
1920
|
-
"privacy": "protected",
|
|
1921
|
-
"default": "new SlotController(this, \"label\")",
|
|
1922
|
-
"inheritedFrom": {
|
|
1923
|
-
"name": "FormAssociatedMixin",
|
|
1924
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1925
|
-
}
|
|
2037
|
+
"name": "inputRef",
|
|
2038
|
+
"privacy": "private"
|
|
1926
2039
|
},
|
|
1927
2040
|
{
|
|
1928
2041
|
"kind": "field",
|
|
1929
|
-
"name": "
|
|
1930
|
-
"privacy": "
|
|
1931
|
-
"default": "new SlotController(this, \"error\")",
|
|
1932
|
-
"inheritedFrom": {
|
|
1933
|
-
"name": "FormAssociatedMixin",
|
|
1934
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1935
|
-
}
|
|
2042
|
+
"name": "listRef",
|
|
2043
|
+
"privacy": "private"
|
|
1936
2044
|
},
|
|
1937
2045
|
{
|
|
1938
2046
|
"kind": "field",
|
|
1939
|
-
"name": "
|
|
1940
|
-
"
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1945
|
-
}
|
|
2047
|
+
"name": "previousFocus",
|
|
2048
|
+
"type": {
|
|
2049
|
+
"text": "HTMLElement | undefined"
|
|
2050
|
+
},
|
|
2051
|
+
"privacy": "private"
|
|
1946
2052
|
},
|
|
1947
2053
|
{
|
|
1948
2054
|
"kind": "field",
|
|
1949
|
-
"name": "
|
|
1950
|
-
"privacy": "
|
|
1951
|
-
"default": "new
|
|
1952
|
-
"inheritedFrom": {
|
|
1953
|
-
"name": "FormAssociatedMixin",
|
|
1954
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1955
|
-
}
|
|
2055
|
+
"name": "dismissController",
|
|
2056
|
+
"privacy": "private",
|
|
2057
|
+
"default": "new LightDismissController(this, {\n isOpen: () => this.open,\n onDismiss: () => this.close(),\n })"
|
|
1956
2058
|
},
|
|
1957
2059
|
{
|
|
1958
2060
|
"kind": "field",
|
|
1959
|
-
"name": "
|
|
1960
|
-
"
|
|
1961
|
-
|
|
1962
|
-
},
|
|
1963
|
-
"privacy": "protected",
|
|
1964
|
-
"default": "\"input\"",
|
|
1965
|
-
"inheritedFrom": {
|
|
1966
|
-
"name": "FormAssociatedMixin",
|
|
1967
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1968
|
-
}
|
|
2061
|
+
"name": "keyboardController",
|
|
2062
|
+
"privacy": "private",
|
|
2063
|
+
"default": "new KeyboardController(this, {\n trigger: () => this.select(),\n goBack: () => this.goBack(),\n end: () => this.end(),\n start: () => this.start(),\n next: () => this.next(),\n previous: () => this.previous(),\n toggleOpen: () => this.toggleOpen(),\n })"
|
|
1969
2064
|
},
|
|
1970
2065
|
{
|
|
1971
2066
|
"kind": "field",
|
|
1972
|
-
"name": "
|
|
2067
|
+
"name": "open",
|
|
1973
2068
|
"type": {
|
|
1974
|
-
"text": "
|
|
2069
|
+
"text": "boolean"
|
|
1975
2070
|
},
|
|
1976
|
-
"
|
|
1977
|
-
"
|
|
1978
|
-
"
|
|
1979
|
-
"name": "FormAssociatedMixin",
|
|
1980
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1981
|
-
}
|
|
2071
|
+
"default": "false",
|
|
2072
|
+
"description": "Show or hide the command menu.",
|
|
2073
|
+
"attribute": "open"
|
|
1982
2074
|
},
|
|
1983
2075
|
{
|
|
1984
2076
|
"kind": "field",
|
|
1985
|
-
"name": "
|
|
2077
|
+
"name": "placeholder",
|
|
1986
2078
|
"type": {
|
|
1987
2079
|
"text": "string"
|
|
1988
2080
|
},
|
|
1989
|
-
"
|
|
1990
|
-
"
|
|
1991
|
-
"
|
|
1992
|
-
"name": "FormAssociatedMixin",
|
|
1993
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1994
|
-
}
|
|
2081
|
+
"default": "\"Type a command or search...\"",
|
|
2082
|
+
"description": "Hint text to display in the Command Menu search field.",
|
|
2083
|
+
"attribute": "placeholder"
|
|
1995
2084
|
},
|
|
1996
2085
|
{
|
|
1997
2086
|
"kind": "field",
|
|
1998
|
-
"name": "
|
|
2087
|
+
"name": "commands",
|
|
1999
2088
|
"type": {
|
|
2000
|
-
"text": "
|
|
2089
|
+
"text": "Array<ICommandMenuAction>"
|
|
2001
2090
|
},
|
|
2002
|
-
"default": "
|
|
2003
|
-
"description": "
|
|
2004
|
-
"attribute": "label",
|
|
2005
|
-
"inheritedFrom": {
|
|
2006
|
-
"name": "FormAssociatedMixin",
|
|
2007
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2008
|
-
}
|
|
2091
|
+
"default": "[]",
|
|
2092
|
+
"description": "Array of commands to be included in the menu.\nPlease see “Commands data” section for more documentation."
|
|
2009
2093
|
},
|
|
2010
2094
|
{
|
|
2011
2095
|
"kind": "field",
|
|
2012
|
-
"name": "
|
|
2096
|
+
"name": "parent",
|
|
2013
2097
|
"type": {
|
|
2014
2098
|
"text": "string | undefined"
|
|
2015
2099
|
},
|
|
2016
|
-
"
|
|
2017
|
-
"attribute": "hint",
|
|
2018
|
-
"inheritedFrom": {
|
|
2019
|
-
"name": "FormAssociatedMixin",
|
|
2020
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2021
|
-
}
|
|
2100
|
+
"privacy": "private"
|
|
2022
2101
|
},
|
|
2023
2102
|
{
|
|
2024
2103
|
"kind": "field",
|
|
2025
|
-
"name": "
|
|
2104
|
+
"name": "search",
|
|
2026
2105
|
"type": {
|
|
2027
|
-
"text": "
|
|
2106
|
+
"text": "string"
|
|
2028
2107
|
},
|
|
2029
|
-
"
|
|
2030
|
-
"
|
|
2031
|
-
"attribute": "hide-label",
|
|
2032
|
-
"inheritedFrom": {
|
|
2033
|
-
"name": "FormAssociatedMixin",
|
|
2034
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2035
|
-
}
|
|
2108
|
+
"privacy": "private",
|
|
2109
|
+
"default": "\"\""
|
|
2036
2110
|
},
|
|
2037
2111
|
{
|
|
2038
2112
|
"kind": "field",
|
|
2039
|
-
"name": "
|
|
2113
|
+
"name": "bump",
|
|
2040
2114
|
"type": {
|
|
2041
|
-
"text": "
|
|
2115
|
+
"text": "boolean"
|
|
2042
2116
|
},
|
|
2043
|
-
"
|
|
2044
|
-
"
|
|
2045
|
-
"inheritedFrom": {
|
|
2046
|
-
"name": "FormAssociatedMixin",
|
|
2047
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2048
|
-
}
|
|
2117
|
+
"privacy": "private",
|
|
2118
|
+
"default": "true"
|
|
2049
2119
|
},
|
|
2050
2120
|
{
|
|
2051
2121
|
"kind": "field",
|
|
2052
|
-
"name": "
|
|
2122
|
+
"name": "selectedIndex",
|
|
2053
2123
|
"type": {
|
|
2054
|
-
"text": "
|
|
2124
|
+
"text": "number"
|
|
2055
2125
|
},
|
|
2056
|
-
"
|
|
2057
|
-
"
|
|
2058
|
-
"inheritedFrom": {
|
|
2059
|
-
"name": "FormAssociatedMixin",
|
|
2060
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2061
|
-
}
|
|
2126
|
+
"privacy": "private",
|
|
2127
|
+
"default": "0"
|
|
2062
2128
|
},
|
|
2063
2129
|
{
|
|
2064
2130
|
"kind": "field",
|
|
2065
|
-
"name": "
|
|
2131
|
+
"name": "filteredCommands",
|
|
2066
2132
|
"type": {
|
|
2067
|
-
"text": "
|
|
2133
|
+
"text": "Array<ICommandMenuAction>"
|
|
2068
2134
|
},
|
|
2069
|
-
"
|
|
2070
|
-
"
|
|
2071
|
-
"attribute": "required",
|
|
2072
|
-
"inheritedFrom": {
|
|
2073
|
-
"name": "FormAssociatedMixin",
|
|
2074
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2075
|
-
}
|
|
2135
|
+
"privacy": "private",
|
|
2136
|
+
"default": "[]"
|
|
2076
2137
|
},
|
|
2077
2138
|
{
|
|
2078
2139
|
"kind": "field",
|
|
2079
|
-
"name": "
|
|
2140
|
+
"name": "selected",
|
|
2080
2141
|
"type": {
|
|
2081
|
-
"text": "
|
|
2142
|
+
"text": "ICommandMenuAction"
|
|
2082
2143
|
},
|
|
2083
|
-
"
|
|
2084
|
-
"description": "Controls whether the input expands to fill the width of its container.",
|
|
2085
|
-
"attribute": "expand",
|
|
2086
|
-
"reflects": true,
|
|
2087
|
-
"inheritedFrom": {
|
|
2088
|
-
"name": "FormAssociatedMixin",
|
|
2089
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2090
|
-
}
|
|
2144
|
+
"privacy": "private"
|
|
2091
2145
|
},
|
|
2092
2146
|
{
|
|
2093
2147
|
"kind": "method",
|
|
2094
|
-
"name": "
|
|
2095
|
-
"privacy": "protected",
|
|
2148
|
+
"name": "show",
|
|
2096
2149
|
"parameters": [
|
|
2097
2150
|
{
|
|
2098
|
-
"name": "
|
|
2151
|
+
"name": "options",
|
|
2152
|
+
"default": "{}",
|
|
2099
2153
|
"type": {
|
|
2100
|
-
"text": "
|
|
2101
|
-
}
|
|
2154
|
+
"text": "{ parent?: string }"
|
|
2155
|
+
},
|
|
2156
|
+
"description": "allows you to open the menu filtered to a specific parent command."
|
|
2102
2157
|
}
|
|
2103
2158
|
],
|
|
2104
|
-
"
|
|
2105
|
-
"name": "FormAssociatedMixin",
|
|
2106
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2107
|
-
}
|
|
2159
|
+
"description": "Show the command menu programmatically."
|
|
2108
2160
|
},
|
|
2109
2161
|
{
|
|
2110
2162
|
"kind": "method",
|
|
2111
|
-
"name": "
|
|
2112
|
-
"
|
|
2113
|
-
"inheritedFrom": {
|
|
2114
|
-
"name": "FormAssociatedMixin",
|
|
2115
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2116
|
-
}
|
|
2163
|
+
"name": "close",
|
|
2164
|
+
"description": "Close the command menu programmatically."
|
|
2117
2165
|
},
|
|
2118
2166
|
{
|
|
2119
2167
|
"kind": "method",
|
|
2120
|
-
"name": "
|
|
2121
|
-
"
|
|
2122
|
-
"inheritedFrom": {
|
|
2123
|
-
"name": "FormAssociatedMixin",
|
|
2124
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2125
|
-
}
|
|
2168
|
+
"name": "toggleOpen",
|
|
2169
|
+
"description": "Toggle the open state programmatically."
|
|
2126
2170
|
},
|
|
2127
2171
|
{
|
|
2128
2172
|
"kind": "method",
|
|
2129
|
-
"name": "
|
|
2130
|
-
"
|
|
2131
|
-
"inheritedFrom": {
|
|
2132
|
-
"name": "FormAssociatedMixin",
|
|
2133
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2134
|
-
}
|
|
2173
|
+
"name": "focus",
|
|
2174
|
+
"description": "Focus the command menu's input."
|
|
2135
2175
|
},
|
|
2136
2176
|
{
|
|
2137
2177
|
"kind": "method",
|
|
2138
|
-
"name": "
|
|
2139
|
-
"privacy": "
|
|
2140
|
-
"inheritedFrom": {
|
|
2141
|
-
"name": "FormAssociatedMixin",
|
|
2142
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2143
|
-
}
|
|
2178
|
+
"name": "renderNoResults",
|
|
2179
|
+
"privacy": "private"
|
|
2144
2180
|
},
|
|
2145
2181
|
{
|
|
2146
|
-
"kind": "
|
|
2147
|
-
"name": "
|
|
2148
|
-
"privacy": "
|
|
2149
|
-
"
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2182
|
+
"kind": "method",
|
|
2183
|
+
"name": "renderSection",
|
|
2184
|
+
"privacy": "private",
|
|
2185
|
+
"parameters": [
|
|
2186
|
+
{
|
|
2187
|
+
"name": "section",
|
|
2188
|
+
"type": {
|
|
2189
|
+
"text": "string | undefined"
|
|
2190
|
+
}
|
|
2191
|
+
},
|
|
2192
|
+
{
|
|
2193
|
+
"name": "commands",
|
|
2194
|
+
"type": {
|
|
2195
|
+
"text": "ICommandMenuAction[]"
|
|
2196
|
+
}
|
|
2197
|
+
}
|
|
2198
|
+
]
|
|
2153
2199
|
},
|
|
2154
2200
|
{
|
|
2155
|
-
"kind": "
|
|
2156
|
-
"name": "
|
|
2157
|
-
"privacy": "
|
|
2158
|
-
"inheritedFrom": {
|
|
2159
|
-
"name": "FormAssociatedMixin",
|
|
2160
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2161
|
-
}
|
|
2201
|
+
"kind": "method",
|
|
2202
|
+
"name": "handleAnimationEnd",
|
|
2203
|
+
"privacy": "private"
|
|
2162
2204
|
},
|
|
2163
2205
|
{
|
|
2164
|
-
"kind": "
|
|
2165
|
-
"name": "
|
|
2166
|
-
"
|
|
2167
|
-
"text": "boolean"
|
|
2168
|
-
},
|
|
2169
|
-
"default": "false",
|
|
2170
|
-
"description": "Makes the component disabled. This prevents users from\nbeing able to interact with the component, and conveys\nits inactive state to assistive technologies.",
|
|
2171
|
-
"attribute": "disabled",
|
|
2172
|
-
"reflects": true,
|
|
2173
|
-
"inheritedFrom": {
|
|
2174
|
-
"name": "InputMixin",
|
|
2175
|
-
"module": "src/common/mixins/InputMixin.ts"
|
|
2176
|
-
}
|
|
2206
|
+
"kind": "method",
|
|
2207
|
+
"name": "handleBlur",
|
|
2208
|
+
"privacy": "private"
|
|
2177
2209
|
},
|
|
2178
2210
|
{
|
|
2179
|
-
"kind": "
|
|
2180
|
-
"name": "
|
|
2181
|
-
"
|
|
2182
|
-
|
|
2183
|
-
|
|
2184
|
-
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2211
|
+
"kind": "method",
|
|
2212
|
+
"name": "handleInput",
|
|
2213
|
+
"privacy": "private",
|
|
2214
|
+
"parameters": [
|
|
2215
|
+
{
|
|
2216
|
+
"name": "event",
|
|
2217
|
+
"type": {
|
|
2218
|
+
"text": "KeyboardEvent"
|
|
2219
|
+
}
|
|
2220
|
+
}
|
|
2221
|
+
]
|
|
2190
2222
|
},
|
|
2191
2223
|
{
|
|
2192
|
-
"kind": "
|
|
2193
|
-
"name": "
|
|
2194
|
-
"
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2224
|
+
"kind": "method",
|
|
2225
|
+
"name": "select",
|
|
2226
|
+
"privacy": "private",
|
|
2227
|
+
"parameters": [
|
|
2228
|
+
{
|
|
2229
|
+
"name": "command",
|
|
2230
|
+
"default": "this.selected",
|
|
2231
|
+
"type": {
|
|
2232
|
+
"text": "ICommandMenuAction"
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
]
|
|
2204
2236
|
},
|
|
2205
2237
|
{
|
|
2206
|
-
"kind": "
|
|
2207
|
-
"name": "
|
|
2208
|
-
"privacy": "
|
|
2209
|
-
"description": "Gets the form, if any, associated with the form element.",
|
|
2210
|
-
"inheritedFrom": {
|
|
2211
|
-
"name": "InputMixin",
|
|
2212
|
-
"module": "src/common/mixins/InputMixin.ts"
|
|
2213
|
-
}
|
|
2238
|
+
"kind": "method",
|
|
2239
|
+
"name": "start",
|
|
2240
|
+
"privacy": "private"
|
|
2214
2241
|
},
|
|
2215
2242
|
{
|
|
2216
|
-
"kind": "
|
|
2217
|
-
"name": "
|
|
2218
|
-
"privacy": "
|
|
2219
|
-
"inheritedFrom": {
|
|
2220
|
-
"name": "FocusableMixin",
|
|
2221
|
-
"module": "src/common/mixins/FocusableMixin.ts"
|
|
2222
|
-
}
|
|
2243
|
+
"kind": "method",
|
|
2244
|
+
"name": "end",
|
|
2245
|
+
"privacy": "private"
|
|
2223
2246
|
},
|
|
2224
2247
|
{
|
|
2225
2248
|
"kind": "method",
|
|
2226
|
-
"name": "
|
|
2249
|
+
"name": "next",
|
|
2250
|
+
"privacy": "private"
|
|
2251
|
+
},
|
|
2252
|
+
{
|
|
2253
|
+
"kind": "method",
|
|
2254
|
+
"name": "previous",
|
|
2255
|
+
"privacy": "private"
|
|
2256
|
+
},
|
|
2257
|
+
{
|
|
2258
|
+
"kind": "method",
|
|
2259
|
+
"name": "goBack",
|
|
2260
|
+
"privacy": "private"
|
|
2261
|
+
},
|
|
2262
|
+
{
|
|
2263
|
+
"kind": "method",
|
|
2264
|
+
"name": "setParent",
|
|
2265
|
+
"privacy": "private",
|
|
2227
2266
|
"parameters": [
|
|
2228
2267
|
{
|
|
2229
|
-
"name": "
|
|
2268
|
+
"name": "parent",
|
|
2230
2269
|
"optional": true,
|
|
2231
2270
|
"type": {
|
|
2232
|
-
"text": "
|
|
2233
|
-
}
|
|
2234
|
-
"description": "An object which controls aspects of the focusing process."
|
|
2271
|
+
"text": "string"
|
|
2272
|
+
}
|
|
2235
2273
|
}
|
|
2236
|
-
]
|
|
2237
|
-
"description": "Programmatically move focus to the component.",
|
|
2238
|
-
"inheritedFrom": {
|
|
2239
|
-
"name": "FocusableMixin",
|
|
2240
|
-
"module": "src/common/mixins/FocusableMixin.ts"
|
|
2241
|
-
}
|
|
2274
|
+
]
|
|
2242
2275
|
},
|
|
2243
2276
|
{
|
|
2244
2277
|
"kind": "method",
|
|
2245
|
-
"name": "
|
|
2246
|
-
"
|
|
2247
|
-
"
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2278
|
+
"name": "setSearch",
|
|
2279
|
+
"privacy": "private",
|
|
2280
|
+
"parameters": [
|
|
2281
|
+
{
|
|
2282
|
+
"name": "str",
|
|
2283
|
+
"type": {
|
|
2284
|
+
"text": "string"
|
|
2285
|
+
}
|
|
2286
|
+
}
|
|
2287
|
+
]
|
|
2251
2288
|
},
|
|
2252
2289
|
{
|
|
2253
2290
|
"kind": "method",
|
|
2254
|
-
"name": "
|
|
2255
|
-
"
|
|
2256
|
-
"inheritedFrom": {
|
|
2257
|
-
"name": "FocusableMixin",
|
|
2258
|
-
"module": "src/common/mixins/FocusableMixin.ts"
|
|
2259
|
-
}
|
|
2291
|
+
"name": "filterCommands",
|
|
2292
|
+
"privacy": "private"
|
|
2260
2293
|
},
|
|
2261
2294
|
{
|
|
2262
2295
|
"kind": "field",
|
|
@@ -2273,214 +2306,285 @@
|
|
|
2273
2306
|
}
|
|
2274
2307
|
}
|
|
2275
2308
|
],
|
|
2276
|
-
"
|
|
2309
|
+
"events": [
|
|
2277
2310
|
{
|
|
2278
|
-
"name": "
|
|
2311
|
+
"name": "open",
|
|
2279
2312
|
"type": {
|
|
2280
|
-
"text": "
|
|
2313
|
+
"text": "NordEvent"
|
|
2281
2314
|
},
|
|
2282
|
-
"
|
|
2283
|
-
"description": "Controls whether the checkbox is checked or not.",
|
|
2284
|
-
"fieldName": "checked"
|
|
2315
|
+
"description": "The command menu was opened."
|
|
2285
2316
|
},
|
|
2286
2317
|
{
|
|
2287
|
-
"name": "
|
|
2318
|
+
"name": "close",
|
|
2288
2319
|
"type": {
|
|
2289
|
-
"text": "
|
|
2320
|
+
"text": "NordEvent"
|
|
2290
2321
|
},
|
|
2291
|
-
"
|
|
2292
|
-
"description": "Label for the input.",
|
|
2293
|
-
"fieldName": "label",
|
|
2294
|
-
"inheritedFrom": {
|
|
2295
|
-
"name": "FormAssociatedMixin",
|
|
2296
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2297
|
-
}
|
|
2322
|
+
"description": "The command menu was closed."
|
|
2298
2323
|
},
|
|
2299
2324
|
{
|
|
2300
|
-
"name": "hint",
|
|
2301
2325
|
"type": {
|
|
2302
|
-
"text": "
|
|
2326
|
+
"text": "SelectEvent"
|
|
2303
2327
|
},
|
|
2304
|
-
"description": "
|
|
2305
|
-
"
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
}
|
|
2310
|
-
},
|
|
2328
|
+
"description": "User selected a command from the menu.",
|
|
2329
|
+
"name": "nord-select"
|
|
2330
|
+
}
|
|
2331
|
+
],
|
|
2332
|
+
"attributes": [
|
|
2311
2333
|
{
|
|
2312
|
-
"name": "
|
|
2334
|
+
"name": "open",
|
|
2313
2335
|
"type": {
|
|
2314
2336
|
"text": "boolean"
|
|
2315
2337
|
},
|
|
2316
2338
|
"default": "false",
|
|
2317
|
-
"description": "
|
|
2318
|
-
"fieldName": "
|
|
2319
|
-
"inheritedFrom": {
|
|
2320
|
-
"name": "FormAssociatedMixin",
|
|
2321
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2322
|
-
}
|
|
2339
|
+
"description": "Show or hide the command menu.",
|
|
2340
|
+
"fieldName": "open"
|
|
2323
2341
|
},
|
|
2324
2342
|
{
|
|
2325
2343
|
"name": "placeholder",
|
|
2326
2344
|
"type": {
|
|
2327
|
-
"text": "string
|
|
2345
|
+
"text": "string"
|
|
2328
2346
|
},
|
|
2329
|
-
"
|
|
2330
|
-
"
|
|
2331
|
-
"
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
},
|
|
2347
|
+
"default": "\"Type a command or search...\"",
|
|
2348
|
+
"description": "Hint text to display in the Command Menu search field.",
|
|
2349
|
+
"fieldName": "placeholder"
|
|
2350
|
+
}
|
|
2351
|
+
],
|
|
2352
|
+
"mixins": [
|
|
2336
2353
|
{
|
|
2337
|
-
"name": "
|
|
2354
|
+
"name": "DraftComponentMixin",
|
|
2355
|
+
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
2356
|
+
}
|
|
2357
|
+
],
|
|
2358
|
+
"superclass": {
|
|
2359
|
+
"name": "LitElement",
|
|
2360
|
+
"package": "lit"
|
|
2361
|
+
},
|
|
2362
|
+
"status": "draft",
|
|
2363
|
+
"category": "action",
|
|
2364
|
+
"tagName": "nord-command-menu",
|
|
2365
|
+
"customElement": true
|
|
2366
|
+
}
|
|
2367
|
+
],
|
|
2368
|
+
"exports": [
|
|
2369
|
+
{
|
|
2370
|
+
"kind": "js",
|
|
2371
|
+
"name": "default",
|
|
2372
|
+
"declaration": {
|
|
2373
|
+
"name": "CommandMenu",
|
|
2374
|
+
"module": "src/command-menu/CommandMenu.ts"
|
|
2375
|
+
}
|
|
2376
|
+
},
|
|
2377
|
+
{
|
|
2378
|
+
"kind": "custom-element-definition",
|
|
2379
|
+
"name": "nord-command-menu",
|
|
2380
|
+
"declaration": {
|
|
2381
|
+
"name": "CommandMenu",
|
|
2382
|
+
"module": "src/command-menu/CommandMenu.ts"
|
|
2383
|
+
}
|
|
2384
|
+
}
|
|
2385
|
+
],
|
|
2386
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to provide global and contextual keyboard shortcuts for users.\n- Make command menu available everywhere. Users must be able to bring up the command menu easily.\n- Make command menu central. Users should be able to find global shortcuts from one location.\n- Make command menu omnipotent. Give users access to every possible action.\n- Group related commands logically under sections with the section setting.\n- Use `Alt` key as the modifier, since this is less likely to clash with existing shortcuts.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make command menu available only in certain views of the application.\n- Don’t define shortcuts such as `Ctrl+C`, since this will clash with the native \"Copy\" shortcut.\n- Don't create complex shortcuts, as users will struggle to remember them.\n- Avoid using `KeyboardEvent.key` for defining the shortcut keys.\n- Don’t use as a search field only.\n\n</div>\n\n---\n\n## Content guidelines\n\nCommand titles should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they execute a command:\n\n<div class=\"n-usage n-usage-do\">Start consultation</div>\n<div class=\"n-usage n-usage-dont\">Consultation</div>\n\nAlways lead with a strong verb that encourages action. To provide enough context to user, use the {verb} + {noun} content formula:\n\n<div class=\"n-usage n-usage-do\">Open dashboard</div>\n<div class=\"n-usage n-usage-dont\">Dashboard</div>\n\nWhen writing command titles, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">New appointment</div>\n<div class=\"n-usage n-usage-dont\">New Appointment</div>\n\nAvoid unnecessary words and articles in command titles, such as “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Change theme</div>\n<div class=\"n-usage n-usage-dont\">Change the theme</div>\n\nAvoid ending in punctuation:\n\n<div class=\"n-usage n-usage-do\">Switch user</div>\n<div class=\"n-usage n-usage-dont\">Switch user.</div>\n\nUse ellipsis in the title when describing sections that have commands grouped inside of them:\n\n<div class=\"n-usage n-usage-do\">Change theme…</div>\n<div class=\"n-usage n-usage-dont\">Change theme</div>\n\n---\n\n## Commands data\n\nEach command in the `commands` data array must include at least an `id` and `title`. A command may also include properties for `section`, `icon`, `handler`, `shortcut` , `parent`, and `keywords`:\n\n| Name | Purpose |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | An identifier for each command, must be unique. Example: `id: \"user\"`. |\n| `title` | The title shown to users. This is used when searching for a command. Example: `title: \"Change theme...\"`. |\n| `keywords` | Not visible in the user interface, but can make it easier to discover commands through search. Example: `keywords: \"command change log sign out in\"`. |\n| `shortcut` | The keyboard shortcut. Example: `shortcut: \"Alt+KeyU\"`. See the sections [Defining Shortcuts](#defining-shortcuts) and [Choosing shortcuts](#choosing-shortcuts) below for more information. |\n| `section` | Used for grouping many commands under a common header. Example: `section: \"Commands\"`. |\n| `icon` | A name of an icon form Nordicons to show beside the title. If not specified, default command icon will be used instead. Example: `icon: \"file-picture\"`. |\n| `parent` | The `id` of a parent command. This is used for nesting commands. Example: `parent: \"theme\"`. |\n| `handler` | A function to execute when an user triggers a command. Example: `handler: () => { alert(\"Change to light theme\") }`. In cases where a command is only used as a parent command e.g. \"Change theme\", this is not required. |\n\n---\n\n## Defining shortcuts\n\nShortcuts in the Command Menu have the following form: `[modifier]+[key]`. Shortcuts are made up of a sequence of presses. A press can be as simple as a single key which matches against [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values):\n\n```js\n// Matches: event.code:\n\"KeyD\"\n```\n\nPresses can optionally be prefixed with **_modifiers_** which match against any valid value to [`KeyboardEvent.getModifierState()`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).\n\n```js\n\"Control+KeyD\"\n\"Meta+KeyD\"\n\"Shift+KeyD\"\n\"Alt+KeyD\"\n\"Meta+Shift+KeyD\"\n```\n\nThere is also a special `$mod` modifier that makes it easy to support cross platform keybindings:\n\n- Mac: `$mod` = `Meta` (⌘)\n- Windows/Linux: `$mod` = `Control`\n\n```js\n\"$mod+KeyD\" // ⌘/Ctrl + D\n\"$mod+Shift+KeyD\" // ⌘/Ctrl + Shift + D\n```\n\nThe Command Menu itself can be opened using `⌘+k` (or `Ctrl+k` on Windows) and closed by hitting `Esc`. These are both non-configurable shortcuts in order to unify the experience across our platforms.\n\n---\n\n## Choosing shortcuts\n\nWhen choosing shortcuts, it is very important that they do not clash with native operating system or browser shortcuts.\n\nFor example, you _should not_ define a shortcut like `$mod+KeyC`, since this will clash with the native “Copy” shortcut, and will be triggered every time a user copies text in the app. Nor should you use shortcuts like `Shift+KeyA` since this will get triggered whenever a user types an uppercase “A” character. Therefore, special care and attention must be given to _each and every_ shortcut choice.\n\nIn general, we recommend using the `Alt` modifier, since this is less likely to clash with existing shortcuts. However, be aware, the `Alt` key is also used for accented characters e.g. `Alt+KeyA` produces the letter “å”. Again, it is crucial that you choose shortcuts carefully.\n\nYou should strive to choose shortcuts that are intuitive and easy to remember. The more complex a shortcut, the less likely a user is to remember it. Of course, a user can still find a command by searching the command menu, and for some users this may be their preferred way of triggering commands.\n\n---\n\n## Common keybindings\n\nKeybindings will be matched against [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) and [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values) which may have some names you don’t expect. Please note that we recommend always using `KeyboardEvent.code` for defining the keys and only using `KeyboardEvent.key` for defining modifiers.\n\n| Windows | macOS | key | code |\n| ------------- | --------------- | ------------- | ------------------------------ |\n| N/A | `Command` / `⌘` | `Meta` | `MetaLeft` / `MetaRight` |\n| `Alt` | `Option` / `⌥` | `Alt` | `AltLeft` / `AltRight` |\n| `Control` | `Control` / `^` | `Control` | `ControlLeft` / `ControlRight` |\n| `Shift` | `Shift` | `Shift` | `ShiftLeft` / `ShiftRight` |\n| `Space` | `Space` | N/A | `Space` |\n| `Enter` | `Return` | `Enter` | `Enter` |\n| `Esc` | `Esc` | `Escape` | `Escape` |\n| `1`, `2`, etc | `1`, `2`, etc | `1`, `2`, etc | `Digit1`, `Digit2`, etc |\n| `a`, `b`, etc | `a`, `b`, etc | `a`, `b`, etc | `KeyA`, `KeyB`, etc |\n| `-` | `-` | `-` | `Minus` |\n| `=` | `=` | `=` | `Equal` |\n| `+` | `+` | `+` | `Equal`\\* |\n\nIn addition to the above table, you can use [https://keycode.info/](https://keycode.info/) for checking the specific values needed. Note that some keys will have the same code as others because they appear on the same key on the keyboard. Keep in mind how this is affected by international keyboards which may have different layouts.\n\n---\n\n## Navigating with the command menu\n\n1. Use `Ctrl+K` (Windows/Linux) or `Cmd+K` (Mac) to open the command menu.\n2. Start typing the command you want to execute. The suggestions in the command menu change to match your text.\n3. Finish entering the name, or use the arrow keys to highlight the command you want from the list of suggestions.\n4. Use `Enter` to execute the chosen command.\n5. If you chose a command that has nested commands, you can use `Backspace` to return to the previous menu.\n6. When the command menu is active, you can use one of the following keyboard shortcuts to close it: `Esc`, `Ctrl+K` (Windows and Linux) or `Cmd+K` (Mac).\n"
|
|
2387
|
+
},
|
|
2388
|
+
{
|
|
2389
|
+
"kind": "javascript-module",
|
|
2390
|
+
"path": "src/command-menu/CommandMenuAction.ts",
|
|
2391
|
+
"declarations": [
|
|
2392
|
+
{
|
|
2393
|
+
"kind": "class",
|
|
2394
|
+
"description": "Command Menu Action displays a single action that can be executed by the user. For usage examples, please see Command Menu component.",
|
|
2395
|
+
"name": "CommandMenuAction",
|
|
2396
|
+
"members": [
|
|
2397
|
+
{
|
|
2398
|
+
"kind": "field",
|
|
2399
|
+
"name": "command",
|
|
2338
2400
|
"type": {
|
|
2339
|
-
"text": "
|
|
2401
|
+
"text": "ICommandMenuAction"
|
|
2340
2402
|
},
|
|
2341
|
-
"
|
|
2342
|
-
"fieldName": "error",
|
|
2343
|
-
"inheritedFrom": {
|
|
2344
|
-
"name": "FormAssociatedMixin",
|
|
2345
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2346
|
-
}
|
|
2403
|
+
"attribute": "command"
|
|
2347
2404
|
},
|
|
2348
2405
|
{
|
|
2349
|
-
"
|
|
2406
|
+
"kind": "field",
|
|
2407
|
+
"name": "selected",
|
|
2350
2408
|
"type": {
|
|
2351
2409
|
"text": "boolean"
|
|
2352
2410
|
},
|
|
2353
2411
|
"default": "false",
|
|
2354
|
-
"
|
|
2355
|
-
"fieldName": "required",
|
|
2356
|
-
"inheritedFrom": {
|
|
2357
|
-
"name": "FormAssociatedMixin",
|
|
2358
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2359
|
-
}
|
|
2412
|
+
"attribute": "selected"
|
|
2360
2413
|
},
|
|
2361
2414
|
{
|
|
2362
|
-
"
|
|
2415
|
+
"kind": "method",
|
|
2416
|
+
"name": "ensureInView",
|
|
2417
|
+
"privacy": "private",
|
|
2418
|
+
"description": "Scroll to show element"
|
|
2419
|
+
},
|
|
2420
|
+
{
|
|
2421
|
+
"kind": "method",
|
|
2422
|
+
"name": "renderShortcut",
|
|
2423
|
+
"privacy": "private"
|
|
2424
|
+
}
|
|
2425
|
+
],
|
|
2426
|
+
"attributes": [
|
|
2427
|
+
{
|
|
2428
|
+
"name": "command",
|
|
2363
2429
|
"type": {
|
|
2364
|
-
"text": "
|
|
2430
|
+
"text": "ICommandMenuAction"
|
|
2365
2431
|
},
|
|
2366
|
-
"
|
|
2367
|
-
"description": "Controls whether the input expands to fill the width of its container.",
|
|
2368
|
-
"fieldName": "expand",
|
|
2369
|
-
"inheritedFrom": {
|
|
2370
|
-
"name": "FormAssociatedMixin",
|
|
2371
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2372
|
-
}
|
|
2432
|
+
"fieldName": "command"
|
|
2373
2433
|
},
|
|
2374
2434
|
{
|
|
2375
|
-
"name": "
|
|
2435
|
+
"name": "selected",
|
|
2376
2436
|
"type": {
|
|
2377
2437
|
"text": "boolean"
|
|
2378
2438
|
},
|
|
2379
2439
|
"default": "false",
|
|
2380
|
-
"
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2386
|
-
|
|
2440
|
+
"fieldName": "selected"
|
|
2441
|
+
}
|
|
2442
|
+
],
|
|
2443
|
+
"superclass": {
|
|
2444
|
+
"name": "LitElement",
|
|
2445
|
+
"package": "lit"
|
|
2446
|
+
},
|
|
2447
|
+
"status": "internal",
|
|
2448
|
+
"category": null,
|
|
2449
|
+
"tagName": "nord-command-menu-action",
|
|
2450
|
+
"customElement": true
|
|
2451
|
+
}
|
|
2452
|
+
],
|
|
2453
|
+
"exports": [
|
|
2454
|
+
{
|
|
2455
|
+
"kind": "js",
|
|
2456
|
+
"name": "default",
|
|
2457
|
+
"declaration": {
|
|
2458
|
+
"name": "CommandMenuAction",
|
|
2459
|
+
"module": "src/command-menu/CommandMenuAction.ts"
|
|
2460
|
+
}
|
|
2461
|
+
},
|
|
2462
|
+
{
|
|
2463
|
+
"kind": "custom-element-definition",
|
|
2464
|
+
"name": "nord-command-menu-action",
|
|
2465
|
+
"declaration": {
|
|
2466
|
+
"name": "CommandMenuAction",
|
|
2467
|
+
"module": "src/command-menu/CommandMenuAction.ts"
|
|
2468
|
+
}
|
|
2469
|
+
}
|
|
2470
|
+
],
|
|
2471
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to provide global and contextual keyboard shortcuts for users.\n- Make command menu available everywhere. Users must be able to bring up the command menu easily.\n- Make command menu central. Users should be able to find global shortcuts from one location.\n- Make command menu omnipotent. Give users access to every possible action.\n- Group related commands logically under sections with the section setting.\n- Use `Alt` key as the modifier, since this is less likely to clash with existing shortcuts.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make command menu available only in certain views of the application.\n- Don’t define shortcuts such as `Ctrl+C`, since this will clash with the native \"Copy\" shortcut.\n- Don't create complex shortcuts, as users will struggle to remember them.\n- Avoid using `KeyboardEvent.key` for defining the shortcut keys.\n- Don’t use as a search field only.\n\n</div>\n\n---\n\n## Content guidelines\n\nCommand titles should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they execute a command:\n\n<div class=\"n-usage n-usage-do\">Start consultation</div>\n<div class=\"n-usage n-usage-dont\">Consultation</div>\n\nAlways lead with a strong verb that encourages action. To provide enough context to user, use the {verb} + {noun} content formula:\n\n<div class=\"n-usage n-usage-do\">Open dashboard</div>\n<div class=\"n-usage n-usage-dont\">Dashboard</div>\n\nWhen writing command titles, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">New appointment</div>\n<div class=\"n-usage n-usage-dont\">New Appointment</div>\n\nAvoid unnecessary words and articles in command titles, such as “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Change theme</div>\n<div class=\"n-usage n-usage-dont\">Change the theme</div>\n\nAvoid ending in punctuation:\n\n<div class=\"n-usage n-usage-do\">Switch user</div>\n<div class=\"n-usage n-usage-dont\">Switch user.</div>\n\nUse ellipsis in the title when describing sections that have commands grouped inside of them:\n\n<div class=\"n-usage n-usage-do\">Change theme…</div>\n<div class=\"n-usage n-usage-dont\">Change theme</div>\n\n---\n\n## Commands data\n\nEach command in the `commands` data array must include at least an `id` and `title`. A command may also include properties for `section`, `icon`, `handler`, `shortcut` , `parent`, and `keywords`:\n\n| Name | Purpose |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | An identifier for each command, must be unique. Example: `id: \"user\"`. |\n| `title` | The title shown to users. This is used when searching for a command. Example: `title: \"Change theme...\"`. |\n| `keywords` | Not visible in the user interface, but can make it easier to discover commands through search. Example: `keywords: \"command change log sign out in\"`. |\n| `shortcut` | The keyboard shortcut. Example: `shortcut: \"Alt+KeyU\"`. See the sections [Defining Shortcuts](#defining-shortcuts) and [Choosing shortcuts](#choosing-shortcuts) below for more information. |\n| `section` | Used for grouping many commands under a common header. Example: `section: \"Commands\"`. |\n| `icon` | A name of an icon form Nordicons to show beside the title. If not specified, default command icon will be used instead. Example: `icon: \"file-picture\"`. |\n| `parent` | The `id` of a parent command. This is used for nesting commands. Example: `parent: \"theme\"`. |\n| `handler` | A function to execute when an user triggers a command. Example: `handler: () => { alert(\"Change to light theme\") }`. In cases where a command is only used as a parent command e.g. \"Change theme\", this is not required. |\n\n---\n\n## Defining shortcuts\n\nShortcuts in the Command Menu have the following form: `[modifier]+[key]`. Shortcuts are made up of a sequence of presses. A press can be as simple as a single key which matches against [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values):\n\n```js\n// Matches: event.code:\n\"KeyD\"\n```\n\nPresses can optionally be prefixed with **_modifiers_** which match against any valid value to [`KeyboardEvent.getModifierState()`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).\n\n```js\n\"Control+KeyD\"\n\"Meta+KeyD\"\n\"Shift+KeyD\"\n\"Alt+KeyD\"\n\"Meta+Shift+KeyD\"\n```\n\nThere is also a special `$mod` modifier that makes it easy to support cross platform keybindings:\n\n- Mac: `$mod` = `Meta` (⌘)\n- Windows/Linux: `$mod` = `Control`\n\n```js\n\"$mod+KeyD\" // ⌘/Ctrl + D\n\"$mod+Shift+KeyD\" // ⌘/Ctrl + Shift + D\n```\n\nThe Command Menu itself can be opened using `⌘+k` (or `Ctrl+k` on Windows) and closed by hitting `Esc`. These are both non-configurable shortcuts in order to unify the experience across our platforms.\n\n---\n\n## Choosing shortcuts\n\nWhen choosing shortcuts, it is very important that they do not clash with native operating system or browser shortcuts.\n\nFor example, you _should not_ define a shortcut like `$mod+KeyC`, since this will clash with the native “Copy” shortcut, and will be triggered every time a user copies text in the app. Nor should you use shortcuts like `Shift+KeyA` since this will get triggered whenever a user types an uppercase “A” character. Therefore, special care and attention must be given to _each and every_ shortcut choice.\n\nIn general, we recommend using the `Alt` modifier, since this is less likely to clash with existing shortcuts. However, be aware, the `Alt` key is also used for accented characters e.g. `Alt+KeyA` produces the letter “å”. Again, it is crucial that you choose shortcuts carefully.\n\nYou should strive to choose shortcuts that are intuitive and easy to remember. The more complex a shortcut, the less likely a user is to remember it. Of course, a user can still find a command by searching the command menu, and for some users this may be their preferred way of triggering commands.\n\n---\n\n## Common keybindings\n\nKeybindings will be matched against [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) and [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values) which may have some names you don’t expect. Please note that we recommend always using `KeyboardEvent.code` for defining the keys and only using `KeyboardEvent.key` for defining modifiers.\n\n| Windows | macOS | key | code |\n| ------------- | --------------- | ------------- | ------------------------------ |\n| N/A | `Command` / `⌘` | `Meta` | `MetaLeft` / `MetaRight` |\n| `Alt` | `Option` / `⌥` | `Alt` | `AltLeft` / `AltRight` |\n| `Control` | `Control` / `^` | `Control` | `ControlLeft` / `ControlRight` |\n| `Shift` | `Shift` | `Shift` | `ShiftLeft` / `ShiftRight` |\n| `Space` | `Space` | N/A | `Space` |\n| `Enter` | `Return` | `Enter` | `Enter` |\n| `Esc` | `Esc` | `Escape` | `Escape` |\n| `1`, `2`, etc | `1`, `2`, etc | `1`, `2`, etc | `Digit1`, `Digit2`, etc |\n| `a`, `b`, etc | `a`, `b`, etc | `a`, `b`, etc | `KeyA`, `KeyB`, etc |\n| `-` | `-` | `-` | `Minus` |\n| `=` | `=` | `=` | `Equal` |\n| `+` | `+` | `+` | `Equal`\\* |\n\nIn addition to the above table, you can use [https://keycode.info/](https://keycode.info/) for checking the specific values needed. Note that some keys will have the same code as others because they appear on the same key on the keyboard. Keep in mind how this is affected by international keyboards which may have different layouts.\n\n---\n\n## Navigating with the command menu\n\n1. Use `Ctrl+K` (Windows/Linux) or `Cmd+K` (Mac) to open the command menu.\n2. Start typing the command you want to execute. The suggestions in the command menu change to match your text.\n3. Finish entering the name, or use the arrow keys to highlight the command you want from the list of suggestions.\n4. Use `Enter` to execute the chosen command.\n5. If you chose a command that has nested commands, you can use `Backspace` to return to the previous menu.\n6. When the command menu is active, you can use one of the following keyboard shortcuts to close it: `Esc`, `Ctrl+K` (Windows and Linux) or `Cmd+K` (Mac).\n"
|
|
2472
|
+
},
|
|
2473
|
+
{
|
|
2474
|
+
"kind": "javascript-module",
|
|
2475
|
+
"path": "src/command-menu/ICommandMenuAction.ts",
|
|
2476
|
+
"declarations": [],
|
|
2477
|
+
"exports": [],
|
|
2478
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to provide global and contextual keyboard shortcuts for users.\n- Make command menu available everywhere. Users must be able to bring up the command menu easily.\n- Make command menu central. Users should be able to find global shortcuts from one location.\n- Make command menu omnipotent. Give users access to every possible action.\n- Group related commands logically under sections with the section setting.\n- Use `Alt` key as the modifier, since this is less likely to clash with existing shortcuts.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make command menu available only in certain views of the application.\n- Don’t define shortcuts such as `Ctrl+C`, since this will clash with the native \"Copy\" shortcut.\n- Don't create complex shortcuts, as users will struggle to remember them.\n- Avoid using `KeyboardEvent.key` for defining the shortcut keys.\n- Don’t use as a search field only.\n\n</div>\n\n---\n\n## Content guidelines\n\nCommand titles should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they execute a command:\n\n<div class=\"n-usage n-usage-do\">Start consultation</div>\n<div class=\"n-usage n-usage-dont\">Consultation</div>\n\nAlways lead with a strong verb that encourages action. To provide enough context to user, use the {verb} + {noun} content formula:\n\n<div class=\"n-usage n-usage-do\">Open dashboard</div>\n<div class=\"n-usage n-usage-dont\">Dashboard</div>\n\nWhen writing command titles, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">New appointment</div>\n<div class=\"n-usage n-usage-dont\">New Appointment</div>\n\nAvoid unnecessary words and articles in command titles, such as “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Change theme</div>\n<div class=\"n-usage n-usage-dont\">Change the theme</div>\n\nAvoid ending in punctuation:\n\n<div class=\"n-usage n-usage-do\">Switch user</div>\n<div class=\"n-usage n-usage-dont\">Switch user.</div>\n\nUse ellipsis in the title when describing sections that have commands grouped inside of them:\n\n<div class=\"n-usage n-usage-do\">Change theme…</div>\n<div class=\"n-usage n-usage-dont\">Change theme</div>\n\n---\n\n## Commands data\n\nEach command in the `commands` data array must include at least an `id` and `title`. A command may also include properties for `section`, `icon`, `handler`, `shortcut` , `parent`, and `keywords`:\n\n| Name | Purpose |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | An identifier for each command, must be unique. Example: `id: \"user\"`. |\n| `title` | The title shown to users. This is used when searching for a command. Example: `title: \"Change theme...\"`. |\n| `keywords` | Not visible in the user interface, but can make it easier to discover commands through search. Example: `keywords: \"command change log sign out in\"`. |\n| `shortcut` | The keyboard shortcut. Example: `shortcut: \"Alt+KeyU\"`. See the sections [Defining Shortcuts](#defining-shortcuts) and [Choosing shortcuts](#choosing-shortcuts) below for more information. |\n| `section` | Used for grouping many commands under a common header. Example: `section: \"Commands\"`. |\n| `icon` | A name of an icon form Nordicons to show beside the title. If not specified, default command icon will be used instead. Example: `icon: \"file-picture\"`. |\n| `parent` | The `id` of a parent command. This is used for nesting commands. Example: `parent: \"theme\"`. |\n| `handler` | A function to execute when an user triggers a command. Example: `handler: () => { alert(\"Change to light theme\") }`. In cases where a command is only used as a parent command e.g. \"Change theme\", this is not required. |\n\n---\n\n## Defining shortcuts\n\nShortcuts in the Command Menu have the following form: `[modifier]+[key]`. Shortcuts are made up of a sequence of presses. A press can be as simple as a single key which matches against [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values):\n\n```js\n// Matches: event.code:\n\"KeyD\"\n```\n\nPresses can optionally be prefixed with **_modifiers_** which match against any valid value to [`KeyboardEvent.getModifierState()`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).\n\n```js\n\"Control+KeyD\"\n\"Meta+KeyD\"\n\"Shift+KeyD\"\n\"Alt+KeyD\"\n\"Meta+Shift+KeyD\"\n```\n\nThere is also a special `$mod` modifier that makes it easy to support cross platform keybindings:\n\n- Mac: `$mod` = `Meta` (⌘)\n- Windows/Linux: `$mod` = `Control`\n\n```js\n\"$mod+KeyD\" // ⌘/Ctrl + D\n\"$mod+Shift+KeyD\" // ⌘/Ctrl + Shift + D\n```\n\nThe Command Menu itself can be opened using `⌘+k` (or `Ctrl+k` on Windows) and closed by hitting `Esc`. These are both non-configurable shortcuts in order to unify the experience across our platforms.\n\n---\n\n## Choosing shortcuts\n\nWhen choosing shortcuts, it is very important that they do not clash with native operating system or browser shortcuts.\n\nFor example, you _should not_ define a shortcut like `$mod+KeyC`, since this will clash with the native “Copy” shortcut, and will be triggered every time a user copies text in the app. Nor should you use shortcuts like `Shift+KeyA` since this will get triggered whenever a user types an uppercase “A” character. Therefore, special care and attention must be given to _each and every_ shortcut choice.\n\nIn general, we recommend using the `Alt` modifier, since this is less likely to clash with existing shortcuts. However, be aware, the `Alt` key is also used for accented characters e.g. `Alt+KeyA` produces the letter “å”. Again, it is crucial that you choose shortcuts carefully.\n\nYou should strive to choose shortcuts that are intuitive and easy to remember. The more complex a shortcut, the less likely a user is to remember it. Of course, a user can still find a command by searching the command menu, and for some users this may be their preferred way of triggering commands.\n\n---\n\n## Common keybindings\n\nKeybindings will be matched against [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) and [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values) which may have some names you don’t expect. Please note that we recommend always using `KeyboardEvent.code` for defining the keys and only using `KeyboardEvent.key` for defining modifiers.\n\n| Windows | macOS | key | code |\n| ------------- | --------------- | ------------- | ------------------------------ |\n| N/A | `Command` / `⌘` | `Meta` | `MetaLeft` / `MetaRight` |\n| `Alt` | `Option` / `⌥` | `Alt` | `AltLeft` / `AltRight` |\n| `Control` | `Control` / `^` | `Control` | `ControlLeft` / `ControlRight` |\n| `Shift` | `Shift` | `Shift` | `ShiftLeft` / `ShiftRight` |\n| `Space` | `Space` | N/A | `Space` |\n| `Enter` | `Return` | `Enter` | `Enter` |\n| `Esc` | `Esc` | `Escape` | `Escape` |\n| `1`, `2`, etc | `1`, `2`, etc | `1`, `2`, etc | `Digit1`, `Digit2`, etc |\n| `a`, `b`, etc | `a`, `b`, etc | `a`, `b`, etc | `KeyA`, `KeyB`, etc |\n| `-` | `-` | `-` | `Minus` |\n| `=` | `=` | `=` | `Equal` |\n| `+` | `+` | `+` | `Equal`\\* |\n\nIn addition to the above table, you can use [https://keycode.info/](https://keycode.info/) for checking the specific values needed. Note that some keys will have the same code as others because they appear on the same key on the keyboard. Keep in mind how this is affected by international keyboards which may have different layouts.\n\n---\n\n## Navigating with the command menu\n\n1. Use `Ctrl+K` (Windows/Linux) or `Cmd+K` (Mac) to open the command menu.\n2. Start typing the command you want to execute. The suggestions in the command menu change to match your text.\n3. Finish entering the name, or use the arrow keys to highlight the command you want from the list of suggestions.\n4. Use `Enter` to execute the chosen command.\n5. If you chose a command that has nested commands, you can use `Backspace` to return to the previous menu.\n6. When the command menu is active, you can use one of the following keyboard shortcuts to close it: `Esc`, `Ctrl+K` (Windows and Linux) or `Cmd+K` (Mac).\n"
|
|
2479
|
+
},
|
|
2480
|
+
{
|
|
2481
|
+
"kind": "javascript-module",
|
|
2482
|
+
"path": "src/command-menu/KeyboardController.ts",
|
|
2483
|
+
"declarations": [
|
|
2484
|
+
{
|
|
2485
|
+
"kind": "class",
|
|
2486
|
+
"description": "",
|
|
2487
|
+
"name": "KeyboardController",
|
|
2488
|
+
"members": [
|
|
2387
2489
|
{
|
|
2388
|
-
"
|
|
2490
|
+
"kind": "field",
|
|
2491
|
+
"name": "host",
|
|
2389
2492
|
"type": {
|
|
2390
|
-
"text": "
|
|
2493
|
+
"text": "CommandMenu"
|
|
2391
2494
|
},
|
|
2392
|
-
"
|
|
2393
|
-
"
|
|
2394
|
-
"inheritedFrom": {
|
|
2395
|
-
"name": "InputMixin",
|
|
2396
|
-
"module": "src/common/mixins/InputMixin.ts"
|
|
2397
|
-
}
|
|
2495
|
+
"privacy": "private",
|
|
2496
|
+
"default": "host"
|
|
2398
2497
|
},
|
|
2399
2498
|
{
|
|
2400
|
-
"
|
|
2499
|
+
"kind": "field",
|
|
2500
|
+
"name": "globalShortcuts",
|
|
2401
2501
|
"type": {
|
|
2402
|
-
"text": "
|
|
2502
|
+
"text": "ShortcutController"
|
|
2403
2503
|
},
|
|
2404
|
-
"
|
|
2405
|
-
"
|
|
2406
|
-
"fieldName": "value",
|
|
2407
|
-
"inheritedFrom": {
|
|
2408
|
-
"name": "InputMixin",
|
|
2409
|
-
"module": "src/common/mixins/InputMixin.ts"
|
|
2410
|
-
}
|
|
2411
|
-
}
|
|
2412
|
-
],
|
|
2413
|
-
"mixins": [
|
|
2414
|
-
{
|
|
2415
|
-
"name": "FormAssociatedMixin",
|
|
2416
|
-
"module": "/src/common/mixins/FormAssociatedMixin.js"
|
|
2504
|
+
"privacy": "private",
|
|
2505
|
+
"default": "new ShortcutController(host, { \"$mod+k\": preventDefault(actions.toggleOpen) })"
|
|
2417
2506
|
},
|
|
2418
2507
|
{
|
|
2419
|
-
"
|
|
2420
|
-
"
|
|
2508
|
+
"kind": "field",
|
|
2509
|
+
"name": "navigationShortcuts",
|
|
2510
|
+
"type": {
|
|
2511
|
+
"text": "ShortcutController"
|
|
2512
|
+
},
|
|
2513
|
+
"privacy": "private",
|
|
2514
|
+
"default": "new ShortcutController(\n host,\n {\n Enter: preventDefault(actions.trigger),\n Backspace: actions.goBack, // we don't want to prevent default, since that would stop backspace deleting chars\n End: preventDefault(actions.end),\n Home: preventDefault(actions.start),\n ArrowDown: preventDefault(actions.next),\n ArrowUp: preventDefault(actions.previous),\n },\n host\n )"
|
|
2421
2515
|
},
|
|
2422
2516
|
{
|
|
2423
|
-
"
|
|
2424
|
-
"
|
|
2517
|
+
"kind": "field",
|
|
2518
|
+
"name": "commandShortcuts",
|
|
2519
|
+
"type": {
|
|
2520
|
+
"text": "ShortcutController"
|
|
2521
|
+
},
|
|
2522
|
+
"privacy": "private",
|
|
2523
|
+
"default": "new ShortcutController(host)"
|
|
2425
2524
|
},
|
|
2426
2525
|
{
|
|
2427
|
-
"
|
|
2428
|
-
"
|
|
2526
|
+
"kind": "method",
|
|
2527
|
+
"name": "registerCommandShortcuts"
|
|
2429
2528
|
}
|
|
2430
|
-
]
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
"
|
|
2436
|
-
"
|
|
2437
|
-
"
|
|
2438
|
-
|
|
2439
|
-
|
|
2529
|
+
]
|
|
2530
|
+
}
|
|
2531
|
+
],
|
|
2532
|
+
"exports": [
|
|
2533
|
+
{
|
|
2534
|
+
"kind": "js",
|
|
2535
|
+
"name": "KeyboardController",
|
|
2536
|
+
"declaration": {
|
|
2537
|
+
"name": "KeyboardController",
|
|
2538
|
+
"module": "src/command-menu/KeyboardController.ts"
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
],
|
|
2542
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to provide global and contextual keyboard shortcuts for users.\n- Make command menu available everywhere. Users must be able to bring up the command menu easily.\n- Make command menu central. Users should be able to find global shortcuts from one location.\n- Make command menu omnipotent. Give users access to every possible action.\n- Group related commands logically under sections with the section setting.\n- Use `Alt` key as the modifier, since this is less likely to clash with existing shortcuts.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make command menu available only in certain views of the application.\n- Don’t define shortcuts such as `Ctrl+C`, since this will clash with the native \"Copy\" shortcut.\n- Don't create complex shortcuts, as users will struggle to remember them.\n- Avoid using `KeyboardEvent.key` for defining the shortcut keys.\n- Don’t use as a search field only.\n\n</div>\n\n---\n\n## Content guidelines\n\nCommand titles should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they execute a command:\n\n<div class=\"n-usage n-usage-do\">Start consultation</div>\n<div class=\"n-usage n-usage-dont\">Consultation</div>\n\nAlways lead with a strong verb that encourages action. To provide enough context to user, use the {verb} + {noun} content formula:\n\n<div class=\"n-usage n-usage-do\">Open dashboard</div>\n<div class=\"n-usage n-usage-dont\">Dashboard</div>\n\nWhen writing command titles, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">New appointment</div>\n<div class=\"n-usage n-usage-dont\">New Appointment</div>\n\nAvoid unnecessary words and articles in command titles, such as “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Change theme</div>\n<div class=\"n-usage n-usage-dont\">Change the theme</div>\n\nAvoid ending in punctuation:\n\n<div class=\"n-usage n-usage-do\">Switch user</div>\n<div class=\"n-usage n-usage-dont\">Switch user.</div>\n\nUse ellipsis in the title when describing sections that have commands grouped inside of them:\n\n<div class=\"n-usage n-usage-do\">Change theme…</div>\n<div class=\"n-usage n-usage-dont\">Change theme</div>\n\n---\n\n## Commands data\n\nEach command in the `commands` data array must include at least an `id` and `title`. A command may also include properties for `section`, `icon`, `handler`, `shortcut` , `parent`, and `keywords`:\n\n| Name | Purpose |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | An identifier for each command, must be unique. Example: `id: \"user\"`. |\n| `title` | The title shown to users. This is used when searching for a command. Example: `title: \"Change theme...\"`. |\n| `keywords` | Not visible in the user interface, but can make it easier to discover commands through search. Example: `keywords: \"command change log sign out in\"`. |\n| `shortcut` | The keyboard shortcut. Example: `shortcut: \"Alt+KeyU\"`. See the sections [Defining Shortcuts](#defining-shortcuts) and [Choosing shortcuts](#choosing-shortcuts) below for more information. |\n| `section` | Used for grouping many commands under a common header. Example: `section: \"Commands\"`. |\n| `icon` | A name of an icon form Nordicons to show beside the title. If not specified, default command icon will be used instead. Example: `icon: \"file-picture\"`. |\n| `parent` | The `id` of a parent command. This is used for nesting commands. Example: `parent: \"theme\"`. |\n| `handler` | A function to execute when an user triggers a command. Example: `handler: () => { alert(\"Change to light theme\") }`. In cases where a command is only used as a parent command e.g. \"Change theme\", this is not required. |\n\n---\n\n## Defining shortcuts\n\nShortcuts in the Command Menu have the following form: `[modifier]+[key]`. Shortcuts are made up of a sequence of presses. A press can be as simple as a single key which matches against [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values):\n\n```js\n// Matches: event.code:\n\"KeyD\"\n```\n\nPresses can optionally be prefixed with **_modifiers_** which match against any valid value to [`KeyboardEvent.getModifierState()`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).\n\n```js\n\"Control+KeyD\"\n\"Meta+KeyD\"\n\"Shift+KeyD\"\n\"Alt+KeyD\"\n\"Meta+Shift+KeyD\"\n```\n\nThere is also a special `$mod` modifier that makes it easy to support cross platform keybindings:\n\n- Mac: `$mod` = `Meta` (⌘)\n- Windows/Linux: `$mod` = `Control`\n\n```js\n\"$mod+KeyD\" // ⌘/Ctrl + D\n\"$mod+Shift+KeyD\" // ⌘/Ctrl + Shift + D\n```\n\nThe Command Menu itself can be opened using `⌘+k` (or `Ctrl+k` on Windows) and closed by hitting `Esc`. These are both non-configurable shortcuts in order to unify the experience across our platforms.\n\n---\n\n## Choosing shortcuts\n\nWhen choosing shortcuts, it is very important that they do not clash with native operating system or browser shortcuts.\n\nFor example, you _should not_ define a shortcut like `$mod+KeyC`, since this will clash with the native “Copy” shortcut, and will be triggered every time a user copies text in the app. Nor should you use shortcuts like `Shift+KeyA` since this will get triggered whenever a user types an uppercase “A” character. Therefore, special care and attention must be given to _each and every_ shortcut choice.\n\nIn general, we recommend using the `Alt` modifier, since this is less likely to clash with existing shortcuts. However, be aware, the `Alt` key is also used for accented characters e.g. `Alt+KeyA` produces the letter “å”. Again, it is crucial that you choose shortcuts carefully.\n\nYou should strive to choose shortcuts that are intuitive and easy to remember. The more complex a shortcut, the less likely a user is to remember it. Of course, a user can still find a command by searching the command menu, and for some users this may be their preferred way of triggering commands.\n\n---\n\n## Common keybindings\n\nKeybindings will be matched against [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) and [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values) which may have some names you don’t expect. Please note that we recommend always using `KeyboardEvent.code` for defining the keys and only using `KeyboardEvent.key` for defining modifiers.\n\n| Windows | macOS | key | code |\n| ------------- | --------------- | ------------- | ------------------------------ |\n| N/A | `Command` / `⌘` | `Meta` | `MetaLeft` / `MetaRight` |\n| `Alt` | `Option` / `⌥` | `Alt` | `AltLeft` / `AltRight` |\n| `Control` | `Control` / `^` | `Control` | `ControlLeft` / `ControlRight` |\n| `Shift` | `Shift` | `Shift` | `ShiftLeft` / `ShiftRight` |\n| `Space` | `Space` | N/A | `Space` |\n| `Enter` | `Return` | `Enter` | `Enter` |\n| `Esc` | `Esc` | `Escape` | `Escape` |\n| `1`, `2`, etc | `1`, `2`, etc | `1`, `2`, etc | `Digit1`, `Digit2`, etc |\n| `a`, `b`, etc | `a`, `b`, etc | `a`, `b`, etc | `KeyA`, `KeyB`, etc |\n| `-` | `-` | `-` | `Minus` |\n| `=` | `=` | `=` | `Equal` |\n| `+` | `+` | `+` | `Equal`\\* |\n\nIn addition to the above table, you can use [https://keycode.info/](https://keycode.info/) for checking the specific values needed. Note that some keys will have the same code as others because they appear on the same key on the keyboard. Keep in mind how this is affected by international keyboards which may have different layouts.\n\n---\n\n## Navigating with the command menu\n\n1. Use `Ctrl+K` (Windows/Linux) or `Cmd+K` (Mac) to open the command menu.\n2. Start typing the command you want to execute. The suggestions in the command menu change to match your text.\n3. Finish entering the name, or use the arrow keys to highlight the command you want from the list of suggestions.\n4. Use `Enter` to execute the chosen command.\n5. If you chose a command that has nested commands, you can use `Backspace` to return to the previous menu.\n6. When the command menu is active, you can use one of the following keyboard shortcuts to close it: `Esc`, `Ctrl+K` (Windows and Linux) or `Cmd+K` (Mac).\n"
|
|
2543
|
+
},
|
|
2544
|
+
{
|
|
2545
|
+
"kind": "javascript-module",
|
|
2546
|
+
"path": "src/command-menu/SelectEvent.ts",
|
|
2547
|
+
"declarations": [
|
|
2548
|
+
{
|
|
2549
|
+
"kind": "class",
|
|
2550
|
+
"description": "",
|
|
2551
|
+
"name": "SelectEvent",
|
|
2552
|
+
"members": [
|
|
2440
2553
|
{
|
|
2441
|
-
"
|
|
2554
|
+
"kind": "field",
|
|
2555
|
+
"name": "eventName",
|
|
2442
2556
|
"type": {
|
|
2443
|
-
"text": "
|
|
2557
|
+
"text": "string"
|
|
2444
2558
|
},
|
|
2445
|
-
"
|
|
2446
|
-
"
|
|
2447
|
-
"name": "FormAssociatedMixin",
|
|
2448
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2449
|
-
}
|
|
2559
|
+
"static": true,
|
|
2560
|
+
"default": "\"nord-select\""
|
|
2450
2561
|
},
|
|
2451
2562
|
{
|
|
2452
|
-
"
|
|
2563
|
+
"kind": "field",
|
|
2564
|
+
"name": "command",
|
|
2453
2565
|
"type": {
|
|
2454
|
-
"text": "
|
|
2566
|
+
"text": "ICommandMenuAction"
|
|
2455
2567
|
},
|
|
2456
|
-
"
|
|
2457
|
-
"inheritedFrom": {
|
|
2458
|
-
"name": "FormAssociatedMixin",
|
|
2459
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2460
|
-
}
|
|
2568
|
+
"default": "command"
|
|
2461
2569
|
}
|
|
2462
|
-
]
|
|
2570
|
+
],
|
|
2571
|
+
"superclass": {
|
|
2572
|
+
"name": "NordEvent",
|
|
2573
|
+
"module": "/src/common/events.js"
|
|
2574
|
+
}
|
|
2463
2575
|
}
|
|
2464
2576
|
],
|
|
2465
2577
|
"exports": [
|
|
2466
2578
|
{
|
|
2467
2579
|
"kind": "js",
|
|
2468
|
-
"name": "
|
|
2469
|
-
"declaration": {
|
|
2470
|
-
"name": "Checkbox",
|
|
2471
|
-
"module": "src/checkbox/Checkbox.ts"
|
|
2472
|
-
}
|
|
2473
|
-
},
|
|
2474
|
-
{
|
|
2475
|
-
"kind": "custom-element-definition",
|
|
2476
|
-
"name": "nord-checkbox",
|
|
2580
|
+
"name": "SelectEvent",
|
|
2477
2581
|
"declaration": {
|
|
2478
|
-
"name": "
|
|
2479
|
-
"module": "src/
|
|
2582
|
+
"name": "SelectEvent",
|
|
2583
|
+
"module": "src/command-menu/SelectEvent.ts"
|
|
2480
2584
|
}
|
|
2481
2585
|
}
|
|
2482
2586
|
],
|
|
2483
|
-
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use for making it possible to choose one or more options from a limited number of options.\n- Use for “accepting terms of service” and similar functionality.\n- Use in forms to toggle something on or off.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use when you have more than 10 options to choose from.\n- Don’t change the selection of another checkbox when another one is clicked. Only exception is when a checkbox is used to make a bulk selection of multiple items.\n\n</div>\n\n---\n\n## Content guidelines\n\nCheckbox labels should be clear, accurate and predictable. It should be possible for the user to understand what they are selecting:\n\n<div class=\"n-usage n-usage-do\">User settings</div>\n<div class=\"n-usage n-usage-dont\">Option 1</div>\n\nWhen writing checkbox labels, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">User settings</div>\n<div class=\"n-usage n-usage-dont\">User Settings</div>\n\nAvoid ending in punctuation if it’s a single sentence, word, or a fragment:\n\n<div class=\"n-usage n-usage-do\">Show dashboard</div>\n<div class=\"n-usage n-usage-dont\">Show dashboard.</div>\n\nDo not use commas or semicolons at the end of each line\n\n<div class=\"n-usage n-usage-do\">Patients</div>\n<div class=\"n-usage n-usage-dont\">Patients;</div>\n"
|
|
2587
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to provide global and contextual keyboard shortcuts for users.\n- Make command menu available everywhere. Users must be able to bring up the command menu easily.\n- Make command menu central. Users should be able to find global shortcuts from one location.\n- Make command menu omnipotent. Give users access to every possible action.\n- Group related commands logically under sections with the section setting.\n- Use `Alt` key as the modifier, since this is less likely to clash with existing shortcuts.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make command menu available only in certain views of the application.\n- Don’t define shortcuts such as `Ctrl+C`, since this will clash with the native \"Copy\" shortcut.\n- Don't create complex shortcuts, as users will struggle to remember them.\n- Avoid using `KeyboardEvent.key` for defining the shortcut keys.\n- Don’t use as a search field only.\n\n</div>\n\n---\n\n## Content guidelines\n\nCommand titles should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they execute a command:\n\n<div class=\"n-usage n-usage-do\">Start consultation</div>\n<div class=\"n-usage n-usage-dont\">Consultation</div>\n\nAlways lead with a strong verb that encourages action. To provide enough context to user, use the {verb} + {noun} content formula:\n\n<div class=\"n-usage n-usage-do\">Open dashboard</div>\n<div class=\"n-usage n-usage-dont\">Dashboard</div>\n\nWhen writing command titles, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">New appointment</div>\n<div class=\"n-usage n-usage-dont\">New Appointment</div>\n\nAvoid unnecessary words and articles in command titles, such as “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Change theme</div>\n<div class=\"n-usage n-usage-dont\">Change the theme</div>\n\nAvoid ending in punctuation:\n\n<div class=\"n-usage n-usage-do\">Switch user</div>\n<div class=\"n-usage n-usage-dont\">Switch user.</div>\n\nUse ellipsis in the title when describing sections that have commands grouped inside of them:\n\n<div class=\"n-usage n-usage-do\">Change theme…</div>\n<div class=\"n-usage n-usage-dont\">Change theme</div>\n\n---\n\n## Commands data\n\nEach command in the `commands` data array must include at least an `id` and `title`. A command may also include properties for `section`, `icon`, `handler`, `shortcut` , `parent`, and `keywords`:\n\n| Name | Purpose |\n| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| `id` | An identifier for each command, must be unique. Example: `id: \"user\"`. |\n| `title` | The title shown to users. This is used when searching for a command. Example: `title: \"Change theme...\"`. |\n| `keywords` | Not visible in the user interface, but can make it easier to discover commands through search. Example: `keywords: \"command change log sign out in\"`. |\n| `shortcut` | The keyboard shortcut. Example: `shortcut: \"Alt+KeyU\"`. See the sections [Defining Shortcuts](#defining-shortcuts) and [Choosing shortcuts](#choosing-shortcuts) below for more information. |\n| `section` | Used for grouping many commands under a common header. Example: `section: \"Commands\"`. |\n| `icon` | A name of an icon form Nordicons to show beside the title. If not specified, default command icon will be used instead. Example: `icon: \"file-picture\"`. |\n| `parent` | The `id` of a parent command. This is used for nesting commands. Example: `parent: \"theme\"`. |\n| `handler` | A function to execute when an user triggers a command. Example: `handler: () => { alert(\"Change to light theme\") }`. In cases where a command is only used as a parent command e.g. \"Change theme\", this is not required. |\n\n---\n\n## Defining shortcuts\n\nShortcuts in the Command Menu have the following form: `[modifier]+[key]`. Shortcuts are made up of a sequence of presses. A press can be as simple as a single key which matches against [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values):\n\n```js\n// Matches: event.code:\n\"KeyD\"\n```\n\nPresses can optionally be prefixed with **_modifiers_** which match against any valid value to [`KeyboardEvent.getModifierState()`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/getModifierState).\n\n```js\n\"Control+KeyD\"\n\"Meta+KeyD\"\n\"Shift+KeyD\"\n\"Alt+KeyD\"\n\"Meta+Shift+KeyD\"\n```\n\nThere is also a special `$mod` modifier that makes it easy to support cross platform keybindings:\n\n- Mac: `$mod` = `Meta` (⌘)\n- Windows/Linux: `$mod` = `Control`\n\n```js\n\"$mod+KeyD\" // ⌘/Ctrl + D\n\"$mod+Shift+KeyD\" // ⌘/Ctrl + Shift + D\n```\n\nThe Command Menu itself can be opened using `⌘+k` (or `Ctrl+k` on Windows) and closed by hitting `Esc`. These are both non-configurable shortcuts in order to unify the experience across our platforms.\n\n---\n\n## Choosing shortcuts\n\nWhen choosing shortcuts, it is very important that they do not clash with native operating system or browser shortcuts.\n\nFor example, you _should not_ define a shortcut like `$mod+KeyC`, since this will clash with the native “Copy” shortcut, and will be triggered every time a user copies text in the app. Nor should you use shortcuts like `Shift+KeyA` since this will get triggered whenever a user types an uppercase “A” character. Therefore, special care and attention must be given to _each and every_ shortcut choice.\n\nIn general, we recommend using the `Alt` modifier, since this is less likely to clash with existing shortcuts. However, be aware, the `Alt` key is also used for accented characters e.g. `Alt+KeyA` produces the letter “å”. Again, it is crucial that you choose shortcuts carefully.\n\nYou should strive to choose shortcuts that are intuitive and easy to remember. The more complex a shortcut, the less likely a user is to remember it. Of course, a user can still find a command by searching the command menu, and for some users this may be their preferred way of triggering commands.\n\n---\n\n## Common keybindings\n\nKeybindings will be matched against [`KeyboardEvent.key`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key) and [`KeyboardEvent.code`](https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/code/code_values) which may have some names you don’t expect. Please note that we recommend always using `KeyboardEvent.code` for defining the keys and only using `KeyboardEvent.key` for defining modifiers.\n\n| Windows | macOS | key | code |\n| ------------- | --------------- | ------------- | ------------------------------ |\n| N/A | `Command` / `⌘` | `Meta` | `MetaLeft` / `MetaRight` |\n| `Alt` | `Option` / `⌥` | `Alt` | `AltLeft` / `AltRight` |\n| `Control` | `Control` / `^` | `Control` | `ControlLeft` / `ControlRight` |\n| `Shift` | `Shift` | `Shift` | `ShiftLeft` / `ShiftRight` |\n| `Space` | `Space` | N/A | `Space` |\n| `Enter` | `Return` | `Enter` | `Enter` |\n| `Esc` | `Esc` | `Escape` | `Escape` |\n| `1`, `2`, etc | `1`, `2`, etc | `1`, `2`, etc | `Digit1`, `Digit2`, etc |\n| `a`, `b`, etc | `a`, `b`, etc | `a`, `b`, etc | `KeyA`, `KeyB`, etc |\n| `-` | `-` | `-` | `Minus` |\n| `=` | `=` | `=` | `Equal` |\n| `+` | `+` | `+` | `Equal`\\* |\n\nIn addition to the above table, you can use [https://keycode.info/](https://keycode.info/) for checking the specific values needed. Note that some keys will have the same code as others because they appear on the same key on the keyboard. Keep in mind how this is affected by international keyboards which may have different layouts.\n\n---\n\n## Navigating with the command menu\n\n1. Use `Ctrl+K` (Windows/Linux) or `Cmd+K` (Mac) to open the command menu.\n2. Start typing the command you want to execute. The suggestions in the command menu change to match your text.\n3. Finish entering the name, or use the arrow keys to highlight the command you want from the list of suggestions.\n4. Use `Enter` to execute the chosen command.\n5. If you chose a command that has nested commands, you can use `Backspace` to return to the previous menu.\n6. When the command menu is active, you can use one of the following keyboard shortcuts to close it: `Esc`, `Ctrl+K` (Windows and Linux) or `Cmd+K` (Mac).\n"
|
|
2484
2588
|
},
|
|
2485
2589
|
{
|
|
2486
2590
|
"kind": "javascript-module",
|
|
@@ -4501,6 +4605,148 @@
|
|
|
4501
4605
|
],
|
|
4502
4606
|
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use the fieldset component when you need to create a relationship between multiple form inputs.\n- It is especially important to use with a group of radio components.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t place interactive content (buttons, links etc) inside the label.\n- Don’t use with a checkbox component when there is **only one** checkbox. For example, when accepting terms and conditions.\n\n</div>\n\n-------\n\n## Content guidelines\n\nFieldset label should be clear, accurate and predictable. It should help the user to understand how the items in the fieldset are grouped together, or what kind of choice the user is making:\n\n<div class=\"n-usage n-usage-do\">Pick a color</div>\n<div class=\"n-usage n-usage-dont\">Choose</div>\n\nWhen writing fieldset labels, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">Pick a color</div>\n<div class=\"n-usage n-usage-dont\">Pick A Color</div>\n\nAvoid ending in punctuation if it’s a single sentence, word, or a fragment:\n\n<div class=\"n-usage n-usage-do\">Pick a color</div>\n<div class=\"n-usage n-usage-dont\">Pick a color.</div>\n\nDo not use colons in fieldset label:\n\n<div class=\"n-usage n-usage-do\">Payment details</div>\n<div class=\"n-usage n-usage-dont\">Payment details:</div>\n\n-------\n\n## Additional considerations\n\n- A label (which becomes to `<legend>` inside the fieldset) is always required.\n- Hint text can be used to offer further information or explanation for an option.\n"
|
|
4503
4607
|
},
|
|
4608
|
+
{
|
|
4609
|
+
"kind": "javascript-module",
|
|
4610
|
+
"path": "src/empty-state/EmptyState.ts",
|
|
4611
|
+
"declarations": [
|
|
4612
|
+
{
|
|
4613
|
+
"kind": "class",
|
|
4614
|
+
"description": "Empty state can be used when there is no data to display to\ndescribe what the user can do next. Empty state should provide\nexplanation or guidance to help user progress.",
|
|
4615
|
+
"name": "EmptyState",
|
|
4616
|
+
"slots": [
|
|
4617
|
+
{
|
|
4618
|
+
"description": "default slot",
|
|
4619
|
+
"name": ""
|
|
4620
|
+
}
|
|
4621
|
+
],
|
|
4622
|
+
"members": [
|
|
4623
|
+
{
|
|
4624
|
+
"kind": "field",
|
|
4625
|
+
"name": "_warningLogged",
|
|
4626
|
+
"type": {
|
|
4627
|
+
"text": "boolean"
|
|
4628
|
+
},
|
|
4629
|
+
"privacy": "private",
|
|
4630
|
+
"static": true,
|
|
4631
|
+
"default": "false",
|
|
4632
|
+
"inheritedFrom": {
|
|
4633
|
+
"name": "DraftComponentMixin",
|
|
4634
|
+
"module": "src/common/mixins/DraftComponentMixin.ts"
|
|
4635
|
+
}
|
|
4636
|
+
}
|
|
4637
|
+
],
|
|
4638
|
+
"mixins": [
|
|
4639
|
+
{
|
|
4640
|
+
"name": "DraftComponentMixin",
|
|
4641
|
+
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
4642
|
+
}
|
|
4643
|
+
],
|
|
4644
|
+
"superclass": {
|
|
4645
|
+
"name": "LitElement",
|
|
4646
|
+
"package": "lit"
|
|
4647
|
+
},
|
|
4648
|
+
"status": "draft",
|
|
4649
|
+
"category": "feedback",
|
|
4650
|
+
"tagName": "nord-empty-state",
|
|
4651
|
+
"customElement": true
|
|
4652
|
+
}
|
|
4653
|
+
],
|
|
4654
|
+
"exports": [
|
|
4655
|
+
{
|
|
4656
|
+
"kind": "js",
|
|
4657
|
+
"name": "default",
|
|
4658
|
+
"declaration": {
|
|
4659
|
+
"name": "EmptyState",
|
|
4660
|
+
"module": "src/empty-state/EmptyState.ts"
|
|
4661
|
+
}
|
|
4662
|
+
},
|
|
4663
|
+
{
|
|
4664
|
+
"kind": "custom-element-definition",
|
|
4665
|
+
"name": "nord-empty-state",
|
|
4666
|
+
"declaration": {
|
|
4667
|
+
"name": "EmptyState",
|
|
4668
|
+
"module": "src/empty-state/EmptyState.ts"
|
|
4669
|
+
}
|
|
4670
|
+
}
|
|
4671
|
+
],
|
|
4672
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use when another component or part of UI has no items or data to show.\n- Help users by clearly explaining the benefit and utility of a product or feature.\n- Be encouraging and never make users feel unsuccessful or guilty.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use as a generic banner to highlight specific content.\n\n</div>\n\n---\n\n## Content guidelines\n\nEmpty state headings should state to the user what’s wrong or why there’s no content:\n\n<div class=\"n-usage n-usage-do\">No results found</div>\n<div class=\"n-usage n-usage-dont\">Error</div>\n\nWhen writing empty state headings, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">You don’t have access to this content</div>\n<div class=\"n-usage n-usage-dont\">You Don’t Have Access To This Content</div>\n\nDescriptions in empty states should add useful and relevant additional information:\n\n<div class=\"n-usage n-usage-do\">We were unable to connect to the service. Click Retry to try again or View log to learn what happened.</div>\n<div class=\"n-usage n-usage-dont\">No connection.</div>\n\nButton labels should be clear, accurate and predictable. It should be possible for the user to understand what will happen when they click a button:\n\n<div class=\"n-usage n-usage-do\">Clear filters</div>\n<div class=\"n-usage n-usage-dont\">Clear</div>\n\nWhen writing button labels, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">View log</div>\n<div class=\"n-usage n-usage-dont\">View Log</div>\n\nAvoid unnecessary words and articles in button labels, such as “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Request access</div>\n<div class=\"n-usage n-usage-dont\">Request an access</div>\n"
|
|
4673
|
+
},
|
|
4674
|
+
{
|
|
4675
|
+
"kind": "javascript-module",
|
|
4676
|
+
"path": "src/header/Header.ts",
|
|
4677
|
+
"declarations": [
|
|
4678
|
+
{
|
|
4679
|
+
"kind": "class",
|
|
4680
|
+
"description": "The header is a block of designated space for labelling the currently\nviewed context as well as providing primary actions.",
|
|
4681
|
+
"name": "Header",
|
|
4682
|
+
"slots": [
|
|
4683
|
+
{
|
|
4684
|
+
"description": "The header content.",
|
|
4685
|
+
"name": ""
|
|
4686
|
+
},
|
|
4687
|
+
{
|
|
4688
|
+
"description": "Optional slot for buttons, toggles, etc.",
|
|
4689
|
+
"name": "action"
|
|
4690
|
+
}
|
|
4691
|
+
],
|
|
4692
|
+
"members": [
|
|
4693
|
+
{
|
|
4694
|
+
"kind": "field",
|
|
4695
|
+
"name": "actionSlot",
|
|
4696
|
+
"privacy": "private",
|
|
4697
|
+
"default": "new SlotController(this, \"action\")"
|
|
4698
|
+
},
|
|
4699
|
+
{
|
|
4700
|
+
"kind": "field",
|
|
4701
|
+
"name": "_warningLogged",
|
|
4702
|
+
"type": {
|
|
4703
|
+
"text": "boolean"
|
|
4704
|
+
},
|
|
4705
|
+
"privacy": "private",
|
|
4706
|
+
"static": true,
|
|
4707
|
+
"default": "false",
|
|
4708
|
+
"inheritedFrom": {
|
|
4709
|
+
"name": "DraftComponentMixin",
|
|
4710
|
+
"module": "src/common/mixins/DraftComponentMixin.ts"
|
|
4711
|
+
}
|
|
4712
|
+
}
|
|
4713
|
+
],
|
|
4714
|
+
"mixins": [
|
|
4715
|
+
{
|
|
4716
|
+
"name": "DraftComponentMixin",
|
|
4717
|
+
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
4718
|
+
}
|
|
4719
|
+
],
|
|
4720
|
+
"superclass": {
|
|
4721
|
+
"name": "LitElement",
|
|
4722
|
+
"package": "lit"
|
|
4723
|
+
},
|
|
4724
|
+
"status": "draft",
|
|
4725
|
+
"category": "structure",
|
|
4726
|
+
"tagName": "nord-header",
|
|
4727
|
+
"customElement": true
|
|
4728
|
+
}
|
|
4729
|
+
],
|
|
4730
|
+
"exports": [
|
|
4731
|
+
{
|
|
4732
|
+
"kind": "js",
|
|
4733
|
+
"name": "default",
|
|
4734
|
+
"declaration": {
|
|
4735
|
+
"name": "Header",
|
|
4736
|
+
"module": "src/header/Header.ts"
|
|
4737
|
+
}
|
|
4738
|
+
},
|
|
4739
|
+
{
|
|
4740
|
+
"kind": "custom-element-definition",
|
|
4741
|
+
"name": "nord-header",
|
|
4742
|
+
"declaration": {
|
|
4743
|
+
"name": "Header",
|
|
4744
|
+
"module": "src/header/Header.ts"
|
|
4745
|
+
}
|
|
4746
|
+
}
|
|
4747
|
+
],
|
|
4748
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use the header component to show a heading to describe the current view.\n- Use the header component to hold primary actions.\n- Use the header component at a visual high position at full width.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t overcrowd the header component with too many actions or information.\n- Don’t nest the header component too deeply and restrict its available space.\n\n</div>\n\n-------\n\n## Content guidelines\n\nThe header component should be a containing element placed high on the page to present high level controls and to describe the page itself. It shouldn’t be overcrowded with controls or information.\n\n<div class=\"n-usage n-usage-do\">[Menu] Dashboard [Account] [Log out]</div>\n<div class=\"n-usage n-usage-dont\">[Menu] Use the cards below to view various information [Export] [Save] [Edit Profile] [Log out] [Preferences]</div>\n"
|
|
4749
|
+
},
|
|
4504
4750
|
{
|
|
4505
4751
|
"kind": "javascript-module",
|
|
4506
4752
|
"path": "src/icon/Icon.ts",
|
|
@@ -4756,82 +5002,6 @@
|
|
|
4756
5002
|
],
|
|
4757
5003
|
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to provide additional meaning in addition to a text label.\n- Use to help users who have difficulties with reading and attention.\n- Use in places where text label doesn’t fit (remember to add an accessible label for the icon).\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use for decorative purposes alone.\n- Don’t use when a button’s action is already clear based on the text label.\n- Don’t use the same icon for differing purposes, as users will come to associate icons with specific types of actions.\n\n</div>\n\n---\n\n## Additional considerations\n\n- Icon components are hidden from assistive technologies by default.\n- Use `label` property to give an accessible label for the icon and to make it visible to assistive technologies.\n"
|
|
4758
5004
|
},
|
|
4759
|
-
{
|
|
4760
|
-
"kind": "javascript-module",
|
|
4761
|
-
"path": "src/header/Header.ts",
|
|
4762
|
-
"declarations": [
|
|
4763
|
-
{
|
|
4764
|
-
"kind": "class",
|
|
4765
|
-
"description": "The header is a block of designated space for labelling the currently\nviewed context as well as providing primary actions.",
|
|
4766
|
-
"name": "Header",
|
|
4767
|
-
"slots": [
|
|
4768
|
-
{
|
|
4769
|
-
"description": "The header content.",
|
|
4770
|
-
"name": ""
|
|
4771
|
-
},
|
|
4772
|
-
{
|
|
4773
|
-
"description": "Optional slot for buttons, toggles, etc.",
|
|
4774
|
-
"name": "action"
|
|
4775
|
-
}
|
|
4776
|
-
],
|
|
4777
|
-
"members": [
|
|
4778
|
-
{
|
|
4779
|
-
"kind": "field",
|
|
4780
|
-
"name": "actionSlot",
|
|
4781
|
-
"privacy": "private",
|
|
4782
|
-
"default": "new SlotController(this, \"action\")"
|
|
4783
|
-
},
|
|
4784
|
-
{
|
|
4785
|
-
"kind": "field",
|
|
4786
|
-
"name": "_warningLogged",
|
|
4787
|
-
"type": {
|
|
4788
|
-
"text": "boolean"
|
|
4789
|
-
},
|
|
4790
|
-
"privacy": "private",
|
|
4791
|
-
"static": true,
|
|
4792
|
-
"default": "false",
|
|
4793
|
-
"inheritedFrom": {
|
|
4794
|
-
"name": "DraftComponentMixin",
|
|
4795
|
-
"module": "src/common/mixins/DraftComponentMixin.ts"
|
|
4796
|
-
}
|
|
4797
|
-
}
|
|
4798
|
-
],
|
|
4799
|
-
"mixins": [
|
|
4800
|
-
{
|
|
4801
|
-
"name": "DraftComponentMixin",
|
|
4802
|
-
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
4803
|
-
}
|
|
4804
|
-
],
|
|
4805
|
-
"superclass": {
|
|
4806
|
-
"name": "LitElement",
|
|
4807
|
-
"package": "lit"
|
|
4808
|
-
},
|
|
4809
|
-
"status": "draft",
|
|
4810
|
-
"category": "structure",
|
|
4811
|
-
"tagName": "nord-header",
|
|
4812
|
-
"customElement": true
|
|
4813
|
-
}
|
|
4814
|
-
],
|
|
4815
|
-
"exports": [
|
|
4816
|
-
{
|
|
4817
|
-
"kind": "js",
|
|
4818
|
-
"name": "default",
|
|
4819
|
-
"declaration": {
|
|
4820
|
-
"name": "Header",
|
|
4821
|
-
"module": "src/header/Header.ts"
|
|
4822
|
-
}
|
|
4823
|
-
},
|
|
4824
|
-
{
|
|
4825
|
-
"kind": "custom-element-definition",
|
|
4826
|
-
"name": "nord-header",
|
|
4827
|
-
"declaration": {
|
|
4828
|
-
"name": "Header",
|
|
4829
|
-
"module": "src/header/Header.ts"
|
|
4830
|
-
}
|
|
4831
|
-
}
|
|
4832
|
-
],
|
|
4833
|
-
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use the header component to show a heading to describe the current view.\n- Use the header component to hold primary actions.\n- Use the header component at a visual high position at full width.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t overcrowd the header component with too many actions or information.\n- Don’t nest the header component too deeply and restrict its available space.\n\n</div>\n\n-------\n\n## Content guidelines\n\nThe header component should be a containing element placed high on the page to present high level controls and to describe the page itself. It shouldn’t be overcrowded with controls or information.\n\n<div class=\"n-usage n-usage-do\">[Menu] Dashboard [Account] [Log out]</div>\n<div class=\"n-usage n-usage-dont\">[Menu] Use the cards below to view various information [Export] [Save] [Edit Profile] [Log out] [Preferences]</div>\n"
|
|
4834
|
-
},
|
|
4835
5005
|
{
|
|
4836
5006
|
"kind": "javascript-module",
|
|
4837
5007
|
"path": "src/input/Input.ts",
|