@canonical/react-ds-app-launchpad 0.9.0-experimental.2 → 0.9.0-experimental.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/esm/ui/GitDiffViewer/Context.js +4 -0
  2. package/dist/esm/ui/GitDiffViewer/Context.js.map +1 -0
  3. package/dist/esm/ui/GitDiffViewer/Provider.js +31 -0
  4. package/dist/esm/ui/GitDiffViewer/Provider.js.map +1 -0
  5. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/CodeDiffViewer.js +119 -0
  6. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/CodeDiffViewer.js.map +1 -0
  7. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/DiffLine.js +33 -0
  8. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/DiffLine.js.map +1 -0
  9. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/index.js +4 -0
  10. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/index.js.map +1 -0
  11. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/types.js.map +1 -0
  12. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/index.js +2 -0
  13. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/common/index.js.map +1 -0
  14. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/index.js +4 -0
  15. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/index.js.map +1 -0
  16. package/dist/esm/ui/GitDiffViewer/common/CodeDiffViewer/types.js.map +1 -0
  17. package/dist/esm/ui/GitDiffViewer/common/FileHeader/FileHeader.js +35 -0
  18. package/dist/esm/ui/GitDiffViewer/common/FileHeader/FileHeader.js.map +1 -0
  19. package/dist/esm/ui/GitDiffViewer/common/FileHeader/index.js +4 -0
  20. package/dist/esm/ui/GitDiffViewer/common/FileHeader/index.js.map +1 -0
  21. package/dist/esm/ui/GitDiffViewer/common/FileHeader/types.js +2 -0
  22. package/dist/esm/ui/GitDiffViewer/common/FileHeader/types.js.map +1 -0
  23. package/dist/esm/ui/GitDiffViewer/common/index.js +3 -0
  24. package/dist/esm/ui/GitDiffViewer/common/index.js.map +1 -0
  25. package/dist/esm/ui/GitDiffViewer/hooks/index.js +2 -0
  26. package/dist/esm/ui/GitDiffViewer/hooks/index.js.map +1 -0
  27. package/dist/esm/ui/GitDiffViewer/hooks/useGitDiffViewer.js +11 -0
  28. package/dist/esm/ui/GitDiffViewer/hooks/useGitDiffViewer.js.map +1 -0
  29. package/dist/esm/ui/GitDiffViewer/index.js +9 -0
  30. package/dist/esm/ui/GitDiffViewer/index.js.map +1 -0
  31. package/dist/esm/ui/GitDiffViewer/styles.css +38 -0
  32. package/dist/esm/ui/GitDiffViewer/types.js +2 -0
  33. package/dist/esm/ui/{Button → GitDiffViewer}/types.js.map +1 -1
  34. package/dist/esm/ui/GitDiffViewer/utils/index.js +2 -0
  35. package/dist/esm/ui/GitDiffViewer/utils/index.js.map +1 -0
  36. package/dist/esm/ui/GitDiffViewer/utils/parseGitDiff.js +73 -0
  37. package/dist/esm/ui/GitDiffViewer/utils/parseGitDiff.js.map +1 -0
  38. package/dist/esm/ui/index.js +1 -1
  39. package/dist/esm/ui/index.js.map +1 -1
  40. package/dist/types/ui/GitDiffViewer/Context.d.ts +4 -0
  41. package/dist/types/ui/GitDiffViewer/Context.d.ts.map +1 -0
  42. package/dist/types/ui/GitDiffViewer/Provider.d.ts +5 -0
  43. package/dist/types/ui/GitDiffViewer/Provider.d.ts.map +1 -0
  44. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/CodeDiffViewer.d.ts +16 -0
  45. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/CodeDiffViewer.d.ts.map +1 -0
  46. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/DiffLine.d.ts +11 -0
  47. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/DiffLine.d.ts.map +1 -0
  48. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/index.d.ts +3 -0
  49. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/index.d.ts.map +1 -0
  50. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/types.d.ts +20 -0
  51. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/DiffLine/types.d.ts.map +1 -0
  52. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/index.d.ts +2 -0
  53. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/common/index.d.ts.map +1 -0
  54. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/index.d.ts +3 -0
  55. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/index.d.ts.map +1 -0
  56. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/types.d.ts +18 -0
  57. package/dist/types/ui/GitDiffViewer/common/CodeDiffViewer/types.d.ts.map +1 -0
  58. package/dist/types/ui/GitDiffViewer/common/FileHeader/FileHeader.d.ts +15 -0
  59. package/dist/types/ui/GitDiffViewer/common/FileHeader/FileHeader.d.ts.map +1 -0
  60. package/dist/types/ui/GitDiffViewer/common/FileHeader/index.d.ts +3 -0
  61. package/dist/types/ui/GitDiffViewer/common/FileHeader/index.d.ts.map +1 -0
  62. package/dist/types/ui/GitDiffViewer/common/FileHeader/types.d.ts +17 -0
  63. package/dist/types/ui/GitDiffViewer/common/FileHeader/types.d.ts.map +1 -0
  64. package/dist/types/ui/GitDiffViewer/common/index.d.ts +3 -0
  65. package/dist/types/ui/GitDiffViewer/common/index.d.ts.map +1 -0
  66. package/dist/types/ui/GitDiffViewer/hooks/index.d.ts +2 -0
  67. package/dist/types/ui/GitDiffViewer/hooks/index.d.ts.map +1 -0
  68. package/dist/types/ui/GitDiffViewer/hooks/useGitDiffViewer.d.ts +3 -0
  69. package/dist/types/ui/GitDiffViewer/hooks/useGitDiffViewer.d.ts.map +1 -0
  70. package/dist/types/ui/GitDiffViewer/index.d.ts +6 -0
  71. package/dist/types/ui/GitDiffViewer/index.d.ts.map +1 -0
  72. package/dist/types/ui/GitDiffViewer/types.d.ts +77 -0
  73. package/dist/types/ui/GitDiffViewer/types.d.ts.map +1 -0
  74. package/dist/types/ui/GitDiffViewer/utils/index.d.ts +2 -0
  75. package/dist/types/ui/GitDiffViewer/utils/index.d.ts.map +1 -0
  76. package/dist/types/ui/GitDiffViewer/utils/parseGitDiff.d.ts +4 -0
  77. package/dist/types/ui/GitDiffViewer/utils/parseGitDiff.d.ts.map +1 -0
  78. package/dist/types/ui/index.d.ts +1 -1
  79. package/dist/types/ui/index.d.ts.map +1 -1
  80. package/package.json +4 -2
  81. package/dist/esm/ui/Button/Button.js +0 -10
  82. package/dist/esm/ui/Button/Button.js.map +0 -1
  83. package/dist/esm/ui/Button/index.js +0 -2
  84. package/dist/esm/ui/Button/index.js.map +0 -1
  85. package/dist/esm/ui/Button/styles.css +0 -63
  86. package/dist/esm/ui/Chip/Chip.css +0 -79
  87. package/dist/esm/ui/Chip/Chip.js +0 -15
  88. package/dist/esm/ui/Chip/Chip.js.map +0 -1
  89. package/dist/esm/ui/Chip/index.js +0 -4
  90. package/dist/esm/ui/Chip/index.js.map +0 -1
  91. package/dist/esm/ui/Chip/types.js.map +0 -1
  92. package/dist/types/ui/Button/Button.d.ts +0 -6
  93. package/dist/types/ui/Button/Button.d.ts.map +0 -1
  94. package/dist/types/ui/Button/index.d.ts +0 -3
  95. package/dist/types/ui/Button/index.d.ts.map +0 -1
  96. package/dist/types/ui/Button/types.d.ts +0 -15
  97. package/dist/types/ui/Button/types.d.ts.map +0 -1
  98. package/dist/types/ui/Chip/Chip.d.ts +0 -10
  99. package/dist/types/ui/Chip/Chip.d.ts.map +0 -1
  100. package/dist/types/ui/Chip/index.d.ts +0 -3
  101. package/dist/types/ui/Chip/index.d.ts.map +0 -1
  102. package/dist/types/ui/Chip/types.d.ts +0 -27
  103. package/dist/types/ui/Chip/types.d.ts.map +0 -1
  104. /package/dist/esm/ui/{Button → GitDiffViewer/common/CodeDiffViewer/common/DiffLine}/types.js +0 -0
  105. /package/dist/esm/ui/{Chip → GitDiffViewer/common/CodeDiffViewer}/types.js +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../../src/ui/GitDiffViewer/common/CodeDiffViewer/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as CodeDiffViewer } from "./CodeDiffViewer.js";
