@aquera/nile-elements 2.0.14 → 2.0.16

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.
Files changed (45) hide show
  1. package/README.md +6 -0
  2. package/demo/nxtgen-classes.css +5 -5
  3. package/demo/nxtgen-dark.css +16 -16
  4. package/demo/nxtgen-properties.css +2 -2
  5. package/demo/nxtgen-utilities.css +5 -5
  6. package/demo/nxtgen.css +5 -5
  7. package/demo/utilities.css +2 -2
  8. package/demo/variables.css +2 -2
  9. package/dist/index.js +33 -12
  10. package/dist/nile-badge/nile-badge.cjs.js +1 -1
  11. package/dist/nile-badge/nile-badge.cjs.js.map +1 -1
  12. package/dist/nile-badge/nile-badge.css.cjs.js +1 -1
  13. package/dist/nile-badge/nile-badge.css.cjs.js.map +1 -1
  14. package/dist/nile-badge/nile-badge.css.esm.js +29 -8
  15. package/dist/nile-badge/nile-badge.esm.js +3 -3
  16. package/dist/nile-lite-tooltip/nile-lite-tooltip.css.cjs.js +1 -1
  17. package/dist/nile-lite-tooltip/nile-lite-tooltip.css.cjs.js.map +1 -1
  18. package/dist/nile-lite-tooltip/nile-lite-tooltip.css.esm.js +1 -1
  19. package/dist/nile-tooltip/nile-tooltip.css.cjs.js +1 -1
  20. package/dist/nile-tooltip/nile-tooltip.css.cjs.js.map +1 -1
  21. package/dist/nile-tooltip/nile-tooltip.css.esm.js +1 -1
  22. package/dist/src/nile-badge/nile-badge.css.js +27 -6
  23. package/dist/src/nile-badge/nile-badge.css.js.map +1 -1
  24. package/dist/src/nile-badge/nile-badge.d.ts +2 -0
  25. package/dist/src/nile-badge/nile-badge.js +8 -0
  26. package/dist/src/nile-badge/nile-badge.js.map +1 -1
  27. package/dist/src/nile-badge/nile-badge.test.js +76 -1
  28. package/dist/src/nile-badge/nile-badge.test.js.map +1 -1
  29. package/dist/src/nile-lite-tooltip/nile-lite-tooltip.css.js +1 -1
  30. package/dist/src/nile-lite-tooltip/nile-lite-tooltip.css.js.map +1 -1
  31. package/dist/src/nile-tooltip/nile-tooltip.css.js +1 -1
  32. package/dist/src/nile-tooltip/nile-tooltip.css.js.map +1 -1
  33. package/dist/src/version.js +1 -1
  34. package/dist/src/version.js.map +1 -1
  35. package/dist/tsconfig.tsbuildinfo +1 -1
  36. package/dist/version.cjs.js +1 -1
  37. package/dist/version.cjs.js.map +1 -1
  38. package/dist/version.esm.js +1 -1
  39. package/package.json +1 -1
  40. package/src/nile-badge/nile-badge.css.ts +27 -6
  41. package/src/nile-badge/nile-badge.test.ts +87 -0
  42. package/src/nile-badge/nile-badge.ts +6 -0
  43. package/src/nile-lite-tooltip/nile-lite-tooltip.css.ts +1 -1
  44. package/src/nile-tooltip/nile-tooltip.css.ts +1 -1
  45. package/vscode-html-custom-data.json +16 -1
