@nordhealth/components 1.3.0 → 1.4.0
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 +198 -198
- package/lib/Button.js +1 -1
- package/lib/Button.js.map +1 -1
- package/lib/{Calendar-bde1e51c.js → Calendar-a389d216.js} +1 -1
- package/lib/{Calendar-bde1e51c.js.map → Calendar-a389d216.js.map} +1 -1
- package/lib/Calendar.js +1 -1
- package/lib/DatePicker.js +1 -1
- package/lib/Icon.js +1 -1
- package/lib/bundle.js +2 -2
- package/lib/bundle.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/src/button/Button.d.ts +1 -1
- package/lib/src/navigation/Navigation.test.d.ts +1 -0
- package/package.json +3 -3
package/custom-elements.json
CHANGED
|
@@ -291,105 +291,40 @@
|
|
|
291
291
|
},
|
|
292
292
|
{
|
|
293
293
|
"kind": "javascript-module",
|
|
294
|
-
"path": "src/
|
|
294
|
+
"path": "src/badge/Badge.ts",
|
|
295
295
|
"declarations": [
|
|
296
296
|
{
|
|
297
297
|
"kind": "class",
|
|
298
|
-
"description": "
|
|
299
|
-
"name": "
|
|
300
|
-
"
|
|
301
|
-
{
|
|
302
|
-
"kind": "field",
|
|
303
|
-
"name": "state",
|
|
304
|
-
"type": {
|
|
305
|
-
"text": "States<typeof transition>"
|
|
306
|
-
},
|
|
307
|
-
"privacy": "private",
|
|
308
|
-
"default": "\"initial\""
|
|
309
|
-
},
|
|
298
|
+
"description": "Badges are used to inform users of the status of an object or of an action that’s been taken. Commonly used in tabular data to indicate status.",
|
|
299
|
+
"name": "Badge",
|
|
300
|
+
"slots": [
|
|
310
301
|
{
|
|
311
|
-
"
|
|
312
|
-
"name": "
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
"default": "\"m\"",
|
|
317
|
-
"description": "The size of the avatar.",
|
|
318
|
-
"attribute": "size",
|
|
319
|
-
"reflects": true
|
|
320
|
-
},
|
|
302
|
+
"description": "The badge content.",
|
|
303
|
+
"name": ""
|
|
304
|
+
}
|
|
305
|
+
],
|
|
306
|
+
"members": [
|
|
321
307
|
{
|
|
322
308
|
"kind": "field",
|
|
323
|
-
"name": "
|
|
309
|
+
"name": "type",
|
|
324
310
|
"type": {
|
|
325
|
-
"text": "
|
|
311
|
+
"text": "\"warning\" | \"success\" | \"danger\" | \"highlight\" | \"info\" | undefined"
|
|
326
312
|
},
|
|
327
|
-
"
|
|
328
|
-
"
|
|
313
|
+
"default": "\"info\"",
|
|
314
|
+
"description": "The type of badge.\nDetermines the color of the chip shown on the badge.",
|
|
315
|
+
"attribute": "type",
|
|
329
316
|
"reflects": true
|
|
330
|
-
},
|
|
331
|
-
{
|
|
332
|
-
"kind": "field",
|
|
333
|
-
"name": "name",
|
|
334
|
-
"type": {
|
|
335
|
-
"text": "string"
|
|
336
|
-
},
|
|
337
|
-
"default": "\"\"",
|
|
338
|
-
"description": "The name of the person.",
|
|
339
|
-
"attribute": "name"
|
|
340
|
-
},
|
|
341
|
-
{
|
|
342
|
-
"kind": "method",
|
|
343
|
-
"name": "handleSrcChange",
|
|
344
|
-
"privacy": "protected"
|
|
345
|
-
},
|
|
346
|
-
{
|
|
347
|
-
"kind": "method",
|
|
348
|
-
"name": "renderImage",
|
|
349
|
-
"privacy": "protected"
|
|
350
|
-
},
|
|
351
|
-
{
|
|
352
|
-
"kind": "method",
|
|
353
|
-
"name": "renderFallback",
|
|
354
|
-
"privacy": "protected"
|
|
355
|
-
},
|
|
356
|
-
{
|
|
357
|
-
"kind": "method",
|
|
358
|
-
"name": "handleLoad",
|
|
359
|
-
"privacy": "private"
|
|
360
|
-
},
|
|
361
|
-
{
|
|
362
|
-
"kind": "method",
|
|
363
|
-
"name": "handleError",
|
|
364
|
-
"privacy": "private"
|
|
365
317
|
}
|
|
366
318
|
],
|
|
367
319
|
"attributes": [
|
|
368
320
|
{
|
|
369
|
-
"name": "
|
|
370
|
-
"type": {
|
|
371
|
-
"text": "\"m\" | \"l\" | \"xl\" | \"xxl\""
|
|
372
|
-
},
|
|
373
|
-
"default": "\"m\"",
|
|
374
|
-
"description": "The size of the avatar.",
|
|
375
|
-
"fieldName": "size"
|
|
376
|
-
},
|
|
377
|
-
{
|
|
378
|
-
"name": "src",
|
|
379
|
-
"type": {
|
|
380
|
-
"text": "string | undefined"
|
|
381
|
-
},
|
|
382
|
-
"description": "The URL of the avatar image uploaded by the user.",
|
|
383
|
-
"fieldName": "src"
|
|
384
|
-
},
|
|
385
|
-
{
|
|
386
|
-
"name": "name",
|
|
321
|
+
"name": "type",
|
|
387
322
|
"type": {
|
|
388
|
-
"text": "
|
|
323
|
+
"text": "\"warning\" | \"success\" | \"danger\" | \"highlight\" | \"info\" | undefined"
|
|
389
324
|
},
|
|
390
|
-
"default": "\"\"",
|
|
391
|
-
"description": "The
|
|
392
|
-
"fieldName": "
|
|
325
|
+
"default": "\"info\"",
|
|
326
|
+
"description": "The type of badge.\nDetermines the color of the chip shown on the badge.",
|
|
327
|
+
"fieldName": "type"
|
|
393
328
|
}
|
|
394
329
|
],
|
|
395
330
|
"superclass": {
|
|
@@ -397,8 +332,8 @@
|
|
|
397
332
|
"package": "lit"
|
|
398
333
|
},
|
|
399
334
|
"status": "ready",
|
|
400
|
-
"category": "
|
|
401
|
-
"tagName": "nord-
|
|
335
|
+
"category": "text",
|
|
336
|
+
"tagName": "nord-badge",
|
|
402
337
|
"customElement": true
|
|
403
338
|
}
|
|
404
339
|
],
|
|
@@ -407,20 +342,20 @@
|
|
|
407
342
|
"kind": "js",
|
|
408
343
|
"name": "default",
|
|
409
344
|
"declaration": {
|
|
410
|
-
"name": "
|
|
411
|
-
"module": "src/
|
|
345
|
+
"name": "Badge",
|
|
346
|
+
"module": "src/badge/Badge.ts"
|
|
412
347
|
}
|
|
413
348
|
},
|
|
414
349
|
{
|
|
415
350
|
"kind": "custom-element-definition",
|
|
416
|
-
"name": "nord-
|
|
351
|
+
"name": "nord-badge",
|
|
417
352
|
"declaration": {
|
|
418
|
-
"name": "
|
|
419
|
-
"module": "src/
|
|
353
|
+
"name": "Badge",
|
|
354
|
+
"module": "src/badge/Badge.ts"
|
|
420
355
|
}
|
|
421
356
|
}
|
|
422
357
|
],
|
|
423
|
-
"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-
|
|
358
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to show a status update on a piece of information or action.\n- Use to mark something as a “draft” or “new”.\n- Use when you want to highlight something that has been added recently.\n- Use established color patterns so that users can clearly identify the importance level.\n- Always position badge so that it’s clear to understand what object it’s related to.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make badges clickable. Instead use button component’s small variant.\n- Don’t use alternatives to existing badge variants.\n\n</div>\n\n---\n\n## Content guidelines\n\nBadge labels should use a single word to describe the status of an object. Only use two words if you need to describe a complex state:\n\n<div class=\"n-usage n-usage-do\">Complete</div>\n<div class=\"n-usage n-usage-dont\">Action completed</div>\n\nWhen writing badge labels, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">Partially refunded</div>\n<div class=\"n-usage n-usage-dont\">Partially Refunded</div>\n\nAvoid unnecessary words and articles in badge labels, such as “is”, “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Pending</div>\n<div class=\"n-usage n-usage-dont\">Item is pending</div>\n\nAlways describe the status in the past tense:\n\n<div class=\"n-usage n-usage-do\">Refunded</div>\n<div class=\"n-usage n-usage-dont\">Refund</div>\n\n---\n\n## Variants\n\nThis section describes the different component variants, their purpose, and when to use each variant.\n\n| Name | Purpose |\n| ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| `info` | The default variant. Used to convey general information that isn’t critical. |\n| `success` | Used to convey success states. For example, you might want to show a badge that tells the user a payment was successful. |\n| `highlight` | Used to highlight specific items in the interface, like notifications. |\n| `danger` | Used to communicate problems that have to be resolved so that user can continue forward. Should always be used for highlighting errors. |\n| `warning` | Used to display information that needs a user’s attention attention and may require further steps. |\n"
|
|
424
359
|
},
|
|
425
360
|
{
|
|
426
361
|
"kind": "javascript-module",
|
|
@@ -466,7 +401,7 @@
|
|
|
466
401
|
"kind": "field",
|
|
467
402
|
"name": "variant",
|
|
468
403
|
"type": {
|
|
469
|
-
"text": "\"default\" | \"primary\" | \"dashed\" | \"plain\" | \"danger\""
|
|
404
|
+
"text": "\"default\" | \"primary\" | \"dashed\" | \"plain\" | \"danger\" | \"switch\""
|
|
470
405
|
},
|
|
471
406
|
"default": "\"default\"",
|
|
472
407
|
"description": "The style variant of the button.",
|
|
@@ -708,7 +643,7 @@
|
|
|
708
643
|
{
|
|
709
644
|
"name": "variant",
|
|
710
645
|
"type": {
|
|
711
|
-
"text": "\"default\" | \"primary\" | \"dashed\" | \"plain\" | \"danger\""
|
|
646
|
+
"text": "\"default\" | \"primary\" | \"dashed\" | \"plain\" | \"danger\" | \"switch\""
|
|
712
647
|
},
|
|
713
648
|
"default": "\"default\"",
|
|
714
649
|
"description": "The style variant of the button.",
|
|
@@ -858,75 +793,7 @@
|
|
|
858
793
|
}
|
|
859
794
|
}
|
|
860
795
|
],
|
|
861
|
-
"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"
|
|
862
|
-
},
|
|
863
|
-
{
|
|
864
|
-
"kind": "javascript-module",
|
|
865
|
-
"path": "src/badge/Badge.ts",
|
|
866
|
-
"declarations": [
|
|
867
|
-
{
|
|
868
|
-
"kind": "class",
|
|
869
|
-
"description": "Badges are used to inform users of the status of an object or of an action that’s been taken. Commonly used in tabular data to indicate status.",
|
|
870
|
-
"name": "Badge",
|
|
871
|
-
"slots": [
|
|
872
|
-
{
|
|
873
|
-
"description": "The badge content.",
|
|
874
|
-
"name": ""
|
|
875
|
-
}
|
|
876
|
-
],
|
|
877
|
-
"members": [
|
|
878
|
-
{
|
|
879
|
-
"kind": "field",
|
|
880
|
-
"name": "type",
|
|
881
|
-
"type": {
|
|
882
|
-
"text": "\"warning\" | \"success\" | \"danger\" | \"highlight\" | \"info\" | undefined"
|
|
883
|
-
},
|
|
884
|
-
"default": "\"info\"",
|
|
885
|
-
"description": "The type of badge.\nDetermines the color of the chip shown on the badge.",
|
|
886
|
-
"attribute": "type",
|
|
887
|
-
"reflects": true
|
|
888
|
-
}
|
|
889
|
-
],
|
|
890
|
-
"attributes": [
|
|
891
|
-
{
|
|
892
|
-
"name": "type",
|
|
893
|
-
"type": {
|
|
894
|
-
"text": "\"warning\" | \"success\" | \"danger\" | \"highlight\" | \"info\" | undefined"
|
|
895
|
-
},
|
|
896
|
-
"default": "\"info\"",
|
|
897
|
-
"description": "The type of badge.\nDetermines the color of the chip shown on the badge.",
|
|
898
|
-
"fieldName": "type"
|
|
899
|
-
}
|
|
900
|
-
],
|
|
901
|
-
"superclass": {
|
|
902
|
-
"name": "LitElement",
|
|
903
|
-
"package": "lit"
|
|
904
|
-
},
|
|
905
|
-
"status": "ready",
|
|
906
|
-
"category": "text",
|
|
907
|
-
"tagName": "nord-badge",
|
|
908
|
-
"customElement": true
|
|
909
|
-
}
|
|
910
|
-
],
|
|
911
|
-
"exports": [
|
|
912
|
-
{
|
|
913
|
-
"kind": "js",
|
|
914
|
-
"name": "default",
|
|
915
|
-
"declaration": {
|
|
916
|
-
"name": "Badge",
|
|
917
|
-
"module": "src/badge/Badge.ts"
|
|
918
|
-
}
|
|
919
|
-
},
|
|
920
|
-
{
|
|
921
|
-
"kind": "custom-element-definition",
|
|
922
|
-
"name": "nord-badge",
|
|
923
|
-
"declaration": {
|
|
924
|
-
"name": "Badge",
|
|
925
|
-
"module": "src/badge/Badge.ts"
|
|
926
|
-
}
|
|
927
|
-
}
|
|
928
|
-
],
|
|
929
|
-
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to show a status update on a piece of information or action.\n- Use to mark something as a “draft” or “new”.\n- Use when you want to highlight something that has been added recently.\n- Use established color patterns so that users can clearly identify the importance level.\n- Always position badge so that it’s clear to understand what object it’s related to.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t make badges clickable. Instead use button component’s small variant.\n- Don’t use alternatives to existing badge variants.\n\n</div>\n\n---\n\n## Content guidelines\n\nBadge labels should use a single word to describe the status of an object. Only use two words if you need to describe a complex state:\n\n<div class=\"n-usage n-usage-do\">Complete</div>\n<div class=\"n-usage n-usage-dont\">Action completed</div>\n\nWhen writing badge labels, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">Partially refunded</div>\n<div class=\"n-usage n-usage-dont\">Partially Refunded</div>\n\nAvoid unnecessary words and articles in badge labels, such as “is”, “the”, “an” or “a”:\n\n<div class=\"n-usage n-usage-do\">Pending</div>\n<div class=\"n-usage n-usage-dont\">Item is pending</div>\n\nAlways describe the status in the past tense:\n\n<div class=\"n-usage n-usage-do\">Refunded</div>\n<div class=\"n-usage n-usage-dont\">Refund</div>\n\n---\n\n## Variants\n\nThis section describes the different component variants, their purpose, and when to use each variant.\n\n| Name | Purpose |\n| ----------- | --------------------------------------------------------------------------------------------------------------------------------------- |\n| `info` | The default variant. Used to convey general information that isn’t critical. |\n| `success` | Used to convey success states. For example, you might want to show a badge that tells the user a payment was successful. |\n| `highlight` | Used to highlight specific items in the interface, like notifications. |\n| `danger` | Used to communicate problems that have to be resolved so that user can continue forward. Should always be used for highlighting errors. |\n| `warning` | Used to display information that needs a user’s attention attention and may require further steps. |\n"
|
|
796
|
+
"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| `switch` | Switch style is reserved for the clinic switcher in the top left corner of an application. |\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"
|
|
930
797
|
},
|
|
931
798
|
{
|
|
932
799
|
"kind": "javascript-module",
|
|
@@ -1514,6 +1381,139 @@
|
|
|
1514
1381
|
],
|
|
1515
1382
|
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use when the user needs to choose a single date or a date range.\n- Close calendar after a single date is selected, unless a range with a start and end date is required.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use for entering date of birth. Use input component instead.\n- Don’t use for choosing a date that is over 10 years in the future or the past.\n\n</div>\n\n---\n\n## Keyboard accessibility\n\nCalendar component is built to closely follow [W3C Date Picker Dialog example](https://www.w3.org/TR/wai-aria-practices/examples/dialog-modal/datepicker-dialog.html) with some small exceptions to e.g. better support iOS VoiceOver and Android TalkBack.\n\n### Month/year buttons\n\n- `Space, Enter`: Changes the month and/or year displayed.\n\n### Calendar grid\n\n- `Space, Enter`: Selects a date.\n- `Arrow up`: Moves focus to the same day of the previous week.\n- `Arrow down`: Moves focus to the same day of the next week.\n- `Arrow right`: Moves focus to the next day. In right-to-left languages, moves focus to the previous day.\n- `Arrow left`: Moves focus to the previous day. In right-to-left languages, moves focus to the next day.\n- `Home`: Moves focus to the first day (e.g Monday) of the current week.\n- `End`: Moves focus to the last day (e.g. Sunday) of the current week.\n- `Page Up`: Changes the grid of dates to the previous month and sets focus on the same day of the same week.\n- `Shift + Page Up`: Changes the grid of dates to the previous year and sets focus on the same day of the same week.\n- `Page Down`: Changes the grid of dates to the next month and sets focus on the same day of the same week.\n- `Shift + Page Down`: Changes the grid of dates to the next year and sets focus on the same day of the same week.\n"
|
|
1516
1383
|
},
|
|
1384
|
+
{
|
|
1385
|
+
"kind": "javascript-module",
|
|
1386
|
+
"path": "src/avatar/Avatar.ts",
|
|
1387
|
+
"declarations": [
|
|
1388
|
+
{
|
|
1389
|
+
"kind": "class",
|
|
1390
|
+
"description": "Avatar is used for showing a thumbnail representation of a user or entity.\nDefault avatar illustration is displayed when no src is specified.",
|
|
1391
|
+
"name": "Avatar",
|
|
1392
|
+
"members": [
|
|
1393
|
+
{
|
|
1394
|
+
"kind": "field",
|
|
1395
|
+
"name": "state",
|
|
1396
|
+
"type": {
|
|
1397
|
+
"text": "States<typeof transition>"
|
|
1398
|
+
},
|
|
1399
|
+
"privacy": "private",
|
|
1400
|
+
"default": "\"initial\""
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
"kind": "field",
|
|
1404
|
+
"name": "size",
|
|
1405
|
+
"type": {
|
|
1406
|
+
"text": "\"m\" | \"l\" | \"xl\" | \"xxl\""
|
|
1407
|
+
},
|
|
1408
|
+
"default": "\"m\"",
|
|
1409
|
+
"description": "The size of the avatar.",
|
|
1410
|
+
"attribute": "size",
|
|
1411
|
+
"reflects": true
|
|
1412
|
+
},
|
|
1413
|
+
{
|
|
1414
|
+
"kind": "field",
|
|
1415
|
+
"name": "src",
|
|
1416
|
+
"type": {
|
|
1417
|
+
"text": "string | undefined"
|
|
1418
|
+
},
|
|
1419
|
+
"description": "The URL of the avatar image uploaded by the user.",
|
|
1420
|
+
"attribute": "src",
|
|
1421
|
+
"reflects": true
|
|
1422
|
+
},
|
|
1423
|
+
{
|
|
1424
|
+
"kind": "field",
|
|
1425
|
+
"name": "name",
|
|
1426
|
+
"type": {
|
|
1427
|
+
"text": "string"
|
|
1428
|
+
},
|
|
1429
|
+
"default": "\"\"",
|
|
1430
|
+
"description": "The name of the person.",
|
|
1431
|
+
"attribute": "name"
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
"kind": "method",
|
|
1435
|
+
"name": "handleSrcChange",
|
|
1436
|
+
"privacy": "protected"
|
|
1437
|
+
},
|
|
1438
|
+
{
|
|
1439
|
+
"kind": "method",
|
|
1440
|
+
"name": "renderImage",
|
|
1441
|
+
"privacy": "protected"
|
|
1442
|
+
},
|
|
1443
|
+
{
|
|
1444
|
+
"kind": "method",
|
|
1445
|
+
"name": "renderFallback",
|
|
1446
|
+
"privacy": "protected"
|
|
1447
|
+
},
|
|
1448
|
+
{
|
|
1449
|
+
"kind": "method",
|
|
1450
|
+
"name": "handleLoad",
|
|
1451
|
+
"privacy": "private"
|
|
1452
|
+
},
|
|
1453
|
+
{
|
|
1454
|
+
"kind": "method",
|
|
1455
|
+
"name": "handleError",
|
|
1456
|
+
"privacy": "private"
|
|
1457
|
+
}
|
|
1458
|
+
],
|
|
1459
|
+
"attributes": [
|
|
1460
|
+
{
|
|
1461
|
+
"name": "size",
|
|
1462
|
+
"type": {
|
|
1463
|
+
"text": "\"m\" | \"l\" | \"xl\" | \"xxl\""
|
|
1464
|
+
},
|
|
1465
|
+
"default": "\"m\"",
|
|
1466
|
+
"description": "The size of the avatar.",
|
|
1467
|
+
"fieldName": "size"
|
|
1468
|
+
},
|
|
1469
|
+
{
|
|
1470
|
+
"name": "src",
|
|
1471
|
+
"type": {
|
|
1472
|
+
"text": "string | undefined"
|
|
1473
|
+
},
|
|
1474
|
+
"description": "The URL of the avatar image uploaded by the user.",
|
|
1475
|
+
"fieldName": "src"
|
|
1476
|
+
},
|
|
1477
|
+
{
|
|
1478
|
+
"name": "name",
|
|
1479
|
+
"type": {
|
|
1480
|
+
"text": "string"
|
|
1481
|
+
},
|
|
1482
|
+
"default": "\"\"",
|
|
1483
|
+
"description": "The name of the person.",
|
|
1484
|
+
"fieldName": "name"
|
|
1485
|
+
}
|
|
1486
|
+
],
|
|
1487
|
+
"superclass": {
|
|
1488
|
+
"name": "LitElement",
|
|
1489
|
+
"package": "lit"
|
|
1490
|
+
},
|
|
1491
|
+
"status": "ready",
|
|
1492
|
+
"category": "image",
|
|
1493
|
+
"tagName": "nord-avatar",
|
|
1494
|
+
"customElement": true
|
|
1495
|
+
}
|
|
1496
|
+
],
|
|
1497
|
+
"exports": [
|
|
1498
|
+
{
|
|
1499
|
+
"kind": "js",
|
|
1500
|
+
"name": "default",
|
|
1501
|
+
"declaration": {
|
|
1502
|
+
"name": "Avatar",
|
|
1503
|
+
"module": "src/avatar/Avatar.ts"
|
|
1504
|
+
}
|
|
1505
|
+
},
|
|
1506
|
+
{
|
|
1507
|
+
"kind": "custom-element-definition",
|
|
1508
|
+
"name": "nord-avatar",
|
|
1509
|
+
"declaration": {
|
|
1510
|
+
"name": "Avatar",
|
|
1511
|
+
"module": "src/avatar/Avatar.ts"
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
],
|
|
1515
|
+
"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- Always add the name of the person using the `name` property.\n- For the best results, use square images or images cropped into a square.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Try to avoid using landscape or portrait images as avatars. Let users crop their images before or after uploading if possible.\n\n</div>\n"
|
|
1516
|
+
},
|
|
1517
1517
|
{
|
|
1518
1518
|
"kind": "javascript-module",
|
|
1519
1519
|
"path": "src/card/Card.ts",
|
|
@@ -10234,41 +10234,6 @@
|
|
|
10234
10234
|
],
|
|
10235
10235
|
"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 hide text visually from the screen, but keep it available to assistive technologies, such as screen readers.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use for hiding interactive content.\n\n</div>\n"
|
|
10236
10236
|
},
|
|
10237
|
-
{
|
|
10238
|
-
"kind": "javascript-module",
|
|
10239
|
-
"path": "src/common/decorators/observe.ts",
|
|
10240
|
-
"declarations": [
|
|
10241
|
-
{
|
|
10242
|
-
"kind": "function",
|
|
10243
|
-
"name": "observe",
|
|
10244
|
-
"parameters": [
|
|
10245
|
-
{
|
|
10246
|
-
"name": "propertyName",
|
|
10247
|
-
"type": {
|
|
10248
|
-
"text": "string"
|
|
10249
|
-
}
|
|
10250
|
-
},
|
|
10251
|
-
{
|
|
10252
|
-
"name": "lifecycle",
|
|
10253
|
-
"default": "\"update\"",
|
|
10254
|
-
"type": {
|
|
10255
|
-
"text": "ObserveLifecycle"
|
|
10256
|
-
}
|
|
10257
|
-
}
|
|
10258
|
-
]
|
|
10259
|
-
}
|
|
10260
|
-
],
|
|
10261
|
-
"exports": [
|
|
10262
|
-
{
|
|
10263
|
-
"kind": "js",
|
|
10264
|
-
"name": "observe",
|
|
10265
|
-
"declaration": {
|
|
10266
|
-
"name": "observe",
|
|
10267
|
-
"module": "src/common/decorators/observe.ts"
|
|
10268
|
-
}
|
|
10269
|
-
}
|
|
10270
|
-
]
|
|
10271
|
-
},
|
|
10272
10237
|
{
|
|
10273
10238
|
"kind": "javascript-module",
|
|
10274
10239
|
"path": "src/common/controllers/DirectionController.ts",
|
|
@@ -11163,6 +11128,41 @@
|
|
|
11163
11128
|
}
|
|
11164
11129
|
]
|
|
11165
11130
|
},
|
|
11131
|
+
{
|
|
11132
|
+
"kind": "javascript-module",
|
|
11133
|
+
"path": "src/common/decorators/observe.ts",
|
|
11134
|
+
"declarations": [
|
|
11135
|
+
{
|
|
11136
|
+
"kind": "function",
|
|
11137
|
+
"name": "observe",
|
|
11138
|
+
"parameters": [
|
|
11139
|
+
{
|
|
11140
|
+
"name": "propertyName",
|
|
11141
|
+
"type": {
|
|
11142
|
+
"text": "string"
|
|
11143
|
+
}
|
|
11144
|
+
},
|
|
11145
|
+
{
|
|
11146
|
+
"name": "lifecycle",
|
|
11147
|
+
"default": "\"update\"",
|
|
11148
|
+
"type": {
|
|
11149
|
+
"text": "ObserveLifecycle"
|
|
11150
|
+
}
|
|
11151
|
+
}
|
|
11152
|
+
]
|
|
11153
|
+
}
|
|
11154
|
+
],
|
|
11155
|
+
"exports": [
|
|
11156
|
+
{
|
|
11157
|
+
"kind": "js",
|
|
11158
|
+
"name": "observe",
|
|
11159
|
+
"declaration": {
|
|
11160
|
+
"name": "observe",
|
|
11161
|
+
"module": "src/common/decorators/observe.ts"
|
|
11162
|
+
}
|
|
11163
|
+
}
|
|
11164
|
+
]
|
|
11165
|
+
},
|
|
11166
11166
|
{
|
|
11167
11167
|
"kind": "javascript-module",
|
|
11168
11168
|
"path": "src/common/directives/cond.ts",
|
package/lib/Button.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as t,n as o}from"./query-assigned-elements-ef860822.js";import{r as n,$ as e,w as r,s as a}from"./lit-element-e382250e.js";import{e as s}from"./property-03f59dce.js";import{e as i,n as l}from"./ref-adf41565.js";import{E as
|
|
1
|
+
import{_ as t,n as o}from"./query-assigned-elements-ef860822.js";import{r as n,$ as e,w as r,s as a}from"./lit-element-e382250e.js";import{e as s}from"./property-03f59dce.js";import{e as i,n as l}from"./ref-adf41565.js";import{E as b}from"./EventController-d99ebeef.js";import{L as d}from"./LightDomController-e0762f0d.js";import{c}from"./cond-ed8742b5.js";import{F as u}from"./FocusableMixin-4c85ced9.js";import{I as h}from"./InputMixin-84ca72ae.js";import{s as p}from"./Component-fa316972.js";import"./directive-de55b00a.js";const v=n`:host{display:inline-block}.n-button{-webkit-appearance:none;align-items:center;appearance:none;background:var(--n-button-background-color,var(--n-color-button));border-radius:var(--n-button-border-radius,var(--n-border-radius-s));border:1px var(--n-button-border-style,solid) var(--n-button-border-color,var(--n-color-border-strong));box-shadow:var(--n-button-box-shadow,var(--n-box-shadow));color:var(--n-button-color,var(--n-color-text));cursor:pointer;display:flex;gap:var(--n-button-gap,var(--n-space-s));font-family:var(--n-font-family);font-feature-settings:var(--n-font-features);font-size:var(--n-button-font-size,var(--n-font-size-m));font-weight:var(--n-button-font-weight,var(--n-font-weight));line-height:var(--n-line-height-form);margin:0;min-block-size:var(--n-button-min-height,var(--n-space-xl));padding:var(--n-button-padding-y,calc(var(--n-space-s)/ 1.6)) var(--n-button-padding-x,calc(var(--n-space-m)/ 1.2));text-align:var(--n-button-text-align,center);text-decoration:none;transition:all .1s ease;-webkit-user-select:none;user-select:none;position:relative;inline-size:var(--n-button-width,fit-content)}.n-button::after{content:"";position:absolute;background:0 0;background-image:var(--n-button-gradient,linear-gradient(to bottom,rgba(0,0,0,0) 50%,rgba(0,0,0,.013) 100%));background-repeat:repeat-x;inline-size:100%;inset-inline:0;block-size:100%;inset-block-start:0}:host([expand]){--n-button-width:100%;display:block}.n-content{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;position:relative}.n-button:hover{--n-button-background-color:var(--n-color-button-hover);--n-button-border-color:var(--n-color-border-hover)}.n-button:focus{--n-button-border-color:var(--n-color-accent);--n-button-border-style:solid;--n-button-box-shadow:0 0 0 1px var(--n-button-border-color);outline:0}.n-button:active{opacity:.8;transform:translateY(1px);transition:none}:host([variant=primary]){--n-button-background-color:var(--n-color-accent);--n-button-border-color:transparent;--n-button-box-shadow:none;--n-button-color:var(--n-color-text-on-accent);--n-button-font-weight:var(--n-font-weight-active)}:host([variant=primary]) .n-button:focus{--n-button-box-shadow:0 0 0 1px var(--n-color-surface),0 0 0 3px var(--n-button-border-color)}:host([variant=primary]) .n-button:hover{--n-button-border-color:transparent;--n-button-background-color:var(--n-color-accent);filter:brightness(93%)}:host([variant=dashed]){--n-button-color:var(--n-color-text-weaker);--n-button-border-color:var(--n-color-border-hover);--n-button-border-style:dashed;--n-button-box-shadow:none}:host([variant=dashed]) .n-button:hover{--n-button-color:var(--n-color-text)}:host([variant=dashed]) .n-button::after{display:none}:host([variant=plain]){--n-button-border-color:transparent;--n-button-box-shadow:none}:host([variant=plain]) .n-button:hover{--n-button-border-color:transparent}:host([variant=plain]) .n-button:focus{--n-button-box-shadow:0 0 0 1px var(--n-button-border-color)}:host([variant=plain]) .n-button::after{display:none}:host([variant=danger]){--n-button-border-color:var(--n-color-status-danger);--n-button-color:var(--n-color-text-error);--n-button-font-weight:var(--n-font-weight-active)}:host([variant=danger]) .n-button:hover{--n-button-border-color:var(--n-color-status-danger)}:host([variant=switch]){--n-button-border-color:transparent;--n-button-color:var(--n-color-text);--n-button-font-weight:var(--n-font-weight-heading);--n-button-box-shadow:none;--n-button-min-height:calc(var(--n-space-xxl) - 1px);--n-button-text-align:left;--n-button-font-size:var(--n-font-size-l);--n-button-border-radius:var(--n-border-radius-sharp);--n-button-background-color:transparent;--n-button-padding-x:var(--n-space-m);display:flex;align-items:center}:host([variant=switch]) .n-button *{pointer-events:none}:host([variant=switch]) .n-button::after{display:none}:host([variant=switch]) .n-button:hover,:host([variant=switch][aria-expanded=true]) .n-button{--n-button-border-color:transparent;--n-button-background-color:var(--n-color-nav-hover)}:host([variant=switch]) .n-button:focus{--n-button-box-shadow:inset 0 0 0 1px var(--n-button-border-color)}:host([disabled]){--n-button-background-color:var(--n-color-border);--n-button-box-shadow:none;--n-button-border-color:var(--n-button-background-color);--n-button-color:var(--n-color-text-weaker);opacity:.5;pointer-events:none}:host([disabled]) .n-button::after{display:none}:host([size="s"]){--n-button-font-size:var(--n-font-size-s);--n-button-min-height:var(--n-space-l);--n-button-padding-y:calc(var(--n-space-s) / 1.5);--n-button-padding-x:var(--n-space-s);--n-button-gap:calc(var(--n-space-s) / 2)}:host([size="s"]) .n-button{line-height:var(--n-line-height-tight)}:host([size="l"]){--n-button-border-radius:var(--n-border-radius);--n-button-font-size:var(--n-font-size-l);--n-button-min-height:calc(var(--n-space-xxl) - var(--n-space-l));--n-button-padding-x:calc(var(--n-space-l) / 1.3);--n-button-font-weight:var(--n-font-weight-active)}::slotted(*){color:inherit;pointer-events:none}::slotted(svg){color:var(--n-color-icon)}::slotted(button[slot=proxy]){display:none}`;let f=class extends(h(u(a))){constructor(){super(...arguments),this.buttonRef=i(),this.events=new b(this),this.lightDom=new d(this,{render:()=>this.renderLightDom()}),this.variant="default",this.type="submit",this.size="m",this.download=!1,this.target="_self",this.expand=!1,this.handleOuterClick=t=>{t.composedPath().some((t=>t===this.focusableRef.value||t===this.buttonRef.value))||t.stopPropagation()}}connectedCallback(){super.connectedCallback(),this.events.listen(this,"click",this.handleOuterClick,!0)}render(){const t=e`<slot name="start"></slot><div class="n-content"><slot></slot></div><slot name="end"></slot>`;return this.href?this.renderLink(t):this.renderButton(t)}renderLink(t){return e`<a ${l(this.focusableRef)} class="n-button" target="${this.target}" ?download="${this.download}" href="${c(this.disabled,r,this.href)}" tabindex="${c(this.disabled,"-1")}" aria-disabled="${c(this.disabled,"true")}" role="${c(this.disabled,"link")}">${t}</a>`}renderButton(t){return e`<slot name="proxy"></slot><button ${l(this.focusableRef)} class="n-button" ?disabled="${this.disabled}" name="${c(this.name)}" value="${c(this.value)}" @click="${this.handleClick}" aria-expanded="${c(this.accessibleExpanded)}" aria-haspopup="${c(this.accessibleHasPopup)}">${t}</button>`}renderLightDom(){return this.href||!this.form?r:e`<button ${l(this.buttonRef)} slot="proxy" name="${c(this.name)}" value="${c(this.value)}" ?disabled="${this.disabled}" type="${this.type}"></button>`}handleClick(t){this.buttonRef.value&&(t.stopPropagation(),this.buttonRef.value.click())}};f.styles=[p,v],t([s({reflect:!0})],f.prototype,"variant",void 0),t([s({reflect:!0})],f.prototype,"type",void 0),t([s({reflect:!0})],f.prototype,"size",void 0),t([s({attribute:"aria-expanded"})],f.prototype,"accessibleExpanded",void 0),t([s({attribute:"aria-haspopup"})],f.prototype,"accessibleHasPopup",void 0),t([s({reflect:!0})],f.prototype,"href",void 0),t([s({type:Boolean})],f.prototype,"download",void 0),t([s({reflect:!0})],f.prototype,"target",void 0),t([s({reflect:!0,type:Boolean})],f.prototype,"expand",void 0),f=t([o("nord-button")],f);var g=f;export{g as default};
|
|
2
2
|
//# sourceMappingURL=Button.js.map
|
package/lib/Button.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../src/button/Button.ts"],"sourcesContent":["import { LitElement, html, nothing, TemplateResult } from \"lit\"\nimport { customElement, property } from \"lit/decorators.js\"\nimport { createRef, ref } from \"lit/directives/ref.js\"\nimport { EventController } from \"../common/controllers/EventController.js\"\nimport { LightDomController } from \"../common/controllers/LightDomController.js\"\nimport { cond } from \"../common/directives/cond.js\"\n\nimport { FocusableMixin } from \"../common/mixins/FocusableMixin.js\"\nimport { InputMixin } from \"../common/mixins/InputMixin.js\"\nimport componentStyle from \"../common/styles/Component.css\"\nimport style from \"./Button.css\"\n\n/**\n * Buttons are used for interface actions. Primary style should be\n * used only once per section for main call-to-action, while other\n * styles can appear more frequently.\n *\n * @status ready\n * @category action\n * @slot - The button content\n * @slot start - Used to place content at the start of button text. Typically used for icons.\n * @slot end - Used to place content at the end of button text. Typically used for icons.\n */\n@customElement(\"nord-button\")\nexport default class Button extends InputMixin(FocusableMixin(LitElement)) {\n static styles = [componentStyle, style]\n\n private buttonRef = createRef<HTMLButtonElement>()\n private events = new EventController(this)\n private lightDom = new LightDomController(this, {\n render: () => this.renderLightDom(),\n })\n\n /**\n * The style variant of the button.\n */\n @property({ reflect: true }) variant: \"default\" | \"primary\" | \"dashed\" | \"plain\" | \"danger\" = \"default\"\n\n /**\n * The type of the button.\n */\n @property({ reflect: true }) type: \"button\" | \"submit\" | \"reset\" = \"submit\"\n\n /**\n * The size of the button.\n * This affects font-size and padding.\n */\n @property({ reflect: true }) size: \"s\" | \"m\" | \"l\" = \"m\"\n\n /**\n * @private\n * This does not need to be documented,\n * since it is only for forwarding the aria-expanded attribute\n * to the internal button element.\n */\n @property({ attribute: \"aria-expanded\" }) accessibleExpanded?: \"true\" | \"false\"\n\n /**\n * @private\n * This does not need to be documented,\n * since it is only for forwarding the aria-haspopup attribute\n * to the internal button element.\n */\n @property({ attribute: \"aria-haspopup\" }) accessibleHasPopup?:\n | \"false\"\n | \"true\"\n | \"menu\"\n | \"listbox\"\n | \"tree\"\n | \"grid\"\n | \"dialog\"\n\n /**\n * When provided, renders the button as a link,\n * with its href attribute set to the given value.\n */\n @property({ reflect: true }) href?: string\n\n /**\n * When provided together with a href property, the button will\n * trigger a file download instead of a page visit.\n */\n @property({ type: Boolean }) download = false\n\n /**\n * When provided together with a href property, determines where\n * to open the linked URL. The keywords have special meanings for\n * where to load the URL: “_self” means the current browsing context,\n * “_blank” usually a new tab but users can configure browsers this to\n * open a new window instead, “_parent” means the parent browsing\n * context of the current one, but if no parent exists, behaves as\n * _self, and finally “top” means the topmost browsing context.\n */\n @property({ reflect: true }) target: \"_self\" | \"_blank\" | \"_parent\" | \"_top\" = \"_self\"\n\n /**\n * Controls whether the button expands to fill the width of its container.\n */\n @property({ reflect: true, type: Boolean }) expand = false\n\n connectedCallback() {\n super.connectedCallback()\n this.events.listen(this, \"click\", this.handleOuterClick, true)\n }\n\n render() {\n const innards = html`\n <slot name=\"start\"></slot>\n <div class=\"n-content\">\n <slot></slot>\n </div>\n <slot name=\"end\"></slot>\n `\n\n return this.href ? this.renderLink(innards) : this.renderButton(innards)\n }\n\n /**\n * We jump through some hoops here to ensure the link is treated correctly when \"disabled\".\n * Links cannot be disabled natively, so we need to rely on some aria magic to get the correct semantics.\n * Along with the advice in the article below, we also set tabindex to \"-1\", so it is taken out of tab order.\n *\n * @see https://www.scottohara.me/blog/2021/05/28/disabled-links.html\n */\n private renderLink(innards: TemplateResult) {\n return html`\n <a\n ${ref(this.focusableRef)}\n class=\"n-button\"\n target=${this.target}\n ?download=${this.download}\n href=${cond(this.disabled, nothing, this.href)}\n tabindex=${cond(this.disabled, \"-1\")}\n aria-disabled=${cond(this.disabled, \"true\")}\n role=${cond(this.disabled, \"link\")}\n >${innards}\n </a>\n `\n }\n\n private renderButton(innards: TemplateResult) {\n return html`\n <slot name=\"proxy\"></slot>\n <button\n ${ref(this.focusableRef)}\n class=\"n-button\"\n ?disabled=${this.disabled}\n name=${cond(this.name)}\n value=${cond(this.value)}\n @click=${this.handleClick}\n aria-expanded=${cond(this.accessibleExpanded)}\n aria-haspopup=${cond(this.accessibleHasPopup)}\n >\n ${innards}\n </button>\n `\n }\n\n private renderLightDom() {\n if (this.href || !this.form) {\n return nothing\n }\n\n return html`\n <button\n ${ref(this.buttonRef)}\n slot=\"proxy\"\n name=${cond(this.name)}\n value=${cond(this.value)}\n ?disabled=${this.disabled}\n type=${this.type}\n ></button>\n `\n }\n\n private handleOuterClick = (e: MouseEvent) => {\n // we want to avoid emitting click events when a click\n // happens in blank space in the host, but not on the button\n // so we stop propagation of any events if click didn't happen on the internal or proxy button\n const isInternalButton = e\n .composedPath()\n .some(node => node === this.focusableRef.value || node === this.buttonRef.value)\n\n if (!isInternalButton) {\n e.stopPropagation()\n }\n }\n\n private handleClick(e: Event) {\n if (this.buttonRef.value) {\n // prevents two events: one from internal button, one from proxy button\n e.stopPropagation()\n this.buttonRef.value.click()\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"nord-button\": Button\n }\n}\n"],"names":["Button","InputMixin","FocusableMixin","LitElement","constructor","this","buttonRef","createRef","events","EventController","lightDom","LightDomController","render","renderLightDom","variant","type","size","download","target","expand","handleOuterClick","e","composedPath","some","node","focusableRef","value","stopPropagation","connectedCallback","super","listen","innards","html","href","renderLink","renderButton","ref","cond","disabled","nothing","name","handleClick","accessibleExpanded","accessibleHasPopup","form","click","styles","componentStyle","style","__decorate","property","reflect","prototype","attribute","Boolean","customElement"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../src/button/Button.ts"],"sourcesContent":["import { LitElement, html, nothing, TemplateResult } from \"lit\"\nimport { customElement, property } from \"lit/decorators.js\"\nimport { createRef, ref } from \"lit/directives/ref.js\"\nimport { EventController } from \"../common/controllers/EventController.js\"\nimport { LightDomController } from \"../common/controllers/LightDomController.js\"\nimport { cond } from \"../common/directives/cond.js\"\n\nimport { FocusableMixin } from \"../common/mixins/FocusableMixin.js\"\nimport { InputMixin } from \"../common/mixins/InputMixin.js\"\nimport componentStyle from \"../common/styles/Component.css\"\nimport style from \"./Button.css\"\n\n/**\n * Buttons are used for interface actions. Primary style should be\n * used only once per section for main call-to-action, while other\n * styles can appear more frequently.\n *\n * @status ready\n * @category action\n * @slot - The button content\n * @slot start - Used to place content at the start of button text. Typically used for icons.\n * @slot end - Used to place content at the end of button text. Typically used for icons.\n */\n@customElement(\"nord-button\")\nexport default class Button extends InputMixin(FocusableMixin(LitElement)) {\n static styles = [componentStyle, style]\n\n private buttonRef = createRef<HTMLButtonElement>()\n private events = new EventController(this)\n private lightDom = new LightDomController(this, {\n render: () => this.renderLightDom(),\n })\n\n /**\n * The style variant of the button.\n */\n @property({ reflect: true }) variant: \"default\" | \"primary\" | \"dashed\" | \"plain\" | \"danger\" | \"switch\" = \"default\"\n\n /**\n * The type of the button.\n */\n @property({ reflect: true }) type: \"button\" | \"submit\" | \"reset\" = \"submit\"\n\n /**\n * The size of the button.\n * This affects font-size and padding.\n */\n @property({ reflect: true }) size: \"s\" | \"m\" | \"l\" = \"m\"\n\n /**\n * @private\n * This does not need to be documented,\n * since it is only for forwarding the aria-expanded attribute\n * to the internal button element.\n */\n @property({ attribute: \"aria-expanded\" }) accessibleExpanded?: \"true\" | \"false\"\n\n /**\n * @private\n * This does not need to be documented,\n * since it is only for forwarding the aria-haspopup attribute\n * to the internal button element.\n */\n @property({ attribute: \"aria-haspopup\" }) accessibleHasPopup?:\n | \"false\"\n | \"true\"\n | \"menu\"\n | \"listbox\"\n | \"tree\"\n | \"grid\"\n | \"dialog\"\n\n /**\n * When provided, renders the button as a link,\n * with its href attribute set to the given value.\n */\n @property({ reflect: true }) href?: string\n\n /**\n * When provided together with a href property, the button will\n * trigger a file download instead of a page visit.\n */\n @property({ type: Boolean }) download = false\n\n /**\n * When provided together with a href property, determines where\n * to open the linked URL. The keywords have special meanings for\n * where to load the URL: “_self” means the current browsing context,\n * “_blank” usually a new tab but users can configure browsers this to\n * open a new window instead, “_parent” means the parent browsing\n * context of the current one, but if no parent exists, behaves as\n * _self, and finally “top” means the topmost browsing context.\n */\n @property({ reflect: true }) target: \"_self\" | \"_blank\" | \"_parent\" | \"_top\" = \"_self\"\n\n /**\n * Controls whether the button expands to fill the width of its container.\n */\n @property({ reflect: true, type: Boolean }) expand = false\n\n connectedCallback() {\n super.connectedCallback()\n this.events.listen(this, \"click\", this.handleOuterClick, true)\n }\n\n render() {\n const innards = html`\n <slot name=\"start\"></slot>\n <div class=\"n-content\">\n <slot></slot>\n </div>\n <slot name=\"end\"></slot>\n `\n\n return this.href ? this.renderLink(innards) : this.renderButton(innards)\n }\n\n /**\n * We jump through some hoops here to ensure the link is treated correctly when \"disabled\".\n * Links cannot be disabled natively, so we need to rely on some aria magic to get the correct semantics.\n * Along with the advice in the article below, we also set tabindex to \"-1\", so it is taken out of tab order.\n *\n * @see https://www.scottohara.me/blog/2021/05/28/disabled-links.html\n */\n private renderLink(innards: TemplateResult) {\n return html`\n <a\n ${ref(this.focusableRef)}\n class=\"n-button\"\n target=${this.target}\n ?download=${this.download}\n href=${cond(this.disabled, nothing, this.href)}\n tabindex=${cond(this.disabled, \"-1\")}\n aria-disabled=${cond(this.disabled, \"true\")}\n role=${cond(this.disabled, \"link\")}\n >${innards}\n </a>\n `\n }\n\n private renderButton(innards: TemplateResult) {\n return html`\n <slot name=\"proxy\"></slot>\n <button\n ${ref(this.focusableRef)}\n class=\"n-button\"\n ?disabled=${this.disabled}\n name=${cond(this.name)}\n value=${cond(this.value)}\n @click=${this.handleClick}\n aria-expanded=${cond(this.accessibleExpanded)}\n aria-haspopup=${cond(this.accessibleHasPopup)}\n >\n ${innards}\n </button>\n `\n }\n\n private renderLightDom() {\n if (this.href || !this.form) {\n return nothing\n }\n\n return html`\n <button\n ${ref(this.buttonRef)}\n slot=\"proxy\"\n name=${cond(this.name)}\n value=${cond(this.value)}\n ?disabled=${this.disabled}\n type=${this.type}\n ></button>\n `\n }\n\n private handleOuterClick = (e: MouseEvent) => {\n // we want to avoid emitting click events when a click\n // happens in blank space in the host, but not on the button\n // so we stop propagation of any events if click didn't happen on the internal or proxy button\n const isInternalButton = e\n .composedPath()\n .some(node => node === this.focusableRef.value || node === this.buttonRef.value)\n\n if (!isInternalButton) {\n e.stopPropagation()\n }\n }\n\n private handleClick(e: Event) {\n if (this.buttonRef.value) {\n // prevents two events: one from internal button, one from proxy button\n e.stopPropagation()\n this.buttonRef.value.click()\n }\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"nord-button\": Button\n }\n}\n"],"names":["Button","InputMixin","FocusableMixin","LitElement","constructor","this","buttonRef","createRef","events","EventController","lightDom","LightDomController","render","renderLightDom","variant","type","size","download","target","expand","handleOuterClick","e","composedPath","some","node","focusableRef","value","stopPropagation","connectedCallback","super","listen","innards","html","href","renderLink","renderButton","ref","cond","disabled","nothing","name","handleClick","accessibleExpanded","accessibleHasPopup","form","click","styles","componentStyle","style","__decorate","property","reflect","prototype","attribute","Boolean","customElement"],"mappings":"+iLAwBA,IAAqBA,EAArB,cAAoCC,EAAWC,EAAeC,KAA9DC,kCAGUC,KAASC,UAAGC,IACZF,KAAAG,OAAS,IAAIC,EAAgBJ,MAC7BA,KAAAK,SAAW,IAAIC,EAAmBN,KAAM,CAC9CO,OAAQ,IAAMP,KAAKQ,mBAMQR,KAAOS,QAAqE,UAK5ET,KAAIU,KAAkC,SAMtCV,KAAIW,KAAoB,IAmCxBX,KAAQY,UAAG,EAWXZ,KAAMa,OAA4C,QAKnCb,KAAMc,QAAG,EA6E7Cd,KAAAe,iBAAoBC,IAIDA,EACtBC,eACAC,MAAKC,GAAQA,IAASnB,KAAKoB,aAAaC,OAASF,IAASnB,KAAKC,UAAUoB,SAG1EL,EAAEM,mBApFNC,oBACEC,MAAMD,oBACNvB,KAAKG,OAAOsB,OAAOzB,KAAM,QAASA,KAAKe,kBAAkB,GAG3DR,SACE,MAAMmB,EAAUC,CAAI,+FAQpB,OAAO3B,KAAK4B,KAAO5B,KAAK6B,WAAWH,GAAW1B,KAAK8B,aAAaJ,GAU1DG,WAAWH,GACjB,OAAOC,CAAI,MAELI,EAAI/B,KAAKoB,0CAEFpB,KAAKa,sBACFb,KAAKY,mBACVoB,EAAKhC,KAAKiC,SAAUC,EAASlC,KAAK4B,oBAC9BI,EAAKhC,KAAKiC,SAAU,yBACfD,EAAKhC,KAAKiC,SAAU,kBAC7BD,EAAKhC,KAAKiC,SAAU,YACxBP,QAKDI,aAAaJ,GACnB,OAAOC,CAAI,qCAGLI,EAAI/B,KAAKoB,6CAECpB,KAAKiC,mBACVD,EAAKhC,KAAKmC,iBACTH,EAAKhC,KAAKqB,mBACTrB,KAAKoC,+BACEJ,EAAKhC,KAAKqC,uCACVL,EAAKhC,KAAKsC,wBAExBZ,aAKAlB,iBACN,OAAIR,KAAK4B,OAAS5B,KAAKuC,KACdL,EAGFP,CAAI,WAELI,EAAI/B,KAAKC,iCAEJ+B,EAAKhC,KAAKmC,iBACTH,EAAKhC,KAAKqB,sBACNrB,KAAKiC,mBACVjC,KAAKU,kBAkBV0B,YAAYpB,GACdhB,KAAKC,UAAUoB,QAEjBL,EAAEM,kBACFtB,KAAKC,UAAUoB,MAAMmB,WAvKlB7C,EAAA8C,OAAS,CAACC,EAAgBC,GAWJC,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAA6FnD,EAAAoD,UAAA,eAAA,GAKrFH,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAAsDnD,EAAAoD,UAAA,YAAA,GAM9CH,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAAmCnD,EAAAoD,UAAA,YAAA,GAQdH,EAAA,CAAzCC,EAAS,CAAEG,UAAW,mBAAwDrD,EAAAoD,UAAA,0BAAA,GAQrCH,EAAA,CAAzCC,EAAS,CAAEG,UAAW,mBAOXrD,EAAAoD,UAAA,0BAAA,GAMiBH,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAAqBnD,EAAAoD,UAAA,YAAA,GAMbH,EAAA,CAA5BC,EAAS,CAAEnC,KAAMuC,WAA2BtD,EAAAoD,UAAA,gBAAA,GAWhBH,EAAA,CAA5BC,EAAS,CAAEC,SAAS,KAAiEnD,EAAAoD,UAAA,cAAA,GAK1CH,EAAA,CAA3CC,EAAS,CAAEC,SAAS,EAAMpC,KAAMuC,WAAyBtD,EAAAoD,UAAA,cAAA,GA1EvCpD,EAAMiD,EAAA,CAD1BM,EAAc,gBACMvD,SAAAA"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{_ as e,n as t}from"./query-assigned-elements-ef860822.js";import{r as a,s as n,$ as o}from"./lit-element-e382250e.js";import{e as i}from"./property-03f59dce.js";import{t as s}from"./state-70f38ceb.js";import{i as r}from"./query-2d22378e.js";import{c as l}from"./repeat-ed796481.js";import{o as d}from"./tinykeys.module-84e6cc41.js";import"./Button.js";import"./VisuallyHidden.js";import c from"./Icon.js";import{E as h}from"./EventController-d99ebeef.js";import{D as u}from"./DirectionController-8b298382.js";import{LocalizeController as p}from"./LocalizeController.js";import{r as v}from"./number-c3ab3e95.js";import{i as m,p as f,a as g,s as y,e as b,b as x,g as w,c as D,d as z,f as k,h as F,j as M,k as S,l as Y}from"./dates-56f73760.js";import{o as $}from"./observe-a9c6dfb6.js";import{monthView as j}from"./month-view.js";import{DateSelectEvent as C}from"./DateSelectEvent.js";import{s as L}from"./Component-fa316972.js";var N=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M105 57.4 47.6 2.8a10.566 10.566 0 1 0-14.56 15.316l51.968 49.35a3.486 3.486 0 0 1 0 5.068l-51.968 49.35a10.502 10.502 0 0 0 14.462 15.232l57.638-54.74A17.584 17.584 0 0 0 105 57.4z"/></svg>',title:"arrow-right-small",tags:"nordicon arrow right small caret pointing triangle chevron"});var T=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M99.736 140a10.486 10.486 0 0 1-7.238-2.884L35 82.6a17.598 17.598 0 0 1-.14-24.976l57.638-54.74a10.502 10.502 0 1 1 14.462 15.232l-51.968 49.35a3.486 3.486 0 0 0 0 5.068l51.968 49.35A10.5 10.5 0 0 1 99.736 140z"/></svg>',title:"arrow-left-small",tags:"nordicon arrow left small caret pointing triangle chevron"});var O=Object.freeze({__proto__:null,default:'<svg viewBox="0 0 140 140" xmlns="http://www.w3.org/2000/svg"><path fill="currentColor" d="M70 110.236a17.332 17.332 0 0 1-12.306-5.096L2.884 47.502A10.502 10.502 0 1 1 18.116 33.04l49.35 51.968a3.486 3.486 0 0 0 5.068 0l49.35-51.968a10.502 10.502 0 1 1 15.232 14.462L82.6 105a17.766 17.766 0 0 1-12.6 5.236z"/></svg>',title:"arrow-down-small",tags:"nordicon arrow down small caret pointing triangle chevron"});const _=e=>e.preventDefault();class I{constructor(e,t){this.hadFirstUpdate=!1,this.initialTouchX=0,this.initialTouchY=0,this.handleTouchStart=e=>{const[{pageX:t,pageY:a}]=e.changedTouches;this.initialTouchX=t,this.initialTouchY=a},this.handleTouchEnd=e=>{const[{pageX:t,pageY:a}]=e.changedTouches,{matchesGesture:n,onSwipeEnd:o}=this.options,i=t-this.initialTouchX,s=a-this.initialTouchY,r={initialX:this.initialTouchX,initialY:this.initialTouchY,pageX:t,pageY:a,distX:i,distY:s};n(r)&&(e.preventDefault(),o(r))},e.addController(this),this.events=new h(e),this.options={target:()=>e,...t}}hostUpdated(){if(!this.hadFirstUpdate){this.hadFirstUpdate=!0;const e=this.options.target();this.events.listen(e,"touchstart",this.handleTouchStart),this.events.listen(e,"touchmove",_),this.events.listen(e,"touchend",this.handleTouchEnd)}}hostDisconnected(){this.hadFirstUpdate=!1}}const X=({distX:e,distY:t})=>Math.abs(e)>=70&&Math.abs(t)<=70,A=({distX:e,distY:t})=>Math.abs(t)>=70&&Math.abs(e)<=70&&t>0,E=a`:host{font-feature-settings:var(--n-font-features-reduced)}.n-calendar{-webkit-user-select:none;user-select:none;background:var(--n-color-surface);box-shadow:var(--n-calendar-box-shadow,var(--n-box-shadow-popout));border-radius:var(--n-border-radius-s);max-inline-size:310px;min-inline-size:290px;padding:var(--n-calendar-padding,16px 16px 20px)}:host([expand]) .n-calendar{max-inline-size:100%;inline-size:100%}@media (max-width:35.9375em){.n-calendar{max-inline-size:100%}}.n-calendar-table{border-collapse:collapse;border-spacing:0;color:var(--n-color-text);font-size:var(--n-font-size-m);font-weight:var(--n-font-weight);line-height:var(--n-date-picker-line-height);text-align:center;inline-size:100%}.n-calendar-table-header{font-size:var(--n-font-size-s);font-weight:var(--n-font-weight-active);letter-spacing:1px;line-height:var(--n-date-picker-line-height);padding-block-end:8px;text-decoration:none;text-transform:uppercase}.n-calendar-cell{text-align:center}.n-calendar-day{-moz-appearance:none;-webkit-appearance:none;appearance:none;background:0 0;border:0;border-radius:var(--n-border-radius-s);color:var(--n-color-text);cursor:pointer;display:inline-block;font-family:var(--n-font-family);font-size:var(--n-font-size-m);font-variant-numeric:tabular-nums;font-weight:var(--n-font-weight);block-size:36px;padding:0 0 1px;position:relative;text-align:center;vertical-align:middle;inline-size:36px;z-index:1}.n-calendar-day[aria-current=date]{box-shadow:0 0 0 1px var(--n-color-accent);color:var(--n-color-text-link);position:relative;z-index:200}.n-calendar-day:hover{background:var(--n-color-active)}.n-calendar-day:focus,.n-calendar-day[aria-pressed=true]{background:var(--n-color-accent);box-shadow:none;color:var(--n-color-text-on-accent);outline:0}.n-calendar-day:active{background:var(--n-color-accent);box-shadow:none!important;color:var(--n-color-text-on-accent);z-index:200}.n-calendar-day:focus{box-shadow:0 0 5px var(--n-color-accent);z-index:200}.n-calendar-day:not(.is-month){box-shadow:none}.n-calendar-day:not(.is-month),.n-calendar-day[aria-disabled=true]{background:0 0;color:var(--n-color-text-weakest);cursor:default}.n-calendar-day[aria-disabled=true]{color:var(--n-color-text-weaker);text-decoration:line-through}.n-calendar-day:not(.is-month)[aria-disabled=true]{color:var(--n-color-text-weakest);text-decoration:none}.n-calendar-day[aria-disabled=true][aria-current=date]{box-shadow:0 0 0 1px var(--n-color-accent);color:var(--n-color-text-link)}.n-calendar-day[aria-disabled=true][aria-current=date]:focus{box-shadow:0 0 5px var(--n-color-accent);background:var(--n-color-accent);color:var(--n-color-text-on-accent)}.n-calendar-day[aria-disabled=true]:not([aria-current=date])::before{display:none}.n-calendar-day.is-outside{background:0 0;box-shadow:none;color:var(--n-color-text-weakest);cursor:default;pointer-events:none}.n-calendar-day.is-outside::before{display:none}.n-calendar-header{align-items:start;display:flex;justify-content:space-between;margin-block-end:16px;inline-size:100%}.n-calendar-nav{white-space:nowrap}.n-calendar-nav nord-button{--n-button-padding-x:11px;margin-inline-start:calc(var(--n-space-s)/ 2)}.n-calendar-select{display:inline-flex;margin-block-start:4px;position:relative;line-height:var(--n-line-height)}.n-calendar-select span{margin-inline-end:var(--n-space-s)}.n-calendar-select select{cursor:pointer;font-size:var(--n-font-size-l);block-size:100%;inset-inline-start:0;opacity:0;position:absolute;inset-block-start:0;inline-size:100%;z-index:2}.n-calendar-select select:focus+.n-calendar-select-label{box-shadow:0 0 0 2px var(--n-color-accent)}.n-calendar-select-label{align-items:center;border-radius:var(--n-border-radius-s);color:var(--n-color-text);display:flex;font-size:var(--n-font-size-xl);font-weight:var(--n-font-weight-active);line-height:var(--n-date-picker-line-height);padding:0 4px 0 8px;pointer-events:none;position:relative;inline-size:100%;z-index:1;text-transform:capitalize}`;c.registerIcon(N),c.registerIcon(T),c.registerIcon(O);const W=e=>t=>{t.preventDefault(),e(t)},U=()=>!1;let B=class extends n{constructor(){super(...arguments),this.dialogLabelId="dialog-header",this.direction=new u(this),this.swipe=new I(this,{matchesGesture:X,onSwipeEnd:({distX:e})=>this.addMonths(e<0?1:-1)}),this.shortcuts=d({ArrowRight:W((()=>this.addDays(this.direction.isLTR?1:-1))),ArrowLeft:W((()=>this.addDays(this.direction.isLTR?-1:1))),ArrowDown:W((()=>this.addDays(7))),ArrowUp:W((()=>this.addDays(-7))),Home:W((()=>this.startOfWeek())),End:W((()=>this.endOfWeek())),PageUp:W((()=>this.addMonths(-1))),PageDown:W((()=>this.addMonths(1))),"Shift+PageUp":W((()=>this.addYears(-1))),"Shift+PageDown":W((()=>this.addYears(1)))}),this.localize=new p(this,{onLangChange:()=>this.handleLangChange()}),this.value="",this.firstDayOfWeek=1,this.min="",this.max="",this.expand=!1,this.isDateDisabled=U,this.activeFocus=!1,this.focusedDay=new Date,this.handleDaySelect=e=>{const t=m(e,f(this.min),f(this.max)),a=!this.isDateDisabled(e);t&&a&&(this.value=g(e),this.dispatchEvent(new C("change",e)))},this.handleMonthSelect=e=>{this.setMonth(parseInt(e.target.value,10))},this.handleYearSelect=e=>{this.setYear(parseInt(e.target.value,10))},this.handleNextMonthClick=e=>{e.preventDefault(),this.addMonths(1)},this.handlePreviousMonthClick=e=>{e.preventDefault(),this.addMonths(-1)},this.enableActiveFocus=()=>{this.activeFocus=!0},this.disableActiveFocus=()=>{this.activeFocus=!1}}focus(e){var t;const a=null!==(t=null==e?void 0:e.target)&&void 0!==t?t:"day";"day"===a?this.focusedDayNode.focus():"month"===a&&this.monthSelectNode.focus()}render(){const e=f(this.value),t=this.focusedDay.getMonth(),a=this.focusedDay.getFullYear(),n=f(this.min),i=f(this.max),s=n?y(n):void 0,r=i?b(i):void 0,d=(e||this.focusedDay).getFullYear(),c=n?n.getFullYear():d-10,h=i?i.getFullYear():d+10;return o`<div class="n-calendar"><div class="n-calendar-header"><div><nord-visually-hidden><h2 id="${this.dialogLabelId}" aria-live="polite" aria-atomic="true">${this.monthNames[t]}, ${this.focusedDay.getFullYear()}</h2></nord-visually-hidden><div class="n-calendar-select"><select aria-label="${this.localize.term("monthSelectLabel")}" class="n-calendar-select-month" @input="${this.handleMonthSelect}">${this.monthNames.map(((e,n)=>o`<option value="${n}" ?selected="${n===t}" ?disabled="${!m(new Date(a,n,1),s,r)}">${e}</option>`))}</select><div class="n-calendar-select-label" aria-hidden="true"><span>${this.monthNamesShort[t]}</span><nord-icon color="var(--n-color-icon)" name="arrow-down-small" size="xs"></nord-icon></div></div><div class="n-calendar-select"><select aria-label="${this.localize.term("yearSelectLabel")}" class="n-calendar-select-year" @input="${this.handleYearSelect}">${l(v(c,h),(e=>e),(e=>o`<option ?selected="${e===a}">${e}</option>`))}</select><div class="n-calendar-select-label" aria-hidden="true"><span>${this.focusedDay.getFullYear()}</span><nord-icon color="var(--n-color-icon)" name="arrow-down-small" size="xs"></nord-icon></div></div></div><div class="n-calendar-nav"><nord-button class="n-calendar-prev" @click="${this.handlePreviousMonthClick}" ?disabled="${x(n,this.focusedDay)}" type="button"><nord-visually-hidden>${this.localize.term("prevMonthLabel")}</nord-visually-hidden><nord-icon color="var(--n-color-icon)" name="${this.direction.isLTR?"arrow-left-small":"arrow-right-small"}" size="s"></nord-icon></nord-button><nord-button class="n-calendar-next" @click="${this.handleNextMonthClick}" ?disabled="${x(i,this.focusedDay)}" type="button"><nord-visually-hidden>${this.localize.term("nextMonthLabel")}</nord-visually-hidden><nord-icon color="var(--n-color-icon)" name="${this.direction.isLTR?"arrow-right-small":"arrow-left-small"}" size="s"></nord-icon></nord-button></div></div>${j({onFocusOut:this.disableActiveFocus,onFocusIn:this.enableActiveFocus,dateFormatter:this.dateFormatShort,selectedDate:e,focusedDate:this.focusedDay,onDateSelect:this.handleDaySelect,onKeyboardNavigation:this.shortcuts,labelledById:this.dialogLabelId,dayNames:this.dayNames,dayNamesShort:this.dayNamesShort,firstDayOfWeek:this.firstDayOfWeek,min:n,max:i,isDateDisabled:this.isDateDisabled})}</div>`}handleValueChange(){this.setFocusedDay(f(this.value)||new Date)}handleFocusedDayChange(){this.activeFocus&&this.focusedDayNode.focus()}handleLangChange(){const e=this.localize.resolvedLang;this.dateFormatShort=new Intl.DateTimeFormat(e,{day:"numeric",month:"long"}),this.monthNames=w(e,"long"),this.monthNamesShort=w(e,"short"),this.dayNames=D(e,"long"),this.dayNamesShort=D(e,"narrow")}addDays(e){this.setFocusedDay(z(this.focusedDay,e))}addMonths(e){this.setMonth(this.focusedDay.getMonth()+e)}addYears(e){this.setYear(this.focusedDay.getFullYear()+e)}startOfWeek(){this.setFocusedDay(k(this.focusedDay,this.firstDayOfWeek))}endOfWeek(){this.setFocusedDay(F(this.focusedDay,this.firstDayOfWeek))}setMonth(e){const t=M(y(this.focusedDay),e),a=b(t),n=M(this.focusedDay,e);this.setFocusedDay(S(n,t,a))}setYear(e){const t=Y(y(this.focusedDay),e),a=b(t),n=Y(this.focusedDay,e);this.setFocusedDay(S(n,t,a))}setFocusedDay(e){this.focusedDay=S(e,f(this.min),f(this.max)),this.dispatchEvent(new C("nord-focus-date",this.focusedDay))}};B.styles=[L,E],e([r(".n-calendar-select-month",!0)],B.prototype,"monthSelectNode",void 0),e([r('button[tabindex="0"]')],B.prototype,"focusedDayNode",void 0),e([i()],B.prototype,"value",void 0),e([i({type:Number})],B.prototype,"firstDayOfWeek",void 0),e([i()],B.prototype,"min",void 0),e([i()],B.prototype,"max",void 0),e([i({reflect:!0,type:Boolean})],B.prototype,"expand",void 0),e([i({attribute:!1})],B.prototype,"isDateDisabled",void 0),e([s()],B.prototype,"activeFocus",void 0),e([s()],B.prototype,"focusedDay",void 0),e([$("value")],B.prototype,"handleValueChange",null),e([$("focusedDay","updated")],B.prototype,"handleFocusedDayChange",null),B=e([t("nord-calendar")],B);var P=B;export{P as C,I as S,A as i};
|
|
2
|
-
//# sourceMappingURL=Calendar-
|
|
2
|
+
//# sourceMappingURL=Calendar-a389d216.js.map
|