@vectara/vectara-ui 0.0.2 → 0.0.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.
@@ -0,0 +1,51 @@
1
+ name: publish-on-version-change
2
+ on:
3
+ push:
4
+ branches:
5
+ - main
6
+ jobs:
7
+ check-version-change:
8
+ name: check-version-change
9
+ runs-on: ubuntu-latest
10
+ outputs:
11
+ did-version-change: ${{ steps.check.outputs.changed }}
12
+ new-version: ${{ steps.check.outputs.version }}
13
+ type: ${{ steps.check.outputs.type }}
14
+ steps:
15
+ - name: Checkout repository
16
+ uses: actions/checkout@v2
17
+
18
+ # Determine if version has changed
19
+ - name: Check version changes
20
+ uses: EndBug/version-check@v2
21
+ with:
22
+ diff-search: true
23
+ id: check
24
+
25
+ publish-to-npm:
26
+ name: publish-to-npm
27
+ runs-on: ubuntu-latest
28
+ needs: [check-version-change]
29
+ if: needs.check-version-change.outputs.did-version-change == 'true'
30
+ steps:
31
+ - name: Checkout repository
32
+ uses: actions/checkout@v2
33
+
34
+ # Draft a release if version name changed
35
+ - name: Draft release
36
+ run: 'gh release create v${{ needs.check-version-change.outputs.new-version }} -d --title "Release ${{ needs.check-version-change.outputs.new-version }}" --generate-notes'
37
+ env:
38
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39
+
40
+ - name: Set up Node.js for NPM
41
+ uses: actions/setup-node@v4
42
+ with:
43
+ registry-url: "https://registry.npmjs.org"
44
+
45
+ - name: Build lib
46
+ run: "npm i && npm run buildLib"
47
+
48
+ - name: Publish package to NPM
49
+ run: npm publish --access=public
50
+ env:
51
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
@@ -11,5 +11,5 @@ const sizeToClassNameMap = {
11
11
  };
12
12
  export const VuiSpinner = ({ color = "accent", size = "m" }) => {
13
13
  const classes = classNames("vuiSpinner", sizeToClassNameMap[size], `vuiSpinner--${color}`);
14
- return (_jsx("div", Object.assign({ className: classes }, { children: _jsx("svg", Object.assign({ version: "1.1", xmlns: "http://www.w3.org/2000/svg", x: "0px", y: "0px", viewBox: "0 0 50 50" }, { children: _jsx("path", Object.assign({ fill: "#000", d: "M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z" }, { children: _jsx("animateTransform", { attributeType: "xml", attributeName: "transform", type: "rotate", from: "0 25 25", to: "360 25 25", dur: "0.6s", repeatCount: "indefinite" }) })) })) })));
14
+ return (_jsx("span", Object.assign({ className: classes }, { children: _jsx("svg", Object.assign({ version: "1.1", xmlns: "http://www.w3.org/2000/svg", x: "0px", y: "0px", viewBox: "0 0 50 50" }, { children: _jsx("path", Object.assign({ fill: "#000", d: "M43.935,25.145c0-10.318-8.364-18.683-18.683-18.683c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615c8.072,0,14.615,6.543,14.615,14.615H43.935z" }, { children: _jsx("animateTransform", { attributeType: "xml", attributeName: "transform", type: "rotate", from: "0 25 25", to: "360 25 25", dur: "0.6s", repeatCount: "indefinite" }) })) })) })));
15
15
  };
@@ -1,5 +1,9 @@
1
1
  @use "sass:map";
2
2
 
3
+ .vuiSpinner {
4
+ display: inline-block;
5
+ }
6
+
3
7
  // Color
