@navikt/aksel-stylelint 7.33.5 → 7.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -170,4 +170,21 @@ Warns when you try to use deprecated class names.
170
170
  }
171
171
  ```
172
172
 
173
+ ## aksel/no-legacy-classes
174
+
175
+ Warns when trying to to use legacy class names starting with `.navds`. As of version 8.0, all class names are prefixed with `.aksel`, so all old overrides no longer work.
176
+
177
+ We still discourage overriding class names from `@navikt/ds-css`:
178
+
179
+ - Add your own `className` instead of referencing Aksel classes directly.
180
+ - Open a GitHub issue if what you need to do isn't straightforward, and we'll work together to find a solution.
181
+
182
+ ❌ Incorrect:
183
+
184
+ ```css
185
+ .navds-button {
186
+ ^^^^^^^^^^^^^
187
+ }
188
+ ```
189
+
173
190
  🐛 Found a bug? https://github.com/navikt/aksel/issues
package/dist/index.css CHANGED
@@ -5,7 +5,7 @@
5
5
  */
6
6
 
7
7
  :root, :host {
8
- --ax-version: "7.33.5";
8
+ --ax-version: "7.35.0";
9
9
  --a-breakpoint-xs: 0;
10
10
  --a-breakpoint-sm: 480px;
11
11
  --a-breakpoint-sm-down: 479px;
@@ -42,7 +42,7 @@
42
42
  --a-font-weight-regular: 400;
43
43
  --a-z-index-popover: 1000;
44
44
  --a-z-index-focus: 10;
45
- --a-z-index-tooltip: 3000;
45
+ --a-z-index-tooltip: 2147483647;
46
46
  --a-border-radius-small: 2px;
47
47
  --a-border-radius-medium: 4px;
48
48
  --a-border-radius-large: 8px;
@@ -1658,6 +1658,232 @@ body,
1658
1658
  }
1659
1659
  }
1660
1660
 
1661
+ /* -------------------- InfoCard, LocalAlert, GlobalAlert ------------------- */
1662
+
1663
+ .navds-base-alert {
1664
+ display: grid;
1665
+ border-radius: var(--a-border-radius-xlarge);
1666
+ overflow: clip;
1667
+ height: fit-content;
1668
+
1669
+ --__ac-base-alert-pi: var(--a-spacing-5);
1670
+ --__ac-base-alert-content-p: var(--a-spacing-3) var(--__ac-base-alert-pi) var(--a-spacing-4) var(--__ac-base-alert-pi);
1671
+ --__ac-base-alert-title-pb: var(--a-spacing-05);
1672
+ --__ac-base-alert-header-max-width: 37.5rem;
1673
+ }
1674
+
1675
+ .navds-base-alert[data-size="small"] {
1676
+ --__ac-base-alert-pi: var(--a-spacing-4);
1677
+ --__ac-base-alert-content-p: var(--a-spacing-2) var(--a-spacing-4) var(--a-spacing-3) var(--a-spacing-4);
1678
+ --__ac-base-alert-title-pb: var(--a-spacing-1);
1679
+ }
1680
+
1681
+ .navds-base-alert[data-variant="moderate"] {
1682
+ outline: 1px solid;
1683
+ outline-offset: -1px;
1684
+ }
1685
+
1686
+ .navds-base-alert[data-variant="strong"] {
1687
+ outline: 4px solid;
1688
+ outline-offset: -4px;
1689
+ }
1690
+
1691
+ .navds-base-alert[data-global="true"] {
1692
+ border-radius: 0;
1693
+ }
1694
+
1695
+ .navds-base-alert[data-color="accent"] {
1696
+ outline-color: var(--a-border-action);
1697
+ }
1698
+
1699
+ .navds-base-alert[data-color="accent"][data-variant="moderate"] .navds-base-alert__header {
1700
+ background: var(--a-surface-action-subtle);
1701
+ color: var(--a-blue-800);
1702
+ border-color: var(--a-blue-200);
1703
+ }
1704
+
1705
+ .navds-base-alert[data-color="neutral"] {
1706
+ outline-color: var(--a-gray-700);
1707
+ }
1708
+
1709
+ .navds-base-alert[data-color="neutral"][data-variant="moderate"] .navds-base-alert__header {
1710
+ background: var(--a-surface-neutral-subtle);
1711
+ color: var(--a-gray-800);
1712
+ border-color: var(--a-gray-200);
1713
+ }
1714
+
1715
+ .navds-base-alert[data-color="neutral"][data-variant="strong"] .navds-base-alert__header {
1716
+ background: var(--a-surface-neutral);
1717
+ color: var(--a-text-on-neutral);
1718
+ }
1719
+
1720
+ .navds-base-alert[data-color="info"] {
1721
+ outline-color: var(--a-border-info);
1722
+ }
1723
+
1724
+ .navds-base-alert[data-color="info"][data-variant="moderate"] .navds-base-alert__header {
1725
+ background: var(--a-surface-info-subtle);
1726
+ color: var(--a-lightblue-900);
1727
+ border-color: var(--a-lightblue-200);
1728
+ }
1729
+
1730
+ .navds-base-alert[data-color="success"] {
1731
+ outline-color: var(--a-border-success);
1732
+ }
1733
+
1734
+ .navds-base-alert[data-color="success"][data-variant="moderate"] .navds-base-alert__header {
1735
+ background: var(--a-surface-success-subtle);
1736
+ color: var(--a-green-800);
1737
+ border-color: var(--a-green-200);
1738
+ }
1739
+
1740
+ .navds-base-alert[data-color="success"][data-variant="strong"] .navds-base-alert__header {
1741
+ background: var(--a-surface-success);
1742
+ color: var(--a-text-on-success);
1743
+ }
1744
+
1745
+ .navds-base-alert[data-color="warning"] {
1746
+ outline-color: var(--a-surface-warning);
1747
+ }
1748
+
1749
+ .navds-base-alert[data-color="warning"][data-variant="moderate"] .navds-base-alert__header {
1750
+ background: var(--a-surface-warning-subtle);
1751
+ color: var(--a-orange-900);
1752
+ border-color: var(--a-orange-200);
1753
+ }
1754
+
1755
+ .navds-base-alert[data-color="warning"][data-variant="strong"] .navds-base-alert__header {
1756
+ background: var(--a-surface-warning);
1757
+ color: var(--a-text-on-warning);
1758
+ }
1759
+
1760
+ .navds-base-alert[data-color="danger"] {
1761
+ outline-color: var(--a-border-danger);
1762
+ }
1763
+
1764
+ .navds-base-alert[data-color="danger"][data-variant="moderate"] .navds-base-alert__header {
1765
+ background: var(--a-surface-danger-subtle);
1766
+ color: var(--a-red-800);
1767
+ border-color: var(--a-red-200);
1768
+ }
1769
+
1770
+ .navds-base-alert[data-color="danger"][data-variant="strong"] .navds-base-alert__header {
1771
+ background: var(--a-surface-danger);
1772
+ color: var(--a-text-on-danger);
1773
+ }
1774
+
1775
+ .navds-base-alert[data-color="brand-magenta"] {
1776
+ outline-color: var(--a-border-alt-1);
1777
+ }
1778
+
1779
+ .navds-base-alert[data-color="brand-magenta"][data-variant="moderate"] .navds-base-alert__header {
1780
+ background: var(--a-surface-alt-1-subtle);
1781
+ color: var(--a-purple-800);
1782
+ border-color: var(--a-purple-200);
1783
+ }
1784
+
1785
+ .navds-base-alert[data-color="brand-beige"] {
1786
+ outline-color: var(--a-border-warning);
1787
+ }
1788
+
1789
+ .navds-base-alert[data-color="brand-beige"][data-variant="moderate"] .navds-base-alert__header {
1790
+ background: var(--a-surface-warning-subtle);
1791
+ color: var(--a-orange-900);
1792
+ border-color: var(--a-orange-200);
1793
+ }
1794
+
1795
+ .navds-base-alert[data-color="brand-blue"] {
1796
+ outline-color: var(--a-border-alt-3);
1797
+ }
1798
+
1799
+ .navds-base-alert[data-color="brand-blue"][data-variant="moderate"] .navds-base-alert__header {
1800
+ background: var(--a-surface-alt-3-subtle);
1801
+ color: var(--a-deepblue-800);
1802
+ border-color: var(--a-deepblue-200);
1803
+ }
1804
+
1805
+ .navds-base-alert[data-color="meta-lime"] {
1806
+ outline-color: var(--a-border-alt-2);
1807
+ }
1808
+
1809
+ .navds-base-alert[data-color="meta-lime"][data-variant="moderate"] .navds-base-alert__header {
1810
+ background: var(--a-surface-alt-2-subtle);
1811
+ color: var(--a-limegreen-900);
1812
+ border-color: var(--a-limegreen-200);
1813
+ }
1814
+
1815
+ .navds-base-alert[data-color="meta-purple"] {
1816
+ outline-color: var(--a-border-alt-1);
1817
+ }
1818
+
1819
+ .navds-base-alert[data-color="meta-purple"][data-variant="moderate"] .navds-base-alert__header {
1820
+ background: var(--a-surface-alt-1-subtle);
1821
+ color: var(--a-purple-800);
1822
+ border-color: var(--a-purple-200);
1823
+ }
1824
+
1825
+ .navds-base-alert__header {
1826
+ display: flex;
1827
+ align-items: flex-start;
1828
+ gap: var(--a-spacing-2);
1829
+ padding: var(--a-spacing-2) var(--__ac-base-alert-pi);
1830
+ border-bottom: 1px solid;
1831
+ }
1832
+
1833
+ .navds-base-alert[data-global="true"] .navds-base-alert__header {
1834
+ padding-inline: max(var(--__ac-base-alert-pi), calc((100% - var(--__ac-base-alert-header-max-width)) / 2));
1835
+ }
1836
+
1837
+ .navds-base-alert[data-variant="strong"] .navds-base-alert__header {
1838
+ border-bottom: none;
1839
+ }
1840
+
1841
+ .navds-base-alert__header:only-child {
1842
+ border-bottom: none;
1843
+ }
1844
+
1845
+ .navds-base-alert__icon {
1846
+ font-size: 1.5rem;
1847
+ margin-top: var(--a-spacing-1);
1848
+ display: grid;
1849
+ }
1850
+
1851
+ .navds-base-alert__title {
1852
+ padding-block: var(--__ac-base-alert-title-pb);
1853
+ }
1854
+
1855
+ .navds-base-alert__content {
1856
+ padding: var(--__ac-base-alert-content-p);
1857
+ background-color: var(--a-bg-default);
1858
+ }
1859
+
1860
+ .navds-base-alert[data-global="true"] .navds-base-alert__content {
1861
+ padding-inline: max(var(--__ac-base-alert-pi), calc((100% - var(--__ac-base-alert-header-max-width)) / 2));
1862
+ }
1863
+
1864
+ .navds-base-alert__close-button.navds-base-alert__close-button {
1865
+ margin-left: auto;
1866
+
1867
+ /* Moved focus-outline over wrapper outline */
1868
+ z-index: 1;
1869
+ }
1870
+
1871
+ .navds-base-alert__close-button.navds-base-alert__close-button:focus-visible {
1872
+ box-shadow: 0 0 0 3px white;
1873
+ }
1874
+
1875
+ .navds-base-alert__close-button.navds-base-alert__close-button.navds-base-alert__close-button.navds-base-alert__close-button {
1876
+ color: var(--a-text-on-inverted);
1877
+ }
1878
+
1879
+ .navds-base-alert[data-color="warning"] .navds-base-alert__close-button.navds-base-alert__close-button {
1880
+ color: var(--a-text-default);
1881
+ }
1882
+
1883
+ :is(.navds-base-alert[data-color="warning"] .navds-base-alert__close-button.navds-base-alert__close-button):active {
1884
+ color: var(--a-text-on-inverted);
1885
+ }
1886
+
1661
1887
  .navds-button {
1662
1888
  --__ac-button-padding: var(--a-spacing-3) var(--a-spacing-5);
1663
1889
 
@@ -5732,6 +5958,52 @@ li.navds-file-item {
5732
5958
  }
5733
5959
  }
5734
5960
 
5961
+ .navds-inline-message {
5962
+ display: flex;
5963
+ gap: var(--a-spacing-1);
5964
+ }
5965
+
5966
+ .navds-inline-message[data-color="info"] {
5967
+ color: var(--a-lightblue-900);
5968
+ }
5969
+
5970
+ .navds-inline-message[data-color="info"] .navds-inline-message__icon {
5971
+ color: var(--a-icon-info);
5972
+ }
5973
+
5974
+ .navds-inline-message[data-color="success"] {
5975
+ color: var(--a-green-900);
5976
+ }
5977
+
5978
+ .navds-inline-message[data-color="success"] .navds-inline-message__icon {
5979
+ color: var(--a-icon-success);
5980
+ }
5981
+
5982
+ .navds-inline-message[data-color="danger"] {
5983
+ color: var(--a-red-900);
5984
+ }
5985
+
5986
+ .navds-inline-message[data-color="danger"] .navds-inline-message__icon {
5987
+ color: var(--a-icon-danger);
5988
+ }
5989
+
5990
+ .navds-inline-message[data-color="warning"] {
5991
+ color: var(--a-orange-900);
5992
+ }
5993
+
5994
+ .navds-inline-message[data-color="warning"] .navds-inline-message__icon {
5995
+ color: var(--a-icon-warning);
5996
+ }
5997
+
5998
+ .navds-inline-message__icon {
5999
+ font-size: 1.5rem;
6000
+ flex: 0 0 auto;
6001
+ }
6002
+
6003
+ .navds-inline-message[data-size="small"] .navds-inline-message__icon {
6004
+ font-size: 1.25rem;
6005
+ }
6006
+
5735
6007
  .navds-internalheader {
5736
6008
  display: flex;
5737
6009
  align-self: stretch;
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.messages = void 0;
7
+ const postcss_selector_parser_1 = __importDefault(require("postcss-selector-parser"));
8
+ const stylelint_1 = __importDefault(require("stylelint"));
9
+ const ruleName = "aksel/no-legacy-classes";
10
+ const url = "https://github.com/navikt/aksel/blob/main/%40navikt/aksel-stylelint/README.md#aksel/no-legacy-classes";
11
+ const prefix = "navds-";
12
+ exports.messages = stylelint_1.default.utils.ruleMessages(ruleName, {
13
+ unexpected: (value) => `".${value}" no longer has any effect.\n\n` +
14
+ "As of Aksel version 8.0, all class names from '@navikt/ds-css' are prefixed with '.aksel-'.\n" +
15
+ "Since this class name starts with '.navds-', it's safe to assume that it no longer works as intended.\n" +
16
+ "We still discourage overriding the styling from Aksel when possible.",
17
+ });
18
+ const ruleFunction = () => {
19
+ return (postcssRoot, postcssResult) => {
20
+ postcssRoot.walkRules((node) => {
21
+ (0, postcss_selector_parser_1.default)((selectors) => {
22
+ selectors.walkClasses((className) => {
23
+ if (!className.value.startsWith(prefix)) {
24
+ return;
25
+ }
26
+ stylelint_1.default.utils.report({
27
+ message: exports.messages.unexpected(className.value),
28
+ node,
29
+ result: postcssResult,
30
+ ruleName,
31
+ word: className.value,
32
+ });
33
+ });
34
+ }).processSync(node.selector);
35
+ });
36
+ };
37
+ };
38
+ ruleFunction.ruleName = ruleName;
39
+ ruleFunction.messages = exports.messages;
40
+ ruleFunction.meta = { url };
41
+ exports.default = ruleFunction;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ const stylelint_test_rule_node_1 = require("stylelint-test-rule-node");
37
+ const _1 = __importStar(require("."));
38
+ (0, stylelint_test_rule_node_1.testRule)({
39
+ plugins: ["./dist/index.js"],
40
+ ruleName: _1.default.ruleName,
41
+ config: true,
42
+ accept: [{ code: ".foo-navds-bar {}", description: "allowed class name" }],
43
+ reject: [
44
+ {
45
+ code: ".foo, \n .navds-button \n .bar {}",
46
+ description: "selector with disallowed class name .navds-*",
47
+ message: _1.messages.unexpected("navds-button"),
48
+ line: 2,
49
+ endLine: 2,
50
+ column: 3,
51
+ endColumn: 15,
52
+ },
53
+ ],
54
+ });
@@ -10,6 +10,7 @@ const aksel_design_token_no_global_override_1 = __importDefault(require("./aksel
10
10
  const aksel_no_class_override_1 = __importDefault(require("./aksel-no-class-override"));
11
11
  const aksel_no_deprecated_classes_1 = __importDefault(require("./aksel-no-deprecated-classes"));
12
12
  const aksel_no_internal_tokens_1 = __importDefault(require("./aksel-no-internal-tokens"));
13
+ const aksel_no_legacy_classes_1 = __importDefault(require("./aksel-no-legacy-classes"));
13
14
  exports.rules = {
14
15
  "aksel/design-token-exists": aksel_design_token_exists_1.default,
15
16
  "aksel/design-token-no-global-override": aksel_design_token_no_global_override_1.default,
@@ -17,4 +18,5 @@ exports.rules = {
17
18
  "aksel/no-internal-tokens": aksel_no_internal_tokens_1.default,
18
19
  "aksel/no-class-override": aksel_no_class_override_1.default,
19
20
  "aksel/no-deprecated-classes": aksel_no_deprecated_classes_1.default,
21
+ "aksel/no-legacy-classes": aksel_no_legacy_classes_1.default,
20
22
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navikt/aksel-stylelint",
3
- "version": "7.33.5",
3
+ "version": "7.35.0",
4
4
  "author": "Aksel | Nav",
5
5
  "homepage": "https://aksel.nav.no/grunnleggende/kode/stylelint",
6
6
  "repository": {
@@ -38,8 +38,8 @@
38
38
  "dev": "yarn watch:lint"
39
39
  },
40
40
  "devDependencies": {
41
- "@navikt/ds-css": "^7.33.5",
42
- "@navikt/ds-tokens": "^7.33.5",
41
+ "@navikt/ds-css": "^7.35.0",
42
+ "@navikt/ds-tokens": "^7.35.0",
43
43
  "concurrently": "9.2.1",
44
44
  "postcss-selector-parser": "^7.1.0",
45
45
  "postcss-value-parser": "^4.2.0",