@clicoh/orion-library 1.2.0-beta.24 → 1.2.0-beta.25

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 (56) hide show
  1. package/assets/css/expresivo.css +136 -11
  2. package/dist/components/01-atoms/CodeBlock/CodeBlock.d.ts +19 -5
  3. package/dist/components/01-atoms/CodeBlock/CodeBlock.d.ts.map +1 -1
  4. package/dist/components/01-atoms/CodeBlock/CodeBlock.jsx +41 -9
  5. package/dist/components/01-atoms/CodeBlock/CodeBlock.jsx.map +1 -1
  6. package/dist/components/02-molecules/Table/Table.d.ts +28 -1
  7. package/dist/components/02-molecules/Table/Table.d.ts.map +1 -1
  8. package/dist/components/02-molecules/Table/Table.jsx +119 -64
  9. package/dist/components/02-molecules/Table/Table.jsx.map +1 -1
  10. package/dist/components/02-molecules/Table/index.d.ts +1 -1
  11. package/dist/components/02-molecules/Table/index.d.ts.map +1 -1
  12. package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.d.ts +3 -1
  13. package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.d.ts.map +1 -1
  14. package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.jsx +7 -3
  15. package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.jsx.map +1 -1
  16. package/dist/components/04-templates/LoginTemplate/LoginForm.d.ts +5 -2
  17. package/dist/components/04-templates/LoginTemplate/LoginForm.d.ts.map +1 -1
  18. package/dist/components/04-templates/LoginTemplate/LoginForm.jsx +3 -2
  19. package/dist/components/04-templates/LoginTemplate/LoginForm.jsx.map +1 -1
  20. package/expresivo/ExpCollapseToggle/ExpCollapseToggle.d.ts +6 -2
  21. package/expresivo/ExpCollapseToggle/ExpCollapseToggle.d.ts.map +1 -1
  22. package/expresivo/ExpCollapseToggle/ExpCollapseToggle.jsx +5 -3
  23. package/expresivo/ExpCollapseToggle/ExpCollapseToggle.jsx.map +1 -1
  24. package/expresivo/ExpLadder/ExpLadder.d.ts +2 -1
  25. package/expresivo/ExpLadder/ExpLadder.d.ts.map +1 -1
  26. package/expresivo/ExpLadder/ExpLadder.jsx +7 -4
  27. package/expresivo/ExpLadder/ExpLadder.jsx.map +1 -1
  28. package/expresivo/ExpMascot/ExpMascot.d.ts +6 -2
  29. package/expresivo/ExpMascot/ExpMascot.d.ts.map +1 -1
  30. package/expresivo/ExpMascot/ExpMascot.jsx +6 -3
  31. package/expresivo/ExpMascot/ExpMascot.jsx.map +1 -1
  32. package/expresivo/ExpPageHero/ExpPageHero.d.ts +21 -5
  33. package/expresivo/ExpPageHero/ExpPageHero.d.ts.map +1 -1
  34. package/expresivo/ExpPageHero/ExpPageHero.jsx +28 -8
  35. package/expresivo/ExpPageHero/ExpPageHero.jsx.map +1 -1
  36. package/expresivo/ExpPageHero/index.d.ts +1 -1
  37. package/expresivo/ExpPageHero/index.d.ts.map +1 -1
  38. package/expresivo/ExpPillButton/ExpPillButton.d.ts +8 -4
  39. package/expresivo/ExpPillButton/ExpPillButton.d.ts.map +1 -1
  40. package/expresivo/ExpPillButton/ExpPillButton.jsx +42 -12
  41. package/expresivo/ExpPillButton/ExpPillButton.jsx.map +1 -1
  42. package/expresivo/ExpPillButton/index.d.ts +1 -1
  43. package/expresivo/ExpPillButton/index.d.ts.map +1 -1
  44. package/expresivo/ExpTabs/ExpTabs.d.ts +52 -0
  45. package/expresivo/ExpTabs/ExpTabs.d.ts.map +1 -0
  46. package/expresivo/ExpTabs/ExpTabs.jsx +105 -0
  47. package/expresivo/ExpTabs/ExpTabs.jsx.map +1 -0
  48. package/expresivo/ExpTabs/index.d.ts +3 -0
  49. package/expresivo/ExpTabs/index.d.ts.map +1 -0
  50. package/expresivo/ExpTabs/index.js +2 -0
  51. package/expresivo/ExpTabs/index.js.map +1 -0
  52. package/expresivo/index.d.ts +1 -0
  53. package/expresivo/index.d.ts.map +1 -1
  54. package/expresivo/index.js +1 -0
  55. package/expresivo/index.js.map +1 -1
  56. package/package.json +1 -1
