@optimum-intelligence/opti-ui 0.5.1 → 0.6.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.
- package/dist/components/app-shell/AppShell.js +139 -121
- package/dist/components/app-shell/AppShell.js.map +1 -1
- package/dist/components/badge/Badge.d.ts +4 -2
- package/dist/components/badge/Badge.js.map +1 -1
- package/dist/components/button/Button.d.ts +6 -1
- package/dist/components/button/Button.js +31 -26
- package/dist/components/button/Button.js.map +1 -1
- package/dist/components/data-table/DataTable.d.ts +14 -2
- package/dist/components/data-table/DataTable.js +113 -98
- package/dist/components/data-table/DataTable.js.map +1 -1
- package/dist/components/data-table/DataTableFilters.d.ts +1 -1
- package/dist/components/data-table/DataTableFilters.js +85 -44
- package/dist/components/data-table/DataTableFilters.js.map +1 -1
- package/dist/components/data-table/export.d.ts +3 -0
- package/dist/components/data-table/export.js +31 -0
- package/dist/components/data-table/export.js.map +1 -0
- package/dist/components/data-table/types.d.ts +32 -5
- package/dist/components/data-table/useDataTable.js +18 -4
- package/dist/components/data-table/useDataTable.js.map +1 -1
- package/dist/components/description-list/DescriptionList.d.ts +29 -0
- package/dist/components/description-list/DescriptionList.js +125 -0
- package/dist/components/description-list/DescriptionList.js.map +1 -0
- package/dist/components/dialog/ConfirmDialog.d.ts +59 -0
- package/dist/components/dialog/ConfirmDialog.js +165 -0
- package/dist/components/dialog/ConfirmDialog.js.map +1 -0
- package/dist/components/dialog/Dialog.d.ts +15 -2
- package/dist/components/dialog/Dialog.js +115 -86
- package/dist/components/dialog/Dialog.js.map +1 -1
- package/dist/components/drawer/Drawer.d.ts +6 -1
- package/dist/components/drawer/Drawer.js +139 -132
- package/dist/components/drawer/Drawer.js.map +1 -1
- package/dist/components/select/Select.d.ts +6 -1
- package/dist/components/select/Select.js +110 -92
- package/dist/components/select/Select.js.map +1 -1
- package/dist/components.json +298 -20
- package/dist/icons/index.d.ts +4 -0
- package/dist/icons/index.js +6 -1
- package/dist/icons/index.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +5 -3
- package/dist/llms-full.txt +106 -5
- package/dist/llms.txt +3 -0
- package/dist/opti-ui.css +445 -20
- package/package.json +4 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { useRender } from '@base-ui/react/use-render';
|
|
2
|
-
|
|
2
|
+
/** Colours with no status meaning, for telling categories apart (types, owners, regions). */
|
|
3
|
+
export type ColorTone = 'blue' | 'cyan' | 'green' | 'yellow' | 'purple' | 'pink';
|
|
4
|
+
export type BadgeTone = 'neutral' | 'accent' | 'info' | 'success' | 'warning' | 'danger' | ColorTone;
|
|
3
5
|
export type BadgeVariant = 'soft' | 'solid' | 'outline';
|
|
4
6
|
export type BadgeState = {
|
|
5
7
|
tone: BadgeTone;
|
|
@@ -7,7 +9,7 @@ export type BadgeState = {
|
|
|
7
9
|
size: 'sm' | 'md';
|
|
8
10
|
};
|
|
9
11
|
export interface BadgeProps extends useRender.ComponentProps<'span', BadgeState> {
|
|
10
|
-
/**
|
|
12
|
+
/** Status colour, or a plain colour from `ColorTone` for categories. */
|
|
11
13
|
tone?: BadgeTone;
|
|
12
14
|
/** `soft` tinted, `solid` filled, `outline` bordered. */
|
|
13
15
|
variant?: BadgeVariant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","names":["useRender","mergeProps","BadgeTone","BadgeVariant","BadgeState","tone","variant","size","BadgeProps","ComponentProps","Badge","t0","$","_c","t1","t2","t3","t4","t5","t6","t7","t8","t9","render","children","ref","props","undefined","t10","state","className","defaultTagName","_c"],"sources":["../../../src/components/badge/Badge.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render';\nimport { mergeProps } from '@base-ui/react/merge-props';\n\nexport type BadgeTone = 'neutral' | 'accent' | 'info' | 'success' | 'warning' | 'danger';\nexport type BadgeVariant = 'soft' | 'solid' | 'outline';\n\nexport type BadgeState = {\n tone: BadgeTone;\n variant: BadgeVariant;\n size: 'sm' | 'md';\n};\n\nexport interface BadgeProps extends useRender.ComponentProps<'span', BadgeState> {\n /**
|
|
1
|
+
{"version":3,"file":"Badge.js","names":["useRender","mergeProps","ColorTone","BadgeTone","BadgeVariant","BadgeState","tone","variant","size","BadgeProps","ComponentProps","Badge","t0","$","_c","t1","t2","t3","t4","t5","t6","t7","t8","t9","render","children","ref","props","undefined","t10","state","className","defaultTagName","_c"],"sources":["../../../src/components/badge/Badge.tsx"],"sourcesContent":["import { useRender } from '@base-ui/react/use-render';\nimport { mergeProps } from '@base-ui/react/merge-props';\n\n/** Colours with no status meaning, for telling categories apart (types, owners, regions). */\nexport type ColorTone = 'blue' | 'cyan' | 'green' | 'yellow' | 'purple' | 'pink';\nexport type BadgeTone = 'neutral' | 'accent' | 'info' | 'success' | 'warning' | 'danger' | ColorTone;\nexport type BadgeVariant = 'soft' | 'solid' | 'outline';\n\nexport type BadgeState = {\n tone: BadgeTone;\n variant: BadgeVariant;\n size: 'sm' | 'md';\n};\n\nexport interface BadgeProps extends useRender.ComponentProps<'span', BadgeState> {\n /** Status colour, or a plain colour from `ColorTone` for categories. */\n tone?: BadgeTone;\n /** `soft` tinted, `solid` filled, `outline` bordered. */\n variant?: BadgeVariant;\n /** Badge height and text size. */\n size?: 'sm' | 'md';\n}\n\n/**\n * Small status label.\n *\n * @example\n * <Badge tone=\"success\">Online</Badge>\n */\nexport function Badge({\n tone = 'neutral',\n variant = 'soft',\n size = 'md',\n render,\n children,\n ref,\n ...props\n}: BadgeProps) {\n const state: BadgeState = { tone, variant, size };\n return useRender({\n defaultTagName: 'span',\n render,\n ref,\n state,\n props: mergeProps<'span'>(\n {\n className: 'oui-badge',\n children,\n },\n props,\n ),\n });\n}\n"],"mappings":";;;;;;;;;;;AA6BA,SAAOW,MAAAC,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAP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;EAAAL,EAAA,MAAAM;EAAAN,EAAA,MAAAQ;CAAA,OAAAA,KAAAR,EAAA;CAAA,OAZMb,GAAUqB,EAYhB;AAAC"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { Button as BaseButton } from '@base-ui/react/button';
|
|
2
|
+
import type { ColorTone } from '../badge/Badge';
|
|
2
3
|
export type ButtonVariant = 'primary' | 'accent' | 'secondary' | 'soft' | 'ghost' | 'danger';
|
|
3
4
|
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
4
5
|
export type ButtonShape = 'pill' | 'rounded';
|
|
6
|
+
/** Status colour for a button, e.g. to match a status badge. */
|
|
7
|
+
export type ButtonTone = 'info' | 'success' | 'warning' | 'danger' | ColorTone;
|
|
5
8
|
export interface ButtonProps extends BaseButton.Props {
|
|
6
9
|
/** Visual emphasis. */
|
|
7
10
|
variant?: ButtonVariant;
|
|
11
|
+
/** Status colour on top of the variant: a filled button in that colour for `primary`/`accent`, tinted text and borders for the others. */
|
|
12
|
+
tone?: ButtonTone;
|
|
8
13
|
/** Height and padding. */
|
|
9
14
|
size?: ButtonSize;
|
|
10
15
|
/** `pill` (default) or `rounded` corners. Override with `--oui-button-radius`. */
|
|
@@ -20,7 +25,7 @@ export interface ButtonProps extends BaseButton.Props {
|
|
|
20
25
|
* @example
|
|
21
26
|
* <Button variant="secondary" loading={saving} onClick={save}>Save</Button>
|
|
22
27
|
*/
|
|
23
|
-
export declare function Button({ variant, size, shape, fullWidth, loading, disabled, className, children, ref, ...props }: ButtonProps): import("react").JSX.Element;
|
|
28
|
+
export declare function Button({ variant, tone, size, shape, fullWidth, loading, disabled, className, children, ref, ...props }: ButtonProps): import("react").JSX.Element;
|
|
24
29
|
export interface IconButtonProps extends Omit<ButtonProps, 'shape' | 'fullWidth'> {
|
|
25
30
|
/** Required: icon-only buttons need an accessible name. */
|
|
26
31
|
'aria-label': string;
|
|
@@ -12,7 +12,7 @@ import { Button } from "@base-ui/react/button";
|
|
|
12
12
|
* <Button variant="secondary" loading={saving} onClick={save}>Save</Button>
|
|
13
13
|
*/
|
|
14
14
|
function Button$1(t0) {
|
|
15
|
-
const $ = c(
|
|
15
|
+
const $ = c(31);
|
|
16
16
|
let children;
|
|
17
17
|
let className;
|
|
18
18
|
let disabled;
|
|
@@ -23,8 +23,9 @@ function Button$1(t0) {
|
|
|
23
23
|
let t1;
|
|
24
24
|
let t2;
|
|
25
25
|
let t3;
|
|
26
|
+
let tone;
|
|
26
27
|
if ($[0] !== t0) {
|
|
27
|
-
({variant: t1, size: t2, shape: t3, fullWidth, loading, disabled, className, children, ref, ...props} = t0);
|
|
28
|
+
({variant: t1, tone, size: t2, shape: t3, fullWidth, loading, disabled, className, children, ref, ...props} = t0);
|
|
28
29
|
$[0] = t0;
|
|
29
30
|
$[1] = children;
|
|
30
31
|
$[2] = className;
|
|
@@ -36,6 +37,7 @@ function Button$1(t0) {
|
|
|
36
37
|
$[8] = t1;
|
|
37
38
|
$[9] = t2;
|
|
38
39
|
$[10] = t3;
|
|
40
|
+
$[11] = tone;
|
|
39
41
|
} else {
|
|
40
42
|
children = $[1];
|
|
41
43
|
className = $[2];
|
|
@@ -47,35 +49,37 @@ function Button$1(t0) {
|
|
|
47
49
|
t1 = $[8];
|
|
48
50
|
t2 = $[9];
|
|
49
51
|
t3 = $[10];
|
|
52
|
+
tone = $[11];
|
|
50
53
|
}
|
|
51
54
|
const variant = t1 === void 0 ? "primary" : t1;
|
|
52
55
|
const size = t2 === void 0 ? "md" : t2;
|
|
53
56
|
const shape = t3 === void 0 ? "pill" : t3;
|
|
54
57
|
let t4;
|
|
55
|
-
if ($[
|
|
58
|
+
if ($[12] !== className) {
|
|
56
59
|
t4 = withClass("oui-button", className);
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
} else t4 = $[
|
|
60
|
+
$[12] = className;
|
|
61
|
+
$[13] = t4;
|
|
62
|
+
} else t4 = $[13];
|
|
60
63
|
const t5 = fullWidth || void 0;
|
|
61
64
|
const t6 = loading || void 0;
|
|
62
65
|
const t7 = loading || void 0;
|
|
63
66
|
const t8 = disabled || loading;
|
|
64
67
|
let t9;
|
|
65
|
-
if ($[
|
|
68
|
+
if ($[14] !== loading) {
|
|
66
69
|
t9 = loading && /* @__PURE__ */ jsx(Spinner, {
|
|
67
70
|
className: "oui-button__spinner",
|
|
68
71
|
label: null
|
|
69
72
|
});
|
|
70
|
-
$[
|
|
71
|
-
$[
|
|
72
|
-
} else t9 = $[
|
|
73
|
+
$[14] = loading;
|
|
74
|
+
$[15] = t9;
|
|
75
|
+
} else t9 = $[15];
|
|
73
76
|
let t10;
|
|
74
|
-
if ($[
|
|
77
|
+
if ($[16] !== children || $[17] !== loading || $[18] !== props || $[19] !== ref || $[20] !== shape || $[21] !== size || $[22] !== t4 || $[23] !== t5 || $[24] !== t6 || $[25] !== t7 || $[26] !== t8 || $[27] !== t9 || $[28] !== tone || $[29] !== variant) {
|
|
75
78
|
t10 = /* @__PURE__ */ jsxs(Button, {
|
|
76
79
|
ref,
|
|
77
80
|
className: t4,
|
|
78
81
|
"data-variant": variant,
|
|
82
|
+
"data-tone": tone,
|
|
79
83
|
"data-size": size,
|
|
80
84
|
"data-shape": shape,
|
|
81
85
|
"data-full-width": t5,
|
|
@@ -86,21 +90,22 @@ function Button$1(t0) {
|
|
|
86
90
|
...props,
|
|
87
91
|
children: [t9, children]
|
|
88
92
|
});
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
93
|
-
$[
|
|
94
|
-
$[
|
|
95
|
-
$[
|
|
96
|
-
$[
|
|
97
|
-
$[
|
|
98
|
-
$[
|
|
99
|
-
$[
|
|
100
|
-
$[
|
|
101
|
-
$[
|
|
102
|
-
$[
|
|
103
|
-
|
|
93
|
+
$[16] = children;
|
|
94
|
+
$[17] = loading;
|
|
95
|
+
$[18] = props;
|
|
96
|
+
$[19] = ref;
|
|
97
|
+
$[20] = shape;
|
|
98
|
+
$[21] = size;
|
|
99
|
+
$[22] = t4;
|
|
100
|
+
$[23] = t5;
|
|
101
|
+
$[24] = t6;
|
|
102
|
+
$[25] = t7;
|
|
103
|
+
$[26] = t8;
|
|
104
|
+
$[27] = t9;
|
|
105
|
+
$[28] = tone;
|
|
106
|
+
$[29] = variant;
|
|
107
|
+
$[30] = t10;
|
|
108
|
+
} else t10 = $[30];
|
|
104
109
|
return t10;
|
|
105
110
|
}
|
|
106
111
|
/** Square button for a single icon. Defaults to the compact ghost style. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","names":["Button","BaseButton","withClass","Spinner","ButtonVariant","ButtonSize","ButtonShape","ButtonProps","Props","variant","size","shape","fullWidth","loading","t0","$","_c","children","className","disabled","props","ref","t1","t2","t3","undefined","t4","t5","t6","t7","t8","t9","t10","IconButtonProps","Omit","IconButton","Button","_c","BaseButton"],"sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import { Button as BaseButton } from '@base-ui/react/button';\nimport { withClass } from '../../utils/cx';\nimport { Spinner } from '../spinner/Spinner';\n\nexport type ButtonVariant = 'primary' | 'accent' | 'secondary' | 'soft' | 'ghost' | 'danger';\nexport type ButtonSize = 'sm' | 'md' | 'lg';\nexport type ButtonShape = 'pill' | 'rounded';\n\nexport interface ButtonProps extends BaseButton.Props {\n /** Visual emphasis. */\n variant?: ButtonVariant;\n /** Height and padding. */\n size?: ButtonSize;\n /** `pill` (default) or `rounded` corners. Override with `--oui-button-radius`. */\n shape?: ButtonShape;\n /** Stretch to the container width. */\n fullWidth?: boolean;\n /** Shows a spinner and blocks interaction while keeping focus. */\n loading?: boolean;\n}\n\n/**\n * Action button. Use `render={<a href=\"…\" />}` with `nativeButton={false}` to style a link as a button.\n *\n * @example\n * <Button variant=\"secondary\" loading={saving} onClick={save}>Save</Button>\n */\nexport function Button({\n variant = 'primary',\n size = 'md',\n shape = 'pill',\n fullWidth,\n loading,\n disabled,\n className,\n children,\n ref,\n ...props\n}: ButtonProps) {\n return (\n <BaseButton\n ref={ref}\n className={withClass('oui-button', className)}\n data-variant={variant}\n data-size={size}\n data-shape={shape}\n data-full-width={fullWidth || undefined}\n data-loading={loading || undefined}\n aria-busy={loading || undefined}\n disabled={disabled || loading}\n focusableWhenDisabled={loading}\n {...props}\n >\n {loading && <Spinner className=\"oui-button__spinner\" label={null} />}\n {children}\n </BaseButton>\n );\n}\n\nexport interface IconButtonProps extends Omit<ButtonProps, 'shape' | 'fullWidth'> {\n /** Required: icon-only buttons need an accessible name. */\n 'aria-label': string;\n /** `rounded` square (default) or `circle`. */\n shape?: 'rounded' | 'circle';\n}\n\n/** Square button for a single icon. Defaults to the compact ghost style. */\nexport function IconButton({\n variant = 'ghost',\n size = 'md',\n shape = 'rounded',\n className,\n ref,\n ...props\n}: IconButtonProps) {\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={withClass('oui-icon-button', className)}\n data-shape={shape}\n {...(props as ButtonProps)}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"Button.js","names":["Button","BaseButton","withClass","ColorTone","Spinner","ButtonVariant","ButtonSize","ButtonShape","ButtonTone","ButtonProps","Props","variant","tone","size","shape","fullWidth","loading","t0","$","_c","children","className","disabled","props","ref","t1","t2","t3","undefined","t4","t5","t6","t7","t8","t9","t10","IconButtonProps","Omit","IconButton","Button","_c","BaseButton"],"sources":["../../../src/components/button/Button.tsx"],"sourcesContent":["import { Button as BaseButton } from '@base-ui/react/button';\nimport { withClass } from '../../utils/cx';\nimport type { ColorTone } from '../badge/Badge';\nimport { Spinner } from '../spinner/Spinner';\n\nexport type ButtonVariant = 'primary' | 'accent' | 'secondary' | 'soft' | 'ghost' | 'danger';\nexport type ButtonSize = 'sm' | 'md' | 'lg';\nexport type ButtonShape = 'pill' | 'rounded';\n/** Status colour for a button, e.g. to match a status badge. */\nexport type ButtonTone = 'info' | 'success' | 'warning' | 'danger' | ColorTone;\n\nexport interface ButtonProps extends BaseButton.Props {\n /** Visual emphasis. */\n variant?: ButtonVariant;\n /** Status colour on top of the variant: a filled button in that colour for `primary`/`accent`, tinted text and borders for the others. */\n tone?: ButtonTone;\n /** Height and padding. */\n size?: ButtonSize;\n /** `pill` (default) or `rounded` corners. Override with `--oui-button-radius`. */\n shape?: ButtonShape;\n /** Stretch to the container width. */\n fullWidth?: boolean;\n /** Shows a spinner and blocks interaction while keeping focus. */\n loading?: boolean;\n}\n\n/**\n * Action button. Use `render={<a href=\"…\" />}` with `nativeButton={false}` to style a link as a button.\n *\n * @example\n * <Button variant=\"secondary\" loading={saving} onClick={save}>Save</Button>\n */\nexport function Button({\n variant = 'primary',\n tone,\n size = 'md',\n shape = 'pill',\n fullWidth,\n loading,\n disabled,\n className,\n children,\n ref,\n ...props\n}: ButtonProps) {\n return (\n <BaseButton\n ref={ref}\n className={withClass('oui-button', className)}\n data-variant={variant}\n data-tone={tone}\n data-size={size}\n data-shape={shape}\n data-full-width={fullWidth || undefined}\n data-loading={loading || undefined}\n aria-busy={loading || undefined}\n disabled={disabled || loading}\n focusableWhenDisabled={loading}\n {...props}\n >\n {loading && <Spinner className=\"oui-button__spinner\" label={null} />}\n {children}\n </BaseButton>\n );\n}\n\nexport interface IconButtonProps extends Omit<ButtonProps, 'shape' | 'fullWidth'> {\n /** Required: icon-only buttons need an accessible name. */\n 'aria-label': string;\n /** `rounded` square (default) or `circle`. */\n shape?: 'rounded' | 'circle';\n}\n\n/** Square button for a single icon. Defaults to the compact ghost style. */\nexport function IconButton({\n variant = 'ghost',\n size = 'md',\n shape = 'rounded',\n className,\n ref,\n ...props\n}: IconButtonProps) {\n return (\n <Button\n ref={ref}\n variant={variant}\n size={size}\n className={withClass('oui-icon-button', className)}\n data-shape={shape}\n {...(props as ButtonProps)}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,SAAOA,SAAAiB,IAAA;CAAA,MAAAC,IAAAC,EAAA,EAAA;CAAA,IAAAC;CAAA,IAAAC;CAAA,IAAAC;CAAA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];
|
|
41
41
|
/** Size of the search box and the filters. */
|
|
42
42
|
controlSize?: DataTableControlSize;
|
|
43
|
-
/** Extra toolbar content (
|
|
43
|
+
/** Extra toolbar content (add, bulk actions…). A function receives the processed rows. */
|
|
44
44
|
toolbar?: React.ReactNode | ((context: DataTableToolbarContext<T>) => React.ReactNode);
|
|
45
|
+
/** `false` drops the search, filters, summary and toolbar content: rows only, for short tables under their own heading. */
|
|
46
|
+
showToolbar?: boolean;
|
|
47
|
+
/**
|
|
48
|
+
* Adds an export button that saves the filtered, sorted rows as `<exportName>.csv`.
|
|
49
|
+
* Columns choose their text with `exportValue`.
|
|
50
|
+
*/
|
|
51
|
+
exportName?: string;
|
|
52
|
+
/**
|
|
53
|
+
* Grow to fill the height of a flex column container (a page, or a `Card`
|
|
54
|
+
* whose content holds the table); only the rows scroll. `maxHeight` still caps it.
|
|
55
|
+
*/
|
|
56
|
+
fill?: boolean;
|
|
45
57
|
/** Class name for the table's root element. */
|
|
46
58
|
className?: string;
|
|
47
59
|
}
|
|
48
|
-
declare function DataTableComponent<T>({ density, striped, stickyHeader, layout, maxHeight, virtualized, onEndReached, empty, tableProps, pageSizeOptions, controlSize, toolbar, className, ...options }: DataTableProps<T>): React.JSX.Element;
|
|
60
|
+
declare function DataTableComponent<T>({ density, striped, stickyHeader, layout, maxHeight, virtualized, onEndReached, empty, tableProps, pageSizeOptions, controlSize, toolbar, showToolbar, exportName, fill, className, ...options }: DataTableProps<T>): React.JSX.Element;
|
|
49
61
|
/**
|
|
50
62
|
* `<DataTable data={…} columns={…} />` renders a complete table with search,
|
|
51
63
|
* filters, sorting, pagination, row selection, row actions and inline editing;
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cx } from "../../utils/cx.js";
|
|
3
3
|
import { createPrimitive } from "../../utils/primitive.js";
|
|
4
|
+
import { DownloadIcon } from "../../icons/index.js";
|
|
4
5
|
import { Spinner } from "../spinner/Spinner.js";
|
|
6
|
+
import { Button } from "../button/Button.js";
|
|
5
7
|
import { SearchInput } from "../search-input/SearchInput.js";
|
|
6
8
|
import { Pagination } from "../pagination/Pagination.js";
|
|
7
9
|
import { DataTableContext, useDataTableContext } from "./context.js";
|
|
8
10
|
import { useDataTable } from "./useDataTable.js";
|
|
9
11
|
import { DataTableContent } from "./DataTableContent.js";
|
|
10
12
|
import { DataTableFilter, DataTableFilters } from "./DataTableFilters.js";
|
|
13
|
+
import { downloadCsv } from "./export.js";
|
|
11
14
|
import { c } from "react/compiler-runtime";
|
|
12
15
|
import * as React from "react";
|
|
13
16
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -287,11 +290,12 @@ function DataTablePagination(t0) {
|
|
|
287
290
|
return t2;
|
|
288
291
|
}
|
|
289
292
|
function DataTableComponent(t0) {
|
|
290
|
-
const $ = c(
|
|
293
|
+
const $ = c(53);
|
|
291
294
|
let className;
|
|
292
295
|
let controlSize;
|
|
293
296
|
let density;
|
|
294
297
|
let empty;
|
|
298
|
+
let exportName;
|
|
295
299
|
let layout;
|
|
296
300
|
let maxHeight;
|
|
297
301
|
let onEndReached;
|
|
@@ -299,150 +303,161 @@ function DataTableComponent(t0) {
|
|
|
299
303
|
let pageSizeOptions;
|
|
300
304
|
let stickyHeader;
|
|
301
305
|
let striped;
|
|
306
|
+
let t1;
|
|
307
|
+
let t2;
|
|
302
308
|
let tableProps;
|
|
303
309
|
let toolbar;
|
|
304
310
|
let virtualized;
|
|
305
311
|
if ($[0] !== t0) {
|
|
306
|
-
({density, striped, stickyHeader, layout, maxHeight, virtualized, onEndReached, empty, tableProps, pageSizeOptions, controlSize, toolbar, className, ...options} = t0);
|
|
312
|
+
({density, striped, stickyHeader, layout, maxHeight, virtualized, onEndReached, empty, tableProps, pageSizeOptions, controlSize, toolbar, showToolbar: t1, exportName, fill: t2, className, ...options} = t0);
|
|
307
313
|
$[0] = t0;
|
|
308
314
|
$[1] = className;
|
|
309
315
|
$[2] = controlSize;
|
|
310
316
|
$[3] = density;
|
|
311
317
|
$[4] = empty;
|
|
312
|
-
$[5] =
|
|
313
|
-
$[6] =
|
|
314
|
-
$[7] =
|
|
315
|
-
$[8] =
|
|
316
|
-
$[9] =
|
|
317
|
-
$[10] =
|
|
318
|
-
$[11] =
|
|
319
|
-
$[12] =
|
|
320
|
-
$[13] =
|
|
321
|
-
$[14] =
|
|
318
|
+
$[5] = exportName;
|
|
319
|
+
$[6] = layout;
|
|
320
|
+
$[7] = maxHeight;
|
|
321
|
+
$[8] = onEndReached;
|
|
322
|
+
$[9] = options;
|
|
323
|
+
$[10] = pageSizeOptions;
|
|
324
|
+
$[11] = stickyHeader;
|
|
325
|
+
$[12] = striped;
|
|
326
|
+
$[13] = t1;
|
|
327
|
+
$[14] = t2;
|
|
328
|
+
$[15] = tableProps;
|
|
329
|
+
$[16] = toolbar;
|
|
330
|
+
$[17] = virtualized;
|
|
322
331
|
} else {
|
|
323
332
|
className = $[1];
|
|
324
333
|
controlSize = $[2];
|
|
325
334
|
density = $[3];
|
|
326
335
|
empty = $[4];
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
336
|
+
exportName = $[5];
|
|
337
|
+
layout = $[6];
|
|
338
|
+
maxHeight = $[7];
|
|
339
|
+
onEndReached = $[8];
|
|
340
|
+
options = $[9];
|
|
341
|
+
pageSizeOptions = $[10];
|
|
342
|
+
stickyHeader = $[11];
|
|
343
|
+
striped = $[12];
|
|
344
|
+
t1 = $[13];
|
|
345
|
+
t2 = $[14];
|
|
346
|
+
tableProps = $[15];
|
|
347
|
+
toolbar = $[16];
|
|
348
|
+
virtualized = $[17];
|
|
337
349
|
}
|
|
338
|
-
const
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
350
|
+
const showToolbar = t1 === void 0 ? true : t1;
|
|
351
|
+
const fill = t2 === void 0 ? false : t2;
|
|
352
|
+
const t3 = options.paginated ?? !virtualized;
|
|
353
|
+
let t4;
|
|
354
|
+
if ($[18] !== options || $[19] !== t3) {
|
|
355
|
+
t4 = {
|
|
342
356
|
...options,
|
|
343
|
-
paginated:
|
|
357
|
+
paginated: t3
|
|
344
358
|
};
|
|
345
|
-
$[
|
|
346
|
-
$[
|
|
347
|
-
$[
|
|
348
|
-
} else
|
|
349
|
-
const table = useDataTable(
|
|
350
|
-
let
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
359
|
+
$[18] = options;
|
|
360
|
+
$[19] = t3;
|
|
361
|
+
$[20] = t4;
|
|
362
|
+
} else t4 = $[20];
|
|
363
|
+
const table = useDataTable(t4);
|
|
364
|
+
let rows;
|
|
365
|
+
let t5;
|
|
366
|
+
if ($[21] !== table || $[22] !== toolbar) {
|
|
367
|
+
rows = table.rows.map(_temp);
|
|
368
|
+
t5 = typeof toolbar === "function" ? toolbar({
|
|
369
|
+
rows,
|
|
354
370
|
selection: table.selection,
|
|
355
371
|
table
|
|
356
372
|
}) : toolbar;
|
|
357
|
-
$[
|
|
358
|
-
$[
|
|
359
|
-
$[
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
$[23] = t4;
|
|
368
|
-
} else t4 = $[23];
|
|
369
|
-
let t5;
|
|
370
|
-
if ($[24] !== controlSize) {
|
|
371
|
-
t5 = /* @__PURE__ */ jsx(DataTableFilters, { size: controlSize });
|
|
372
|
-
$[24] = controlSize;
|
|
373
|
-
$[25] = t5;
|
|
374
|
-
} else t5 = $[25];
|
|
375
|
-
let t6;
|
|
376
|
-
if ($[26] === Symbol.for("react.memo_cache_sentinel")) {
|
|
377
|
-
t6 = /* @__PURE__ */ jsx(DataTableSummary, {});
|
|
378
|
-
$[26] = t6;
|
|
379
|
-
} else t6 = $[26];
|
|
373
|
+
$[21] = table;
|
|
374
|
+
$[22] = toolbar;
|
|
375
|
+
$[23] = rows;
|
|
376
|
+
$[24] = t5;
|
|
377
|
+
} else {
|
|
378
|
+
rows = $[23];
|
|
379
|
+
t5 = $[24];
|
|
380
|
+
}
|
|
381
|
+
const extra = t5;
|
|
382
|
+
const t6 = fill || void 0;
|
|
380
383
|
let t7;
|
|
381
|
-
if ($[27] !== extra) {
|
|
382
|
-
t7 = /* @__PURE__ */ jsxs(
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
384
|
+
if ($[25] !== controlSize || $[26] !== exportName || $[27] !== extra || $[28] !== rows || $[29] !== showToolbar || $[30] !== table.columns || $[31] !== table.labels || $[32] !== table.searchable) {
|
|
385
|
+
t7 = showToolbar && /* @__PURE__ */ jsxs(DataTableToolbar, { children: [
|
|
386
|
+
table.searchable && /* @__PURE__ */ jsx(DataTableSearch, { size: controlSize }),
|
|
387
|
+
/* @__PURE__ */ jsx(DataTableFilters, { size: controlSize }),
|
|
388
|
+
/* @__PURE__ */ jsxs(DataTableActions, { children: [
|
|
389
|
+
/* @__PURE__ */ jsx(DataTableSummary, {}),
|
|
390
|
+
extra,
|
|
391
|
+
exportName && /* @__PURE__ */ jsxs(Button, {
|
|
392
|
+
variant: "secondary",
|
|
393
|
+
size: "sm",
|
|
394
|
+
disabled: !rows.length,
|
|
395
|
+
onClick: () => downloadCsv(table.columns, rows, exportName),
|
|
396
|
+
children: [/* @__PURE__ */ jsx(DownloadIcon, {}), table.labels.export]
|
|
397
|
+
})
|
|
398
|
+
] })
|
|
392
399
|
] });
|
|
393
|
-
$[
|
|
394
|
-
$[
|
|
395
|
-
$[
|
|
396
|
-
$[
|
|
397
|
-
|
|
400
|
+
$[25] = controlSize;
|
|
401
|
+
$[26] = exportName;
|
|
402
|
+
$[27] = extra;
|
|
403
|
+
$[28] = rows;
|
|
404
|
+
$[29] = showToolbar;
|
|
405
|
+
$[30] = table.columns;
|
|
406
|
+
$[31] = table.labels;
|
|
407
|
+
$[32] = table.searchable;
|
|
408
|
+
$[33] = t7;
|
|
409
|
+
} else t7 = $[33];
|
|
410
|
+
const t8 = fill ? maxHeight ?? "none" : maxHeight;
|
|
398
411
|
let t9;
|
|
399
|
-
if ($[
|
|
412
|
+
if ($[34] !== density || $[35] !== empty || $[36] !== layout || $[37] !== onEndReached || $[38] !== stickyHeader || $[39] !== striped || $[40] !== t8 || $[41] !== tableProps || $[42] !== virtualized) {
|
|
400
413
|
t9 = /* @__PURE__ */ jsx(DataTableContent, {
|
|
401
414
|
density,
|
|
402
415
|
striped,
|
|
403
416
|
stickyHeader,
|
|
404
417
|
layout,
|
|
405
|
-
maxHeight,
|
|
418
|
+
maxHeight: t8,
|
|
406
419
|
virtualized,
|
|
407
420
|
onEndReached,
|
|
408
421
|
empty,
|
|
409
422
|
tableProps
|
|
410
423
|
});
|
|
411
|
-
$[
|
|
412
|
-
$[
|
|
413
|
-
$[
|
|
414
|
-
$[36] = maxHeight;
|
|
424
|
+
$[34] = density;
|
|
425
|
+
$[35] = empty;
|
|
426
|
+
$[36] = layout;
|
|
415
427
|
$[37] = onEndReached;
|
|
416
428
|
$[38] = stickyHeader;
|
|
417
429
|
$[39] = striped;
|
|
418
|
-
$[40] =
|
|
419
|
-
$[41] =
|
|
420
|
-
$[42] =
|
|
421
|
-
|
|
430
|
+
$[40] = t8;
|
|
431
|
+
$[41] = tableProps;
|
|
432
|
+
$[42] = virtualized;
|
|
433
|
+
$[43] = t9;
|
|
434
|
+
} else t9 = $[43];
|
|
422
435
|
let t10;
|
|
423
|
-
if ($[
|
|
436
|
+
if ($[44] !== pageSizeOptions) {
|
|
424
437
|
t10 = /* @__PURE__ */ jsx(DataTablePagination, { pageSizeOptions });
|
|
425
|
-
$[
|
|
426
|
-
$[
|
|
427
|
-
} else t10 = $[
|
|
438
|
+
$[44] = pageSizeOptions;
|
|
439
|
+
$[45] = t10;
|
|
440
|
+
} else t10 = $[45];
|
|
428
441
|
let t11;
|
|
429
|
-
if ($[
|
|
442
|
+
if ($[46] !== className || $[47] !== t10 || $[48] !== t6 || $[49] !== t7 || $[50] !== t9 || $[51] !== table) {
|
|
430
443
|
t11 = /* @__PURE__ */ jsxs(DataTableRoot, {
|
|
431
444
|
table,
|
|
432
445
|
className,
|
|
446
|
+
"data-fill": t6,
|
|
433
447
|
children: [
|
|
434
|
-
|
|
448
|
+
t7,
|
|
435
449
|
t9,
|
|
436
450
|
t10
|
|
437
451
|
]
|
|
438
452
|
});
|
|
439
|
-
$[
|
|
440
|
-
$[
|
|
441
|
-
$[
|
|
442
|
-
$[
|
|
443
|
-
$[
|
|
444
|
-
$[
|
|
445
|
-
|
|
453
|
+
$[46] = className;
|
|
454
|
+
$[47] = t10;
|
|
455
|
+
$[48] = t6;
|
|
456
|
+
$[49] = t7;
|
|
457
|
+
$[50] = t9;
|
|
458
|
+
$[51] = table;
|
|
459
|
+
$[52] = t11;
|
|
460
|
+
} else t11 = $[52];
|
|
446
461
|
return t11;
|
|
447
462
|
}
|
|
448
463
|
/**
|