@fuf-stack/pixels 0.34.2 → 0.36.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.
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk264THKFKcjs = require('../chunk-264THKFK.cjs');
4
+ var _chunkZASS525Kcjs = require('../chunk-ZASS525K.cjs');
5
5
  require('../chunk-4X43AGXE.cjs');
6
6
  require('../chunk-D4TLDLEX.cjs');
7
7
 
8
8
 
9
9
 
10
- exports.Json = _chunk264THKFKcjs.Json_default; exports.default = _chunk264THKFKcjs.Json_default2;
10
+ exports.Json = _chunkZASS525Kcjs.Json_default; exports.default = _chunkZASS525Kcjs.Json_default2;
11
11
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
- import { J as Json } from '../Json-DZue23GO.cjs';
2
- export { a as JsonProps } from '../Json-DZue23GO.cjs';
1
+ import { J as Json } from '../Json-ngM0f9n2.cjs';
2
+ export { a as JsonProps } from '../Json-ngM0f9n2.cjs';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
5
 
@@ -1,5 +1,5 @@
1
- import { J as Json } from '../Json-DZue23GO.js';
2
- export { a as JsonProps } from '../Json-DZue23GO.js';
1
+ import { J as Json } from '../Json-ngM0f9n2.js';
2
+ export { a as JsonProps } from '../Json-ngM0f9n2.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
5
 
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  Json_default,
3
3
  Json_default2
4
- } from "../chunk-CA5JB6OY.js";
4
+ } from "../chunk-3JUTQREC.js";
5
5
  import "../chunk-HL5BEHIS.js";
6
6
  import "../chunk-J7N2552D.js";
