@trackunit/react-components 1.24.7 → 1.25.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.
Files changed (78) hide show
  1. package/index.cjs.js +2298 -2199
  2. package/index.esm.js +2299 -2200
  3. package/migrations/entry.js +3 -0
  4. package/migrations/entry.js.map +1 -0
  5. package/migrations/utils/jsx-utils.js +203 -0
  6. package/migrations/utils/jsx-utils.js.map +1 -0
  7. package/migrations/v2-0-0/breadcrumb-remove-deprecated-props.js +67 -0
  8. package/migrations/v2-0-0/breadcrumb-remove-deprecated-props.js.map +1 -0
  9. package/migrations/v2-0-0/cardheader-onclickclose-to-actions.js +101 -0
  10. package/migrations/v2-0-0/cardheader-onclickclose-to-actions.js.map +1 -0
  11. package/migrations/v2-0-0/iconbutton-add-required-name.js +59 -0
  12. package/migrations/v2-0-0/iconbutton-add-required-name.js.map +1 -0
  13. package/migrations/v2-0-0/kpi-tooltiplabel-to-wrapper.js +95 -0
  14. package/migrations/v2-0-0/kpi-tooltiplabel-to-wrapper.js.map +1 -0
  15. package/migrations/v2-0-0/notice-tooltiplabel-to-wrapper.js +114 -0
  16. package/migrations/v2-0-0/notice-tooltiplabel-to-wrapper.js.map +1 -0
  17. package/migrations/v2-0-0/pagination-add-required-titles.js +65 -0
  18. package/migrations/v2-0-0/pagination-add-required-titles.js.map +1 -0
  19. package/migrations/v2-0-0/tag-add-removetaglabel.js +59 -0
  20. package/migrations/v2-0-0/tag-add-removetaglabel.js.map +1 -0
  21. package/migrations/v2-0-0/togglegroup-remove-item-style.js +100 -0
  22. package/migrations/v2-0-0/togglegroup-remove-item-style.js.map +1 -0
  23. package/migrations.json +44 -0
  24. package/package.json +7 -6
  25. package/src/components/Breadcrumb/BreadcrumbForMediumScreen.d.ts +2 -2
  26. package/src/components/Breadcrumb/utils/types.d.ts +1 -0
  27. package/src/components/Card/Card.variants.d.ts +4 -4
  28. package/src/components/Card/CardHeader.d.ts +3 -8
  29. package/src/components/Icon/Icon.variants.d.ts +1 -1
  30. package/src/components/InteractableItem/InteractableItem.variants.d.ts +1 -1
  31. package/src/components/KPI/KPI.d.ts +1 -5
  32. package/src/components/KPI/KPI.variants.d.ts +1 -1
  33. package/src/components/KPICard/KPICard.d.ts +5 -1
  34. package/src/components/Menu/MoreMenu/MoreMenu.d.ts +8 -3
  35. package/src/components/Notice/Notice.d.ts +1 -9
  36. package/src/components/Pagination/Pagination.d.ts +11 -1
  37. package/src/components/Tag/Tag.d.ts +35 -13
  38. package/src/components/Tag/Tag.variants.d.ts +1 -1
  39. package/src/components/Text/Text.variants.d.ts +1 -1
  40. package/src/components/ToggleGroup/ToggleGroup.d.ts +81 -36
  41. package/src/components/buttons/Button/Button.d.ts +1 -1
  42. package/src/components/buttons/IconButton/IconButton.d.ts +28 -6
  43. package/src/components/buttons/shared/ButtonProps.d.ts +3 -2
  44. package/src/translation.d.ts +30 -0
  45. package/translation.cjs.js +7 -0
  46. package/translation.cjs10.js +7 -0
  47. package/translation.cjs11.js +7 -0
  48. package/translation.cjs12.js +7 -0
  49. package/translation.cjs13.js +7 -0
  50. package/translation.cjs14.js +7 -0
  51. package/translation.cjs15.js +7 -0
  52. package/translation.cjs16.js +7 -0
  53. package/translation.cjs17.js +7 -0
  54. package/translation.cjs2.js +7 -0
  55. package/translation.cjs3.js +7 -0
  56. package/translation.cjs4.js +7 -0
  57. package/translation.cjs5.js +7 -0
  58. package/translation.cjs6.js +7 -0
  59. package/translation.cjs7.js +7 -0
  60. package/translation.cjs8.js +7 -0
  61. package/translation.cjs9.js +7 -0
  62. package/translation.esm.js +5 -0
  63. package/translation.esm10.js +5 -0
  64. package/translation.esm11.js +5 -0
  65. package/translation.esm12.js +5 -0
  66. package/translation.esm13.js +5 -0
  67. package/translation.esm14.js +5 -0
  68. package/translation.esm15.js +5 -0
  69. package/translation.esm16.js +5 -0
  70. package/translation.esm17.js +5 -0
  71. package/translation.esm2.js +5 -0
  72. package/translation.esm3.js +5 -0
  73. package/translation.esm4.js +5 -0
  74. package/translation.esm5.js +5 -0
  75. package/translation.esm6.js +5 -0
  76. package/translation.esm7.js +5 -0
  77. package/translation.esm8.js +5 -0
  78. package/translation.esm9.js +5 -0
