@hamsterbase/ui 0.0.0-stage → 0.1.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/Button/Button.d.ts +7 -0
- package/dist/components/Button/styles.d.ts +14 -0
- package/dist/components/Checkbox/Checkbox.d.ts +5 -0
- package/dist/components/Checkbox/styles.d.ts +7 -0
- package/dist/components/Divider/Divider.d.ts +9 -0
- package/dist/components/Divider/styles.d.ts +7 -0
- package/dist/components/IconButton/IconButton.d.ts +11 -0
- package/dist/components/IconButton/styles.d.ts +12 -0
- package/dist/components/ResizeHandle/ResizeHandle.d.ts +14 -0
- package/dist/components/ResizeHandle/styles.d.ts +9 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +239 -0
- package/dist/styles.css +785 -0
- package/docs/Button.md +6 -0
- package/docs/Checkbox.md +5 -0
- package/docs/Divider.md +11 -0
- package/docs/IconButton.md +7 -0
- package/docs/ResizeHandle.md +18 -0
- package/docs/index.md +18 -0
- package/package.json +47 -3
- package/README.md +0 -3
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { buttonStyles } from './styles.js';
|
|
3
|
+
export interface ButtonProps extends ComponentPropsWithRef<'button'> {
|
|
4
|
+
variant?: keyof typeof buttonStyles.variants;
|
|
5
|
+
size?: keyof typeof buttonStyles.sizes;
|
|
6
|
+
}
|
|
7
|
+
export declare function Button({ variant, size, type, className, ...props }: ButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare const buttonStyles: {
|
|
2
|
+
readonly base: string;
|
|
3
|
+
readonly variants: {
|
|
4
|
+
readonly primary: "border-transparent bg-hub-primary-solid text-hub-primary-contrast enabled:hover:bg-hub-primary-solid/90";
|
|
5
|
+
readonly secondary: "border-hub-border bg-hub-bg-panel text-hub-fg enabled:hover:bg-hub-bg-muted";
|
|
6
|
+
readonly ghost: "border-transparent bg-transparent text-hub-fg enabled:hover:bg-hub-bg-muted";
|
|
7
|
+
readonly danger: "border-transparent bg-hub-error-solid text-hub-error-contrast enabled:hover:bg-hub-error-solid/90";
|
|
8
|
+
};
|
|
9
|
+
readonly sizes: {
|
|
10
|
+
readonly sm: "h-6 px-2.5 text-hub-sm";
|
|
11
|
+
readonly md: "h-7 px-3 text-hub-md";
|
|
12
|
+
readonly lg: "h-8 px-4 text-hub-md";
|
|
13
|
+
};
|
|
14
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type InputHTMLAttributes } from 'react';
|
|
2
|
+
export interface CheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> {
|
|
3
|
+
readonly indeterminate?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const Checkbox: import("react").ForwardRefExoticComponent<CheckboxProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const checkboxStyles: {
|
|
2
|
+
readonly Root: "group/checkbox relative inline-flex size-3.5 flex-none align-middle";
|
|
3
|
+
readonly Input: string;
|
|
4
|
+
readonly Surface: string;
|
|
5
|
+
readonly Check: "hidden [grid-area:1/1] group-has-[:checked:not(:indeterminate)]/checkbox:block";
|
|
6
|
+
readonly Mixed: "hidden [grid-area:1/1] group-has-[:indeterminate]/checkbox:block";
|
|
7
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
export interface DividerProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'children'> {
|
|
3
|
+
readonly orientation?: 'horizontal' | 'vertical';
|
|
4
|
+
readonly tone?: 'default' | 'subtle';
|
|
5
|
+
readonly edge?: 'top' | 'bottom' | 'left' | 'right';
|
|
6
|
+
readonly inset?: number;
|
|
7
|
+
readonly length?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const Divider: import("react").ForwardRefExoticComponent<DividerProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
import { iconButtonStyles } from './styles.js';
|
|
3
|
+
export type IconButtonSize = keyof typeof iconButtonStyles.sizes;
|
|
4
|
+
export type IconButtonVariant = keyof typeof iconButtonStyles.variants;
|
|
5
|
+
export interface IconButtonProps extends Omit<ComponentPropsWithRef<'button'>, 'aria-label' | 'aria-pressed'> {
|
|
6
|
+
'aria-label': string;
|
|
7
|
+
pressed?: boolean;
|
|
8
|
+
size?: IconButtonSize;
|
|
9
|
+
variant?: IconButtonVariant;
|
|
10
|
+
}
|
|
11
|
+
export declare function IconButton({ className, size, type, variant, pressed, ...props }: IconButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const iconButtonStyles: {
|
|
2
|
+
readonly base: string;
|
|
3
|
+
readonly sizes: {
|
|
4
|
+
readonly sm: "size-6 [&_svg]:size-3.5";
|
|
5
|
+
readonly md: "size-7 [&_svg]:size-3.5";
|
|
6
|
+
readonly lg: "size-8 [&_svg]:size-4";
|
|
7
|
+
};
|
|
8
|
+
readonly variants: {
|
|
9
|
+
readonly primary: string;
|
|
10
|
+
readonly secondary: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type HTMLAttributes } from 'react';
|
|
2
|
+
export interface ResizeHandleProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onChange' | 'defaultValue' | 'onDoubleClick' | 'onKeyDown' | 'onPointerEnter' | 'onPointerDown' | 'onPointerMove' | 'onPointerUp' | 'onLostPointerCapture' | 'onPointerCancel'> {
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly controls: string;
|
|
5
|
+
readonly value: number;
|
|
6
|
+
readonly min: number;
|
|
7
|
+
readonly max: number;
|
|
8
|
+
readonly defaultValue?: number;
|
|
9
|
+
readonly showDivider?: boolean;
|
|
10
|
+
readonly inset?: number;
|
|
11
|
+
readonly edge?: 'left' | 'right';
|
|
12
|
+
readonly onChange: (value: number) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const ResizeHandle: import("react").ForwardRefExoticComponent<ResizeHandleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const resizeHandleStyles: {
|
|
2
|
+
readonly Root: string;
|
|
3
|
+
readonly left: "left-[-3.5px]";
|
|
4
|
+
readonly right: "right-[-3.5px]";
|
|
5
|
+
readonly Line: "pointer-events-none absolute inset-y-0 left-[3px]";
|
|
6
|
+
readonly Feedback: string;
|
|
7
|
+
readonly Gradient: string;
|
|
8
|
+
readonly DragShield: "fixed inset-0 z-40 cursor-col-resize";
|
|
9
|
+
};
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Button } from './components/Button/Button.js';
|
|
2
|
+
export type { ButtonProps } from './components/Button/Button.js';
|
|
3
|
+
export { IconButton } from './components/IconButton/IconButton.js';
|
|
4
|
+
export type { IconButtonProps, IconButtonSize, IconButtonVariant } from './components/IconButton/IconButton.js';
|
|
5
|
+
export { Checkbox } from './components/Checkbox/Checkbox.js';
|
|
6
|
+
export type { CheckboxProps } from './components/Checkbox/Checkbox.js';
|
|
7
|
+
export { Divider } from './components/Divider/Divider.js';
|
|
8
|
+
export type { DividerProps } from './components/Divider/Divider.js';
|
|
9
|
+
export { ResizeHandle } from './components/ResizeHandle/ResizeHandle.js';
|
|
10
|
+
export type { ResizeHandleProps } from './components/ResizeHandle/ResizeHandle.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { clsx } from "clsx/lite";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef, useImperativeHandle, useLayoutEffect, useRef, useState } from "react";
|
|
4
|
+
import { Check, Minus } from "lucide-react";
|
|
5
|
+
// src/components/Button/styles.ts
|
|
6
|
+
var buttonStyles = {
|
|
7
|
+
base: clsx("inline-flex items-center justify-center gap-1.5", "select-none whitespace-nowrap border rounded-full", "font-sans font-medium leading-4", "transition-colors duration-150 motion-reduce:transition-none", "focus-visible:outline-2 focus-visible:outline-solid focus-visible:outline-offset-2 focus-visible:outline-hub-focus-ring", "disabled:cursor-not-allowed disabled:opacity-50"),
|
|
8
|
+
variants: {
|
|
9
|
+
primary: "border-transparent bg-hub-primary-solid text-hub-primary-contrast enabled:hover:bg-hub-primary-solid/90",
|
|
10
|
+
secondary: "border-hub-border bg-hub-bg-panel text-hub-fg enabled:hover:bg-hub-bg-muted",
|
|
11
|
+
ghost: "border-transparent bg-transparent text-hub-fg enabled:hover:bg-hub-bg-muted",
|
|
12
|
+
danger: "border-transparent bg-hub-error-solid text-hub-error-contrast enabled:hover:bg-hub-error-solid/90"
|
|
13
|
+
},
|
|
14
|
+
sizes: {
|
|
15
|
+
sm: "h-6 px-2.5 text-hub-sm",
|
|
16
|
+
md: "h-7 px-3 text-hub-md",
|
|
17
|
+
lg: "h-8 px-4 text-hub-md"
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
// src/components/Button/Button.tsx
|
|
21
|
+
function Button({ variant = "primary", size = "md", type = "button", className, ...props }) {
|
|
22
|
+
return /* @__PURE__ */ jsx("button", {
|
|
23
|
+
...props,
|
|
24
|
+
type,
|
|
25
|
+
className: clsx(buttonStyles.base, buttonStyles.variants[variant], buttonStyles.sizes[size], className)
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
// src/components/IconButton/styles.ts
|
|
29
|
+
var iconButtonStyles = {
|
|
30
|
+
base: clsx("inline-grid flex-none select-none place-items-center rounded-full border-0", "transition-colors duration-100 motion-reduce:transition-none", "focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-hub-focus-ring", "disabled:cursor-not-allowed disabled:opacity-50", "aria-pressed:bg-hub-bg-muted aria-pressed:text-hub-fg", "aria-pressed:enabled:hover:bg-hub-bg-emphasized aria-pressed:enabled:active:bg-hub-bg-emphasized"),
|
|
31
|
+
sizes: {
|
|
32
|
+
sm: "size-6 [&_svg]:size-3.5",
|
|
33
|
+
md: "size-7 [&_svg]:size-3.5",
|
|
34
|
+
lg: "size-8 [&_svg]:size-4"
|
|
35
|
+
},
|
|
36
|
+
variants: {
|
|
37
|
+
primary: clsx("bg-hub-bg-panel text-hub-fg shadow-hub-sm", "enabled:hover:bg-hub-bg-muted enabled:active:bg-hub-bg-emphasized"),
|
|
38
|
+
secondary: clsx("bg-transparent text-hub-fg-muted", "enabled:hover:bg-hub-bg-muted enabled:hover:text-hub-fg enabled:active:bg-hub-bg-muted")
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
// src/components/IconButton/IconButton.tsx
|
|
42
|
+
function IconButton({ className, size = "md", type = "button", variant = "primary", pressed, ...props }) {
|
|
43
|
+
return /* @__PURE__ */ jsx("button", {
|
|
44
|
+
...props,
|
|
45
|
+
type,
|
|
46
|
+
"aria-pressed": pressed,
|
|
47
|
+
className: clsx(iconButtonStyles.base, iconButtonStyles.sizes[size], iconButtonStyles.variants[variant], className)
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
// src/components/Checkbox/styles.ts
|
|
51
|
+
var checkboxStyles = {
|
|
52
|
+
Root: "group/checkbox relative inline-flex size-3.5 flex-none align-middle",
|
|
53
|
+
Input: clsx("peer absolute inset-0 z-10 m-0 size-full cursor-pointer opacity-0", "disabled:cursor-default"),
|
|
54
|
+
Surface: clsx("pointer-events-none box-border grid size-full place-items-center rounded-[3px] border", "border-hub-border-strong bg-transparent text-hub-primary-contrast", "transition-colors duration-[80ms] ease-out motion-reduce:transition-none", "peer-checked:border-hub-primary-solid peer-checked:bg-hub-primary-solid", "peer-indeterminate:border-hub-primary-solid peer-indeterminate:bg-hub-primary-solid", "peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-hub-focus-ring", "peer-disabled:opacity-40"),
|
|
55
|
+
Check: "hidden [grid-area:1/1] group-has-[:checked:not(:indeterminate)]/checkbox:block",
|
|
56
|
+
Mixed: "hidden [grid-area:1/1] group-has-[:indeterminate]/checkbox:block"
|
|
57
|
+
};
|
|
58
|
+
// src/components/Checkbox/Checkbox.tsx
|
|
59
|
+
var Checkbox = forwardRef(function Checkbox({ indeterminate = false, className, ...props }, ref) {
|
|
60
|
+
const input = useRef(null);
|
|
61
|
+
useImperativeHandle(ref, () => input.current, []);
|
|
62
|
+
useLayoutEffect(() => {
|
|
63
|
+
if (input.current) input.current.indeterminate = indeterminate;
|
|
64
|
+
}, [indeterminate]);
|
|
65
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
66
|
+
className: clsx(checkboxStyles.Root, className),
|
|
67
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
68
|
+
...props,
|
|
69
|
+
ref: input,
|
|
70
|
+
type: "checkbox",
|
|
71
|
+
className: checkboxStyles.Input
|
|
72
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
73
|
+
className: checkboxStyles.Surface,
|
|
74
|
+
"aria-hidden": "true",
|
|
75
|
+
children: [/* @__PURE__ */ jsx(Check, {
|
|
76
|
+
className: checkboxStyles.Check,
|
|
77
|
+
size: 12,
|
|
78
|
+
strokeWidth: 2.5
|
|
79
|
+
}), /* @__PURE__ */ jsx(Minus, {
|
|
80
|
+
className: checkboxStyles.Mixed,
|
|
81
|
+
size: 12,
|
|
82
|
+
strokeWidth: 2.5
|
|
83
|
+
})]
|
|
84
|
+
})]
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
// src/components/Divider/styles.ts
|
|
88
|
+
var dividerStyles = {
|
|
89
|
+
Root: "pointer-events-none block flex-none",
|
|
90
|
+
horizontal: "h-[0.5px] w-full",
|
|
91
|
+
vertical: "w-[0.5px] self-stretch",
|
|
92
|
+
default: "bg-hub-border",
|
|
93
|
+
subtle: "bg-hub-border/50"
|
|
94
|
+
};
|
|
95
|
+
// src/components/Divider/Divider.tsx
|
|
96
|
+
var Divider = forwardRef(function Divider({ orientation = "horizontal", tone = "default", edge, inset = 0, length, className, style, ...props }, ref) {
|
|
97
|
+
const direction = edge ? edge === "left" || edge === "right" ? "vertical" : "horizontal" : orientation;
|
|
98
|
+
const horizontal = direction === "horizontal";
|
|
99
|
+
const geometry = edge ? {
|
|
100
|
+
[edge]: 0,
|
|
101
|
+
...horizontal ? {
|
|
102
|
+
left: inset,
|
|
103
|
+
right: inset,
|
|
104
|
+
width: length ?? "auto"
|
|
105
|
+
} : {
|
|
106
|
+
top: inset,
|
|
107
|
+
bottom: inset,
|
|
108
|
+
height: length
|
|
109
|
+
}
|
|
110
|
+
} : {
|
|
111
|
+
...horizontal ? {
|
|
112
|
+
marginInline: inset,
|
|
113
|
+
width: length ?? (inset ? `calc(100% - ${inset * 2}px)` : void 0)
|
|
114
|
+
} : {
|
|
115
|
+
marginBlock: inset,
|
|
116
|
+
height: length
|
|
117
|
+
},
|
|
118
|
+
...length === void 0 ? {} : { alignSelf: "center" }
|
|
119
|
+
};
|
|
120
|
+
return /* @__PURE__ */ jsx("span", {
|
|
121
|
+
...props,
|
|
122
|
+
ref,
|
|
123
|
+
"aria-hidden": "true",
|
|
124
|
+
"data-divider": "",
|
|
125
|
+
"data-orientation": direction,
|
|
126
|
+
"data-tone": tone,
|
|
127
|
+
"data-edge": edge,
|
|
128
|
+
className: clsx(dividerStyles.Root, dividerStyles[direction], dividerStyles[tone], edge && "absolute", className),
|
|
129
|
+
style: {
|
|
130
|
+
...geometry,
|
|
131
|
+
...style
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
// src/components/ResizeHandle/styles.ts
|
|
136
|
+
var line = "pointer-events-none absolute inset-y-0 left-[3px]";
|
|
137
|
+
var resizeHandleStyles = {
|
|
138
|
+
Root: clsx("group/resize absolute z-10 w-[7px] touch-none select-none cursor-col-resize outline-none"),
|
|
139
|
+
left: "left-[-3.5px]",
|
|
140
|
+
right: "right-[-3.5px]",
|
|
141
|
+
Line: line,
|
|
142
|
+
Feedback: clsx(line, "w-px origin-left scale-x-50 overflow-hidden bg-hub-border opacity-0", "[mask-image:linear-gradient(transparent,black_10%,black_90%,transparent)]", "transition-opacity duration-250 ease-in-out motion-reduce:transition-none", "group-hover/resize:opacity-100 group-data-[dragging=true]/resize:opacity-100", "group-focus-visible/resize:opacity-100"),
|
|
143
|
+
Gradient: clsx("absolute -top-1/2 left-0 h-[200%] w-full bg-hub-fg", "[mask-image:linear-gradient(transparent_5%,black_40%,black_60%,transparent_95%)]"),
|
|
144
|
+
DragShield: "fixed inset-0 z-40 cursor-col-resize"
|
|
145
|
+
};
|
|
146
|
+
// src/components/ResizeHandle/ResizeHandle.tsx
|
|
147
|
+
var ResizeHandle = forwardRef(function ResizeHandle({ label, controls, value, min, max, defaultValue, showDivider = true, inset = 0, edge = "right", onChange, className, style, ...props }, ref) {
|
|
148
|
+
const sign = edge === "right" ? 1 : -1;
|
|
149
|
+
const drag = useRef(void 0);
|
|
150
|
+
const feedback = useRef(null);
|
|
151
|
+
const trackPointer = (event) => {
|
|
152
|
+
const rect = event.currentTarget.getBoundingClientRect();
|
|
153
|
+
if (feedback.current) feedback.current.style.transform = `translateY(${event.clientY - rect.top - rect.height / 2}px)`;
|
|
154
|
+
};
|
|
155
|
+
const [dragging, setDragging] = useState(false);
|
|
156
|
+
const resize = (width) => onChange(Math.max(min, Math.min(max, width)));
|
|
157
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
158
|
+
...props,
|
|
159
|
+
ref,
|
|
160
|
+
role: "separator",
|
|
161
|
+
"aria-label": label,
|
|
162
|
+
"aria-controls": controls,
|
|
163
|
+
"aria-orientation": "vertical",
|
|
164
|
+
"aria-valuemin": min,
|
|
165
|
+
"aria-valuemax": max,
|
|
166
|
+
"aria-valuenow": value,
|
|
167
|
+
tabIndex: 0,
|
|
168
|
+
className: clsx(resizeHandleStyles.Root, resizeHandleStyles[edge], className),
|
|
169
|
+
style: {
|
|
170
|
+
insetBlock: inset,
|
|
171
|
+
...style
|
|
172
|
+
},
|
|
173
|
+
"data-resize-handle": true,
|
|
174
|
+
"data-dragging": dragging,
|
|
175
|
+
onDoubleClick: () => {
|
|
176
|
+
if (defaultValue !== void 0) resize(defaultValue);
|
|
177
|
+
},
|
|
178
|
+
onKeyDown: (event) => {
|
|
179
|
+
const width = event.key === "Home" ? min : event.key === "End" ? max : void 0;
|
|
180
|
+
if (width === void 0) return;
|
|
181
|
+
event.preventDefault();
|
|
182
|
+
event.stopPropagation();
|
|
183
|
+
resize(width);
|
|
184
|
+
},
|
|
185
|
+
onPointerEnter: trackPointer,
|
|
186
|
+
onPointerDown: (event) => {
|
|
187
|
+
if (event.button !== 0 || !event.isPrimary || drag.current) return;
|
|
188
|
+
event.preventDefault();
|
|
189
|
+
trackPointer(event);
|
|
190
|
+
event.currentTarget.focus();
|
|
191
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
192
|
+
drag.current = {
|
|
193
|
+
pointerId: event.pointerId,
|
|
194
|
+
x: event.clientX,
|
|
195
|
+
width: value
|
|
196
|
+
};
|
|
197
|
+
setDragging(true);
|
|
198
|
+
},
|
|
199
|
+
onPointerMove: (event) => {
|
|
200
|
+
trackPointer(event);
|
|
201
|
+
const current = drag.current;
|
|
202
|
+
if (current?.pointerId !== event.pointerId) return;
|
|
203
|
+
resize(current.width + (event.clientX - current.x) * sign);
|
|
204
|
+
},
|
|
205
|
+
onPointerUp: (event) => {
|
|
206
|
+
if (drag.current?.pointerId !== event.pointerId) return;
|
|
207
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) event.currentTarget.releasePointerCapture(event.pointerId);
|
|
208
|
+
drag.current = void 0;
|
|
209
|
+
setDragging(false);
|
|
210
|
+
},
|
|
211
|
+
onLostPointerCapture: () => {
|
|
212
|
+
drag.current = void 0;
|
|
213
|
+
setDragging(false);
|
|
214
|
+
},
|
|
215
|
+
onPointerCancel: () => {
|
|
216
|
+
drag.current = void 0;
|
|
217
|
+
setDragging(false);
|
|
218
|
+
},
|
|
219
|
+
children: [
|
|
220
|
+
showDivider && /* @__PURE__ */ jsx(Divider, {
|
|
221
|
+
orientation: "vertical",
|
|
222
|
+
className: resizeHandleStyles.Line
|
|
223
|
+
}),
|
|
224
|
+
/* @__PURE__ */ jsx("span", {
|
|
225
|
+
"aria-hidden": true,
|
|
226
|
+
className: resizeHandleStyles.Feedback,
|
|
227
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
228
|
+
ref: feedback,
|
|
229
|
+
className: resizeHandleStyles.Gradient
|
|
230
|
+
})
|
|
231
|
+
}),
|
|
232
|
+
dragging ? /* @__PURE__ */ jsx("div", {
|
|
233
|
+
"aria-hidden": true,
|
|
234
|
+
className: resizeHandleStyles.DragShield
|
|
235
|
+
}) : null
|
|
236
|
+
]
|
|
237
|
+
});
|
|
238
|
+
});
|
|
239
|
+
export { Button, Checkbox, Divider, IconButton, ResizeHandle };
|
package/dist/styles.css
ADDED
|
@@ -0,0 +1,785 @@
|
|
|
1
|
+
/*! tailwindcss v4.3.4 | MIT License | https://tailwindcss.com */
|
|
2
|
+
@layer properties {
|
|
3
|
+
@supports (((-webkit-hyphens: none)) and (not (margin-trim: block))) or ((-moz-orient: inline) and (not (color: rgb(from red r g b)))) {
|
|
4
|
+
*, :before, :after, ::backdrop {
|
|
5
|
+
--tw-scale-x: 1;
|
|
6
|
+
--tw-scale-y: 1;
|
|
7
|
+
--tw-scale-z: 1;
|
|
8
|
+
--tw-rotate-x: initial;
|
|
9
|
+
--tw-rotate-y: initial;
|
|
10
|
+
--tw-rotate-z: initial;
|
|
11
|
+
--tw-skew-x: initial;
|
|
12
|
+
--tw-skew-y: initial;
|
|
13
|
+
--tw-border-style: solid;
|
|
14
|
+
--tw-leading: initial;
|
|
15
|
+
--tw-font-weight: initial;
|
|
16
|
+
--tw-shadow: 0 0 #0000;
|
|
17
|
+
--tw-shadow-color: initial;
|
|
18
|
+
--tw-shadow-alpha: 100%;
|
|
19
|
+
--tw-inset-shadow: 0 0 #0000;
|
|
20
|
+
--tw-inset-shadow-color: initial;
|
|
21
|
+
--tw-inset-shadow-alpha: 100%;
|
|
22
|
+
--tw-ring-color: initial;
|
|
23
|
+
--tw-ring-shadow: 0 0 #0000;
|
|
24
|
+
--tw-inset-ring-color: initial;
|
|
25
|
+
--tw-inset-ring-shadow: 0 0 #0000;
|
|
26
|
+
--tw-ring-inset: initial;
|
|
27
|
+
--tw-ring-offset-width: 0px;
|
|
28
|
+
--tw-ring-offset-color: #fff;
|
|
29
|
+
--tw-ring-offset-shadow: 0 0 #0000;
|
|
30
|
+
--tw-duration: initial;
|
|
31
|
+
--tw-ease: initial;
|
|
32
|
+
--tw-outline-style: solid;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@layer theme {
|
|
38
|
+
:root, :host {
|
|
39
|
+
--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", Arial,
|
|
40
|
+
sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
|
|
41
|
+
--spacing: .25rem;
|
|
42
|
+
--font-weight-medium: 500;
|
|
43
|
+
--ease-out: cubic-bezier(0, 0, .2, 1);
|
|
44
|
+
--ease-in-out: cubic-bezier(.4, 0, .2, 1);
|
|
45
|
+
--default-transition-duration: .15s;
|
|
46
|
+
--default-transition-timing-function: cubic-bezier(.4, 0, .2, 1);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@layer base, components;
|
|
51
|
+
|
|
52
|
+
@layer utilities {
|
|
53
|
+
.pointer-events-none {
|
|
54
|
+
pointer-events: none;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.absolute {
|
|
58
|
+
position: absolute;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.fixed {
|
|
62
|
+
position: fixed;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.relative {
|
|
66
|
+
position: relative;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.inset-0 {
|
|
70
|
+
inset: 0;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.inset-y-0 {
|
|
74
|
+
inset-block: 0;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.-top-1\/2 {
|
|
78
|
+
top: -50%;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.right-\[-3\.5px\] {
|
|
82
|
+
right: -3.5px;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.left-0 {
|
|
86
|
+
left: 0;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.left-\[-3\.5px\] {
|
|
90
|
+
left: -3.5px;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
.left-\[3px\] {
|
|
94
|
+
left: 3px;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.z-10 {
|
|
98
|
+
z-index: 10;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.z-40 {
|
|
102
|
+
z-index: 40;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.m-0 {
|
|
106
|
+
margin: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.box-border {
|
|
110
|
+
box-sizing: border-box;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.block {
|
|
114
|
+
display: block;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.grid {
|
|
118
|
+
display: grid;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.hidden {
|
|
122
|
+
display: none;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.inline-flex {
|
|
126
|
+
display: inline-flex;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.inline-grid {
|
|
130
|
+
display: inline-grid;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.size-3\.5 {
|
|
134
|
+
width: calc(var(--spacing) * 3.5);
|
|
135
|
+
height: calc(var(--spacing) * 3.5);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.size-6 {
|
|
139
|
+
width: calc(var(--spacing) * 6);
|
|
140
|
+
height: calc(var(--spacing) * 6);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.size-7 {
|
|
144
|
+
width: calc(var(--spacing) * 7);
|
|
145
|
+
height: calc(var(--spacing) * 7);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.size-8 {
|
|
149
|
+
width: calc(var(--spacing) * 8);
|
|
150
|
+
height: calc(var(--spacing) * 8);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.size-full {
|
|
154
|
+
width: 100%;
|
|
155
|
+
height: 100%;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.h-6 {
|
|
159
|
+
height: calc(var(--spacing) * 6);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.h-7 {
|
|
163
|
+
height: calc(var(--spacing) * 7);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
.h-8 {
|
|
167
|
+
height: calc(var(--spacing) * 8);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.h-\[0\.5px\] {
|
|
171
|
+
height: .5px;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.h-\[200\%\] {
|
|
175
|
+
height: 200%;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.w-\[0\.5px\] {
|
|
179
|
+
width: .5px;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.w-\[7px\] {
|
|
183
|
+
width: 7px;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
.w-full {
|
|
187
|
+
width: 100%;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
.w-px {
|
|
191
|
+
width: 1px;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
.flex-none {
|
|
195
|
+
flex: none;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.origin-left {
|
|
199
|
+
transform-origin: 0;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.scale-x-50 {
|
|
203
|
+
--tw-scale-x: 50%;
|
|
204
|
+
scale: var(--tw-scale-x) var(--tw-scale-y);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
.transform {
|
|
208
|
+
transform: var(--tw-rotate-x, ) var(--tw-rotate-y, ) var(--tw-rotate-z, ) var(--tw-skew-x, ) var(--tw-skew-y, );
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
.cursor-col-resize {
|
|
212
|
+
cursor: col-resize;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
.cursor-pointer {
|
|
216
|
+
cursor: pointer;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.touch-none {
|
|
220
|
+
touch-action: none;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
.resize {
|
|
224
|
+
resize: both;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.place-items-center {
|
|
228
|
+
place-items: center;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
.items-center {
|
|
232
|
+
align-items: center;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
.justify-center {
|
|
236
|
+
justify-content: center;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.gap-1\.5 {
|
|
240
|
+
gap: calc(var(--spacing) * 1.5);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
.self-stretch {
|
|
244
|
+
align-self: stretch;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.overflow-hidden {
|
|
248
|
+
overflow: hidden;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.rounded-\[3px\] {
|
|
252
|
+
border-radius: 3px;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
.rounded-full {
|
|
256
|
+
border-radius: 2147483647px;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.border {
|
|
260
|
+
border-style: var(--tw-border-style);
|
|
261
|
+
border-width: 1px;
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
.border-0 {
|
|
265
|
+
border-style: var(--tw-border-style);
|
|
266
|
+
border-width: 0;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.border-hub-border {
|
|
270
|
+
border-color: var(--hub-border);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.border-hub-border-strong {
|
|
274
|
+
border-color: var(--hub-border-strong);
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.border-transparent {
|
|
278
|
+
border-color: #0000;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
.bg-hub-bg-panel {
|
|
282
|
+
background-color: var(--hub-bg-panel);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.bg-hub-border, .bg-hub-border\/50 {
|
|
286
|
+
background-color: var(--hub-border);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
290
|
+
.bg-hub-border\/50 {
|
|
291
|
+
background-color: color-mix(in oklab, var(--hub-border) 50%, transparent);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.bg-hub-error-solid {
|
|
296
|
+
background-color: var(--hub-error-solid);
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
.bg-hub-fg {
|
|
300
|
+
background-color: var(--hub-fg);
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.bg-hub-primary-solid {
|
|
304
|
+
background-color: var(--hub-primary-solid);
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.bg-transparent {
|
|
308
|
+
background-color: #0000;
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
.\[mask-image\:linear-gradient\(transparent\,black_10\%\,black_90\%\,transparent\)\] {
|
|
312
|
+
-webkit-mask-image: linear-gradient(#0000, #000 10% 90%, #0000);
|
|
313
|
+
mask-image: linear-gradient(#0000, #000 10% 90%, #0000);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
.\[mask-image\:linear-gradient\(transparent_5\%\,black_40\%\,black_60\%\,transparent_95\%\)\] {
|
|
317
|
+
-webkit-mask-image: linear-gradient(#0000 5%, #000 40% 60%, #0000 95%);
|
|
318
|
+
mask-image: linear-gradient(#0000 5%, #000 40% 60%, #0000 95%);
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.px-2\.5 {
|
|
322
|
+
padding-inline: calc(var(--spacing) * 2.5);
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.px-3 {
|
|
326
|
+
padding-inline: calc(var(--spacing) * 3);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.px-4 {
|
|
330
|
+
padding-inline: calc(var(--spacing) * 4);
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.align-middle {
|
|
334
|
+
vertical-align: middle;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.font-sans {
|
|
338
|
+
font-family: var(--font-sans);
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
.text-hub-md {
|
|
342
|
+
font-size: var(--hub-font-size-md);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.text-hub-sm {
|
|
346
|
+
font-size: var(--hub-font-size-sm);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
.leading-4 {
|
|
350
|
+
--tw-leading: calc(var(--spacing) * 4);
|
|
351
|
+
line-height: calc(var(--spacing) * 4);
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.font-medium {
|
|
355
|
+
--tw-font-weight: var(--font-weight-medium);
|
|
356
|
+
font-weight: var(--font-weight-medium);
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.whitespace-nowrap {
|
|
360
|
+
white-space: nowrap;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.text-hub-error-contrast {
|
|
364
|
+
color: var(--hub-error-contrast);
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.text-hub-fg {
|
|
368
|
+
color: var(--hub-fg);
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
.text-hub-fg-muted {
|
|
372
|
+
color: var(--hub-fg-muted);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.text-hub-primary-contrast {
|
|
376
|
+
color: var(--hub-primary-contrast);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
.opacity-0 {
|
|
380
|
+
opacity: 0;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.shadow-hub-sm {
|
|
384
|
+
--tw-shadow: var(--hub-shadow-sm);
|
|
385
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.transition-colors {
|
|
389
|
+
transition-property: color, background-color, border-color, outline-color, text-decoration-color, fill, stroke, --tw-gradient-from, --tw-gradient-via, --tw-gradient-to;
|
|
390
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
391
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
.transition-opacity {
|
|
395
|
+
transition-property: opacity;
|
|
396
|
+
transition-timing-function: var(--tw-ease, var(--default-transition-timing-function));
|
|
397
|
+
transition-duration: var(--tw-duration, var(--default-transition-duration));
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.duration-100 {
|
|
401
|
+
--tw-duration: .1s;
|
|
402
|
+
transition-duration: .1s;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
.duration-150 {
|
|
406
|
+
--tw-duration: .15s;
|
|
407
|
+
transition-duration: .15s;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
.duration-250 {
|
|
411
|
+
--tw-duration: .25s;
|
|
412
|
+
transition-duration: .25s;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.duration-\[80ms\] {
|
|
416
|
+
--tw-duration: 80ms;
|
|
417
|
+
transition-duration: 80ms;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.ease-in-out {
|
|
421
|
+
--tw-ease: var(--ease-in-out);
|
|
422
|
+
transition-timing-function: var(--ease-in-out);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.ease-out {
|
|
426
|
+
--tw-ease: var(--ease-out);
|
|
427
|
+
transition-timing-function: var(--ease-out);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.outline-none {
|
|
431
|
+
--tw-outline-style: none;
|
|
432
|
+
outline-style: none;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
.select-none {
|
|
436
|
+
-webkit-user-select: none;
|
|
437
|
+
user-select: none;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
.\[grid-area\:1\/1\] {
|
|
441
|
+
grid-area: 1 / 1;
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
@media (hover: hover) {
|
|
445
|
+
:is(:where(.group\/resize):hover .group-hover\/resize\:opacity-100) {
|
|
446
|
+
opacity: 1;
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
:is(:where(.group\/resize):focus-visible .group-focus-visible\/resize\:opacity-100) {
|
|
451
|
+
opacity: 1;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
:is(:where(.group\/checkbox):has(:checked:not(:indeterminate)) .group-has-\[\:checked\:not\(\:indeterminate\)\]\/checkbox\:block), :is(:where(.group\/checkbox):has(:indeterminate) .group-has-\[\:indeterminate\]\/checkbox\:block) {
|
|
455
|
+
display: block;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
:is(:where(.group\/resize)[data-dragging="true"] .group-data-\[dragging\=true\]\/resize\:opacity-100) {
|
|
459
|
+
opacity: 1;
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
:is(:where(.peer):checked ~ .peer-checked\:border-hub-primary-solid) {
|
|
463
|
+
border-color: var(--hub-primary-solid);
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
:is(:where(.peer):checked ~ .peer-checked\:bg-hub-primary-solid) {
|
|
467
|
+
background-color: var(--hub-primary-solid);
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
:is(:where(.peer):indeterminate ~ .peer-indeterminate\:border-hub-primary-solid) {
|
|
471
|
+
border-color: var(--hub-primary-solid);
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
:is(:where(.peer):indeterminate ~ .peer-indeterminate\:bg-hub-primary-solid) {
|
|
475
|
+
background-color: var(--hub-primary-solid);
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
:is(:where(.peer):focus-visible ~ .peer-focus-visible\:outline-2) {
|
|
479
|
+
outline-style: var(--tw-outline-style);
|
|
480
|
+
outline-width: 2px;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
:is(:where(.peer):focus-visible ~ .peer-focus-visible\:outline-offset-2) {
|
|
484
|
+
outline-offset: 2px;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
:is(:where(.peer):focus-visible ~ .peer-focus-visible\:outline-hub-focus-ring) {
|
|
488
|
+
outline-color: var(--hub-focus-ring);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
:is(:where(.peer):disabled ~ .peer-disabled\:opacity-40) {
|
|
492
|
+
opacity: .4;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.focus-visible\:ring-1:focus-visible {
|
|
496
|
+
--tw-ring-shadow: var(--tw-ring-inset, ) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color, currentcolor);
|
|
497
|
+
box-shadow: var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
.focus-visible\:ring-hub-focus-ring:focus-visible {
|
|
501
|
+
--tw-ring-color: var(--hub-focus-ring);
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.focus-visible\:outline-2:focus-visible {
|
|
505
|
+
outline-style: var(--tw-outline-style);
|
|
506
|
+
outline-width: 2px;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.focus-visible\:outline-offset-2:focus-visible {
|
|
510
|
+
outline-offset: 2px;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.focus-visible\:outline-hub-focus-ring:focus-visible {
|
|
514
|
+
outline-color: var(--hub-focus-ring);
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.focus-visible\:outline-none:focus-visible {
|
|
518
|
+
--tw-outline-style: none;
|
|
519
|
+
outline-style: none;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.focus-visible\:outline-solid:focus-visible {
|
|
523
|
+
--tw-outline-style: solid;
|
|
524
|
+
outline-style: solid;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
@media (hover: hover) {
|
|
528
|
+
.enabled\:hover\:bg-hub-bg-muted:enabled:hover {
|
|
529
|
+
background-color: var(--hub-bg-muted);
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
.enabled\:hover\:bg-hub-error-solid\/90:enabled:hover {
|
|
533
|
+
background-color: var(--hub-error-solid);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
537
|
+
.enabled\:hover\:bg-hub-error-solid\/90:enabled:hover {
|
|
538
|
+
background-color: color-mix(in oklab, var(--hub-error-solid) 90%, transparent);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
.enabled\:hover\:bg-hub-primary-solid\/90:enabled:hover {
|
|
543
|
+
background-color: var(--hub-primary-solid);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
@supports (color: color-mix(in lab, red, red)) {
|
|
547
|
+
.enabled\:hover\:bg-hub-primary-solid\/90:enabled:hover {
|
|
548
|
+
background-color: color-mix(in oklab, var(--hub-primary-solid) 90%, transparent);
|
|
549
|
+
}
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.enabled\:hover\:text-hub-fg:enabled:hover {
|
|
553
|
+
color: var(--hub-fg);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.enabled\:active\:bg-hub-bg-emphasized:enabled:active {
|
|
558
|
+
background-color: var(--hub-bg-emphasized);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
.enabled\:active\:bg-hub-bg-muted:enabled:active {
|
|
562
|
+
background-color: var(--hub-bg-muted);
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
.disabled\:cursor-default:disabled {
|
|
566
|
+
cursor: default;
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
.disabled\:cursor-not-allowed:disabled {
|
|
570
|
+
cursor: not-allowed;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.disabled\:opacity-50:disabled {
|
|
574
|
+
opacity: .5;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
.aria-pressed\:bg-hub-bg-muted[aria-pressed="true"] {
|
|
578
|
+
background-color: var(--hub-bg-muted);
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
.aria-pressed\:text-hub-fg[aria-pressed="true"] {
|
|
582
|
+
color: var(--hub-fg);
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
@media (hover: hover) {
|
|
586
|
+
.aria-pressed\:enabled\:hover\:bg-hub-bg-emphasized[aria-pressed="true"]:enabled:hover {
|
|
587
|
+
background-color: var(--hub-bg-emphasized);
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
.aria-pressed\:enabled\:active\:bg-hub-bg-emphasized[aria-pressed="true"]:enabled:active {
|
|
592
|
+
background-color: var(--hub-bg-emphasized);
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
@media (prefers-reduced-motion: reduce) {
|
|
596
|
+
.motion-reduce\:transition-none {
|
|
597
|
+
transition-property: none;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
.\[\&_svg\]\:size-3\.5 svg {
|
|
602
|
+
width: calc(var(--spacing) * 3.5);
|
|
603
|
+
height: calc(var(--spacing) * 3.5);
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
.\[\&_svg\]\:size-4 svg {
|
|
607
|
+
width: calc(var(--spacing) * 4);
|
|
608
|
+
height: calc(var(--spacing) * 4);
|
|
609
|
+
}
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
:root {
|
|
613
|
+
--hub-font-size-sm: 12px;
|
|
614
|
+
--hub-font-size-md: 13px;
|
|
615
|
+
--hub-font-size-lg: 14px;
|
|
616
|
+
--hub-bg: #fff;
|
|
617
|
+
--hub-bg-panel: #fff;
|
|
618
|
+
--hub-bg-muted: #f2f2f6;
|
|
619
|
+
--hub-bg-emphasized: #e8e8ef;
|
|
620
|
+
--hub-fg: #25252a;
|
|
621
|
+
--hub-fg-muted: #73737a;
|
|
622
|
+
--hub-border: #dedee5;
|
|
623
|
+
--hub-border-strong: lch(69.4% 0 142.924);
|
|
624
|
+
--hub-primary-solid: #7560d5;
|
|
625
|
+
--hub-primary-contrast: #fff;
|
|
626
|
+
--hub-error-solid: #c93645;
|
|
627
|
+
--hub-error-contrast: #fff;
|
|
628
|
+
--hub-shadow-sm: 0 0 0 .5px #0000000f, 0 3px 6px -2px #00000005, 0 1px 1px #0000000a;
|
|
629
|
+
--hub-focus-ring: #7560d5;
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
@property --tw-scale-x {
|
|
633
|
+
syntax: "*";
|
|
634
|
+
inherits: false;
|
|
635
|
+
initial-value: 1;
|
|
636
|
+
}
|
|
637
|
+
|
|
638
|
+
@property --tw-scale-y {
|
|
639
|
+
syntax: "*";
|
|
640
|
+
inherits: false;
|
|
641
|
+
initial-value: 1;
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
@property --tw-scale-z {
|
|
645
|
+
syntax: "*";
|
|
646
|
+
inherits: false;
|
|
647
|
+
initial-value: 1;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
@property --tw-rotate-x {
|
|
651
|
+
syntax: "*";
|
|
652
|
+
inherits: false
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
@property --tw-rotate-y {
|
|
656
|
+
syntax: "*";
|
|
657
|
+
inherits: false
|
|
658
|
+
}
|
|
659
|
+
|
|
660
|
+
@property --tw-rotate-z {
|
|
661
|
+
syntax: "*";
|
|
662
|
+
inherits: false
|
|
663
|
+
}
|
|
664
|
+
|
|
665
|
+
@property --tw-skew-x {
|
|
666
|
+
syntax: "*";
|
|
667
|
+
inherits: false
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
@property --tw-skew-y {
|
|
671
|
+
syntax: "*";
|
|
672
|
+
inherits: false
|
|
673
|
+
}
|
|
674
|
+
|
|
675
|
+
@property --tw-border-style {
|
|
676
|
+
syntax: "*";
|
|
677
|
+
inherits: false;
|
|
678
|
+
initial-value: solid;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
@property --tw-leading {
|
|
682
|
+
syntax: "*";
|
|
683
|
+
inherits: false
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
@property --tw-font-weight {
|
|
687
|
+
syntax: "*";
|
|
688
|
+
inherits: false
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
@property --tw-shadow {
|
|
692
|
+
syntax: "*";
|
|
693
|
+
inherits: false;
|
|
694
|
+
initial-value: 0 0 #0000;
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
@property --tw-shadow-color {
|
|
698
|
+
syntax: "*";
|
|
699
|
+
inherits: false
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
@property --tw-shadow-alpha {
|
|
703
|
+
syntax: "<percentage>";
|
|
704
|
+
inherits: false;
|
|
705
|
+
initial-value: 100%;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
@property --tw-inset-shadow {
|
|
709
|
+
syntax: "*";
|
|
710
|
+
inherits: false;
|
|
711
|
+
initial-value: 0 0 #0000;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
@property --tw-inset-shadow-color {
|
|
715
|
+
syntax: "*";
|
|
716
|
+
inherits: false
|
|
717
|
+
}
|
|
718
|
+
|
|
719
|
+
@property --tw-inset-shadow-alpha {
|
|
720
|
+
syntax: "<percentage>";
|
|
721
|
+
inherits: false;
|
|
722
|
+
initial-value: 100%;
|
|
723
|
+
}
|
|
724
|
+
|
|
725
|
+
@property --tw-ring-color {
|
|
726
|
+
syntax: "*";
|
|
727
|
+
inherits: false
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
@property --tw-ring-shadow {
|
|
731
|
+
syntax: "*";
|
|
732
|
+
inherits: false;
|
|
733
|
+
initial-value: 0 0 #0000;
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
@property --tw-inset-ring-color {
|
|
737
|
+
syntax: "*";
|
|
738
|
+
inherits: false
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
@property --tw-inset-ring-shadow {
|
|
742
|
+
syntax: "*";
|
|
743
|
+
inherits: false;
|
|
744
|
+
initial-value: 0 0 #0000;
|
|
745
|
+
}
|
|
746
|
+
|
|
747
|
+
@property --tw-ring-inset {
|
|
748
|
+
syntax: "*";
|
|
749
|
+
inherits: false
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
@property --tw-ring-offset-width {
|
|
753
|
+
syntax: "<length>";
|
|
754
|
+
inherits: false;
|
|
755
|
+
initial-value: 0;
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
@property --tw-ring-offset-color {
|
|
759
|
+
syntax: "*";
|
|
760
|
+
inherits: false;
|
|
761
|
+
initial-value: #fff;
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
@property --tw-ring-offset-shadow {
|
|
765
|
+
syntax: "*";
|
|
766
|
+
inherits: false;
|
|
767
|
+
initial-value: 0 0 #0000;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
@property --tw-duration {
|
|
771
|
+
syntax: "*";
|
|
772
|
+
inherits: false
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
@property --tw-ease {
|
|
776
|
+
syntax: "*";
|
|
777
|
+
inherits: false
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
@property --tw-outline-style {
|
|
781
|
+
syntax: "*";
|
|
782
|
+
inherits: false;
|
|
783
|
+
initial-value: solid;
|
|
784
|
+
}
|
|
785
|
+
/*$vite$:1*/
|
package/docs/Button.md
ADDED
package/docs/Checkbox.md
ADDED
package/docs/Divider.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Divider
|
|
2
|
+
|
|
3
|
+
装饰性半像素分隔线,不进入无障碍树。支持原生 span 属性和 ref。
|
|
4
|
+
|
|
5
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
6
|
+
| --- | --- | --- | --- |
|
|
7
|
+
| orientation | `'horizontal' \| 'vertical'` | `'horizontal'` | 内联分隔线方向;垂直线在 flex 容器中自动拉伸。 |
|
|
8
|
+
| tone | `'default' \| 'subtle'` | `'default'` | 分隔线颜色强度:`default` 为正常颜色,`subtle` 将颜色透明度设为 50%。 |
|
|
9
|
+
| edge | `'top' \| 'bottom' \| 'left' \| 'right'` | — | 将分隔线固定在父容器的上、下、左或右边,不占布局空间。上、下边为横线,左、右边为竖线,此时 `orientation` 不生效。父容器需设置 `position: relative`。 |
|
|
10
|
+
| inset | `number` | `0` | 沿分隔线两端内缩的像素数。 |
|
|
11
|
+
| length | `number` | — | 固定长度(像素);默认填满可用空间,边界模式从内缩后的起点延伸。 |
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# IconButton
|
|
2
|
+
|
|
3
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
4
|
+
| --- | --- | --- | --- |
|
|
5
|
+
| variant | `'primary' \| 'secondary'` | `'primary'` | primary 带描边与轻阴影;secondary 透明、无边框。 |
|
|
6
|
+
| size | `'sm' \| 'md' \| 'lg'` | `'md'` | 按钮尺寸分别为 24、28、32px;内部 SVG 尺寸分别为 14、14、16px。 |
|
|
7
|
+
| pressed | `boolean` | `undefined` | 受控选中状态,内部映射为 `aria-pressed`。不传时为普通按钮;点击不会自动修改状态。 |
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# ResizeHandle
|
|
2
|
+
|
|
3
|
+
受控面板调宽手柄,组合 Divider 显示边界。放在具有定位的面板内,由调用方把 value 应用到面板宽度并处理持久化。保留 7px 拖拽热区、半像素边界与跟随指针的渐变反馈。
|
|
4
|
+
|
|
5
|
+
支持原生 div 展示属性和 ref;交互事件由组件管理。label 和 controls 分别提供可访问名称和受控面板 id。Home/End 调至最小/最大值;提供 defaultValue 后可双击复位。所有交互输出都限制在 min/max 范围内。调用方应保证 min ≤ value ≤ max。
|
|
6
|
+
|
|
7
|
+
| 属性 | 类型 | 默认值 | 说明 |
|
|
8
|
+
| --- | --- | --- | --- |
|
|
9
|
+
| label | `string` | 必填 | 手柄的可访问名称。 |
|
|
10
|
+
| controls | `string` | 必填 | 受控面板的 DOM id。 |
|
|
11
|
+
| value | `number` | 必填 | 当前面板宽度,单位像素。 |
|
|
12
|
+
| min | `number` | 必填 | 最小宽度。 |
|
|
13
|
+
| max | `number` | 必填 | 最大宽度。 |
|
|
14
|
+
| onChange | `(value: number) => void` | 必填 | 宽度变化回调。 |
|
|
15
|
+
| defaultValue | `number` | — | 双击复位宽度;不提供时不复位,不代表非受控初值。 |
|
|
16
|
+
| showDivider | `boolean` | `true` | 是否显示静态分隔线,隐藏时仍保留交互反馈。 |
|
|
17
|
+
| inset | `number` | `0` | 手柄上下内缩像素数。 |
|
|
18
|
+
| edge | `'left' \| 'right'` | `'right'` | 面板的可拖动边界;左边界向左移动时增大宽度。 |
|
package/docs/index.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# @hamsterbase/ui
|
|
2
|
+
|
|
3
|
+
React 19 组件库。引入组件及样式即可使用,无需配置 Tailwind。
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { Button } from '@hamsterbase/ui';
|
|
7
|
+
import '@hamsterbase/ui/styles.css';
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
样式不包含全局 reset。可在应用根节点或局部容器覆盖 `--hub-*` CSS 变量来调整主题。
|
|
11
|
+
|
|
12
|
+
## 组件文档
|
|
13
|
+
|
|
14
|
+
- [Button](./Button.md)
|
|
15
|
+
- [Checkbox](./Checkbox.md)
|
|
16
|
+
- [Divider](./Divider.md)
|
|
17
|
+
- [IconButton](./IconButton.md)
|
|
18
|
+
- [ResizeHandle](./ResizeHandle.md)
|
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hamsterbase/ui",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"files": [
|
|
5
|
+
"dist",
|
|
6
|
+
"docs",
|
|
7
|
+
"!dist/playground"
|
|
8
|
+
],
|
|
9
|
+
"type": "module",
|
|
10
|
+
"sideEffects": [
|
|
11
|
+
"**/*.css"
|
|
12
|
+
],
|
|
13
|
+
"exports": {
|
|
14
|
+
".": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"import": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"./styles.css": "./dist/styles.css",
|
|
19
|
+
"./docs/*": "./docs/*"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@tailwindcss/vite": "4.3.4",
|
|
23
|
+
"@types/node": "^24.19.2",
|
|
24
|
+
"@types/react": "19.2.17",
|
|
25
|
+
"@types/react-dom": "^19.2.7",
|
|
26
|
+
"react": "19.2.8",
|
|
27
|
+
"tailwindcss": "4.3.4",
|
|
28
|
+
"typescript": "~6.0.3",
|
|
29
|
+
"vite": "8.3.5"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"react": "^19.0.0"
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"clsx": "^2.1.1",
|
|
36
|
+
"lucide-react": "^1.68.0"
|
|
37
|
+
},
|
|
38
|
+
"main": "./dist/index.js",
|
|
39
|
+
"types": "./dist/index.d.ts",
|
|
40
|
+
"publishConfig": {
|
|
41
|
+
"access": "public",
|
|
42
|
+
"registry": "https://registry.npmjs.org/"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"dev": "pnpm --filter @hamsterbase/ui-playground exec vite --host 0.0.0.0",
|
|
46
|
+
"build": "vite build && tsc -p tsconfig.build.json && node scripts/finalize-build.mjs",
|
|
47
|
+
"check": "tsc -p tsconfig.json",
|
|
48
|
+
"build:playground": "pnpm --filter @hamsterbase/ui-playground exec vite build"
|
|
49
|
+
}
|
|
6
50
|
}
|
package/README.md
DELETED