7
7
  export {
@@ -12,6 +12,8 @@ interface JsonProps {
12
12
  maxHeight?: string | number;
13
13
  /** Callback when copy action is performed */
14
14
  onCopy?: (copiedValue: string) => void;
15
+ /** Color scheme, if not provided component tries to determine it with next-themes and body dark class */
16
+ theme?: 'light' | 'dark';
15
17
  /** Object to be visualized JSON string or object */
16
18
  value: string | object;
17
19
  }
@@ -19,6 +21,6 @@ interface JsonProps {
19
21
  * Json renderer based on [react-json-view](https://uiwjs.github.io/react-json-view)
20
22
  * with improved error handling, accessibility, and customization options
21
23
  */
22
- declare const Json: ({ className, collapsed, value, maxHeight, onCopy, errorRenderer, }: JsonProps) => react_jsx_runtime.JSX.Element;
24
+ declare const Json: ({ className, collapsed, errorRenderer, maxHeight, onCopy, theme, value, }: JsonProps) => react_jsx_runtime.JSX.Element;
23
25
 
24
26
  export { Json as J, type JsonProps as a };
@@ -12,6 +12,8 @@ interface JsonProps {
12
12
  maxHeight?: string | number;
13
13
  /** Callback when copy action is performed */
14
14
  onCopy?: (copiedValue: string) => void;
15
+ /** Color scheme, if not provided component tries to determine it with next-themes and body dark class */
16
+ theme?: 'light' | 'dark';
15
17
  /** Object to be visualized JSON string or object */
16
18
  value: string | object;
17
19
  }
@@ -19,6 +21,6 @@ interface JsonProps {
19
21
  * Json renderer based on [react-json-view](https://uiwjs.github.io/react-json-view)
20
22
  * with improved error handling, accessibility, and customization options
21
23
  */
22
- declare const Json: ({ className, collapsed, value, maxHeight, onCopy, errorRenderer, }: JsonProps) => react_jsx_runtime.JSX.Element;
24
+ declare const Json: ({ className, collapsed, errorRenderer, maxHeight, onCopy, theme, value, }: JsonProps) => react_jsx_runtime.JSX.Element;
23
25
 
24
26
  export { Json as J, type JsonProps as a };
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkCXHVRIPZcjs = require('../chunk-CXHVRIPZ.cjs');
5
+ var _chunk2DCJPDZLcjs = require('../chunk-2DCJPDZL.cjs');
6
6
  require('../chunk-D4TLDLEX.cjs');
7
7
 
8
8
 
9
9
 
10
10
 
11
- exports.Table = _chunkCXHVRIPZcjs.Table_default; exports.default = _chunkCXHVRIPZcjs.Table_default2; exports.tableVariants = _chunkCXHVRIPZcjs.tableVariants;
11
+ exports.Table = _chunk2DCJPDZLcjs.Table_default; exports.default = _chunk2DCJPDZLcjs.Table_default2; exports.tableVariants = _chunk2DCJPDZLcjs.tableVariants;
12
12
  //# sourceMappingURL=index.cjs.map
@@ -1,5 +1,5 @@
1
- import { T as Table } from '../Table-mg36Y5qK.cjs';
2
- export { c as TableColumnProps, a as TableProps, b as TableRowProps, V as VariantProps, t as tableVariants } from '../Table-mg36Y5qK.cjs';
1
+ import { T as Table } from '../Table-ClTZfWXT.cjs';
2
+ export { c as TableColumnProps, a as TableProps, b as TableRowProps, V as VariantProps, t as tableVariants } from '../Table-ClTZfWXT.cjs';
3
3
  import 'react/jsx-runtime';
4
4
  import 'tailwind-variants';
5
5
  import 'tailwind-variants/dist/config.js';
@@ -1,5 +1,5 @@
1
- import { T as Table } from '../Table-mg36Y5qK.js';
2
- export { c as TableColumnProps, a as TableProps, b as TableRowProps, V as VariantProps, t as tableVariants } from '../Table-mg36Y5qK.js';
1
+ import { T as Table } from '../Table-ClTZfWXT.js';
2
+ export { c as TableColumnProps, a as TableProps, b as TableRowProps, V as VariantProps, t as tableVariants } from '../Table-ClTZfWXT.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'tailwind-variants';
5
5
  import 'tailwind-variants/dist/config.js';
@@ -2,7 +2,7 @@ import {
2
2
  Table_default,
3
3
  Table_default2,
4
4
  tableVariants
5
- } from "../chunk-OVS2CO2K.js";
5
+ } from "../chunk-PACHM4GL.js";
6
6
  import "../chunk-J7N2552D.js";
7
7
  export {
8
8
  Table_default as Table,
@@ -235,10 +235,12 @@ interface TableProps extends VariantProps {
235
235
  stickyHeader?: boolean;
236
236
  /** HTML data-testid attribute used in e2e tests */
237
237
  testId?: string;
238
+ /** Virtualize allows efficient rendering of large lists by only rendering items that are visible in the viewport. */
239
+ virtualized?: boolean;
238
240
  }
239
241
  /**
240
242
  * Table component based on [HeroUI Table](https://www.heroui.com//docs/components/table)
241
243
  */
242
- declare const Table: ({ ariaLabel, bottomContent, className, columns, emptyContent, hasWrapper, hideHeader, loading, loadingContent, rows, separation, stickyHeader, testId, }: TableProps) => react_jsx_runtime.JSX.Element;
244
+ declare const Table: ({ ariaLabel, bottomContent, className, columns, emptyContent, hasWrapper, hideHeader, loading, loadingContent, rows, separation, stickyHeader, testId, virtualized, }: TableProps) => react_jsx_runtime.JSX.Element;
243
245
 
244
246
  export { Table as T, type VariantProps as V, type TableProps as a, type TableRowProps as b, type TableColumnProps as c, tableVariants as t };
@@ -235,10 +235,12 @@ interface TableProps extends VariantProps {
235
235
  stickyHeader?: boolean;
236
236
  /** HTML data-testid attribute used in e2e tests */
237
237
  testId?: string;
238
+ /** Virtualize allows efficient rendering of large lists by only rendering items that are visible in the viewport. */
239
+ virtualized?: boolean;
238
240
  }
239
241
  /**
240
242
  * Table component based on [HeroUI Table](https://www.heroui.com//docs/components/table)
241
243
  */
242
- declare const Table: ({ ariaLabel, bottomContent, className, columns, emptyContent, hasWrapper, hideHeader, loading, loadingContent, rows, separation, stickyHeader, testId, }: TableProps) => react_jsx_runtime.JSX.Element;
244
+ declare const Table: ({ ariaLabel, bottomContent, className, columns, emptyContent, hasWrapper, hideHeader, loading, loadingContent, rows, separation, stickyHeader, testId, virtualized, }: TableProps) => react_jsx_runtime.JSX.Element;
243
245
 
244
246
  export { Table as T, type VariantProps as V, type TableProps as a, type TableRowProps as b, type TableColumnProps as c, tableVariants as t };
@@ -62,7 +62,8 @@ var Table = ({
62
62
  rows = [],
63
63
  separation = "none",
64
64
  stickyHeader = false,
65
- testId = void 0
65
+ testId = void 0,
66
+ virtualized = false
66
67
  }) => {
67
68
  const variants = tableVariants({ separation });
68
69
  const classNames = _pixelutils.variantsToClassNames.call(void 0, variants, className, "base");
@@ -76,6 +77,7 @@ var Table = ({
76
77
  hideHeader,
77
78
  isHeaderSticky: stickyHeader,
78
79
  isStriped: separation === "striped" || separation === "striped-divider-x",
80
+ isVirtualized: virtualized,
79
81
  removeWrapper: !hasWrapper,
80
82
  children: [
81
83
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _table.TableHeader, { columns, children: (column) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _table.TableColumn, { children: column.label }, column.key) }),
@@ -109,4 +111,4 @@ var Table_default2 = Table_default;
109
111
 
110
112
 
111
113
  exports.tableVariants = tableVariants; exports.Table_default = Table_default; exports.Table_default2 = Table_default2;
112
- //# sourceMappingURL=chunk-CXHVRIPZ.cjs.map
114
+ //# sourceMappingURL=chunk-2DCJPDZL.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/pixels/pixels/packages/pixels/dist/chunk-2DCJPDZL.cjs","../src/Table/Table.tsx","../src/Table/index.ts"],"names":["Table_default"],"mappings":"AAAA;ACGA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AAAA,sCACK;AAEP,oDAAkD;AAoH9C,+CAAA;AAjHG,IAAM,cAAA,EAAgB,4BAAA;AAAG,EAC9B,KAAA,EAAO;AAAA,IACL,IAAA,EAAM,EAAA;AAAA,IACN,OAAA,EAAS,EAAA;AAAA,IACT,KAAA,EAAO,EAAA;AAAA,IACP,KAAA,EAAO,EAAA;AAAA,IACP,KAAA,EAAO,EAAA;AAAA,IACP,EAAA,EAAI,EAAA;AAAA,IACJ,EAAA,EAAI,aAAA;AAAA,IACJ,EAAA,EAAI,EAAA;AAAA,IACJ,KAAA,EAAO,EAAA;AAAA,IACP,QAAA,EAAU,EAAA;AAAA,IACV,YAAA,EAAc,EAAA;AAAA,IACd,cAAA,EAAgB;AAAA,EAClB,CAAA;AAAA,EACA,QAAA,EAAU;AAAA,IACR,UAAA,EAAY;AAAA,MACV,OAAA,EAAS;AAAA,QACP,EAAA,EAAI;AAAA,MACN,CAAA;AAAA,MACA,WAAA,EAAa;AAAA,QACX,EAAA,EAAI;AAAA,MACN,CAAA;AAAA,MACA,WAAA,EAAa;AAAA,QACX,EAAA,EAAI;AAAA,MACN,CAAA;AAAA,MACA,mBAAA,EAAqB;AAAA,QACn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UAAA;AAAA,MAEhB,QAAA,EAAA;AAAA,wBAAA,6BAAA,kBAAC,EAAA,EAAY,OAAA,EACV,QAAA,EAAA,CAAC,MAAA,EAAA,mBACA,6BAAA,kBAAC,EAAA,EAA8B,QAAA,EAAA,MAAA,CAAO,MAAA,CAAA,EAApB,MAAA,CAAO,GAAmB,EAAA,CAEhD,CAAA;AAAA,wBACA,6BAAA;AAAA,UAAC,gBAAA;AAAA,UAAA;AAAA,YACC,SAAA,EAAW,OAAA;AAAA,YACX,cAAA,EAAgB,eAAA,GAAkB,KAAA;AAAA,YAClC,YAAA;AAAA,YACA,KAAA,EAAO,IAAA;AAAA,YAEN,QAAA,EAAA,CAAC,IAAA,EAAA,mBACA,6BAAA;AAAA,cAAC,eAAA;AAAA,cAAA;AAAA,gBAIE,QAAA,EAAA,CAAC,SAAA,EAAA,mBACA,6BAAA,gBAAC,EAAA,EAAW,QAAA,EAAA,gCAAA,IAAY,EAAM,SAAS,EAAA,CAAE;AAAA,cAAA,CAAA;AAAA,cAJtC,IAAA,CAAK;AAAA,YAMZ;AAAA,UAAA;AAAA,QAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,EACF,CAAA;AAEJ,CAAA;AAEA,IAAO,cAAA,EAAQ,KAAA;AD9Df;AACA;AE9FA,IAAOA,eAAAA,EAAQ,aAAA;AFgGf;AACA;AACE;AACA;AACA;AACF,sHAAC","file":"/home/runner/work/pixels/pixels/packages/pixels/dist/chunk-2DCJPDZL.cjs","sourcesContent":[null,"import type { TVClassName, TVProps } from '@fuf-stack/pixel-utils';\nimport type { ReactNode } from 'react';\n\nimport {\n getKeyValue,\n Table as HeroTable,\n TableBody,\n TableCell,\n TableColumn,\n TableHeader,\n TableRow,\n} from '@heroui/table';\n\nimport { slugify, tv, variantsToClassNames } from '@fuf-stack/pixel-utils';\n\n// table styling variants\nexport const tableVariants = tv({\n slots: {\n base: '',\n wrapper: '',\n table: '',\n thead: '',\n tbody: '',\n tr: '',\n th: 'bg-content2',\n td: '',\n tfoot: '',\n sortIcon: '',\n emptyWrapper: '',\n loadingWrapper: '',\n },\n variants: {\n separation: {\n divider: {\n tr: 'divide-x rounded-lg border-b data-[last=true]:border-none [&:first-child:not([data-first=\"true\"])]:border-none',\n },\n 'divider-x': {\n tr: 'divide-x',\n },\n 'divider-y': {\n tr: 'rounded-lg border-b data-[last=true]:border-none [&:first-child:not([data-first=\"true\"])]:border-none',\n },\n 'striped-divider-x': {\n tr: 'divide-x',\n th: 'border-divider',\n td: 'border-divider first:rounded-s-lg last:rounded-e-lg group-data-[odd=true]:bg-content2',\n },\n striped: {\n tr: '',\n td: 'first:rounded-s-lg last:rounded-e-lg group-data-[odd=true]:bg-content2',\n },\n none: {},\n },\n },\n});\n\nexport type VariantProps = TVProps<typeof tableVariants>;\ntype ClassName = TVClassName<typeof tableVariants>;\n\nexport interface TableColumnProps {\n key: string;\n label: ReactNode;\n}\n\nexport interface TableRowProps {\n key: string | number;\n [key: string | number]: ReactNode;\n}\n\nexport interface TableProps extends VariantProps {\n /** Aria label for the Table. */\n ariaLabel?: string;\n /** Component to display at the bottom of the Table. */\n bottomContent?: ReactNode;\n /** CSS class name */\n className?: ClassName;\n /** Objects with table data */\n columns: TableColumnProps[];\n /** Component to display if there are no rows! */\n emptyContent?: ReactNode;\n /** Determine if the Table should have a card like wrapper. */\n hasWrapper?: boolean;\n /** remove header */\n hideHeader?: boolean;\n /** Tells the Table to show the loading component. */\n loading?: boolean;\n /** Loading animation component. */\n loadingContent?: ReactNode;\n /** Items displayed as rows in the Table. Should have key-value pair for each column. */\n rows?: TableRowProps[];\n /** Separation style for the rows & columns. */\n separation?:\n | 'none'\n | 'striped'\n | 'striped-divider-x'\n | 'divider-x'\n | 'divider-y'\n | 'divider';\n /** Keeps the header of the Table in view while scrolling a height limited Table. */\n stickyHeader?: boolean;\n /** HTML data-testid attribute used in e2e tests */\n testId?: string;\n /** Virtualize allows efficient rendering of large lists by only rendering items that are visible in the viewport. */\n virtualized?: boolean;\n}\n\n/**\n * Table component based on [HeroUI Table](https://www.heroui.com//docs/components/table)\n */\nconst Table = ({\n ariaLabel = undefined,\n bottomContent = undefined,\n className = undefined,\n columns,\n emptyContent = 'No rows to display.',\n hasWrapper = false,\n hideHeader = false,\n loading = false,\n loadingContent = undefined,\n rows = [],\n separation = 'none',\n stickyHeader = false,\n testId = undefined,\n virtualized = false,\n}: TableProps) => {\n const variants = tableVariants({ separation });\n const classNames = variantsToClassNames(variants, className, 'base');\n\n return (\n <HeroTable\n aria-label={ariaLabel}\n bottomContent={bottomContent}\n classNames={classNames}\n data-testid={testId && slugify(testId)}\n hideHeader={hideHeader}\n isHeaderSticky={stickyHeader}\n isStriped={separation === 'striped' || separation === 'striped-divider-x'}\n isVirtualized={virtualized}\n removeWrapper={!hasWrapper}\n >\n <TableHeader columns={columns}>\n {(column: TableColumnProps) => (\n <TableColumn key={column.key}>{column.label}</TableColumn>\n )}\n </TableHeader>\n <TableBody\n isLoading={loading}\n loadingContent={loadingContent || '...'} // TODO: use future spinner/loading component\n emptyContent={emptyContent}\n items={rows}\n >\n {(item: TableRowProps) => (\n <TableRow\n key={item.key}\n // data-testid={`${slugify(testId || 'table')}_item_${slugify(JSON.stringify(item.testId || item.key))}`}\n >\n {(columnKey) => (\n <TableCell>{getKeyValue(item, columnKey)}</TableCell>\n )}\n </TableRow>\n )}\n </TableBody>\n </HeroTable>\n );\n};\n\nexport default Table;\n","import Table, { tableVariants } from './Table';\n\nexport type {\n TableProps,\n TableRowProps,\n TableColumnProps,\n VariantProps,\n} from './Table';\n\nexport { Table, tableVariants };\n\nexport default Table;\n"]}
@@ -2718,17 +2718,20 @@ var handleCopy = (rawValue, onCopy) => {
2718
2718
  var Json = ({
2719
2719
  className = void 0,
2720
2720
  collapsed = false,
2721
- value,
2721
+ errorRenderer = void 0,
2722
2722
  maxHeight = void 0,
2723
2723
  onCopy = void 0,
2724
- errorRenderer = void 0
2724
+ theme = void 0,
2725
+ value
2725
2726
  }) => {
2726
2727
  const [showDetails, setShowDetails] = useState3(false);
2727
2728
  const { resolvedTheme } = useTheme();
2728
- const isDarkMode = useMemo2(
2729
- () => resolvedTheme === "dark" || document.body.classList.contains("dark"),
2730
- [resolvedTheme]
2731
- );
2729
+ const isDarkMode = useMemo2(() => {
2730
+ if (theme) {
2731
+ return theme === "dark";
2732
+ }
2733
+ return resolvedTheme === "dark" || document.body.classList.contains("dark");
2734
+ }, [resolvedTheme, theme]);
2732
2735
  let content = null;
2733
2736
  let error = null;
2734
2737
  try {
@@ -2780,4 +2783,4 @@ export {
2780
2783
  Json_default,
2781
2784
  Json_default2
2782
2785
  };
2783
- //# sourceMappingURL=chunk-CA5JB6OY.js.map
2786
+ //# sourceMappingURL=chunk-3JUTQREC.js.map