@fremtind/jokul 5.0.0-next.13 → 5.0.0-next.14

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 (88) hide show
  1. package/build/build-stats.html +1 -1
  2. package/build/cjs/components/expander/Accordion.cjs +2 -0
  3. package/build/cjs/components/expander/Accordion.cjs.map +1 -0
  4. package/build/cjs/components/expander/Accordion.d.cts +2 -0
  5. package/build/cjs/components/expander/ExpandablePanel.cjs +1 -1
  6. package/build/cjs/components/expander/ExpandablePanel.cjs.map +1 -1
  7. package/build/cjs/components/expander/ExpandablePanelContent.cjs +1 -1
  8. package/build/cjs/components/expander/ExpandablePanelContent.cjs.map +1 -1
  9. package/build/cjs/components/expander/index.d.cts +1 -1
  10. package/build/cjs/components/expander/types.d.cts +5 -2
  11. package/build/cjs/components/link-list/LinkList.cjs +1 -1
  12. package/build/cjs/components/link-list/LinkList.cjs.map +1 -1
  13. package/build/cjs/components/link-list/LinkList.d.cts +1 -1
  14. package/build/cjs/components/link-list/types.d.cts +1 -0
  15. package/build/cjs/utilities/types.cjs +1 -1
  16. package/build/cjs/utilities/types.cjs.map +1 -1
  17. package/build/cjs/utilities/types.d.cts +1 -1
  18. package/build/es/components/expander/Accordion.d.ts +2 -0
  19. package/build/es/components/expander/Accordion.js +2 -0
  20. package/build/es/components/expander/Accordion.js.map +1 -0
  21. package/build/es/components/expander/ExpandablePanel.js +1 -1
  22. package/build/es/components/expander/ExpandablePanel.js.map +1 -1
  23. package/build/es/components/expander/ExpandablePanelContent.js +1 -1
  24. package/build/es/components/expander/ExpandablePanelContent.js.map +1 -1
  25. package/build/es/components/expander/index.d.ts +1 -1
  26. package/build/es/components/expander/types.d.ts +5 -2
  27. package/build/es/components/link-list/LinkList.d.ts +1 -1
  28. package/build/es/components/link-list/LinkList.js +1 -1
  29. package/build/es/components/link-list/LinkList.js.map +1 -1
  30. package/build/es/components/link-list/types.d.ts +1 -0
  31. package/build/es/utilities/types.d.ts +1 -1
  32. package/build/es/utilities/types.js +1 -1
  33. package/build/es/utilities/types.js.map +1 -1
  34. package/codemods/__tests__/import-paths.test.mjs +131 -32
  35. package/codemods/import-paths.mjs +38 -14
  36. package/codemods/transforms/expandable-panel.mjs +41 -0
  37. package/package.json +1 -1
  38. package/styles/base.css +95 -702
  39. package/styles/base.min.css +1 -1
  40. package/styles/components/countdown/countdown.css +2 -2
  41. package/styles/components/countdown/countdown.min.css +1 -1
  42. package/styles/components/expander/_index.scss +1 -0
  43. package/styles/components/expander/accordion.css +21 -0
  44. package/styles/components/expander/accordion.min.css +1 -0
  45. package/styles/components/expander/accordion.scss +24 -0
  46. package/styles/components/expander/expandable.css +16 -27
  47. package/styles/components/expander/expandable.min.css +1 -1
  48. package/styles/components/expander/expandable.scss +5 -19
  49. package/styles/components/feedback/feedback.css +2 -2
  50. package/styles/components/feedback/feedback.min.css +1 -1
  51. package/styles/components/file-input/file-input.css +9 -9
  52. package/styles/components/file-input/file-input.min.css +1 -1
  53. package/styles/components/input-group/input-group.css +2 -2
  54. package/styles/components/input-group/input-group.min.css +1 -1
  55. package/styles/components/link-list/link-list.css +6 -1
  56. package/styles/components/link-list/link-list.min.css +1 -1
  57. package/styles/components/link-list/link-list.scss +8 -1
  58. package/styles/components/loader/loader.css +6 -6
  59. package/styles/components/loader/loader.min.css +1 -1
  60. package/styles/components/loader/skeleton-loader.css +3 -3
  61. package/styles/components/loader/skeleton-loader.min.css +1 -1
  62. package/styles/components/message/message.css +2 -2
  63. package/styles/components/message/message.min.css +1 -1
  64. package/styles/components/progress-bar/progress-bar.css +1 -1
  65. package/styles/components/progress-bar/progress-bar.min.css +1 -1
  66. package/styles/components/segmented-control/segmented-control.css +2 -2
  67. package/styles/components/segmented-control/segmented-control.min.css +1 -1
  68. package/styles/components/system-message/system-message.css +2 -2
  69. package/styles/components/system-message/system-message.min.css +1 -1
  70. package/styles/components/toast/toast.css +4 -4
  71. package/styles/components/toast/toast.min.css +1 -1
  72. package/styles/components.css +67 -52
  73. package/styles/components.min.css +1 -1
  74. package/styles/tailwind.css +95 -95
  75. package/styles/theme/_color-scheme.scss +95 -95
  76. package/styles/theme/_index.scss +0 -4
  77. package/styles/theme/brands/dnb/_color-scheme.scss +0 -121
  78. package/styles/theme/brands/dnb/_fonts.scss +0 -46
  79. package/styles/theme/brands/dnb/_index.scss +0 -2
  80. package/styles/theme/brands/eika/_color-scheme.scss +0 -121
  81. package/styles/theme/brands/eika/_fonts.scss +0 -46
  82. package/styles/theme/brands/eika/_index.scss +0 -2
  83. package/styles/theme/brands/fremtind/_color-scheme.scss +0 -121
  84. package/styles/theme/brands/fremtind/_fonts.scss +0 -30
  85. package/styles/theme/brands/fremtind/_index.scss +0 -2
  86. package/styles/theme/brands/sparebank1/_color-scheme.scss +0 -121
  87. package/styles/theme/brands/sparebank1/_fonts.scss +0 -38
  88. package/styles/theme/brands/sparebank1/_index.scss +0 -2