4
8
  $color: (
5
9
  accent: (
@@ -1,7 +1,8 @@
1
1
  type Props = {
2
- summary: string;
2
+ summary?: string;
3
3
  className?: string;
4
4
  SummaryCitation: React.ComponentType<any>;
5
+ statusIndicator?: React.ReactNode;
5
6
  };
6
- export declare const VuiSummary: ({ summary, className, SummaryCitation }: Props) => import("react/jsx-runtime").JSX.Element;
7
+ export declare const VuiSummary: ({ summary, className, SummaryCitation, statusIndicator }: Props) => import("react/jsx-runtime").JSX.Element;
7
8
  export {};
@@ -1,4 +1,4 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import classNames from "classnames";
3
3
  import Markdown from "markdown-to-jsx";
4
4
  import { extractCitations } from "../../utils/citations/extractCitations";
@@ -27,17 +27,16 @@ const markDownCitations = (summary) => {
27
27
  }, [])
28
28
  .join("");
29
29
  };
30
- export const VuiSummary = ({ summary, className, SummaryCitation }) => {
30
+ export const VuiSummary = ({ summary, className, SummaryCitation, statusIndicator }) => {
31
31
  // Protect users' privacy in FullStory.
32
32
  // https://help.fullstory.com/hc/en-us/articles/360020623574-How-do-I-protect-my-users-privacy-in-FullStory-#01F5DPW1AJHZHR8TBM9YQEDRMH
33
33
  const classes = classNames("vuiSummary", "fs-mask", className);
34
- const markdown = markDownCitations(summary);
35
- return (_jsx("div", Object.assign({ className: classes, dir: "auto" }, { children: _jsx(VuiText, Object.assign({ size: "m" }, { children: _jsx(Markdown, { children: markdown, options: {
36
- forceBlock: true,
37
- overrides: {
38
- SummaryCitation: {
39
- component: SummaryCitation
40
- }
41
- }
42
- } }) })) })));
34
+ const parsedSummary = summary && (_jsx(Markdown, { children: markDownCitations(summary), options: {
35
+ overrides: {
36
+ SummaryCitation: {
37
+ component: SummaryCitation
38
+ }
39
+ }
40
+ } }));
41
+ return (_jsx("div", Object.assign({ className: classes, dir: "auto" }, { children: summary ? (_jsx(VuiText, Object.assign({ size: "m" }, { children: _jsxs("p", { children: [parsedSummary, statusIndicator] }) }))) : (statusIndicator) })));
43
42
  };
@@ -40,6 +40,7 @@ With some **bold** and _emphasized_ test. Here is a [link](https://www.vectara.c
40
40
  <div
41
41
  class="vuiText vuiText--m"
42
42
  >
43
+ <p />
43
44
  <div>
44
45
  <h1
45
46
  id="heres-a-heading-1"
@@ -133,6 +134,7 @@ With some **bold** and _emphasized_ test. Here is a [link](https://www.vectara.c
133
134
  </tbody>
134
135
  </table>
135
136
  </div>
137
+ <p />
136
138
  </div>
137
139
  </div>
138
140
  </DocumentFragment>
@@ -173,6 +175,7 @@ With some **bold** [2][3] and _emphasized_ [2][3] test. Here is a [link](https:/
173
175
  <div
174
176
  class="vuiText vuiText--m"
175
177
  >
178
+ <p />
176
179
  <div>
177
180
  <h1
178
181
  id="summarycitation-reference1--heres-a-heading-1"
@@ -386,6 +389,7 @@ With some **bold** [2][3] and _emphasized_ [2][3] test. Here is a [link](https:/
386
389
  </tbody>
387
390
  </table>
388
391
  </div>
392
+ <p />
389
393
  </div>
390
394
  </div>
391
395
  </DocumentFragment>
@@ -405,44 +409,45 @@ With some **bold** [2][3] and _emphasized_ [2][3] test. Here is a [link](https:/
405
409
  <div
406
410
  class="vuiText vuiText--m"
407
411
  >
408
- <div>
409
- <button
410
- class="vuiSummaryCitation"
411
- >
412
- 1
413
- </button>
414
- Beginning of summary.
415
- <button
416
- class="vuiSummaryCitation"
417
- >
418
- 2
419
- </button>
420
- <button
421
- class="vuiSummaryCitation"
422
- >
423
- 3
424
- </button>
425
- Multiple at beginning of sentence, and before comma
426
- <button
427
- class="vuiSummaryCitation"
428
- >
429
- 4
430
- </button>
431
- , single at middle
432
- <button
433
- class="vuiSummaryCitation"
434
- >
435
- 5
436
- </button>
437
- of sentence. At end of sentence
438
- <button
439
- class="vuiSummaryCitation"
440
- >
441
- 6
442
- </button>
443
- .
444
-
445
- </div>
412
+ <p>
413
+ <span>
414
+ <button
415
+ class="vuiSummaryCitation"
416
+ >
417
+ 1
418
+ </button>
419
+ Beginning of summary.
420
+ <button
421
+ class="vuiSummaryCitation"
422
+ >
423
+ 2
424
+ </button>
425
+ <button
426
+ class="vuiSummaryCitation"
427
+ >
428
+ 3
429
+ </button>
430
+ Multiple at beginning of sentence, and before comma
431
+ <button
432
+ class="vuiSummaryCitation"
433
+ >
434
+ 4
435
+ </button>
436
+ , single at middle
437
+ <button
438
+ class="vuiSummaryCitation"
439
+ >
440
+ 5
441
+ </button>
442
+ of sentence. At end of sentence
443
+ <button
444
+ class="vuiSummaryCitation"
445
+ >
446
+ 6
447
+ </button>
448
+ .
449
+ </span>
450
+ </p>
446
451
  </div>
447
452
  </div>
448
453
  </DocumentFragment>
@@ -461,12 +466,14 @@ With some **bold** [2][3] and _emphasized_ [2][3] test. Here is a [link](https:/
461
466
  class="vuiText vuiText--m"
462
467
  >
463
468
  <p>
464
- End of summary.
465
- <button
466
- class="vuiSummaryCitation"
467
- >
468
- 1
469
- </button>
469
+ <span>
470
+ End of summary.
471
+ <button
472
+ class="vuiSummaryCitation"
473
+ >
474
+ 1
475
+ </button>
476
+ </span>
470
477
  </p>
471
478
  </div>
472
479
  </div>
@@ -486,54 +493,56 @@ With some **bold** [2][3] and _emphasized_ [2][3] test. Here is a [link](https:/
486
493
  class="vuiText vuiText--m"
487
494
  >
488
495
  <p>
489
- Two citations
490
- <button
491
- class="vuiSummaryCitation"
492
- >
493
- 1
494
- </button>
495
- <button
496
- class="vuiSummaryCitation"
497
- >
498
- 2
499
- </button>
500
- and seven citations
501
- <button
502
- class="vuiSummaryCitation"
503
- >
504
- 1
505
- </button>
506
- <button
507
- class="vuiSummaryCitation"
508
- >
509
- 2
510
- </button>
511
- <button
512
- class="vuiSummaryCitation"
513
- >
514
- 3
515
- </button>
516
- <button
517
- class="vuiSummaryCitation"
518
- >
519
- 4
520
- </button>
521
- <button
522
- class="vuiSummaryCitation"
523
- >
524
- 5
525
- </button>
526
- <button
527
- class="vuiSummaryCitation"
528
- >
529
- 6
530
- </button>
531
- <button
532
- class="vuiSummaryCitation"
533
- >
534
- 7
535
- </button>
536
- .
496
+ <span>
497
+ Two citations
498
+ <button
499
+ class="vuiSummaryCitation"
500
+ >
501
+ 1
502
+ </button>
503
+ <button
504
+ class="vuiSummaryCitation"
505
+ >
506
+ 2
507
+ </button>
508
+ and seven citations
509
+ <button
510
+ class="vuiSummaryCitation"
511
+ >
512
+ 1
513
+ </button>
514
+ <button
515
+ class="vuiSummaryCitation"
516
+ >
517
+ 2
518
+ </button>
519
+ <button
520
+ class="vuiSummaryCitation"
521
+ >
522
+ 3
523
+ </button>
524
+ <button
525
+ class="vuiSummaryCitation"
526
+ >
527
+ 4
528
+ </button>
529
+ <button
530
+ class="vuiSummaryCitation"
531
+ >
532
+ 5
533
+ </button>
534
+ <button
535
+ class="vuiSummaryCitation"
536
+ >
537
+ 6
538
+ </button>
539
+ <button
540
+ class="vuiSummaryCitation"
541
+ >
542
+ 7
543
+ </button>
544
+ .
545
+ </span>
537
546
  </p>
538
547
  </div>
539
548
  </div>
@@ -28,6 +28,7 @@ type Props<T> = {
28
28
  content?: React.ReactNode;
29
29
  className?: string;
30
30
  fluid?: boolean;
31
+ isDisabled?: boolean;
31
32
  };
32
33
  type Selection<T> = {
33
34
  bulkActions?: TableBulkActionProps<T[]>["actions"];
@@ -40,5 +41,5 @@ type Search = {
40
41
  onSearchChange?: (value: string) => void;
41
42
  "data-testid"?: string;
42
43
  };
43
- export declare const VuiTable: <T extends Row>({ isLoading, idField, columns, rows, actions, actionsTestIdProvider, pagination, selection, search, customControls, onSort, onReload, content, className, fluid, ...rest }: Props<T>) => import("react/jsx-runtime").JSX.Element;
44
+ export declare const VuiTable: <T extends Row>({ isLoading, idField, columns, rows, actions, actionsTestIdProvider, pagination, selection, search, customControls, onSort, onReload, content, className, fluid, isDisabled, ...rest }: Props<T>) => import("react/jsx-runtime").JSX.Element;
44
45
  export {};
@@ -36,7 +36,7 @@ const extractId = (row, idField) => {
36
36
  // https://github.com/typescript-eslint/typescript-eslint/issues/4062
37
37
  // eslint-disable-next-line @typescript-eslint/no-unnecessary-type-constraint
38
38
  export const VuiTable = (_a) => {
39
- var { isLoading, idField, columns, rows, actions, actionsTestIdProvider, pagination, selection, search, customControls, onSort, onReload, content, className, fluid } = _a, rest = __rest(_a, ["isLoading", "idField", "columns", "rows", "actions", "actionsTestIdProvider", "pagination", "selection", "search", "customControls", "onSort", "onReload", "content", "className", "fluid"]);
39
+ var { isLoading, idField, columns, rows, actions, actionsTestIdProvider, pagination, selection, search, customControls, onSort, onReload, content, className, fluid, isDisabled = false } = _a, rest = __rest(_a, ["isLoading", "idField", "columns", "rows", "actions", "actionsTestIdProvider", "pagination", "selection", "search", "customControls", "onSort", "onReload", "content", "className", "fluid", "isDisabled"]);
40
40
  const [rowBeingActedUpon, setRowBeingActedUpon] = useState(undefined);
41
41
  const { bulkActions, onSelectRow, selectedRows } = selection || {};
42
42
  const { searchValue, searchPlaceholder, onSearchChange } = search || {};
@@ -94,10 +94,12 @@ export const VuiTable = (_a) => {
94
94
  }, testId: (_b = actionsTestIdProvider === null || actionsTestIdProvider === void 0 ? void 0 : actionsTestIdProvider(row)) !== null && _b !== void 0 ? _b : undefined }) }))] }), rowId));
95
95
  });