@@ -1,2 +1,2 @@
1
- System.register([],function(_export,_context){"use strict";var e;function n(){var _ref;return(_ref=function(){if("undefined"==typeof window||"function"!=typeof getComputedStyle)return null;try{return getComputedStyle(document.documentElement).getPropertyValue("--nile-version").trim().replace(/^["']|["']$/g,"")||null;}catch(_unused){return null;}}())!==null&&_ref!==void 0?_ref:"1.3.4";}return{setters:[],execute:function execute(){if("undefined"!=typeof window){window.nileElementsVersion="__NILE_ELEMENTS_VERSION__";e=null;Object.defineProperty(window,"nileVersion",{configurable:!0,get:function get(){return e!==null&&e!==void 0?e:n();},set:function set(n){e=n;}}),window.process=window.process||{env:{NODE_ENV:"production"}};}}};});
1
+ System.register([],function(_export,_context){"use strict";var e;function n(){var _ref;return(_ref=function(){if("undefined"==typeof window||"function"!=typeof getComputedStyle)return null;try{return getComputedStyle(document.documentElement).getPropertyValue("--nile-version").trim().replace(/^["']|["']$/g,"")||null;}catch(_unused){return null;}}())!==null&&_ref!==void 0?_ref:"1.3.5";}return{setters:[],execute:function execute(){if("undefined"!=typeof window){window.nileElementsVersion="__NILE_ELEMENTS_VERSION__";e=null;Object.defineProperty(window,"nileVersion",{configurable:!0,get:function get(){return e!==null&&e!==void 0?e:n();},set:function set(n){e=n;}}),window.process=window.process||{env:{NODE_ENV:"production"}};}}};});
2
2
  //# sourceMappingURL=version.cjs.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.cjs.js","sources":["../../src/version.ts","../../nile/lib/version.js"],"sourcesContent":["// Version utility.\n//\n// NILE_ELEMENTS_VERSION is this package's own version and is still substituted\n// at build time by scripts/replace-version.cjs.\n//\n// The tokens version is read from the loaded Nile stylesheet's --nile-version\n// custom property (stamped by @aquera/nile's scripts/stamp-css-version.mjs),\n// falling back to the @aquera/nile installed alongside this package.\n//\n// Reading the stylesheet is what makes a tokens-only release visible. The\n// imported constant alone is not enough: rollup.config.js bundles\n// @aquera/nile/lib/version.js into dist/index.js, so on the CDN build it is\n// frozen at this package's build time. The stylesheet is the live source.\nimport { NILE_VERSION as BUILT_IN_NILE_VERSION } from '@aquera/nile/lib/version.js';\n\nexport const NILE_ELEMENTS_VERSION = '__NILE_ELEMENTS_VERSION__';\n\nfunction readStylesheetNileVersion(): string | null {\n if (typeof window === 'undefined' || typeof getComputedStyle !== 'function') {\n return null;\n }\n\n try {\n const value = getComputedStyle(document.documentElement)\n .getPropertyValue('--nile-version')\n .trim()\n .replace(/^[\"']|[\"']$/g, '');\n\n return value || null;\n } catch {\n return null;\n }\n}\n\n/**\n * The version of @aquera/nile (tokens/stylesheets) whose CSS is loaded in the\n * page, falling back to the @aquera/nile bundled into this package when no\n * stamped stylesheet is present.\n *\n * This is the canonical runtime API. It resolves on every call rather than\n * caching, so it is correct even when the Nile stylesheet is added to the page\n * after this module evaluates - which is the common case, and why no\n * module-evaluation-time snapshot of it is exported.\n */\nexport function getNileVersion(): string {\n return readStylesheetNileVersion() ?? BUILT_IN_NILE_VERSION;\n}\n\n// Set global versions for runtime access\nif (typeof window !== 'undefined') {\n (window as any).nileElementsVersion = NILE_ELEMENTS_VERSION;\n\n // A getter rather than a value, so window.nileVersion reflects whichever\n // stylesheet is loaded at read time regardless of script/style ordering.\n let override: string | null = null;\n Object.defineProperty(window, 'nileVersion', {\n configurable: true,\n get: () => override ?? getNileVersion(),\n set: (value: string) => {\n override = value;\n },\n });\n\n (window as any).process = (window as any).process || {\n env: { NODE_ENV: 'production' },\n };\n}\n","// Generated by scripts/build-version.mjs - do not edit by hand.\nexport const NILE_VERSION = '1.3.4';\n"],"names":["getNileVersion","n","_ref","window","getComputedStyle","document","documentElement","getPropertyValue","trim","replace","_unused","readStylesheetNileVersion","setters","execute","nileElementsVersion","override","Object","defineProperty","configurable","get","set","value","process","env","NODE_ENV"],"mappings":"yEA4CgBA,CAAAA,CACdC,CAAA,CAAA,KAAAC,IAAA,CAAA,OAAAA,IAAA,CA5BF,UACE,CAAA,GAAsB,WAAXC,EAAAA,MAAAA,CAAAA,MAAAA,EAAsD,UAArBC,EAAAA,MAAAA,CAAAA,gBAAAA,CAC1C,MAAO,KAAA,CAGT,GAME,CAAA,MALcA,CAAAA,iBAAiBC,QAASC,CAAAA,eAAAA,CAAAA,CACrCC,gBAAiB,CAAA,gBAAA,CAAA,CACjBC,IACAC,CAAAA,CAAAA,CAAAA,OAAAA,CAAQ,cAAgB,CAAA,EAAA,CAAA,EAEX,IACjB,EAAC,MAAAC,OAAA,CACA,CAAA,MAAO,KACR,EACH,CAaSC,CAAAA,CAAAA,UAAAA,IAAAA,UAAAA,IAAAA,CC5CmB,OD6C5B,EAGA,OAAAC,OAAA,IAAAC,OAAA,UAAAA,QAAA,KAAsB,WAAXV,EAAAA,MAAAA,CAAAA,MAAAA,CAAwB,CAChCA,MAAAA,CAAeW,mBAnCmB,CAAA,2BAAA,CAuC/BC,CAAAA,CAA0B,IAC9BC,CAAAA,MAAAA,CAAOC,cAAed,CAAAA,MAAAA,CAAQ,aAAe,CAAA,CAC3Ce,cAAc,CACdC,CAAAA,GAAAA,CAAK,QAALA,CAAAA,GAAAA,CAAAA,QAAWJ,CAAAA,CAAAA,SAAAA,CAAAA,UAAAA,CAAAA,CAAYf,CACvBoB,CAAAA,CAAAA,GAAAA,GAAAA,CAAMC,QAAND,CAAAA,GAAAA,CAAMC,CACJN,CAAAA,CAAAA,CAAAA,CAAWM,CAAK,EAInBlB,CAAAA,CAAAA,CAAAA,MAAAA,CAAemB,OAAWnB,CAAAA,MAAAA,CAAemB,OAAW,EAAA,CACnDC,GAAK,CAAA,CAAEC,SAAU,YAErB,CAAA,CAAA,EAAA"}
1
+ {"version":3,"file":"version.cjs.js","sources":["../../src/version.ts","../../nile/lib/version.js"],"sourcesContent":["// Version utility.\n//\n// NILE_ELEMENTS_VERSION is this package's own version and is still substituted\n// at build time by scripts/replace-version.cjs.\n//\n// The tokens version is read from the loaded Nile stylesheet's --nile-version\n// custom property (stamped by @aquera/nile's scripts/stamp-css-version.mjs),\n// falling back to the @aquera/nile installed alongside this package.\n//\n// Reading the stylesheet is what makes a tokens-only release visible. The\n// imported constant alone is not enough: rollup.config.js bundles\n// @aquera/nile/lib/version.js into dist/index.js, so on the CDN build it is\n// frozen at this package's build time. The stylesheet is the live source.\nimport { NILE_VERSION as BUILT_IN_NILE_VERSION } from '@aquera/nile/lib/version.js';\n\nexport const NILE_ELEMENTS_VERSION = '__NILE_ELEMENTS_VERSION__';\n\nfunction readStylesheetNileVersion(): string | null {\n if (typeof window === 'undefined' || typeof getComputedStyle !== 'function') {\n return null;\n }\n\n try {\n const value = getComputedStyle(document.documentElement)\n .getPropertyValue('--nile-version')\n .trim()\n .replace(/^[\"']|[\"']$/g, '');\n\n return value || null;\n } catch {\n return null;\n }\n}\n\n/**\n * The version of @aquera/nile (tokens/stylesheets) whose CSS is loaded in the\n * page, falling back to the @aquera/nile bundled into this package when no\n * stamped stylesheet is present.\n *\n * This is the canonical runtime API. It resolves on every call rather than\n * caching, so it is correct even when the Nile stylesheet is added to the page\n * after this module evaluates - which is the common case, and why no\n * module-evaluation-time snapshot of it is exported.\n */\nexport function getNileVersion(): string {\n return readStylesheetNileVersion() ?? BUILT_IN_NILE_VERSION;\n}\n\n// Set global versions for runtime access\nif (typeof window !== 'undefined') {\n (window as any).nileElementsVersion = NILE_ELEMENTS_VERSION;\n\n // A getter rather than a value, so window.nileVersion reflects whichever\n // stylesheet is loaded at read time regardless of script/style ordering.\n let override: string | null = null;\n Object.defineProperty(window, 'nileVersion', {\n configurable: true,\n get: () => override ?? getNileVersion(),\n set: (value: string) => {\n override = value;\n },\n });\n\n (window as any).process = (window as any).process || {\n env: { NODE_ENV: 'production' },\n };\n}\n","// Generated by scripts/build-version.mjs - do not edit by hand.\nexport const NILE_VERSION = '1.3.5';\n"],"names":["getNileVersion","n","_ref","window","getComputedStyle","document","documentElement","getPropertyValue","trim","replace","_unused","readStylesheetNileVersion","setters","execute","nileElementsVersion","override","Object","defineProperty","configurable","get","set","value","process","env","NODE_ENV"],"mappings":"yEA4CgBA,CAAAA,CACdC,CAAA,CAAA,KAAAC,IAAA,CAAA,OAAAA,IAAA,CA5BF,UACE,CAAA,GAAsB,WAAXC,EAAAA,MAAAA,CAAAA,MAAAA,EAAsD,UAArBC,EAAAA,MAAAA,CAAAA,gBAAAA,CAC1C,MAAO,KAAA,CAGT,GAME,CAAA,MALcA,CAAAA,iBAAiBC,QAASC,CAAAA,eAAAA,CAAAA,CACrCC,gBAAiB,CAAA,gBAAA,CAAA,CACjBC,IACAC,CAAAA,CAAAA,CAAAA,OAAAA,CAAQ,cAAgB,CAAA,EAAA,CAAA,EAEX,IACjB,EAAC,MAAAC,OAAA,CACA,CAAA,MAAO,KACR,EACH,CAaSC,CAAAA,CAAAA,UAAAA,IAAAA,UAAAA,IAAAA,CC5CmB,OD6C5B,EAGA,OAAAC,OAAA,IAAAC,OAAA,UAAAA,QAAA,KAAsB,WAAXV,EAAAA,MAAAA,CAAAA,MAAAA,CAAwB,CAChCA,MAAAA,CAAeW,mBAnCmB,CAAA,2BAAA,CAuC/BC,CAAAA,CAA0B,IAC9BC,CAAAA,MAAAA,CAAOC,cAAed,CAAAA,MAAAA,CAAQ,aAAe,CAAA,CAC3Ce,cAAc,CACdC,CAAAA,GAAAA,CAAK,QAALA,CAAAA,GAAAA,CAAAA,QAAWJ,CAAAA,CAAAA,SAAAA,CAAAA,UAAAA,CAAAA,CAAYf,CACvBoB,CAAAA,CAAAA,GAAAA,GAAAA,CAAMC,QAAND,CAAAA,GAAAA,CAAMC,CACJN,CAAAA,CAAAA,CAAAA,CAAWM,CAAK,EAInBlB,CAAAA,CAAAA,CAAAA,MAAAA,CAAemB,OAAWnB,CAAAA,MAAAA,CAAemB,OAAW,EAAA,CACnDC,GAAK,CAAA,CAAEC,SAAU,YAErB,CAAA,CAAA,EAAA"}
@@ -1 +1 @@
1
- function n(){return function(){if("undefined"==typeof window||"function"!=typeof getComputedStyle)return null;try{return getComputedStyle(document.documentElement).getPropertyValue("--nile-version").trim().replace(/^["']|["']$/g,"")||null}catch{return null}}()??"1.3.4"}if("undefined"!=typeof window){window.nileElementsVersion="__NILE_ELEMENTS_VERSION__";let e=null;Object.defineProperty(window,"nileVersion",{configurable:!0,get:()=>e??n(),set:n=>{e=n}}),window.process=window.process||{env:{NODE_ENV:"production"}}}
1
+ function n(){return function(){if("undefined"==typeof window||"function"!=typeof getComputedStyle)return null;try{return getComputedStyle(document.documentElement).getPropertyValue("--nile-version").trim().replace(/^["']|["']$/g,"")||null}catch{return null}}()??"1.3.5"}if("undefined"!=typeof window){window.nileElementsVersion="__NILE_ELEMENTS_VERSION__";let e=null;Object.defineProperty(window,"nileVersion",{configurable:!0,get:()=>e??n(),set:n=>{e=n}}),window.process=window.process||{env:{NODE_ENV:"production"}}}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Webcomponent nile-elements following open-wc recommendations",
4
4
  "license": "MIT",
5
5
  "author": "nile-elements",
6
- "version": "2.0.14",
6
+ "version": "2.0.16",
7
7
  "main": "dist/src/index.js",
8
8
  "type": "module",
9
9
  "module": "dist/src/index.js",
@@ -63,11 +63,11 @@ export const styles = css`
63
63
  }
64
64
 
65
65
  .badge--orange {
66
- color: var(--nile-badge-color-font-orange, var(--ng-componentcolors-utility-orange-700));
66
+ color: var(--nile-badge-color-font-orange, var(--ng-componentcolors-utility-error-600));
67
67
  border-width: var(--nile-badge-color-border-width, var(--ng-border-width-1));
68
68
  border-style: solid;
69
- border-color: var(--nile-badge-color-border-color-orange, var(--ng-componentcolors-utility-orange-dark-200));
70
- background: var(--nile-badge-color-background-orange, var(--ng-componentcolors-utility-orange-dark-50));
69
+ border-color: var(--nile-badge-color-border-color-orange, var(--ng-componentcolors-utility-orange-300));
70
+ background: var(--nile-badge-color-background-orange, var(--ng-componentcolors-utility-orange-50));
71
71
  }
72
72
 
73
73
  .badge--purple {
@@ -120,7 +120,7 @@ export const styles = css`
120
120
  color: var(--nile-badge-color-font-warning, var(--ng-componentcolors-utility-warning-700));
121
121
  border-width: var(--nile-badge-color-border-width, var(--ng-border-width-1));
122
122
  border-style: solid;
123
- border-color: var(--nile-badge-color-border-color-warning, var(--ng-componentcolors-utility-warning-200));
123
+ border-color: var(--nile-badge-color-border-color-warning, var(--ng-componentcolors-utility-warning-300));
124
124
  background: var(--nile-badge-color-background-warning, var(--ng-componentcolors-utility-warning-50));
125
125
  }
126
126
 
@@ -153,7 +153,7 @@ export const styles = css`
153
153
  }
154
154
 
155
155
  .badge--orange.badge--pill-outline {
156
- border: var(--nile-badge-color-border-width-pill-outline, var(--ng-border-width-1)) solid var(--nile-badge-color-pill-outline-orange, var(--ng-componentcolors-utility-orange-dark-200));
156
+ border: var(--nile-badge-color-border-width-pill-outline, var(--ng-border-width-1)) solid var(--nile-badge-color-pill-outline-orange, var(--ng-componentcolors-utility-orange-300));
157
157
  }
158
158
 
159
159
  .badge--purple.badge--pill-outline {
@@ -181,7 +181,7 @@ export const styles = css`
181
181
  }
182
182
 
183
183
  .badge--warning.badge--pill-outline {
184
- border: var(--nile-badge-color-border-width-pill-outline, var(--ng-border-width-1)) solid var(--nile-badge-color-pill-outline-warning, var(--ng-componentcolors-utility-warning-200));
184
+ border: var(--nile-badge-color-border-width-pill-outline, var(--ng-border-width-1)) solid var(--nile-badge-color-pill-outline-warning, var(--ng-componentcolors-utility-warning-300));
185
185
  }
186
186
 
187
187
  .badge--error.badge--pill-outline {
@@ -202,6 +202,27 @@ export const styles = css`
202
202
  padding: var(--nile-spacing-xxs, var(--ng-spacing-xxs)) var(--nile-spacing-md, var(--ng-spacing-md-alt));
203
203
  border-radius: var(--nile-radius-full, var(--ng-radius-full));
204
204
  }
205
+
206
+ /* Sizes — md is the base .badge rule above, so the default is unchanged. */
207
+ .badge.badge--sm {
208
+ padding: var(--nile-spacing-xxs, var(--ng-spacing-xxs)) var(--nile-spacing-md, var(--ng-spacing-md));
209
+ height: var(--nile-height-22px, var(--ng-height-22px));
210
+ }
211
+
212
+ .badge--sm .badge__content {
213
+ font-size: var(--nile-type-scale-2, var(--ng-font-size-text-xs));
214
+ line-height: var(--nile-type-scale-5, var(--ng-line-height-text-xs));
215
+ }
216
+
217
+ .badge.badge--lg {
218
+ padding: var(--nile-spacing-xs, var(--ng-spacing-xs)) var(--nile-spacing-lg, var(--ng-spacing-lg));
219
+ height: var(--nile-height-28px, var(--ng-height-28px));
220
+ }
221
+
222
+ .badge--lg .badge__content {
223
+ font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
224
+ line-height: var(--nile-type-scale-5, var(--ng-line-height-text-sm));
225
+ }
205
226
  `;
206
227
  export default [styles];
207
228
 
@@ -1,6 +1,7 @@
1
1
  import { expect, fixture, html, elementUpdated } from '@open-wc/testing';
2
2
  import './nile-badge';
3
3
  import NileBadge from './nile-badge';
4
+ import { styles } from './nile-badge.css';
4
5
 
5
6
  describe('NileBadge', () => {
6
7
  // === RENDERING ===
@@ -657,4 +658,90 @@ describe('NileBadge', () => {
657
658
  const el = await fixture<NileBadge>(html`<nile-badge>\u2713 Done</nile-badge>`);
658
659
  expect(el.textContent).to.contain('\u2713');
659
660
  });
661
+
662
+ // === SIZE TESTS ===
663
+ it('101. should have size default to md', async () => {
664
+ const el = await fixture<NileBadge>(html`<nile-badge></nile-badge>`);
665
+ expect(el.size).to.equal('md');
666
+ const span = el.shadowRoot!.querySelector('span');
667
+ expect(span!.classList.contains('badge--md')).to.be.true;
668
+ });
669
+
670
+ it('102. should reflect size attribute', async () => {
671
+ const el = await fixture<NileBadge>(html`<nile-badge size="lg"></nile-badge>`);
672
+ expect(el.getAttribute('size')).to.equal('lg');
673
+ });
674
+
675
+ for (const size of ['sm', 'md', 'lg'] as const) {
676
+ it(`103. should apply only the ${size} size class`, async () => {
677
+ const el = await fixture<NileBadge>(html`<nile-badge size=${size}>Label</nile-badge>`);
678
+ const span = el.shadowRoot!.querySelector('span')!;
679
+ for (const other of ['sm', 'md', 'lg']) {
680
+ expect(span.classList.contains(`badge--${other}`)).to.equal(other === size);
681
+ }
682
+ });
683
+ }
684
+
685
+ it('104. should update size class when size changes', async () => {
686
+ const el = await fixture<NileBadge>(html`<nile-badge>Label</nile-badge>`);
687
+ el.size = 'sm';
688
+ await elementUpdated(el);
689
+ const span = el.shadowRoot!.querySelector('span')!;
690
+ expect(span.classList.contains('badge--sm')).to.be.true;
691
+ expect(span.classList.contains('badge--md')).to.be.false;
692
+ });
693
+
694
+ describe('size dimensions (nxtgen tokens)', () => {
695
+ let tokens: HTMLStyleElement;
696
+
697
+ before(() => {
698
+ tokens = document.createElement('style');
699
+ tokens.textContent = `:root {
700
+ --ng-height-22px: 22px; --ng-height-24px: 24px; --ng-height-28px: 28px;
701
+ --ng-spacing-xxs: 2px; --ng-spacing-xs: 4px; --ng-spacing-md: 8px;
702
+ --ng-spacing-md-alt: 10px; --ng-spacing-lg: 12px;
703
+ }`;
704
+ document.head.appendChild(tokens);
705
+ });
706
+
707
+ after(() => tokens.remove());
708
+
709
+ it('105. should render 22px, 24px and 28px tall for sm, md and lg', async () => {
710
+ const heights: number[] = [];
711
+ for (const size of ['sm', 'md', 'lg']) {
712
+ const el = await fixture<NileBadge>(html`<nile-badge size=${size}>Label</nile-badge>`);
713
+ heights.push(el.shadowRoot!.querySelector('span')!.getBoundingClientRect().height);
714
+ }
715
+ expect(heights).to.deep.equal([22, 24, 28]);
716
+ });
717
+
718
+ it('106. should keep size padding when rounded', async () => {
719
+ const el = await fixture<NileBadge>(html`<nile-badge size="lg" rounded>Label</nile-badge>`);
720
+ const style = getComputedStyle(el.shadowRoot!.querySelector('span')!);
721
+ expect(style.paddingTop).to.equal('4px');
722
+ expect(style.paddingLeft).to.equal('12px');
723
+ });
724
+ });
725
+
726
+ describe('error / orange / warning colour tokens', () => {
727
+ const css = styles.cssText;
728
+ const rule = (selector: string) => css.slice(css.indexOf(`${selector} {`)).split('}')[0];
729
+ const ng = (token: string) => `var(--ng-componentcolors-utility-${token})`;
730
+
731
+ const cases: [string, string, string, string][] = [
732
+ ['error', 'error-50', 'error-200', 'error-700'],
733
+ ['orange', 'orange-50', 'orange-300', 'error-600'],
734
+ ['warning', 'warning-50', 'warning-300', 'warning-700'],
735
+ ];
736
+
737
+ cases.forEach(([variant, fill, border, text], i) => {
738
+ it(`${107 + i}. should map ${variant} to ${fill} / ${border} / ${text}`, () => {
739
+ const base = rule(`.badge--${variant}`);
740
+ expect(base).to.contain(`background-${variant}, ${ng(fill)})`);
741
+ expect(base).to.contain(`border-color-${variant}, ${ng(border)})`);
742
+ expect(base).to.contain(`font-${variant}, ${ng(text)})`);
743
+ expect(rule(`.badge--${variant}.badge--pill-outline`)).to.contain(`pill-outline-${variant}, ${ng(border)})`);
744
+ });
745
+ });
746
+ });
660
747
  });
@@ -84,6 +84,9 @@ export class NileBadge extends NileElement {
84
84
  | 'pill-outline'
85
85
  | 'badge-color'='badge-color';
86
86
 
87
+ /** The badge's size. `md` keeps the existing default dimensions. */
88
+ @property({ reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';
89
+
87
90
  render() {
88
91
  return html`
89
92
  <span
@@ -111,6 +114,9 @@ export class NileBadge extends NileElement {
111
114
  this.rounded ||
112
115
  this.pilltype == 'pill-outline' ||
113
116
  this.pilltype == 'pill-color',
117
+ 'badge--sm': this.size === 'sm',
118
+ 'badge--md': this.size === 'md',
119
+ 'badge--lg': this.size === 'lg',
114
120
  })}
115
121
  >
116
122
  <slot part="content" class="badge__content"></slot>
@@ -19,7 +19,7 @@ export const styles = css`
19
19
  .tippy-box {
20
20
  position: relative;
21
21
  background-color: var(--nile-colors-dark-900, var(--ng-colors-bg-primary-solid));
22
- color: var(--nile-colors-dark-200, var(--ng-colors-text-primary-on-brand));
22
+ color: var(--nile-colors-dark-200, var(--ng-colors-text-white));
23
23
  font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-semibold));
24
24
  border-radius: var(--nile-radius-sm, var(--ng-radius-md));
25
25
  font-size: var(--nile-type-scale-3, var(--ng-font-size-text-xs));
@@ -63,7 +63,7 @@ export const styles = css`
63
63
  font-weight: var(--nile-tooltip-font-weight-sm, var(--ng-font-weight-semibold));
64
64
  line-height: var(--nile-tooltip-line-height-sm, var(--ng-line-height-text-xs));
65
65
  padding: var(--nile-tooltip-padding-y, var(--ng-spacing-md)) var(--nile-tooltip-padding-x, var(--ng-spacing-md));
66
- color: var(--nile-colors-white-base, var(--ng-colors-text-primary-on-brand));
66
+ color: var(--nile-colors-white-base, var(--ng-colors-text-white));
67
67
  pointer-events: none;
68
68
  word-break: break-word;
69
69
  font-family: var(--nile-font-family-inherit, var(--ng-font-family-body));
@@ -496,7 +496,7 @@
496
496
  },
497
497
  {
498
498
  "name": "nile-badge",
499
- "description": "Events:\n\n * `nile-remove` {} - Emitted when the remove button is activated.\n\nSlots:\n\n * ` ` {} - The badge's content.\n\nAttributes:\n\n * `variant` {`\"primary\" | \"success\" | \"normal\" | \"warning\" | \"error\" | \"info\" | \"gray\" | \"brand\" | \"blue-light\" | \"blue\" | \"indigo\" | \"purple\" | \"pink\" | \"orange\" | \"blue-gray\" | \"gray-blue\"`} - The badge's theme variant.\n\n * `rounded` {`boolean`} - Draws a pill-style badge with rounded edges.\n\n * `pilltype` {`\"pill-color\" | \"pill-outline\" | \"badge-color\"`} - \n\nProperties:\n\n * `styles` - \n\n * `variant` {`\"primary\" | \"success\" | \"normal\" | \"warning\" | \"error\" | \"info\" | \"gray\" | \"brand\" | \"blue-light\" | \"blue\" | \"indigo\" | \"purple\" | \"pink\" | \"orange\" | \"blue-gray\" | \"gray-blue\"`} - The badge's theme variant.\n\n * `rounded` {`boolean`} - Draws a pill-style badge with rounded edges.\n\n * `pilltype` {`\"pill-color\" | \"pill-outline\" | \"badge-color\"`} - \n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
499
+ "description": "Events:\n\n * `nile-remove` {} - Emitted when the remove button is activated.\n\nSlots:\n\n * ` ` {} - The badge's content.\n\nAttributes:\n\n * `variant` {`\"primary\" | \"success\" | \"normal\" | \"warning\" | \"error\" | \"info\" | \"gray\" | \"brand\" | \"blue-light\" | \"blue\" | \"indigo\" | \"purple\" | \"pink\" | \"orange\" | \"blue-gray\" | \"gray-blue\"`} - The badge's theme variant.\n\n * `rounded` {`boolean`} - Draws a pill-style badge with rounded edges.\n\n * `pilltype` {`\"pill-color\" | \"pill-outline\" | \"badge-color\"`} - \n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - The badge's size. `md` keeps the existing default dimensions.\n\nProperties:\n\n * `styles` - \n\n * `variant` {`\"primary\" | \"success\" | \"normal\" | \"warning\" | \"error\" | \"info\" | \"gray\" | \"brand\" | \"blue-light\" | \"blue\" | \"indigo\" | \"purple\" | \"pink\" | \"orange\" | \"blue-gray\" | \"gray-blue\"`} - The badge's theme variant.\n\n * `rounded` {`boolean`} - Draws a pill-style badge with rounded edges.\n\n * `pilltype` {`\"pill-color\" | \"pill-outline\" | \"badge-color\"`} - \n\n * `size` {`\"sm\" | \"md\" | \"lg\"`} - The badge's size. `md` keeps the existing default dimensions.\n\n * `BUBBLES` {`boolean`} - \n\n * `COMPOSED` {`boolean`} - \n\n * `CANCELABLE` {`boolean`} - ",
500
500
  "attributes": [
501
501
  {
502
502
  "name": "variant",
@@ -572,6 +572,21 @@
572
572
  }
573
573
  ]
574
574
  },
575
+ {
576
+ "name": "size",
577
+ "description": "`size` {`\"sm\" | \"md\" | \"lg\"`} - The badge's size. `md` keeps the existing default dimensions.\n\nProperty: size\n\nDefault: md",
578
+ "values": [
579
+ {
580
+ "name": "sm"
581
+ },
582
+ {
583
+ "name": "md"
584
+ },
585
+ {
586
+ "name": "lg"
587
+ }
588
+ ]
589
+ },
575
590
  {
576
591
  "name": "onnile-remove",
577
592
  "description": "`nile-remove` {} - Emitted when the remove button is activated."