2
+ export * from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/GitDiffViewer/common/CodeDiffViewer/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChE,cAAc,YAAY,CAAC"}
@@ -0,0 +1,18 @@
1
+ import type React from "react";
2
+ export type CodeDiffViewerAddComment = (props: {
3
+ lineNumber: number;
4
+ onClose: () => void;
5
+ }) => React.ReactNode;
6
+ export type CodeDiffViewerProps = {
7
+ /** A unique identifier for the CodeDiffViewer */
8
+ id?: string;
9
+ /** Additional CSS classes */
10
+ className?: string;
11
+ /** Add comment element.
12
+ * If provided, the add comment button will be displayed on the line number.
13
+ */
14
+ AddComment?: CodeDiffViewerAddComment;
15
+ /** Inline styles */
16
+ style?: React.CSSProperties;
17
+ };
18
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/GitDiffViewer/common/CodeDiffViewer/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,wBAAwB,GAAG,CAAC,KAAK,EAAE;IAC7C,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,KAAK,KAAK,CAAC,SAAS,CAAC;AAEtB,MAAM,MAAM,mBAAmB,GAAG;IAChC,iDAAiD;IACjD,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,wBAAwB,CAAC;IACtC,oBAAoB;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type React from "react";
2
+ import "./styles.css";
3
+ import type { FileHeaderProps } from "./types.js";
4
+ /**
5
+ * Displays the file name and change count for a diff.
6
+ * With option to add custom elements to the left and right of the file header.
7
+ *
8
+ * @returns {React.ReactElement} - Rendered FileHeader
9
+ */
10
+ declare const FileHeader: {
11
+ ({ id, children, className, style, hideCollapse, showChangeCount, leftContent, rightContent, ...props }: FileHeaderProps): React.ReactElement;
12
+ displayName: string;
13
+ };
14
+ export default FileHeader;
15
+ //# sourceMappingURL=FileHeader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileHeader.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/GitDiffViewer/common/FileHeader/FileHeader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,OAAO,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD;;;;;GAKG;AACH,QAAA,MAAM,UAAU;6GAUb,eAAe,GAAG,KAAK,CAAC,YAAY;;CA0EtC,CAAC;AAIF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { default as FileHeader } from "./FileHeader.js";
2
+ export * from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/GitDiffViewer/common/FileHeader/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxD,cAAc,YAAY,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type React from "react";
2
+ export type FileHeaderProps = {
3
+ /** A unique identifier for the FileHeader */
4
+ id?: string;
5
+ /** Additional CSS classes */
6
+ className?: string;
7
+ /** Child elements */
8
+ children?: React.ReactNode;
9
+ /** Inline styles */
10
+ style?: React.CSSProperties;
11
+ /** Shown by default */
12
+ hideCollapse?: boolean;
13
+ showChangeCount?: boolean;
14
+ leftContent?: React.ReactNode;
15
+ rightContent?: React.ReactNode;
16
+ };
17
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../../src/ui/GitDiffViewer/common/FileHeader/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,MAAM,eAAe,GAAG;IAC5B,6CAA6C;IAC7C,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,oBAAoB;IACpB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B,uBAAuB;IACvB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAChC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from "./CodeDiffViewer/index.js";
2
+ export * from "./FileHeader/index.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ui/GitDiffViewer/common/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as useGitDiffViewer } from "./useGitDiffViewer.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ui/GitDiffViewer/hooks/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1,3 @@
1
+ declare const useGitDiffViewer: () => import("../types.js").ContextOptions;
2
+ export default useGitDiffViewer;
3
+ //# sourceMappingURL=useGitDiffViewer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useGitDiffViewer.d.ts","sourceRoot":"","sources":["../../../../../src/ui/GitDiffViewer/hooks/useGitDiffViewer.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,gBAAgB,4CAQrB,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./hooks/index.js";
2
+ export type { DiffFile as GitDiffFile, Hunk as GitDiffHunk } from "./types.js";
3
+ export * from "./utils/index.js";
4
+ import type { GitDiffViewerComponent } from "./types.js";
5
+ export declare const GitDiffViewer: GitDiffViewerComponent;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/GitDiffViewer/index.ts"],"names":[],"mappings":"AACA,cAAc,kBAAkB,CAAC;AACjC,YAAY,EAAE,QAAQ,IAAI,WAAW,EAAE,IAAI,IAAI,WAAW,EAAE,MAAM,YAAY,CAAC;AAC/E,cAAc,kBAAkB,CAAC;AAIjC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAEzD,eAAO,MAAM,aAAa,EAAe,sBAAsB,CAAC"}
@@ -0,0 +1,77 @@
1
+ import type { AllOrNone } from "@canonical/utils";
2
+ import type React from "react";
3
+ import type { CodeDiffViewerProps, FileHeaderProps } from "./common/index.js";
4
+ /**
5
+ * When this is provided, the component will add support for collapsing the diff code section.
6
+ */
7
+ export type CollapseOption = {
8
+ /**
9
+ * Whether the diff code section is collapsed.
10
+ */
11
+ isCollapsed: boolean;
12
+ /**
13
+ * Toggle the collapse state of the diff code section.
14
+ */
15
+ onCollapseToggle: (collapsed: boolean) => void;
16
+ };
17
+ export type DiffOptions = {
18
+ /**
19
+ * The diff file being displayed.
20
+ *
21
+ * In case you need to parse raw diff text,
22
+ * you can use the `parseDiff` function from `@canonical/react-ds-app-launchpad`
23
+ */
24
+ diff: DiffFile;
25
+ };
26
+ export type WrapLinesOption = {
27
+ /**
28
+ * Whether the code lines should not overflow.
29
+ */
30
+ wrapLines?: boolean;
31
+ };
32
+ export type LineDecorationOptions = {
33
+ /**
34
+ * Additional UI elements to be displayed bellow the code diff lines.
35
+ */
36
+ lineDecorations?: Record<number, React.ReactElement>;
37
+ };
38
+ type UserContextOptions = LineDecorationOptions & DiffOptions & WrapLinesOption & AllOrNone<CollapseOption>;
39
+ type ManagedContextOptions = {
40
+ addCommentEnabled: boolean;
41
+ setAddCommentEnabled: (enabled: boolean) => void;
42
+ addCommentOpenLocations: Set<number>;
43
+ toggleAddCommentLocation: (lineNumber: number) => void;
44
+ };
45
+ export type ContextOptions = UserContextOptions & ManagedContextOptions;
46
+ export type ProviderOptions = {
47
+ id?: string;
48
+ className?: string;
49
+ style?: React.CSSProperties;
50
+ /**
51
+ * Consider using `GitDiffViewer.FileHeader`, and `GitDiffViewer.CodeDiff` components.
52
+ */
53
+ children?: React.ReactNode;
54
+ } & UserContextOptions;
55
+ export type Hunk = {
56
+ header: string;
57
+ oldStart: number;
58
+ oldLines: number;
59
+ newStart: number;
60
+ newLines: number;
61
+ lines: {
62
+ type: "add" | "remove" | "context";
63
+ content: string;
64
+ }[];
65
+ };
66
+ export type DiffFile = {
67
+ oldPath: string;
68
+ newPath: string;
69
+ hunks: Hunk[];
70
+ fileChangeState: "none" | "added" | "deleted" | "modified";
71
+ };
72
+ export type GitDiffViewerComponent = ((props: ProviderOptions) => React.ReactElement) & {
73
+ FileHeader: (props: FileHeaderProps) => React.ReactElement | null;
74
+ CodeDiffViewer: (props: CodeDiffViewerProps) => React.ReactElement | null;
75
+ };
76
+ export {};
77
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/GitDiffViewer/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,gBAAgB,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG;IACxB;;;;;OAKG;IACH,IAAI,EAAE,QAAQ,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,CAAC;CACtD,CAAC;AAEF,KAAK,kBAAkB,GAAG,qBAAqB,GAC7C,WAAW,GACX,eAAe,GACf,SAAS,CAAC,cAAc,CAAC,CAAC;AAE5B,KAAK,qBAAqB,GAAG;IAC3B,iBAAiB,EAAE,OAAO,CAAC;IAC3B,oBAAoB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,uBAAuB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACrC,wBAAwB,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;CACxD,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,kBAAkB,GAAG,qBAAqB,CAAC;AAExE,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;IAC5B;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B,GAAG,kBAAkB,CAAC;AAEvB,MAAM,MAAM,IAAI,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE;QACL,IAAI,EAAE,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;QACnC,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,IAAI,EAAE,CAAC;IACd,eAAe,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,UAAU,CAAC;CAC5D,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,CAAC,CACpC,KAAK,EAAE,eAAe,KACnB,KAAK,CAAC,YAAY,CAAC,GAAG;IACzB,UAAU,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;IAClE,cAAc,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC;CAC3E,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default as parseGitDiff } from "./parseGitDiff.js";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/ui/GitDiffViewer/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { DiffFile } from "../types.js";
2
+ declare function parseGitDiff(diffText: string): DiffFile[];
3
+ export default parseGitDiff;
4
+ //# sourceMappingURL=parseGitDiff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parseGitDiff.d.ts","sourceRoot":"","sources":["../../../../../src/ui/GitDiffViewer/utils/parseGitDiff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAQ,MAAM,aAAa,CAAC;AAElD,iBAAS,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,QAAQ,EAAE,CAwElD;AAED,eAAe,YAAY,CAAC"}
@@ -1,2 +1,2 @@
1
- export { Button, type ButtonProps } from "./Button/index.js";
1
+ export * from "./GitDiffViewer/index.js";
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonical/react-ds-app-launchpad",
3
- "version": "0.9.0-experimental.2",
3
+ "version": "0.9.0-experimental.4",
4
4
  "type": "module",