@@ -50,6 +50,10 @@
50
50
  --exp-row-edge: var(--color-gray-5);
51
51
  --exp-row-edge-hover: #c9c3fd;
52
52
 
53
+ --exp-code-bg: var(--color-lavender-3);
54
+ --exp-code-drop: 0 2px 8px rgba(106, 93, 249, 0.06);
55
+ --exp-code-drop-hover: 0 8px 20px rgba(106, 93, 249, 0.14);
56
+
53
57
  --exp-nav-glow: rgba(106, 93, 249, 0.22);
54
58
 
55
59
  --exp-hero-dots: rgba(106, 93, 249, 0.14);
@@ -99,6 +103,10 @@
99
103
  --exp-row-edge: var(--color-gray-1);
100
104
  --exp-row-edge-hover: #4a3fd0;
101
105
 
106
+ --exp-code-bg: var(--color-gray-dark-2);
107
+ --exp-code-drop: none;
108
+ --exp-code-drop-hover: none;
109
+
102
110
  --exp-nav-glow: rgba(137, 128, 255, 0.35);
103
111
 
104
112
  --exp-hero-dots: rgba(137, 128, 255, 0.16);
@@ -224,17 +232,24 @@
224
232
  animation: exp-swing 3.2s ease-in-out infinite;
225
233
  }
226
234
 
227
- /* Page hero (ExpPageHero): a band only on wide screens ------------------ */
235
+ /* Page hero (ExpPageHero): a band on wide screens, and below them only with
236
+ narrowLayout="band" ---------------------------------------------------- */
237
+
238
+ .exp-hero {
239
+ border: 1px solid var(--exp-hero-edge);
240
+ border-radius: 1rem;
241
+ background:
242
+ radial-gradient(var(--exp-hero-dots) 1px, transparent 1.4px) 0 0 / 14px 14px,
243
+ var(--exp-hero-bg);
244
+ box-shadow: var(--exp-hero-drop);
245
+ }
228
246
 