96
96
  }
97
- return (_jsxs(_Fragment, { children: [(hasSearch ||
97
+ return (
98
+ // @ts-expect-error React doesn't support inert yet
99
+ _jsxs("div", Object.assign({ className: "vuiTableWrapper", inert: isDisabled ? "" : null }, { children: [isDisabled && _jsx("div", { className: "vuiTableBlock" }), (hasSearch ||
98
100
  customControls ||
99
101
  (hasBulkActions && selectedRows && selectedRows.length > 0) ||
100
- Boolean(onReload)) && (_jsxs(_Fragment, { children: [_jsxs(VuiFlexContainer, Object.assign({ spacing: "s", justifyContent: "spaceBetween", alignItems: "center" }, { children: [selectedRows && selectedRows.length > 0 && hasBulkActions && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiTableBulkActions, { selectedRows: selectedRows, actions: bulkActions }) }))), hasSearch && (_jsx(VuiFlexItem, Object.assign({ grow: 1, shrink: false }, { children: _jsx(VuiTextInput, { placeholder: searchPlaceholder, fullWidth: true, value: searchValue, onChange: (event) => onSearchChange(event.target.value), "data-testid": search === null || search === void 0 ? void 0 : search["data-testid"] }) }))), customControls && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: customControls }))), onReload && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiButtonSecondary, Object.assign({ color: "neutral", onClick: () => onReload() }, { children: "Reload" })) })))] })), _jsx(VuiSpacer, { size: "s" })] })), _jsxs("table", Object.assign({ className: classes }, rest, { children: [_jsx("thead", { children: _jsxs("tr", { children: [onSelectRow && (_jsx("th", Object.assign({ className: "vuiTableHeaderSelect" }, { children: _jsx(VuiTableCell, { children: _jsx(VuiCheckbox, { disabled: !isInteractive, checked: isInteractive ? allRowsSelected : false, onChange: () => {
102
+ Boolean(onReload)) && (_jsxs(_Fragment, { children: [_jsxs(VuiFlexContainer, Object.assign({ spacing: "s", alignItems: "center" }, { children: [selectedRows && selectedRows.length > 0 && hasBulkActions && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: _jsx(VuiTableBulkActions, { selectedRows: selectedRows, actions: bulkActions }) }))), hasSearch && (_jsx(VuiFlexItem, Object.assign({ grow: 1, shrink: false }, { children: _jsx(VuiTextInput, { placeholder: searchPlaceholder, fullWidth: true, value: searchValue, onChange: (event) => onSearchChange(event.target.value), "data-testid": search === null || search === void 0 ? void 0 : search["data-testid"] }) }))), customControls && (_jsx(VuiFlexItem, Object.assign({ grow: false, shrink: false }, { children: customControls }))), onReload && (_jsx(VuiFlexItem, Object.assign({ grow: 1, shrink: false }, { children: _jsx(VuiFlexContainer, Object.assign({ justifyContent: "end" }, { children: _jsx(VuiButtonSecondary, Object.assign({ color: "neutral", onClick: () => onReload() }, { children: "Reload" })) })) })))] })), _jsx(VuiSpacer, { size: "s" })] })), _jsxs("table", Object.assign({ className: classes }, rest, { children: [_jsx("thead", { children: _jsxs("tr", { children: [onSelectRow && (_jsx("th", Object.assign({ className: "vuiTableHeaderSelect" }, { children: _jsx(VuiTableCell, { children: _jsx(VuiCheckbox, { disabled: !isInteractive, checked: isInteractive ? allRowsSelected : false, onChange: () => {
101
103
  let newSelectedRows;
102
104
  if (allRowsSelected) {
103
105
  newSelectedRows = [];
@@ -113,5 +115,5 @@ export const VuiTable = (_a) => {
113
115
  const { name, header, width } = column;
114
116
  const styles = width ? { width } : undefined;
115
117
  return (_jsx("th", Object.assign({ style: styles }, { children: _jsx(VuiTableHeaderCell, { name: name, header: header, onSort: onSort }) }), name));
116
- }), actions && _jsx("th", { className: "vuiTableHeaderActions" })] }) }), _jsx("tbody", { children: tableContent })] })), !pagination ? undefined : isComplexPagination(pagination) ? (_jsxs(_Fragment, { children: [_jsx(VuiSpacer, { size: "xs" }), _jsx(VuiTablePagination, Object.assign({ isDisabled: !isInteractive }, pagination))] })) : (_jsxs(_Fragment, { children: [_jsx(VuiSpacer, { size: "xs" }), _jsx(VuiTablePager, Object.assign({ isDisabled: !isInteractive }, pagination))] }))] }));
118
+ }), actions && _jsx("th", { className: "vuiTableHeaderActions" })] }) }), _jsx("tbody", { children: tableContent })] })), !pagination ? undefined : isComplexPagination(pagination) ? (_jsxs(_Fragment, { children: [_jsx(VuiSpacer, { size: "xs" }), _jsx(VuiTablePagination, Object.assign({ isDisabled: !isInteractive }, pagination))] })) : (_jsxs(_Fragment, { children: [_jsx(VuiSpacer, { size: "xs" }), _jsx(VuiTablePager, Object.assign({ isDisabled: !isInteractive }, pagination))] }))] })));
117
119
  };
@@ -1,3 +1,17 @@
1
+ .vuiTableWrapper {
2
+ position: relative;
3
+ }
4
+
5
+ .vuiTableBlock {
6
+ background-color: transparentize($colorEmptyShade, 0.6);
7
+ height: 100%;
8
+ left: 0;
9
+ padding: $sizeM;
10
+ position: absolute;
11
+ top: 0;
12
+ width: 100%;
13
+ }
14
+
1
15
  .vuiTable {
2
16
  width: 100%;
3
17
  table-layout: fixed;
@@ -21,5 +21,5 @@ export const VuiToggle = (_a) => {
21
21
  labelId = createId();
22
22
  inputProps["aria-labelledby"] = labelId;
23
23
  }
24
- return (_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "s" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsxs("label", Object.assign({ className: "vuiToggle" }, { children: [_jsx("input", Object.assign({ className: "vuiToggle__input", type: "checkbox", checked: checked, onChange: onChange, id: id }, inputProps, rest)), _jsx("span", { className: "vuiToggle__button" })] })) })), label && (_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx("div", Object.assign({ id: labelId }, { children: label })) })))] })));
24
+ return (_jsxs(VuiFlexContainer, Object.assign({ alignItems: "center", spacing: "s" }, { children: [_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsxs("label", Object.assign({ className: "vuiToggle" }, rest, { children: [_jsx("input", Object.assign({ className: "vuiToggle__input", type: "checkbox", checked: checked, onChange: onChange, id: id }, inputProps)), _jsx("span", { className: "vuiToggle__button" })] })) })), label && (_jsx(VuiFlexItem, Object.assign({ grow: false }, { children: _jsx("div", Object.assign({ id: labelId }, { children: label })) })))] })));
25
25
  };
@@ -2566,6 +2566,10 @@ fieldset {
2566
2566
  height: 40px;
2567
2567
  }
2568
2568
 
2569
+ .vuiSpinner {
2570
+ display: inline-block;
2571
+ }
2572
+
2569
2573
  .vuiSpinner--accent svg path,
2570
2574
  .vuiSpinner--accent svg rect {
2571
2575
  fill: #551edf;
@@ -2669,6 +2673,20 @@ fieldset {
2669
2673
  color: #ffffff;
2670
2674
  }
2671
2675
 
2676
+ .vuiTableWrapper {
2677
+ position: relative;
2678
+ }
2679
+
2680
+ .vuiTableBlock {
2681
+ background-color: rgba(255, 255, 255, 0.4);
2682
+ height: 100%;
2683
+ left: 0;
2684
+ padding: 16px;
2685
+ position: absolute;
2686
+ top: 0;
2687
+ width: 100%;
2688
+ }
2689
+
2672
2690
  .vuiTable {
2673
2691
  width: 100%;
2674
2692
  table-layout: fixed;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vectara/vectara-ui",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "homepage": "https://vectara.github.io/vectara-ui/",
5
5
  "description": "Vectara's design system, codified as a React and Sass component library",
6
6
  "author": "Vectara",