5
5
  "module": "dist/esm/index.js",
6
6
  "types": "dist/types/index.d.ts",
@@ -40,6 +40,8 @@
40
40
  "dependencies": {
41
41
  "@canonical/storybook-config": "^0.9.0-experimental.2",
42
42
  "@canonical/styles": "^0.9.0-experimental.2",
43
+ "@canonical/utils": "^0.9.0-experimental.4",
44
+ "highlight.js": "^11.11.1",
43
45
  "react": "^19.0.0",
44
46
  "react-dom": "^19.0.0"
45
47
  },
@@ -66,5 +68,5 @@
66
68
  "vite-tsconfig-paths": "^5.1.4",
67
69
  "vitest": "^2.1.8"
68
70
  },
69
- "gitHead": "3b4b3637d6c340d1363bc89e973dadea8881f625"
71
+ "gitHead": "1d084380afa970ea924d774ced9c2a3f6a6c027e"
70
72
  }
@@ -1,10 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import "./styles.css";
3
- /** Buttons are clickable elements used to perform an action. */
4
- const Button = ({ id, className, appearance, label, ...props }) => {
5
- return (_jsx("button", { id: id, className: ["ds", "button", appearance, className]
6
- .filter(Boolean)
7
- .join(" "), ...props, "aria-label": label, children: label }));
8
- };
9
- export default Button;
10
- //# sourceMappingURL=Button.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.js","sourceRoot":"","sources":["../../../../src/ui/Button/Button.tsx"],"names":[],"mappings":";AACA,OAAO,cAAc,CAAC;AAEtB,gEAAgE;AAChE,MAAM,MAAM,GAAG,CAAC,EACd,EAAE,EACF,SAAS,EACT,UAAU,EACV,KAAK,EACL,GAAG,KAAK,EACF,EAAsB,EAAE;IAC9B,OAAO,CACL,iBACE,EAAE,EAAE,EAAE,EACN,SAAS,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC;aAC/C,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,KACR,KAAK,gBACG,KAAK,YAEhB,KAAK,GACC,CACV,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,2 +0,0 @@
1
- export { default as Button } from "./Button.js";
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC"}
@@ -1,63 +0,0 @@
1
- /* component styles */
2
-
3
- /* component variables
4
- --button-color-background: background color of the button
5
- --button-color-background-hover: background color of the button on hover
6
- --button-color-background-active: background color of the button on active
7
- --button-color-text: text color of the button
8
- --button-color-border: border color of the button
9
- --button-color-border-hover: border color of the button on hover
10
- --button-color-border-active: border color of the button on active
11
-
12
- --button-margin-left: left margin of the button
13
- --button-margin-bottom: bottom margin of the button
14
- --button-padding-vertical: vertical padding of the button
15
- --button-padding-horizontal: horizontal padding of the button
16
- --button-border-width: border width of the button
17
- --button-font-size: font size of the button
18
- --button-font-weight: font weight of the button
19
- --button-line-height: line height of the button
20
- */
21
- .ds.button {
22
- display: inline-block;
23
- cursor: pointer;
24
-
25
- color: var(--intent-color-text, var(--button-color-text));
26
- background-color: var(--intent-color, var(--button-color-background));
27
- border-color: var(--intent-color-border, var(--button-color-border));
28
- border-style: solid;
29
- border-width: var(--button-border-width);
30
- font-size: var(--button-font-size);
31
- font-weight: var(--button-font-weight);
32
- line-height: var(--button-line-height);
33
- margin-block-end: var(--button-margin-bottom);
34
- margin-inline-end: var(--button-margin-left);
35
- padding-block: var(--button-padding-vertical);
36
- padding-inline: var(--button-padding-horizontal);
37
-
38
- text-align: left;
39
- text-decoration: none;
40
-
41
- /* component states */
42
- &:hover {
43
- background-color: var(
44
- --intent-color-hover,
45
- var(--button-color-background-hover)
46
- );
47
- border-color: var(
48
- --intent-color-border-hover,
49
- var(--button-color-border-hover)
50
- );
51
- }
52
-
53
- &:active {
54
- background-color: var(
55
- --intent-color-active,
56
- var(--button-color-background-active)
57
- );
58
- border-color: var(
59
- --intent-color-border-active,
60
- var(--button-color-border-active)
61
- );
62
- }
63
- }
@@ -1,79 +0,0 @@
1
- /* @canonical/generator-canonical-ds 0.4.0-experimental.0 */
2
-
3
- .ds.chip {
4
- border-color: var(--intent-color-border, var(--chip-color-border));
5
- border-style: solid;
6
- border-radius: var(--chip-border-radius);
7
- border-width: var(--chip-border-width);
8
-
9
- color: var(--intent-color-text-tinted, var(--chip-color-text));
10
- background-color: var(--intent-color-tinted, var(--chip-color-background));
11
-
12
- display: inline-flex;
13
- align-items: baseline;
14
-
15
- user-select: none;
16
- white-space: nowrap;
17
-
18
- font-size: var(--chip-font-size);
19
- font-weight: var(--chip-font-weight);
20
- line-height: var(--chip-line-height);
21
-
22
- margin-block-end: var(--chip-margin-bottom);
23
- margin-inline-end: var(--chip-margin-left);
24
- padding-block: var(--chip-padding-vertical);
25
- padding-inline: var(--chip-padding-horizontal);
26
-
27
- & > .lead {
28
- font-variant-caps: all-small-caps;
29
- font-variant-numeric: oldstyle-nums;
30
- }
31
-
32
- & > .lead + .value::before {
33
- content: ": ";
34
- }
35
-
36
- & > .lead,
37
- & > .value {
38
- display: inline;
39
- overflow: hidden;
40
- text-overflow: ellipsis;
41
- }
42
-
43
- & > .dismiss {
44
- background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23000' fill-rule='nonzero' d='M13.041 1.898l1.06 1.06L9.062 8l5.04 5.042-1.06 1.06L8 9.062 2.96 14.1l-1.06-1.06L6.938 8 1.9 2.96l1.06-1.06 5.04 5.04z'/%3E%3C/svg%3E");
45
- background-color: var(--chip-color-background);
46
- align-self: center;
47
- background-size: 0.75rem;
48
- background-repeat: no-repeat;
49
- background-position: center;
50
- display: inline-block;
51
- cursor: pointer;
52
- margin-left: var(--spacing-horizontal-xsmall);
53
- flex: 0 0 auto;
54
- border-radius: 50%;
55
- border-color: transparent;
56
- height: var(--font-size-default);
57
- width: var(--font-size-default);
58
- }
59
-
60
- &:is(button) {
61
- cursor: pointer;
62
- }
63
-
64
- &:hover:not(:has(.dismiss)),
65
- & > .dismiss:hover {
66
- background-color: var(
67
- --intent-color-tinted-hover,
68
- var(--chip-color-background-hover)
69
- );
70
- }
71
-
72
- &:active:not(:has(.dismiss)),
73
- & > .dismiss:active {
74
- background-color: var(
75
- --intent-color-tinted-active,
76
- var(--chip-color-background-active)
77
- );
78
- }
79
- }
@@ -1,15 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import "./Chip.css";
3
- const componentCssClassName = "ds chip";
4
- /**
5
- * description of the Chip component
6
- * @returns {React.ReactElement} - Rendered Chip
7
- */
8
- const Chip = ({ appearance = "neutral", lead, value, onClick, onDismiss, id, className, style, ...props }) => {
9
- const Container = onClick ? "button" : "span";
10
- return (_jsxs(Container, { id: id, style: style, className: [componentCssClassName, appearance, className]
11
- .filter(Boolean)
12
- .join(" "), onClick: onClick, ...props, children: [lead && _jsx("span", { className: "lead", children: lead }), value && _jsx("span", { className: "value", children: value }), onDismiss && (_jsx("button", { type: "button", className: "dismiss", "aria-label": "Dismiss", onClick: () => onDismiss() }))] }));
13
- };
14
- export default Chip;
15
- //# sourceMappingURL=Chip.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Chip.js","sourceRoot":"","sources":["../../../../src/ui/Chip/Chip.tsx"],"names":[],"mappings":";AAEA,OAAO,YAAY,CAAC;AAGpB,MAAM,qBAAqB,GAAG,SAAS,CAAC;AAExC;;;GAGG;AACH,MAAM,IAAI,GAAG,CAAC,EACZ,UAAU,GAAG,SAAS,EACtB,IAAI,EACJ,KAAK,EACL,OAAO,EACP,SAAS,EACT,EAAE,EACF,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACM,EAAsB,EAAE;IACtC,MAAM,SAAS,GAAG,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;IAC9C,OAAO,CACL,MAAC,SAAS,IACR,EAAE,EAAE,EAAE,EACN,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,CAAC,qBAAqB,EAAE,UAAU,EAAE,SAAS,CAAC;aACtD,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,GAAG,CAAC,EACZ,OAAO,EAAE,OAAO,KACZ,KAAK,aAER,IAAI,IAAI,eAAM,SAAS,EAAC,MAAM,YAAE,IAAI,GAAQ,EAC5C,KAAK,IAAI,eAAM,SAAS,EAAC,OAAO,YAAE,KAAK,GAAQ,EAC/C,SAAS,IAAI,CACZ,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,SAAS,gBACR,SAAS,EACpB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,GAC1B,CACH,IACS,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,4 +0,0 @@
1
- /* @canonical/generator-canonical-ds 0.4.0-experimental.0 */
2
- export { default as Chip } from "./Chip.js";
3
- export * from "./types.js";
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ui/Chip/index.ts"],"names":[],"mappings":"AAAA,4DAA4D;AAC5D,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ui/Chip/types.ts"],"names":[],"mappings":""}
@@ -1,6 +0,0 @@
1
- import type Props from "./types.js";
2
- import "./styles.css";
3
- /** Buttons are clickable elements used to perform an action. */
4
- declare const Button: ({ id, className, appearance, label, ...props }: Props) => React.ReactElement;
5
- export default Button;
6
- //# sourceMappingURL=Button.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/ui/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,cAAc,CAAC;AAEtB,gEAAgE;AAChE,QAAA,MAAM,MAAM,mDAMT,KAAK,KAAG,KAAK,CAAC,YAahB,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,3 +0,0 @@
1
- export { default as Button } from "./Button.js";
2
- export type { default as ButtonProps, BaseProps as ButtonBaseProps, } from "./types.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAChD,YAAY,EACV,OAAO,IAAI,WAAW,EACtB,SAAS,IAAI,eAAe,GAC7B,MAAM,YAAY,CAAC"}
@@ -1,15 +0,0 @@
1
- import type React from "react";
2
- export interface BaseProps {
3
- id?: string;
4
- /** Additional CSS classes */
5
- className?: string;
6
- /** The visual style of the button */
7
- appearance?: "neutral" | "base" | "positive" | "negative" | "link";
8
- /** Button contents */
9
- label: string;
10
- /** Optional click handler */
11
- onClick?: () => void;
12
- }
13
- type Props = BaseProps & React.ButtonHTMLAttributes<HTMLButtonElement>;
14
- export default Props;
15
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/Button/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,MAAM,WAAW,SAAS;IAExB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qCAAqC;IACrC,UAAU,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,MAAM,CAAC;IACnE,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,KAAK,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AAEvE,eAAe,KAAK,CAAC"}
@@ -1,10 +0,0 @@
1
- import type React from "react";
2
- import "./Chip.css";
3
- import type { ChipPropsType } from "./types.js";
4
- /**
5
- * description of the Chip component
6
- * @returns {React.ReactElement} - Rendered Chip
7
- */
8
- declare const Chip: ({ appearance, lead, value, onClick, onDismiss, id, className, style, ...props }: ChipPropsType) => React.ReactElement;
9
- export default Chip;
10
- //# sourceMappingURL=Chip.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../../src/ui/Chip/Chip.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIhD;;;GAGG;AACH,QAAA,MAAM,IAAI,oFAUP,aAAa,KAAG,KAAK,CAAC,YAwBxB,CAAC;AAEF,eAAe,IAAI,CAAC"}
@@ -1,3 +0,0 @@
1
- export { default as Chip } from "./Chip.js";
2
- export * from "./types.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ui/Chip/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,IAAI,EAAE,MAAM,WAAW,CAAC;AAC5C,cAAc,YAAY,CAAC"}
@@ -1,27 +0,0 @@
1
- import type React from "react";
2
- /**
3
- * Props for the `Chip` component.
4
- */
5
- export interface ChipProps {
6
- /**
7
- * The chip’s appearance.
8
- * @default "neutral"
9
- */
10
- appearance?: "neutral" | "positive" | "negative" | "caution" | "information";
11
- /** Text shown before the value. */
12
- lead?: string;
13
- /** The chip’s value text. */
14
- value?: string;
15
- /** Called when the chip is clicked. */
16
- onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
17
- /** Called when the chip is dismissed. */
18
- onDismiss?: () => void;
19
- /** Unique identifier for the chip. */
20
- id?: string;
21
- /** Additional CSS class names. */
22
- className?: string;
23
- /** Inline styles for the chip. */
24
- style?: React.CSSProperties;
25
- }
26
- export type ChipPropsType = ChipProps & Omit<React.HTMLAttributes<HTMLButtonElement>, "children">;
27
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ui/Chip/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,GAAG,aAAa,CAAC;IAE7E,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,uCAAuC;IACvC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC;IAE/D,yCAAyC;IACzC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IAEvB,sCAAsC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,kCAAkC;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC;CAC7B;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,GACnC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,EAAE,UAAU,CAAC,CAAC"}