229
- @media (min-width: 64rem) {
230
- .exp-hero {
231
- border: 1px solid var(--exp-hero-edge);
232
- border-radius: 1rem;
233
- background:
234
- radial-gradient(var(--exp-hero-dots) 1px, transparent 1.4px) 0 0 / 14px
235
- 14px,
236
- var(--exp-hero-bg);
237
- box-shadow: var(--exp-hero-drop);
247
+ @media (max-width: 63.99rem) {
248
+ .exp-hero[data-narrow='row'] {
249
+ border: 0;
250
+ border-radius: 0;
251
+ background: none;
252
+ box-shadow: none;
238
253
  }
239
254
  }
240
255
 
@@ -1014,6 +1029,108 @@
1014
1029
  background: var(--exp-row-bg-hover);
1015
1030
  }
1016
1031
 
1032
+ /* Rows that open a detail: one tbody per row, so the gap moves from
1033
+ border-spacing to a spacer row and the open row joins its detail. */
1034
+
1035
+ :root:has(.exp-scope[data-exp-tables='cards'])
1036
+ [data-orion-part='table']:has(> [data-orion-part='table-group']):not(
1037
+ [data-orion-part='data-table'][data-modifier='card'] *
1038
+ ) {
1039
+ border-spacing: 0;
1040
+ }
1041
+
1042
+ :root:has(.exp-scope[data-exp-tables='cards'])
1043
+ [data-orion-part='table-group']:not(
1044
+ [data-orion-part='data-table'][data-modifier='card'] *
1045
+ )::before {
1046
+ content: '';
1047
+ display: table-row;
1048
+ height: 8px;
1049
+ }
1050
+
1051
+ :root:has(.exp-scope[data-exp-tables='cards'])
1052
+ [data-orion-part='table-row'][data-expanded]:not(
1053
+ [data-orion-part='data-table'][data-modifier='card'] *
1054
+ )
1055
+ > td {
1056
+ border-color: var(--exp-row-edge-hover);
1057
+ border-bottom-color: var(--exp-row-edge);
1058
+ background: var(--exp-row-bg-hover);
1059
+ }
1060
+
1061
+ :root:has(.exp-scope[data-exp-tables='cards'])
1062
+ [data-orion-part='table-row'][data-expanded]:not(
1063
+ [data-orion-part='data-table'][data-modifier='card'] *
1064
+ )
1065
+ > td:first-child {
1066
+ border-radius: 14px 0 0 0;
1067
+ }
1068
+
1069
+ :root:has(.exp-scope[data-exp-tables='cards'])
1070
+ [data-orion-part='table-row'][data-expanded]:not(
1071
+ [data-orion-part='data-table'][data-modifier='card'] *
1072
+ )
1073
+ > td:last-child {
1074
+ border-radius: 0 14px 0 0;
1075
+ }
1076
+
1077
+ :root:has(.exp-scope[data-exp-tables='cards'])
1078
+ [data-orion-part='table-detail']:not(
1079
+ [data-orion-part='data-table'][data-modifier='card'] *
1080
+ ) {
1081
+ border: 0;
1082
+ background: transparent;
1083
+ }
1084
+
1085
+ :root:has(.exp-scope[data-exp-tables='cards'])
1086
+ [data-orion-part='table-detail']:not(
1087
+ [data-orion-part='data-table'][data-modifier='card'] *
1088
+ )
1089
+ > td {
1090
+ padding: 16px 16px 20px;
1091
+ border: 1px solid var(--exp-row-edge-hover);
1092
+ border-top: 0;
1093
+ border-radius: 0 0 14px 14px;
1094
+ background: var(--exp-code-bg);
1095
+ }
1096
+
1097
+ /* Skin: code blocks with a title (CodeBlock title) ---------------------- */
1098
+
1099
+ /* A titled block stands alone, as a card: the band along the top and the
1100
+ code on a tinted surface. */
1101
+ :root:has(.exp-scope)
1102
+ [data-orion-part='code-block']:has([data-orion-part='code-block-title']) {
1103
+ border-color: var(--exp-card-edge);
1104
+ border-radius: 16px;
1105
+ padding-top: 3px;
1106
+ background:
1107
+ var(--exp-card-band) top / 100% 3px no-repeat,
1108
+ var(--exp-card-bg);
1109
+ box-shadow: var(--exp-code-drop);
1110
+ transition:
1111
+ transform 200ms var(--exp-ease-out),
1112
+ box-shadow 200ms ease;
1113
+ }
1114
+
1115
+ :root:has(.exp-scope)
1116
+ [data-orion-part='code-block']:has(
1117
+ [data-orion-part='code-block-title']
1118
+ ):hover {
1119
+ box-shadow: var(--exp-code-drop-hover);
1120
+ }
1121
+
1122
+ :root:has(.exp-scope)
1123
+ [data-orion-part='code-block']:has([data-orion-part='code-block-title'])
1124
+ > [data-orion-part='code-block-header'] {
1125
+ padding: 8px 8px 8px 16px;
1126
+ }
1127
+
1128
+ :root:has(.exp-scope)
1129
+ [data-orion-part='code-block']:has([data-orion-part='code-block-title'])
1130
+ > pre {
1131
+ background: var(--exp-code-bg);
1132
+ }
1133
+
1017
1134
  /* Hover movement, only without reduced motion --------------------------- */
1018
1135
 
1019
1136
  @media (prefers-reduced-motion: no-preference) {
@@ -1063,10 +1180,17 @@
1063
1180
  :root:has(.exp-scope[data-exp-tables='cards'])
1064
1181
  [data-orion-part='table-row']:not(
1065
1182
  [data-orion-part='data-table'][data-modifier='card'] *
1066
- ):is(:hover, :focus-visible, [data-selected])
1183
+ ):not([data-expanded]):is(:hover, :focus-visible, [data-selected])
1067
1184
  > td {
1068
1185
  transform: translateY(-2px);
1069
1186
  }
1187
+
1188
+ :root:has(.exp-scope)
1189
+ [data-orion-part='code-block']:has(
1190
+ [data-orion-part='code-block-title']
1191
+ ):hover {
1192
+ transform: translateY(-2px);
1193
+ }
1070
1194
  }
