@nordhealth/components 1.0.0-alpha.52 → 1.0.0-alpha.53
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 +917 -917
- package/lib/Button.js +1 -1
- package/lib/Button.js.map +1 -1
- package/package.json +2 -2
package/custom-elements.json
CHANGED
|
@@ -686,6 +686,114 @@
|
|
|
686
686
|
],
|
|
687
687
|
"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 clear and accurate labels.\n- Use established button colors appropriately. For example, only use a danger button style for an action that’s difficult or impossible to undo.\n- Prioritize the most important actions. Too many buttons will cause confusion.\n- Be consistent with positioning of buttons in the user interface.\n- Use strong, actionable verbs in labels such as “Add”, “Close”, “Cancel”, or “Save”.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use buttons to link to other pages. Use regular link or a plain style instead where necessary.\n- Don’t use buttons for navigation where the link appears within or following a sentence.\n- Don’t use labels such as “Read more”, “Click here” or “More”.\n\n</div>\n\n---\n\n## Content guidelines\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\">View user settings</div>\n<div class=\"n-usage n-usage-dont\">Click here</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\">My tasks</div>\n<div class=\"n-usage n-usage-dont\">My Tasks</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\">Add item</div>\n<div class=\"n-usage n-usage-dont\">Add an item</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| `default` | Default style is the most common button variant. Only switch to another variant if you need to adjust the visual weight of the element. |\n| `primary` | Primary style is reserved for main call-to-actions. Should be used only once per content area or panel, e.g. for a “Save” action. |\n| `dashed` | Dashed style should be used for actions that trigger filtering. |\n| `danger` | Danger style should be used for actions that delete data or otherwise make it hard to undo the action. |\n| `plain` | Used for less important or less common actions. Can be also used for linking to other pages. |\n| `disabled` | Used for actions that aren’t currently available or not available anymore. Also prevents users from being able to interact with the component, and conveys its inactive state to assistive technologies. |\n\n---\n\n## Additional considerations\n\n- Users of assistive technology expect a button to submit data or do an action. If you need the button to navigate into another view, use the `href` property which will output `<a>` tag instead of a `<button>`.\n- When you need to disable a button, use `disabled` property as it conveys this information correctly to assistive technologies like screen readers.\n- Button component provides 3 size variants; small, medium and large. The large size should only be used for marketing purposes or on areas such as an empty space/content notice.\n"
|
|
688
688
|
},
|
|
689
|
+
{
|
|
690
|
+
"kind": "javascript-module",
|
|
691
|
+
"path": "src/card/Card.ts",
|
|
692
|
+
"declarations": [
|
|
693
|
+
{
|
|
694
|
+
"kind": "class",
|
|
695
|
+
"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.",
|
|
696
|
+
"name": "Card",
|
|
697
|
+
"slots": [
|
|
698
|
+
{
|
|
699
|
+
"description": "The card content.",
|
|
700
|
+
"name": ""
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
"description": "Optional slot that holds a header for the card.",
|
|
704
|
+
"name": "header"
|
|
705
|
+
},
|
|
706
|
+
{
|
|
707
|
+
"description": "Optional slot that holds footer content for the card.",
|
|
708
|
+
"name": "footer"
|
|
709
|
+
}
|
|
710
|
+
],
|
|
711
|
+
"members": [
|
|
712
|
+
{
|
|
713
|
+
"kind": "field",
|
|
714
|
+
"name": "headerSlot",
|
|
715
|
+
"privacy": "private",
|
|
716
|
+
"default": "new SlotController(this, \"header\")"
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"kind": "field",
|
|
720
|
+
"name": "footerSlot",
|
|
721
|
+
"privacy": "private",
|
|
722
|
+
"default": "new SlotController(this, \"footer\")"
|
|
723
|
+
},
|
|
724
|
+
{
|
|
725
|
+
"kind": "field",
|
|
726
|
+
"name": "padding",
|
|
727
|
+
"type": {
|
|
728
|
+
"text": "\"m\" | \"l\" | \"none\""
|
|
729
|
+
},
|
|
730
|
+
"default": "\"m\"",
|
|
731
|
+
"description": "Controls the padding of card component. When set to “none”,\nthe header and footer slots will still have padding.",
|
|
732
|
+
"attribute": "padding",
|
|
733
|
+
"reflects": true
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
"kind": "field",
|
|
737
|
+
"name": "_warningLogged",
|
|
738
|
+
"type": {
|
|
739
|
+
"text": "boolean"
|
|
740
|
+
},
|
|
741
|
+
"privacy": "private",
|
|
742
|
+
"static": true,
|
|
743
|
+
"default": "false",
|
|
744
|
+
"inheritedFrom": {
|
|
745
|
+
"name": "DraftComponentMixin",
|
|
746
|
+
"module": "src/common/mixins/DraftComponentMixin.ts"
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
],
|
|
750
|
+
"attributes": [
|
|
751
|
+
{
|
|
752
|
+
"name": "padding",
|
|
753
|
+
"type": {
|
|
754
|
+
"text": "\"m\" | \"l\" | \"none\""
|
|
755
|
+
},
|
|
756
|
+
"default": "\"m\"",
|
|
757
|
+
"description": "Controls the padding of card component. When set to “none”,\nthe header and footer slots will still have padding.",
|
|
758
|
+
"fieldName": "padding"
|
|
759
|
+
}
|
|
760
|
+
],
|
|
761
|
+
"mixins": [
|
|
762
|
+
{
|
|
763
|
+
"name": "DraftComponentMixin",
|
|
764
|
+
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
765
|
+
}
|
|
766
|
+
],
|
|
767
|
+
"superclass": {
|
|
768
|
+
"name": "LitElement",
|
|
769
|
+
"package": "lit"
|
|
770
|
+
},
|
|
771
|
+
"status": "draft",
|
|
772
|
+
"category": "structure",
|
|
773
|
+
"tagName": "nord-card",
|
|
774
|
+
"customElement": true
|
|
775
|
+
}
|
|
776
|
+
],
|
|
777
|
+
"exports": [
|
|
778
|
+
{
|
|
779
|
+
"kind": "js",
|
|
780
|
+
"name": "default",
|
|
781
|
+
"declaration": {
|
|
782
|
+
"name": "Card",
|
|
783
|
+
"module": "src/card/Card.ts"
|
|
784
|
+
}
|
|
785
|
+
},
|
|
786
|
+
{
|
|
787
|
+
"kind": "custom-element-definition",
|
|
788
|
+
"name": "nord-card",
|
|
789
|
+
"declaration": {
|
|
790
|
+
"name": "Card",
|
|
791
|
+
"module": "src/card/Card.ts"
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
],
|
|
795
|
+
"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"
|
|
796
|
+
},
|
|
689
797
|
{
|
|
690
798
|
"kind": "javascript-module",
|
|
691
799
|
"path": "src/calendar/Calendar.ts",
|
|
@@ -1167,385 +1275,411 @@
|
|
|
1167
1275
|
},
|
|
1168
1276
|
{
|
|
1169
1277
|
"kind": "javascript-module",
|
|
1170
|
-
"path": "src/
|
|
1278
|
+
"path": "src/checkbox/Checkbox.ts",
|
|
1171
1279
|
"declarations": [
|
|
1172
1280
|
{
|
|
1173
1281
|
"kind": "class",
|
|
1174
|
-
"description": "
|
|
1175
|
-
"name": "
|
|
1282
|
+
"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.",
|
|
1283
|
+
"name": "Checkbox",
|
|
1176
1284
|
"slots": [
|
|
1177
1285
|
{
|
|
1178
|
-
"description": "
|
|
1179
|
-
"name": ""
|
|
1286
|
+
"description": "Use when a label requires more than plain text.",
|
|
1287
|
+
"name": "label"
|
|
1180
1288
|
},
|
|
1181
1289
|
{
|
|
1182
|
-
"description": "Optional slot that holds
|
|
1183
|
-
"name": "
|
|
1290
|
+
"description": "Optional slot that holds hint text for the input.",
|
|
1291
|
+
"name": "hint"
|
|
1184
1292
|
},
|
|
1185
1293
|
{
|
|
1186
|
-
"description": "Optional slot that holds
|
|
1187
|
-
"name": "
|
|
1294
|
+
"description": "Optional slot that holds error text for the input.",
|
|
1295
|
+
"name": "error"
|
|
1188
1296
|
}
|
|
1189
1297
|
],
|
|
1190
1298
|
"members": [
|
|
1191
1299
|
{
|
|
1192
1300
|
"kind": "field",
|
|
1193
|
-
"name": "
|
|
1194
|
-
"privacy": "
|
|
1195
|
-
"
|
|
1301
|
+
"name": "formValue",
|
|
1302
|
+
"privacy": "protected",
|
|
1303
|
+
"inheritedFrom": {
|
|
1304
|
+
"name": "FormAssociatedMixin",
|
|
1305
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1306
|
+
}
|
|
1196
1307
|
},
|
|
1197
1308
|
{
|
|
1198
1309
|
"kind": "field",
|
|
1199
|
-
"name": "
|
|
1200
|
-
"
|
|
1201
|
-
|
|
1310
|
+
"name": "checked",
|
|
1311
|
+
"type": {
|
|
1312
|
+
"text": "boolean"
|
|
1313
|
+
},
|
|
1314
|
+
"default": "false",
|
|
1315
|
+
"description": "Controls whether the checkbox is checked or not.",
|
|
1316
|
+
"attribute": "checked"
|
|
1317
|
+
},
|
|
1318
|
+
{
|
|
1319
|
+
"kind": "method",
|
|
1320
|
+
"name": "handleChange",
|
|
1321
|
+
"privacy": "protected",
|
|
1322
|
+
"return": {
|
|
1323
|
+
"type": {
|
|
1324
|
+
"text": "void"
|
|
1325
|
+
}
|
|
1326
|
+
},
|
|
1327
|
+
"parameters": [
|
|
1328
|
+
{
|
|
1329
|
+
"name": "e",
|
|
1330
|
+
"type": {
|
|
1331
|
+
"text": "Event"
|
|
1332
|
+
}
|
|
1333
|
+
}
|
|
1334
|
+
],
|
|
1335
|
+
"inheritedFrom": {
|
|
1336
|
+
"name": "FormAssociatedMixin",
|
|
1337
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1338
|
+
}
|
|
1202
1339
|
},
|
|
1203
1340
|
{
|
|
1204
1341
|
"kind": "field",
|
|
1205
|
-
"name": "
|
|
1342
|
+
"name": "labelSlot",
|
|
1343
|
+
"privacy": "protected",
|
|
1344
|
+
"default": "new SlotController(this, \"label\")",
|
|
1345
|
+
"inheritedFrom": {
|
|
1346
|
+
"name": "FormAssociatedMixin",
|
|
1347
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1348
|
+
}
|
|
1349
|
+
},
|
|
1350
|
+
{
|
|
1351
|
+
"kind": "field",
|
|
1352
|
+
"name": "errorSlot",
|
|
1353
|
+
"privacy": "protected",
|
|
1354
|
+
"default": "new SlotController(this, \"error\")",
|
|
1355
|
+
"inheritedFrom": {
|
|
1356
|
+
"name": "FormAssociatedMixin",
|
|
1357
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1358
|
+
}
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
"kind": "field",
|
|
1362
|
+
"name": "hintSlot",
|
|
1363
|
+
"privacy": "protected",
|
|
1364
|
+
"default": "new SlotController(this, \"hint\")",
|
|
1365
|
+
"inheritedFrom": {
|
|
1366
|
+
"name": "FormAssociatedMixin",
|
|
1367
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1368
|
+
}
|
|
1369
|
+
},
|
|
1370
|
+
{
|
|
1371
|
+
"kind": "field",
|
|
1372
|
+
"name": "formData",
|
|
1373
|
+
"privacy": "protected",
|
|
1374
|
+
"default": "new FormDataController(this, { value: () => this.formValue })",
|
|
1375
|
+
"inheritedFrom": {
|
|
1376
|
+
"name": "FormAssociatedMixin",
|
|
1377
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1378
|
+
}
|
|
1379
|
+
},
|
|
1380
|
+
{
|
|
1381
|
+
"kind": "field",
|
|
1382
|
+
"name": "inputId",
|
|
1206
1383
|
"type": {
|
|
1207
|
-
"text": "
|
|
1384
|
+
"text": "string"
|
|
1208
1385
|
},
|
|
1209
|
-
"
|
|
1210
|
-
"
|
|
1211
|
-
"
|
|
1212
|
-
|
|
1386
|
+
"privacy": "protected",
|
|
1387
|
+
"default": "\"input\"",
|
|
1388
|
+
"inheritedFrom": {
|
|
1389
|
+
"name": "FormAssociatedMixin",
|
|
1390
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1391
|
+
}
|
|
1213
1392
|
},
|
|
1214
1393
|
{
|
|
1215
1394
|
"kind": "field",
|
|
1216
|
-
"name": "
|
|
1395
|
+
"name": "errorId",
|
|
1217
1396
|
"type": {
|
|
1218
|
-
"text": "
|
|
1397
|
+
"text": "string"
|
|
1219
1398
|
},
|
|
1220
|
-
"privacy": "
|
|
1221
|
-
"
|
|
1222
|
-
"default": "false",
|
|
1399
|
+
"privacy": "protected",
|
|
1400
|
+
"default": "\"error\"",
|
|
1223
1401
|
"inheritedFrom": {
|
|
1224
|
-
"name": "
|
|
1225
|
-
"module": "src/common/mixins/
|
|
1402
|
+
"name": "FormAssociatedMixin",
|
|
1403
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1226
1404
|
}
|
|
1227
|
-
}
|
|
1228
|
-
],
|
|
1229
|
-
"attributes": [
|
|
1405
|
+
},
|
|
1230
1406
|
{
|
|
1231
|
-
"
|
|
1407
|
+
"kind": "field",
|
|
1408
|
+
"name": "hintId",
|
|
1232
1409
|
"type": {
|
|
1233
|
-
"text": "
|
|
1410
|
+
"text": "string"
|
|
1234
1411
|
},
|
|
1235
|
-
"
|
|
1236
|
-
"
|
|
1237
|
-
"
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
"name": "DraftComponentMixin",
|
|
1243
|
-
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
1244
|
-
}
|
|
1245
|
-
],
|
|
1246
|
-
"superclass": {
|
|
1247
|
-
"name": "LitElement",
|
|
1248
|
-
"package": "lit"
|
|
1249
|
-
},
|
|
1250
|
-
"status": "draft",
|
|
1251
|
-
"category": "structure",
|
|
1252
|
-
"tagName": "nord-card",
|
|
1253
|
-
"customElement": true
|
|
1254
|
-
}
|
|
1255
|
-
],
|
|
1256
|
-
"exports": [
|
|
1257
|
-
{
|
|
1258
|
-
"kind": "js",
|
|
1259
|
-
"name": "default",
|
|
1260
|
-
"declaration": {
|
|
1261
|
-
"name": "Card",
|
|
1262
|
-
"module": "src/card/Card.ts"
|
|
1263
|
-
}
|
|
1264
|
-
},
|
|
1265
|
-
{
|
|
1266
|
-
"kind": "custom-element-definition",
|
|
1267
|
-
"name": "nord-card",
|
|
1268
|
-
"declaration": {
|
|
1269
|
-
"name": "Card",
|
|
1270
|
-
"module": "src/card/Card.ts"
|
|
1271
|
-
}
|
|
1272
|
-
}
|
|
1273
|
-
],
|
|
1274
|
-
"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"
|
|
1275
|
-
},
|
|
1276
|
-
{
|
|
1277
|
-
"kind": "javascript-module",
|
|
1278
|
-
"path": "src/command-menu/CommandMenu.ts",
|
|
1279
|
-
"declarations": [
|
|
1280
|
-
{
|
|
1281
|
-
"kind": "class",
|
|
1282
|
-
"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.",
|
|
1283
|
-
"name": "CommandMenu",
|
|
1284
|
-
"slots": [
|
|
1285
|
-
{
|
|
1286
|
-
"description": "Used to replace the default footer contents.",
|
|
1287
|
-
"name": "footer"
|
|
1288
|
-
}
|
|
1289
|
-
],
|
|
1290
|
-
"members": [
|
|
1291
|
-
{
|
|
1292
|
-
"kind": "field",
|
|
1293
|
-
"name": "inputRef",
|
|
1294
|
-
"privacy": "private"
|
|
1295
|
-
},
|
|
1296
|
-
{
|
|
1297
|
-
"kind": "field",
|
|
1298
|
-
"name": "listRef",
|
|
1299
|
-
"privacy": "private"
|
|
1300
|
-
},
|
|
1412
|
+
"privacy": "protected",
|
|
1413
|
+
"default": "\"hint\"",
|
|
1414
|
+
"inheritedFrom": {
|
|
1415
|
+
"name": "FormAssociatedMixin",
|
|
1416
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1417
|
+
}
|
|
1418
|
+
},
|
|
1301
1419
|
{
|
|
1302
1420
|
"kind": "field",
|
|
1303
|
-
"name": "
|
|
1421
|
+
"name": "label",
|
|
1304
1422
|
"type": {
|
|
1305
|
-
"text": "
|
|
1423
|
+
"text": "string"
|
|
1306
1424
|
},
|
|
1307
|
-
"
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
"
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1425
|
+
"default": "\"\"",
|
|
1426
|
+
"description": "Label for the input.",
|
|
1427
|
+
"attribute": "label",
|
|
1428
|
+
"inheritedFrom": {
|
|
1429
|
+
"name": "FormAssociatedMixin",
|
|
1430
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1431
|
+
}
|
|
1314
1432
|
},
|
|
1315
1433
|
{
|
|
1316
1434
|
"kind": "field",
|
|
1317
|
-
"name": "
|
|
1318
|
-
"
|
|
1319
|
-
|
|
1435
|
+
"name": "hint",
|
|
1436
|
+
"type": {
|
|
1437
|
+
"text": "string | undefined"
|
|
1438
|
+
},
|
|
1439
|
+
"description": "Optional hint text to be displayed with the input. Alternatively use the hint slot.",
|
|
1440
|
+
"attribute": "hint",
|
|
1441
|
+
"inheritedFrom": {
|
|
1442
|
+
"name": "FormAssociatedMixin",
|
|
1443
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1444
|
+
}
|
|
1320
1445
|
},
|
|
1321
1446
|
{
|
|
1322
1447
|
"kind": "field",
|
|
1323
|
-
"name": "
|
|
1448
|
+
"name": "hideLabel",
|
|
1324
1449
|
"type": {
|
|
1325
1450
|
"text": "boolean"
|
|
1326
1451
|
},
|
|
1327
1452
|
"default": "false",
|
|
1328
|
-
"description": "
|
|
1329
|
-
"attribute": "
|
|
1453
|
+
"description": "Visually hide the label, but still show it to assistive technologies like screen readers.",
|
|
1454
|
+
"attribute": "hide-label",
|
|
1455
|
+
"inheritedFrom": {
|
|
1456
|
+
"name": "FormAssociatedMixin",
|
|
1457
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1458
|
+
}
|
|
1330
1459
|
},
|
|
1331
1460
|
{
|
|
1332
1461
|
"kind": "field",
|
|
1333
1462
|
"name": "placeholder",
|
|
1334
|
-
"type": {
|
|
1335
|
-
"text": "string"
|
|
1336
|
-
},
|
|
1337
|
-
"default": "\"Type a command or search...\"",
|
|
1338
|
-
"description": "Hint text to display in the Command Menu search field.",
|
|
1339
|
-
"attribute": "placeholder"
|
|
1340
|
-
},
|
|
1341
|
-
{
|
|
1342
|
-
"kind": "field",
|
|
1343
|
-
"name": "commands",
|
|
1344
|
-
"type": {
|
|
1345
|
-
"text": "Array<ICommandMenuAction>"
|
|
1346
|
-
},
|
|
1347
|
-
"default": "[]",
|
|
1348
|
-
"description": "Array of commands to be included in the menu.\nPlease see “Commands data” section for more documentation."
|
|
1349
|
-
},
|
|
1350
|
-
{
|
|
1351
|
-
"kind": "field",
|
|
1352
|
-
"name": "parent",
|
|
1353
1463
|
"type": {
|
|
1354
1464
|
"text": "string | undefined"
|
|
1355
1465
|
},
|
|
1356
|
-
"
|
|
1466
|
+
"description": "Placeholder text to display within the input.",
|
|
1467
|
+
"attribute": "placeholder",
|
|
1468
|
+
"inheritedFrom": {
|
|
1469
|
+
"name": "FormAssociatedMixin",
|
|
1470
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1471
|
+
}
|
|
1357
1472
|
},
|
|
1358
1473
|
{
|
|
1359
1474
|
"kind": "field",
|
|
1360
|
-
"name": "
|
|
1475
|
+
"name": "error",
|
|
1361
1476
|
"type": {
|
|
1362
|
-
"text": "string"
|
|
1477
|
+
"text": "string | undefined"
|
|
1363
1478
|
},
|
|
1364
|
-
"
|
|
1365
|
-
"
|
|
1479
|
+
"description": "Optional error to be shown with the input. Alternatively use the error slot.",
|
|
1480
|
+
"attribute": "error",
|
|
1481
|
+
"inheritedFrom": {
|
|
1482
|
+
"name": "FormAssociatedMixin",
|
|
1483
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1484
|
+
}
|
|
1366
1485
|
},
|
|
1367
1486
|
{
|
|
1368
1487
|
"kind": "field",
|
|
1369
|
-
"name": "
|
|
1488
|
+
"name": "required",
|
|
1370
1489
|
"type": {
|
|
1371
1490
|
"text": "boolean"
|
|
1372
1491
|
},
|
|
1373
|
-
"
|
|
1374
|
-
"
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
"text": "number"
|
|
1381
|
-
},
|
|
1382
|
-
"privacy": "private",
|
|
1383
|
-
"default": "0"
|
|
1384
|
-
},
|
|
1385
|
-
{
|
|
1386
|
-
"kind": "field",
|
|
1387
|
-
"name": "filteredCommands",
|
|
1388
|
-
"type": {
|
|
1389
|
-
"text": "Array<ICommandMenuAction>"
|
|
1390
|
-
},
|
|
1391
|
-
"privacy": "private",
|
|
1392
|
-
"default": "[]"
|
|
1492
|
+
"default": "false",
|
|
1493
|
+
"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.",
|
|
1494
|
+
"attribute": "required",
|
|
1495
|
+
"inheritedFrom": {
|
|
1496
|
+
"name": "FormAssociatedMixin",
|
|
1497
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1498
|
+
}
|
|
1393
1499
|
},
|
|
1394
1500
|
{
|
|
1395
1501
|
"kind": "field",
|
|
1396
|
-
"name": "
|
|
1502
|
+
"name": "expand",
|
|
1397
1503
|
"type": {
|
|
1398
|
-
"text": "
|
|
1504
|
+
"text": "boolean"
|
|
1399
1505
|
},
|
|
1400
|
-
"
|
|
1506
|
+
"default": "false",
|
|
1507
|
+
"description": "Controls whether the input expands to fill the width of its container.",
|
|
1508
|
+
"attribute": "expand",
|
|
1509
|
+
"reflects": true,
|
|
1510
|
+
"inheritedFrom": {
|
|
1511
|
+
"name": "FormAssociatedMixin",
|
|
1512
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1513
|
+
}
|
|
1401
1514
|
},
|
|
1402
1515
|
{
|
|
1403
1516
|
"kind": "method",
|
|
1404
|
-
"name": "
|
|
1517
|
+
"name": "handleInput",
|
|
1518
|
+
"privacy": "protected",
|
|
1405
1519
|
"parameters": [
|
|
1406
1520
|
{
|
|
1407
|
-
"name": "
|
|
1408
|
-
"default": "{}",
|
|
1521
|
+
"name": "e",
|
|
1409
1522
|
"type": {
|
|
1410
|
-
"text": "
|
|
1411
|
-
}
|
|
1412
|
-
"description": "allows you to open the menu filtered to a specific parent command."
|
|
1523
|
+
"text": "Event"
|
|
1524
|
+
}
|
|
1413
1525
|
}
|
|
1414
1526
|
],
|
|
1415
|
-
"
|
|
1527
|
+
"inheritedFrom": {
|
|
1528
|
+
"name": "FormAssociatedMixin",
|
|
1529
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1530
|
+
}
|
|
1416
1531
|
},
|
|
1417
1532
|
{
|
|
1418
1533
|
"kind": "method",
|
|
1419
|
-
"name": "
|
|
1420
|
-
"
|
|
1534
|
+
"name": "renderLabel",
|
|
1535
|
+
"privacy": "protected",
|
|
1536
|
+
"inheritedFrom": {
|
|
1537
|
+
"name": "FormAssociatedMixin",
|
|
1538
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1539
|
+
}
|
|
1421
1540
|
},
|
|
1422
1541
|
{
|
|
1423
1542
|
"kind": "method",
|
|
1424
|
-
"name": "
|
|
1425
|
-
"
|
|
1543
|
+
"name": "renderError",
|
|
1544
|
+
"privacy": "protected",
|
|
1545
|
+
"inheritedFrom": {
|
|
1546
|
+
"name": "FormAssociatedMixin",
|
|
1547
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1548
|
+
}
|
|
1426
1549
|
},
|
|
1427
1550
|
{
|
|
1428
1551
|
"kind": "method",
|
|
1429
|
-
"name": "
|
|
1430
|
-
"
|
|
1552
|
+
"name": "getDescribedBy",
|
|
1553
|
+
"privacy": "protected",
|
|
1554
|
+
"inheritedFrom": {
|
|
1555
|
+
"name": "FormAssociatedMixin",
|
|
1556
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1557
|
+
}
|
|
1431
1558
|
},
|
|
1432
1559
|
{
|
|
1433
1560
|
"kind": "method",
|
|
1434
|
-
"name": "
|
|
1435
|
-
"privacy": "
|
|
1561
|
+
"name": "getInvalid",
|
|
1562
|
+
"privacy": "protected",
|
|
1563
|
+
"inheritedFrom": {
|
|
1564
|
+
"name": "FormAssociatedMixin",
|
|
1565
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1566
|
+
}
|
|
1436
1567
|
},
|
|
1437
1568
|
{
|
|
1438
|
-
"kind": "
|
|
1439
|
-
"name": "
|
|
1440
|
-
"privacy": "
|
|
1441
|
-
"
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
"text": "string | undefined"
|
|
1446
|
-
}
|
|
1447
|
-
},
|
|
1448
|
-
{
|
|
1449
|
-
"name": "commands",
|
|
1450
|
-
"type": {
|
|
1451
|
-
"text": "ICommandMenuAction[]"
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
]
|
|
1569
|
+
"kind": "field",
|
|
1570
|
+
"name": "hasHint",
|
|
1571
|
+
"privacy": "protected",
|
|
1572
|
+
"inheritedFrom": {
|
|
1573
|
+
"name": "FormAssociatedMixin",
|
|
1574
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1575
|
+
}
|
|
1455
1576
|
},
|
|
1456
1577
|
{
|
|
1457
|
-
"kind": "
|
|
1458
|
-
"name": "
|
|
1459
|
-
"privacy": "
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
"privacy": "private"
|
|
1465
|
-
},
|
|
1466
|
-
{
|
|
1467
|
-
"kind": "method",
|
|
1468
|
-
"name": "handleInput",
|
|
1469
|
-
"privacy": "private",
|
|
1470
|
-
"parameters": [
|
|
1471
|
-
{
|
|
1472
|
-
"name": "event",
|
|
1473
|
-
"type": {
|
|
1474
|
-
"text": "KeyboardEvent"
|
|
1475
|
-
}
|
|
1476
|
-
}
|
|
1477
|
-
]
|
|
1478
|
-
},
|
|
1479
|
-
{
|
|
1480
|
-
"kind": "method",
|
|
1481
|
-
"name": "select",
|
|
1482
|
-
"privacy": "private",
|
|
1483
|
-
"parameters": [
|
|
1484
|
-
{
|
|
1485
|
-
"name": "command",
|
|
1486
|
-
"default": "this.selected",
|
|
1487
|
-
"type": {
|
|
1488
|
-
"text": "ICommandMenuAction"
|
|
1489
|
-
}
|
|
1490
|
-
}
|
|
1491
|
-
]
|
|
1578
|
+
"kind": "field",
|
|
1579
|
+
"name": "hasError",
|
|
1580
|
+
"privacy": "protected",
|
|
1581
|
+
"inheritedFrom": {
|
|
1582
|
+
"name": "FormAssociatedMixin",
|
|
1583
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1584
|
+
}
|
|
1492
1585
|
},
|
|
1493
1586
|
{
|
|
1494
|
-
"kind": "
|
|
1495
|
-
"name": "
|
|
1496
|
-
"
|
|
1587
|
+
"kind": "field",
|
|
1588
|
+
"name": "disabled",
|
|
1589
|
+
"type": {
|
|
1590
|
+
"text": "boolean"
|
|
1591
|
+
},
|
|
1592
|
+
"default": "false",
|
|
1593
|
+
"description": "Makes the component disabled. This prevents users from\nbeing able to interact with the component, and conveys\nits inactive state to assistive technologies.",
|
|
1594
|
+
"attribute": "disabled",
|
|
1595
|
+
"reflects": true,
|
|
1596
|
+
"inheritedFrom": {
|
|
1597
|
+
"name": "InputMixin",
|
|
1598
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1599
|
+
}
|
|
1497
1600
|
},
|
|
1498
1601
|
{
|
|
1499
|
-
"kind": "
|
|
1500
|
-
"name": "
|
|
1501
|
-
"
|
|
1602
|
+
"kind": "field",
|
|
1603
|
+
"name": "name",
|
|
1604
|
+
"type": {
|
|
1605
|
+
"text": "string | undefined"
|
|
1606
|
+
},
|
|
1607
|
+
"description": "The name of the form component.",
|
|
1608
|
+
"attribute": "name",
|
|
1609
|
+
"inheritedFrom": {
|
|
1610
|
+
"name": "InputMixin",
|
|
1611
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1612
|
+
}
|
|
1502
1613
|
},
|
|
1503
1614
|
{
|
|
1504
|
-
"kind": "
|
|
1505
|
-
"name": "
|
|
1506
|
-
"
|
|
1615
|
+
"kind": "field",
|
|
1616
|
+
"name": "value",
|
|
1617
|
+
"type": {
|
|
1618
|
+
"text": "string"
|
|
1619
|
+
},
|
|
1620
|
+
"default": "\"\"",
|
|
1621
|
+
"description": "The value of the form component.",
|
|
1622
|
+
"attribute": "value",
|
|
1623
|
+
"inheritedFrom": {
|
|
1624
|
+
"name": "InputMixin",
|
|
1625
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1626
|
+
}
|
|
1507
1627
|
},
|
|
1508
1628
|
{
|
|
1509
|
-
"kind": "
|
|
1510
|
-
"name": "
|
|
1511
|
-
"privacy": "
|
|
1629
|
+
"kind": "field",
|
|
1630
|
+
"name": "form",
|
|
1631
|
+
"privacy": "protected",
|
|
1632
|
+
"description": "Gets the form, if any, associated with the form element.",
|
|
1633
|
+
"inheritedFrom": {
|
|
1634
|
+
"name": "InputMixin",
|
|
1635
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1636
|
+
}
|
|
1512
1637
|
},
|
|
1513
1638
|
{
|
|
1514
|
-
"kind": "
|
|
1515
|
-
"name": "
|
|
1516
|
-
"privacy": "
|
|
1639
|
+
"kind": "field",
|
|
1640
|
+
"name": "focusableRef",
|
|
1641
|
+
"privacy": "protected",
|
|
1642
|
+
"inheritedFrom": {
|
|
1643
|
+
"name": "FocusableMixin",
|
|
1644
|
+
"module": "src/common/mixins/FocusableMixin.ts"
|
|
1645
|
+
}
|
|
1517
1646
|
},
|
|
1518
1647
|
{
|
|
1519
1648
|
"kind": "method",
|
|
1520
|
-
"name": "
|
|
1521
|
-
"privacy": "private",
|
|
1649
|
+
"name": "focus",
|
|
1522
1650
|
"parameters": [
|
|
1523
1651
|
{
|
|
1524
|
-
"name": "
|
|
1652
|
+
"name": "options",
|
|
1525
1653
|
"optional": true,
|
|
1526
1654
|
"type": {
|
|
1527
|
-
"text": "
|
|
1528
|
-
}
|
|
1655
|
+
"text": "FocusOptions"
|
|
1656
|
+
},
|
|
1657
|
+
"description": "An object which controls aspects of the focusing process."
|
|
1529
1658
|
}
|
|
1530
|
-
]
|
|
1659
|
+
],
|
|
1660
|
+
"description": "Programmatically move focus to the component.",
|
|
1661
|
+
"inheritedFrom": {
|
|
1662
|
+
"name": "FocusableMixin",
|
|
1663
|
+
"module": "src/common/mixins/FocusableMixin.ts"
|
|
1664
|
+
}
|
|
1531
1665
|
},
|
|
1532
1666
|
{
|
|
1533
1667
|
"kind": "method",
|
|
1534
|
-
"name": "
|
|
1535
|
-
"
|
|
1536
|
-
"
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
"text": "string"
|
|
1541
|
-
}
|
|
1542
|
-
}
|
|
1543
|
-
]
|
|
1668
|
+
"name": "blur",
|
|
1669
|
+
"description": "Programmatically remove focus from the component.",
|
|
1670
|
+
"inheritedFrom": {
|
|
1671
|
+
"name": "FocusableMixin",
|
|
1672
|
+
"module": "src/common/mixins/FocusableMixin.ts"
|
|
1673
|
+
}
|
|
1544
1674
|
},
|
|
1545
1675
|
{
|
|
1546
1676
|
"kind": "method",
|
|
1547
|
-
"name": "
|
|
1548
|
-
"
|
|
1677
|
+
"name": "click",
|
|
1678
|
+
"description": "Programmatically simulates a click on the component.",
|
|
1679
|
+
"inheritedFrom": {
|
|
1680
|
+
"name": "FocusableMixin",
|
|
1681
|
+
"module": "src/common/mixins/FocusableMixin.ts"
|
|
1682
|
+
}
|
|
1549
1683
|
},
|
|
1550
1684
|
{
|
|
1551
1685
|
"kind": "field",
|
|
@@ -1562,148 +1696,193 @@
|
|
|
1562
1696
|
}
|
|
1563
1697
|
}
|
|
1564
1698
|
],
|
|
1565
|
-
"
|
|
1699
|
+
"attributes": [
|
|
1566
1700
|
{
|
|
1567
|
-
"name": "
|
|
1701
|
+
"name": "checked",
|
|
1568
1702
|
"type": {
|
|
1569
|
-
"text": "
|
|
1703
|
+
"text": "boolean"
|
|
1570
1704
|
},
|
|
1571
|
-
"
|
|
1705
|
+
"default": "false",
|
|
1706
|
+
"description": "Controls whether the checkbox is checked or not.",
|
|
1707
|
+
"fieldName": "checked"
|
|
1572
1708
|
},
|
|
1573
1709
|
{
|
|
1574
|
-
"name": "
|
|
1710
|
+
"name": "label",
|
|
1575
1711
|
"type": {
|
|
1576
|
-
"text": "
|
|
1712
|
+
"text": "string"
|
|
1577
1713
|
},
|
|
1578
|
-
"
|
|
1714
|
+
"default": "\"\"",
|
|
1715
|
+
"description": "Label for the input.",
|
|
1716
|
+
"fieldName": "label",
|
|
1717
|
+
"inheritedFrom": {
|
|
1718
|
+
"name": "FormAssociatedMixin",
|
|
1719
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1720
|
+
}
|
|
1579
1721
|
},
|
|
1580
1722
|
{
|
|
1723
|
+
"name": "hint",
|
|
1581
1724
|
"type": {
|
|
1582
|
-
"text": "
|
|
1725
|
+
"text": "string | undefined"
|
|
1583
1726
|
},
|
|
1584
|
-
"description": "
|
|
1585
|
-
"
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1727
|
+
"description": "Optional hint text to be displayed with the input. Alternatively use the hint slot.",
|
|
1728
|
+
"fieldName": "hint",
|
|
1729
|
+
"inheritedFrom": {
|
|
1730
|
+
"name": "FormAssociatedMixin",
|
|
1731
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1732
|
+
}
|
|
1733
|
+
},
|
|
1589
1734
|
{
|
|
1590
|
-
"name": "
|
|
1735
|
+
"name": "hide-label",
|
|
1591
1736
|
"type": {
|
|
1592
1737
|
"text": "boolean"
|
|
1593
1738
|
},
|
|
1594
1739
|
"default": "false",
|
|
1595
|
-
"description": "
|
|
1596
|
-
"fieldName": "
|
|
1740
|
+
"description": "Visually hide the label, but still show it to assistive technologies like screen readers.",
|
|
1741
|
+
"fieldName": "hideLabel",
|
|
1742
|
+
"inheritedFrom": {
|
|
1743
|
+
"name": "FormAssociatedMixin",
|
|
1744
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1745
|
+
}
|
|
1597
1746
|
},
|
|
1598
1747
|
{
|
|
1599
1748
|
"name": "placeholder",
|
|
1600
1749
|
"type": {
|
|
1601
|
-
"text": "string"
|
|
1750
|
+
"text": "string | undefined"
|
|
1602
1751
|
},
|
|
1603
|
-
"
|
|
1604
|
-
"
|
|
1605
|
-
"
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
"name": "DraftComponentMixin",
|
|
1611
|
-
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
1612
|
-
}
|
|
1613
|
-
],
|
|
1614
|
-
"superclass": {
|
|
1615
|
-
"name": "LitElement",
|
|
1616
|
-
"package": "lit"
|
|
1617
|
-
},
|
|
1618
|
-
"status": "draft",
|
|
1619
|
-
"category": "action",
|
|
1620
|
-
"tagName": "nord-command-menu",
|
|
1621
|
-
"customElement": true
|
|
1622
|
-
}
|
|
1623
|
-
],
|
|
1624
|
-
"exports": [
|
|
1625
|
-
{
|
|
1626
|
-
"kind": "js",
|
|
1627
|
-
"name": "default",
|
|
1628
|
-
"declaration": {
|
|
1629
|
-
"name": "CommandMenu",
|
|
1630
|
-
"module": "src/command-menu/CommandMenu.ts"
|
|
1631
|
-
}
|
|
1632
|
-
},
|
|
1633
|
-
{
|
|
1634
|
-
"kind": "custom-element-definition",
|
|
1635
|
-
"name": "nord-command-menu",
|
|
1636
|
-
"declaration": {
|
|
1637
|
-
"name": "CommandMenu",
|
|
1638
|
-
"module": "src/command-menu/CommandMenu.ts"
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
],
|
|
1642
|
-
"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"
|
|
1643
|
-
},
|
|
1644
|
-
{
|
|
1645
|
-
"kind": "javascript-module",
|
|
1646
|
-
"path": "src/command-menu/CommandMenuAction.ts",
|
|
1647
|
-
"declarations": [
|
|
1648
|
-
{
|
|
1649
|
-
"kind": "class",
|
|
1650
|
-
"description": "Command Menu Action displays a single action that can be executed by the user. For usage examples, please see Command Menu component.",
|
|
1651
|
-
"name": "CommandMenuAction",
|
|
1652
|
-
"members": [
|
|
1752
|
+
"description": "Placeholder text to display within the input.",
|
|
1753
|
+
"fieldName": "placeholder",
|
|
1754
|
+
"inheritedFrom": {
|
|
1755
|
+
"name": "FormAssociatedMixin",
|
|
1756
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1757
|
+
}
|
|
1758
|
+
},
|
|
1653
1759
|
{
|
|
1654
|
-
"
|
|
1655
|
-
"name": "command",
|
|
1760
|
+
"name": "error",
|
|
1656
1761
|
"type": {
|
|
1657
|
-
"text": "
|
|
1762
|
+
"text": "string | undefined"
|
|
1658
1763
|
},
|
|
1659
|
-
"
|
|
1764
|
+
"description": "Optional error to be shown with the input. Alternatively use the error slot.",
|
|
1765
|
+
"fieldName": "error",
|
|
1766
|
+
"inheritedFrom": {
|
|
1767
|
+
"name": "FormAssociatedMixin",
|
|
1768
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1769
|
+
}
|
|
1660
1770
|
},
|
|
1661
1771
|
{
|
|
1662
|
-
"
|
|
1663
|
-
"name": "selected",
|
|
1772
|
+
"name": "required",
|
|
1664
1773
|
"type": {
|
|
1665
1774
|
"text": "boolean"
|
|
1666
1775
|
},
|
|
1667
1776
|
"default": "false",
|
|
1668
|
-
"
|
|
1777
|
+
"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.",
|
|
1778
|
+
"fieldName": "required",
|
|
1779
|
+
"inheritedFrom": {
|
|
1780
|
+
"name": "FormAssociatedMixin",
|
|
1781
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1782
|
+
}
|
|
1669
1783
|
},
|
|
1670
1784
|
{
|
|
1671
|
-
"
|
|
1672
|
-
"
|
|
1673
|
-
|
|
1674
|
-
|
|
1785
|
+
"name": "expand",
|
|
1786
|
+
"type": {
|
|
1787
|
+
"text": "boolean"
|
|
1788
|
+
},
|
|
1789
|
+
"default": "false",
|
|
1790
|
+
"description": "Controls whether the input expands to fill the width of its container.",
|
|
1791
|
+
"fieldName": "expand",
|
|
1792
|
+
"inheritedFrom": {
|
|
1793
|
+
"name": "FormAssociatedMixin",
|
|
1794
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1795
|
+
}
|
|
1675
1796
|
},
|
|
1676
1797
|
{
|
|
1677
|
-
"
|
|
1678
|
-
"
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1798
|
+
"name": "disabled",
|
|
1799
|
+
"type": {
|
|
1800
|
+
"text": "boolean"
|
|
1801
|
+
},
|
|
1802
|
+
"default": "false",
|
|
1803
|
+
"description": "Makes the component disabled. This prevents users from\nbeing able to interact with the component, and conveys\nits inactive state to assistive technologies.",
|
|
1804
|
+
"fieldName": "disabled",
|
|
1805
|
+
"inheritedFrom": {
|
|
1806
|
+
"name": "InputMixin",
|
|
1807
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1808
|
+
}
|
|
1809
|
+
},
|
|
1683
1810
|
{
|
|
1684
|
-
"name": "
|
|
1811
|
+
"name": "name",
|
|
1685
1812
|
"type": {
|
|
1686
|
-
"text": "
|
|
1813
|
+
"text": "string | undefined"
|
|
1687
1814
|
},
|
|
1688
|
-
"
|
|
1815
|
+
"description": "The name of the form component.",
|
|
1816
|
+
"fieldName": "name",
|
|
1817
|
+
"inheritedFrom": {
|
|
1818
|
+
"name": "InputMixin",
|
|
1819
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1820
|
+
}
|
|
1689
1821
|
},
|
|
1690
1822
|
{
|
|
1691
|
-
"name": "
|
|
1823
|
+
"name": "value",
|
|
1692
1824
|
"type": {
|
|
1693
|
-
"text": "
|
|
1825
|
+
"text": "string"
|
|
1694
1826
|
},
|
|
1695
|
-
"default": "
|
|
1696
|
-
"
|
|
1827
|
+
"default": "\"\"",
|
|
1828
|
+
"description": "The value of the form component.",
|
|
1829
|
+
"fieldName": "value",
|
|
1830
|
+
"inheritedFrom": {
|
|
1831
|
+
"name": "InputMixin",
|
|
1832
|
+
"module": "src/common/mixins/InputMixin.ts"
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
],
|
|
1836
|
+
"mixins": [
|
|
1837
|
+
{
|
|
1838
|
+
"name": "FormAssociatedMixin",
|
|
1839
|
+
"module": "/src/common/mixins/FormAssociatedMixin.js"
|
|
1840
|
+
},
|
|
1841
|
+
{
|
|
1842
|
+
"name": "InputMixin",
|
|
1843
|
+
"module": "/src/common/mixins/InputMixin.js"
|
|
1844
|
+
},
|
|
1845
|
+
{
|
|
1846
|
+
"name": "FocusableMixin",
|
|
1847
|
+
"module": "/src/common/mixins/FocusableMixin.js"
|
|
1848
|
+
},
|
|
1849
|
+
{
|
|
1850
|
+
"name": "DraftComponentMixin",
|
|
1851
|
+
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
1697
1852
|
}
|
|
1698
1853
|
],
|
|
1699
1854
|
"superclass": {
|
|
1700
1855
|
"name": "LitElement",
|
|
1701
1856
|
"package": "lit"
|
|
1702
1857
|
},
|
|
1703
|
-
"status": "
|
|
1704
|
-
"category":
|
|
1705
|
-
"tagName": "nord-
|
|
1706
|
-
"customElement": true
|
|
1858
|
+
"status": "draft",
|
|
1859
|
+
"category": "form",
|
|
1860
|
+
"tagName": "nord-checkbox",
|
|
1861
|
+
"customElement": true,
|
|
1862
|
+
"events": [
|
|
1863
|
+
{
|
|
1864
|
+
"name": "input",
|
|
1865
|
+
"type": {
|
|
1866
|
+
"text": "NordEvent"
|
|
1867
|
+
},
|
|
1868
|
+
"description": "Fired as the user types into the input.",
|
|
1869
|
+
"inheritedFrom": {
|
|
1870
|
+
"name": "FormAssociatedMixin",
|
|
1871
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1872
|
+
}
|
|
1873
|
+
},
|
|
1874
|
+
{
|
|
1875
|
+
"name": "change",
|
|
1876
|
+
"type": {
|
|
1877
|
+
"text": "NordEvent"
|
|
1878
|
+
},
|
|
1879
|
+
"description": "Fired whenever the input's value is changed via user interaction.",
|
|
1880
|
+
"inheritedFrom": {
|
|
1881
|
+
"name": "FormAssociatedMixin",
|
|
1882
|
+
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1883
|
+
}
|
|
1884
|
+
}
|
|
1885
|
+
]
|
|
1707
1886
|
}
|
|
1708
1887
|
],
|
|
1709
1888
|
"exports": [
|
|
@@ -1711,535 +1890,294 @@
|
|
|
1711
1890
|
"kind": "js",
|
|
1712
1891
|
"name": "default",
|
|
1713
1892
|
"declaration": {
|
|
1714
|
-
"name": "
|
|
1715
|
-
"module": "src/
|
|
1893
|
+
"name": "Checkbox",
|
|
1894
|
+
"module": "src/checkbox/Checkbox.ts"
|
|
1716
1895
|
}
|
|
1717
1896
|
},
|
|
1718
1897
|
{
|
|
1719
1898
|
"kind": "custom-element-definition",
|
|
1720
|
-
"name": "nord-
|
|
1899
|
+
"name": "nord-checkbox",
|
|
1721
1900
|
"declaration": {
|
|
1722
|
-
"name": "
|
|
1723
|
-
"module": "src/
|
|
1901
|
+
"name": "Checkbox",
|
|
1902
|
+
"module": "src/checkbox/Checkbox.ts"
|
|
1724
1903
|
}
|
|
1725
1904
|
}
|
|
1726
1905
|
],
|
|
1727
|
-
"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"
|
|
1728
|
-
},
|
|
1729
|
-
{
|
|
1730
|
-
"kind": "javascript-module",
|
|
1731
|
-
"path": "src/command-menu/ICommandMenuAction.ts",
|
|
1732
|
-
"declarations": [],
|
|
1733
|
-
"exports": [],
|
|
1734
|
-
"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"
|
|
1906
|
+
"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"
|
|
1735
1907
|
},
|
|
1736
1908
|
{
|
|
1737
1909
|
"kind": "javascript-module",
|
|
1738
|
-
"path": "src/command-menu/
|
|
1910
|
+
"path": "src/command-menu/CommandMenu.ts",
|
|
1739
1911
|
"declarations": [
|
|
1740
1912
|
{
|
|
1741
1913
|
"kind": "class",
|
|
1742
|
-
"description": "",
|
|
1743
|
-
"name": "
|
|
1914
|
+
"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.",
|
|
1915
|
+
"name": "CommandMenu",
|
|
1916
|
+
"slots": [
|
|
1917
|
+
{
|
|
1918
|
+
"description": "Used to replace the default footer contents.",
|
|
1919
|
+
"name": "footer"
|
|
1920
|
+
}
|
|
1921
|
+
],
|
|
1744
1922
|
"members": [
|
|
1745
1923
|
{
|
|
1746
1924
|
"kind": "field",
|
|
1747
|
-
"name": "
|
|
1925
|
+
"name": "inputRef",
|
|
1926
|
+
"privacy": "private"
|
|
1927
|
+
},
|
|
1928
|
+
{
|
|
1929
|
+
"kind": "field",
|
|
1930
|
+
"name": "listRef",
|
|
1931
|
+
"privacy": "private"
|
|
1932
|
+
},
|
|
1933
|
+
{
|
|
1934
|
+
"kind": "field",
|
|
1935
|
+
"name": "previousFocus",
|
|
1748
1936
|
"type": {
|
|
1749
|
-
"text": "
|
|
1937
|
+
"text": "HTMLElement | undefined"
|
|
1750
1938
|
},
|
|
1939
|
+
"privacy": "private"
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
"kind": "field",
|
|
1943
|
+
"name": "dismissController",
|
|
1751
1944
|
"privacy": "private",
|
|
1752
|
-
"default": "
|
|
1945
|
+
"default": "new LightDismissController(this, {\n isOpen: () => this.open,\n onDismiss: () => this.close(),\n })"
|
|
1753
1946
|
},
|
|
1754
1947
|
{
|
|
1755
1948
|
"kind": "field",
|
|
1756
|
-
"name": "
|
|
1949
|
+
"name": "keyboardController",
|
|
1950
|
+
"privacy": "private",
|
|
1951
|
+
"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 })"
|
|
1952
|
+
},
|
|
1953
|
+
{
|
|
1954
|
+
"kind": "field",
|
|
1955
|
+
"name": "open",
|
|
1757
1956
|
"type": {
|
|
1758
|
-
"text": "
|
|
1957
|
+
"text": "boolean"
|
|
1759
1958
|
},
|
|
1760
|
-
"
|
|
1761
|
-
"
|
|
1959
|
+
"default": "false",
|
|
1960
|
+
"description": "Show or hide the command menu.",
|
|
1961
|
+
"attribute": "open"
|
|
1762
1962
|
},
|
|
1763
1963
|
{
|
|
1764
1964
|
"kind": "field",
|
|
1765
|
-
"name": "
|
|
1965
|
+
"name": "placeholder",
|
|
1766
1966
|
"type": {
|
|
1767
|
-
"text": "
|
|
1967
|
+
"text": "string"
|
|
1768
1968
|
},
|
|
1769
|
-
"
|
|
1770
|
-
"
|
|
1969
|
+
"default": "\"Type a command or search...\"",
|
|
1970
|
+
"description": "Hint text to display in the Command Menu search field.",
|
|
1971
|
+
"attribute": "placeholder"
|
|
1771
1972
|
},
|
|
1772
1973
|
{
|
|
1773
1974
|
"kind": "field",
|
|
1774
|
-
"name": "
|
|
1975
|
+
"name": "commands",
|
|
1775
1976
|
"type": {
|
|
1776
|
-
"text": "
|
|
1977
|
+
"text": "Array<ICommandMenuAction>"
|
|
1777
1978
|
},
|
|
1778
|
-
"
|
|
1779
|
-
"
|
|
1979
|
+
"default": "[]",
|
|
1980
|
+
"description": "Array of commands to be included in the menu.\nPlease see “Commands data” section for more documentation."
|
|
1780
1981
|
},
|
|
1781
1982
|
{
|
|
1782
|
-
"kind": "
|
|
1783
|
-
"name": "
|
|
1784
|
-
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
{
|
|
1790
|
-
"kind": "js",
|
|
1791
|
-
"name": "KeyboardController",
|
|
1792
|
-
"declaration": {
|
|
1793
|
-
"name": "KeyboardController",
|
|
1794
|
-
"module": "src/command-menu/KeyboardController.ts"
|
|
1795
|
-
}
|
|
1796
|
-
}
|
|
1797
|
-
],
|
|
1798
|
-
"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"
|
|
1799
|
-
},
|
|
1800
|
-
{
|
|
1801
|
-
"kind": "javascript-module",
|
|
1802
|
-
"path": "src/command-menu/events.ts",
|
|
1803
|
-
"declarations": [
|
|
1804
|
-
{
|
|
1805
|
-
"kind": "class",
|
|
1806
|
-
"description": "",
|
|
1807
|
-
"name": "SelectEvent",
|
|
1808
|
-
"members": [
|
|
1983
|
+
"kind": "field",
|
|
1984
|
+
"name": "parent",
|
|
1985
|
+
"type": {
|
|
1986
|
+
"text": "string | undefined"
|
|
1987
|
+
},
|
|
1988
|
+
"privacy": "private"
|
|
1989
|
+
},
|
|
1809
1990
|
{
|
|
1810
1991
|
"kind": "field",
|
|
1811
|
-
"name": "
|
|
1992
|
+
"name": "search",
|
|
1812
1993
|
"type": {
|
|
1813
|
-
"text": "
|
|
1994
|
+
"text": "string"
|
|
1814
1995
|
},
|
|
1815
|
-
"
|
|
1816
|
-
|
|
1817
|
-
],
|
|
1818
|
-
"superclass": {
|
|
1819
|
-
"name": "NordEvent",
|
|
1820
|
-
"module": "/src/common/events.js"
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1823
|
-
],
|
|
1824
|
-
"exports": [
|
|
1825
|
-
{
|
|
1826
|
-
"kind": "js",
|
|
1827
|
-
"name": "SelectEvent",
|
|
1828
|
-
"declaration": {
|
|
1829
|
-
"name": "SelectEvent",
|
|
1830
|
-
"module": "src/command-menu/events.ts"
|
|
1831
|
-
}
|
|
1832
|
-
}
|
|
1833
|
-
],
|
|
1834
|
-
"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"
|
|
1835
|
-
},
|
|
1836
|
-
{
|
|
1837
|
-
"kind": "javascript-module",
|
|
1838
|
-
"path": "src/checkbox/Checkbox.ts",
|
|
1839
|
-
"declarations": [
|
|
1840
|
-
{
|
|
1841
|
-
"kind": "class",
|
|
1842
|
-
"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.",
|
|
1843
|
-
"name": "Checkbox",
|
|
1844
|
-
"slots": [
|
|
1845
|
-
{
|
|
1846
|
-
"description": "Use when a label requires more than plain text.",
|
|
1847
|
-
"name": "label"
|
|
1848
|
-
},
|
|
1849
|
-
{
|
|
1850
|
-
"description": "Optional slot that holds hint text for the input.",
|
|
1851
|
-
"name": "hint"
|
|
1852
|
-
},
|
|
1853
|
-
{
|
|
1854
|
-
"description": "Optional slot that holds error text for the input.",
|
|
1855
|
-
"name": "error"
|
|
1856
|
-
}
|
|
1857
|
-
],
|
|
1858
|
-
"members": [
|
|
1859
|
-
{
|
|
1860
|
-
"kind": "field",
|
|
1861
|
-
"name": "formValue",
|
|
1862
|
-
"privacy": "protected",
|
|
1863
|
-
"inheritedFrom": {
|
|
1864
|
-
"name": "FormAssociatedMixin",
|
|
1865
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1866
|
-
}
|
|
1996
|
+
"privacy": "private",
|
|
1997
|
+
"default": "\"\""
|
|
1867
1998
|
},
|
|
1868
1999
|
{
|
|
1869
2000
|
"kind": "field",
|
|
1870
|
-
"name": "
|
|
2001
|
+
"name": "bump",
|
|
1871
2002
|
"type": {
|
|
1872
2003
|
"text": "boolean"
|
|
1873
2004
|
},
|
|
1874
|
-
"
|
|
1875
|
-
"
|
|
1876
|
-
"attribute": "checked"
|
|
1877
|
-
},
|
|
1878
|
-
{
|
|
1879
|
-
"kind": "method",
|
|
1880
|
-
"name": "handleChange",
|
|
1881
|
-
"privacy": "protected",
|
|
1882
|
-
"return": {
|
|
1883
|
-
"type": {
|
|
1884
|
-
"text": "void"
|
|
1885
|
-
}
|
|
1886
|
-
},
|
|
1887
|
-
"parameters": [
|
|
1888
|
-
{
|
|
1889
|
-
"name": "e",
|
|
1890
|
-
"type": {
|
|
1891
|
-
"text": "Event"
|
|
1892
|
-
}
|
|
1893
|
-
}
|
|
1894
|
-
],
|
|
1895
|
-
"inheritedFrom": {
|
|
1896
|
-
"name": "FormAssociatedMixin",
|
|
1897
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1898
|
-
}
|
|
1899
|
-
},
|
|
1900
|
-
{
|
|
1901
|
-
"kind": "field",
|
|
1902
|
-
"name": "labelSlot",
|
|
1903
|
-
"privacy": "protected",
|
|
1904
|
-
"default": "new SlotController(this, \"label\")",
|
|
1905
|
-
"inheritedFrom": {
|
|
1906
|
-
"name": "FormAssociatedMixin",
|
|
1907
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1908
|
-
}
|
|
1909
|
-
},
|
|
1910
|
-
{
|
|
1911
|
-
"kind": "field",
|
|
1912
|
-
"name": "errorSlot",
|
|
1913
|
-
"privacy": "protected",
|
|
1914
|
-
"default": "new SlotController(this, \"error\")",
|
|
1915
|
-
"inheritedFrom": {
|
|
1916
|
-
"name": "FormAssociatedMixin",
|
|
1917
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1918
|
-
}
|
|
1919
|
-
},
|
|
1920
|
-
{
|
|
1921
|
-
"kind": "field",
|
|
1922
|
-
"name": "hintSlot",
|
|
1923
|
-
"privacy": "protected",
|
|
1924
|
-
"default": "new SlotController(this, \"hint\")",
|
|
1925
|
-
"inheritedFrom": {
|
|
1926
|
-
"name": "FormAssociatedMixin",
|
|
1927
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1928
|
-
}
|
|
1929
|
-
},
|
|
1930
|
-
{
|
|
1931
|
-
"kind": "field",
|
|
1932
|
-
"name": "formData",
|
|
1933
|
-
"privacy": "protected",
|
|
1934
|
-
"default": "new FormDataController(this, { value: () => this.formValue })",
|
|
1935
|
-
"inheritedFrom": {
|
|
1936
|
-
"name": "FormAssociatedMixin",
|
|
1937
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1938
|
-
}
|
|
1939
|
-
},
|
|
1940
|
-
{
|
|
1941
|
-
"kind": "field",
|
|
1942
|
-
"name": "inputId",
|
|
1943
|
-
"type": {
|
|
1944
|
-
"text": "string"
|
|
1945
|
-
},
|
|
1946
|
-
"privacy": "protected",
|
|
1947
|
-
"default": "\"input\"",
|
|
1948
|
-
"inheritedFrom": {
|
|
1949
|
-
"name": "FormAssociatedMixin",
|
|
1950
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1951
|
-
}
|
|
1952
|
-
},
|
|
1953
|
-
{
|
|
1954
|
-
"kind": "field",
|
|
1955
|
-
"name": "errorId",
|
|
1956
|
-
"type": {
|
|
1957
|
-
"text": "string"
|
|
1958
|
-
},
|
|
1959
|
-
"privacy": "protected",
|
|
1960
|
-
"default": "\"error\"",
|
|
1961
|
-
"inheritedFrom": {
|
|
1962
|
-
"name": "FormAssociatedMixin",
|
|
1963
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1964
|
-
}
|
|
2005
|
+
"privacy": "private",
|
|
2006
|
+
"default": "true"
|
|
1965
2007
|
},
|
|
1966
2008
|
{
|
|
1967
2009
|
"kind": "field",
|
|
1968
|
-
"name": "
|
|
2010
|
+
"name": "selectedIndex",
|
|
1969
2011
|
"type": {
|
|
1970
|
-
"text": "
|
|
2012
|
+
"text": "number"
|
|
1971
2013
|
},
|
|
1972
|
-
"privacy": "
|
|
1973
|
-
"default": "
|
|
1974
|
-
"inheritedFrom": {
|
|
1975
|
-
"name": "FormAssociatedMixin",
|
|
1976
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1977
|
-
}
|
|
2014
|
+
"privacy": "private",
|
|
2015
|
+
"default": "0"
|
|
1978
2016
|
},
|
|
1979
2017
|
{
|
|
1980
2018
|
"kind": "field",
|
|
1981
|
-
"name": "
|
|
2019
|
+
"name": "filteredCommands",
|
|
1982
2020
|
"type": {
|
|
1983
|
-
"text": "
|
|
2021
|
+
"text": "Array<ICommandMenuAction>"
|
|
1984
2022
|
},
|
|
1985
|
-
"
|
|
1986
|
-
"
|
|
1987
|
-
"attribute": "label",
|
|
1988
|
-
"inheritedFrom": {
|
|
1989
|
-
"name": "FormAssociatedMixin",
|
|
1990
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
1991
|
-
}
|
|
2023
|
+
"privacy": "private",
|
|
2024
|
+
"default": "[]"
|
|
1992
2025
|
},
|
|
1993
2026
|
{
|
|
1994
2027
|
"kind": "field",
|
|
1995
|
-
"name": "
|
|
2028
|
+
"name": "selected",
|
|
1996
2029
|
"type": {
|
|
1997
|
-
"text": "
|
|
2030
|
+
"text": "ICommandMenuAction"
|
|
1998
2031
|
},
|
|
1999
|
-
"
|
|
2000
|
-
"attribute": "hint",
|
|
2001
|
-
"inheritedFrom": {
|
|
2002
|
-
"name": "FormAssociatedMixin",
|
|
2003
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2004
|
-
}
|
|
2032
|
+
"privacy": "private"
|
|
2005
2033
|
},
|
|
2006
2034
|
{
|
|
2007
|
-
"kind": "
|
|
2008
|
-
"name": "
|
|
2009
|
-
"
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2035
|
+
"kind": "method",
|
|
2036
|
+
"name": "show",
|
|
2037
|
+
"parameters": [
|
|
2038
|
+
{
|
|
2039
|
+
"name": "options",
|
|
2040
|
+
"default": "{}",
|
|
2041
|
+
"type": {
|
|
2042
|
+
"text": "{ parent?: string }"
|
|
2043
|
+
},
|
|
2044
|
+
"description": "allows you to open the menu filtered to a specific parent command."
|
|
2045
|
+
}
|
|
2046
|
+
],
|
|
2047
|
+
"description": "Show the command menu programmatically."
|
|
2019
2048
|
},
|
|
2020
2049
|
{
|
|
2021
|
-
"kind": "
|
|
2022
|
-
"name": "
|
|
2023
|
-
"
|
|
2024
|
-
"text": "string | undefined"
|
|
2025
|
-
},
|
|
2026
|
-
"description": "Placeholder text to display within the input.",
|
|
2027
|
-
"attribute": "placeholder",
|
|
2028
|
-
"inheritedFrom": {
|
|
2029
|
-
"name": "FormAssociatedMixin",
|
|
2030
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2031
|
-
}
|
|
2050
|
+
"kind": "method",
|
|
2051
|
+
"name": "close",
|
|
2052
|
+
"description": "Close the command menu programmatically."
|
|
2032
2053
|
},
|
|
2033
2054
|
{
|
|
2034
|
-
"kind": "
|
|
2035
|
-
"name": "
|
|
2036
|
-
"
|
|
2037
|
-
"text": "string | undefined"
|
|
2038
|
-
},
|
|
2039
|
-
"description": "Optional error to be shown with the input. Alternatively use the error slot.",
|
|
2040
|
-
"attribute": "error",
|
|
2041
|
-
"inheritedFrom": {
|
|
2042
|
-
"name": "FormAssociatedMixin",
|
|
2043
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2044
|
-
}
|
|
2055
|
+
"kind": "method",
|
|
2056
|
+
"name": "toggleOpen",
|
|
2057
|
+
"description": "Toggle the open state programmatically."
|
|
2045
2058
|
},
|
|
2046
2059
|
{
|
|
2047
|
-
"kind": "
|
|
2048
|
-
"name": "
|
|
2049
|
-
"
|
|
2050
|
-
"text": "boolean"
|
|
2051
|
-
},
|
|
2052
|
-
"default": "false",
|
|
2053
|
-
"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.",
|
|
2054
|
-
"attribute": "required",
|
|
2055
|
-
"inheritedFrom": {
|
|
2056
|
-
"name": "FormAssociatedMixin",
|
|
2057
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2058
|
-
}
|
|
2060
|
+
"kind": "method",
|
|
2061
|
+
"name": "focus",
|
|
2062
|
+
"description": "Focus the command menu's input."
|
|
2059
2063
|
},
|
|
2060
2064
|
{
|
|
2061
|
-
"kind": "
|
|
2062
|
-
"name": "
|
|
2063
|
-
"
|
|
2064
|
-
"text": "boolean"
|
|
2065
|
-
},
|
|
2066
|
-
"default": "false",
|
|
2067
|
-
"description": "Controls whether the input expands to fill the width of its container.",
|
|
2068
|
-
"attribute": "expand",
|
|
2069
|
-
"reflects": true,
|
|
2070
|
-
"inheritedFrom": {
|
|
2071
|
-
"name": "FormAssociatedMixin",
|
|
2072
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2073
|
-
}
|
|
2065
|
+
"kind": "method",
|
|
2066
|
+
"name": "renderNoResults",
|
|
2067
|
+
"privacy": "private"
|
|
2074
2068
|
},
|
|
2075
2069
|
{
|
|
2076
2070
|
"kind": "method",
|
|
2077
|
-
"name": "
|
|
2078
|
-
"privacy": "
|
|
2071
|
+
"name": "renderSection",
|
|
2072
|
+
"privacy": "private",
|
|
2079
2073
|
"parameters": [
|
|
2080
2074
|
{
|
|
2081
|
-
"name": "
|
|
2075
|
+
"name": "section",
|
|
2082
2076
|
"type": {
|
|
2083
|
-
"text": "
|
|
2077
|
+
"text": "string | undefined"
|
|
2084
2078
|
}
|
|
2085
|
-
}
|
|
2086
|
-
|
|
2087
|
-
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2092
|
-
|
|
2093
|
-
"kind": "method",
|
|
2094
|
-
"name": "renderLabel",
|
|
2095
|
-
"privacy": "protected",
|
|
2096
|
-
"inheritedFrom": {
|
|
2097
|
-
"name": "FormAssociatedMixin",
|
|
2098
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2099
|
-
}
|
|
2100
|
-
},
|
|
2101
|
-
{
|
|
2102
|
-
"kind": "method",
|
|
2103
|
-
"name": "renderError",
|
|
2104
|
-
"privacy": "protected",
|
|
2105
|
-
"inheritedFrom": {
|
|
2106
|
-
"name": "FormAssociatedMixin",
|
|
2107
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2108
|
-
}
|
|
2079
|
+
},
|
|
2080
|
+
{
|
|
2081
|
+
"name": "commands",
|
|
2082
|
+
"type": {
|
|
2083
|
+
"text": "ICommandMenuAction[]"
|
|
2084
|
+
}
|
|
2085
|
+
}
|
|
2086
|
+
]
|
|
2109
2087
|
},
|
|
2110
2088
|
{
|
|
2111
2089
|
"kind": "method",
|
|
2112
|
-
"name": "
|
|
2113
|
-
"privacy": "
|
|
2114
|
-
"inheritedFrom": {
|
|
2115
|
-
"name": "FormAssociatedMixin",
|
|
2116
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2117
|
-
}
|
|
2090
|
+
"name": "handleAnimationEnd",
|
|
2091
|
+
"privacy": "private"
|
|
2118
2092
|
},
|
|
2119
2093
|
{
|
|
2120
2094
|
"kind": "method",
|
|
2121
|
-
"name": "
|
|
2122
|
-
"privacy": "
|
|
2123
|
-
"inheritedFrom": {
|
|
2124
|
-
"name": "FormAssociatedMixin",
|
|
2125
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2126
|
-
}
|
|
2095
|
+
"name": "handleBlur",
|
|
2096
|
+
"privacy": "private"
|
|
2127
2097
|
},
|
|
2128
2098
|
{
|
|
2129
|
-
"kind": "
|
|
2130
|
-
"name": "
|
|
2131
|
-
"privacy": "
|
|
2132
|
-
"
|
|
2133
|
-
|
|
2134
|
-
|
|
2135
|
-
|
|
2099
|
+
"kind": "method",
|
|
2100
|
+
"name": "handleInput",
|
|
2101
|
+
"privacy": "private",
|
|
2102
|
+
"parameters": [
|
|
2103
|
+
{
|
|
2104
|
+
"name": "event",
|
|
2105
|
+
"type": {
|
|
2106
|
+
"text": "KeyboardEvent"
|
|
2107
|
+
}
|
|
2108
|
+
}
|
|
2109
|
+
]
|
|
2136
2110
|
},
|
|
2137
2111
|
{
|
|
2138
|
-
"kind": "
|
|
2139
|
-
"name": "
|
|
2140
|
-
"privacy": "
|
|
2141
|
-
"
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2112
|
+
"kind": "method",
|
|
2113
|
+
"name": "select",
|
|
2114
|
+
"privacy": "private",
|
|
2115
|
+
"parameters": [
|
|
2116
|
+
{
|
|
2117
|
+
"name": "command",
|
|
2118
|
+
"default": "this.selected",
|
|
2119
|
+
"type": {
|
|
2120
|
+
"text": "ICommandMenuAction"
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
]
|
|
2145
2124
|
},
|
|
2146
2125
|
{
|
|
2147
|
-
"kind": "
|
|
2148
|
-
"name": "
|
|
2149
|
-
"
|
|
2150
|
-
"text": "boolean"
|
|
2151
|
-
},
|
|
2152
|
-
"default": "false",
|
|
2153
|
-
"description": "Makes the component disabled. This prevents users from\nbeing able to interact with the component, and conveys\nits inactive state to assistive technologies.",
|
|
2154
|
-
"attribute": "disabled",
|
|
2155
|
-
"reflects": true,
|
|
2156
|
-
"inheritedFrom": {
|
|
2157
|
-
"name": "InputMixin",
|
|
2158
|
-
"module": "src/common/mixins/InputMixin.ts"
|
|
2159
|
-
}
|
|
2126
|
+
"kind": "method",
|
|
2127
|
+
"name": "start",
|
|
2128
|
+
"privacy": "private"
|
|
2160
2129
|
},
|
|
2161
2130
|
{
|
|
2162
|
-
"kind": "
|
|
2163
|
-
"name": "
|
|
2164
|
-
"
|
|
2165
|
-
"text": "string | undefined"
|
|
2166
|
-
},
|
|
2167
|
-
"description": "The name of the form component.",
|
|
2168
|
-
"attribute": "name",
|
|
2169
|
-
"inheritedFrom": {
|
|
2170
|
-
"name": "InputMixin",
|
|
2171
|
-
"module": "src/common/mixins/InputMixin.ts"
|
|
2172
|
-
}
|
|
2131
|
+
"kind": "method",
|
|
2132
|
+
"name": "end",
|
|
2133
|
+
"privacy": "private"
|
|
2173
2134
|
},
|
|
2174
2135
|
{
|
|
2175
|
-
"kind": "
|
|
2176
|
-
"name": "
|
|
2177
|
-
"
|
|
2178
|
-
"text": "string"
|
|
2179
|
-
},
|
|
2180
|
-
"default": "\"\"",
|
|
2181
|
-
"description": "The value of the form component.",
|
|
2182
|
-
"attribute": "value",
|
|
2183
|
-
"inheritedFrom": {
|
|
2184
|
-
"name": "InputMixin",
|
|
2185
|
-
"module": "src/common/mixins/InputMixin.ts"
|
|
2186
|
-
}
|
|
2136
|
+
"kind": "method",
|
|
2137
|
+
"name": "next",
|
|
2138
|
+
"privacy": "private"
|
|
2187
2139
|
},
|
|
2188
2140
|
{
|
|
2189
|
-
"kind": "
|
|
2190
|
-
"name": "
|
|
2191
|
-
"privacy": "
|
|
2192
|
-
"description": "Gets the form, if any, associated with the form element.",
|
|
2193
|
-
"inheritedFrom": {
|
|
2194
|
-
"name": "InputMixin",
|
|
2195
|
-
"module": "src/common/mixins/InputMixin.ts"
|
|
2196
|
-
}
|
|
2141
|
+
"kind": "method",
|
|
2142
|
+
"name": "previous",
|
|
2143
|
+
"privacy": "private"
|
|
2197
2144
|
},
|
|
2198
2145
|
{
|
|
2199
|
-
"kind": "
|
|
2200
|
-
"name": "
|
|
2201
|
-
"privacy": "
|
|
2202
|
-
"inheritedFrom": {
|
|
2203
|
-
"name": "FocusableMixin",
|
|
2204
|
-
"module": "src/common/mixins/FocusableMixin.ts"
|
|
2205
|
-
}
|
|
2146
|
+
"kind": "method",
|
|
2147
|
+
"name": "goBack",
|
|
2148
|
+
"privacy": "private"
|
|
2206
2149
|
},
|
|
2207
2150
|
{
|
|
2208
2151
|
"kind": "method",
|
|
2209
|
-
"name": "
|
|
2152
|
+
"name": "setParent",
|
|
2153
|
+
"privacy": "private",
|
|
2210
2154
|
"parameters": [
|
|
2211
2155
|
{
|
|
2212
|
-
"name": "
|
|
2156
|
+
"name": "parent",
|
|
2213
2157
|
"optional": true,
|
|
2214
2158
|
"type": {
|
|
2215
|
-
"text": "
|
|
2216
|
-
}
|
|
2217
|
-
"description": "An object which controls aspects of the focusing process."
|
|
2159
|
+
"text": "string"
|
|
2160
|
+
}
|
|
2218
2161
|
}
|
|
2219
|
-
]
|
|
2220
|
-
"description": "Programmatically move focus to the component.",
|
|
2221
|
-
"inheritedFrom": {
|
|
2222
|
-
"name": "FocusableMixin",
|
|
2223
|
-
"module": "src/common/mixins/FocusableMixin.ts"
|
|
2224
|
-
}
|
|
2162
|
+
]
|
|
2225
2163
|
},
|
|
2226
2164
|
{
|
|
2227
2165
|
"kind": "method",
|
|
2228
|
-
"name": "
|
|
2229
|
-
"
|
|
2230
|
-
"
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2166
|
+
"name": "setSearch",
|
|
2167
|
+
"privacy": "private",
|
|
2168
|
+
"parameters": [
|
|
2169
|
+
{
|
|
2170
|
+
"name": "str",
|
|
2171
|
+
"type": {
|
|
2172
|
+
"text": "string"
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
]
|
|
2234
2176
|
},
|
|
2235
2177
|
{
|
|
2236
2178
|
"kind": "method",
|
|
2237
|
-
"name": "
|
|
2238
|
-
"
|
|
2239
|
-
"inheritedFrom": {
|
|
2240
|
-
"name": "FocusableMixin",
|
|
2241
|
-
"module": "src/common/mixins/FocusableMixin.ts"
|
|
2242
|
-
}
|
|
2179
|
+
"name": "filterCommands",
|
|
2180
|
+
"privacy": "private"
|
|
2243
2181
|
},
|
|
2244
2182
|
{
|
|
2245
2183
|
"kind": "field",
|
|
@@ -2256,191 +2194,225 @@
|
|
|
2256
2194
|
}
|
|
2257
2195
|
}
|
|
2258
2196
|
],
|
|
2197
|
+
"events": [
|
|
2198
|
+
{
|
|
2199
|
+
"name": "open",
|
|
2200
|
+
"type": {
|
|
2201
|
+
"text": "NordEvent"
|
|
2202
|
+
},
|
|
2203
|
+
"description": "The command menu was opened."
|
|
2204
|
+
},
|
|
2205
|
+
{
|
|
2206
|
+
"name": "close",
|
|
2207
|
+
"type": {
|
|
2208
|
+
"text": "NordEvent"
|
|
2209
|
+
},
|
|
2210
|
+
"description": "The command menu was closed."
|
|
2211
|
+
},
|
|
2212
|
+
{
|
|
2213
|
+
"type": {
|
|
2214
|
+
"text": "SelectEvent"
|
|
2215
|
+
},
|
|
2216
|
+
"description": "User selected a command from the menu.",
|
|
2217
|
+
"name": "n-select"
|
|
2218
|
+
}
|
|
2219
|
+
],
|
|
2259
2220
|
"attributes": [
|
|
2260
2221
|
{
|
|
2261
|
-
"name": "
|
|
2222
|
+
"name": "open",
|
|
2262
2223
|
"type": {
|
|
2263
2224
|
"text": "boolean"
|
|
2264
2225
|
},
|
|
2265
2226
|
"default": "false",
|
|
2266
|
-
"description": "
|
|
2267
|
-
"fieldName": "
|
|
2227
|
+
"description": "Show or hide the command menu.",
|
|
2228
|
+
"fieldName": "open"
|
|
2268
2229
|
},
|
|
2269
2230
|
{
|
|
2270
|
-
"name": "
|
|
2231
|
+
"name": "placeholder",
|
|
2271
2232
|
"type": {
|
|
2272
2233
|
"text": "string"
|
|
2273
2234
|
},
|
|
2274
|
-
"default": "\"
|
|
2275
|
-
"description": "
|
|
2276
|
-
"fieldName": "
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
}
|
|
2281
|
-
},
|
|
2235
|
+
"default": "\"Type a command or search...\"",
|
|
2236
|
+
"description": "Hint text to display in the Command Menu search field.",
|
|
2237
|
+
"fieldName": "placeholder"
|
|
2238
|
+
}
|
|
2239
|
+
],
|
|
2240
|
+
"mixins": [
|
|
2282
2241
|
{
|
|
2283
|
-
"name": "
|
|
2242
|
+
"name": "DraftComponentMixin",
|
|
2243
|
+
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
2244
|
+
}
|
|
2245
|
+
],
|
|
2246
|
+
"superclass": {
|
|
2247
|
+
"name": "LitElement",
|
|
2248
|
+
"package": "lit"
|
|
2249
|
+
},
|
|
2250
|
+
"status": "draft",
|
|
2251
|
+
"category": "action",
|
|
2252
|
+
"tagName": "nord-command-menu",
|
|
2253
|
+
"customElement": true
|
|
2254
|
+
}
|
|
2255
|
+
],
|
|
2256
|
+
"exports": [
|
|
2257
|
+
{
|
|
2258
|
+
"kind": "js",
|
|
2259
|
+
"name": "default",
|
|
2260
|
+
"declaration": {
|
|
2261
|
+
"name": "CommandMenu",
|
|
2262
|
+
"module": "src/command-menu/CommandMenu.ts"
|
|
2263
|
+
}
|
|
2264
|
+
},
|
|
2265
|
+
{
|
|
2266
|
+
"kind": "custom-element-definition",
|
|
2267
|
+
"name": "nord-command-menu",
|
|
2268
|
+
"declaration": {
|
|
2269
|
+
"name": "CommandMenu",
|
|
2270
|
+
"module": "src/command-menu/CommandMenu.ts"
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
],
|
|
2274
|
+
"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"
|
|
2275
|
+
},
|
|
2276
|
+
{
|
|
2277
|
+
"kind": "javascript-module",
|
|
2278
|
+
"path": "src/command-menu/CommandMenuAction.ts",
|
|
2279
|
+
"declarations": [
|
|
2280
|
+
{
|
|
2281
|
+
"kind": "class",
|
|
2282
|
+
"description": "Command Menu Action displays a single action that can be executed by the user. For usage examples, please see Command Menu component.",
|
|
2283
|
+
"name": "CommandMenuAction",
|
|
2284
|
+
"members": [
|
|
2285
|
+
{
|
|
2286
|
+
"kind": "field",
|
|
2287
|
+
"name": "command",
|
|
2284
2288
|
"type": {
|
|
2285
|
-
"text": "
|
|
2289
|
+
"text": "ICommandMenuAction"
|
|
2286
2290
|
},
|
|
2287
|
-
"
|
|
2288
|
-
"fieldName": "hint",
|
|
2289
|
-
"inheritedFrom": {
|
|
2290
|
-
"name": "FormAssociatedMixin",
|
|
2291
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2292
|
-
}
|
|
2291
|
+
"attribute": "command"
|
|
2293
2292
|
},
|
|
2294
2293
|
{
|
|
2295
|
-
"
|
|
2294
|
+
"kind": "field",
|
|
2295
|
+
"name": "selected",
|
|
2296
2296
|
"type": {
|
|
2297
2297
|
"text": "boolean"
|
|
2298
2298
|
},
|
|
2299
2299
|
"default": "false",
|
|
2300
|
-
"
|
|
2301
|
-
"fieldName": "hideLabel",
|
|
2302
|
-
"inheritedFrom": {
|
|
2303
|
-
"name": "FormAssociatedMixin",
|
|
2304
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2305
|
-
}
|
|
2300
|
+
"attribute": "selected"
|
|
2306
2301
|
},
|
|
2307
2302
|
{
|
|
2308
|
-
"
|
|
2309
|
-
"
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
"description": "Placeholder text to display within the input.",
|
|
2313
|
-
"fieldName": "placeholder",
|
|
2314
|
-
"inheritedFrom": {
|
|
2315
|
-
"name": "FormAssociatedMixin",
|
|
2316
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2317
|
-
}
|
|
2303
|
+
"kind": "method",
|
|
2304
|
+
"name": "ensureInView",
|
|
2305
|
+
"privacy": "private",
|
|
2306
|
+
"description": "Scroll to show element"
|
|
2318
2307
|
},
|
|
2319
2308
|
{
|
|
2320
|
-
"
|
|
2321
|
-
"
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
"inheritedFrom": {
|
|
2327
|
-
"name": "FormAssociatedMixin",
|
|
2328
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2329
|
-
}
|
|
2330
|
-
},
|
|
2309
|
+
"kind": "method",
|
|
2310
|
+
"name": "renderShortcut",
|
|
2311
|
+
"privacy": "private"
|
|
2312
|
+
}
|
|
2313
|
+
],
|
|
2314
|
+
"attributes": [
|
|
2331
2315
|
{
|
|
2332
|
-
"name": "
|
|
2316
|
+
"name": "command",
|
|
2333
2317
|
"type": {
|
|
2334
|
-
"text": "
|
|
2318
|
+
"text": "ICommandMenuAction"
|
|
2335
2319
|
},
|
|
2336
|
-
"
|
|
2337
|
-
"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.",
|
|
2338
|
-
"fieldName": "required",
|
|
2339
|
-
"inheritedFrom": {
|
|
2340
|
-
"name": "FormAssociatedMixin",
|
|
2341
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2342
|
-
}
|
|
2320
|
+
"fieldName": "command"
|
|
2343
2321
|
},
|
|
2344
2322
|
{
|
|
2345
|
-
"name": "
|
|
2323
|
+
"name": "selected",
|
|
2346
2324
|
"type": {
|
|
2347
2325
|
"text": "boolean"
|
|
2348
2326
|
},
|
|
2349
2327
|
"default": "false",
|
|
2350
|
-
"
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2328
|
+
"fieldName": "selected"
|
|
2329
|
+
}
|
|
2330
|
+
],
|
|
2331
|
+
"superclass": {
|
|
2332
|
+
"name": "LitElement",
|
|
2333
|
+
"package": "lit"
|
|
2334
|
+
},
|
|
2335
|
+
"status": "internal",
|
|
2336
|
+
"category": null,
|
|
2337
|
+
"tagName": "nord-command-menu-action",
|
|
2338
|
+
"customElement": true
|
|
2339
|
+
}
|
|
2340
|
+
],
|
|
2341
|
+
"exports": [
|
|
2342
|
+
{
|
|
2343
|
+
"kind": "js",
|
|
2344
|
+
"name": "default",
|
|
2345
|
+
"declaration": {
|
|
2346
|
+
"name": "CommandMenuAction",
|
|
2347
|
+
"module": "src/command-menu/CommandMenuAction.ts"
|
|
2348
|
+
}
|
|
2349
|
+
},
|
|
2350
|
+
{
|
|
2351
|
+
"kind": "custom-element-definition",
|
|
2352
|
+
"name": "nord-command-menu-action",
|
|
2353
|
+
"declaration": {
|
|
2354
|
+
"name": "CommandMenuAction",
|
|
2355
|
+
"module": "src/command-menu/CommandMenuAction.ts"
|
|
2356
|
+
}
|
|
2357
|
+
}
|
|
2358
|
+
],
|
|
2359
|
+
"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"
|
|
2360
|
+
},
|
|
2361
|
+
{
|
|
2362
|
+
"kind": "javascript-module",
|
|
2363
|
+
"path": "src/command-menu/ICommandMenuAction.ts",
|
|
2364
|
+
"declarations": [],
|
|
2365
|
+
"exports": [],
|
|
2366
|
+
"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"
|
|
2367
|
+
},
|
|
2368
|
+
{
|
|
2369
|
+
"kind": "javascript-module",
|
|
2370
|
+
"path": "src/command-menu/KeyboardController.ts",
|
|
2371
|
+
"declarations": [
|
|
2372
|
+
{
|
|
2373
|
+
"kind": "class",
|
|
2374
|
+
"description": "",
|
|
2375
|
+
"name": "KeyboardController",
|
|
2376
|
+
"members": [
|
|
2357
2377
|
{
|
|
2358
|
-
"
|
|
2378
|
+
"kind": "field",
|
|
2379
|
+
"name": "host",
|
|
2359
2380
|
"type": {
|
|
2360
|
-
"text": "
|
|
2381
|
+
"text": "CommandMenu"
|
|
2361
2382
|
},
|
|
2362
|
-
"
|
|
2363
|
-
"
|
|
2364
|
-
"fieldName": "disabled",
|
|
2365
|
-
"inheritedFrom": {
|
|
2366
|
-
"name": "InputMixin",
|
|
2367
|
-
"module": "src/common/mixins/InputMixin.ts"
|
|
2368
|
-
}
|
|
2383
|
+
"privacy": "private",
|
|
2384
|
+
"default": "host"
|
|
2369
2385
|
},
|
|
2370
2386
|
{
|
|
2371
|
-
"
|
|
2387
|
+
"kind": "field",
|
|
2388
|
+
"name": "globalShortcuts",
|
|
2372
2389
|
"type": {
|
|
2373
|
-
"text": "
|
|
2390
|
+
"text": "ShortcutController"
|
|
2374
2391
|
},
|
|
2375
|
-
"
|
|
2376
|
-
"
|
|
2377
|
-
"inheritedFrom": {
|
|
2378
|
-
"name": "InputMixin",
|
|
2379
|
-
"module": "src/common/mixins/InputMixin.ts"
|
|
2380
|
-
}
|
|
2392
|
+
"privacy": "private",
|
|
2393
|
+
"default": "new ShortcutController(host, { \"$mod+k\": preventDefault(actions.toggleOpen) })"
|
|
2381
2394
|
},
|
|
2382
2395
|
{
|
|
2383
|
-
"
|
|
2396
|
+
"kind": "field",
|
|
2397
|
+
"name": "navigationShortcuts",
|
|
2384
2398
|
"type": {
|
|
2385
|
-
"text": "
|
|
2399
|
+
"text": "ShortcutController"
|
|
2386
2400
|
},
|
|
2387
|
-
"
|
|
2388
|
-
"
|
|
2389
|
-
"fieldName": "value",
|
|
2390
|
-
"inheritedFrom": {
|
|
2391
|
-
"name": "InputMixin",
|
|
2392
|
-
"module": "src/common/mixins/InputMixin.ts"
|
|
2393
|
-
}
|
|
2394
|
-
}
|
|
2395
|
-
],
|
|
2396
|
-
"mixins": [
|
|
2397
|
-
{
|
|
2398
|
-
"name": "FormAssociatedMixin",
|
|
2399
|
-
"module": "/src/common/mixins/FormAssociatedMixin.js"
|
|
2400
|
-
},
|
|
2401
|
-
{
|
|
2402
|
-
"name": "InputMixin",
|
|
2403
|
-
"module": "/src/common/mixins/InputMixin.js"
|
|
2404
|
-
},
|
|
2405
|
-
{
|
|
2406
|
-
"name": "FocusableMixin",
|
|
2407
|
-
"module": "/src/common/mixins/FocusableMixin.js"
|
|
2401
|
+
"privacy": "private",
|
|
2402
|
+
"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 )"
|
|
2408
2403
|
},
|
|
2409
2404
|
{
|
|
2410
|
-
"
|
|
2411
|
-
"
|
|
2412
|
-
}
|
|
2413
|
-
],
|
|
2414
|
-
"superclass": {
|
|
2415
|
-
"name": "LitElement",
|
|
2416
|
-
"package": "lit"
|
|
2417
|
-
},
|
|
2418
|
-
"status": "draft",
|
|
2419
|
-
"category": "form",
|
|
2420
|
-
"tagName": "nord-checkbox",
|
|
2421
|
-
"customElement": true,
|
|
2422
|
-
"events": [
|
|
2423
|
-
{
|
|
2424
|
-
"name": "input",
|
|
2405
|
+
"kind": "field",
|
|
2406
|
+
"name": "commandShortcuts",
|
|
2425
2407
|
"type": {
|
|
2426
|
-
"text": "
|
|
2408
|
+
"text": "ShortcutController"
|
|
2427
2409
|
},
|
|
2428
|
-
"
|
|
2429
|
-
"
|
|
2430
|
-
"name": "FormAssociatedMixin",
|
|
2431
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2432
|
-
}
|
|
2410
|
+
"privacy": "private",
|
|
2411
|
+
"default": "new ShortcutController(host)"
|
|
2433
2412
|
},
|
|
2434
2413
|
{
|
|
2435
|
-
"
|
|
2436
|
-
"
|
|
2437
|
-
"text": "NordEvent"
|
|
2438
|
-
},
|
|
2439
|
-
"description": "Fired whenever the input's value is changed via user interaction.",
|
|
2440
|
-
"inheritedFrom": {
|
|
2441
|
-
"name": "FormAssociatedMixin",
|
|
2442
|
-
"module": "src/common/mixins/FormAssociatedMixin.ts"
|
|
2443
|
-
}
|
|
2414
|
+
"kind": "method",
|
|
2415
|
+
"name": "registerCommandShortcuts"
|
|
2444
2416
|
}
|
|
2445
2417
|
]
|
|
2446
2418
|
}
|
|
@@ -2448,22 +2420,50 @@
|
|
|
2448
2420
|
"exports": [
|
|
2449
2421
|
{
|
|
2450
2422
|
"kind": "js",
|
|
2451
|
-
"name": "
|
|
2423
|
+
"name": "KeyboardController",
|
|
2452
2424
|
"declaration": {
|
|
2453
|
-
"name": "
|
|
2454
|
-
"module": "src/
|
|
2425
|
+
"name": "KeyboardController",
|
|
2426
|
+
"module": "src/command-menu/KeyboardController.ts"
|
|
2455
2427
|
}
|
|
2456
|
-
}
|
|
2428
|
+
}
|
|
2429
|
+
],
|
|
2430
|
+
"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"
|
|
2431
|
+
},
|
|
2432
|
+
{
|
|
2433
|
+
"kind": "javascript-module",
|
|
2434
|
+
"path": "src/command-menu/events.ts",
|
|
2435
|
+
"declarations": [
|
|
2457
2436
|
{
|
|
2458
|
-
"kind": "
|
|
2459
|
-
"
|
|
2437
|
+
"kind": "class",
|
|
2438
|
+
"description": "",
|
|
2439
|
+
"name": "SelectEvent",
|
|
2440
|
+
"members": [
|
|
2441
|
+
{
|
|
2442
|
+
"kind": "field",
|
|
2443
|
+
"name": "command",
|
|
2444
|
+
"type": {
|
|
2445
|
+
"text": "ICommandMenuAction"
|
|
2446
|
+
},
|
|
2447
|
+
"default": "command"
|
|
2448
|
+
}
|
|
2449
|
+
],
|
|
2450
|
+
"superclass": {
|
|
2451
|
+
"name": "NordEvent",
|
|
2452
|
+
"module": "/src/common/events.js"
|
|
2453
|
+
}
|
|
2454
|
+
}
|
|
2455
|
+
],
|
|
2456
|
+
"exports": [
|
|
2457
|
+
{
|
|
2458
|
+
"kind": "js",
|
|
2459
|
+
"name": "SelectEvent",
|
|
2460
2460
|
"declaration": {
|
|
2461
|
-
"name": "
|
|
2462
|
-
"module": "src/
|
|
2461
|
+
"name": "SelectEvent",
|
|
2462
|
+
"module": "src/command-menu/events.ts"
|
|
2463
2463
|
}
|
|
2464
2464
|
}
|
|
2465
2465
|
],
|
|
2466
|
-
"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"
|
|
2466
|
+
"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"
|
|
2467
2467
|
},
|
|
2468
2468
|
{
|
|
2469
2469
|
"kind": "javascript-module",
|