@nordhealth/components 1.0.0-beta.20 → 1.0.0-beta.21
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 +252 -252
- package/lib/Button.js +1 -1
- package/lib/Button.js.map +1 -1
- package/lib/{Calendar-582091ef.js → Calendar-600fd148.js} +1 -1
- package/lib/{Calendar-582091ef.js.map → Calendar-600fd148.js.map} +1 -1
- package/lib/Calendar.js +1 -1
- package/lib/DatePicker.js +1 -1
- package/lib/Input.js +1 -1
- package/lib/Input.js.map +1 -1
- package/lib/Select.js +1 -1
- package/lib/Select.js.map +1 -1
- package/lib/bundle.js +5 -5
- package/lib/bundle.js.map +1 -1
- package/lib/index.js +1 -1
- package/lib/src/button/Button.d.ts +2 -2
- package/lib/src/input/Input.d.ts +2 -2
- package/package.json +3 -3
package/custom-elements.json
CHANGED
|
@@ -897,6 +897,74 @@
|
|
|
897
897
|
],
|
|
898
898
|
"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"
|
|
899
899
|
},
|
|
900
|
+
{
|
|
901
|
+
"kind": "javascript-module",
|
|
902
|
+
"path": "src/banner/Banner.ts",
|
|
903
|
+
"declarations": [
|
|
904
|
+
{
|
|
905
|
+
"kind": "class",
|
|
906
|
+
"description": "Banner informs users about important changes or conditions in the\ninterface. Use this component if you need to communicate to users\nin a prominent way.",
|
|
907
|
+
"name": "Banner",
|
|
908
|
+
"slots": [
|
|
909
|
+
{
|
|
910
|
+
"description": "default slot",
|
|
911
|
+
"name": ""
|
|
912
|
+
}
|
|
913
|
+
],
|
|
914
|
+
"members": [
|
|
915
|
+
{
|
|
916
|
+
"kind": "field",
|
|
917
|
+
"name": "variant",
|
|
918
|
+
"type": {
|
|
919
|
+
"text": "\"info\" | \"danger\" | \"success\" | \"warning\""
|
|
920
|
+
},
|
|
921
|
+
"default": "\"info\"",
|
|
922
|
+
"description": "The style variant of the banner.",
|
|
923
|
+
"attribute": "variant",
|
|
924
|
+
"reflects": true
|
|
925
|
+
}
|
|
926
|
+
],
|
|
927
|
+
"attributes": [
|
|
928
|
+
{
|
|
929
|
+
"name": "variant",
|
|
930
|
+
"type": {
|
|
931
|
+
"text": "\"info\" | \"danger\" | \"success\" | \"warning\""
|
|
932
|
+
},
|
|
933
|
+
"default": "\"info\"",
|
|
934
|
+
"description": "The style variant of the banner.",
|
|
935
|
+
"fieldName": "variant"
|
|
936
|
+
}
|
|
937
|
+
],
|
|
938
|
+
"superclass": {
|
|
939
|
+
"name": "LitElement",
|
|
940
|
+
"package": "lit"
|
|
941
|
+
},
|
|
942
|
+
"status": "new",
|
|
943
|
+
"category": "feedback",
|
|
944
|
+
"tagName": "nord-banner",
|
|
945
|
+
"customElement": true
|
|
946
|
+
}
|
|
947
|
+
],
|
|
948
|
+
"exports": [
|
|
949
|
+
{
|
|
950
|
+
"kind": "js",
|
|
951
|
+
"name": "default",
|
|
952
|
+
"declaration": {
|
|
953
|
+
"name": "Banner",
|
|
954
|
+
"module": "src/banner/Banner.ts"
|
|
955
|
+
}
|
|
956
|
+
},
|
|
957
|
+
{
|
|
958
|
+
"kind": "custom-element-definition",
|
|
959
|
+
"name": "nord-banner",
|
|
960
|
+
"declaration": {
|
|
961
|
+
"name": "Banner",
|
|
962
|
+
"module": "src/banner/Banner.ts"
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
],
|
|
966
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use this component if you need to communicate in a prominent way.\n- Place banner at the top of the section it applies to.\n- Use for highlighting errors and success statuses.\n- Put banner close to the context it’s referring to.\n- Move focus to the banner if it’s relevant to the current workflow.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Move focus to banner if it appears on page load.\n- Use for highlighting general content or as a banner.\n- Use to replace an error page.\n\n</div>\n\n---\n\n## Content guidelines\n\nBanner content should be clear, accurate and easy to understand:\n\n<div class=\"n-usage n-usage-do\">We’re experiencing an incident. Please see our status page for more details.</div>\n<div class=\"n-usage n-usage-dont\">There was an error.</div>\n\nWhen writing banner content, always write it 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\">We’re experiencing an incident.</div>\n<div class=\"n-usage n-usage-dont\">We’re Experiencing An Incident.</div>\n\nAlways end in punctuation:\n\n<div class=\"n-usage n-usage-do\">We’re experiencing an incident.</div>\n<div class=\"n-usage n-usage-dont\">We’re experiencing an incident</div>\n"
|
|
967
|
+
},
|
|
900
968
|
{
|
|
901
969
|
"kind": "javascript-module",
|
|
902
970
|
"path": "src/button/Button.ts",
|
|
@@ -911,12 +979,12 @@
|
|
|
911
979
|
"name": ""
|
|
912
980
|
},
|
|
913
981
|
{
|
|
914
|
-
"description": "Used to place content
|
|
915
|
-
"name": "
|
|
982
|
+
"description": "Used to place content at the start of button text. Typically used for icons.",
|
|
983
|
+
"name": "start"
|
|
916
984
|
},
|
|
917
985
|
{
|
|
918
|
-
"description": "Used to place content
|
|
919
|
-
"name": "
|
|
986
|
+
"description": "Used to place content at the end of button text. Typically used for icons.",
|
|
987
|
+
"name": "end"
|
|
920
988
|
}
|
|
921
989
|
],
|
|
922
990
|
"members": [
|
|
@@ -1297,74 +1365,6 @@
|
|
|
1297
1365
|
],
|
|
1298
1366
|
"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"
|
|
1299
1367
|
},
|
|
1300
|
-
{
|
|
1301
|
-
"kind": "javascript-module",
|
|
1302
|
-
"path": "src/banner/Banner.ts",
|
|
1303
|
-
"declarations": [
|
|
1304
|
-
{
|
|
1305
|
-
"kind": "class",
|
|
1306
|
-
"description": "Banner informs users about important changes or conditions in the\ninterface. Use this component if you need to communicate to users\nin a prominent way.",
|
|
1307
|
-
"name": "Banner",
|
|
1308
|
-
"slots": [
|
|
1309
|
-
{
|
|
1310
|
-
"description": "default slot",
|
|
1311
|
-
"name": ""
|
|
1312
|
-
}
|
|
1313
|
-
],
|
|
1314
|
-
"members": [
|
|
1315
|
-
{
|
|
1316
|
-
"kind": "field",
|
|
1317
|
-
"name": "variant",
|
|
1318
|
-
"type": {
|
|
1319
|
-
"text": "\"info\" | \"danger\" | \"success\" | \"warning\""
|
|
1320
|
-
},
|
|
1321
|
-
"default": "\"info\"",
|
|
1322
|
-
"description": "The style variant of the banner.",
|
|
1323
|
-
"attribute": "variant",
|
|
1324
|
-
"reflects": true
|
|
1325
|
-
}
|
|
1326
|
-
],
|
|
1327
|
-
"attributes": [
|
|
1328
|
-
{
|
|
1329
|
-
"name": "variant",
|
|
1330
|
-
"type": {
|
|
1331
|
-
"text": "\"info\" | \"danger\" | \"success\" | \"warning\""
|
|
1332
|
-
},
|
|
1333
|
-
"default": "\"info\"",
|
|
1334
|
-
"description": "The style variant of the banner.",
|
|
1335
|
-
"fieldName": "variant"
|
|
1336
|
-
}
|
|
1337
|
-
],
|
|
1338
|
-
"superclass": {
|
|
1339
|
-
"name": "LitElement",
|
|
1340
|
-
"package": "lit"
|
|
1341
|
-
},
|
|
1342
|
-
"status": "new",
|
|
1343
|
-
"category": "feedback",
|
|
1344
|
-
"tagName": "nord-banner",
|
|
1345
|
-
"customElement": true
|
|
1346
|
-
}
|
|
1347
|
-
],
|
|
1348
|
-
"exports": [
|
|
1349
|
-
{
|
|
1350
|
-
"kind": "js",
|
|
1351
|
-
"name": "default",
|
|
1352
|
-
"declaration": {
|
|
1353
|
-
"name": "Banner",
|
|
1354
|
-
"module": "src/banner/Banner.ts"
|
|
1355
|
-
}
|
|
1356
|
-
},
|
|
1357
|
-
{
|
|
1358
|
-
"kind": "custom-element-definition",
|
|
1359
|
-
"name": "nord-banner",
|
|
1360
|
-
"declaration": {
|
|
1361
|
-
"name": "Banner",
|
|
1362
|
-
"module": "src/banner/Banner.ts"
|
|
1363
|
-
}
|
|
1364
|
-
}
|
|
1365
|
-
],
|
|
1366
|
-
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use this component if you need to communicate in a prominent way.\n- Place banner at the top of the section it applies to.\n- Use for highlighting errors and success statuses.\n- Put banner close to the context it’s referring to.\n- Move focus to the banner if it’s relevant to the current workflow.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Move focus to banner if it appears on page load.\n- Use for highlighting general content or as a banner.\n- Use to replace an error page.\n\n</div>\n\n---\n\n## Content guidelines\n\nBanner content should be clear, accurate and easy to understand:\n\n<div class=\"n-usage n-usage-do\">We’re experiencing an incident. Please see our status page for more details.</div>\n<div class=\"n-usage n-usage-dont\">There was an error.</div>\n\nWhen writing banner content, always write it 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\">We’re experiencing an incident.</div>\n<div class=\"n-usage n-usage-dont\">We’re Experiencing An Incident.</div>\n\nAlways end in punctuation:\n\n<div class=\"n-usage n-usage-do\">We’re experiencing an incident.</div>\n<div class=\"n-usage n-usage-dont\">We’re experiencing an incident</div>\n"
|
|
1367
|
-
},
|
|
1368
1368
|
{
|
|
1369
1369
|
"kind": "javascript-module",
|
|
1370
1370
|
"path": "src/card/Card.ts",
|
|
@@ -5018,16 +5018,16 @@
|
|
|
5018
5018
|
"name": "error"
|
|
5019
5019
|
},
|
|
5020
5020
|
{
|
|
5021
|
-
"description": "Optional slot
|
|
5022
|
-
"name": "
|
|
5021
|
+
"description": "Optional slot used to place an icon at the start of the input.",
|
|
5022
|
+
"name": "start"
|
|
5023
5023
|
}
|
|
5024
5024
|
],
|
|
5025
5025
|
"members": [
|
|
5026
5026
|
{
|
|
5027
5027
|
"kind": "field",
|
|
5028
|
-
"name": "
|
|
5028
|
+
"name": "startSlot",
|
|
5029
5029
|
"privacy": "private",
|
|
5030
|
-
"default": "new SlotController(this, \"
|
|
5030
|
+
"default": "new SlotController(this, \"start\")"
|
|
5031
5031
|
},
|
|
5032
5032
|
{
|
|
5033
5033
|
"kind": "field",
|
|
@@ -8731,182 +8731,6 @@
|
|
|
8731
8731
|
],
|
|
8732
8732
|
"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"
|
|
8733
8733
|
},
|
|
8734
|
-
{
|
|
8735
|
-
"kind": "javascript-module",
|
|
8736
|
-
"path": "src/common/directives/cond.ts",
|
|
8737
|
-
"declarations": [
|
|
8738
|
-
{
|
|
8739
|
-
"kind": "variable",
|
|
8740
|
-
"name": "cond"
|
|
8741
|
-
}
|
|
8742
|
-
],
|
|
8743
|
-
"exports": [
|
|
8744
|
-
{
|
|
8745
|
-
"kind": "js",
|
|
8746
|
-
"name": "cond",
|
|
8747
|
-
"declaration": {
|
|
8748
|
-
"name": "cond",
|
|
8749
|
-
"module": "src/common/directives/cond.ts"
|
|
8750
|
-
}
|
|
8751
|
-
}
|
|
8752
|
-
]
|
|
8753
|
-
},
|
|
8754
|
-
{
|
|
8755
|
-
"kind": "javascript-module",
|
|
8756
|
-
"path": "src/common/directives/wrapIf.ts",
|
|
8757
|
-
"declarations": [
|
|
8758
|
-
{
|
|
8759
|
-
"kind": "function",
|
|
8760
|
-
"name": "wrapIf",
|
|
8761
|
-
"return": {
|
|
8762
|
-
"type": {
|
|
8763
|
-
"text": "TInner"
|
|
8764
|
-
}
|
|
8765
|
-
},
|
|
8766
|
-
"parameters": [
|
|
8767
|
-
{
|
|
8768
|
-
"name": "condition",
|
|
8769
|
-
"type": {
|
|
8770
|
-
"text": "false"
|
|
8771
|
-
}
|
|
8772
|
-
},
|
|
8773
|
-
{
|
|
8774
|
-
"name": "inner",
|
|
8775
|
-
"type": {
|
|
8776
|
-
"text": "() => TInner"
|
|
8777
|
-
}
|
|
8778
|
-
},
|
|
8779
|
-
{
|
|
8780
|
-
"name": "wrapper",
|
|
8781
|
-
"type": {
|
|
8782
|
-
"text": "(inner: TInner) => TWrapper"
|
|
8783
|
-
}
|
|
8784
|
-
}
|
|
8785
|
-
]
|
|
8786
|
-
},
|
|
8787
|
-
{
|
|
8788
|
-
"kind": "function",
|
|
8789
|
-
"name": "wrapIf",
|
|
8790
|
-
"return": {
|
|
8791
|
-
"type": {
|
|
8792
|
-
"text": "TWrapper"
|
|
8793
|
-
}
|
|
8794
|
-
},
|
|
8795
|
-
"parameters": [
|
|
8796
|
-
{
|
|
8797
|
-
"name": "condition",
|
|
8798
|
-
"type": {
|
|
8799
|
-
"text": "true"
|
|
8800
|
-
}
|
|
8801
|
-
},
|
|
8802
|
-
{
|
|
8803
|
-
"name": "inner",
|
|
8804
|
-
"type": {
|
|
8805
|
-
"text": "() => TInner"
|
|
8806
|
-
}
|
|
8807
|
-
},
|
|
8808
|
-
{
|
|
8809
|
-
"name": "wrapper",
|
|
8810
|
-
"type": {
|
|
8811
|
-
"text": "(inner: TInner) => TWrapper"
|
|
8812
|
-
}
|
|
8813
|
-
}
|
|
8814
|
-
]
|
|
8815
|
-
},
|
|
8816
|
-
{
|
|
8817
|
-
"kind": "function",
|
|
8818
|
-
"name": "wrapIf",
|
|
8819
|
-
"return": {
|
|
8820
|
-
"type": {
|
|
8821
|
-
"text": "TInner | TWrapper"
|
|
8822
|
-
}
|
|
8823
|
-
},
|
|
8824
|
-
"parameters": [
|
|
8825
|
-
{
|
|
8826
|
-
"name": "condition",
|
|
8827
|
-
"type": {
|
|
8828
|
-
"text": "unknown"
|
|
8829
|
-
}
|
|
8830
|
-
},
|
|
8831
|
-
{
|
|
8832
|
-
"name": "inner",
|
|
8833
|
-
"type": {
|
|
8834
|
-
"text": "() => TInner"
|
|
8835
|
-
}
|
|
8836
|
-
},
|
|
8837
|
-
{
|
|
8838
|
-
"name": "wrapper",
|
|
8839
|
-
"type": {
|
|
8840
|
-
"text": "(inner: TInner) => TWrapper"
|
|
8841
|
-
}
|
|
8842
|
-
}
|
|
8843
|
-
]
|
|
8844
|
-
},
|
|
8845
|
-
{
|
|
8846
|
-
"kind": "function",
|
|
8847
|
-
"name": "wrapIf",
|
|
8848
|
-
"parameters": [
|
|
8849
|
-
{
|
|
8850
|
-
"name": "condition",
|
|
8851
|
-
"type": {
|
|
8852
|
-
"text": "any"
|
|
8853
|
-
}
|
|
8854
|
-
},
|
|
8855
|
-
{
|
|
8856
|
-
"name": "inner",
|
|
8857
|
-
"type": {
|
|
8858
|
-
"text": "() => TInner"
|
|
8859
|
-
}
|
|
8860
|
-
},
|
|
8861
|
-
{
|
|
8862
|
-
"name": "wrapper",
|
|
8863
|
-
"type": {
|
|
8864
|
-
"text": "(innards: TInner) => TWrapper"
|
|
8865
|
-
}
|
|
8866
|
-
}
|
|
8867
|
-
],
|
|
8868
|
-
"return": {
|
|
8869
|
-
"type": {
|
|
8870
|
-
"text": ""
|
|
8871
|
-
}
|
|
8872
|
-
}
|
|
8873
|
-
}
|
|
8874
|
-
],
|
|
8875
|
-
"exports": [
|
|
8876
|
-
{
|
|
8877
|
-
"kind": "js",
|
|
8878
|
-
"name": "wrapIf",
|
|
8879
|
-
"declaration": {
|
|
8880
|
-
"name": "wrapIf",
|
|
8881
|
-
"module": "src/common/directives/wrapIf.ts"
|
|
8882
|
-
}
|
|
8883
|
-
},
|
|
8884
|
-
{
|
|
8885
|
-
"kind": "js",
|
|
8886
|
-
"name": "wrapIf",
|
|
8887
|
-
"declaration": {
|
|
8888
|
-
"name": "wrapIf",
|
|
8889
|
-
"module": "src/common/directives/wrapIf.ts"
|
|
8890
|
-
}
|
|
8891
|
-
},
|
|
8892
|
-
{
|
|
8893
|
-
"kind": "js",
|
|
8894
|
-
"name": "wrapIf",
|
|
8895
|
-
"declaration": {
|
|
8896
|
-
"name": "wrapIf",
|
|
8897
|
-
"module": "src/common/directives/wrapIf.ts"
|
|
8898
|
-
}
|
|
8899
|
-
},
|
|
8900
|
-
{
|
|
8901
|
-
"kind": "js",
|
|
8902
|
-
"name": "wrapIf",
|
|
8903
|
-
"declaration": {
|
|
8904
|
-
"name": "wrapIf",
|
|
8905
|
-
"module": "src/common/directives/wrapIf.ts"
|
|
8906
|
-
}
|
|
8907
|
-
}
|
|
8908
|
-
]
|
|
8909
|
-
},
|
|
8910
8734
|
{
|
|
8911
8735
|
"kind": "javascript-module",
|
|
8912
8736
|
"path": "src/common/controllers/DirectionController.ts",
|
|
@@ -9621,6 +9445,182 @@
|
|
|
9621
9445
|
}
|
|
9622
9446
|
]
|
|
9623
9447
|
},
|
|
9448
|
+
{
|
|
9449
|
+
"kind": "javascript-module",
|
|
9450
|
+
"path": "src/common/directives/cond.ts",
|
|
9451
|
+
"declarations": [
|
|
9452
|
+
{
|
|
9453
|
+
"kind": "variable",
|
|
9454
|
+
"name": "cond"
|
|
9455
|
+
}
|
|
9456
|
+
],
|
|
9457
|
+
"exports": [
|
|
9458
|
+
{
|
|
9459
|
+
"kind": "js",
|
|
9460
|
+
"name": "cond",
|
|
9461
|
+
"declaration": {
|
|
9462
|
+
"name": "cond",
|
|
9463
|
+
"module": "src/common/directives/cond.ts"
|
|
9464
|
+
}
|
|
9465
|
+
}
|
|
9466
|
+
]
|
|
9467
|
+
},
|
|
9468
|
+
{
|
|
9469
|
+
"kind": "javascript-module",
|
|
9470
|
+
"path": "src/common/directives/wrapIf.ts",
|
|
9471
|
+
"declarations": [
|
|
9472
|
+
{
|
|
9473
|
+
"kind": "function",
|
|
9474
|
+
"name": "wrapIf",
|
|
9475
|
+
"return": {
|
|
9476
|
+
"type": {
|
|
9477
|
+
"text": "TInner"
|
|
9478
|
+
}
|
|
9479
|
+
},
|
|
9480
|
+
"parameters": [
|
|
9481
|
+
{
|
|
9482
|
+
"name": "condition",
|
|
9483
|
+
"type": {
|
|
9484
|
+
"text": "false"
|
|
9485
|
+
}
|
|
9486
|
+
},
|
|
9487
|
+
{
|
|
9488
|
+
"name": "inner",
|
|
9489
|
+
"type": {
|
|
9490
|
+
"text": "() => TInner"
|
|
9491
|
+
}
|
|
9492
|
+
},
|
|
9493
|
+
{
|
|
9494
|
+
"name": "wrapper",
|
|
9495
|
+
"type": {
|
|
9496
|
+
"text": "(inner: TInner) => TWrapper"
|
|
9497
|
+
}
|
|
9498
|
+
}
|
|
9499
|
+
]
|
|
9500
|
+
},
|
|
9501
|
+
{
|
|
9502
|
+
"kind": "function",
|
|
9503
|
+
"name": "wrapIf",
|
|
9504
|
+
"return": {
|
|
9505
|
+
"type": {
|
|
9506
|
+
"text": "TWrapper"
|
|
9507
|
+
}
|
|
9508
|
+
},
|
|
9509
|
+
"parameters": [
|
|
9510
|
+
{
|
|
9511
|
+
"name": "condition",
|
|
9512
|
+
"type": {
|
|
9513
|
+
"text": "true"
|
|
9514
|
+
}
|
|
9515
|
+
},
|
|
9516
|
+
{
|
|
9517
|
+
"name": "inner",
|
|
9518
|
+
"type": {
|
|
9519
|
+
"text": "() => TInner"
|
|
9520
|
+
}
|
|
9521
|
+
},
|
|
9522
|
+
{
|
|
9523
|
+
"name": "wrapper",
|
|
9524
|
+
"type": {
|
|
9525
|
+
"text": "(inner: TInner) => TWrapper"
|
|
9526
|
+
}
|
|
9527
|
+
}
|
|
9528
|
+
]
|
|
9529
|
+
},
|
|
9530
|
+
{
|
|
9531
|
+
"kind": "function",
|
|
9532
|
+
"name": "wrapIf",
|
|
9533
|
+
"return": {
|
|
9534
|
+
"type": {
|
|
9535
|
+
"text": "TInner | TWrapper"
|
|
9536
|
+
}
|
|
9537
|
+
},
|
|
9538
|
+
"parameters": [
|
|
9539
|
+
{
|
|
9540
|
+
"name": "condition",
|
|
9541
|
+
"type": {
|
|
9542
|
+
"text": "unknown"
|
|
9543
|
+
}
|
|
9544
|
+
},
|
|
9545
|
+
{
|
|
9546
|
+
"name": "inner",
|
|
9547
|
+
"type": {
|
|
9548
|
+
"text": "() => TInner"
|
|
9549
|
+
}
|
|
9550
|
+
},
|
|
9551
|
+
{
|
|
9552
|
+
"name": "wrapper",
|
|
9553
|
+
"type": {
|
|
9554
|
+
"text": "(inner: TInner) => TWrapper"
|
|
9555
|
+
}
|
|
9556
|
+
}
|
|
9557
|
+
]
|
|
9558
|
+
},
|
|
9559
|
+
{
|
|
9560
|
+
"kind": "function",
|
|
9561
|
+
"name": "wrapIf",
|
|
9562
|
+
"parameters": [
|
|
9563
|
+
{
|
|
9564
|
+
"name": "condition",
|
|
9565
|
+
"type": {
|
|
9566
|
+
"text": "any"
|
|
9567
|
+
}
|
|
9568
|
+
},
|
|
9569
|
+
{
|
|
9570
|
+
"name": "inner",
|
|
9571
|
+
"type": {
|
|
9572
|
+
"text": "() => TInner"
|
|
9573
|
+
}
|
|
9574
|
+
},
|
|
9575
|
+
{
|
|
9576
|
+
"name": "wrapper",
|
|
9577
|
+
"type": {
|
|
9578
|
+
"text": "(innards: TInner) => TWrapper"
|
|
9579
|
+
}
|
|
9580
|
+
}
|
|
9581
|
+
],
|
|
9582
|
+
"return": {
|
|
9583
|
+
"type": {
|
|
9584
|
+
"text": ""
|
|
9585
|
+
}
|
|
9586
|
+
}
|
|
9587
|
+
}
|
|
9588
|
+
],
|
|
9589
|
+
"exports": [
|
|
9590
|
+
{
|
|
9591
|
+
"kind": "js",
|
|
9592
|
+
"name": "wrapIf",
|
|
9593
|
+
"declaration": {
|
|
9594
|
+
"name": "wrapIf",
|
|
9595
|
+
"module": "src/common/directives/wrapIf.ts"
|
|
9596
|
+
}
|
|
9597
|
+
},
|
|
9598
|
+
{
|
|
9599
|
+
"kind": "js",
|
|
9600
|
+
"name": "wrapIf",
|
|
9601
|
+
"declaration": {
|
|
9602
|
+
"name": "wrapIf",
|
|
9603
|
+
"module": "src/common/directives/wrapIf.ts"
|
|
9604
|
+
}
|
|
9605
|
+
},
|
|
9606
|
+
{
|
|
9607
|
+
"kind": "js",
|
|
9608
|
+
"name": "wrapIf",
|
|
9609
|
+
"declaration": {
|
|
9610
|
+
"name": "wrapIf",
|
|
9611
|
+
"module": "src/common/directives/wrapIf.ts"
|
|
9612
|
+
}
|
|
9613
|
+
},
|
|
9614
|
+
{
|
|
9615
|
+
"kind": "js",
|
|
9616
|
+
"name": "wrapIf",
|
|
9617
|
+
"declaration": {
|
|
9618
|
+
"name": "wrapIf",
|
|
9619
|
+
"module": "src/common/directives/wrapIf.ts"
|
|
9620
|
+
}
|
|
9621
|
+
}
|
|
9622
|
+
]
|
|
9623
|
+
},
|
|
9624
9624
|
{
|
|
9625
9625
|
"kind": "javascript-module",
|
|
9626
9626
|
"path": "src/common/mixins/DraftComponentMixin.ts",
|
package/lib/Button.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{_ as t,n as o}from"./query-assigned-elements-37b095c4.js";import{r as n,$ as e,w as r,s as a}from"./lit-element-74b6bb4b.js";import{e as i}from"./property-03f59dce.js";import{l as s}from"./if-defined-fe657a02.js";import{e as l,n as d}from"./ref-7d028e3a.js";import{L as b}from"./LightDomController-011334da.js";import{F as c}from"./FocusableMixin-ebb67709.js";import{I as u}from"./InputMixin-94d15730.js";import{s as h}from"./Component-9d373ef3.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([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 p=class extends(u(c(a))){constructor(){super(...arguments),this.buttonRef=l(),this.lightDom=new b(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.addEventListener("click",this.handleOuterClick,!0)}disconnectedCallback(){this.removeEventListener("click",this.handleOuterClick,!0)}render(){const t=e`<slot name="
|
|
1
|
+
import{_ as t,n as o}from"./query-assigned-elements-37b095c4.js";import{r as n,$ as e,w as r,s as a}from"./lit-element-74b6bb4b.js";import{e as i}from"./property-03f59dce.js";import{l as s}from"./if-defined-fe657a02.js";import{e as l,n as d}from"./ref-7d028e3a.js";import{L as b}from"./LightDomController-011334da.js";import{F as c}from"./FocusableMixin-ebb67709.js";import{I as u}from"./InputMixin-94d15730.js";import{s as h}from"./Component-9d373ef3.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([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 p=class extends(u(c(a))){constructor(){super(...arguments),this.buttonRef=l(),this.lightDom=new b(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.addEventListener("click",this.handleOuterClick,!0)}disconnectedCallback(){this.removeEventListener("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 ${d(this.focusableRef)} class="n-button" target="${this.target}" ?download="${this.download}" href="${s(this.disabled?void 0:this.href)}" tabindex="${s(this.disabled?"-1":void 0)}" aria-disabled="${s(this.disabled?"true":void 0)}" role="${s(this.disabled?"link":void 0)}">${t}</a>`}renderButton(t){return e`<slot name="proxy"></slot><button ${d(this.focusableRef)} class="n-button" ?disabled="${this.disabled}" name="${s(this.name||void 0)}" value="${s(this.value||void 0)}" @click="${this.handleClick}">${t}</button>`}renderLightDom(){return this.href||!this.form?r:e`<button ${d(this.buttonRef)} slot="proxy" name="${s(this.name||void 0)}" value="${s(this.value||void 0)}" ?disabled="${this.disabled}" type="${this.type}"></button>`}handleClick(t){this.buttonRef.value&&(t.stopPropagation(),this.buttonRef.value.click())}};p.styles=[h,v],t([i({reflect:!0})],p.prototype,"variant",void 0),t([i({reflect:!0})],p.prototype,"type",void 0),t([i({reflect:!0})],p.prototype,"size",void 0),t([i({reflect:!0})],p.prototype,"href",void 0),t([i({type:Boolean})],p.prototype,"download",void 0),t([i({reflect:!0})],p.prototype,"target",void 0),t([i({reflect:!0,type:Boolean})],p.prototype,"expand",void 0),p=t([o("nord-button")],p);var f=p;export{f 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 { ifDefined } from \"lit/directives/if-defined.js\"\nimport { createRef, ref } from \"lit/directives/ref.js\"\nimport { LightDomController } from \"../common/controllers/LightDomController.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
|
|
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 { ifDefined } from \"lit/directives/if-defined.js\"\nimport { createRef, ref } from \"lit/directives/ref.js\"\nimport { LightDomController } from \"../common/controllers/LightDomController.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 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 * 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.addEventListener(\"click\", this.handleOuterClick, true)\n }\n\n disconnectedCallback() {\n this.removeEventListener(\"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=${ifDefined(this.disabled ? undefined : this.href)}\n tabindex=${ifDefined(this.disabled ? \"-1\" : undefined)}\n aria-disabled=${ifDefined(this.disabled ? \"true\" : undefined)}\n role=${ifDefined(this.disabled ? \"link\" : undefined)}\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=${ifDefined(this.name || undefined)}\n value=${ifDefined(this.value || undefined)}\n @click=${this.handleClick}\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=${ifDefined(this.name || undefined)}\n value=${ifDefined(this.value || undefined)}\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","createRef","LightDomController","render","renderLightDom","e","composedPath","some","node","focusableRef","value","buttonRef","stopPropagation","connectedCallback","super","addEventListener","handleOuterClick","disconnectedCallback","removeEventListener","innards","html","href","renderLink","renderButton","ref","target","download","ifDefined","disabled","undefined","name","handleClick","form","nothing","type","click","componentStyle","style","__decorate","property","reflect","Boolean","customElement"],"mappings":"0qJAuBA,IAAqBA,EAArB,cAAoCC,EAAWC,EAAeC,KAA9DC,kCAGUC,eAAYC,IACZD,cAAW,IAAIE,EAAmBF,KAAM,CAC9CG,OAAQ,IAAMH,KAAKI,mBAMQJ,aAAiE,UAKjEA,UAAsC,SAMtCA,UAAwB,IAYxBA,eAAW,EAWXA,YAAkD,QAKnCA,aAAS,EA+E7CA,sBAAoBK,IAIDA,EACtBC,eACAC,MAAKC,GAAQA,IAASR,KAAKS,aAAaC,OAASF,IAASR,KAAKW,UAAUD,SAG1EL,EAAEO,mBAtFNC,oBACEC,MAAMD,oBACNb,KAAKe,iBAAiB,QAASf,KAAKgB,kBAAkB,GAGxDC,uBACEjB,KAAKkB,oBAAoB,QAASlB,KAAKgB,kBAAkB,GAG3Db,SACE,MAAMgB,EAAUC,CAAI,+FAQpB,OAAOpB,KAAKqB,KAAOrB,KAAKsB,WAAWH,GAAWnB,KAAKuB,aAAaJ,GAU1DG,WAAWH,GACjB,OAAOC,CAAI,MAELI,EAAIxB,KAAKS,0CAEFT,KAAKyB,sBACFzB,KAAK0B,mBACVC,EAAU3B,KAAK4B,cAAWC,EAAY7B,KAAKqB,oBACvCM,EAAU3B,KAAK4B,SAAW,UAAOC,sBAC5BF,EAAU3B,KAAK4B,SAAW,YAASC,aAC5CF,EAAU3B,KAAK4B,SAAW,YAASC,OACvCV,QAKDI,aAAaJ,GACnB,OAAOC,CAAI,qCAGLI,EAAIxB,KAAKS,6CAECT,KAAK4B,mBACVD,EAAU3B,KAAK8B,WAAQD,cACtBF,EAAU3B,KAAKU,YAASmB,eACvB7B,KAAK+B,gBAEZZ,aAKAf,iBACN,OAAIJ,KAAKqB,OAASrB,KAAKgC,KACdC,EAGFb,CAAI,WAELI,EAAIxB,KAAKW,iCAEJgB,EAAU3B,KAAK8B,WAAQD,cACtBF,EAAU3B,KAAKU,YAASmB,kBACpB7B,KAAK4B,mBACV5B,KAAKkC,kBAkBVH,YAAY1B,GACdL,KAAKW,UAAUD,QAEjBL,EAAEO,kBACFZ,KAAKW,UAAUD,MAAMyB,WAjJlBxC,SAAS,CAACyC,EAAgBC,GAUJC,GAA5BC,EAAS,CAAEC,SAAS,mCAKQF,GAA5BC,EAAS,CAAEC,SAAS,gCAMQF,GAA5BC,EAAS,CAAEC,SAAS,gCAMQF,GAA5BC,EAAS,CAAEC,SAAS,gCAMQF,GAA5BC,EAAS,CAAEL,KAAMO,0CAWWH,GAA5BC,EAAS,CAAEC,SAAS,kCAKuBF,GAA3CC,EAAS,CAAEC,SAAS,EAAMN,KAAMO,wCAlDd9C,KADpB+C,EAAc,gBACM/C,SAAAA"}
|