@@ -1,5 +1,5 @@
1
- import test from "node:test";
2
1
  import assert from "node:assert/strict";
2
+ import test from "node:test";
3
3
  import { transformImportPaths } from "../import-paths.mjs";
4
4
 
5
5
  test("migrates core, styles and utilities imports", () => {
@@ -16,7 +16,9 @@ import type { WithChildren } from "@fremtind/jokul/core";
16
16
  true,
17
17
  );
18
18
  assert.equal(
19
- result.text.includes('import "@fremtind/jokul/styles/components.scss";'),
19
+ result.text.includes(
20
+ 'import "@fremtind/jokul/styles/components.scss";',
21
+ ),
20
22
  true,
21
23
  );
22
24
  assert.equal(
@@ -64,9 +66,7 @@ import "@fremtind/jokul/styles/components/select";
64
66
  const result = transformImportPaths(source, "/tmp/MyForm.tsx");
65
67
 
66
68
  assert.equal(
67
- result.text.includes(
68
- '@fremtind/jokul/styles/components/beta/select',
69
- ),
69
+ result.text.includes("@fremtind/jokul/styles/components/beta/select"),
70
70
  true,
71
71
  );
72
72
  assert.deepEqual(result.warnings, []);
@@ -114,13 +114,14 @@ test("removes css @import of webfonts.css", () => {
114
114
 
115
115
  assert.equal(result.text.includes("webfonts"), false);
116
116
  assert.equal(
117
- result.text.includes('@import "@fremtind/jokul/styles/components.css";'),
117
+ result.text.includes(
118
+ '@import "@fremtind/jokul/styles/components.css";',
119
+ ),
118
120
  true,
119
121
  );
120
122
  assert.deepEqual(result.warnings, []);
121
123
  });
122
124
 
123
-
124
125
  test("renames Fremtind Material Symbols font-family", () => {
125
126
  const source = `.icon {
126
127
  font-family: "Fremtind Material Symbols", "Fremtind Material Symbols Fallback", sans-serif;
@@ -129,10 +130,7 @@ test("renames Fremtind Material Symbols font-family", () => {
129
130
 
130
131
  const result = transformImportPaths(source, "/tmp/icons.scss");
131
132
 
132
- assert.equal(
133
- result.text.includes("Fremtind Material Symbols"),
134
- false,
135
- );
133
+ assert.equal(result.text.includes("Fremtind Material Symbols"), false);
136
134
  assert.equal(
137
135
  result.text.includes(
138
136
  '"Jokul Icons", "Jokul Icons Fallback", sans-serif',
@@ -150,10 +148,7 @@ test("renames Fremtind Material Symbols inside CSS files too", () => {
150
148
 
151
149
  const result = transformImportPaths(source, "/tmp/icons.css");
152
150
 
153
- assert.equal(
154
- result.text.includes("Fremtind Material Symbols"),
155
- false,
156
- );
151
+ assert.equal(result.text.includes("Fremtind Material Symbols"), false);
157
152
  assert.equal(result.text.includes("'Jokul Icons'"), true);
158
153
  });
159
154
 
@@ -196,8 +191,14 @@ test("renames CSS container-high and container-low tokens", () => {
196
191
 
197
192
  const result = transformImportPaths(source, "/tmp/card.css");
198
193
 
199
- assert.equal(result.text.includes("--jkl-color-background-container-high"), false);
200
- assert.equal(result.text.includes("--jkl-color-background-container-low"), false);
194
+ assert.equal(
195
+ result.text.includes("--jkl-color-background-container-high"),
196
+ false,
197
+ );
198
+ assert.equal(
199
+ result.text.includes("--jkl-color-background-container-low"),
200
+ false,
201
+ );
201
202
  assert.equal(
202
203
  result.text.split("--jkl-color-background-container").length - 1,
203
204
  2,
@@ -215,10 +216,22 @@ test("renames CSS alert tokens to feedback tokens", () => {
215
216
  const result = transformImportPaths(source, "/tmp/alerts.css");
216
217
 
217
218
  assert.equal(result.text.includes("--jkl-color-background-alert-"), false);
218
- assert.equal(result.text.includes("--jkl-color-info-background-container"), true);
219
- assert.equal(result.text.includes("--jkl-color-warning-background-container"), true);
220
- assert.equal(result.text.includes("--jkl-color-error-background-container"), true);
221
- assert.equal(result.text.includes("--jkl-color-success-background-container"), true);
219
+ assert.equal(
220
+ result.text.includes("--jkl-color-info-background-container"),
221
+ true,
222
+ );
223
+ assert.equal(
224
+ result.text.includes("--jkl-color-warning-background-container"),
225
+ true,
226
+ );
227
+ assert.equal(
228
+ result.text.includes("--jkl-color-error-background-container"),
229
+ true,
230
+ );
231
+ assert.equal(
232
+ result.text.includes("--jkl-color-success-background-container"),
233
+ true,
234
+ );
222
235
  });
223
236
 
224
237
  test("warns about removed interactive tokens", () => {
@@ -297,7 +310,10 @@ test("renames container-inverted to background-contrast", () => {
297
310
 
298
311
  const result = transformImportPaths(source, "/tmp/inverted.css");
299
312
 
300
- assert.equal(result.text.includes("--jkl-color-background-container-inverted"), false);
313
+ assert.equal(
314
+ result.text.includes("--jkl-color-background-container-inverted"),
315
+ false,
316
+ );
301
317
  assert.equal(result.text.includes("--jkl-color-background-contrast"), true);
302
318
  assert.deepEqual(result.warnings, []);
303
319
  });
@@ -364,15 +380,25 @@ test("renames container-high but leaves sibling container-low and base container
364
380
 
365
381
  const result = transformImportPaths(source, "/tmp/x.css");
366
382
 
367
- assert.equal(result.text.includes("--jkl-color-background-container-high"), false);
368
- assert.equal(result.text.includes("--jkl-color-background-container-low"), false);
369
- assert.equal(result.text.includes("var(--jkl-color-background-container)"), true,
370
- "base container token must survive unchanged");
383
+ assert.equal(
384
+ result.text.includes("--jkl-color-background-container-high"),
385
+ false,
386
+ );
387
+ assert.equal(
388
+ result.text.includes("--jkl-color-background-container-low"),
389
+ false,
390
+ );
391
+ assert.equal(
392
+ result.text.includes("var(--jkl-color-background-container)"),
393
+ true,
394
+ "base container token must survive unchanged",
395
+ );
371
396
  assert.equal(result.replacements, 2);
372
397
  });
373
398
 
374
399
  test("does not rename alert-info token that has a longer suffix", () => {
375
- const source = ".x { background: var(--jkl-color-background-alert-info-extra); }";
400
+ const source =
401
+ ".x { background: var(--jkl-color-background-alert-info-extra); }";
376
402
 
377
403
  const result = transformImportPaths(source, "/tmp/x.css");
378
404
 
@@ -392,7 +418,10 @@ test("renames token used as a custom property definition, not just inside var()"
392
418
 
393
419
  assert.equal(result.text.includes("--jkl-color-background-action:"), false);
394
420
  assert.equal(result.text.includes("--jkl-color-text-inverted:"), false);
395
- assert.equal(result.text.includes("--jkl-color-background-contrast:"), true);
421
+ assert.equal(
422
+ result.text.includes("--jkl-color-background-contrast:"),
423
+ true,
424
+ );
396
425
  assert.equal(result.text.includes("--jkl-color-text-on-contrast:"), true);
397
426
  });
398
427
 
@@ -430,7 +459,10 @@ test("renames only the fallback font-family if primary is absent", () => {
430
459
 
431
460
  const result = transformImportPaths(source, "/tmp/icons.css");
432
461
 
433
- assert.equal(result.text.includes("Fremtind Material Symbols Fallback"), false);
462
+ assert.equal(
463
+ result.text.includes("Fremtind Material Symbols Fallback"),
464
+ false,
465
+ );
434
466
  assert.equal(result.text.includes("Jokul Icons Fallback"), true);
435
467
  assert.equal(result.replacements, 1);
436
468
  });
@@ -618,8 +650,14 @@ test("warns about bg-background-interactive Tailwind class", () => {
618
650
 
619
651
  const result = transformImportPaths(source, "/tmp/cmp.tsx");
620
652
 
621
- assert.equal(result.warnings.some((w) => /background-interactive/.test(w)), true);
622
- assert.equal(result.warnings.filter((w) => /background-interactive/.test(w)).length, 1);
653
+ assert.equal(
654
+ result.warnings.some((w) => /background-interactive/.test(w)),
655
+ true,
656
+ );
657
+ assert.equal(
658
+ result.warnings.filter((w) => /background-interactive/.test(w)).length,
659
+ 1,
660
+ );
623
661
  });
624
662
 
625
663
  test("warns about border-border-separator Tailwind class", () => {
@@ -627,7 +665,12 @@ test("warns about border-border-separator Tailwind class", () => {
627
665
 
628
666
  const result = transformImportPaths(source, "/tmp/cmp.tsx");
629
667
 
630
- assert.equal(result.warnings.some((w) => /border-border-separator/.test(w) || /kantklasser/.test(w)), true);
668
+ assert.equal(
669
+ result.warnings.some(
670
+ (w) => /border-border-separator/.test(w) || /kantklasser/.test(w),
671
+ ),
672
+ true,
673
+ );
631
674
  });
632
675
 
633
676
  // --- does not warn about valid 5.0 patterns ---
@@ -646,3 +689,59 @@ test("does not warn about valid 5.0 patterns", () => {
646
689
 
647
690
  assert.deepEqual(result.warnings, []);
648
691
  });
692
+
693
+ test('ExpandablePanel: fjerner variant="fill" prop (fill er nå default)', () => {
694
+ const source = `<ExpandablePanel variant="fill" open={open}>`;
695
+ const result = transformImportPaths(source, "/tmp/MyPage.tsx");
696
+ assert.equal(result.text, "<ExpandablePanel open={open}>");
697
+ assert.equal(result.changed, true);
698
+ });
699
+
700
+ test("ExpandablePanel: fjerner variant={'fill'} prop", () => {
701
+ const source = `<ExpandablePanel variant={'fill'}>`;
702
+ const result = transformImportPaths(source, "/tmp/MyPage.tsx");
703
+ assert.equal(result.text, "<ExpandablePanel>");
704
+ assert.equal(result.changed, true);
705
+ });
706
+
707
+ test('ExpandablePanel: endrer variant="stroke" til outlined', () => {
708
+ const source = `<ExpandablePanel variant="stroke" className="my-panel">`;
709
+ const result = transformImportPaths(source, "/tmp/MyPage.tsx");
710
+ assert.equal(
711
+ result.text,
712
+ `<ExpandablePanel outlined className="my-panel">`,
713
+ );
714
+ assert.equal(result.changed, true);
715
+ });
716
+
717
+ test("ExpandablePanel: endrer variant={'stroke'} til outlined", () => {
718
+ const source = `<ExpandablePanel variant={'stroke'}>`;
719
+ const result = transformImportPaths(source, "/tmp/MyPage.tsx");
720
+ assert.equal(result.text, "<ExpandablePanel outlined>");
721
+ assert.equal(result.changed, true);
722
+ });
723
+
724
+ test("ExpandablePanel: endrer CSS-klasse jkl-expandable--stroke til jkl-expandable-panel--outlined", () => {
725
+ const source = ".jkl-expandable--stroke { border-color: red; }";
726
+ const result = transformImportPaths(source, "/tmp/custom.scss");
727
+ assert.equal(
728
+ result.text,
729
+ ".jkl-expandable-panel--outlined { border-color: red; }",
730
+ );
731
+ assert.equal(result.changed, true);
732
+ });
733
+
734
+ test("ExpandablePanel: håndterer flerlinjet JSX korrekt", () => {
735
+ const source = `<ExpandablePanel
736
+ variant="fill"
737
+ open={open}
738
+ >`;
739
+ const result = transformImportPaths(source, "/tmp/MyPage.tsx");
740
+ assert.equal(
741
+ result.text,
742
+ `<ExpandablePanel
743
+ open={open}
744
+ >`,
745
+ );
746
+ assert.equal(result.changed, true);
747
+ });
@@ -1,15 +1,19 @@
1
- import { readdir, readFile, stat, writeFile } from "node:fs/promises";
1
+ import { readFile, readdir, stat, writeFile } from "node:fs/promises";
2
2
  import path from "node:path";
3
3
 
4
4
  import {
5
- applyDirectReplacements,
5
+ applyCssTokenRenames,
6
+ applyTailwindColorRenames,
7
+ } from "./transforms/color-tokens.mjs";
8
+ import { applyExpandablePanelTransforms } from "./transforms/expandable-panel.mjs";
9
+ import { applyFontFamilyReplacements } from "./transforms/font-family.mjs";
10
+ import {
11
+ BASE_OR_COMPONENT_CSS_PATTERN,
6
12
  applyBetaStyleReplacements,
13
+ applyDirectReplacements,
7
14
  removeRedundantWebfontsCssImport,
8
15
  reorderConfiguredFontImport,
9
- BASE_OR_COMPONENT_CSS_PATTERN,
10
16
  } from "./transforms/import-specifiers.mjs";
11
- import { applyCssTokenRenames, applyTailwindColorRenames } from "./transforms/color-tokens.mjs";
12
- import { applyFontFamilyReplacements } from "./transforms/font-family.mjs";
13
17
  import { collectManualMigrationWarnings } from "./transforms/warnings.mjs";
14
18
 
15
19
  const TEXT_EXTENSIONS = new Set([
@@ -51,7 +55,9 @@ const IGNORED_FILE_PATTERNS = [
51
55
 
52
56
  function shouldIgnoreFile(filePath) {
53
57
  const normalizedPath = filePath.split(path.sep).join("/");
54
- return IGNORED_FILE_PATTERNS.some((pattern) => normalizedPath.includes(pattern));
58
+ return IGNORED_FILE_PATTERNS.some((pattern) =>
59
+ normalizedPath.includes(pattern),
60
+ );
55
61
  }
56
62
 
57
63
  function shouldIgnoreDirectory(directoryPath) {
@@ -65,7 +71,8 @@ export function transformImportPaths(text, filePath = "") {
65
71
  const beta = applyBetaStyleReplacements(direct.text);
66
72
  const cssTokens = applyCssTokenRenames(beta.text);
67
73
  const tailwindColors = applyTailwindColorRenames(cssTokens.text);
68
- let next = tailwindColors.text;
74
+ const expandablePanel = applyExpandablePanelTransforms(tailwindColors.text);
75
+ let next = expandablePanel.text;
69
76
  let reordered = false;
70
77
 
71
78
  if (/\.(sass|scss)$/i.test(filePath)) {
@@ -79,7 +86,10 @@ export function transformImportPaths(text, filePath = "") {
79
86
  ...collectManualMigrationWarnings(text),
80
87
  ];
81
88
 
82
- if (webfontsRemoval.count > 0 && !BASE_OR_COMPONENT_CSS_PATTERN.test(next)) {
89
+ if (
90
+ webfontsRemoval.count > 0 &&
91
+ !BASE_OR_COMPONENT_CSS_PATTERN.test(next)
92
+ ) {
83
93
  warnings.push(
84
94
  "Manuell vurdering: fjernet import av `styles/fonts/webfonts.css`. `@font-face`-definisjonene ligger nå i `@fremtind/jokul/styles/base.css`, så den må importeres for at fontene skal lastes.",
85
95
  );
@@ -94,7 +104,8 @@ export function transformImportPaths(text, filePath = "") {
94
104
  webfontsRemoval.count +
95
105
  fontFamily.count +
96
106
  cssTokens.count +
97
- tailwindColors.count,
107
+ tailwindColors.count +
108
+ expandablePanel.count,
98
109
  warnings,
99
110
  reordered,
100
111
  };
@@ -109,7 +120,9 @@ async function collectFiles(targetPath, collected) {
109
120
  }
110
121
 
111
122
  const entries = await readdir(targetPath, { withFileTypes: true });
112
- const sortedEntries = [...entries].sort((a, b) => a.name.localeCompare(b.name));
123
+ const sortedEntries = [...entries].sort((a, b) =>
124
+ a.name.localeCompare(b.name),
125
+ );
113
126
 
114
127
  for (const entry of sortedEntries) {
115
128
  if (entry.isDirectory() && IGNORED_DIRECTORIES.has(entry.name)) {
@@ -121,7 +134,10 @@ async function collectFiles(targetPath, collected) {
121
134
  return collected;
122
135
  }
123
136
 
124
- if (TEXT_EXTENSIONS.has(path.extname(targetPath)) && !shouldIgnoreFile(targetPath)) {
137
+ if (
138
+ TEXT_EXTENSIONS.has(path.extname(targetPath)) &&
139
+ !shouldIgnoreFile(targetPath)
140
+ ) {
125
141
  collected.push(targetPath);
126
142
  }
127
143
 
@@ -133,8 +149,14 @@ function parseArguments(rawArgs) {
133
149
  const targets = [];
134
150
 
135
151
  for (const arg of rawArgs) {
136
- if (arg === "--dry-run") { options.dryRun = true; continue; }
137
- if (arg === "--verbose") { options.verbose = true; continue; }
152
+ if (arg === "--dry-run") {
153
+ options.dryRun = true;
154
+ continue;
155
+ }
156
+ if (arg === "--verbose") {
157
+ options.verbose = true;
158
+ continue;
159
+ }
138
160
  if (arg === "--help" || arg === "-h") {
139
161
  throw new Error(
140
162
  "Bruk: jokul codemod [import-paths] [sti ...] [--dry-run] [--verbose]",
@@ -181,7 +203,9 @@ export async function runImportPathsCodemod(rawArgs = []) {
181
203
  }
182
204
 
183
205
  if (options.verbose || options.dryRun) {
184
- console.log(`${options.dryRun ? "Ville endret" : "Endret"} ${filePath}`);
206
+ console.log(
207
+ `${options.dryRun ? "Ville endret" : "Endret"} ${filePath}`,
208
+ );
185
209
  }
186
210
  }
187
211
 
@@ -0,0 +1,41 @@
1
+ // Variant-prop-endringer i ExpandablePanel:
2
+ // variant="fill" → fjernet (fill er default-atferd, prop eksisterer ikke lenger)
3
+ // variant="stroke" → outlined (boolean prop)
4
+ //
5
+ // CSS-klasseendring:
6
+ // jkl-expandable--stroke → jkl-expandable--outlined
7
+
8
+ const STROKE_PROP_PATTERN =
9
+ /variant=(?:"stroke"|'stroke'|\{"stroke"}|\{'stroke'})/;
10
+
11
+ const FILL_PROP_PATTERN = /\s+variant=(?:"fill"|'fill'|\{"fill"}|\{'fill'})/;
12
+
13
+ const CSS_CLASS_PATTERN = /\bjkl-expandable--stroke\b/g;
14
+
15
+ // Matches an ExpandablePanel opening or self-closing tag.
16
+ // [^>]* is safe for JSX since > in prop values must be escaped ({">"} or &gt;).
17
+ const EXPANDABLE_PANEL_TAG = /<ExpandablePanel\b[^>]*>/g;
18
+
19
+ export function applyExpandablePanelTransforms(text) {
20
+ let next = text;
21
+ let count = 0;
22
+
23
+ next = next.replace(CSS_CLASS_PATTERN, () => {
24
+ count++;
25
+ return "jkl-expandable-panel--outlined";
26
+ });
27
+
28
+ next = next.replace(EXPANDABLE_PANEL_TAG, (tag) =>
29
+ tag
30
+ .replace(FILL_PROP_PATTERN, () => {
31
+ count++;
32
+ return "";
33
+ })
34
+ .replace(STROKE_PROP_PATTERN, () => {
35
+ count++;
36
+ return "outlined";
37
+ }),
38
+ );
39
+
40
+ return { text: next, count };
41
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fremtind/jokul",
3
- "version": "5.0.0-next.13",
3
+ "version": "5.0.0-next.14",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"