1071
1195
 
1072
1196
  @media (prefers-reduced-motion: reduce) {
@@ -1096,6 +1220,7 @@
1096
1220
  :root:has(.exp-scope) textarea[data-orion-part='field-control'],
1097
1221
  :root:has(.exp-scope) [data-orion-part='field-icon'],
1098
1222
  :root:has(.exp-scope) [data-orion-part='table-row'] > td,
1223
+ :root:has(.exp-scope) [data-orion-part='code-block'],
1099
1224
  :root:has(.exp-scope) [data-orion-part='menu-link']::before {
1100
1225
  transition: none;
1101
1226
  }
@@ -10,6 +10,12 @@ export type CodeBlockProps = {
10
10
  copiedLabel: string;
11
11
  /** Shown in the header (`ts`, `sql`, `diff`). No syntax coloring is applied. */
12
12
  language?: string;
13
+ /** Header content before the language, such as where the excerpt comes from. */
14
+ title?: ReactNode;
15
+ /** What the copy button writes, when it is not the code itself. */
16
+ copyText?: string;
17
+ /** Text to mark wherever it appears in the code, ignoring case. */
18
+ mark?: string;
13
19
  /** Number of the first line. Line numbers are shown only when it is set. */
14
20
  startLine?: number;
15
21
  /** Lines to emphasize, as inclusive ranges in the same numbering. */
@@ -18,7 +24,7 @@ export type CodeBlockProps = {
18
24
  wrap?: boolean;
19
25
  /** Called when the browser refuses to write to the clipboard. */
20
26
  onCopyError?: (error: unknown) => void;
21
- } & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
27
+ } & Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'title'>;
22
28
  /**
23
29
  * Read-only block of source code with a copy button. Shows an excerpt
24
30
  * exactly as written: monospace and, by default, no wrapping, with horizontal
@@ -26,12 +32,17 @@ export type CodeBlockProps = {
26
32
  *
27
33
  * With `wrap`, a line longer than the block continues on the next row, under
28
34
  * the code and not under the line numbers. Use it where scrolling sideways is
29
- * awkward, such as narrow screens or a command to read whole. Copying always
30
- * takes the original text.
35
+ * awkward, such as narrow screens or a command to read whole. Copying takes
36
+ * the original text, or `copyText` when the button should copy something
37
+ * else, such as the file and line the excerpt comes from.
31
38
  *
32
39
  * Setting `startLine` numbers the lines, so an excerpt from the middle of a
33
40
  * file keeps its real line numbers; `highlight` then marks ranges in that
34
- * same numbering. There is no syntax coloring.
41
+ * same numbering, and `mark` marks every match of a text inside the lines,
42
+ * such as the query that found the excerpt. There is no syntax coloring.
43
+ *
44
+ * `title` goes in the header, before the language label: where the excerpt
45
+ * comes from, as a file path or a set of badges.
35
46
  *
36
47
  * Copying uses the Clipboard API, which browsers only expose on secure
37
48
  * origins (`https` or `localhost`). When it fails the button stays as it was
@@ -53,6 +64,9 @@ export type CodeBlockProps = {
53
64
  * @param {string} props.copyLabel - Accessible name and tooltip of the copy button.
54
65
  * @param {string} props.copiedLabel - Shown and announced right after copying.
55
66
  * @param {string} [props.language] - Label shown in the header.
67
+ * @param {ReactNode} [props.title] - Header content before the language label.
68
+ * @param {string} [props.copyText] - What the copy button writes; defaults to `code`.
69
+ * @param {string} [props.mark] - Text marked wherever it appears in the code, ignoring case.
56
70
  * @param {number} [props.startLine] - Number of the first line; enables line numbers.
57
71
  * @param {CodeBlockRange[]} [props.highlight=[]] - Inclusive line ranges to emphasize.
58
72
  * @param {boolean} [props.wrap=false] - Long lines continue on the next row instead of scrolling.
@@ -60,5 +74,5 @@ export type CodeBlockProps = {
60
74
  *
61
75
  * @returns {ReactNode} The rendered CodeBlock component.
62
76
  */
63
- export declare function CodeBlock({ code, copyLabel, copiedLabel, language, startLine, highlight, wrap, onCopyError, ...restProps }: CodeBlockProps): ReactNode;
77
+ export declare function CodeBlock({ code, copyLabel, copiedLabel, language, title, copyText, mark, startLine, highlight, wrap, onCopyError, ...restProps }: CodeBlockProps): ReactNode;
64
78
  //# sourceMappingURL=CodeBlock.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/CodeBlock/CodeBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAKf,iEAAiE;AACjE,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG;IAC3B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B,yEAAyE;IACzE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iEAAiE;IACjE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;AAQrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,SAAS,EACT,SAAc,EACd,IAAY,EACZ,WAAW,EACX,GAAG,SAAS,EACb,EAAE,cAAc,GAAG,SAAS,CAmG5B"}
1
+ {"version":3,"file":"CodeBlock.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/CodeBlock/CodeBlock.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAKf,iEAAiE;AACjE,MAAM,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;AAExD,MAAM,MAAM,cAAc,GAAG;IAC3B,yCAAyC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;IAClB,yEAAyE;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,gFAAgF;IAChF,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,SAAS,CAAC,EAAE,cAAc,EAAE,CAAC;IAC7B,yEAAyE;IACzE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iEAAiE;IACjE,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,CAAC;AAmC/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgDG;AACH,wBAAgB,SAAS,CAAC,EACxB,IAAI,EACJ,SAAS,EACT,WAAW,EACX,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,SAAS,EACT,SAAc,EACd,IAAY,EACZ,WAAW,EACX,GAAG,SAAS,EACb,EAAE,cAAc,GAAG,SAAS,CAgH5B"}
@@ -2,12 +2,32 @@
2
2
  import clsx from 'clsx';
3
3
  import { useEffect, useRef, useState, } from 'react';
4
4
  import { FiCheck, FiCopy } from 'react-icons/fi';
5
- import { Each } from '../../00-base';
5
+ import { Each, Show } from '../../00-base';
6
6
  import { IconButton } from '../IconButton';
7
7
  const COPIED_FEEDBACK_MS = 1600;
8
8
  function isHighlighted(line, ranges) {
9
9
  return ranges.some(([from, to]) => line >= from && line <= to);
10
10
  }
11
+ function markPattern(mark) {
12
+ const text = mark?.trim();
13
+ if (!text)
14
+ return undefined;
15
+ return new RegExp(`(${text.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')})`, 'i');
16
+ }
17
+ function renderLine(line, pattern) {
18
+ if (!line)
19
+ return ' ';
20
+ if (!pattern)
21
+ return line;
22
+ return (<Each of={line.split(pattern)} render={(part, index) => (<Show>
23
+ <Show.When isTrue={index % 2 === 1}>
24
+ <mark className="dark:bg-lavender-dark-1 bg-lavender-1 rounded-sm text-current shadow-[0_0_0_1px_rgba(106,93,249,0.35)]">
25
+ {part}
26
+ </mark>
27
+ </Show.When>
28
+ <Show.Else>{part}</Show.Else>
29
+ </Show>)}/>);
30
+ }
11
31
  /**
12
32
  * Read-only block of source code with a copy button. Shows an excerpt
13
33
  * exactly as written: monospace and, by default, no wrapping, with horizontal
@@ -15,12 +35,17 @@ function isHighlighted(line, ranges) {
15
35
  *
16
36
  * With `wrap`, a line longer than the block continues on the next row, under
17
37
  * the code and not under the line numbers. Use it where scrolling sideways is
18
- * awkward, such as narrow screens or a command to read whole. Copying always
19
- * takes the original text.
38
+ * awkward, such as narrow screens or a command to read whole. Copying takes
39
+ * the original text, or `copyText` when the button should copy something
40
+ * else, such as the file and line the excerpt comes from.
20
41
  *
21
42
  * Setting `startLine` numbers the lines, so an excerpt from the middle of a
22
43
  * file keeps its real line numbers; `highlight` then marks ranges in that
23
- * same numbering. There is no syntax coloring.
44
+ * same numbering, and `mark` marks every match of a text inside the lines,
45
+ * such as the query that found the excerpt. There is no syntax coloring.
46
+ *
47
+ * `title` goes in the header, before the language label: where the excerpt
48
+ * comes from, as a file path or a set of badges.
24
49
  *
25
50
  * Copying uses the Clipboard API, which browsers only expose on secure
26
51
  * origins (`https` or `localhost`). When it fails the button stays as it was
@@ -42,6 +67,9 @@ function isHighlighted(line, ranges) {
42
67
  * @param {string} props.copyLabel - Accessible name and tooltip of the copy button.
43
68
  * @param {string} props.copiedLabel - Shown and announced right after copying.
44
69
  * @param {string} [props.language] - Label shown in the header.
70
+ * @param {ReactNode} [props.title] - Header content before the language label.
71
+ * @param {string} [props.copyText] - What the copy button writes; defaults to `code`.
72
+ * @param {string} [props.mark] - Text marked wherever it appears in the code, ignoring case.
45
73
  * @param {number} [props.startLine] - Number of the first line; enables line numbers.
46
74
  * @param {CodeBlockRange[]} [props.highlight=[]] - Inclusive line ranges to emphasize.
47
75
  * @param {boolean} [props.wrap=false] - Long lines continue on the next row instead of scrolling.
@@ -49,7 +77,7 @@ function isHighlighted(line, ranges) {
49
77
  *
50
78
  * @returns {ReactNode} The rendered CodeBlock component.
51
79
  */
52
- export function CodeBlock({ code, copyLabel, copiedLabel, language, startLine, highlight = [], wrap = false, onCopyError, ...restProps }) {
80
+ export function CodeBlock({ code, copyLabel, copiedLabel, language, title, copyText, mark, startLine, highlight = [], wrap = false, onCopyError, ...restProps }) {
53
81
  const [isCopied, setIsCopied] = useState(false);
54
82
  const resetTimer = useRef(undefined);
55
83
  useEffect(() => () => clearTimeout(resetTimer.current), []);
@@ -57,9 +85,10 @@ export function CodeBlock({ code, copyLabel, copiedLabel, language, startLine, h
57
85
  const isNumbered = startLine !== undefined;
58
86
  const firstLine = startLine ?? 1;
59
87
  const gutterWidth = `${String(firstLine + lines.length - 1).length}ch`;
88
+ const pattern = markPattern(mark);
60
89
  const copy = async () => {
61
90
  try {
62
- await navigator.clipboard.writeText(code);
91
+ await navigator.clipboard.writeText(copyText ?? code);
63
92
  }
64
93
  catch (error) {
65
94
  onCopyError?.(error);
@@ -69,8 +98,11 @@ export function CodeBlock({ code, copyLabel, copiedLabel, language, startLine, h
69
98
  clearTimeout(resetTimer.current);
70
99
  resetTimer.current = setTimeout(() => setIsCopied(false), COPIED_FEEDBACK_MS);
71
100
  };
72
- return (<div {...restProps} className={clsx('border-gray-5 bg-gray-7 dark:border-gray-1 dark:bg-black-1 min-w-0 overflow-hidden rounded-lg border', restProps.className)}>
73
- <div className="border-gray-5 dark:border-gray-1 flex items-center justify-between gap-2 border-b py-1 pr-1 pl-3">
101
+ return (<div {...restProps} data-orion-part="code-block" className={clsx('border-gray-5 bg-gray-7 dark:border-gray-1 dark:bg-black-1 min-w-0 overflow-hidden rounded-lg border', restProps.className)}>
102
+ <div data-orion-part="code-block-header" className="border-gray-5 dark:border-gray-1 flex items-center justify-between gap-2 border-b py-1 pr-1 pl-3">
103
+ {!!title && (<div data-orion-part="code-block-title" className="flex min-w-0 flex-1 flex-wrap items-center gap-x-3 gap-y-1 py-1">
104
+ {title}
105
+ </div>)}
74
106
  <span className="text-gray-1 dark:text-gray-2 truncate text-xs leading-4">
75
107
  {language}
76
108
  </span>
@@ -93,7 +125,7 @@ export function CodeBlock({ code, copyLabel, copiedLabel, language, startLine, h
93
125
  <span className={clsx('pr-3', wrap
94
126
  ? 'min-w-0 flex-1 wrap-anywhere whitespace-pre-wrap'
95
127
  : 'whitespace-pre', !isNumbered && 'pl-3')}>
96
- {line || ' '}
128
+ {renderLine(line, pattern)}
97
129
  </span>
98
130
  {'\n'}
99
131
  </span>);
@@ -1 +1 @@
1
- {"version":3,"file":"CodeBlock.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/CodeBlock/CodeBlock.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAGL,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAwB3C,MAAM,kBAAkB,GAAG,IAAI,CAAC;AAEhC,SAAS,aAAa,CAAC,IAAY,EAAE,MAAwB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,EAAE;YACtB,MAAM,MAAM,GAAG,SAAS,GAAG,KAAK,CAAC;YACjC,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;YAElD,OAAO,CACL,CAAC,IAAI,CACH,SAAS,CAAC,CAAC,IAAI,CACb,MAAM,EACN,QAAQ,IAAI,uCAAuC,CACpD,CAAC,CAEF;kBAAA,CAAC,CAAC,CAAC,UAAU,IAAI,CACf,CAAC,IAAI,CACH,WAAW,CAAC,MAAM,CAClB,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC,CAC9B,SAAS,CAAC,CAAC,IAAI,CACb,kDAAkD,EAClD,QAAQ;wBACN,CAAC,CAAC,qDAAqD;wBACvD,CAAC,CAAC,8BAA8B,CACnC,CAAC,CAEF;sBAAA,CAAC,MAAM,CACT;oBAAA,EAAE,IAAI,CAAC,CACR,CACD;kBAAA,CAAC,IAAI,CACH,SAAS,CAAC,CAAC,IAAI,CACb,MAAM,EACN,IAAI;oBACF,CAAC,CAAC,kDAAkD;oBACpD,CAAC,CAAC,gBAAgB,EACpB,CAAC,UAAU,IAAI,MAAM,CACtB,CAAC,CAEF;oBAAA,CAAC,IAAI,IAAI,GAAG,CACd;kBAAA,EAAE,IAAI,CACN;kBAAA,CAAC,IAAI,CACP;gBAAA,EAAE,IAAI,CAAC,CACR,CAAC;QACJ,CAAC,CAAC,EAEN;QAAA,EAAE,IAAI,CACR;MAAA,EAAE,GAAG,CACP;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"CodeBlock.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/CodeBlock/CodeBlock.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAGL,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,OAAO,EAAE,MAAM,E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AAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
@@ -9,6 +9,17 @@ export type TableItemWithTemplate = {
9
9
  export type TableCellValue = TablePrimitive | TableItemWithTemplate;
10
10
  export type TableItem = Record<string, TableCellValue>;
11
11
  export type TableItemSelection = Record<string, TableItem>;
12
+ /** Content that a row opens under itself, across every column. */
13
+ export type TableRowDetail = {
14
+ /** Content shown under the row while it is open. */
15
+ render: (item: TableItem) => ReactNode;
16
+ /** Values of the `id` column of the open rows. */
17
+ openIds: TablePrimitive[];
18
+ /** Called when the user opens or closes a row. */
19
+ onToggle: (item: TableItem) => void;
20
+ /** Accessible name and tooltip of the toggle of a row. */
21
+ toggleLabel: (item: TableItem) => string;
22
+ };
12
23
  type TableNotSelectableProps = {
13
24
  headers: {
14
25
  key: string;
@@ -31,6 +42,7 @@ type TableNotSelectableProps = {
31
42
  selectAllLabel?: string;
32
43
  getRowSelectionLabel?: (item: TableItem) => string;
33
44
  getRowActionLabel?: (item: TableItem) => string;
45
+ rowDetail?: TableRowDetail;
34
46
  } & HTMLAttributes<HTMLDivElement>;
35
47
  type TableSelectablePropsMultiple = {
36
48
  selectable?: true;
@@ -74,6 +86,20 @@ export type TableActions = ButtonHTMLAttributes<HTMLButtonElement> & {
74
86
  * numberOfRows={10}
75
87
  * />
76
88
  *
89
+ * @example
90
+ * // Rows that open a detail under themselves
91
+ * <Table
92
+ * headers={[{ key: 'name', title: 'Name' }]}
93
+ * id="id"
94
+ * data={rows}
95
+ * rowDetail={{
96
+ * render: (item) => <Details id={item.id} />,
97
+ * openIds: open,
98
+ * onToggle: (item) => toggle(item.id),
99
+ * toggleLabel: (item) => `Details of ${item.name}`,
100
+ * }}
101
+ * />
102
+ *
77
103
  * @param {Object} props - The properties for the Table component.
78
104
  * @param {Array<{ key: string, title: string | ReactNode }>} props.headers - The headers of the table.
79
105
  * @param {string} props.id - The unique identifier for each row.
@@ -88,10 +114,11 @@ export type TableActions = ButtonHTMLAttributes<HTMLButtonElement> & {
88
114
  * @param {boolean} [props.loading=false] - Whether the table is in a loading state.
89
115
  * @param {number} [props.numberOfRows=10] - The number of rows to display when loading.
90
116
  * @param {ReactNode} [props.empty=<TableEmpty />] - Content shown when `data` is empty.
117
+ * @param {TableRowDetail} [props.rowDetail] - Content each row opens under itself, across every column. Adds a chevron toggle at the end of the row; a click on the row toggles it too, instead of calling `action`.
91
118
  * @param {Object} restProps - Additional properties for the container div.
92
119
  *
93
120
  * @returns {ReactNode} The rendered Table component.
94
121
  */
95
- export declare function Table({ headers, id, data, action, actions, selectable, multiple, currentSelection, setCurrentSelection, tableProps, loading, numberOfRows, footer, empty, tableName, selectAllLabel, getRowSelectionLabel, getRowActionLabel, ...restProps }: TableProps): ReactNode;
122
+ export declare function Table({ headers, id, data, action, actions, selectable, multiple, currentSelection, setCurrentSelection, tableProps, loading, numberOfRows, footer, empty, tableName, selectAllLabel, getRowSelectionLabel, getRowActionLabel, rowDetail, ...restProps }: TableProps): ReactNode;
96
123
  export {};
97
124
  //# sourceMappingURL=Table.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/components/02-molecules/Table/Table.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EAGnB,KAAK,SAAS,EAEf,MAAM,OAAO,CAAC;AAGf,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAK/D,KAAK,UAAU,GACX,uBAAuB,GACvB,4BAA4B,GAC5B,0BAA0B,CAAC;AAE/B,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAEvD,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,cAAc,GAAG,qBAAqB,CAAC;AAEpE,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,M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EAAE,kBAAkB,KAAK,IAAI,CAAC;CAC1D,GAAG,IAAI,CACN,uBAAuB,EACvB,YAAY,GAAG,kBAAkB,GAAG,qBAAqB,GAAG,UAAU,CACvE,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,UAAU,CAAC,EAAE,IAAI,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,gBAAgB,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IACzC,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACjD,GAAG,IAAI,CACN,uBAAuB,EACvB,YAAY,GAAG,kBAAkB,GAAG,qBAAqB,GAAG,UAAU,CACvE,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GAAG;IACnE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,aAAa,CAAC;CAC1B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,wBAAgB,KAAK,CAAC,EACpB,OAAO,EACP,EAAE,EACF,IAAI,EACJ,MAAM,EACN,OAAO,EACP,UAAkB,EAClB,QAAe,EACf,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,OAAe,EACf,YAAiB,EACjB,MAAM,EACN,KAAK,EACL,SAAS,EACT,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,GAAG,SAAS,EACb,EAAE,UAAU,GAAG,SAAS,CAwTxB"}
1
+ {"version":3,"file":"Table.d.ts","sourceRoot":"","sources":["../../../../src/components/02-molecules/Table/Table.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,cAAc,EAGnB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAIf,OAAO,EAAY,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAK/D,KAAK,UAAU,GACX,uBAAuB,GACvB,4BAA4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