@@ -0,0 +1,114 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.noticeTooltipLabelToWrapper = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const ts = tslib_1.__importStar(require("typescript"));
6
+ const jsx_utils_1 = require("../utils/jsx-utils");
7
+ const PACKAGE_NAME = "@trackunit/react-components";
8
+ const COMPONENT_NAME = "Notice";
9
+ const ensureTooltipImport = (content) => {
10
+ const sourceFile = (0, jsx_utils_1.parseTsx)(content, "source.tsx");
11
+ const aliases = (0, jsx_utils_1.getImportedAliases)(sourceFile, PACKAGE_NAME);
12
+ if (aliases !== null && Object.values(aliases).includes("Tooltip"))
13
+ return content;
14
+ for (const stmt of sourceFile.statements) {
15
+ if (!ts.isImportDeclaration(stmt))
16
+ continue;
17
+ const moduleSpecifier = stmt.moduleSpecifier;
18
+ if (!ts.isStringLiteral(moduleSpecifier) || moduleSpecifier.text !== PACKAGE_NAME)
19
+ continue;
20
+ const namedBindings = stmt.importClause?.namedBindings;
21
+ if (namedBindings === undefined || !ts.isNamedImports(namedBindings))
22
+ continue;
23
+ const elementsText = namedBindings.elements.map(el => el.getText()).join(", ");
24
+ const merged = `${elementsText}, Tooltip`;
25
+ const before = content.slice(0, namedBindings.getStart());
26
+ const after = content.slice(namedBindings.getEnd());
27
+ return `${before}{ ${merged} }${after}`;
28
+ }
29
+ return `import { Tooltip } from "${PACKAGE_NAME}";\n${content}`;
30
+ };
31
+ const transformNoticeUsage = (filePath, content) => {
32
+ const sourceFile = (0, jsx_utils_1.parseTsx)(content, filePath);
33
+ const aliases = (0, jsx_utils_1.getImportedAliases)(sourceFile, PACKAGE_NAME);
34
+ if (aliases === null)
35
+ return null;
36
+ const localAlias = Object.entries(aliases).find(([, name]) => name === COMPONENT_NAME)?.[0];
37
+ if (localAlias === undefined)
38
+ return null;
39
+ const matches = (0, jsx_utils_1.findJsxElements)(sourceFile, [localAlias]);
40
+ if (matches.length === 0)
41
+ return null;
42
+ const edits = [];
43
+ for (const { openingElement, element } of matches) {
44
+ const tooltipLabelAttr = (0, jsx_utils_1.findJsxAttribute)(openingElement, "tooltipLabel");
45
+ const withTooltipAttr = (0, jsx_utils_1.findJsxAttribute)(openingElement, "withTooltip");
46
+ if (tooltipLabelAttr === null && withTooltipAttr === null)
47
+ continue;
48
+ let label = null;
49
+ if (tooltipLabelAttr !== null) {
50
+ const initializer = tooltipLabelAttr.initializer;
51
+ if (initializer !== undefined) {
52
+ if (ts.isStringLiteral(initializer)) {
53
+ label = `"${initializer.text}"`;
54
+ }
55
+ else if (ts.isJsxExpression(initializer) && initializer.expression !== undefined) {
56
+ label = `{${initializer.expression.getText()}}`;
57
+ }
58
+ }
59
+ }
60
+ const attrEdits = [];
61
+ for (const attr of [tooltipLabelAttr, withTooltipAttr]) {
62
+ if (attr === null)
63
+ continue;
64
+ attrEdits.push({ start: attr.getFullStart(), end: attr.getEnd() });
65
+ }
66
+ edits.push({
67
+ elementStart: element.getStart(),
68
+ elementEnd: element.getEnd(),
69
+ elementText: content.slice(element.getStart(), element.getEnd()),
70
+ label,
71
+ attrEdits,
72
+ });
73
+ }
74
+ if (edits.length === 0)
75
+ return null;
76
+ edits.sort((a, b) => b.elementStart - a.elementStart);
77
+ let updated = content;
78
+ let needsTooltipImport = false;
79
+ for (const edit of edits) {
80
+ // Remove the tooltipLabel/withTooltip attributes from the element first.
81
+ let elementWithoutAttrs = edit.elementText;
82
+ const sortedAttrEdits = [...edit.attrEdits].sort((a, b) => b.start - a.start);
83
+ for (const { start, end } of sortedAttrEdits) {
84
+ elementWithoutAttrs =
85
+ elementWithoutAttrs.slice(0, start - edit.elementStart) + elementWithoutAttrs.slice(end - edit.elementStart);
86
+ }
87
+ if (edit.label !== null) {
88
+ const wrapped = `<Tooltip label=${edit.label} placement="bottom">${elementWithoutAttrs}</Tooltip>`;
89
+ updated = updated.slice(0, edit.elementStart) + wrapped + updated.slice(edit.elementEnd);
90
+ needsTooltipImport = true;
91
+ }
92
+ else {
93
+ // No label to forward (e.g. only `withTooltip`); just strip the props.
94
+ updated = updated.slice(0, edit.elementStart) + elementWithoutAttrs + updated.slice(edit.elementEnd);
95
+ }
96
+ }
97
+ if (needsTooltipImport) {
98
+ updated = ensureTooltipImport(updated);
99
+ }
100
+ return updated;
101
+ };
102
+ /**
103
+ * Removes the deprecated `withTooltip`/`tooltipLabel` props from `<Notice>`
104
+ * usages. When a label is present the element is wrapped in `<Tooltip>` to
105
+ * preserve hover behaviour; when only `withTooltip` was set the props are
106
+ * dropped because they had no remaining effect.
107
+ */
108
+ const noticeTooltipLabelToWrapper = (tree) => {
109
+ const touched = (0, jsx_utils_1.visitTsxFiles)(tree, "Notice", transformNoticeUsage);
110
+ (0, jsx_utils_1.logSummary)("notice-tooltiplabel-to-wrapper", touched);
111
+ };
112
+ exports.noticeTooltipLabelToWrapper = noticeTooltipLabelToWrapper;
113
+ exports.default = exports.noticeTooltipLabelToWrapper;
114
+ //# sourceMappingURL=notice-tooltiplabel-to-wrapper.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notice-tooltiplabel-to-wrapper.js","sourceRoot":"","sources":["../../../../../../libs/react/components/migrations/v2-0-0/notice-tooltiplabel-to-wrapper.ts"],"names":[],"mappings":";;;;AACA,uDAAiC;AACjC,kDAO4B;AAE5B,MAAM,YAAY,GAAG,6BAA6B,CAAC;AACnD,MAAM,cAAc,GAAG,QAAQ,CAAC;AAEhC,MAAM,mBAAmB,GAAG,CAAC,OAAe,EAAU,EAAE;IACtD,MAAM,UAAU,GAAG,IAAA,oBAAQ,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,IAAA,8BAAkB,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC7D,IAAI,OAAO,KAAK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ree } from \"@nx/devkit\";\nimport * as ts from \"typescript\";\nimport {\n findJsxAttribute,\n findJsxElements,\n getImportedAliases,\n logSummary,\n parseTsx,\n visitTsxFiles,\n} from \"../utils/jsx-utils\";\n\nconst PACKAGE_NAME = \"@trackunit/react-components\";\nconst COMPONENT_NAME = \"Notice\";\n\nconst ensureTooltipImport = (content: string): string => {\n const sourceFile = parseTsx(content, \"source.tsx\");\n const aliases = getImportedAliases(sourceFile, PACKAGE_NAME);\n if (aliases !== null && Object.values(aliases).includes(\"Tooltip\")) return content;\n\n for (const stmt of sourceFile.statements) {\n if (!ts.isImportDeclaration(stmt)) continue;\n const moduleSpecifier = stmt.moduleSpecifier;\n if (!ts.isStringLiteral(moduleSpecifier) || moduleSpecifier.text !== PACKAGE_NAME) continue;\n\n const namedBindings = stmt.importClause?.namedBindings;\n if (namedBindings === undefined || !ts.isNamedImports(namedBindings)) continue;\n\n const elementsText = namedBindings.elements.map(el => el.getText()).join(\", \");\n const merged = `${elementsText}, Tooltip`;\n const before = content.slice(0, namedBindings.getStart());\n const after = content.slice(namedBindings.getEnd());\n return `${before}{ ${merged} }${after}`;\n }\n\n return `import { Tooltip } from \"${PACKAGE_NAME}\";\\n${content}`;\n};\n\nconst transformNoticeUsage = (filePath: string, content: string): string | null => {\n const sourceFile = parseTsx(content, filePath);\n\n const aliases = getImportedAliases(sourceFile, PACKAGE_NAME);\n if (aliases === null) return null;\n\n const localAlias = Object.entries(aliases).find(([, name]) => name === COMPONENT_NAME)?.[0];\n if (localAlias === undefined) return null;\n\n const matches = findJsxElements(sourceFile, [localAlias]);\n if (matches.length === 0) return null;\n\n type Edit = {\n elementStart: number;\n elementEnd: number;\n elementText: string;\n label: string | null;\n attrEdits: Array<{ start: number; end: number }>;\n };\n const edits: Array<Edit> = [];\n\n for (const { openingElement, element } of matches) {\n const tooltipLabelAttr = findJsxAttribute(openingElement, \"tooltipLabel\");\n const withTooltipAttr = findJsxAttribute(openingElement, \"withTooltip\");\n if (tooltipLabelAttr === null && withTooltipAttr === null) continue;\n\n let label: string | null = null;\n if (tooltipLabelAttr !== null) {\n const initializer = tooltipLabelAttr.initializer;\n if (initializer !== undefined) {\n if (ts.isStringLiteral(initializer)) {\n label = `\"${initializer.text}\"`;\n } else if (ts.isJsxExpression(initializer) && initializer.expression !== undefined) {\n label = `{${initializer.expression.getText()}}`;\n }\n }\n }\n\n const attrEdits: Array<{ start: number; end: number }> = [];\n for (const attr of [tooltipLabelAttr, withTooltipAttr]) {\n if (attr === null) continue;\n attrEdits.push({ start: attr.getFullStart(), end: attr.getEnd() });\n }\n\n edits.push({\n elementStart: element.getStart(),\n elementEnd: element.getEnd(),\n elementText: content.slice(element.getStart(), element.getEnd()),\n label,\n attrEdits,\n });\n }\n\n if (edits.length === 0) return null;\n\n edits.sort((a, b) => b.elementStart - a.elementStart);\n\n let updated = content;\n let needsTooltipImport = false;\n\n for (const edit of edits) {\n // Remove the tooltipLabel/withTooltip attributes from the element first.\n let elementWithoutAttrs = edit.elementText;\n const sortedAttrEdits = [...edit.attrEdits].sort((a, b) => b.start - a.start);\n for (const { start, end } of sortedAttrEdits) {\n elementWithoutAttrs =\n elementWithoutAttrs.slice(0, start - edit.elementStart) + elementWithoutAttrs.slice(end - edit.elementStart);\n }\n\n if (edit.label !== null) {\n const wrapped = `<Tooltip label=${edit.label} placement=\"bottom\">${elementWithoutAttrs}</Tooltip>`;\n updated = updated.slice(0, edit.elementStart) + wrapped + updated.slice(edit.elementEnd);\n needsTooltipImport = true;\n } else {\n // No label to forward (e.g. only `withTooltip`); just strip the props.\n updated = updated.slice(0, edit.elementStart) + elementWithoutAttrs + updated.slice(edit.elementEnd);\n }\n }\n\n if (needsTooltipImport) {\n updated = ensureTooltipImport(updated);\n }\n\n return updated;\n};\n\n/**\n * Removes the deprecated `withTooltip`/`tooltipLabel` props from `<Notice>`\n * usages. When a label is present the element is wrapped in `<Tooltip>` to\n * preserve hover behaviour; when only `withTooltip` was set the props are\n * dropped because they had no remaining effect.\n */\nexport const noticeTooltipLabelToWrapper = (tree: Tree): void => {\n const touched = visitTsxFiles(tree, \"Notice\", transformNoticeUsage);\n logSummary(\"notice-tooltiplabel-to-wrapper\", touched);\n};\n\nexport default noticeTooltipLabelToWrapper;\n"]}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.paginationAddRequiredTitles = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const jsx_utils_1 = require("../utils/jsx-utils");
6
+ const PACKAGE_NAME = "@trackunit/react-components";
7
+ const COMPONENT_NAME = "Pagination";
8
+ const PLACEHOLDERS = {
9
+ previousPageTitle: "Previous page",
10
+ nextPageTitle: "Next page",
11
+ };
12
+ const transformPaginationUsage = (filePath, content) => {
13
+ const sourceFile = (0, jsx_utils_1.parseTsx)(content, filePath);
14
+ const aliases = (0, jsx_utils_1.getImportedAliases)(sourceFile, PACKAGE_NAME);
15
+ if (aliases === null)
16
+ return null;
17
+ const localAlias = Object.entries(aliases).find(([, name]) => name === COMPONENT_NAME)?.[0];
18
+ if (localAlias === undefined)
19
+ return null;
20
+ const matches = (0, jsx_utils_1.findJsxElements)(sourceFile, [localAlias]);
21
+ if (matches.length === 0)
22
+ return null;
23
+ const edits = [];
24
+ for (const { openingElement } of matches) {
25
+ if ((0, jsx_utils_1.hasSpreadAttribute)(openingElement))
26
+ continue;
27
+ for (const [propName, placeholder] of Object.entries(PLACEHOLDERS)) {
28
+ if ((0, jsx_utils_1.findJsxAttribute)(openingElement, propName) !== null)
29
+ continue;
30
+ edits.push({
31
+ offset: openingElement.tagName.getEnd(),
32
+ text: ` ${propName}="${placeholder}"`,
33
+ });
34
+ }
35
+ }
36
+ if (edits.length === 0)
37
+ return null;
38
+ // Apply in reverse so earlier offsets stay valid; keep order at the same
39
+ // offset so attributes appear in declaration order in the source.
40
+ edits.sort((a, b) => (a.offset === b.offset ? 0 : b.offset - a.offset));
41
+ let updated = content;
42
+ for (const { offset, text } of edits) {
43
+ updated = updated.slice(0, offset) + text + updated.slice(offset);
44
+ }
45
+ return updated;
46
+ };
47
+ /**
48
+ * Adds the now-required `previousPageTitle` and `nextPageTitle` props to
49
+ * `<Pagination>` usages that don't already provide them. The values default
50
+ * to the English strings "Previous page"/"Next page"; consumers should
51
+ * replace them with their own localized strings.
52
+ *
53
+ * Usages with a spread attribute (e.g. `<Pagination {...props} />`) are
54
+ * skipped because we cannot tell whether the props are already provided.
55
+ */
56
+ const paginationAddRequiredTitles = (tree) => {
57
+ const touched = (0, jsx_utils_1.visitTsxFiles)(tree, "Pagination", transformPaginationUsage);
58
+ (0, jsx_utils_1.logSummary)("pagination-add-required-titles", touched);
59
+ if (touched > 0) {
60
+ devkit_1.logger.info(` Replace the placeholder "Previous page"/"Next page" strings with your own localized values.`);
61
+ }
62
+ };
63
+ exports.paginationAddRequiredTitles = paginationAddRequiredTitles;
64
+ exports.default = exports.paginationAddRequiredTitles;
65
+ //# sourceMappingURL=pagination-add-required-titles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination-add-required-titles.js","sourceRoot":"","sources":["../../../../../../libs/react/components/migrations/v2-0-0/pagination-add-required-titles.ts"],"names":[],"mappings":";;;AAAA,uCAA+C;AAC/C,kDAQ4B;AAE5B,MAAM,YAAY,GAAG,6BAA6B,CAAC;AACnD,MAAM,cAAc,GAAG,YAAY,CAAC;AAEpC,MAAM,YAAY,GAA2B;IAC3C,iBAAiB,EAAE,eAAe;IAClC,aAAa,EAAE,WAAW;CAC3B,CAAC;AAEF,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAE,OAAe,EAAiB,EAAE;IACpF,MAAM,UAAU,GAAG,IAAA,oBAAQ,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAE/C,MAAM,OAAO,GAAG,IAAA,8BAAkB,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC7D,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IAElC,MAAM,UAAU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,OAAO,CAAC;IACtB,KAAK,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,KAAK,EAAE,CAAC;QACrC,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,GAAG,IAAI,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF;;;;;;;;GAQG;AACI,MAAM,2BAA2B,GAAG,CAAC,IAAU,EAAQ,EAAE;IAC9D,MAAM,OAAO,GAAG,IAAA,yBAAa,EAAC,IAAI,EAAE,YAAY,EAAE,wBAAwB,CAAC,CAAC;IAC5E,IAAA,sBAAU,EAAC,gCAAgC,EAAE,OAAO,CAAC,CAAC;IACtD,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;QAChB,eAAM,CAAC,IAAI,CAAC,+FAA+F,CAAC,CAAC;IAC/G,CAAC;AACH,CAAC,CAAC;AANW,QAAA,2BAA2B,+BAMtC;AAEF,kBAAe,mCAA2B,CAAC","sourcesContent":["import { type Tree, logger } from \"@nx/devkit\";\nimport {\n findJsxAttribute,\n findJsxElements,\n getImportedAliases,\n hasSpreadAttribute,\n logSummary,\n parseTsx,\n visitTsxFiles,\n} from \"../utils/jsx-utils\";\n\nconst PACKAGE_NAME = \"@trackunit/react-components\";\nconst COMPONENT_NAME = \"Pagination\";\n\nconst PLACEHOLDERS: Record<string, string> = {\n previousPageTitle: \"Previous page\",\n nextPageTitle: \"Next page\",\n};\n\nconst transformPaginationUsage = (filePath: string, content: string): string | null => {\n const sourceFile = parseTsx(content, filePath);\n\n const aliases = getImportedAliases(sourceFile, PACKAGE_NAME);\n if (aliases === null) return null;\n\n const localAlias = Object.entries(aliases).find(([, name]) => name === COMPONENT_NAME)?.[0];\n if (localAlias === undefined) return null;\n\n const matches = findJsxElements(sourceFile, [localAlias]);\n if (matches.length === 0) return null;\n\n type Edit = { offset: number; text: string };\n const edits: Array<Edit> = [];\n\n for (const { openingElement } of matches) {\n if (hasSpreadAttribute(openingElement)) continue;\n\n for (const [propName, placeholder] of Object.entries(PLACEHOLDERS)) {\n if (findJsxAttribute(openingElement, propName) !== null) continue;\n edits.push({\n offset: openingElement.tagName.getEnd(),\n text: ` ${propName}=\"${placeholder}\"`,\n });\n }\n }\n\n if (edits.length === 0) return null;\n\n // Apply in reverse so earlier offsets stay valid; keep order at the same\n // offset so attributes appear in declaration order in the source.\n edits.sort((a, b) => (a.offset === b.offset ? 0 : b.offset - a.offset));\n\n let updated = content;\n for (const { offset, text } of edits) {\n updated = updated.slice(0, offset) + text + updated.slice(offset);\n }\n return updated;\n};\n\n/**\n * Adds the now-required `previousPageTitle` and `nextPageTitle` props to\n * `<Pagination>` usages that don't already provide them. The values default\n * to the English strings \"Previous page\"/\"Next page\"; consumers should\n * replace them with their own localized strings.\n *\n * Usages with a spread attribute (e.g. `<Pagination {...props} />`) are\n * skipped because we cannot tell whether the props are already provided.\n */\nexport const paginationAddRequiredTitles = (tree: Tree): void => {\n const touched = visitTsxFiles(tree, \"Pagination\", transformPaginationUsage);\n logSummary(\"pagination-add-required-titles\", touched);\n if (touched > 0) {\n logger.info(` Replace the placeholder \"Previous page\"/\"Next page\" strings with your own localized values.`);\n }\n};\n\nexport default paginationAddRequiredTitles;\n"]}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.tagAddRemoveTagLabel = void 0;
4
+ const devkit_1 = require("@nx/devkit");
5
+ const jsx_utils_1 = require("../utils/jsx-utils");
6
+ const PACKAGE_NAME = "@trackunit/react-components";
7
+ const COMPONENT_NAME = "Tag";
8
+ const REMOVE_TAG_LABEL_PLACEHOLDER = "Remove tag";
9
+ const transformTagUsage = (filePath, content) => {
10
+ const sourceFile = (0, jsx_utils_1.parseTsx)(content, filePath);
11
+ const aliases = (0, jsx_utils_1.getImportedAliases)(sourceFile, PACKAGE_NAME);
12
+ if (aliases === null)
13
+ return null;
14
+ const localAlias = Object.entries(aliases).find(([, name]) => name === COMPONENT_NAME)?.[0];
15
+ if (localAlias === undefined)
16
+ return null;
17
+ const matches = (0, jsx_utils_1.findJsxElements)(sourceFile, [localAlias]);
18
+ if (matches.length === 0)
19
+ return null;
20
+ const edits = [];
21
+ for (const { openingElement } of matches) {
22
+ if ((0, jsx_utils_1.hasSpreadAttribute)(openingElement))
23
+ continue;
24
+ // Only act when the tag is dismissible (has onClickClose) and missing the
25
+ // newly required label.
26
+ if ((0, jsx_utils_1.findJsxAttribute)(openingElement, "onClickClose") === null)
27
+ continue;
28
+ if ((0, jsx_utils_1.findJsxAttribute)(openingElement, "removeTagLabel") !== null)
29
+ continue;
30
+ edits.push({
31
+ offset: openingElement.tagName.getEnd(),
32
+ text: ` removeTagLabel="${REMOVE_TAG_LABEL_PLACEHOLDER}"`,
33
+ });
34
+ }
35
+ if (edits.length === 0)
36
+ return null;
37
+ edits.sort((a, b) => (a.offset === b.offset ? 0 : b.offset - a.offset));
38
+ let updated = content;
39
+ for (const { offset, text } of edits) {
40
+ updated = updated.slice(0, offset) + text + updated.slice(offset);
41
+ }
42
+ return updated;
43
+ };
44
+ /**
45
+ * Adds the now-required `removeTagLabel` prop to dismissible `<Tag>` usages
46
+ * (those with `onClickClose`) when it is missing. Default value is the English
47
+ * string "Remove tag"; consumers should replace it with their own localized
48
+ * label.
49
+ */
50
+ const tagAddRemoveTagLabel = (tree) => {
51
+ const touched = (0, jsx_utils_1.visitTsxFiles)(tree, "Tag", transformTagUsage);
52
+ (0, jsx_utils_1.logSummary)("tag-add-removetaglabel", touched);
53
+ if (touched > 0) {
54
+ devkit_1.logger.info(` Replace the placeholder "Remove tag" string with your own localized value.`);
55
+ }
56
+ };
57
+ exports.tagAddRemoveTagLabel = tagAddRemoveTagLabel;
58
+ exports.default = exports.tagAddRemoveTagLabel;
59
+ //# sourceMappingURL=tag-add-removetaglabel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tag-add-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Attribute,\n logSummary,\n parseTsx,\n visitTsxFiles,\n} from \"../utils/jsx-utils\";\n\nconst PACKAGE_NAME = \"@trackunit/react-components\";\nconst COMPONENT_NAME = \"Tag\";\n\nconst REMOVE_TAG_LABEL_PLACEHOLDER = \"Remove tag\";\n\nconst transformTagUsage = (filePath: string, content: string): string | null => {\n const sourceFile = parseTsx(content, filePath);\n\n const aliases = getImportedAliases(sourceFile, PACKAGE_NAME);\n if (aliases === null) return null;\n\n const localAlias = Object.entries(aliases).find(([, name]) => name === COMPONENT_NAME)?.[0];\n if (localAlias === undefined) return null;\n\n const matches = findJsxElements(sourceFile, [localAlias]);\n if (matches.length === 0) return null;\n\n type Edit = { offset: number; text: string };\n const edits: Array<Edit> = [];\n\n for (const { openingElement } of matches) {\n if (hasSpreadAttribute(openingElement)) continue;\n\n // Only act when the tag is dismissible (has onClickClose) and missing the\n // newly required label.\n if (findJsxAttribute(openingElement, \"onClickClose\") === null) continue;\n if (findJsxAttribute(openingElement, \"removeTagLabel\") !== null) continue;\n\n edits.push({\n offset: openingElement.tagName.getEnd(),\n text: ` removeTagLabel=\"${REMOVE_TAG_LABEL_PLACEHOLDER}\"`,\n });\n }\n\n if (edits.length === 0) return null;\n\n edits.sort((a, b) => (a.offset === b.offset ? 0 : b.offset - a.offset));\n\n let updated = content;\n for (const { offset, text } of edits) {\n updated = updated.slice(0, offset) + text + updated.slice(offset);\n }\n return updated;\n};\n\n/**\n * Adds the now-required `removeTagLabel` prop to dismissible `<Tag>` usages\n * (those with `onClickClose`) when it is missing. Default value is the English\n * string \"Remove tag\"; consumers should replace it with their own localized\n * label.\n */\nexport const tagAddRemoveTagLabel = (tree: Tree): void => {\n const touched = visitTsxFiles(tree, \"Tag\", transformTagUsage);\n logSummary(\"tag-add-removetaglabel\", touched);\n if (touched > 0) {\n logger.info(` Replace the placeholder \"Remove tag\" string with your own localized value.`);\n }\n};\n\nexport default tagAddRemoveTagLabel;\n"]}
@@ -0,0 +1,100 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.toggleGroupRemoveItemStyle = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nx/devkit");
6
+ const ts = tslib_1.__importStar(require("typescript"));
7
+ const jsx_utils_1 = require("../utils/jsx-utils");
8
+ const PACKAGE_NAME = "@trackunit/react-components";
9
+ const COMPONENT_NAME = "ToggleGroup";
10
+ const collectStyleRemovalsFromArray = (arrayLiteral) => {
11
+ const removals = [];
12
+ for (const element of arrayLiteral.elements) {
13
+ if (!ts.isObjectLiteralExpression(element))
14
+ continue;
15
+ for (const prop of element.properties) {
16
+ if ((ts.isPropertyAssignment(prop) || ts.isShorthandPropertyAssignment(prop)) &&
17
+ ts.isIdentifier(prop.name) &&
18
+ prop.name.text === "style") {
19
+ removals.push({ start: prop.getFullStart(), end: prop.getEnd() });
20
+ }
21
+ }
22
+ }
23
+ return removals;
24
+ };
25
+ const transformToggleGroupUsage = (filePath, content) => {
26
+ const sourceFile = (0, jsx_utils_1.parseTsx)(content, filePath);
27
+ const aliases = (0, jsx_utils_1.getImportedAliases)(sourceFile, PACKAGE_NAME);
28
+ if (aliases === null)
29
+ return { content: null, skippedNonInline: 0 };
30
+ const localAlias = Object.entries(aliases).find(([, name]) => name === COMPONENT_NAME)?.[0];
31
+ if (localAlias === undefined)
32
+ return { content: null, skippedNonInline: 0 };
33
+ const matches = (0, jsx_utils_1.findJsxElements)(sourceFile, [localAlias]);
34
+ if (matches.length === 0)
35
+ return { content: null, skippedNonInline: 0 };
36
+ const removals = [];
37
+ let skippedNonInline = 0;
38
+ for (const { openingElement } of matches) {
39
+ const listAttr = (0, jsx_utils_1.findJsxAttribute)(openingElement, "list");
40
+ if (listAttr === null)
41
+ continue;
42
+ const initializer = listAttr.initializer;
43
+ if (initializer === undefined || !ts.isJsxExpression(initializer))
44
+ continue;
45
+ const expr = initializer.expression;
46
+ if (expr === undefined)
47
+ continue;
48
+ if (!ts.isArrayLiteralExpression(expr)) {
49
+ // The list is referenced through a variable / function call; we can't
50
+ // safely strip `style` without potentially editing unrelated objects.
51
+ skippedNonInline += 1;
52
+ continue;
53
+ }
54
+ removals.push(...collectStyleRemovalsFromArray(expr));
55
+ }
56
+ if (removals.length === 0)
57
+ return { content: null, skippedNonInline };
58
+ // Remove the property and its trailing comma if present so we don't leave
59
+ // dangling `, ,` sequences.
60
+ const sorted = [...removals].sort((a, b) => b.start - a.start);
61
+ let updated = content;
62
+ for (let { start, end } of sorted) {
63
+ while (start > 0 && (updated[start - 1] === " " || updated[start - 1] === "\t")) {
64
+ start -= 1;
65
+ }
66
+ if (updated[end] === ",") {
67
+ end += 1;
68
+ }
69
+ updated = updated.slice(0, start) + updated.slice(end);
70
+ }
71
+ return { content: updated, skippedNonInline };
72
+ };
73
+ /**
74
+ * Removes the `style` property from items in `<ToggleGroup list={[...]}>`
75
+ * because `BasicToggleGroupListProps` no longer extends `Styleable`.
76
+ *
77
+ * Only inline array literals are processed; lists pulled in via a variable or
78
+ * function call are left untouched and reported in the migration summary so
79
+ * the developer can review them.
80
+ */
81
+ const toggleGroupRemoveItemStyle = (tree) => {
82
+ let touched = 0;
83
+ let totalSkipped = 0;
84
+ (0, jsx_utils_1.visitTsxFiles)(tree, COMPONENT_NAME, (filePath, content) => {
85
+ const { content: updated, skippedNonInline } = transformToggleGroupUsage(filePath, content);
86
+ totalSkipped += skippedNonInline;
87
+ if (updated !== null && updated !== content) {
88
+ touched += 1;
89
+ return updated;
90
+ }
91
+ return null;
92
+ });
93
+ (0, jsx_utils_1.logSummary)("togglegroup-remove-item-style", touched, totalSkipped);
94
+ if (totalSkipped > 0) {
95
+ devkit_1.logger.info(` ${totalSkipped} ToggleGroup usage(s) referenced their list through a variable/function. Remove any 'style' properties from those item objects manually.`);
96
+ }
97
+ };
98
+ exports.toggleGroupRemoveItemStyle = toggleGroupRemoveItemStyle;
99
+ exports.default = exports.toggleGroupRemoveItemStyle;
100
+ //# sourceMappingURL=togglegroup-remove-item-style.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"togglegroup-remove-item-style.js","sourceRoot":"","sources":["../../../../../../libs/react/components/migrations/v2-0-0/togglegroup-remove-item-style.ts"],"names":[],"mappings":";;;;AAAA,uCAA+C;AAC/C,uDAAiC;AACjC,kDAO4B;AAE5B,MAAM,YAAY,GAAG,6BAA6B,CAAC;AACnD,MAAM,cAAc,GAAG,aAAa,CAAC;AAIrC,MAAM,6BAA6B,GAAG,CAAC,YAAuC,EAA0B,EAAE;IACxG,MAAM,QAAQ,GAAmB,EAAE,CAAC;IACpC,KAAK,MAAM,OAAO,IAAI,YAAY,CAAC,QAAQ,EAAE,CAAC;QAC5C,IAAI,CAAC,EAAE,CAAC,yBAAyB,CAAC,OAAO,CAAC;YAAE,SAAS;QACrD,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACtC,IACE,CAAC,EAAE,CAAC,oBAAoB,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,6BAA6B,CAAC,IAAI,CAAC,CAAC;gBACzE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;gBAC1B,IAAI,CAAC,IAAI,CAAC,IAAI,KAAK,OAAO,EAC1B,CAAC;gBACD,QAAQ,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,EAAE,GAAG,EAAE,IAAI,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACpE,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,yBAAyB,GAAG,CAChC,QAAgB,EAChB,OAAe,EACuC,EAAE;IACxD,MAAM,UAAU,GAAG,IAAA,oBAAQ,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAE/C,MAAM,OAAO,GAAG,IAAA,8BAAkB,EAAC,UAAU,EAAE,YAAY,CAAC,CAAC;IAC7D,IAAI,OAAO,KAAK,IAAI;QAAE,OAA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E,OAAO,EAAE,gBAAgB,EAAE,GAAG,yBAAyB,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC5F,YAAY,IAAI,gBAAgB,CAAC;QACjC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;YAC5C,OAAO,IAAI,CAAC,CAAC;YACb,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IACH,IAAA,sBAAU,EAAC,+BAA+B,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;IACnE,IAAI,YAAY,GAAG,CAAC,EAAE,CAAC;QACrB,eAAM,CAAC,IAAI,CACT,KAAK,YAAY,0IAA0I,CAC5J,CAAC;IACJ,CAAC;AACH,CAAC,CAAC;AAlBW,QAAA,0BAA0B,8BAkBrC;AAEF,kBAAe,kCAA0B,CAAC","sourcesContent":["import { type Tree, logger } from \"@nx/devkit\";\nimport * as ts from \"typescript\";\nimport {\n findJsxAttribute,\n findJsxElements,\n getImportedAliases,\n logSummary,\n parseTsx,\n visitTsxFiles,\n} from \"../utils/jsx-utils\";\n\nconst PACKAGE_NAME = \"@trackunit/react-components\";\nconst COMPONENT_NAME = \"ToggleGroup\";\n\ntype Removal = { start: number; end: number };\n\nconst collectStyleRemovalsFromArray = (arrayLiteral: ts.ArrayLiteralExpression): ReadonlyArray<Removal> => {\n const removals: Array<Removal> = [];\n for (const element of arrayLiteral.elements) {\n if (!ts.isObjectLiteralExpression(element)) continue;\n for (const prop of element.properties) {\n if (\n (ts.isPropertyAssignment(prop) || ts.isShorthandPropertyAssignment(prop)) &&\n ts.isIdentifier(prop.name) &&\n prop.name.text === \"style\"\n ) {\n removals.push({ start: prop.getFullStart(), end: prop.getEnd() });\n }\n }\n }\n return removals;\n};\n\nconst transformToggleGroupUsage = (\n filePath: string,\n content: string\n): { content: string | null; skippedNonInline: number } => {\n const sourceFile = parseTsx(content, filePath);\n\n const aliases = getImportedAliases(sourceFile, PACKAGE_NAME);\n if (aliases === null) return { content: null, skippedNonInline: 0 };\n\n const localAlias = Object.entries(aliases).find(([, name]) => name === COMPONENT_NAME)?.[0];\n if (localAlias === undefined) return { content: null, skippedNonInline: 0 };\n\n const matches = findJsxElements(sourceFile, [localAlias]);\n if (matches.length === 0) return { content: null, skippedNonInline: 0 };\n\n const removals: Array<Removal> = [];\n let skippedNonInline = 0;\n\n for (const { openingElement } of matches) {\n const listAttr = findJsxAttribute(openingElement, \"list\");\n if (listAttr === null) continue;\n\n const initializer = listAttr.initializer;\n if (initializer === undefined || !ts.isJsxExpression(initializer)) continue;\n const expr = initializer.expression;\n if (expr === undefined) continue;\n\n if (!ts.isArrayLiteralExpression(expr)) {\n // The list is referenced through a variable / function call; we can't\n // safely strip `style` without potentially editing unrelated objects.\n skippedNonInline += 1;\n continue;\n }\n\n removals.push(...collectStyleRemovalsFromArray(expr));\n }\n\n if (removals.length === 0) return { content: null, skippedNonInline };\n\n // Remove the property and its trailing comma if present so we don't leave\n // dangling `, ,` sequences.\n const sorted = [...removals].sort((a, b) => b.start - a.start);\n let updated = content;\n for (let { start, end } of sorted) {\n while (start > 0 && (updated[start - 1] === \" \" || updated[start - 1] === \"\\t\")) {\n start -= 1;\n }\n if (updated[end] === \",\") {\n end += 1;\n }\n updated = updated.slice(0, start) + updated.slice(end);\n }\n\n return { content: updated, skippedNonInline };\n};\n\n/**\n * Removes the `style` property from items in `<ToggleGroup list={[...]}>`\n * because `BasicToggleGroupListProps` no longer extends `Styleable`.\n *\n * Only inline array literals are processed; lists pulled in via a variable or\n * function call are left untouched and reported in the migration summary so\n * the developer can review them.\n */\nexport const toggleGroupRemoveItemStyle = (tree: Tree): void => {\n let touched = 0;\n let totalSkipped = 0;\n visitTsxFiles(tree, COMPONENT_NAME, (filePath, content) => {\n const { content: updated, skippedNonInline } = transformToggleGroupUsage(filePath, content);\n totalSkipped += skippedNonInline;\n if (updated !== null && updated !== content) {\n touched += 1;\n return updated;\n }\n return null;\n });\n logSummary(\"togglegroup-remove-item-style\", touched, totalSkipped);\n if (totalSkipped > 0) {\n logger.info(\n ` ${totalSkipped} ToggleGroup usage(s) referenced their list through a variable/function. Remove any 'style' properties from those item objects manually.`\n );\n }\n};\n\nexport default toggleGroupRemoveItemStyle;\n"]}
@@ -0,0 +1,44 @@
1
+ {
2
+ "generators": {
3
+ "v2-0-0-iconbutton-add-required-name": {
4
+ "version": "2.0.0",
5
+ "description": "Add a placeholder title prop to IconButton usages that don't already provide title or ariaLabel (now required for accessibility).",
6
+ "implementation": "./migrations/v2-0-0/iconbutton-add-required-name"
7
+ },
8
+ "v2-0-0-breadcrumb-remove-deprecated-props": {
9
+ "version": "2.0.0",
10
+ "description": "Remove the deprecated backButtonTitle and expandCollapsedItemsTitle props from Breadcrumb, BreadcrumbContainer, and BreadcrumbForMediumScreen.",
11
+ "implementation": "./migrations/v2-0-0/breadcrumb-remove-deprecated-props"
12
+ },
13
+ "v2-0-0-cardheader-onclickclose-to-actions": {
14
+ "version": "2.0.0",
15
+ "description": "Replace the removed CardHeader.onClickClose prop with an actions slot containing an IconButton + XMark Icon.",
16
+ "implementation": "./migrations/v2-0-0/cardheader-onclickclose-to-actions"
17
+ },
18
+ "v2-0-0-pagination-add-required-titles": {
19
+ "version": "2.0.0",
20
+ "description": "Add the now-required previousPageTitle and nextPageTitle props to Pagination usages.",
21
+ "implementation": "./migrations/v2-0-0/pagination-add-required-titles"
22
+ },
23
+ "v2-0-0-tag-add-removetaglabel": {
24
+ "version": "2.0.0",
25
+ "description": "Add the now-required removeTagLabel prop to dismissible Tag usages (those with onClickClose).",
26
+ "implementation": "./migrations/v2-0-0/tag-add-removetaglabel"
27
+ },
28
+ "v2-0-0-kpi-tooltiplabel-to-wrapper": {
29
+ "version": "2.0.0",
30
+ "description": "Replace the removed KPI.tooltipLabel prop with a Tooltip wrapper around the KPI.",
31
+ "implementation": "./migrations/v2-0-0/kpi-tooltiplabel-to-wrapper"
32
+ },
33
+ "v2-0-0-notice-tooltiplabel-to-wrapper": {
34
+ "version": "2.0.0",
35
+ "description": "Replace the removed Notice.withTooltip / Notice.tooltipLabel props with a Tooltip wrapper.",
36
+ "implementation": "./migrations/v2-0-0/notice-tooltiplabel-to-wrapper"
37
+ },
38
+ "v2-0-0-togglegroup-remove-item-style": {
39
+ "version": "2.0.0",
40
+ "description": "Remove the no-longer-supported style property from inline ToggleGroup list items.",
41
+ "implementation": "./migrations/v2-0-0/togglegroup-remove-item-style"
42
+ }
43
+ }
44
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "1.24.7",
3
+ "version": "1.25.0",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "migrations": "./migrations.json",
@@ -14,16 +14,17 @@
14
14
  "@floating-ui/react": "^0.26.25",
15
15
  "string-ts": "^2.0.0",
16
16
  "tailwind-merge": "^2.0.0",
17
- "@trackunit/ui-design-tokens": "1.13.4",
18
- "@trackunit/css-class-variance-utilities": "1.13.4",
19
- "@trackunit/shared-utils": "1.15.4",
20
- "@trackunit/ui-icons": "1.13.4",
17
+ "@trackunit/ui-design-tokens": "1.13.5",
18
+ "@trackunit/css-class-variance-utilities": "1.13.5",
19
+ "@trackunit/shared-utils": "1.15.5",
20
+ "@trackunit/ui-icons": "1.13.5",
21
21
  "es-toolkit": "^1.39.10",
22
22
  "@tanstack/react-virtual": "3.13.12",
23
23
  "dequal": "^2.0.3",
24
24
  "fflate": "^0.8.2",
25
25
  "superjson": "^2.2.6",
26
- "zod": "^3.25.76"
26
+ "zod": "^3.25.76",
27
+ "@trackunit/i18n-library-translation": "1.22.0"
27
28
  },
