@1889ca/ui 0.4.0 → 0.5.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@1889ca/ui",
3
- "version": "0.4.0",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "module": "src/index.js",
@@ -0,0 +1,117 @@
1
+ /** Contract: contracts/packages-ui-components/rules.md */
2
+
3
+ .ui-panel {
4
+ background: rgba(18, 18, 24, 0.8);
5
+ backdrop-filter: blur(var(--ui-glass-blur-heavy));
6
+ border: 1px solid var(--ui-border);
7
+ border-top-color: var(--ui-border-strong);
8
+ border-radius: var(--ui-radius-lg);
9
+ box-shadow: var(--ui-shadow-float);
10
+ display: flex;
11
+ flex-direction: column;
12
+ min-width: 120px;
13
+ overflow: hidden;
14
+ }
15
+
16
+ /* ── Titlebar ── */
17
+
18
+ .ui-panel-titlebar {
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: space-between;
22
+ padding: 0.4rem 0.65rem;
23
+ border-bottom: 1px solid var(--ui-border);
24
+ flex-shrink: 0;
25
+ }
26
+
27
+ .ui-panel-title {
28
+ font-size: 0.7rem;
29
+ font-weight: 600;
30
+ color: var(--ui-text-muted);
31
+ text-transform: uppercase;
32
+ letter-spacing: 0.06em;
33
+ }
34
+
35
+ .ui-panel-actions {
36
+ display: flex;
37
+ align-items: center;
38
+ gap: 0.35rem;
39
+ }
40
+
41
+ .ui-panel-close {
42
+ background: none;
43
+ border: none;
44
+ color: var(--ui-text-subtle);
45
+ font-size: 0.9rem;
46
+ cursor: pointer;
47
+ line-height: 1;
48
+ padding: 0.1rem 0.2rem;
49
+ border-radius: var(--ui-radius-sm);
50
+ transition: color 0.15s, background 0.15s;
51
+ }
52
+
53
+ .ui-panel-close:hover {
54
+ color: var(--ui-text);
55
+ background: var(--ui-surface-raised);
56
+ }
57
+
58
+ /* ── Tabs ── */
59
+
60
+ .ui-panel-tabs {
61
+ display: flex;
62
+ flex-shrink: 0;
63
+ padding: 0 0.35rem;
64
+ gap: 2px;
65
+ border-bottom: 1px solid var(--ui-border);
66
+ }
67
+
68
+ .ui-panel-tab {
69
+ position: relative;
70
+ padding: 0.45rem 0.7rem;
71
+ background: none;
72
+ border: none;
73
+ color: var(--ui-text-subtle);
74
+ font-size: 0.7rem;
75
+ font-weight: 500;
76
+ text-transform: uppercase;
77
+ letter-spacing: 0.05em;
78
+ cursor: pointer;
79
+ transition: color 0.15s;
80
+ }
81
+
82
+ .ui-panel-tab::after {
83
+ content: '';
84
+ position: absolute;
85
+ left: 0.35rem;
86
+ right: 0.35rem;
87
+ bottom: -1px;
88
+ height: 2px;
89
+ border-radius: 1px;
90
+ background: transparent;
91
+ transition: background 0.2s var(--ui-ease);
92
+ }
93
+
94
+ .ui-panel-tab:hover {
95
+ color: var(--ui-text-muted);
96
+ }
97
+
98
+ .ui-panel-tab--active {
99
+ color: var(--ui-accent);
100
+ }
101
+
102
+ .ui-panel-tab--active::after {
103
+ background: var(--ui-accent);
104
+ }
105
+
106
+ /* ── Body ── */
107
+
108
+ .ui-panel-body {
109
+ flex: 1;
110
+ min-height: 0;
111
+ padding: 0.5rem 0.65rem;
112
+ overflow: auto;
113
+ }
114
+
115
+ .ui-panel-body--flush {
116
+ padding: 0;
117
+ }
@@ -0,0 +1,51 @@
1
+ /** Contract: contracts/packages-ui-components/rules.md */
2
+
3
+ /**
4
+ * Static glass panel — same chrome as DraggablePanel but positioned in flow.
5
+ * Use for sidebar sections, inspector panels, toolboxes, etc.
6
+ *
7
+ * @param {string} title - Titlebar text (optional)
8
+ * @param {Array} tabs - [{id, label}] tab definitions (optional)
9
+ * @param {string} activeTab - Currently active tab id
10
+ * @param {function} onTabChange - Called with tab id on click
11
+ * @param {ReactNode} children - Panel body content
12
+ * @param {ReactNode} actions - Extra elements in the titlebar (right side, before close)
13
+ * @param {function} onClose - Close button handler (omit to hide close button)
14
+ * @param {string} className - Additional class names
15
+ * @param {boolean} flush - If true, removes body padding (for custom layouts)
16
+ */
17
+ export default function Panel({ title, tabs, activeTab, onTabChange, children, actions, onClose, className, flush }) {
18
+ const hasHeader = title || actions || onClose;
19
+ const hasTabs = tabs && tabs.length > 0;
20
+
21
+ return (
22
+ <div className={`ui-panel${className ? ` ${className}` : ''}`}>
23
+ {hasHeader && (
24
+ <div className="ui-panel-titlebar">
25
+ {title && <span className="ui-panel-title">{title}</span>}
26
+ <div className="ui-panel-actions">
27
+ {actions}
28
+ {onClose && <button className="ui-panel-close" type="button" onClick={onClose}>&times;</button>}
29
+ </div>
30
+ </div>
31
+ )}
32
+ {hasTabs && (
33
+ <nav className="ui-panel-tabs">
34
+ {tabs.map((tab) => (
35
+ <button
36
+ key={tab.id}
37
+ type="button"
38
+ className={`ui-panel-tab${activeTab === tab.id ? ' ui-panel-tab--active' : ''}`}
39
+ onClick={() => onTabChange?.(tab.id)}
40
+ >
41
+ {tab.label}
42
+ </button>
43
+ ))}
44
+ </nav>
45
+ )}
46
+ <div className={`ui-panel-body${flush ? ' ui-panel-body--flush' : ''}`}>
47
+ {children}
48
+ </div>
49
+ </div>
50
+ );
51
+ }
package/src/index.js CHANGED
@@ -20,6 +20,7 @@ import './components/LoginCard.css';
20
20
  import './components/PasskeyLoginPage.css';
21
21
  import './components/UserMenu.css';
22
22
  import './components/StatusBar.css';
23
+ import './components/Panel.css';
23
24
 
24
25
  /* Components */
25
26
  export { default as ContextMenu } from './components/ContextMenu.jsx';
@@ -38,6 +39,7 @@ export { default as LoginCard } from './components/LoginCard.jsx';
38
39
  export { default as PasskeyLoginPage } from './components/PasskeyLoginPage.jsx';
39
40
  export { default as UserMenu } from './components/UserMenu.jsx';
40
41
  export { default as StatusBar } from './components/StatusBar.jsx';
42
+ export { default as Panel } from './components/Panel.jsx';
41
43
 
42
44
  /* Auth */
43
45
  export { AuthProvider, useAuth } from './auth/AuthProvider.jsx';