@hellboy/ds 0.1.2 → 0.2.7
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 +568 -71
- package/{src/style/components/badge → dist/components}/badge.css +9 -25
- package/dist/components/badge.d.mts +12 -0
- package/dist/components/badge.d.ts +12 -0
- package/dist/components/badge.js +42 -0
- package/dist/components/badge.mjs +15 -0
- package/dist/components/banner.css +280 -0
- package/dist/components/banner.d.mts +12 -0
- package/dist/components/banner.d.ts +12 -0
- package/dist/components/banner.js +184 -0
- package/dist/components/banner.mjs +147 -0
- package/dist/components/button-group.css +289 -0
- package/dist/components/button-group.d.mts +81 -0
- package/dist/components/button-group.d.ts +81 -0
- package/dist/components/button-group.js +180 -0
- package/dist/components/button-group.mjs +143 -0
- package/{src/style/components/button → dist/components}/button.css +59 -62
- package/dist/components/button.d.mts +57 -0
- package/dist/components/button.d.ts +57 -0
- package/dist/components/button.js +129 -0
- package/dist/components/button.mjs +92 -0
- package/{src/style/components/card → dist/components}/card.css +9 -30
- package/dist/components/card.d.mts +31 -0
- package/dist/components/card.d.ts +31 -0
- package/dist/components/card.js +59 -0
- package/dist/components/card.mjs +32 -0
- package/{src/style → dist}/components/checkbox.css +51 -43
- package/dist/components/checkbox.d.mts +31 -0
- package/dist/components/checkbox.d.ts +31 -0
- package/dist/components/checkbox.js +130 -0
- package/dist/components/checkbox.mjs +93 -0
- package/{src/style/components/code-block → dist/components}/code-block.css +3 -7
- package/dist/components/code-block.d.mts +24 -0
- package/dist/components/code-block.d.ts +24 -0
- package/dist/components/code-block.js +43 -0
- package/dist/components/code-block.mjs +16 -0
- package/dist/components/color-control.css +285 -0
- package/dist/components/color-control.d.mts +5 -0
- package/dist/components/color-control.d.ts +5 -0
- package/dist/components/color-control.js +534 -0
- package/dist/components/color-control.mjs +497 -0
- package/dist/components/dialog.css +930 -0
- package/dist/components/dialog.d.mts +32 -0
- package/dist/components/dialog.d.ts +32 -0
- package/dist/components/dialog.js +1111 -0
- package/dist/components/dialog.mjs +1074 -0
- package/dist/components/divider.css +356 -0
- package/dist/components/divider.d.mts +32 -0
- package/dist/components/divider.d.ts +32 -0
- package/dist/components/divider.js +344 -0
- package/dist/components/divider.mjs +307 -0
- package/{src/style/components/drag-handle → dist/components}/drag-handle.css +3 -18
- package/dist/components/drag-handle.d.mts +11 -0
- package/dist/components/drag-handle.d.ts +11 -0
- package/dist/components/drag-handle.js +103 -0
- package/dist/components/drag-handle.mjs +66 -0
- package/dist/components/drawer.css +1027 -0
- package/dist/components/drawer.d.mts +14 -0
- package/dist/components/drawer.d.ts +14 -0
- package/dist/components/drawer.js +1072 -0
- package/dist/components/drawer.mjs +1035 -0
- package/dist/components/floating-bar.css +17 -0
- package/dist/components/floating-bar.d.mts +25 -0
- package/dist/components/floating-bar.d.ts +25 -0
- package/dist/components/floating-bar.js +52 -0
- package/dist/components/floating-bar.mjs +25 -0
- package/dist/components/footer.css +40 -0
- package/dist/components/footer.d.mts +8 -0
- package/dist/components/footer.d.ts +8 -0
- package/dist/components/footer.js +44 -0
- package/dist/components/footer.mjs +17 -0
- package/dist/components/grid.css +47 -0
- package/dist/components/grid.d.mts +27 -0
- package/dist/components/grid.d.ts +27 -0
- package/dist/components/grid.js +52 -0
- package/dist/components/grid.mjs +25 -0
- package/dist/components/header.css +1075 -0
- package/dist/components/header.d.mts +35 -0
- package/dist/components/header.d.ts +35 -0
- package/dist/components/header.js +1402 -0
- package/dist/components/header.mjs +1365 -0
- package/dist/components/hero.css +121 -0
- package/dist/components/hero.d.mts +111 -0
- package/dist/components/hero.d.ts +111 -0
- package/dist/components/hero.js +285 -0
- package/dist/components/hero.mjs +248 -0
- package/{src/style/components/icons → dist/components}/icons.css +14 -15
- package/dist/components/icons.d.mts +104 -0
- package/dist/components/icons.d.ts +104 -0
- package/dist/components/icons.js +239 -0
- package/dist/components/icons.mjs +203 -0
- package/{src/style/components/input → dist/components}/input.css +189 -102
- package/dist/components/input.d.mts +114 -0
- package/dist/components/input.d.ts +114 -0
- package/dist/components/input.js +926 -0
- package/dist/components/input.mjs +879 -0
- package/dist/components/layout.css +551 -0
- package/dist/components/layout.d.mts +16 -0
- package/dist/components/layout.d.ts +16 -0
- package/dist/components/layout.js +387 -0
- package/dist/components/layout.mjs +352 -0
- package/{src/style/components/list → dist/components}/list.css +47 -41
- package/dist/components/list.d.mts +46 -0
- package/dist/components/list.d.ts +46 -0
- package/dist/components/list.js +124 -0
- package/dist/components/list.mjs +96 -0
- package/dist/components/navbar.css +706 -0
- package/dist/components/navbar.d.mts +56 -0
- package/dist/components/navbar.d.ts +56 -0
- package/dist/components/navbar.js +994 -0
- package/dist/components/navbar.mjs +952 -0
- package/{src/style/components/page-index → dist/components}/page-index.css +2 -47
- package/dist/components/page-index.d.mts +25 -0
- package/dist/components/page-index.d.ts +25 -0
- package/dist/components/page-index.js +239 -0
- package/dist/components/page-index.mjs +202 -0
- package/{src/style/components/page → dist/components}/page.css +4 -15
- package/dist/components/page.d.mts +30 -0
- package/dist/components/page.d.ts +30 -0
- package/dist/components/page.js +40 -0
- package/dist/components/page.mjs +13 -0
- package/dist/components/popover.css +87 -0
- package/dist/components/popover.d.mts +22 -0
- package/dist/components/popover.d.ts +22 -0
- package/dist/components/popover.js +243 -0
- package/dist/components/popover.mjs +206 -0
- package/{src/style → dist}/components/radio.css +8 -51
- package/dist/components/radio.d.mts +59 -0
- package/dist/components/radio.d.ts +59 -0
- package/dist/components/radio.js +133 -0
- package/dist/components/radio.mjs +95 -0
- package/dist/components/section.css +993 -0
- package/dist/components/section.d.mts +33 -0
- package/dist/components/section.d.ts +33 -0
- package/dist/components/section.js +1401 -0
- package/dist/components/section.mjs +1364 -0
- package/dist/components/select.css +391 -0
- package/dist/components/select.d.mts +63 -0
- package/dist/components/select.d.ts +63 -0
- package/dist/components/select.js +452 -0
- package/dist/components/select.mjs +415 -0
- package/{src/style/components/slider → dist/components}/slider.css +55 -33
- package/dist/components/slider.d.mts +69 -0
- package/dist/components/slider.d.ts +69 -0
- package/dist/components/slider.js +254 -0
- package/dist/components/slider.mjs +217 -0
- package/dist/components/switch.css +1081 -0
- package/dist/components/switch.d.mts +33 -0
- package/dist/components/switch.d.ts +33 -0
- package/dist/components/switch.js +1092 -0
- package/dist/components/switch.mjs +1055 -0
- package/{src/style/components/table → dist/components}/table.css +3 -28
- package/dist/components/table.d.mts +42 -0
- package/dist/components/table.d.ts +42 -0
- package/dist/components/table.js +108 -0
- package/dist/components/table.mjs +76 -0
- package/dist/components/tag.css +97 -0
- package/dist/components/tag.d.mts +12 -0
- package/dist/components/tag.d.ts +12 -0
- package/dist/components/tag.js +42 -0
- package/dist/components/tag.mjs +15 -0
- package/dist/components/textarea.css +1359 -0
- package/dist/components/textarea.d.mts +84 -0
- package/dist/components/textarea.d.ts +84 -0
- package/dist/components/textarea.js +1962 -0
- package/dist/components/textarea.mjs +1924 -0
- package/{src/style/components/theme-control → dist/components}/theme-control.css +3 -7
- package/dist/components/theme-control.d.mts +9 -0
- package/dist/components/theme-control.d.ts +9 -0
- package/dist/components/theme-control.js +235 -0
- package/dist/components/theme-control.mjs +200 -0
- package/{src/style/components/tooltip → dist/components}/tooltip.css +5 -13
- package/dist/components/tooltip.d.mts +12 -0
- package/dist/components/tooltip.d.ts +12 -0
- package/dist/components/tooltip.js +200 -0
- package/dist/components/tooltip.mjs +163 -0
- package/dist/icons-Czahnf-r.d.mts +15 -0
- package/dist/icons-Czahnf-r.d.ts +15 -0
- package/dist/index.css +2915 -2068
- package/dist/index.d.mts +144 -721
- package/dist/index.d.ts +144 -721
- package/dist/index.js +4076 -2282
- package/dist/index.mjs +4132 -2366
- package/dist/theme.css +34 -34
- package/package.json +27 -8
- package/dist/index.css.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/hellboy-ds-0.1.2.tgz +0 -0
- package/src/components/badge/Badge.tsx +0 -29
- package/src/components/badge/index.ts +0 -1
- package/src/components/banner/Banner.tsx +0 -48
- package/src/components/banner/banner.css +0 -44
- package/src/components/banner/index.ts +0 -1
- package/src/components/button/button.tsx +0 -127
- package/src/components/button/index.ts +0 -1
- package/src/components/card/card.tsx +0 -57
- package/src/components/card/index.ts +0 -1
- package/src/components/checkbox/Checkbox.tsx +0 -98
- package/src/components/checkbox/index.ts +0 -1
- package/src/components/code-block/code-block.tsx +0 -44
- package/src/components/code-block/index.ts +0 -1
- package/src/components/color-control/color-control.tsx +0 -322
- package/src/components/color-control/index.ts +0 -1
- package/src/components/drag-handle/DragHandle.tsx +0 -78
- package/src/components/drag-handle/index.ts +0 -1
- package/src/components/drawer/drawer.tsx +0 -82
- package/src/components/drawer/index.ts +0 -1
- package/src/components/floating-bar/floating-bar.tsx +0 -52
- package/src/components/floating-bar/index.ts +0 -2
- package/src/components/footer/footer.tsx +0 -28
- package/src/components/footer/index.ts +0 -1
- package/src/components/grid/Grid.tsx +0 -53
- package/src/components/grid/index.ts +0 -1
- package/src/components/header/header.tsx +0 -57
- package/src/components/header/index.ts +0 -1
- package/src/components/icons/icons.tsx +0 -44
- package/src/components/icons/index.ts +0 -1
- package/src/components/index.ts +0 -29
- package/src/components/input/DatePicker.tsx +0 -133
- package/src/components/input/Input.tsx +0 -220
- package/src/components/input/InputDate.tsx +0 -10
- package/src/components/input/InputDateTime.tsx +0 -10
- package/src/components/input/InputEmail.tsx +0 -10
- package/src/components/input/InputField.tsx +0 -137
- package/src/components/input/InputNumber.tsx +0 -10
- package/src/components/input/InputPassword.tsx +0 -10
- package/src/components/input/InputSearch.tsx +0 -10
- package/src/components/input/InputTel.tsx +0 -10
- package/src/components/input/InputText.tsx +0 -10
- package/src/components/input/InputTime.tsx +0 -10
- package/src/components/input/InputUrl.tsx +0 -10
- package/src/components/input/TimePicker.tsx +0 -151
- package/src/components/input/index.ts +0 -11
- package/src/components/layout/Layout.tsx +0 -244
- package/src/components/layout/index.ts +0 -1
- package/src/components/list/List.tsx +0 -159
- package/src/components/list/index.ts +0 -1
- package/src/components/navbar/MenuCategory.tsx +0 -20
- package/src/components/navbar/MenuGroup.tsx +0 -288
- package/src/components/navbar/MenuItem.tsx +0 -65
- package/src/components/navbar/Navbar.tsx +0 -23
- package/src/components/navbar/index.ts +0 -4
- package/src/components/page/index.ts +0 -1
- package/src/components/page/page.tsx +0 -46
- package/src/components/page-index/PageIndex.tsx +0 -275
- package/src/components/page-index/index.ts +0 -1
- package/src/components/popover/index.ts +0 -1
- package/src/components/popover/popover.tsx +0 -199
- package/src/components/radio/Radio.tsx +0 -176
- package/src/components/radio/index.ts +0 -1
- package/src/components/section/index.ts +0 -1
- package/src/components/section/section.tsx +0 -66
- package/src/components/select/Select.tsx +0 -212
- package/src/components/select/index.ts +0 -1
- package/src/components/slider/Slider.tsx +0 -267
- package/src/components/slider/index.ts +0 -1
- package/src/components/switch/index.ts +0 -1
- package/src/components/switch/switch.tsx +0 -99
- package/src/components/table/Table.tsx +0 -147
- package/src/components/table/index.ts +0 -1
- package/src/components/theme-control/index.ts +0 -1
- package/src/components/theme-control/theme-control.tsx +0 -78
- package/src/components/tooltip/index.ts +0 -1
- package/src/components/tooltip/tooltip.tsx +0 -207
- package/src/contexts/NavbarTooltipContext.tsx +0 -48
- package/src/contexts/index.ts +0 -1
- package/src/foundations/motion.md +0 -136
- package/src/index.ts +0 -40
- package/src/style/_shared/field.css +0 -69
- package/src/style/components/color-control/color-control.css +0 -126
- package/src/style/components/drawer/drawer.css +0 -210
- package/src/style/components/floating-bar/floating-bar.css +0 -39
- package/src/style/components/footer/footer.css +0 -108
- package/src/style/components/grid/grid.css +0 -33
- package/src/style/components/header/header.css +0 -44
- package/src/style/components/layout/layout.css +0 -205
- package/src/style/components/navbar/navbar.css +0 -342
- package/src/style/components/popover/popover.css +0 -44
- package/src/style/components/section/section.css +0 -67
- package/src/style/components/select/select.css +0 -143
- package/src/style/components/switch/switch.css +0 -267
- package/src/style/foundations/global.css +0 -316
- package/src/style/foundations/motion.css +0 -164
- package/src/style/foundations/spacing.css +0 -51
- package/src/style/foundations/typography.css +0 -39
- package/src/style/foundations/z-index.css +0 -81
- package/src/style/modes/dark.css +0 -146
- package/src/style/modes/light.css +0 -147
- package/src/style/semantic.css +0 -52
- package/src/style/styles.css +0 -51
- package/src/style/themes/theme.json +0 -37
- package/src/utils/README.md +0 -305
- package/src/utils/USER_PREFERENCES.md +0 -558
- package/src/utils/theme.ts +0 -127
- package/src/utils/user-preferences.ts +0 -577
- package/tsconfig.json +0 -25
- package/tsup.config.ts +0 -52
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
+
|
|
5
|
+
// src/components/layout/Layout.tsx
|
|
6
|
+
import * as React3 from "react";
|
|
7
|
+
|
|
8
|
+
// src/components/drag-handle/DragHandle.tsx
|
|
9
|
+
import React, { useState, useRef, useCallback } from "react";
|
|
10
|
+
import { jsx } from "react/jsx-runtime";
|
|
11
|
+
var DragHandle = ({
|
|
12
|
+
onResize,
|
|
13
|
+
onResizeEnd,
|
|
14
|
+
orientation = "vertical",
|
|
15
|
+
className = ""
|
|
16
|
+
}) => {
|
|
17
|
+
const [isDragging, setIsDragging] = useState(false);
|
|
18
|
+
const dragHandleRef = useRef(null);
|
|
19
|
+
const startPosRef = useRef(0);
|
|
20
|
+
const handleMouseDown = useCallback((e) => {
|
|
21
|
+
setIsDragging(true);
|
|
22
|
+
startPosRef.current = orientation === "vertical" ? e.clientX : e.clientY;
|
|
23
|
+
e.preventDefault();
|
|
24
|
+
}, [orientation]);
|
|
25
|
+
const handleMouseMove = useCallback((e) => {
|
|
26
|
+
if (!isDragging) return;
|
|
27
|
+
const currentPos = orientation === "vertical" ? e.clientX : e.clientY;
|
|
28
|
+
const delta = currentPos - startPosRef.current;
|
|
29
|
+
onResize(delta);
|
|
30
|
+
startPosRef.current = currentPos;
|
|
31
|
+
}, [isDragging, onResize, orientation]);
|
|
32
|
+
const handleMouseUp = useCallback(() => {
|
|
33
|
+
setIsDragging(false);
|
|
34
|
+
onResizeEnd?.();
|
|
35
|
+
}, [onResizeEnd]);
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
if (isDragging) {
|
|
38
|
+
document.addEventListener("mousemove", handleMouseMove);
|
|
39
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
40
|
+
document.body.style.cursor = orientation === "vertical" ? "col-resize" : "row-resize";
|
|
41
|
+
document.body.style.userSelect = "none";
|
|
42
|
+
} else {
|
|
43
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
44
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
45
|
+
document.body.style.cursor = "";
|
|
46
|
+
document.body.style.userSelect = "";
|
|
47
|
+
}
|
|
48
|
+
return () => {
|
|
49
|
+
document.removeEventListener("mousemove", handleMouseMove);
|
|
50
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
51
|
+
document.body.style.cursor = "";
|
|
52
|
+
document.body.style.userSelect = "";
|
|
53
|
+
};
|
|
54
|
+
}, [isDragging, handleMouseMove, handleMouseUp, orientation]);
|
|
55
|
+
const classes = [
|
|
56
|
+
"drag-handle",
|
|
57
|
+
`drag-handle--${orientation}`,
|
|
58
|
+
isDragging && "drag-handle--dragging",
|
|
59
|
+
className
|
|
60
|
+
].filter(Boolean).join(" ");
|
|
61
|
+
return /* @__PURE__ */ jsx(
|
|
62
|
+
"div",
|
|
63
|
+
{
|
|
64
|
+
ref: dragHandleRef,
|
|
65
|
+
className: classes,
|
|
66
|
+
onMouseDown: handleMouseDown,
|
|
67
|
+
children: /* @__PURE__ */ jsx("div", { className: "drag-handle__indicator" })
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
// src/utils/user-preferences.ts
|
|
73
|
+
var DEFAULT_CONFIG = {
|
|
74
|
+
backend: "localStorage",
|
|
75
|
+
prefix: "hellboy-ds",
|
|
76
|
+
dbName: "hellboy-ds-prefs",
|
|
77
|
+
storeName: "preferences"
|
|
78
|
+
};
|
|
79
|
+
var config = { ...DEFAULT_CONFIG };
|
|
80
|
+
var getStorageKey = (key) => {
|
|
81
|
+
return `${config.prefix}:${key}`;
|
|
82
|
+
};
|
|
83
|
+
var isLocalStorageAvailable = () => {
|
|
84
|
+
try {
|
|
85
|
+
const test = "__storage_test__";
|
|
86
|
+
localStorage.setItem(test, test);
|
|
87
|
+
localStorage.removeItem(test);
|
|
88
|
+
return true;
|
|
89
|
+
} catch {
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var IndexedDBStore = class {
|
|
94
|
+
constructor() {
|
|
95
|
+
__publicField(this, "db", null);
|
|
96
|
+
}
|
|
97
|
+
async init() {
|
|
98
|
+
if (typeof window === "undefined" || !window.indexedDB) {
|
|
99
|
+
throw new Error("IndexedDB not available");
|
|
100
|
+
}
|
|
101
|
+
return new Promise((resolve, reject) => {
|
|
102
|
+
const request = indexedDB.open(config.dbName, 1);
|
|
103
|
+
request.onerror = () => reject(request.error);
|
|
104
|
+
request.onsuccess = () => {
|
|
105
|
+
this.db = request.result;
|
|
106
|
+
resolve();
|
|
107
|
+
};
|
|
108
|
+
request.onupgradeneeded = (event) => {
|
|
109
|
+
const db = event.target.result;
|
|
110
|
+
if (!db.objectStoreNames.contains(config.storeName)) {
|
|
111
|
+
db.createObjectStore(config.storeName, { keyPath: "key" });
|
|
112
|
+
}
|
|
113
|
+
};
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async get(key) {
|
|
117
|
+
if (!this.db) await this.init();
|
|
118
|
+
return new Promise((resolve, reject) => {
|
|
119
|
+
const transaction = this.db.transaction([config.storeName], "readonly");
|
|
120
|
+
const store = transaction.objectStore(config.storeName);
|
|
121
|
+
const request = store.get(key);
|
|
122
|
+
request.onsuccess = () => resolve(request.result?.value);
|
|
123
|
+
request.onerror = () => reject(request.error);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
async set(key, value) {
|
|
127
|
+
if (!this.db) await this.init();
|
|
128
|
+
return new Promise((resolve, reject) => {
|
|
129
|
+
const transaction = this.db.transaction([config.storeName], "readwrite");
|
|
130
|
+
const store = transaction.objectStore(config.storeName);
|
|
131
|
+
const request = store.put({ key, value });
|
|
132
|
+
request.onsuccess = () => resolve();
|
|
133
|
+
request.onerror = () => reject(request.error);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
async remove(key) {
|
|
137
|
+
if (!this.db) await this.init();
|
|
138
|
+
return new Promise((resolve, reject) => {
|
|
139
|
+
const transaction = this.db.transaction([config.storeName], "readwrite");
|
|
140
|
+
const store = transaction.objectStore(config.storeName);
|
|
141
|
+
const request = store.delete(key);
|
|
142
|
+
request.onsuccess = () => resolve();
|
|
143
|
+
request.onerror = () => reject(request.error);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
async clear() {
|
|
147
|
+
if (!this.db) await this.init();
|
|
148
|
+
return new Promise((resolve, reject) => {
|
|
149
|
+
const transaction = this.db.transaction([config.storeName], "readwrite");
|
|
150
|
+
const store = transaction.objectStore(config.storeName);
|
|
151
|
+
const request = store.clear();
|
|
152
|
+
request.onsuccess = () => resolve();
|
|
153
|
+
request.onerror = () => reject(request.error);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
var indexedDBStore = new IndexedDBStore();
|
|
158
|
+
var getPreference = (key, defaultValue) => {
|
|
159
|
+
try {
|
|
160
|
+
if (config.backend === "localStorage" && isLocalStorageAvailable()) {
|
|
161
|
+
const stored = localStorage.getItem(getStorageKey(key));
|
|
162
|
+
if (stored !== null) {
|
|
163
|
+
return JSON.parse(stored);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return defaultValue;
|
|
167
|
+
} catch (error) {
|
|
168
|
+
console.warn(`Failed to get preference "${key}":`, error);
|
|
169
|
+
return defaultValue;
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
var setPreference = (key, value) => {
|
|
173
|
+
try {
|
|
174
|
+
if (config.backend === "localStorage" && isLocalStorageAvailable()) {
|
|
175
|
+
localStorage.setItem(getStorageKey(key), JSON.stringify(value));
|
|
176
|
+
}
|
|
177
|
+
} catch (error) {
|
|
178
|
+
console.warn(`Failed to set preference "${key}":`, error);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
// src/components/navbar/Navbar.tsx
|
|
183
|
+
import * as React2 from "react";
|
|
184
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
185
|
+
var NAVBAR_COLLAPSED_WIDTH = 64;
|
|
186
|
+
var NAVBAR_MIN_PERSIST_WIDTH = 211;
|
|
187
|
+
|
|
188
|
+
// src/components/layout/Layout.tsx
|
|
189
|
+
import { Fragment, jsx as jsx3, jsxs } from "react/jsx-runtime";
|
|
190
|
+
var DEFAULT_LEFT_WIDTH = 280;
|
|
191
|
+
var DEFAULT_RIGHT_WIDTH = 300;
|
|
192
|
+
var MIN_WIDTH = NAVBAR_COLLAPSED_WIDTH;
|
|
193
|
+
var MAX_WIDTH = 600;
|
|
194
|
+
var Layout = ({
|
|
195
|
+
variant = "stacked",
|
|
196
|
+
header,
|
|
197
|
+
footer,
|
|
198
|
+
sidebarLeft,
|
|
199
|
+
sidebarRight,
|
|
200
|
+
bottomBar,
|
|
201
|
+
resizable = false,
|
|
202
|
+
hero,
|
|
203
|
+
children,
|
|
204
|
+
className = "",
|
|
205
|
+
...props
|
|
206
|
+
}) => {
|
|
207
|
+
const classes = ["layout", `layout--${variant}`, className].filter(Boolean).join(" ");
|
|
208
|
+
const hasSidebarLeft = sidebarLeft != null;
|
|
209
|
+
const hasSidebarRight = sidebarRight != null;
|
|
210
|
+
const columnCount = [hasSidebarLeft, true, hasSidebarRight].filter(Boolean).length;
|
|
211
|
+
const shouldShowResizers = resizable && columnCount >= 2;
|
|
212
|
+
const [leftSidebarWidth, setLeftSidebarWidth] = React3.useState(() => {
|
|
213
|
+
const isCollapsed = getPreference("layout.leftSidebarCollapsed", false);
|
|
214
|
+
if (isCollapsed) {
|
|
215
|
+
return NAVBAR_COLLAPSED_WIDTH;
|
|
216
|
+
}
|
|
217
|
+
const stored = getPreference("layout.leftSidebarWidth", DEFAULT_LEFT_WIDTH);
|
|
218
|
+
return typeof stored === "number" ? stored : DEFAULT_LEFT_WIDTH;
|
|
219
|
+
});
|
|
220
|
+
const [rightSidebarWidth, setRightSidebarWidth] = React3.useState(() => {
|
|
221
|
+
const stored = getPreference("layout.rightSidebarWidth", DEFAULT_RIGHT_WIDTH);
|
|
222
|
+
return typeof stored === "number" ? stored : DEFAULT_RIGHT_WIDTH;
|
|
223
|
+
});
|
|
224
|
+
const [leftSidebarPreferredWidth, setLeftSidebarPreferredWidth] = React3.useState(() => {
|
|
225
|
+
const savedWidth = getPreference("layout.leftSidebarWidth");
|
|
226
|
+
return typeof savedWidth === "number" && savedWidth >= NAVBAR_MIN_PERSIST_WIDTH ? savedWidth : DEFAULT_LEFT_WIDTH;
|
|
227
|
+
});
|
|
228
|
+
const [leftSidebarCollapsed, setLeftSidebarCollapsed] = React3.useState(() => {
|
|
229
|
+
const stored = getPreference("layout.leftSidebarCollapsed");
|
|
230
|
+
return typeof stored === "boolean" ? stored : false;
|
|
231
|
+
});
|
|
232
|
+
const clampWidth = React3.useCallback((width) => {
|
|
233
|
+
return Math.max(MIN_WIDTH, Math.min(MAX_WIDTH, Math.round(width)));
|
|
234
|
+
}, []);
|
|
235
|
+
const updateLeftSidebarWidth = React3.useCallback(
|
|
236
|
+
(width) => {
|
|
237
|
+
const clamped = clampWidth(width);
|
|
238
|
+
setLeftSidebarWidth(clamped);
|
|
239
|
+
if (clamped >= NAVBAR_MIN_PERSIST_WIDTH) {
|
|
240
|
+
setPreference("layout.leftSidebarWidth", clamped);
|
|
241
|
+
setLeftSidebarPreferredWidth(clamped);
|
|
242
|
+
setLeftSidebarCollapsed(false);
|
|
243
|
+
setPreference("layout.leftSidebarCollapsed", false);
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
[clampWidth]
|
|
247
|
+
);
|
|
248
|
+
const updateRightSidebarWidth = React3.useCallback(
|
|
249
|
+
(width) => {
|
|
250
|
+
const clamped = clampWidth(width);
|
|
251
|
+
setRightSidebarWidth(clamped);
|
|
252
|
+
setPreference("layout.rightSidebarWidth", clamped);
|
|
253
|
+
},
|
|
254
|
+
[clampWidth]
|
|
255
|
+
);
|
|
256
|
+
const handleLeftResize = React3.useCallback(
|
|
257
|
+
(delta) => {
|
|
258
|
+
setLeftSidebarWidth((prev) => {
|
|
259
|
+
const next = clampWidth(prev + delta);
|
|
260
|
+
return next;
|
|
261
|
+
});
|
|
262
|
+
},
|
|
263
|
+
[clampWidth]
|
|
264
|
+
);
|
|
265
|
+
const handleLeftResizeEnd = React3.useCallback(() => {
|
|
266
|
+
setLeftSidebarWidth((currentWidth) => {
|
|
267
|
+
if (currentWidth >= NAVBAR_MIN_PERSIST_WIDTH) {
|
|
268
|
+
setPreference("layout.leftSidebarWidth", currentWidth);
|
|
269
|
+
setLeftSidebarPreferredWidth(currentWidth);
|
|
270
|
+
setLeftSidebarCollapsed(false);
|
|
271
|
+
setPreference("layout.leftSidebarCollapsed", false);
|
|
272
|
+
return currentWidth;
|
|
273
|
+
} else {
|
|
274
|
+
setLeftSidebarCollapsed(true);
|
|
275
|
+
setPreference("layout.leftSidebarCollapsed", true);
|
|
276
|
+
return NAVBAR_COLLAPSED_WIDTH;
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}, []);
|
|
280
|
+
const handleRightResize = React3.useCallback(
|
|
281
|
+
(delta) => {
|
|
282
|
+
setRightSidebarWidth((prev) => {
|
|
283
|
+
const next = clampWidth(prev - delta);
|
|
284
|
+
setPreference("layout.rightSidebarWidth", next);
|
|
285
|
+
return next;
|
|
286
|
+
});
|
|
287
|
+
},
|
|
288
|
+
[clampWidth]
|
|
289
|
+
);
|
|
290
|
+
if (variant === "single" || variant === "stacked") {
|
|
291
|
+
return /* @__PURE__ */ jsx3("div", { className: classes, ...props, children: /* @__PURE__ */ jsxs("div", { className: "layout__container scrollable", children: [
|
|
292
|
+
hero,
|
|
293
|
+
/* @__PURE__ */ jsxs("main", { className: "layout__main", children: [
|
|
294
|
+
header && /* @__PURE__ */ jsx3("header", { className: "layout__header", children: header }),
|
|
295
|
+
children,
|
|
296
|
+
footer && footer
|
|
297
|
+
] }),
|
|
298
|
+
bottomBar && /* @__PURE__ */ jsx3("div", { className: "layout__bottom-bar", children: bottomBar })
|
|
299
|
+
] }) });
|
|
300
|
+
}
|
|
301
|
+
return /* @__PURE__ */ jsxs("div", { className: classes, ...props, children: [
|
|
302
|
+
hasSidebarLeft && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
303
|
+
/* @__PURE__ */ jsx3(
|
|
304
|
+
"aside",
|
|
305
|
+
{
|
|
306
|
+
className: "layout__sidebar layout__sidebar--left scrollable",
|
|
307
|
+
style: { width: leftSidebarWidth },
|
|
308
|
+
children: React3.isValidElement(sidebarLeft) ? React3.cloneElement(sidebarLeft, {
|
|
309
|
+
sidebarWidth: leftSidebarWidth,
|
|
310
|
+
onRequestWidthChange: updateLeftSidebarWidth,
|
|
311
|
+
preferredWidth: leftSidebarPreferredWidth,
|
|
312
|
+
initialCollapsed: leftSidebarCollapsed
|
|
313
|
+
}) : sidebarLeft
|
|
314
|
+
}
|
|
315
|
+
),
|
|
316
|
+
shouldShowResizers && /* @__PURE__ */ jsx3(
|
|
317
|
+
DragHandle,
|
|
318
|
+
{
|
|
319
|
+
orientation: "vertical",
|
|
320
|
+
onResize: handleLeftResize,
|
|
321
|
+
onResizeEnd: handleLeftResizeEnd
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
] }),
|
|
325
|
+
/* @__PURE__ */ jsxs("div", { className: "layout__container scrollable", children: [
|
|
326
|
+
hero,
|
|
327
|
+
/* @__PURE__ */ jsxs("main", { className: "layout__main", children: [
|
|
328
|
+
header && /* @__PURE__ */ jsx3("header", { className: "layout__header", children: header }),
|
|
329
|
+
children,
|
|
330
|
+
footer && /* @__PURE__ */ jsx3("div", { className: "layout__footer", children: footer })
|
|
331
|
+
] }),
|
|
332
|
+
bottomBar && /* @__PURE__ */ jsx3("div", { className: "layout__bottom-bar", children: bottomBar })
|
|
333
|
+
] }),
|
|
334
|
+
hasSidebarRight && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
335
|
+
shouldShowResizers && /* @__PURE__ */ jsx3(DragHandle, { orientation: "vertical", onResize: handleRightResize }),
|
|
336
|
+
/* @__PURE__ */ jsx3(
|
|
337
|
+
"aside",
|
|
338
|
+
{
|
|
339
|
+
className: "layout__sidebar layout__sidebar--right scrollable",
|
|
340
|
+
style: { width: rightSidebarWidth },
|
|
341
|
+
children: React3.isValidElement(sidebarRight) ? React3.cloneElement(sidebarRight, {
|
|
342
|
+
sidebarWidth: rightSidebarWidth,
|
|
343
|
+
onRequestWidthChange: updateRightSidebarWidth
|
|
344
|
+
}) : sidebarRight
|
|
345
|
+
}
|
|
346
|
+
)
|
|
347
|
+
] })
|
|
348
|
+
] });
|
|
349
|
+
};
|
|
350
|
+
export {
|
|
351
|
+
Layout
|
|
352
|
+
};
|
|
@@ -1,8 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/* src/style/components/icons/icons.css */
|
|
2
|
+
.icon {
|
|
3
|
+
display: inline-flex;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
}
|
|
7
|
+
.icon--skeleton {
|
|
8
|
+
background:
|
|
9
|
+
linear-gradient(
|
|
10
|
+
90deg,
|
|
11
|
+
rgba(0, 0, 0, 0.06) 0%,
|
|
12
|
+
rgba(0, 0, 0, 0.03) 50%,
|
|
13
|
+
rgba(0, 0, 0, 0.06) 100%);
|
|
14
|
+
border-radius: 4px;
|
|
15
|
+
animation: hb-skeleton 1.2s ease-in-out infinite;
|
|
16
|
+
}
|
|
17
|
+
@keyframes hb-skeleton {
|
|
18
|
+
0% {
|
|
19
|
+
background-position: 200% 0;
|
|
20
|
+
}
|
|
21
|
+
100% {
|
|
22
|
+
background-position: -200% 0;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
.icon {
|
|
26
|
+
display: inline-block;
|
|
27
|
+
flex-shrink: 0;
|
|
28
|
+
transition: color var(--transition-base, 0.2s ease);
|
|
29
|
+
}
|
|
30
|
+
.icon--interactive {
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
color: var(--color-foreground-1);
|
|
33
|
+
}
|
|
34
|
+
.icon--interactive:hover:not(:disabled) {
|
|
35
|
+
color: var(--color-action-primary-hover);
|
|
36
|
+
}
|
|
37
|
+
.icon--interactive:active:not(:disabled) {
|
|
38
|
+
color: var(--color-action-primary-active);
|
|
39
|
+
}
|
|
40
|
+
.icon--interactive:disabled {
|
|
41
|
+
cursor: not-allowed;
|
|
42
|
+
color: var(--color-foreground-2);
|
|
43
|
+
}
|
|
5
44
|
|
|
45
|
+
/* src/style/components/list/list.css */
|
|
6
46
|
.list {
|
|
7
47
|
display: flex;
|
|
8
48
|
flex-direction: column;
|
|
@@ -10,7 +50,6 @@
|
|
|
10
50
|
padding: 0;
|
|
11
51
|
margin: 0;
|
|
12
52
|
}
|
|
13
|
-
|
|
14
53
|
.list-item {
|
|
15
54
|
display: flex;
|
|
16
55
|
align-items: center;
|
|
@@ -21,54 +60,35 @@
|
|
|
21
60
|
color: var(--color-foreground-1);
|
|
22
61
|
background-color: transparent;
|
|
23
62
|
}
|
|
24
|
-
|
|
25
63
|
.list-item:not(:hover):not(:active) {
|
|
26
64
|
transition: background-color var(--motion-duration-fast) var(--motion-easing-accelerate), color var(--motion-duration-fast) var(--motion-easing-accelerate);
|
|
27
65
|
}
|
|
28
|
-
|
|
29
|
-
/* Interactive items */
|
|
30
66
|
.list-item--interactive {
|
|
31
67
|
cursor: pointer;
|
|
32
68
|
user-select: none;
|
|
33
69
|
}
|
|
34
|
-
|
|
35
70
|
.list-item--interactive:hover:not(.list-item--disabled) {
|
|
36
71
|
background-color: var(--color-accent-hover);
|
|
37
72
|
}
|
|
38
|
-
|
|
39
73
|
.list-item--interactive:active:not(.list-item--disabled) {
|
|
40
74
|
background-color: var(--color-accent-active);
|
|
41
75
|
}
|
|
42
|
-
|
|
43
|
-
/* Focus state - uses action colors */
|
|
44
76
|
.list-item--interactive:focus-visible {
|
|
45
77
|
outline: 2px solid var(--color-action-primary);
|
|
46
78
|
outline-offset: 2px;
|
|
47
79
|
}
|
|
48
|
-
|
|
49
|
-
/* Selected state */
|
|
50
80
|
.list-item--selected {
|
|
51
|
-
background-color: hsla(
|
|
52
|
-
var(--accent-hue),
|
|
53
|
-
var(--accent-saturation),
|
|
54
|
-
var(--accent-lightness),
|
|
55
|
-
0.12
|
|
56
|
-
);
|
|
81
|
+
background-color: hsla(var(--accent-hue), var(--accent-saturation), var(--accent-lightness), 0.12);
|
|
57
82
|
color: var(--color-on-primary);
|
|
58
83
|
font-weight: 500;
|
|
59
84
|
}
|
|
60
|
-
|
|
61
85
|
.list-item--selected:hover:not(.list-item--disabled) {
|
|
62
86
|
background-color: var(--color-accent-active);
|
|
63
87
|
}
|
|
64
|
-
|
|
65
|
-
/* Disabled state */
|
|
66
88
|
.list-item--disabled {
|
|
67
89
|
cursor: not-allowed;
|
|
68
90
|
opacity: 0.5;
|
|
69
91
|
}
|
|
70
|
-
|
|
71
|
-
/* Icon */
|
|
72
92
|
.list-item__icon {
|
|
73
93
|
display: flex;
|
|
74
94
|
align-items: center;
|
|
@@ -76,12 +96,9 @@
|
|
|
76
96
|
flex-shrink: 0;
|
|
77
97
|
color: var(--color-foreground-2);
|
|
78
98
|
}
|
|
79
|
-
|
|
80
99
|
.list-item--selected .list-item__icon {
|
|
81
100
|
color: var(--color-on-primary);
|
|
82
101
|
}
|
|
83
|
-
|
|
84
|
-
/* Content */
|
|
85
102
|
.list-item__content {
|
|
86
103
|
flex: 1;
|
|
87
104
|
font-size: var(--font-size-base);
|
|
@@ -89,8 +106,6 @@
|
|
|
89
106
|
flex-direction: column;
|
|
90
107
|
gap: var(--spacing-1);
|
|
91
108
|
}
|
|
92
|
-
|
|
93
|
-
/* Category */
|
|
94
109
|
.list-item__category {
|
|
95
110
|
font-size: var(--font-size-xs);
|
|
96
111
|
color: var(--color-foreground-3);
|
|
@@ -98,14 +113,11 @@
|
|
|
98
113
|
letter-spacing: 0.5px;
|
|
99
114
|
font-weight: 600;
|
|
100
115
|
}
|
|
101
|
-
|
|
102
|
-
/* Category section */
|
|
103
116
|
.list-category {
|
|
104
117
|
display: flex;
|
|
105
118
|
flex-direction: column;
|
|
106
119
|
gap: var(--spacing-2);
|
|
107
120
|
}
|
|
108
|
-
|
|
109
121
|
.list-category__title {
|
|
110
122
|
font-size: var(--font-size-sm);
|
|
111
123
|
font-weight: 600;
|
|
@@ -114,14 +126,11 @@
|
|
|
114
126
|
text-transform: uppercase;
|
|
115
127
|
letter-spacing: 0.5px;
|
|
116
128
|
}
|
|
117
|
-
|
|
118
129
|
.list-category__items {
|
|
119
130
|
display: flex;
|
|
120
131
|
flex-direction: column;
|
|
121
132
|
gap: var(--spacing-1);
|
|
122
133
|
}
|
|
123
|
-
|
|
124
|
-
/* Selected indicator */
|
|
125
134
|
.list-item__indicator {
|
|
126
135
|
display: flex;
|
|
127
136
|
align-items: center;
|
|
@@ -129,12 +138,9 @@
|
|
|
129
138
|
flex-shrink: 0;
|
|
130
139
|
color: var(--color-action-primary);
|
|
131
140
|
}
|
|
132
|
-
|
|
133
|
-
/* Dark theme adjustments */
|
|
134
|
-
:root[data-theme="dark"] .list-item--interactive:hover:not(.list-item--disabled) {
|
|
141
|
+
:root[data-theme=dark] .list-item--interactive:hover:not(.list-item--disabled) {
|
|
135
142
|
background-color: var(--color-accent-hover);
|
|
136
143
|
}
|
|
137
|
-
|
|
138
|
-
:root[data-theme="dark"] .list-item--selected {
|
|
144
|
+
:root[data-theme=dark] .list-item--selected {
|
|
139
145
|
background-color: var(--color-accent-active);
|
|
140
146
|
}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ListItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Item content
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Icon name from our icon library
|
|
10
|
+
*/
|
|
11
|
+
icon?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the item is selected
|
|
14
|
+
*/
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the item is disabled
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Click handler
|
|
22
|
+
*/
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Custom class name
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Category label for organizing items (display only)
|
|
30
|
+
*/
|
|
31
|
+
category?: string;
|
|
32
|
+
}
|
|
33
|
+
declare const ListItem: React.FC<ListItemProps>;
|
|
34
|
+
interface ListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
35
|
+
/**
|
|
36
|
+
* List items
|
|
37
|
+
*/
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Custom class name
|
|
41
|
+
*/
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
declare const List: React.FC<ListProps>;
|
|
45
|
+
|
|
46
|
+
export { List, ListItem, type ListItemProps, type ListProps };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
interface ListItemProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/**
|
|
5
|
+
* Item content
|
|
6
|
+
*/
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Icon name from our icon library
|
|
10
|
+
*/
|
|
11
|
+
icon?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Whether the item is selected
|
|
14
|
+
*/
|
|
15
|
+
selected?: boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Whether the item is disabled
|
|
18
|
+
*/
|
|
19
|
+
disabled?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Click handler
|
|
22
|
+
*/
|
|
23
|
+
onClick?: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Custom class name
|
|
26
|
+
*/
|
|
27
|
+
className?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Category label for organizing items (display only)
|
|
30
|
+
*/
|
|
31
|
+
category?: string;
|
|
32
|
+
}
|
|
33
|
+
declare const ListItem: React.FC<ListItemProps>;
|
|
34
|
+
interface ListProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
35
|
+
/**
|
|
36
|
+
* List items
|
|
37
|
+
*/
|
|
38
|
+
children: React.ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Custom class name
|
|
41
|
+
*/
|
|
42
|
+
className?: string;
|
|
43
|
+
}
|
|
44
|
+
declare const List: React.FC<ListProps>;
|
|
45
|
+
|
|
46
|
+
export { List, ListItem, type ListItemProps, type ListProps };
|