doom-design-system 0.2.1 → 0.3.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/ActionRow/ActionRow.module.css +1 -0
- package/dist/components/Alert/Alert.module.css +2 -2
- package/dist/components/Button/Button.module.css +5 -2
- package/dist/components/Checkbox/Checkbox.module.css +1 -1
- package/dist/components/Drawer/Drawer.d.ts +2 -1
- package/dist/components/Drawer/Drawer.js +2 -2
- package/dist/components/Drawer/Drawer.module.css +74 -8
- package/dist/components/Input/Input.module.css +1 -1
- package/dist/components/Modal/Modal.d.ts +2 -1
- package/dist/components/Modal/Modal.js +4 -2
- package/dist/components/Modal/Modal.module.css +56 -7
- package/dist/components/Select/Select.module.css +1 -1
- package/dist/components/Sheet/Sheet.d.ts +3 -1
- package/dist/components/Sheet/Sheet.js +2 -2
- package/dist/components/Sheet/Sheet.module.css +98 -12
- package/dist/components/Slider/Slider.d.ts +4 -4
- package/dist/components/Slider/Slider.js +46 -9
- package/dist/components/Slider/Slider.module.css +60 -68
- package/dist/components/SplitButton/SplitButton.js +1 -1
- package/dist/components/SplitButton/SplitButton.module.css +7 -2
- package/dist/components/Table/Table.d.ts +4 -4
- package/dist/components/Table/Table.js +40 -41
- package/dist/components/Table/Table.module.css +11 -5
- package/dist/components/Textarea/Textarea.module.css +1 -1
- package/dist/styles/globals.css +19 -0
- package/dist/styles/themes/definitions.d.ts +91 -59
- package/dist/styles/themes/definitions.js +5 -67
- package/dist/styles/tokens.d.ts +171 -0
- package/dist/styles/tokens.js +185 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -10,26 +10,63 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
10
10
|
}
|
|
11
11
|
return t;
|
|
12
12
|
};
|
|
13
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
14
|
import clsx from "clsx";
|
|
15
15
|
import styles from "./Slider.module.css";
|
|
16
16
|
import React from "react";
|
|
17
17
|
import { Label } from "../Label/Label.js";
|
|
18
|
+
import { Text } from "../Text/Text.js";
|
|
18
19
|
export function Slider(_a) {
|
|
19
20
|
var { label, showValue, value, defaultValue, onChange, min = 0, max = 100, step = 1, className, id } = _a, props = __rest(_a, ["label", "showValue", "value", "defaultValue", "onChange", "min", "max", "step", "className", "id"]);
|
|
20
21
|
const reactId = React.useId();
|
|
21
22
|
const inputId = id || `slider-${reactId}`;
|
|
22
|
-
|
|
23
|
+
// Normalize initial value
|
|
24
|
+
const initialValue = defaultValue !== undefined
|
|
25
|
+
? defaultValue
|
|
26
|
+
: Array.isArray(value)
|
|
27
|
+
? value
|
|
28
|
+
: min;
|
|
29
|
+
const [internalValue, setInternalValue] = React.useState(initialValue);
|
|
23
30
|
const isControlled = value !== undefined;
|
|
24
31
|
const currentValue = isControlled ? value : internalValue;
|
|
25
|
-
const
|
|
32
|
+
const isRange = Array.isArray(currentValue);
|
|
33
|
+
// Helper to ensure types match logic
|
|
34
|
+
const valArray = isRange
|
|
35
|
+
? currentValue
|
|
36
|
+
: [currentValue, currentValue];
|
|
37
|
+
const minLimit = Number(min);
|
|
38
|
+
const maxLimit = Number(max);
|
|
39
|
+
const handleChange = (e, index) => {
|
|
26
40
|
const newVal = Number(e.target.value);
|
|
27
|
-
if (!
|
|
28
|
-
|
|
41
|
+
if (!isRange) {
|
|
42
|
+
if (!isControlled)
|
|
43
|
+
setInternalValue(newVal);
|
|
44
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newVal);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const newArray = [...valArray];
|
|
48
|
+
if (index === 0) {
|
|
49
|
+
// Changing Min: Don't exceed Max
|
|
50
|
+
newArray[0] = Math.min(newVal, valArray[1]);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// Changing Max: Don't go below Min
|
|
54
|
+
newArray[1] = Math.max(newVal, valArray[0]);
|
|
55
|
+
}
|
|
56
|
+
if (!isControlled)
|
|
57
|
+
setInternalValue(newArray);
|
|
58
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newArray);
|
|
29
59
|
}
|
|
30
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newVal);
|
|
31
60
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
61
|
+
// Calculate Percentage for Track Fill
|
|
62
|
+
const getPercentage = (val) => ((val - minLimit) / (maxLimit - minLimit)) * 100;
|
|
63
|
+
const startPercent = isRange ? getPercentage(valArray[0]) : 0;
|
|
64
|
+
const endPercent = isRange
|
|
65
|
+
? getPercentage(valArray[1])
|
|
66
|
+
: getPercentage(valArray[0]);
|
|
67
|
+
const widthPercent = endPercent - startPercent;
|
|
68
|
+
return (_jsxs("div", { className: clsx(styles.container, className), children: [(label || showValue) && (_jsxs("div", { className: styles.labelRow, children: [label && _jsx(Label, { htmlFor: inputId, children: label }), showValue && (_jsx(Text, { variant: "small", weight: "bold", className: styles.valueDisplay, children: isRange ? `${valArray[0]} - ${valArray[1]}` : valArray[0] }))] })), _jsxs("div", { className: styles.trackWrapper, children: [_jsx("div", { className: styles.trackInner, children: _jsx("div", { className: styles.progressFill, style: {
|
|
69
|
+
left: `${startPercent}%`,
|
|
70
|
+
width: `${widthPercent}%`,
|
|
71
|
+
} }) }), !isRange ? (_jsx("input", Object.assign({ id: inputId, className: styles.rangeInput, type: "range", min: min, max: max, step: step, value: valArray[0], onChange: (e) => handleChange(e), "aria-label": !label ? props["aria-label"] || "Slider" : undefined, "aria-valuenow": valArray[0], "aria-valuemin": minLimit, "aria-valuemax": maxLimit }, props))) : (_jsxs(_Fragment, { children: [_jsx("input", { id: `${inputId}-min`, className: styles.multiRangeInput, type: "range", min: min, max: max, step: step, value: valArray[0], onChange: (e) => handleChange(e, 0), "aria-label": "Minimum value", style: { zIndex: valArray[0] > maxLimit - 10 ? 21 : 20 } }), _jsx("input", { id: `${inputId}-max`, className: styles.multiRangeInput, type: "range", min: min, max: max, step: step, value: valArray[1], onChange: (e) => handleChange(e, 1), "aria-label": "Maximum value", style: { zIndex: 20 } })] }))] })] }));
|
|
35
72
|
}
|
|
@@ -3,128 +3,120 @@
|
|
|
3
3
|
flex-direction: column;
|
|
4
4
|
gap: 0.75rem;
|
|
5
5
|
width: 100%;
|
|
6
|
+
padding: 0 12px;
|
|
6
7
|
}
|
|
7
8
|
|
|
8
9
|
.labelRow {
|
|
9
10
|
display: flex;
|
|
10
11
|
justify-content: space-between;
|
|
11
12
|
align-items: center;
|
|
12
|
-
font-family: var(--font-heading);
|
|
13
|
-
font-weight: 600;
|
|
14
|
-
font-size: var(--text-sm);
|
|
15
|
-
color: var(--foreground);
|
|
16
13
|
}
|
|
17
14
|
|
|
18
15
|
.valueDisplay {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
16
|
+
background-color: var(--card-bg);
|
|
17
|
+
padding: 0.125rem 0.5rem;
|
|
18
|
+
border: var(--border-width) solid var(--card-border);
|
|
19
|
+
border-radius: var(--radius);
|
|
20
|
+
display: inline-flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: center;
|
|
25
23
|
}
|
|
26
24
|
|
|
27
25
|
.trackWrapper {
|
|
28
26
|
position: relative;
|
|
29
27
|
width: 100%;
|
|
30
|
-
height:
|
|
31
|
-
border-radius: 999px;
|
|
32
|
-
background: var(--muted);
|
|
28
|
+
height: 12px;
|
|
33
29
|
overflow: visible;
|
|
34
30
|
}
|
|
35
31
|
|
|
32
|
+
.trackInner {
|
|
33
|
+
position: absolute;
|
|
34
|
+
inset: 0;
|
|
35
|
+
background: var(--card-bg);
|
|
36
|
+
border: var(--border-width) solid var(--card-border);
|
|
37
|
+
border-radius: var(--radius);
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
box-sizing: border-box;
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
.progressFill {
|
|
37
43
|
position: absolute;
|
|
38
|
-
left: 0;
|
|
39
44
|
top: 0;
|
|
40
|
-
|
|
41
|
-
width: var(--percentage, 0%);
|
|
45
|
+
bottom: 0;
|
|
42
46
|
background: var(--primary);
|
|
43
|
-
border-radius: 999px;
|
|
44
47
|
z-index: 1;
|
|
48
|
+
pointer-events: none;
|
|
45
49
|
}
|
|
46
50
|
|
|
47
|
-
.rangeInput {
|
|
51
|
+
.rangeInput, .multiRangeInput {
|
|
48
52
|
appearance: none;
|
|
49
53
|
-webkit-appearance: none;
|
|
50
54
|
position: absolute;
|
|
51
55
|
top: 0;
|
|
52
|
-
left:
|
|
53
|
-
width: 100
|
|
56
|
+
left: -12px;
|
|
57
|
+
width: calc(100% + 24px);
|
|
54
58
|
height: 100%;
|
|
55
59
|
background: transparent;
|
|
56
60
|
cursor: pointer;
|
|
57
|
-
margin: 0;
|
|
58
61
|
z-index: 10;
|
|
62
|
+
margin: 0;
|
|
59
63
|
}
|
|
60
|
-
.rangeInput::-webkit-slider-runnable-track {
|
|
64
|
+
.rangeInput::-webkit-slider-runnable-track, .multiRangeInput::-webkit-slider-runnable-track {
|
|
61
65
|
width: 100%;
|
|
62
|
-
height:
|
|
66
|
+
height: 12px;
|
|
63
67
|
background: transparent;
|
|
64
68
|
border: none;
|
|
65
69
|
}
|
|
66
|
-
.rangeInput::-moz-range-track {
|
|
70
|
+
.rangeInput::-moz-range-track, .multiRangeInput::-moz-range-track {
|
|
67
71
|
width: 100%;
|
|
68
|
-
height:
|
|
72
|
+
height: 12px;
|
|
69
73
|
background: transparent;
|
|
70
74
|
border: none;
|
|
71
75
|
}
|
|
72
|
-
.rangeInput::-webkit-slider-thumb {
|
|
76
|
+
.rangeInput::-webkit-slider-thumb, .multiRangeInput::-webkit-slider-thumb {
|
|
73
77
|
-webkit-appearance: none;
|
|
74
|
-
height:
|
|
75
|
-
width:
|
|
78
|
+
height: 24px;
|
|
79
|
+
width: 24px;
|
|
76
80
|
background: var(--primary);
|
|
77
|
-
border:
|
|
81
|
+
border: var(--border-width) solid var(--border-strong);
|
|
78
82
|
border-radius: 50%;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
83
|
+
margin-top: -7px; /* Center thumb on track */
|
|
84
|
+
position: relative;
|
|
85
|
+
z-index: 20;
|
|
82
86
|
}
|
|
83
|
-
.rangeInput::-moz-range-thumb {
|
|
84
|
-
height:
|
|
85
|
-
width:
|
|
87
|
+
.rangeInput::-moz-range-thumb, .multiRangeInput::-moz-range-thumb {
|
|
88
|
+
height: 24px;
|
|
89
|
+
width: 24px;
|
|
86
90
|
background: var(--primary);
|
|
87
|
-
border:
|
|
91
|
+
border: var(--border-width) solid var(--border-strong);
|
|
88
92
|
border-radius: 50%;
|
|
89
|
-
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--card-border);
|
|
90
|
-
transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
|
|
91
93
|
}
|
|
92
|
-
.rangeInput:
|
|
93
|
-
transform: scale(1.15);
|
|
94
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent);
|
|
95
|
-
}
|
|
96
|
-
.rangeInput:hover::-moz-range-thumb {
|
|
97
|
-
transform: scale(1.15);
|
|
98
|
-
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent);
|
|
99
|
-
}
|
|
100
|
-
.rangeInput:active::-webkit-slider-thumb {
|
|
101
|
-
transform: scale(1.05);
|
|
102
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 6px color-mix(in srgb, var(--primary) 25%, transparent);
|
|
103
|
-
}
|
|
104
|
-
.rangeInput:active::-moz-range-thumb {
|
|
105
|
-
transform: scale(1.05);
|
|
106
|
-
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 6px color-mix(in srgb, var(--primary) 25%, transparent);
|
|
107
|
-
}
|
|
108
|
-
.rangeInput:focus {
|
|
94
|
+
.rangeInput:focus, .multiRangeInput:focus {
|
|
109
95
|
outline: none;
|
|
110
96
|
}
|
|
111
|
-
.rangeInput:focus-visible::-webkit-slider-thumb {
|
|
112
|
-
outline:
|
|
113
|
-
outline-offset:
|
|
97
|
+
.rangeInput:focus-visible::-webkit-slider-thumb, .multiRangeInput:focus-visible::-webkit-slider-thumb {
|
|
98
|
+
outline: var(--border-width) solid var(--foreground);
|
|
99
|
+
outline-offset: 4px;
|
|
114
100
|
}
|
|
115
|
-
.rangeInput:focus-visible::-moz-range-thumb {
|
|
116
|
-
outline:
|
|
117
|
-
outline-offset:
|
|
101
|
+
.rangeInput:focus-visible::-moz-range-thumb, .multiRangeInput:focus-visible::-moz-range-thumb {
|
|
102
|
+
outline: var(--border-width) solid var(--foreground);
|
|
103
|
+
outline-offset: 4px;
|
|
118
104
|
}
|
|
119
|
-
.rangeInput:disabled {
|
|
105
|
+
.rangeInput:disabled, .multiRangeInput:disabled {
|
|
120
106
|
cursor: not-allowed;
|
|
121
107
|
opacity: 0.5;
|
|
122
108
|
}
|
|
123
|
-
.rangeInput:disabled::-webkit-slider-thumb {
|
|
124
|
-
background: var(--muted
|
|
125
|
-
|
|
109
|
+
.rangeInput:disabled::-webkit-slider-thumb, .multiRangeInput:disabled::-webkit-slider-thumb {
|
|
110
|
+
background: var(--muted);
|
|
111
|
+
filter: grayscale(1);
|
|
126
112
|
}
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
113
|
+
|
|
114
|
+
.multiRangeInput {
|
|
115
|
+
pointer-events: none !important;
|
|
116
|
+
}
|
|
117
|
+
.multiRangeInput::-webkit-slider-thumb {
|
|
118
|
+
pointer-events: auto !important;
|
|
119
|
+
}
|
|
120
|
+
.multiRangeInput::-moz-range-thumb {
|
|
121
|
+
pointer-events: auto !important;
|
|
130
122
|
}
|
|
@@ -7,7 +7,7 @@ import styles from "./SplitButton.module.css";
|
|
|
7
7
|
import { useState } from "react";
|
|
8
8
|
export function SplitButton({ primaryLabel, onPrimaryClick, items, variant = "primary", className, }) {
|
|
9
9
|
const [isOpen, setIsOpen] = useState(false);
|
|
10
|
-
return (_jsx(Popover, { isOpen: isOpen, onClose: () => setIsOpen(false), placement: "bottom-end", trigger: _jsxs("div", { className: clsx(styles.container, styles[variant], className), children: [_jsx("button", { className: styles.mainButton, onClick: onPrimaryClick, children: primaryLabel }), _jsx("button", { className: styles.dropdownTrigger, onClick: () => setIsOpen(!isOpen), "aria-expanded": isOpen, "aria-haspopup": "menu", "aria-label": `More ${primaryLabel} options`, children: _jsx(ChevronDown, { size: 16, strokeWidth: 3, "aria-hidden": "true" }) })] }), content: _jsx("div", { className: styles.menu, children: items.map((item, index) => (_jsx("button", { className: styles.item, onClick: () => {
|
|
10
|
+
return (_jsx(Popover, { isOpen: isOpen, onClose: () => setIsOpen(false), placement: "bottom-end", trigger: _jsxs("div", { className: clsx(styles.container, styles[variant], className), "data-state": isOpen ? "open" : "closed", children: [_jsx("button", { className: styles.mainButton, onClick: onPrimaryClick, children: primaryLabel }), _jsx("button", { className: styles.dropdownTrigger, onClick: () => setIsOpen(!isOpen), "aria-expanded": isOpen, "aria-haspopup": "menu", "aria-label": `More ${primaryLabel} options`, children: _jsx(ChevronDown, { size: 16, strokeWidth: 3, "aria-hidden": "true" }) })] }), content: _jsx("div", { className: styles.menu, children: items.map((item, index) => (_jsx("button", { className: styles.item, onClick: () => {
|
|
11
11
|
item.onClick();
|
|
12
12
|
setIsOpen(false);
|
|
13
13
|
}, children: item.label }, index))) }) }));
|
|
@@ -13,10 +13,15 @@
|
|
|
13
13
|
background-color: var(--secondary);
|
|
14
14
|
color: var(--secondary-foreground);
|
|
15
15
|
}
|
|
16
|
-
.container:hover
|
|
16
|
+
.container:hover {
|
|
17
17
|
transform: translate(-2px, -2px);
|
|
18
18
|
box-shadow: var(--shadow-hover);
|
|
19
19
|
}
|
|
20
|
+
.container[data-state=open] {
|
|
21
|
+
transform: translate(-2px, -2px);
|
|
22
|
+
box-shadow: 8px 8px 0px 0px var(--shadow-primary);
|
|
23
|
+
border: var(--border-width) solid var(--shadow-primary);
|
|
24
|
+
}
|
|
20
25
|
|
|
21
26
|
.mainButton {
|
|
22
27
|
border: none;
|
|
@@ -52,7 +57,7 @@
|
|
|
52
57
|
background: var(--card-bg);
|
|
53
58
|
border: var(--border-width) solid var(--primary);
|
|
54
59
|
border-radius: var(--radius);
|
|
55
|
-
box-shadow: var(--shadow-
|
|
60
|
+
box-shadow: 8px 8px 0px 0px var(--shadow-primary);
|
|
56
61
|
min-width: 200px;
|
|
57
62
|
overflow: hidden;
|
|
58
63
|
display: flex;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ColumnDef } from
|
|
2
|
-
import React from
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import React from "react";
|
|
3
3
|
interface TableProps<T> {
|
|
4
4
|
data: T[];
|
|
5
5
|
columns: ColumnDef<T>[];
|
|
@@ -10,8 +10,8 @@ interface TableProps<T> {
|
|
|
10
10
|
height?: string | number;
|
|
11
11
|
className?: string;
|
|
12
12
|
style?: React.CSSProperties;
|
|
13
|
-
variant?:
|
|
14
|
-
density?:
|
|
13
|
+
variant?: "default" | "flat";
|
|
14
|
+
density?: "compact" | "standard" | "relaxed";
|
|
15
15
|
toolbarContent?: React.ReactNode;
|
|
16
16
|
striped?: boolean;
|
|
17
17
|
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import clsx from
|
|
4
|
-
import { useReactTable, getCoreRowModel, getSortedRowModel, getPaginationRowModel, getFilteredRowModel, flexRender, } from
|
|
5
|
-
import { useVirtualizer } from
|
|
6
|
-
import { Input } from
|
|
7
|
-
import { Select } from
|
|
8
|
-
import { Flex } from
|
|
9
|
-
import { Pagination } from
|
|
10
|
-
import styles from
|
|
11
|
-
import React, { useState } from
|
|
12
|
-
export function Table({ data, columns, enablePagination = true, enableFiltering = true, enableSorting = true, pageSize = 10, height, className, style, variant =
|
|
3
|
+
import clsx from "clsx";
|
|
4
|
+
import { useReactTable, getCoreRowModel, getSortedRowModel, getPaginationRowModel, getFilteredRowModel, flexRender, } from "@tanstack/react-table";
|
|
5
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
6
|
+
import { Input } from "../Input/Input.js";
|
|
7
|
+
import { Select } from "../Select/Select.js";
|
|
8
|
+
import { Flex } from "../Layout/Layout.js";
|
|
9
|
+
import { Pagination } from "../Pagination/Pagination.js";
|
|
10
|
+
import styles from "./Table.module.css";
|
|
11
|
+
import React, { useState } from "react";
|
|
12
|
+
export function Table({ data, columns, enablePagination = true, enableFiltering = true, enableSorting = true, pageSize = 10, height, className, style, variant = "default", density = "standard", toolbarContent, striped = false, }) {
|
|
13
13
|
const [sorting, setSorting] = useState([]);
|
|
14
|
-
const [globalFilter, setGlobalFilter] = useState(
|
|
14
|
+
const [globalFilter, setGlobalFilter] = useState("");
|
|
15
15
|
const [pagination, setPagination] = useState({
|
|
16
16
|
pageIndex: 0,
|
|
17
17
|
pageSize: pageSize,
|
|
@@ -30,7 +30,9 @@ export function Table({ data, columns, enablePagination = true, enableFiltering
|
|
|
30
30
|
onPaginationChange: setPagination,
|
|
31
31
|
getCoreRowModel: getCoreRowModel(),
|
|
32
32
|
getSortedRowModel: getSortedRowModel(), // Always provide the model, enableSorting controls if it's used
|
|
33
|
-
getPaginationRowModel: enablePagination
|
|
33
|
+
getPaginationRowModel: enablePagination
|
|
34
|
+
? getPaginationRowModel()
|
|
35
|
+
: undefined,
|
|
34
36
|
getFilteredRowModel: enableFiltering ? getFilteredRowModel() : undefined,
|
|
35
37
|
});
|
|
36
38
|
// Virtualization Logic (Simplified for rows)
|
|
@@ -43,38 +45,35 @@ export function Table({ data, columns, enablePagination = true, enableFiltering
|
|
|
43
45
|
overscan: 5,
|
|
44
46
|
});
|
|
45
47
|
const isVirtual = !!height;
|
|
46
|
-
return (_jsxs("div", { className: clsx(styles.container, variant ===
|
|
47
|
-
height: height ? height :
|
|
48
|
-
overflowY: height ?
|
|
49
|
-
overflowX:
|
|
50
|
-
width:
|
|
48
|
+
return (_jsxs("div", { className: clsx(styles.container, variant === "flat" && styles.flat, className), style: style, children: [enableFiltering && (_jsxs("div", { className: styles.toolbar, children: [_jsx("div", { style: { width: "300px" }, children: _jsx(Input, { placeholder: "Search...", value: globalFilter !== null && globalFilter !== void 0 ? globalFilter : "", onChange: (e) => setGlobalFilter(e.target.value) }) }), toolbarContent && (_jsx(Flex, { gap: "1rem", align: "center", children: toolbarContent }))] })), _jsxs("div", { ref: parentRef, tabIndex: 0, style: {
|
|
49
|
+
height: height ? height : "auto",
|
|
50
|
+
overflowY: height ? "auto" : "visible",
|
|
51
|
+
overflowX: "auto",
|
|
52
|
+
width: "100%",
|
|
51
53
|
}, children: [_jsxs("table", { className: styles.table, children: [_jsx("thead", { children: table.getHeaderGroups().map((headerGroup) => (_jsx("tr", { children: headerGroup.headers.map((header) => {
|
|
52
54
|
var _a;
|
|
53
55
|
const canSort = header.column.getCanSort();
|
|
54
|
-
return (_jsx("th", { onClick: canSort
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
transform: `translateY(${virtualRow.start}px)`,
|
|
71
|
-
}, children: row.getVisibleCells().map((cell) => (_jsx("td", { className: clsx(styles.td, styles[density]), children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id));
|
|
72
|
-
}) })) : (_jsx("tbody", { children: table.getRowModel().rows.map((row) => (_jsx("tr", { className: clsx(styles.tr, striped && styles.striped, 'group'), children: row.getVisibleCells().map((cell) => (_jsx("td", { className: clsx(styles.td, styles[density]), children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))) }))] }), table.getRowModel().rows.length === 0 && (_jsx("div", { className: styles.noResults, children: "No results found." }))] }), enablePagination && !isVirtual && (_jsx("div", { className: styles.paginationContainer, children: _jsxs(Flex, { gap: "1rem", align: "center", style: { width: '100%', justifyContent: 'space-between' }, children: [_jsx("div", { style: { flexShrink: 0 }, children: _jsx(Select, { value: table.getState().pagination.pageSize, onChange: (e) => {
|
|
56
|
+
return (_jsx("th", { onClick: canSort
|
|
57
|
+
? header.column.getToggleSortingHandler()
|
|
58
|
+
: undefined, style: { width: header.getSize() }, className: clsx(styles.th, styles[density], canSort && styles.sortable), children: _jsxs("div", { className: styles.headerContent, children: [flexRender(header.column.columnDef.header, header.getContext()), canSort &&
|
|
59
|
+
((_a = {
|
|
60
|
+
asc: " ▲",
|
|
61
|
+
desc: " ▼",
|
|
62
|
+
}[header.column.getIsSorted()]) !== null && _a !== void 0 ? _a : null)] }) }, header.id));
|
|
63
|
+
}) }, headerGroup.id))) }), isVirtual ? (_jsxs("tbody", { children: [rowVirtualizer.getVirtualItems().length > 0 && (_jsx("tr", { style: {
|
|
64
|
+
height: `${rowVirtualizer.getVirtualItems()[0].start}px`,
|
|
65
|
+
}, children: _jsx("td", { colSpan: columns.length, style: { border: 0, padding: 0 } }) })), rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
66
|
+
const row = rows[virtualRow.index];
|
|
67
|
+
return (_jsx("tr", { className: clsx(styles.tr, striped && styles.striped), children: row.getVisibleCells().map((cell) => (_jsx("td", { className: clsx(styles.td, styles[density]), children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id));
|
|
68
|
+
}), rowVirtualizer.getVirtualItems().length > 0 && (_jsx("tr", { style: {
|
|
69
|
+
height: `${rowVirtualizer.getTotalSize() -
|
|
70
|
+
rowVirtualizer.getVirtualItems()[rowVirtualizer.getVirtualItems().length - 1].end}px`,
|
|
71
|
+
}, children: _jsx("td", { colSpan: columns.length, style: { border: 0, padding: 0 } }) }))] })) : (_jsx("tbody", { children: table.getRowModel().rows.map((row) => (_jsx("tr", { className: clsx(styles.tr, striped && styles.striped, "group"), children: row.getVisibleCells().map((cell) => (_jsx("td", { className: clsx(styles.td, styles[density]), children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))) }))] }), table.getRowModel().rows.length === 0 && (_jsx("div", { className: styles.noResults, children: "No results found." }))] }), enablePagination && !isVirtual && (_jsx("div", { className: styles.paginationContainer, children: _jsxs(Flex, { gap: "1rem", align: "center", style: { width: "100%", justifyContent: "space-between" }, children: [_jsx("div", { style: { flexShrink: 0 }, children: _jsx(Select, { value: table.getState().pagination.pageSize, onChange: (e) => {
|
|
73
72
|
table.setPageSize(Number(e.target.value));
|
|
74
73
|
}, options: [
|
|
75
|
-
{ value: 10, label:
|
|
76
|
-
{ value: 20, label:
|
|
77
|
-
{ value: 50, label:
|
|
78
|
-
{ value: 100, label:
|
|
74
|
+
{ value: 10, label: "10 rows" },
|
|
75
|
+
{ value: 20, label: "20 rows" },
|
|
76
|
+
{ value: 50, label: "50 rows" },
|
|
77
|
+
{ value: 100, label: "100 rows" },
|
|
79
78
|
] }) }), _jsx(Pagination, { currentPage: table.getState().pagination.pageIndex + 1, totalPages: table.getPageCount(), onPageChange: (page) => table.setPageIndex(page - 1) })] }) }))] }));
|
|
80
79
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
width: 100%;
|
|
3
3
|
border: var(--border-width) solid var(--card-border);
|
|
4
4
|
border-radius: var(--radius);
|
|
5
|
-
background: var(--
|
|
5
|
+
background: var(--surface-accent);
|
|
6
6
|
box-shadow: var(--shadow-hard);
|
|
7
7
|
overflow: hidden;
|
|
8
8
|
display: flex;
|
|
@@ -18,17 +18,23 @@
|
|
|
18
18
|
.toolbar {
|
|
19
19
|
padding: var(--spacing-md);
|
|
20
20
|
border-bottom: var(--border-width) solid var(--card-border);
|
|
21
|
-
background:
|
|
21
|
+
background: transparent;
|
|
22
22
|
display: flex;
|
|
23
23
|
justify-content: space-between;
|
|
24
24
|
align-items: center;
|
|
25
25
|
gap: 1rem;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
.tableWrapper {
|
|
29
|
+
width: 100%;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
}
|
|
32
|
+
|
|
28
33
|
.table {
|
|
29
34
|
width: 100%;
|
|
30
35
|
border-collapse: collapse;
|
|
31
36
|
font-size: var(--text-base);
|
|
37
|
+
background: var(--card-bg);
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
.th {
|
|
@@ -60,7 +66,7 @@
|
|
|
60
66
|
.td {
|
|
61
67
|
padding: 1rem;
|
|
62
68
|
border-bottom: 1px solid var(--card-border);
|
|
63
|
-
color: var(--
|
|
69
|
+
color: var(--on-surface);
|
|
64
70
|
}
|
|
65
71
|
.td.compact {
|
|
66
72
|
padding: 0.5rem 1rem;
|
|
@@ -92,7 +98,7 @@
|
|
|
92
98
|
.paginationContainer {
|
|
93
99
|
padding: var(--spacing-md);
|
|
94
100
|
border-top: var(--border-width) solid var(--card-border);
|
|
95
|
-
background:
|
|
101
|
+
background: transparent;
|
|
96
102
|
display: flex;
|
|
97
103
|
justify-content: space-between;
|
|
98
104
|
align-items: center;
|
|
@@ -101,7 +107,7 @@
|
|
|
101
107
|
.noResults {
|
|
102
108
|
padding: 2rem;
|
|
103
109
|
text-align: center;
|
|
104
|
-
color: var(--muted
|
|
110
|
+
color: var(--on-surface-muted);
|
|
105
111
|
}
|
|
106
112
|
|
|
107
113
|
.headerContent {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
.textarea:focus, .textarea:focus-visible, .textarea[aria-expanded=true] {
|
|
24
24
|
outline: none;
|
|
25
25
|
transform: translate(-2px, -2px);
|
|
26
|
-
box-shadow:
|
|
26
|
+
box-shadow: 8px 8px 0px 0px var(--shadow-primary);
|
|
27
27
|
border-color: var(--primary);
|
|
28
28
|
}
|
|
29
29
|
.textarea::placeholder {
|
package/dist/styles/globals.css
CHANGED
|
@@ -1546,3 +1546,22 @@ body .transition-all {
|
|
|
1546
1546
|
body .shadow-hard {
|
|
1547
1547
|
box-shadow: var(--shadow-hard);
|
|
1548
1548
|
}
|
|
1549
|
+
body {
|
|
1550
|
+
/* Dynamically built directional shadows */
|
|
1551
|
+
}
|
|
1552
|
+
body .shadow-top-hard {
|
|
1553
|
+
/* Top-Right heavy shadow */
|
|
1554
|
+
box-shadow: 8px -8px 0 0 var(--border-strong);
|
|
1555
|
+
}
|
|
1556
|
+
body .shadow-bottom-hard {
|
|
1557
|
+
/* Standard Bottom-Right shadow */
|
|
1558
|
+
box-shadow: 8px 8px 0 0 var(--border-strong);
|
|
1559
|
+
}
|
|
1560
|
+
body .shadow-left-hard {
|
|
1561
|
+
/* Bottom-Left shadow for right-anchored elements */
|
|
1562
|
+
box-shadow: -8px 8px 0 0 var(--border-strong);
|
|
1563
|
+
}
|
|
1564
|
+
body .shadow-right-hard {
|
|
1565
|
+
/* Bottom-Right shadow for left-anchored elements */
|
|
1566
|
+
box-shadow: 8px 8px 0 0 var(--border-strong);
|
|
1567
|
+
}
|