@nordhealth/components 1.0.0-beta.3 → 1.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +108 -108
- package/lib/Banner.js +1 -1
- package/lib/Banner.js.map +1 -1
- package/lib/Icon.js +1 -1
- package/lib/bundle.js +2 -2
- package/lib/bundle.js.map +1 -1
- package/package.json +2 -2
package/custom-elements.json
CHANGED
|
@@ -1277,114 +1277,6 @@
|
|
|
1277
1277
|
],
|
|
1278
1278
|
"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"
|
|
1279
1279
|
},
|
|
1280
|
-
{
|
|
1281
|
-
"kind": "javascript-module",
|
|
1282
|
-
"path": "src/card/Card.ts",
|
|
1283
|
-
"declarations": [
|
|
1284
|
-
{
|
|
1285
|
-
"kind": "class",
|
|
1286
|
-
"description": "Cards are shadowed surfaces that display content and actions on a\nsingle topic. They should be easy to scan for relevant and\nactionable information.",
|
|
1287
|
-
"name": "Card",
|
|
1288
|
-
"slots": [
|
|
1289
|
-
{
|
|
1290
|
-
"description": "The card content.",
|
|
1291
|
-
"name": ""
|
|
1292
|
-
},
|
|
1293
|
-
{
|
|
1294
|
-
"description": "Optional slot that holds a header for the card.",
|
|
1295
|
-
"name": "header"
|
|
1296
|
-
},
|
|
1297
|
-
{
|
|
1298
|
-
"description": "Optional slot that holds footer content for the card.",
|
|
1299
|
-
"name": "footer"
|
|
1300
|
-
}
|
|
1301
|
-
],
|
|
1302
|
-
"members": [
|
|
1303
|
-
{
|
|
1304
|
-
"kind": "field",
|
|
1305
|
-
"name": "headerSlot",
|
|
1306
|
-
"privacy": "private",
|
|
1307
|
-
"default": "new SlotController(this, \"header\")"
|
|
1308
|
-
},
|
|
1309
|
-
{
|
|
1310
|
-
"kind": "field",
|
|
1311
|
-
"name": "footerSlot",
|
|
1312
|
-
"privacy": "private",
|
|
1313
|
-
"default": "new SlotController(this, \"footer\")"
|
|
1314
|
-
},
|
|
1315
|
-
{
|
|
1316
|
-
"kind": "field",
|
|
1317
|
-
"name": "padding",
|
|
1318
|
-
"type": {
|
|
1319
|
-
"text": "\"m\" | \"l\" | \"none\""
|
|
1320
|
-
},
|
|
1321
|
-
"default": "\"m\"",
|
|
1322
|
-
"description": "Controls the padding of card component. When set to “none”,\nthe header and footer slots will still have padding.",
|
|
1323
|
-
"attribute": "padding",
|
|
1324
|
-
"reflects": true
|
|
1325
|
-
},
|
|
1326
|
-
{
|
|
1327
|
-
"kind": "field",
|
|
1328
|
-
"name": "_warningLogged",
|
|
1329
|
-
"type": {
|
|
1330
|
-
"text": "boolean"
|
|
1331
|
-
},
|
|
1332
|
-
"privacy": "private",
|
|
1333
|
-
"static": true,
|
|
1334
|
-
"default": "false",
|
|
1335
|
-
"inheritedFrom": {
|
|
1336
|
-
"name": "DraftComponentMixin",
|
|
1337
|
-
"module": "src/common/mixins/DraftComponentMixin.ts"
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
],
|
|
1341
|
-
"attributes": [
|
|
1342
|
-
{
|
|
1343
|
-
"name": "padding",
|
|
1344
|
-
"type": {
|
|
1345
|
-
"text": "\"m\" | \"l\" | \"none\""
|
|
1346
|
-
},
|
|
1347
|
-
"default": "\"m\"",
|
|
1348
|
-
"description": "Controls the padding of card component. When set to “none”,\nthe header and footer slots will still have padding.",
|
|
1349
|
-
"fieldName": "padding"
|
|
1350
|
-
}
|
|
1351
|
-
],
|
|
1352
|
-
"mixins": [
|
|
1353
|
-
{
|
|
1354
|
-
"name": "DraftComponentMixin",
|
|
1355
|
-
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
1356
|
-
}
|
|
1357
|
-
],
|
|
1358
|
-
"superclass": {
|
|
1359
|
-
"name": "LitElement",
|
|
1360
|
-
"package": "lit"
|
|
1361
|
-
},
|
|
1362
|
-
"status": "draft",
|
|
1363
|
-
"category": "structure",
|
|
1364
|
-
"tagName": "nord-card",
|
|
1365
|
-
"customElement": true
|
|
1366
|
-
}
|
|
1367
|
-
],
|
|
1368
|
-
"exports": [
|
|
1369
|
-
{
|
|
1370
|
-
"kind": "js",
|
|
1371
|
-
"name": "default",
|
|
1372
|
-
"declaration": {
|
|
1373
|
-
"name": "Card",
|
|
1374
|
-
"module": "src/card/Card.ts"
|
|
1375
|
-
}
|
|
1376
|
-
},
|
|
1377
|
-
{
|
|
1378
|
-
"kind": "custom-element-definition",
|
|
1379
|
-
"name": "nord-card",
|
|
1380
|
-
"declaration": {
|
|
1381
|
-
"name": "Card",
|
|
1382
|
-
"module": "src/card/Card.ts"
|
|
1383
|
-
}
|
|
1384
|
-
}
|
|
1385
|
-
],
|
|
1386
|
-
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to display content and actions on a single topic inside a container.\n- Use to visually separate specific parts of content in an application view.\n- Use to wrap a form into a container, for example a login form.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use when you need to capture user’s attention in a prominent way.\n- Don’t use to inform user about important changes or conditions in the interface.\n- Don’t use multiple primary buttons inside a card. A card should only contain a single primary action.\n\n</div>\n"
|
|
1387
|
-
},
|
|
1388
1280
|
{
|
|
1389
1281
|
"kind": "javascript-module",
|
|
1390
1282
|
"path": "src/checkbox/Checkbox.ts",
|
|
@@ -2017,6 +1909,114 @@
|
|
|
2017
1909
|
],
|
|
2018
1910
|
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use for making it possible to choose one or more options from a limited number of options.\n- Use for “accepting terms of service” and similar functionality.\n- Use in forms to toggle something on or off.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use when you have more than 10 options to choose from.\n- Don’t change the selection of another checkbox when another one is clicked. Only exception is when a checkbox is used to make a bulk selection of multiple items.\n\n</div>\n\n---\n\n## Content guidelines\n\nCheckbox labels should be clear, accurate and predictable. It should be possible for the user to understand what they are selecting:\n\n<div class=\"n-usage n-usage-do\">User settings</div>\n<div class=\"n-usage n-usage-dont\">Option 1</div>\n\nWhen writing checkbox labels, always write them in sentence case, not title case. The first word should be capitalized and the rest lowercase (unless a proper noun):\n\n<div class=\"n-usage n-usage-do\">User settings</div>\n<div class=\"n-usage n-usage-dont\">User Settings</div>\n\nAvoid ending in punctuation if it’s a single sentence, word, or a fragment:\n\n<div class=\"n-usage n-usage-do\">Show dashboard</div>\n<div class=\"n-usage n-usage-dont\">Show dashboard.</div>\n\nDo not use commas or semicolons at the end of each line\n\n<div class=\"n-usage n-usage-do\">Patients</div>\n<div class=\"n-usage n-usage-dont\">Patients;</div>\n"
|
|
2019
1911
|
},
|
|
1912
|
+
{
|
|
1913
|
+
"kind": "javascript-module",
|
|
1914
|
+
"path": "src/card/Card.ts",
|
|
1915
|
+
"declarations": [
|
|
1916
|
+
{
|
|
1917
|
+
"kind": "class",
|
|
1918
|
+
"description": "Cards are shadowed surfaces that display content and actions on a\nsingle topic. They should be easy to scan for relevant and\nactionable information.",
|
|
1919
|
+
"name": "Card",
|
|
1920
|
+
"slots": [
|
|
1921
|
+
{
|
|
1922
|
+
"description": "The card content.",
|
|
1923
|
+
"name": ""
|
|
1924
|
+
},
|
|
1925
|
+
{
|
|
1926
|
+
"description": "Optional slot that holds a header for the card.",
|
|
1927
|
+
"name": "header"
|
|
1928
|
+
},
|
|
1929
|
+
{
|
|
1930
|
+
"description": "Optional slot that holds footer content for the card.",
|
|
1931
|
+
"name": "footer"
|
|
1932
|
+
}
|
|
1933
|
+
],
|
|
1934
|
+
"members": [
|
|
1935
|
+
{
|
|
1936
|
+
"kind": "field",
|
|
1937
|
+
"name": "headerSlot",
|
|
1938
|
+
"privacy": "private",
|
|
1939
|
+
"default": "new SlotController(this, \"header\")"
|
|
1940
|
+
},
|
|
1941
|
+
{
|
|
1942
|
+
"kind": "field",
|
|
1943
|
+
"name": "footerSlot",
|
|
1944
|
+
"privacy": "private",
|
|
1945
|
+
"default": "new SlotController(this, \"footer\")"
|
|
1946
|
+
},
|
|
1947
|
+
{
|
|
1948
|
+
"kind": "field",
|
|
1949
|
+
"name": "padding",
|
|
1950
|
+
"type": {
|
|
1951
|
+
"text": "\"m\" | \"l\" | \"none\""
|
|
1952
|
+
},
|
|
1953
|
+
"default": "\"m\"",
|
|
1954
|
+
"description": "Controls the padding of card component. When set to “none”,\nthe header and footer slots will still have padding.",
|
|
1955
|
+
"attribute": "padding",
|
|
1956
|
+
"reflects": true
|
|
1957
|
+
},
|
|
1958
|
+
{
|
|
1959
|
+
"kind": "field",
|
|
1960
|
+
"name": "_warningLogged",
|
|
1961
|
+
"type": {
|
|
1962
|
+
"text": "boolean"
|
|
1963
|
+
},
|
|
1964
|
+
"privacy": "private",
|
|
1965
|
+
"static": true,
|
|
1966
|
+
"default": "false",
|
|
1967
|
+
"inheritedFrom": {
|
|
1968
|
+
"name": "DraftComponentMixin",
|
|
1969
|
+
"module": "src/common/mixins/DraftComponentMixin.ts"
|
|
1970
|
+
}
|
|
1971
|
+
}
|
|
1972
|
+
],
|
|
1973
|
+
"attributes": [
|
|
1974
|
+
{
|
|
1975
|
+
"name": "padding",
|
|
1976
|
+
"type": {
|
|
1977
|
+
"text": "\"m\" | \"l\" | \"none\""
|
|
1978
|
+
},
|
|
1979
|
+
"default": "\"m\"",
|
|
1980
|
+
"description": "Controls the padding of card component. When set to “none”,\nthe header and footer slots will still have padding.",
|
|
1981
|
+
"fieldName": "padding"
|
|
1982
|
+
}
|
|
1983
|
+
],
|
|
1984
|
+
"mixins": [
|
|
1985
|
+
{
|
|
1986
|
+
"name": "DraftComponentMixin",
|
|
1987
|
+
"module": "/src/common/mixins/DraftComponentMixin.js"
|
|
1988
|
+
}
|
|
1989
|
+
],
|
|
1990
|
+
"superclass": {
|
|
1991
|
+
"name": "LitElement",
|
|
1992
|
+
"package": "lit"
|
|
1993
|
+
},
|
|
1994
|
+
"status": "draft",
|
|
1995
|
+
"category": "structure",
|
|
1996
|
+
"tagName": "nord-card",
|
|
1997
|
+
"customElement": true
|
|
1998
|
+
}
|
|
1999
|
+
],
|
|
2000
|
+
"exports": [
|
|
2001
|
+
{
|
|
2002
|
+
"kind": "js",
|
|
2003
|
+
"name": "default",
|
|
2004
|
+
"declaration": {
|
|
2005
|
+
"name": "Card",
|
|
2006
|
+
"module": "src/card/Card.ts"
|
|
2007
|
+
}
|
|
2008
|
+
},
|
|
2009
|
+
{
|
|
2010
|
+
"kind": "custom-element-definition",
|
|
2011
|
+
"name": "nord-card",
|
|
2012
|
+
"declaration": {
|
|
2013
|
+
"name": "Card",
|
|
2014
|
+
"module": "src/card/Card.ts"
|
|
2015
|
+
}
|
|
2016
|
+
}
|
|
2017
|
+
],
|
|
2018
|
+
"readme": "## Usage\n\nThis section includes guidelines for designers and developers about the usage of this component in different contexts.\n\n<div class=\"n-usage n-usage-do\">\n\n### Do\n\n- Use to display content and actions on a single topic inside a container.\n- Use to visually separate specific parts of content in an application view.\n- Use to wrap a form into a container, for example a login form.\n\n</div>\n<div class=\"n-usage n-usage-dont\">\n\n### Don’t\n\n- Don’t use when you need to capture user’s attention in a prominent way.\n- Don’t use to inform user about important changes or conditions in the interface.\n- Don’t use multiple primary buttons inside a card. A card should only contain a single primary action.\n\n</div>\n"
|
|
2019
|
+
},
|
|
2020
2020
|
{
|
|
2021
2021
|
"kind": "javascript-module",
|
|
2022
2022
|
"path": "src/command-menu/CommandMenu.ts",
|
package/lib/Banner.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as n,_ as r,n as a}from"./DraftComponentMixin-30345acf.js";import{r as o,$ as e,s as t}from"./lit-element-9646ab7e.js";import{e as i}from"./property-03f59dce.js";import{s}from"./Component-a19be7c9.js";const c=o`:host{--n-banner-padding:var(--n-space-m);--n-banner-background:var(--n-color-status-info-weak);font-size:var(--n-font-size-m);color:var(--n-color-text)}.n-banner{background:var(--n-banner-background);box-shadow:var(--n-box-shadow-card);border-radius:var(--n-border-radius);
|
|
1
|
+
import{D as n,_ as r,n as a}from"./DraftComponentMixin-30345acf.js";import{r as o,$ as e,s as t}from"./lit-element-9646ab7e.js";import{e as i}from"./property-03f59dce.js";import{s}from"./Component-a19be7c9.js";const c=o`:host{--n-banner-padding:var(--n-space-m);--n-banner-background:var(--n-color-status-info-weak);font-size:var(--n-font-size-m);color:var(--n-color-text);display:contents}.n-banner{background:var(--n-banner-background);box-shadow:var(--n-box-shadow-card);border-radius:var(--n-border-radius);padding:var(--n-space-m) var(--n-space-l);margin:0;inline-size:100%}.n-banner-content{inline-size:calc(100% - var(--n-space-xl))}nord-icon{transform:translateY(2px);color:var(--n-color-icon-hover)}::slotted(a){color:var(--n-color-text)!important;text-decoration:underline!important}::slotted(p){margin:0!important}:host([variant=success]){--n-banner-background:var(--n-color-status-success-weak)}:host([variant=danger]){--n-banner-background:var(--n-color-status-danger-weak)}:host([variant=warning]){--n-banner-background:var(--n-color-status-warning-weak)}`;let d=class extends(n(t)){constructor(){super(...arguments),this.variant="info"}render(){return e`<div class="n-banner"><nord-stack align-items="start" direction="horizontal"><nord-icon name="interface-warning" size="m" ?hidden="${"warning"!==this.variant}"></nord-icon><nord-icon name="interface-warning" size="m" ?hidden="${"danger"!==this.variant}"></nord-icon><nord-icon name="interface-info" size="m" ?hidden="${"info"!==this.variant}"></nord-icon><nord-icon name="interface-help-2" size="m" ?hidden="${"success"!==this.variant}"></nord-icon><div class="n-banner-content"><slot></slot></div></nord-stack></div>`}};d.styles=[s,c],r([i({reflect:!0})],d.prototype,"variant",void 0),d=r([a("nord-banner")],d);var l=d;export{l as default};
|
|
2
2
|
//# sourceMappingURL=Banner.js.map
|
package/lib/Banner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Banner.js","sources":["../src/banner/Banner.ts"],"sourcesContent":["import { LitElement, html } from \"lit\"\nimport { customElement, property } from \"lit/decorators.js\"\nimport { DraftComponentMixin } from \"../common/mixins/DraftComponentMixin.js\"\n\nimport componentStyle from \"../common/styles/Component.css\"\nimport style from \"./Banner.css\"\n\n/**\n * Banner informs users about important changes or conditions in the\n * interface. Use this component if you need to communicate to users\n * in a prominent way.\n *\n * @status draft\n * @category feedback\n * @slot - default slot\n */\n@customElement(\"nord-banner\")\nexport default class Banner extends DraftComponentMixin(LitElement) {\n static styles = [componentStyle, style]\n\n /**\n * The style variant of the banner.\n */\n @property({ reflect: true }) variant: \"info\" | \"danger\" | \"success\" | \"warning\" = \"info\"\n\n render() {\n return html`\n <div class=\"n-banner\">\n <nord-stack align-items=\"start\" direction=\"horizontal\">\n <nord-icon name=\"interface-warning\" size=\"m\" ?hidden=${this.variant !== \"warning\"}></nord-icon>\n <nord-icon name=\"interface-warning\" size=\"m\" ?hidden=${this.variant !== \"danger\"}></nord-icon>\n <nord-icon name=\"interface-info\" size=\"m\" ?hidden=${this.variant !== \"info\"}></nord-icon>\n <nord-icon name=\"interface-help-2\" size=\"m\" ?hidden=${this.variant !== \"success\"}></nord-icon>\n <div class=\"n-banner-content\">\n <slot></slot>\n </div>\n </nord-stack>\n </div>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"nord-banner\": Banner\n }\n}\n"],"names":["Banner","DraftComponentMixin","LitElement","constructor","this","render","html","variant","componentStyle","style","__decorate","property","reflect","customElement"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Banner.js","sources":["../src/banner/Banner.ts"],"sourcesContent":["import { LitElement, html } from \"lit\"\nimport { customElement, property } from \"lit/decorators.js\"\nimport { DraftComponentMixin } from \"../common/mixins/DraftComponentMixin.js\"\n\nimport componentStyle from \"../common/styles/Component.css\"\nimport style from \"./Banner.css\"\n\n/**\n * Banner informs users about important changes or conditions in the\n * interface. Use this component if you need to communicate to users\n * in a prominent way.\n *\n * @status draft\n * @category feedback\n * @slot - default slot\n */\n@customElement(\"nord-banner\")\nexport default class Banner extends DraftComponentMixin(LitElement) {\n static styles = [componentStyle, style]\n\n /**\n * The style variant of the banner.\n */\n @property({ reflect: true }) variant: \"info\" | \"danger\" | \"success\" | \"warning\" = \"info\"\n\n render() {\n return html`\n <div class=\"n-banner\">\n <nord-stack align-items=\"start\" direction=\"horizontal\">\n <nord-icon name=\"interface-warning\" size=\"m\" ?hidden=${this.variant !== \"warning\"}></nord-icon>\n <nord-icon name=\"interface-warning\" size=\"m\" ?hidden=${this.variant !== \"danger\"}></nord-icon>\n <nord-icon name=\"interface-info\" size=\"m\" ?hidden=${this.variant !== \"info\"}></nord-icon>\n <nord-icon name=\"interface-help-2\" size=\"m\" ?hidden=${this.variant !== \"success\"}></nord-icon>\n <div class=\"n-banner-content\">\n <slot></slot>\n </div>\n </nord-stack>\n </div>\n `\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n \"nord-banner\": Banner\n }\n}\n"],"names":["Banner","DraftComponentMixin","LitElement","constructor","this","render","html","variant","componentStyle","style","__decorate","property","reflect","customElement"],"mappings":"+iCAiBA,IAAqBA,EAArB,cAAoCC,EAAoBC,IAAxDC,kCAM+BC,aAAqD,OAElFC,SACE,OAAOC,CAAI,sIAGmE,YAAjBF,KAAKG,8EACY,WAAjBH,KAAKG,2EACS,SAAjBH,KAAKG,6EACc,YAAjBH,KAAKG,8FAd5DP,SAAS,CAACQ,EAAgBC,GAKJC,GAA5BC,EAAS,CAAEC,SAAS,mCANFZ,KADpBa,EAAc,gBACMb,SAAAA"}
|
package/lib/Icon.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{D as e,_ as s,n as i}from"./DraftComponentMixin-30345acf.js";import{r as t,$ as o,s as r}from"./lit-element-9646ab7e.js";import{e as n}from"./property-03f59dce.js";import{t as a}from"./state-70f38ceb.js";import{l as c}from"./if-defined-2a4c6dbc.js";import{o as l}from"./unsafe-html-4da54dd2.js";import{s as d}from"./Component-a19be7c9.js";import"./directive-de55b00a.js";const h=t`:host{--n-icon-size:var(--n-size-icon-m);display:inline-block;block-size:var(--n-icon-size);inline-size:var(--n-icon-size)}:host([size=xs]){--n-icon-size:var(--n-size-icon-xs)}:host([size="s"]){--n-icon-size:var(--n-size-icon-s)}:host([size="l"]){--n-icon-size:var(--n-size-icon-l)}:host([size=xl]){--n-icon-size:var(--n-size-icon-xl)}:host([size=xxl]){--n-icon-size:var(--n-size-icon-xxl)}.n-icon{display:block}svg{display:block}`;var v;let p=v=class extends(e(r)){constructor(){super(...arguments),this.name="",this.size="m",this.svg=""}static registerResolver(e){v.resolver=e}static registerIcon(e,s){let i,t;if("string"==typeof e?(i=e,t=s):(i=e.title,t=e.default),!i)throw new Error("name is required when registering an icon");if(!t)throw new Error("icon must not be empty");v.registeredIcons.has(i)||v.registeredIcons.set(i,t)}willUpdate(e){if(!e.has("name"))return;const s=this.resolve();"string"==typeof s?this.svg=s:s.then((e=>{this.svg=e})).catch((()=>{this.svg=""}))}render(){return o`<div role="${c(this.label?"img":void 0)}" aria-label="${c(this.label)}"><slot style="${c(this.color?`color:${this.color}`:void 0)}" aria-hidden="true">${l(this.svg)}</slot></div>`}resolve(){return this.name?v.registeredIcons.has(this.name)?v.registeredIcons.get(this.name):v.resolver(this.name):""}};p.styles=[d,h],p.resolver=e=>fetch(`https://nordcdn.net/ds/icons/1.3.
|
|
1
|
+
import{D as e,_ as s,n as i}from"./DraftComponentMixin-30345acf.js";import{r as t,$ as o,s as r}from"./lit-element-9646ab7e.js";import{e as n}from"./property-03f59dce.js";import{t as a}from"./state-70f38ceb.js";import{l as c}from"./if-defined-2a4c6dbc.js";import{o as l}from"./unsafe-html-4da54dd2.js";import{s as d}from"./Component-a19be7c9.js";import"./directive-de55b00a.js";const h=t`:host{--n-icon-size:var(--n-size-icon-m);display:inline-block;block-size:var(--n-icon-size);inline-size:var(--n-icon-size)}:host([size=xs]){--n-icon-size:var(--n-size-icon-xs)}:host([size="s"]){--n-icon-size:var(--n-size-icon-s)}:host([size="l"]){--n-icon-size:var(--n-size-icon-l)}:host([size=xl]){--n-icon-size:var(--n-size-icon-xl)}:host([size=xxl]){--n-icon-size:var(--n-size-icon-xxl)}.n-icon{display:block}svg{display:block}`;var v;let p=v=class extends(e(r)){constructor(){super(...arguments),this.name="",this.size="m",this.svg=""}static registerResolver(e){v.resolver=e}static registerIcon(e,s){let i,t;if("string"==typeof e?(i=e,t=s):(i=e.title,t=e.default),!i)throw new Error("name is required when registering an icon");if(!t)throw new Error("icon must not be empty");v.registeredIcons.has(i)||v.registeredIcons.set(i,t)}willUpdate(e){if(!e.has("name"))return;const s=this.resolve();"string"==typeof s?this.svg=s:s.then((e=>{this.svg=e})).catch((()=>{this.svg=""}))}render(){return o`<div role="${c(this.label?"img":void 0)}" aria-label="${c(this.label)}"><slot style="${c(this.color?`color:${this.color}`:void 0)}" aria-hidden="true">${l(this.svg)}</slot></div>`}resolve(){return this.name?v.registeredIcons.has(this.name)?v.registeredIcons.get(this.name):v.resolver(this.name):""}};p.styles=[d,h],p.resolver=e=>fetch(`https://nordcdn.net/ds/icons/1.3.4/assets/${e}.svg`).then((e=>e.text())),p.registeredIcons=new Map,s([n({reflect:!0})],p.prototype,"name",void 0),s([n({reflect:!0})],p.prototype,"size",void 0),s([n({reflect:!0})],p.prototype,"color",void 0),s([n({reflect:!0})],p.prototype,"label",void 0),s([a()],p.prototype,"svg",void 0),p=v=s([i("nord-icon")],p);var m=p;export{m as default};
|
|
2
2
|
//# sourceMappingURL=Icon.js.map
|