28
29
  "peerDependencies": {
29
30
  "react": "^19.0.0",
@@ -1,6 +1,6 @@
1
1
  import { ReactElement } from "react";
2
- import { BreadcrumbContainerProps } from "./utils/types";
2
+ import { BreadcrumbForMediumScreenProps } from "./utils/types";
3
3
  /**
4
4
  * BreadcrumbForMediumScreen is a helper component that renders the breadcrumb items for medium screens.
5
5
  */
6
- export declare const BreadcrumbForMediumScreen: ({ "data-testid": dataTestId, breadcrumbItems, className, style, }: BreadcrumbContainerProps) => ReactElement;
6
+ export declare const BreadcrumbForMediumScreen: ({ "data-testid": dataTestId, breadcrumbItems, className, style, }: BreadcrumbForMediumScreenProps) => ReactElement;
@@ -22,6 +22,7 @@ export interface BreadcrumbProps extends CommonProps, Styleable, Refable<HTMLDiv
22
22
  export interface BreadcrumbContainerProps extends CommonProps, Styleable, Refable<HTMLDivElement> {
23
23
  breadcrumbItems: Array<ReactElement<BreadcrumbItemProps>>;
24
24
  }
25
+ export type BreadcrumbForMediumScreenProps = BreadcrumbContainerProps;
25
26
  export interface BreadcrumbItemRenderProps extends CommonProps, Styleable {
26
27
  item: ReactElement<BreadcrumbItemProps>;
27
28
  }
@@ -4,17 +4,17 @@ export declare const cvaCard: (props?: ({
4
4
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
5
5
  export declare const cvaCardFooterContainerRoot: (props?: ({
6
6
  border?: "default" | "borderless" | null | undefined;
7
- padding?: "none" | "default" | null | undefined;
7
+ padding?: "default" | "none" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
9
  export declare const cvaCardFooterContainer: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
10
10
  export declare const cvaCardHeader: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
11
11
  export declare const cvaCardHeaderHeadingContainer: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
12
12
  export declare const cvaCardHeaderContainer: (props?: ({
13
13
  border?: "default" | "borderless" | null | undefined;
14
- padding?: "none" | "default" | null | undefined;
14
+ padding?: "default" | "none" | null | undefined;
15
15
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
16
16
  export declare const cvaCardBodyContainer: (props?: ({
17
17
  direction?: "column" | "column-reverse" | "row" | "row-reverse" | null | undefined;
18
- padding?: "none" | "default" | null | undefined;
19
- gap?: "none" | "default" | null | undefined;
18
+ padding?: "default" | "none" | null | undefined;
19
+ gap?: "default" | "none" | null | undefined;
20
20
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -1,7 +1,7 @@
1
- import { MouseEventHandler, ReactElement, ReactNode } from "react";
1
+ import { ReactElement, ReactNode } from "react";
2
2
  import { CommonProps } from "../../common/CommonProps";
3
- import type { Styleable } from "../../common/Styleable";
4
3
  import { Refable } from "../../common/Refable";
4
+ import type { Styleable } from "../../common/Styleable";
5
5
  import { HeadingVariant } from "../Heading/Heading";
6
6
  export interface CardHeaderProps extends CommonProps, Styleable, Refable<HTMLDivElement> {
7
7
  /**
@@ -25,11 +25,6 @@ export interface CardHeaderProps extends CommonProps, Styleable, Refable<HTMLDiv
25
25
  * Whether a separator line should be rendered
26
26
  */
27
27
  hideSeparator?: boolean;
28
- /**
29
- * @deprecated Use `actions` to render a custom close button and handle its `onClick` instead.
30
- * Function to call when the close button is clicked.
31
- */
32
- onClickClose?: MouseEventHandler<HTMLButtonElement>;
33
28
  /**
34
29
  * Children to render in the header.
35
30
  */
@@ -90,4 +85,4 @@ export interface CardHeaderProps extends CommonProps, Styleable, Refable<HTMLDiv
90
85
  * @param {CardHeaderProps} props - The props for the CardHeader component
91
86
  * @returns {ReactElement} CardHeader component
92
87
  */
93
- export declare const CardHeader: ({ heading, headingVariant, subHeading, onClickClose, "data-testid": dataTestId, className, children, accessories, actions, padding, hideSeparator, style, ref, }: CardHeaderProps) => ReactElement;
88
+ export declare const CardHeader: ({ heading, headingVariant, subHeading, "data-testid": dataTestId, className, children, accessories, actions, padding, hideSeparator, style, ref, }: CardHeaderProps) => ReactElement;
@@ -1,5 +1,5 @@
1
1
  export declare const cvaIcon: (props?: ({
2
- color?: "black" | "white" | "default" | "active" | "primary" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "moving" | "excessive_usage" | "stopped" | "unknown" | "unused" | "utilized" | "heavily_utilized" | "unknown_utilization" | "site_area" | "site_classic_poi" | "site_classic_zone" | "site_depot" | "site_work_place" | "site_construction_site" | "site_unknown" | "on_rent" | "returned" | "available" | "pickup_ready" | "transfer" | "in_repair" | "other_rental_status" | null | undefined;
2
+ color?: "default" | "black" | "white" | "active" | "primary" | "neutral" | "info" | "success" | "warning" | "danger" | "good" | "low" | "critical" | "working" | "idle" | "moving" | "excessive_usage" | "stopped" | "unknown" | "unused" | "utilized" | "heavily_utilized" | "unknown_utilization" | "site_area" | "site_classic_poi" | "site_classic_zone" | "site_depot" | "site_work_place" | "site_construction_site" | "site_unknown" | "on_rent" | "returned" | "available" | "pickup_ready" | "transfer" | "in_repair" | "other_rental_status" | null | undefined;
3
3
  size?: "small" | "medium" | "large" | null | undefined;
4
4
  fontSize?: boolean | null | undefined;
5
5
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -13,7 +13,7 @@
13
13
  * @returns tailwind class names on the basis on the provided props.
14
14
  */
15
15
  export declare const cvaInteractableItem: (props?: ({
16
- cursor?: "auto" | "default" | "help" | "not-allowed" | "pointer" | "zoom-in" | "zoom-out" | null | undefined;
16
+ cursor?: "default" | "auto" | "help" | "not-allowed" | "pointer" | "zoom-in" | "zoom-out" | null | undefined;
17
17
  selection?: "auto" | "selected" | "unselected" | null | undefined;
18
18
  disabled?: boolean | null | undefined;
19
19
  focus?: "auto" | "focused" | "unfocused" | null | undefined;
@@ -15,10 +15,6 @@ export interface KPIProps extends CommonProps, Styleable, Refable<HTMLDivElement
15
15
  * The unit of the KPI
16
16
  */
17
17
  unit: string;
18
- /**
19
- * Label for the tooltip
20
- */
21
- tooltipLabel?: string;
22
18
  /**
23
19
  * The size of the KPI
24
20
  */
@@ -65,4 +61,4 @@ export interface KPIProps extends CommonProps, Styleable, Refable<HTMLDivElement
65
61
  * @param {KPIProps} props - The props for the KPI component
66
62
  * @returns {ReactElement} KPI component
67
63
  */
68
- export declare const KPI: ({ title, value, unit, className, "data-testid": dataTestId, tooltipLabel, variant, style, ref, ...rest }: KPIProps) => ReactElement;
64
+ export declare const KPI: ({ title, value, unit, className, "data-testid": dataTestId, variant, style, ref, ...rest }: KPIProps) => ReactElement;
@@ -1,5 +1,5 @@
1
1
  export declare const cvaKPI: (props?: ({
2
- variant?: "small" | "default" | "condensed" | null | undefined;
2
+ variant?: "default" | "small" | "condensed" | null | undefined;
3
3
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
4
4
  export declare const cvaKPITrendPercentage: (props?: ({
5
5
  color?: "neutral" | "info" | "success" | "warning" | "danger" | null | undefined;
@@ -40,6 +40,10 @@ export interface KPICardProps extends MappedOmit<KPIProps, "variant">, Refable<H
40
40
  * Value bar to display in the KPI
41
41
  */
42
42
  valueBar?: Omit<ValueBarProps, "className" | "dataTestId" | "size" | "valueColor">;
43
+ /**
44
+ * Label for the tooltip
45
+ */
46
+ tooltipLabel?: string;
43
47
  }
44
48
  /**
45
49
  * The KPICard component displays a key performance indicator in an interactive card format.
@@ -93,4 +97,4 @@ export interface KPICardProps extends MappedOmit<KPIProps, "variant">, Refable<H
93
97
  * @param {KPICardProps} props - The props for the KPICard component
94
98
  * @returns {ReactElement} KPICard component
95
99
  */
96
- export declare const KPICard: ({ isActive, onClick, className, "data-testid": dataTestId, children, iconName, iconColor, notice, valueBar, trends, unit, ref, ...rest }: KPICardProps) => ReactElement;
100
+ export declare const KPICard: ({ isActive, onClick, className, "data-testid": dataTestId, children, iconName, iconColor, notice, valueBar, trends, unit, ref, tooltipLabel, ...rest }: KPICardProps) => ReactElement;