doom-design-system 0.1.3 → 0.1.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.
- package/README.md +5 -2
- package/dist/components/Accordion/Accordion.d.ts +17 -0
- package/dist/components/Accordion/Accordion.js +94 -0
- package/dist/components/Accordion/index.d.ts +1 -0
- package/dist/components/Accordion/index.js +1 -0
- package/dist/components/Alert/Alert.d.ts +11 -0
- package/dist/components/Alert/Alert.js +70 -0
- package/dist/components/Alert/index.d.ts +1 -0
- package/dist/components/Alert/index.js +1 -0
- package/dist/components/Avatar/Avatar.d.ts +13 -0
- package/dist/components/Avatar/Avatar.js +51 -0
- package/dist/components/Avatar/index.d.ts +1 -0
- package/dist/components/Avatar/index.js +1 -0
- package/dist/components/Badge/Badge.js +1 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +13 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +46 -0
- package/dist/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/components/Breadcrumbs/index.js +1 -0
- package/dist/components/Button/Button.js +39 -6
- package/dist/components/Card/Card.js +1 -1
- package/dist/components/Drawer/Drawer.d.ts +12 -0
- package/dist/components/Drawer/Drawer.js +101 -0
- package/dist/components/Drawer/index.d.ts +1 -0
- package/dist/components/Drawer/index.js +1 -0
- package/dist/components/Form/Form.d.ts +20 -7
- package/dist/components/Form/Form.js +49 -9
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.js +27 -60
- package/dist/components/Label/Label.d.ts +6 -0
- package/dist/components/Label/Label.js +38 -0
- package/dist/components/Label/index.d.ts +1 -0
- package/dist/components/Label/index.js +1 -0
- package/dist/components/Link/Link.js +1 -1
- package/dist/components/Modal/Modal.js +7 -7
- package/dist/components/Pagination/Pagination.d.ts +8 -0
- package/dist/components/Pagination/Pagination.js +94 -0
- package/dist/components/Pagination/index.d.ts +1 -0
- package/dist/components/Pagination/index.js +1 -0
- package/dist/components/Popover/Popover.d.ts +1 -1
- package/dist/components/Popover/Popover.js +47 -29
- package/dist/components/RadioGroup/RadioGroup.d.ts +19 -0
- package/dist/components/RadioGroup/RadioGroup.js +101 -0
- package/dist/components/RadioGroup/index.d.ts +1 -0
- package/dist/components/RadioGroup/index.js +1 -0
- package/dist/components/Select/Select.js +5 -17
- package/dist/components/Sheet/Sheet.d.ts +10 -0
- package/dist/components/Sheet/Sheet.js +87 -0
- package/dist/components/Sheet/index.d.ts +1 -0
- package/dist/components/Sheet/index.js +1 -0
- package/dist/components/Slider/Slider.d.ts +10 -0
- package/dist/components/Slider/Slider.js +168 -0
- package/dist/components/Slider/index.d.ts +1 -0
- package/dist/components/Slider/index.js +1 -0
- package/dist/components/Switch/Switch.d.ts +11 -0
- package/dist/components/Switch/Switch.js +77 -0
- package/dist/components/Switch/index.d.ts +1 -0
- package/dist/components/Switch/index.js +1 -0
- package/dist/components/Table/Table.js +6 -6
- package/dist/components/Tabs/Tabs.js +6 -9
- package/dist/components/Textarea/Textarea.js +3 -10
- package/dist/components/Toast/Toast.js +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +9 -0
- package/dist/components/Tooltip/Tooltip.js +37 -0
- package/dist/components/Tooltip/index.d.ts +1 -0
- package/dist/components/Tooltip/index.js +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +12 -0
- package/dist/styles/mixins.d.ts +3 -0
- package/dist/styles/mixins.js +25 -0
- package/dist/styles/themes/definitions.d.ts +112 -0
- package/dist/styles/themes/definitions.js +37 -4
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { createContext, useContext } from 'react';
|
|
4
|
+
import styled from '@emotion/styled';
|
|
5
|
+
const Group = styled.div `
|
|
6
|
+
display: flex;
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
gap: 0.5rem;
|
|
9
|
+
`;
|
|
10
|
+
const ItemLabel = styled.label `
|
|
11
|
+
display: flex;
|
|
12
|
+
align-items: center;
|
|
13
|
+
gap: 0.75rem;
|
|
14
|
+
cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
|
|
15
|
+
position: relative;
|
|
16
|
+
padding: 0.75rem 1rem;
|
|
17
|
+
border-radius: var(--radius);
|
|
18
|
+
transition: all 0.15s ease;
|
|
19
|
+
opacity: ${props => props.disabled ? 0.5 : 1};
|
|
20
|
+
|
|
21
|
+
&:hover:not([aria-disabled="true"]) {
|
|
22
|
+
background-color: var(--muted);
|
|
23
|
+
background-color: color-mix(in srgb, var(--primary) 8%, transparent);
|
|
24
|
+
}
|
|
25
|
+
`;
|
|
26
|
+
const RadioCircle = styled.div `
|
|
27
|
+
width: 22px;
|
|
28
|
+
height: 22px;
|
|
29
|
+
border: 2px solid ${props => props.checked ? 'var(--primary)' : 'var(--foreground)'};
|
|
30
|
+
border-radius: 50%;
|
|
31
|
+
background: var(--background);
|
|
32
|
+
display: flex;
|
|
33
|
+
align-items: center;
|
|
34
|
+
justify-content: center;
|
|
35
|
+
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
|
36
|
+
flex-shrink: 0;
|
|
37
|
+
position: relative;
|
|
38
|
+
|
|
39
|
+
${props => props.checked && `
|
|
40
|
+
border-color: var(--primary);
|
|
41
|
+
background: var(--primary);
|
|
42
|
+
box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 15%, transparent);
|
|
43
|
+
`}
|
|
44
|
+
`;
|
|
45
|
+
const InnerDot = styled.div `
|
|
46
|
+
width: 10px;
|
|
47
|
+
height: 10px;
|
|
48
|
+
background: var(--primary-foreground);
|
|
49
|
+
border-radius: 50%;
|
|
50
|
+
transform: scale(0);
|
|
51
|
+
animation: radioScale 0.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
|
|
52
|
+
|
|
53
|
+
@keyframes radioScale {
|
|
54
|
+
from {
|
|
55
|
+
transform: scale(0);
|
|
56
|
+
}
|
|
57
|
+
to {
|
|
58
|
+
transform: scale(1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`;
|
|
62
|
+
const HiddenInput = styled.input `
|
|
63
|
+
position: absolute;
|
|
64
|
+
opacity: 0;
|
|
65
|
+
width: 1px;
|
|
66
|
+
height: 1px;
|
|
67
|
+
pointer-events: none;
|
|
68
|
+
|
|
69
|
+
&:focus-visible ~ div {
|
|
70
|
+
outline: var(--outline-width) solid var(--primary);
|
|
71
|
+
outline-offset: var(--outline-offset);
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
const LabelText = styled.span `
|
|
75
|
+
font-family: var(--font-body);
|
|
76
|
+
font-weight: 500;
|
|
77
|
+
font-size: var(--text-base);
|
|
78
|
+
color: var(--foreground);
|
|
79
|
+
user-select: none;
|
|
80
|
+
`;
|
|
81
|
+
const RadioGroupContext = createContext(undefined);
|
|
82
|
+
export function RadioGroup({ name, value: controlledValue, defaultValue, onValueChange, disabled, children, className }) {
|
|
83
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue || '');
|
|
84
|
+
const isControlled = controlledValue !== undefined;
|
|
85
|
+
const currentValue = isControlled ? controlledValue : internalValue;
|
|
86
|
+
const handleChange = (newValue) => {
|
|
87
|
+
if (!isControlled) {
|
|
88
|
+
setInternalValue(newValue);
|
|
89
|
+
}
|
|
90
|
+
onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(newValue);
|
|
91
|
+
};
|
|
92
|
+
return (_jsx(RadioGroupContext.Provider, { value: { name, value: currentValue, onChange: handleChange, disabled }, children: _jsx(Group, { role: "radiogroup", className: className, children: children }) }));
|
|
93
|
+
}
|
|
94
|
+
export function RadioGroupItem({ value, children, disabled, className }) {
|
|
95
|
+
const context = useContext(RadioGroupContext);
|
|
96
|
+
if (!context)
|
|
97
|
+
throw new Error('RadioGroupItem must be used within RadioGroup');
|
|
98
|
+
const checked = context.value === value;
|
|
99
|
+
const isDisabled = disabled || context.disabled;
|
|
100
|
+
return (_jsxs(ItemLabel, { disabled: isDisabled, "aria-disabled": isDisabled, className: className, children: [_jsx(HiddenInput, { type: "radio", name: context.name, value: value, checked: checked, onChange: () => !isDisabled && context.onChange(value), disabled: isDisabled }), _jsx(RadioCircle, { checked: checked, "aria-hidden": "true", children: checked && _jsx(InnerDot, {}) }), _jsx(LabelText, { children: children })] }));
|
|
101
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RadioGroup, RadioGroupItem } from './RadioGroup';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RadioGroup, RadioGroupItem } from './RadioGroup';
|
|
@@ -12,6 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import { useState, useRef, useEffect, useId } from 'react';
|
|
15
|
+
import { baseInteractiveStyles, focusStyles } from '../../styles/mixins';
|
|
15
16
|
import styled from '@emotion/styled';
|
|
16
17
|
import { Text, Popover } from '../..';
|
|
17
18
|
import { Check, ChevronDown } from 'lucide-react';
|
|
@@ -24,45 +25,32 @@ const SelectContainer = styled.div `
|
|
|
24
25
|
const SelectTrigger = styled.button `
|
|
25
26
|
width: 100%;
|
|
26
27
|
background: var(--card-bg);
|
|
27
|
-
border: var(--border-width) solid var(--card-border);
|
|
28
28
|
color: var(--foreground);
|
|
29
29
|
padding: 0.75rem 1rem;
|
|
30
30
|
font-size: var(--text-base);
|
|
31
31
|
cursor: pointer;
|
|
32
|
-
box-shadow: var(--shadow-hard);
|
|
33
|
-
border-radius: var(--radius);
|
|
34
32
|
display: flex;
|
|
35
33
|
justify-content: space-between;
|
|
36
34
|
align-items: center;
|
|
37
35
|
font-weight: 700;
|
|
38
36
|
text-transform: uppercase;
|
|
39
37
|
letter-spacing: 0.05em;
|
|
40
|
-
transition: all 0.1s ease;
|
|
41
38
|
min-height: 42px;
|
|
42
39
|
|
|
43
|
-
|
|
44
|
-
transform: translate(-2px, -2px);
|
|
45
|
-
box-shadow: var(--shadow-hover);
|
|
46
|
-
}
|
|
40
|
+
${baseInteractiveStyles}
|
|
47
41
|
|
|
48
|
-
&:
|
|
49
|
-
outline: none;
|
|
42
|
+
&:hover {
|
|
50
43
|
transform: translate(-2px, -2px);
|
|
51
44
|
box-shadow: var(--shadow-hover);
|
|
52
|
-
border-color: var(--primary);
|
|
53
45
|
}
|
|
54
46
|
|
|
55
|
-
|
|
56
|
-
transform: translate(-2px, -2px);
|
|
57
|
-
box-shadow: var(--shadow-hover);
|
|
58
|
-
border-color: var(--primary);
|
|
59
|
-
}
|
|
47
|
+
${focusStyles}
|
|
60
48
|
`;
|
|
61
49
|
const OptionsList = styled.ul `
|
|
62
50
|
background: var(--card-bg);
|
|
63
51
|
border: var(--border-width) solid var(--primary);
|
|
64
52
|
border-radius: var(--radius);
|
|
65
|
-
box-shadow:
|
|
53
|
+
box-shadow: none;
|
|
66
54
|
min-width: 200px;
|
|
67
55
|
max-height: 300px;
|
|
68
56
|
overflow-y: auto;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SheetProps {
|
|
3
|
+
isOpen: boolean;
|
|
4
|
+
onClose: () => void;
|
|
5
|
+
title?: string;
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function Sheet({ isOpen, onClose, title, children, className }: SheetProps): React.ReactPortal | null;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
|
+
import styled from '@emotion/styled';
|
|
6
|
+
import { X } from 'lucide-react';
|
|
7
|
+
import { Button } from '../Button';
|
|
8
|
+
import { Flex } from '../Layout';
|
|
9
|
+
const Overlay = styled.div `
|
|
10
|
+
position: fixed;
|
|
11
|
+
inset: 0;
|
|
12
|
+
background-color: rgba(0, 0, 0, var(--overlay-opacity));
|
|
13
|
+
backdrop-filter: blur(4px);
|
|
14
|
+
opacity: ${props => props.isOpen ? 1 : 0};
|
|
15
|
+
transition: opacity 0.2s ease-in-out;
|
|
16
|
+
pointer-events: ${props => props.isOpen ? 'auto' : 'none'};
|
|
17
|
+
z-index: var(--z-dropdown);
|
|
18
|
+
`;
|
|
19
|
+
const Panel = styled.div `
|
|
20
|
+
position: fixed;
|
|
21
|
+
bottom: 0;
|
|
22
|
+
left: 0;
|
|
23
|
+
right: 0;
|
|
24
|
+
max-height: 96vh;
|
|
25
|
+
min-height: 50vh;
|
|
26
|
+
background-color: var(--card-bg);
|
|
27
|
+
border-top: var(--border-width) solid var(--card-border);
|
|
28
|
+
border-left: var(--border-width) solid var(--card-border);
|
|
29
|
+
border-right: var(--border-width) solid var(--card-border);
|
|
30
|
+
border-top-left-radius: var(--radius);
|
|
31
|
+
border-top-right-radius: var(--radius);
|
|
32
|
+
box-shadow: var(--shadow-lg);
|
|
33
|
+
display: flex;
|
|
34
|
+
flex-direction: column;
|
|
35
|
+
z-index: var(--z-modal);
|
|
36
|
+
transform: ${props => props.isOpen ? 'translateY(0)' : 'translateY(100%)'};
|
|
37
|
+
transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
38
|
+
`;
|
|
39
|
+
const HandleBar = styled.div `
|
|
40
|
+
width: 48px;
|
|
41
|
+
height: 6px;
|
|
42
|
+
background-color: var(--card-border);
|
|
43
|
+
border-radius: 99px;
|
|
44
|
+
margin: 0.75rem auto;
|
|
45
|
+
opacity: 0.5;
|
|
46
|
+
`;
|
|
47
|
+
const Header = styled(Flex) `
|
|
48
|
+
padding: 0 var(--spacing-lg) var(--spacing-md) var(--spacing-lg);
|
|
49
|
+
`;
|
|
50
|
+
const Title = styled.h2 `
|
|
51
|
+
margin: 0;
|
|
52
|
+
font-family: var(--font-heading);
|
|
53
|
+
font-size: var(--text-xl);
|
|
54
|
+
font-weight: 700;
|
|
55
|
+
`;
|
|
56
|
+
const Content = styled.div `
|
|
57
|
+
flex: 1;
|
|
58
|
+
padding: 0 var(--spacing-lg) var(--spacing-lg) var(--spacing-lg);
|
|
59
|
+
overflow-y: auto;
|
|
60
|
+
`;
|
|
61
|
+
export function Sheet({ isOpen, onClose, title, children, className }) {
|
|
62
|
+
const [mounted, setMounted] = useState(false);
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
setMounted(true);
|
|
65
|
+
if (isOpen) {
|
|
66
|
+
document.body.style.overflow = 'hidden';
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
document.body.style.overflow = '';
|
|
70
|
+
}
|
|
71
|
+
return () => {
|
|
72
|
+
document.body.style.overflow = '';
|
|
73
|
+
};
|
|
74
|
+
}, [isOpen]);
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
const handleEsc = (e) => {
|
|
77
|
+
if (e.key === 'Escape')
|
|
78
|
+
onClose();
|
|
79
|
+
};
|
|
80
|
+
if (isOpen)
|
|
81
|
+
window.addEventListener('keydown', handleEsc);
|
|
82
|
+
return () => window.removeEventListener('keydown', handleEsc);
|
|
83
|
+
}, [isOpen, onClose]);
|
|
84
|
+
if (!mounted)
|
|
85
|
+
return null;
|
|
86
|
+
return createPortal(_jsxs(_Fragment, { children: [_jsx(Overlay, { isOpen: isOpen, onClick: onClose, "aria-hidden": "true" }), _jsxs(Panel, { isOpen: isOpen, role: "dialog", "aria-modal": "true", className: className, children: [_jsx(HandleBar, {}), _jsxs(Header, { align: "center", justify: "space-between", children: [_jsx(Title, { children: title }), _jsx(Button, { variant: "ghost", size: "sm", onClick: onClose, "aria-label": "Close sheet", children: _jsx(X, { size: 24 }) })] }), _jsx(Content, { children: children })] })] }), document.body);
|
|
87
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Sheet } from './Sheet';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Sheet } from './Sheet';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface SliderProps extends Omit<React.InputHTMLAttributes<HTMLInputElement>, 'onChange'> {
|
|
3
|
+
label?: string;
|
|
4
|
+
showValue?: boolean;
|
|
5
|
+
value?: number;
|
|
6
|
+
defaultValue?: number;
|
|
7
|
+
onChange?: (value: number) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function Slider({ label, showValue, value, defaultValue, onChange, min, max, step, className, ...props }: SliderProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import styled from '@emotion/styled';
|
|
16
|
+
const SliderContainer = styled.div `
|
|
17
|
+
display: flex;
|
|
18
|
+
flex-direction: column;
|
|
19
|
+
gap: 0.75rem;
|
|
20
|
+
width: 100%;
|
|
21
|
+
`;
|
|
22
|
+
const LabelRow = styled.div `
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: space-between;
|
|
25
|
+
align-items: center;
|
|
26
|
+
font-family: var(--font-heading);
|
|
27
|
+
font-weight: 600;
|
|
28
|
+
font-size: var(--text-sm);
|
|
29
|
+
color: var(--foreground);
|
|
30
|
+
`;
|
|
31
|
+
const ValueDisplay = styled.span `
|
|
32
|
+
font-family: var(--font-mono, monospace);
|
|
33
|
+
font-weight: 700;
|
|
34
|
+
color: var(--primary);
|
|
35
|
+
font-size: var(--text-base);
|
|
36
|
+
min-width: 3ch;
|
|
37
|
+
text-align: right;
|
|
38
|
+
`;
|
|
39
|
+
const TrackWrapper = styled.div `
|
|
40
|
+
position: relative;
|
|
41
|
+
width: 100%;
|
|
42
|
+
height: 8px;
|
|
43
|
+
border-radius: 999px;
|
|
44
|
+
background: var(--muted);
|
|
45
|
+
overflow: visible;
|
|
46
|
+
`;
|
|
47
|
+
const ProgressFill = styled.div `
|
|
48
|
+
position: absolute;
|
|
49
|
+
left: 0;
|
|
50
|
+
top: 0;
|
|
51
|
+
height: 100%;
|
|
52
|
+
width: ${props => props.percentage}%;
|
|
53
|
+
background: var(--primary);
|
|
54
|
+
border-radius: 999px;
|
|
55
|
+
z-index: 1;
|
|
56
|
+
`;
|
|
57
|
+
const RangeInput = styled.input `
|
|
58
|
+
-webkit-appearance: none;
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: 0;
|
|
61
|
+
left: 0;
|
|
62
|
+
width: 100%;
|
|
63
|
+
height: 100%;
|
|
64
|
+
background: transparent;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
margin: 0;
|
|
67
|
+
z-index: 10;
|
|
68
|
+
|
|
69
|
+
&::-webkit-slider-runnable-track {
|
|
70
|
+
width: 100%;
|
|
71
|
+
height: 8px;
|
|
72
|
+
background: transparent;
|
|
73
|
+
border: none;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
&::-moz-range-track {
|
|
77
|
+
width: 100%;
|
|
78
|
+
height: 8px;
|
|
79
|
+
background: transparent;
|
|
80
|
+
border: none;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
&::-webkit-slider-thumb {
|
|
84
|
+
-webkit-appearance: none;
|
|
85
|
+
height: 20px;
|
|
86
|
+
width: 20px;
|
|
87
|
+
background: var(--primary);
|
|
88
|
+
border: 3px solid var(--background);
|
|
89
|
+
border-radius: 50%;
|
|
90
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--card-border);
|
|
91
|
+
transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
|
|
92
|
+
margin-top: -6px;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&::-moz-range-thumb {
|
|
96
|
+
height: 20px;
|
|
97
|
+
width: 20px;
|
|
98
|
+
background: var(--primary);
|
|
99
|
+
border: 3px solid var(--background);
|
|
100
|
+
border-radius: 50%;
|
|
101
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2), 0 0 0 1px var(--card-border);
|
|
102
|
+
transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&:hover::-webkit-slider-thumb {
|
|
106
|
+
transform: scale(1.15);
|
|
107
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&:hover::-moz-range-thumb {
|
|
111
|
+
transform: scale(1.15);
|
|
112
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25), 0 0 0 4px color-mix(in srgb, var(--primary) 20%, transparent);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&:active::-webkit-slider-thumb {
|
|
116
|
+
transform: scale(1.05);
|
|
117
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 6px color-mix(in srgb, var(--primary) 25%, transparent);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&:active::-moz-range-thumb {
|
|
121
|
+
transform: scale(1.05);
|
|
122
|
+
box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3), 0 0 0 6px color-mix(in srgb, var(--primary) 25%, transparent);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&:focus {
|
|
126
|
+
outline: none;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
&:focus-visible::-webkit-slider-thumb {
|
|
130
|
+
outline: 2px solid var(--primary);
|
|
131
|
+
outline-offset: 2px;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
&:focus-visible::-moz-range-thumb {
|
|
135
|
+
outline: 2px solid var(--primary);
|
|
136
|
+
outline-offset: 2px;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&:disabled {
|
|
140
|
+
cursor: not-allowed;
|
|
141
|
+
opacity: 0.5;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&:disabled::-webkit-slider-thumb {
|
|
145
|
+
background: var(--muted-foreground);
|
|
146
|
+
cursor: not-allowed;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
&:disabled::-moz-range-thumb {
|
|
150
|
+
background: var(--muted-foreground);
|
|
151
|
+
cursor: not-allowed;
|
|
152
|
+
}
|
|
153
|
+
`;
|
|
154
|
+
export function Slider(_a) {
|
|
155
|
+
var { label, showValue, value, defaultValue, onChange, min = 0, max = 100, step = 1, className } = _a, props = __rest(_a, ["label", "showValue", "value", "defaultValue", "onChange", "min", "max", "step", "className"]);
|
|
156
|
+
const [internalValue, setInternalValue] = React.useState(defaultValue !== undefined ? defaultValue : min);
|
|
157
|
+
const isControlled = value !== undefined;
|
|
158
|
+
const currentValue = isControlled ? value : internalValue;
|
|
159
|
+
const handleChange = (e) => {
|
|
160
|
+
const newVal = Number(e.target.value);
|
|
161
|
+
if (!isControlled) {
|
|
162
|
+
setInternalValue(newVal);
|
|
163
|
+
}
|
|
164
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newVal);
|
|
165
|
+
};
|
|
166
|
+
const percentage = ((currentValue - min) / (max - min)) * 100;
|
|
167
|
+
return (_jsxs(SliderContainer, { className: className, children: [(label || showValue) && (_jsxs(LabelRow, { children: [label && _jsx("span", { children: label }), showValue && _jsx(ValueDisplay, { children: currentValue })] })), _jsxs(TrackWrapper, { children: [_jsx(ProgressFill, { percentage: percentage }), _jsx(RangeInput, Object.assign({ type: "range", min: min, max: max, step: step, value: currentValue, onChange: handleChange, percentage: percentage }, props))] })] }));
|
|
168
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Slider } from './Slider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Slider } from './Slider';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SwitchProps {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
onChange?: (checked: boolean) => void;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
label?: string;
|
|
7
|
+
id?: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
readOnly?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare const Switch: React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import React from 'react';
|
|
15
|
+
import styled from '@emotion/styled';
|
|
16
|
+
const SwitchContainer = styled.label `
|
|
17
|
+
display: inline-flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
gap: 1rem;
|
|
20
|
+
cursor: ${props => props.disabled ? 'not-allowed' : 'pointer'};
|
|
21
|
+
opacity: ${props => props.disabled ? 0.6 : 1};
|
|
22
|
+
user-select: none;
|
|
23
|
+
`;
|
|
24
|
+
const Input = styled.input `
|
|
25
|
+
position: absolute;
|
|
26
|
+
width: 1px;
|
|
27
|
+
height: 1px;
|
|
28
|
+
padding: 0;
|
|
29
|
+
margin: -1px;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
clip: rect(0, 0, 0, 0);
|
|
32
|
+
white-space: nowrap;
|
|
33
|
+
border: 0;
|
|
34
|
+
`;
|
|
35
|
+
const Toggle = styled.div `
|
|
36
|
+
position: relative;
|
|
37
|
+
width: 58px;
|
|
38
|
+
height: 32px;
|
|
39
|
+
background-color: ${props => props.checked ? 'var(--primary)' : 'var(--card-bg)'};
|
|
40
|
+
border: var(--border-width) solid var(--card-border);
|
|
41
|
+
border-radius: var(--radius-pill);
|
|
42
|
+
transition: background-color var(--duration-normal) var(--ease-in-out), transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out);
|
|
43
|
+
box-shadow: var(--shadow-sm);
|
|
44
|
+
box-sizing: border-box;
|
|
45
|
+
|
|
46
|
+
&::after {
|
|
47
|
+
content: '';
|
|
48
|
+
display: block;
|
|
49
|
+
position: absolute;
|
|
50
|
+
top: 50%;
|
|
51
|
+
left: 4px;
|
|
52
|
+
width: 24px;
|
|
53
|
+
height: 24px;
|
|
54
|
+
background-color: ${props => props.checked ? 'var(--primary-foreground)' : 'var(--muted)'};
|
|
55
|
+
border: var(--border-width) solid var(--card-border);
|
|
56
|
+
border-radius: 50%;
|
|
57
|
+
transform: translateY(-50%) translateX(${props => props.checked ? '20px' : '0'});
|
|
58
|
+
transition: transform var(--duration-normal) var(--ease-in-out), background-color var(--duration-normal) var(--ease-in-out);
|
|
59
|
+
box-sizing: border-box;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
`;
|
|
63
|
+
const Label = styled.span `
|
|
64
|
+
font-family: var(--font-heading);
|
|
65
|
+
font-weight: 600;
|
|
66
|
+
color: var(--foreground);
|
|
67
|
+
`;
|
|
68
|
+
export const Switch = React.forwardRef((_a, ref) => {
|
|
69
|
+
var { checked = false, onChange, disabled, label, id, className } = _a, props = __rest(_a, ["checked", "onChange", "disabled", "label", "id", "className"]);
|
|
70
|
+
const handleChange = (e) => {
|
|
71
|
+
if (disabled)
|
|
72
|
+
return;
|
|
73
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(e.target.checked);
|
|
74
|
+
};
|
|
75
|
+
return (_jsxs(SwitchContainer, { disabled: disabled, className: className, children: [_jsx(Input, Object.assign({ type: "checkbox", role: "switch", id: id, ref: ref, checked: checked, onChange: handleChange, disabled: disabled, readOnly: props.readOnly, "aria-checked": checked }, props)), _jsx(Toggle, { checked: checked }), label && _jsx(Label, { children: label })] }));
|
|
76
|
+
});
|
|
77
|
+
Switch.displayName = 'Switch';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Switch';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Switch';
|
|
@@ -4,8 +4,8 @@ import React, { useState } from 'react';
|
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
5
|
import { useReactTable, getCoreRowModel, getSortedRowModel, getPaginationRowModel, getFilteredRowModel, flexRender, } from '@tanstack/react-table';
|
|
6
6
|
import { useVirtualizer } from '@tanstack/react-virtual';
|
|
7
|
-
import {
|
|
8
|
-
|
|
7
|
+
import { Input, Select, Flex } from '../..';
|
|
8
|
+
import { Pagination } from '../Pagination';
|
|
9
9
|
const TableContainer = styled.div `
|
|
10
10
|
width: 100%;
|
|
11
11
|
border: var(--border-width) solid var(--card-border);
|
|
@@ -17,7 +17,7 @@ const TableContainer = styled.div `
|
|
|
17
17
|
flex-direction: column;
|
|
18
18
|
`;
|
|
19
19
|
const Toolbar = styled.div `
|
|
20
|
-
padding:
|
|
20
|
+
padding: var(--spacing-md);
|
|
21
21
|
border-bottom: var(--border-width) solid var(--card-border);
|
|
22
22
|
background: var(--background);
|
|
23
23
|
display: flex;
|
|
@@ -92,7 +92,7 @@ const Tr = styled.tr `
|
|
|
92
92
|
}
|
|
93
93
|
`;
|
|
94
94
|
const PaginationContainer = styled.div `
|
|
95
|
-
padding:
|
|
95
|
+
padding: var(--spacing-md);
|
|
96
96
|
border-top: var(--border-width) solid var(--card-border);
|
|
97
97
|
background: var(--background);
|
|
98
98
|
display: flex;
|
|
@@ -165,12 +165,12 @@ export function Table({ data, columns, enablePagination = true, enableFiltering
|
|
|
165
165
|
height: `${virtualRow.size}px`,
|
|
166
166
|
transform: `translateY(${virtualRow.start}px)`,
|
|
167
167
|
}, children: row.getVisibleCells().map((cell) => (_jsx(Td, { "$density": density, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id));
|
|
168
|
-
}) })) : (_jsx("tbody", { children: table.getRowModel().rows.map((row) => (_jsx(Tr, { className: "group", "$striped": striped, children: row.getVisibleCells().map((cell) => (_jsx(Td, { "$density": density, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))) }))] }), table.getRowModel().rows.length === 0 && (_jsx("div", { style: { padding: '2rem', textAlign: 'center', color: 'var(--muted-foreground)' }, children: "No results found." }))] }), enablePagination && !isVirtual && (
|
|
168
|
+
}) })) : (_jsx("tbody", { children: table.getRowModel().rows.map((row) => (_jsx(Tr, { className: "group", "$striped": striped, children: row.getVisibleCells().map((cell) => (_jsx(Td, { "$density": density, children: flexRender(cell.column.columnDef.cell, cell.getContext()) }, cell.id))) }, row.id))) }))] }), table.getRowModel().rows.length === 0 && (_jsx("div", { style: { padding: '2rem', textAlign: 'center', color: 'var(--muted-foreground)' }, children: "No results found." }))] }), enablePagination && !isVirtual && (_jsx(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) => {
|
|
169
169
|
table.setPageSize(Number(e.target.value));
|
|
170
170
|
}, options: [
|
|
171
171
|
{ value: 10, label: '10 rows' },
|
|
172
172
|
{ value: 20, label: '20 rows' },
|
|
173
173
|
{ value: 50, label: '50 rows' },
|
|
174
174
|
{ value: 100, label: '100 rows' },
|
|
175
|
-
] })
|
|
175
|
+
] }) }), _jsx(Pagination, { currentPage: table.getState().pagination.pageIndex + 1, totalPages: table.getPageCount(), onPageChange: (page) => table.setPageIndex(page - 1) })] }) }))] }));
|
|
176
176
|
}
|
|
@@ -3,19 +3,16 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { createContext, useContext, useState } from 'react';
|
|
4
4
|
import styled from '@emotion/styled';
|
|
5
5
|
import { keyframes } from '@emotion/react';
|
|
6
|
+
import { Flex } from '../Layout';
|
|
6
7
|
const TabsContext = createContext(null);
|
|
7
|
-
// --- Styled Components ---
|
|
8
8
|
const fadeIn = keyframes `
|
|
9
9
|
from { opacity: 0; transform: translateY(5px); }
|
|
10
10
|
to { opacity: 1; transform: translateY(0); }
|
|
11
11
|
`;
|
|
12
|
-
const StyledTabsList = styled
|
|
13
|
-
display: flex;
|
|
14
|
-
gap: 0.5rem;
|
|
12
|
+
const StyledTabsList = styled(Flex) `
|
|
15
13
|
margin-bottom: 0;
|
|
16
|
-
padding-left:
|
|
14
|
+
padding-left: var(--spacing-md);
|
|
17
15
|
position: relative;
|
|
18
|
-
/* z-index is managed by triggers */
|
|
19
16
|
`;
|
|
20
17
|
const StyledTabsTrigger = styled.button `
|
|
21
18
|
padding: 0.75rem 1.5rem;
|
|
@@ -31,7 +28,7 @@ const StyledTabsTrigger = styled.button `
|
|
|
31
28
|
border-radius: var(--radius) var(--radius) 0 0;
|
|
32
29
|
cursor: pointer;
|
|
33
30
|
position: relative;
|
|
34
|
-
z-index: ${props => props.isActive ? 'var(--z-elevated)' : 1};
|
|
31
|
+
z-index: ${props => props.isActive ? 'var(--z-elevated)' : '1'};
|
|
35
32
|
transition: all 0.2s ease;
|
|
36
33
|
transform: ${props => props.isActive ? 'translateY(0)' : 'translateY(4px)'};
|
|
37
34
|
|
|
@@ -49,7 +46,7 @@ const StyledTabsBody = styled.div `
|
|
|
49
46
|
padding: 2.5rem;
|
|
50
47
|
box-shadow: var(--shadow-hard);
|
|
51
48
|
position: relative;
|
|
52
|
-
z-index:
|
|
49
|
+
z-index: var(--z-elevated);
|
|
53
50
|
min-height: 600px;
|
|
54
51
|
margin-top: -3px;
|
|
55
52
|
`;
|
|
@@ -69,7 +66,7 @@ export function Tabs({ defaultValue, value, onValueChange, children, className }
|
|
|
69
66
|
return (_jsx(TabsContext.Provider, { value: { activeTab, setActiveTab }, children: _jsx("div", { className: className, children: children }) }));
|
|
70
67
|
}
|
|
71
68
|
export function TabsList({ children, className }) {
|
|
72
|
-
return _jsx(StyledTabsList, { className: className, children: children });
|
|
69
|
+
return _jsx(StyledTabsList, { gap: "0.5rem", className: className, children: children });
|
|
73
70
|
}
|
|
74
71
|
export function TabsTrigger({ value, children, className, onClick }) {
|
|
75
72
|
const context = useContext(TabsContext);
|