@syscore/ui-library 1.7.7 → 1.8.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/client/components/ui/input.tsx +1 -1
- package/client/components/ui/label.tsx +2 -2
- package/client/components/ui/tag.tsx +8 -8
- package/client/components/ui/toggle.tsx +16 -24
- package/client/global.css +11 -13
- package/client/lib/utils.ts +6 -0
- package/client/ui/Panel.stories.tsx +509 -435
- package/dist/index.cjs.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.es.js +28 -27
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { motion } from "motion/react";
|
|
|
3
3
|
import { AnimatePresence } from "motion/react";
|
|
4
4
|
import { getConceptColor } from "../lib/concept-colors";
|
|
5
5
|
import { CodeBadge } from "../components/ui/code-badge";
|
|
6
|
-
import { cn } from "../lib/utils";
|
|
6
|
+
import { capitalize, cn } from "../lib/utils";
|
|
7
7
|
import { Tag } from "../components/ui/tag";
|
|
8
8
|
import { CONCEPT_ICONS } from "../lib/concept-icons";
|
|
9
9
|
import { conceptColors } from "../lib/concept-colors";
|
|
@@ -12,326 +12,365 @@ import { useState } from "react";
|
|
|
12
12
|
import { Label } from "../components/ui/label";
|
|
13
13
|
import { Toggle } from "../components/ui/toggle";
|
|
14
14
|
|
|
15
|
-
|
|
16
15
|
// Order of concepts for display
|
|
17
16
|
const conceptOrder: ConceptSlug[] = [
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
17
|
+
"air",
|
|
18
|
+
"water",
|
|
19
|
+
"nourishment",
|
|
20
|
+
"light",
|
|
21
|
+
"movement",
|
|
22
|
+
"thermal-comfort",
|
|
23
|
+
"sound",
|
|
24
|
+
"materials",
|
|
25
|
+
"community",
|
|
26
|
+
"mind",
|
|
27
|
+
"innovation",
|
|
29
28
|
];
|
|
30
29
|
|
|
31
|
-
|
|
32
30
|
// Wrapper component that manages state and accepts initial values from args
|
|
33
31
|
const ExploreSidePanelView = (args: any) => {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
backgroundColor: activeColor.contrast || activeColor.solid,
|
|
175
|
-
borderColor: activeColor.contrast || activeColor.solid,
|
|
176
|
-
color: "white",
|
|
177
|
-
borderWidth: "3px",
|
|
178
|
-
}
|
|
179
|
-
: isOutlined
|
|
180
|
-
? {
|
|
181
|
-
backgroundColor: "white",
|
|
182
|
-
borderColor: activeColor.contrast || activeColor.solid,
|
|
183
|
-
color: activeColor.contrast || activeColor.solid,
|
|
184
|
-
borderWidth: "3px",
|
|
185
|
-
}
|
|
186
|
-
: !isSelected
|
|
187
|
-
? {
|
|
188
|
-
backgroundColor: "var(--color-blue-100)",
|
|
189
|
-
color: "var(--color-blue-600)",
|
|
190
|
-
borderColor: "var(--color-blue-100)",
|
|
191
|
-
borderWidth: "3px",
|
|
192
|
-
}
|
|
193
|
-
: {
|
|
194
|
-
borderWidth: "3px",
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
/>
|
|
198
|
-
</button>
|
|
199
|
-
);
|
|
200
|
-
})}
|
|
201
|
-
</div>
|
|
202
|
-
</motion.section>
|
|
32
|
+
const {
|
|
33
|
+
concepts,
|
|
34
|
+
themes,
|
|
35
|
+
strategies,
|
|
36
|
+
selectedConcept,
|
|
37
|
+
selectedTheme,
|
|
38
|
+
selectedStrategy,
|
|
39
|
+
onConceptClick,
|
|
40
|
+
onThemeClick,
|
|
41
|
+
onStrategyClick,
|
|
42
|
+
scope,
|
|
43
|
+
onScopeChange,
|
|
44
|
+
activePursuits,
|
|
45
|
+
onPursuitToggle,
|
|
46
|
+
} = args;
|
|
47
|
+
|
|
48
|
+
// Local UI state (hover)
|
|
49
|
+
const [hoveredConcept, setHoveredConcept] = useState<ConceptSlug | null>(
|
|
50
|
+
null,
|
|
51
|
+
);
|
|
52
|
+
const [hoveredTheme, setHoveredTheme] = useState<string | null>(null);
|
|
53
|
+
const [hoveredStrategy, setHoveredStrategy] = useState<string | null>(null);
|
|
54
|
+
|
|
55
|
+
// Derived data
|
|
56
|
+
const conceptsByKey = new Map(concepts.map((c) => [c.conceptKey, c]));
|
|
57
|
+
const activeColor = getConceptColor(selectedConcept || "community");
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
<LayoutGroup>
|
|
61
|
+
<Card className="space-y-2 rounded-r-none pt-8 border-r-0">
|
|
62
|
+
{/* CONCEPT Section */}
|
|
63
|
+
<motion.section layout="position" className="flex flex-col gap-3">
|
|
64
|
+
<div className="flex items-center min-w-0">
|
|
65
|
+
<Label className="pr-1">CONCEPT</Label>
|
|
66
|
+
|
|
67
|
+
<div className="relative min-w-0 flex-1 self-stretch">
|
|
68
|
+
<AnimatePresence mode="wait">
|
|
69
|
+
{hoveredConcept && (
|
|
70
|
+
<motion.div
|
|
71
|
+
key={hoveredConcept}
|
|
72
|
+
initial={{ opacity: 0, x: -4 }}
|
|
73
|
+
animate={{ opacity: 1, x: 0 }}
|
|
74
|
+
exit={{ opacity: 0, x: 4 }}
|
|
75
|
+
transition={{ duration: 0.15 }}
|
|
76
|
+
className="absolute top-1/2 -translate-y-1/2 left-0 right-0 body-small"
|
|
77
|
+
style={{ willChange: "opacity, transform" }}
|
|
78
|
+
>
|
|
79
|
+
<span className="line-clamp-1">
|
|
80
|
+
·{" "}
|
|
81
|
+
{capitalize(
|
|
82
|
+
concepts.find((c) => c.conceptKey === hoveredConcept)
|
|
83
|
+
?.name ?? "",
|
|
84
|
+
)}
|
|
85
|
+
</span>
|
|
86
|
+
</motion.div>
|
|
87
|
+
)}
|
|
88
|
+
</AnimatePresence>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
|
|
92
|
+
<div className="grid grid-cols-3 lg:grid-cols-5 max-w-max gap-2">
|
|
93
|
+
{conceptOrder.map((slug) => {
|
|
94
|
+
const Icon = CONCEPT_ICONS[slug];
|
|
95
|
+
const isSelected = selectedConcept === slug;
|
|
96
|
+
const isHovered = hoveredConcept === slug;
|
|
97
|
+
const isFilled = (isSelected && !selectedTheme) || isHovered;
|
|
98
|
+
const isOutlined = isSelected && !!selectedTheme && !isHovered;
|
|
99
|
+
const color = getConceptColor(slug);
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<button
|
|
103
|
+
key={slug}
|
|
104
|
+
onClick={() => onConceptClick(slug)}
|
|
105
|
+
onMouseEnter={() => setHoveredConcept(slug)}
|
|
106
|
+
onMouseLeave={() => setHoveredConcept(null)}
|
|
107
|
+
className="rounded-full transition-all duration-200 size-12 flex items-center justify-center cursor-pointer"
|
|
108
|
+
style={(() => {
|
|
109
|
+
if (isOutlined) {
|
|
110
|
+
return {
|
|
111
|
+
outline: `3px solid ${color.contrast || color.solid}`,
|
|
112
|
+
outlineOffset: "-3px",
|
|
113
|
+
backgroundColor: "white",
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
if (isFilled) {
|
|
117
|
+
return {
|
|
118
|
+
backgroundColor: color.contrast || color.solid,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
return undefined;
|
|
122
|
+
})()}
|
|
123
|
+
aria-label={conceptsByKey.get(slug)?.name}
|
|
124
|
+
>
|
|
125
|
+
<Icon
|
|
126
|
+
active={isFilled}
|
|
127
|
+
outlined={isOutlined}
|
|
128
|
+
className="size-12"
|
|
129
|
+
/>
|
|
130
|
+
</button>
|
|
131
|
+
);
|
|
132
|
+
})}
|
|
133
|
+
</div>
|
|
134
|
+
</motion.section>
|
|
135
|
+
|
|
136
|
+
{/* THEME Section - Animated reveal */}
|
|
137
|
+
<AnimatePresence mode="wait">
|
|
138
|
+
{themes.length > 0 && (
|
|
139
|
+
<motion.section
|
|
140
|
+
key="theme-section"
|
|
141
|
+
layout="position"
|
|
142
|
+
initial={{ opacity: 0 }}
|
|
143
|
+
animate={{ opacity: 1 }}
|
|
144
|
+
exit={{ opacity: 0 }}
|
|
145
|
+
transition={{ duration: 0.2 }}
|
|
146
|
+
className="flex flex-col gap-3"
|
|
147
|
+
style={{ willChange: "opacity" }}
|
|
148
|
+
>
|
|
149
|
+
<div className="flex items-center min-w-0">
|
|
150
|
+
<Label className="pr-1">THEME</Label>
|
|
151
|
+
|
|
152
|
+
<div className="relative min-w-0 flex-1 self-stretch">
|
|
153
|
+
<AnimatePresence mode="wait">
|
|
154
|
+
{hoveredTheme && (
|
|
155
|
+
<motion.div
|
|
156
|
+
key={hoveredTheme}
|
|
157
|
+
initial={{ opacity: 0, x: -4 }}
|
|
158
|
+
animate={{ opacity: 1, x: 0 }}
|
|
159
|
+
exit={{ opacity: 0, x: 4 }}
|
|
160
|
+
transition={{ duration: 0.15 }}
|
|
161
|
+
className="absolute top-1/2 -translate-y-1/2 left-0 right-0 body-small"
|
|
162
|
+
style={{ willChange: "opacity, transform" }}
|
|
163
|
+
>
|
|
164
|
+
<span className="line-clamp-1">
|
|
165
|
+
·{" "}
|
|
166
|
+
{capitalize(
|
|
167
|
+
themes.find((t) => t.code === hoveredTheme)?.name ??
|
|
168
|
+
"",
|
|
169
|
+
)}
|
|
170
|
+
</span>
|
|
171
|
+
</motion.div>
|
|
203
172
|
)}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
173
|
+
</AnimatePresence>
|
|
174
|
+
</div>
|
|
175
|
+
</div>
|
|
176
|
+
<div className="grid grid-cols-3 lg:grid-cols-5 max-w-max gap-2">
|
|
177
|
+
{themes.map((theme) => {
|
|
178
|
+
const isSelected = selectedTheme === theme.code;
|
|
179
|
+
const isFilled = isSelected && !selectedStrategy;
|
|
180
|
+
const isOutlined = isSelected && !!selectedStrategy;
|
|
181
|
+
|
|
182
|
+
return (
|
|
183
|
+
<button
|
|
184
|
+
key={theme.code}
|
|
185
|
+
onClick={() => onThemeClick(theme.code)}
|
|
186
|
+
onMouseEnter={() => setHoveredTheme(theme.code)}
|
|
187
|
+
onMouseLeave={() => setHoveredTheme(null)}
|
|
188
|
+
className="cursor-pointer"
|
|
189
|
+
>
|
|
190
|
+
<CodeBadge
|
|
191
|
+
code={theme.code}
|
|
192
|
+
className={cn(!isSelected && "hover:border-blue-300")}
|
|
193
|
+
style={
|
|
194
|
+
isFilled
|
|
195
|
+
? {
|
|
196
|
+
backgroundColor:
|
|
197
|
+
activeColor.contrast || activeColor.solid,
|
|
198
|
+
borderColor:
|
|
199
|
+
activeColor.contrast || activeColor.solid,
|
|
200
|
+
color: "white",
|
|
201
|
+
borderWidth: "3px",
|
|
202
|
+
}
|
|
203
|
+
: isOutlined
|
|
204
|
+
? {
|
|
205
|
+
backgroundColor: "white",
|
|
206
|
+
borderColor:
|
|
207
|
+
activeColor.contrast || activeColor.solid,
|
|
208
|
+
color:
|
|
209
|
+
activeColor.contrast || activeColor.solid,
|
|
210
|
+
borderWidth: "3px",
|
|
211
|
+
}
|
|
212
|
+
: !isSelected
|
|
213
|
+
? {
|
|
214
|
+
backgroundColor: "var(--color-blue-100)",
|
|
215
|
+
color: "var(--color-blue-600)",
|
|
216
|
+
borderColor: "var(--color-blue-100)",
|
|
217
|
+
borderWidth: "3px",
|
|
218
|
+
}
|
|
219
|
+
: {
|
|
220
|
+
borderWidth: "3px",
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
/>
|
|
224
|
+
</button>
|
|
225
|
+
);
|
|
226
|
+
})}
|
|
227
|
+
</div>
|
|
228
|
+
</motion.section>
|
|
229
|
+
)}
|
|
230
|
+
</AnimatePresence>
|
|
231
|
+
|
|
232
|
+
{/* STRATEGY Section - Animated reveal */}
|
|
233
|
+
<AnimatePresence mode="wait">
|
|
234
|
+
{strategies.length > 0 && (
|
|
235
|
+
<motion.section
|
|
236
|
+
key="strategy-section"
|
|
237
|
+
layout="position"
|
|
238
|
+
initial={{ opacity: 0 }}
|
|
239
|
+
animate={{ opacity: 1 }}
|
|
240
|
+
exit={{ opacity: 0 }}
|
|
241
|
+
transition={{ duration: 0.2 }}
|
|
242
|
+
className="flex flex-col gap-3"
|
|
243
|
+
style={{ willChange: "opacity" }}
|
|
244
|
+
>
|
|
245
|
+
<div className="flex items-center min-w-0">
|
|
246
|
+
<Label className="pr-1">STRATEGY</Label>
|
|
247
|
+
|
|
248
|
+
<div className="relative min-w-0 flex-1 self-stretch mt-px">
|
|
249
|
+
<AnimatePresence mode="wait">
|
|
250
|
+
{hoveredStrategy && (
|
|
251
|
+
<motion.div
|
|
252
|
+
key={hoveredStrategy}
|
|
253
|
+
initial={{ opacity: 0, x: -4 }}
|
|
254
|
+
animate={{ opacity: 1, x: 0 }}
|
|
255
|
+
exit={{ opacity: 0, x: 4 }}
|
|
256
|
+
transition={{ duration: 0.15 }}
|
|
257
|
+
className="absolute top-1/2 -translate-y-1/2 left-0 right-0 body-small"
|
|
258
|
+
style={{ willChange: "opacity, transform" }}
|
|
259
|
+
>
|
|
260
|
+
<span className="line-clamp-1">
|
|
261
|
+
·{" "}
|
|
262
|
+
{capitalize(
|
|
263
|
+
strategies.find((s) => s.code === hoveredStrategy)
|
|
264
|
+
?.name ?? "",
|
|
265
|
+
)}
|
|
266
|
+
</span>
|
|
267
|
+
</motion.div>
|
|
276
268
|
)}
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
<
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
269
|
+
</AnimatePresence>
|
|
270
|
+
</div>
|
|
271
|
+
</div>
|
|
272
|
+
<div className="grid grid-cols-3 sm:grid-cols-5 max-w-max gap-2">
|
|
273
|
+
{strategies.map((strategy) => {
|
|
274
|
+
const isSelected = selectedStrategy === strategy.code;
|
|
275
|
+
|
|
276
|
+
return (
|
|
277
|
+
<button
|
|
278
|
+
key={strategy.code}
|
|
279
|
+
onClick={() => onStrategyClick(strategy.code)}
|
|
280
|
+
onMouseEnter={() => setHoveredStrategy(strategy.code)}
|
|
281
|
+
onMouseLeave={() => setHoveredStrategy(null)}
|
|
282
|
+
className="cursor-pointer"
|
|
283
|
+
>
|
|
284
|
+
<CodeBadge
|
|
285
|
+
code={strategy.code}
|
|
286
|
+
className={cn(
|
|
287
|
+
!isSelected && "hover:border-blue-300",
|
|
288
|
+
"border-[3px]",
|
|
289
|
+
)}
|
|
290
|
+
style={
|
|
291
|
+
isSelected
|
|
292
|
+
? {
|
|
293
|
+
backgroundColor:
|
|
294
|
+
activeColor.contrast || activeColor.solid,
|
|
295
|
+
borderColor:
|
|
296
|
+
activeColor.contrast || activeColor.solid,
|
|
297
|
+
color: "white",
|
|
298
|
+
borderWidth: "3px",
|
|
299
|
+
}
|
|
300
|
+
: {
|
|
301
|
+
backgroundColor: "var(--color-blue-100)",
|
|
302
|
+
color: "var(--color-blue-600)",
|
|
303
|
+
borderColor: "var(--color-blue-100)",
|
|
304
|
+
borderWidth: "3px",
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
/>
|
|
308
|
+
</button>
|
|
309
|
+
);
|
|
310
|
+
})}
|
|
311
|
+
</div>
|
|
312
|
+
</motion.section>
|
|
313
|
+
)}
|
|
314
|
+
</AnimatePresence>
|
|
315
|
+
|
|
316
|
+
{/* SCOPE Section */}
|
|
317
|
+
<motion.section
|
|
318
|
+
layout="position"
|
|
319
|
+
transition={{ duration: 0.2, ease: [0.25, 0.46, 0.45, 0.94] }}
|
|
320
|
+
className="flex flex-col gap-3 items-start max-w-max"
|
|
321
|
+
>
|
|
322
|
+
<Label>SCOPE</Label>
|
|
323
|
+
<div className="bg-white border border-gray-100 rounded-full inline-flex">
|
|
324
|
+
<Toggle
|
|
325
|
+
options={[
|
|
326
|
+
{ label: "Non-core", value: "non-core" },
|
|
327
|
+
{ label: "Core", value: "core" },
|
|
328
|
+
]}
|
|
329
|
+
value={scope}
|
|
330
|
+
onValueChange={(value) =>
|
|
331
|
+
onScopeChange(value as "non-core" | "core")
|
|
332
|
+
}
|
|
333
|
+
/>
|
|
334
|
+
</div>
|
|
335
|
+
</motion.section>
|
|
336
|
+
|
|
337
|
+
{/* PURSUIT Section */}
|
|
338
|
+
<motion.section
|
|
339
|
+
layout="position"
|
|
340
|
+
transition={{ duration: 0.2, ease: [0.25, 0.46, 0.45, 0.94] }}
|
|
341
|
+
className="flex flex-col gap-3 items-start max-w-max"
|
|
342
|
+
>
|
|
343
|
+
<Label>PURSUIT</Label>
|
|
344
|
+
<div className=" inline-flex gap-3">
|
|
345
|
+
<Tag
|
|
346
|
+
variant="light"
|
|
347
|
+
active={activePursuits.has("certification")}
|
|
348
|
+
onClick={() => onPursuitToggle("certification")}
|
|
349
|
+
>
|
|
350
|
+
Certification
|
|
351
|
+
</Tag>
|
|
352
|
+
<Tag
|
|
353
|
+
variant="light"
|
|
354
|
+
active={activePursuits.has("rating")}
|
|
355
|
+
onClick={() => onPursuitToggle("rating")}
|
|
356
|
+
>
|
|
357
|
+
Rating
|
|
358
|
+
</Tag>
|
|
359
|
+
</div>
|
|
360
|
+
</motion.section>
|
|
361
|
+
</Card>
|
|
362
|
+
</LayoutGroup>
|
|
363
|
+
);
|
|
325
364
|
};
|
|
326
365
|
|
|
327
366
|
export const ExploreSidePanel = {
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
367
|
+
args: {
|
|
368
|
+
mockSearchParams: "concept=community&theme=C8",
|
|
369
|
+
},
|
|
370
|
+
parameters: {
|
|
371
|
+
docs: {
|
|
372
|
+
source: {
|
|
373
|
+
code: `<ExploreSidePanelView
|
|
335
374
|
concepts={concepts}
|
|
336
375
|
themes={themes}
|
|
337
376
|
strategies={strategies}
|
|
@@ -346,135 +385,170 @@ export const ExploreSidePanel = {
|
|
|
346
385
|
activePursuits={activePursuits}
|
|
347
386
|
onPursuitToggle={handlePursuitToggle}
|
|
348
387
|
/>`,
|
|
349
|
-
|
|
350
|
-
},
|
|
351
|
-
},
|
|
352
|
-
render: (args: any) => {
|
|
353
|
-
// Mock searchParams with state for Storybook //
|
|
354
|
-
const [urlState, setUrlState] = useState(args.mockSearchParams || "");
|
|
355
|
-
const searchParams = new URLSearchParams(urlState);
|
|
356
|
-
//In real app: const searchParams = useSearchParams();
|
|
357
|
-
|
|
358
|
-
// URL state
|
|
359
|
-
const selectedConcept = searchParams.get("concept") as ConceptSlug | null;
|
|
360
|
-
const selectedTheme = searchParams.get("theme");
|
|
361
|
-
const selectedStrategy = searchParams.get("strategy");
|
|
362
|
-
|
|
363
|
-
// Progressive data fetching //
|
|
364
|
-
// const { data: concepts = [] } = useConceptListQuery();
|
|
365
|
-
// const { data: themes = [] } = useThemesQuery(selectedConcept);
|
|
366
|
-
// const { data: strategies = [] } = useStrategiesQuery(selectedConcept, selectedTheme);
|
|
367
|
-
|
|
368
|
-
// Mock data for Storybook
|
|
369
|
-
const concepts = [{ "conceptKey": "mind", "name": "Mind" }, { "conceptKey": "community", "name": "Community" }, { "conceptKey": "movement", "name": "Movement" }, { "conceptKey": "water", "name": "Water" }, { "conceptKey": "air", "name": "Air" }, { "conceptKey": "light", "name": "Light" }, { "conceptKey": "thermal-comfort", "name": "Thermal Comfort" }, { "conceptKey": "nourishment", "name": "Nourishment" }, { "conceptKey": "sound", "name": "Sound" }, { "conceptKey": "materials", "name": "Materials" }, { "conceptKey": "innovation", "name": "Innovation" }];
|
|
370
|
-
|
|
371
|
-
// Themes only load when concept is selected
|
|
372
|
-
const themes = selectedConcept ? [{ "code": "C1", "name": "Community and occupant engagement" }, { "code": "C2", "name": "Emergency preparedness" }, { "code": "C3", "name": "Fair housing" }, { "code": "C4", "name": "Family and parental support" }, { "code": "C5", "name": "Health benefits and services" }, { "code": "C6", "name": "Health promotion" }, { "code": "C7", "name": "Inclusive design" }, { "code": "C8", "name": "Occupant experience" }, { "code": "C9", "name": "Organizational practices" }, { "code": "C10", "name": "Personal-professional development" }, { "code": "C11", "name": "Supportive construction practices" }] : [];
|
|
373
|
-
|
|
374
|
-
// Strategies only load when theme is selected
|
|
375
|
-
const strategies = selectedTheme ? [{ "code": "C8.1", "name": "Collect additional occupant research" }, { "code": "C8.2", "name": "Conduct qualitative research" }, { "code": "C8.3", "name": "Develop annual action plan" }, { "code": "C8.4", "name": "Perform annual occupant survey" }] : [];
|
|
376
|
-
|
|
377
|
-
// Local state
|
|
378
|
-
const [scope, setScope] = useState<"core" | "non-core">("core");
|
|
379
|
-
const [activePursuits, setActivePursuits] = useState<Set<"certification" | "rating">>(
|
|
380
|
-
new Set(["certification"])
|
|
381
|
-
);
|
|
382
|
-
|
|
383
|
-
// Navigation handlers
|
|
384
|
-
const handleConceptClick = (slug: ConceptSlug) => {
|
|
385
|
-
const params = new URLSearchParams(searchParams.toString());
|
|
386
|
-
|
|
387
|
-
if (selectedConcept === slug) {
|
|
388
|
-
params.delete("concept");
|
|
389
|
-
params.delete("theme");
|
|
390
|
-
params.delete("strategy");
|
|
391
|
-
} else {
|
|
392
|
-
params.set("concept", slug);
|
|
393
|
-
params.delete("theme");
|
|
394
|
-
params.delete("strategy");
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
setUrlState(params.toString());
|
|
398
|
-
// In real app: router.push(`/explore?${params.toString()}`);
|
|
399
|
-
};
|
|
400
|
-
|
|
401
|
-
const handleThemeClick = (themeCode: string) => {
|
|
402
|
-
const params = new URLSearchParams(searchParams.toString());
|
|
403
|
-
|
|
404
|
-
if (selectedTheme === themeCode) {
|
|
405
|
-
if (selectedStrategy) {
|
|
406
|
-
params.delete("strategy");
|
|
407
|
-
} else {
|
|
408
|
-
params.delete("theme");
|
|
409
|
-
params.delete("strategy");
|
|
410
|
-
}
|
|
411
|
-
} else {
|
|
412
|
-
params.set("theme", themeCode);
|
|
413
|
-
params.delete("strategy");
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
setUrlState(params.toString());
|
|
417
|
-
// In real app: router.push(`/explore?${params.toString()}`);
|
|
418
|
-
};
|
|
419
|
-
|
|
420
|
-
const handleStrategyClick = (strategyCode: string) => {
|
|
421
|
-
const params = new URLSearchParams(searchParams.toString());
|
|
422
|
-
|
|
423
|
-
if (selectedStrategy === strategyCode) {
|
|
424
|
-
params.delete("strategy");
|
|
425
|
-
} else {
|
|
426
|
-
params.set("strategy", strategyCode);
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
setUrlState(params.toString());
|
|
430
|
-
// In real app: router.push(`/explore?${params.toString()}`);
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
const handleScopeChange = (newScope: "core" | "non-core") => {
|
|
434
|
-
setScope(newScope);
|
|
435
|
-
};
|
|
436
|
-
|
|
437
|
-
const handlePursuitToggle = (pursuit: "certification" | "rating") => {
|
|
438
|
-
setActivePursuits((prev) => {
|
|
439
|
-
const next = new Set(prev);
|
|
440
|
-
if (next.has(pursuit)) {
|
|
441
|
-
next.delete(pursuit);
|
|
442
|
-
} else {
|
|
443
|
-
next.add(pursuit);
|
|
444
|
-
}
|
|
445
|
-
return next;
|
|
446
|
-
});
|
|
447
|
-
};
|
|
448
|
-
|
|
449
|
-
return (
|
|
450
|
-
<ExploreSidePanelView
|
|
451
|
-
concepts={concepts}
|
|
452
|
-
themes={themes}
|
|
453
|
-
strategies={strategies}
|
|
454
|
-
selectedConcept={selectedConcept}
|
|
455
|
-
selectedTheme={selectedTheme}
|
|
456
|
-
selectedStrategy={selectedStrategy}
|
|
457
|
-
onConceptClick={handleConceptClick}
|
|
458
|
-
onThemeClick={handleThemeClick}
|
|
459
|
-
onStrategyClick={handleStrategyClick}
|
|
460
|
-
scope={scope}
|
|
461
|
-
onScopeChange={handleScopeChange}
|
|
462
|
-
activePursuits={activePursuits}
|
|
463
|
-
onPursuitToggle={handlePursuitToggle}
|
|
464
|
-
/>
|
|
465
|
-
);
|
|
388
|
+
},
|
|
466
389
|
},
|
|
390
|
+
},
|
|
391
|
+
render: (args: any) => {
|
|
392
|
+
// Mock searchParams with state for Storybook //
|
|
393
|
+
const [urlState, setUrlState] = useState(args.mockSearchParams || "");
|
|
394
|
+
const searchParams = new URLSearchParams(urlState);
|
|
395
|
+
//In real app: const searchParams = useSearchParams();
|
|
396
|
+
|
|
397
|
+
// URL state
|
|
398
|
+
const selectedConcept = searchParams.get("concept") as ConceptSlug | null;
|
|
399
|
+
const selectedTheme = searchParams.get("theme");
|
|
400
|
+
const selectedStrategy = searchParams.get("strategy");
|
|
401
|
+
|
|
402
|
+
// Progressive data fetching //
|
|
403
|
+
// const { data: concepts = [] } = useConceptListQuery();
|
|
404
|
+
// const { data: themes = [] } = useThemesQuery(selectedConcept);
|
|
405
|
+
// const { data: strategies = [] } = useStrategiesQuery(selectedConcept, selectedTheme);
|
|
406
|
+
|
|
407
|
+
// Mock data for Storybook
|
|
408
|
+
const concepts = [
|
|
409
|
+
{ conceptKey: "mind", name: "Mind" },
|
|
410
|
+
{ conceptKey: "community", name: "Community" },
|
|
411
|
+
{ conceptKey: "movement", name: "Movement" },
|
|
412
|
+
{ conceptKey: "water", name: "Water" },
|
|
413
|
+
{ conceptKey: "air", name: "Air" },
|
|
414
|
+
{ conceptKey: "light", name: "Light" },
|
|
415
|
+
{ conceptKey: "thermal-comfort", name: "Thermal Comfort" },
|
|
416
|
+
{ conceptKey: "nourishment", name: "Nourishment" },
|
|
417
|
+
{ conceptKey: "sound", name: "Sound" },
|
|
418
|
+
{ conceptKey: "materials", name: "Materials" },
|
|
419
|
+
{ conceptKey: "innovation", name: "Innovation" },
|
|
420
|
+
];
|
|
421
|
+
|
|
422
|
+
// Themes only load when concept is selected
|
|
423
|
+
const themes = selectedConcept
|
|
424
|
+
? [
|
|
425
|
+
{ code: "C1", name: "Community and occupant engagement" },
|
|
426
|
+
{ code: "C2", name: "Emergency preparedness" },
|
|
427
|
+
{ code: "C3", name: "Fair housing" },
|
|
428
|
+
{ code: "C4", name: "Family and parental support" },
|
|
429
|
+
{ code: "C5", name: "Health benefits and services" },
|
|
430
|
+
{ code: "C6", name: "Health promotion" },
|
|
431
|
+
{ code: "C7", name: "Inclusive design" },
|
|
432
|
+
{ code: "C8", name: "Occupant experience" },
|
|
433
|
+
{ code: "C9", name: "Organizational practices" },
|
|
434
|
+
{ code: "C10", name: "Personal-professional development" },
|
|
435
|
+
{ code: "C11", name: "Supportive construction practices" },
|
|
436
|
+
]
|
|
437
|
+
: [];
|
|
438
|
+
|
|
439
|
+
// Strategies only load when theme is selected
|
|
440
|
+
const strategies = selectedTheme
|
|
441
|
+
? [
|
|
442
|
+
{ code: "C8.1", name: "Collect additional occupant research" },
|
|
443
|
+
{ code: "C8.2", name: "Conduct qualitative research" },
|
|
444
|
+
{ code: "C8.3", name: "Develop annual action plan" },
|
|
445
|
+
{ code: "C8.4", name: "Perform annual occupant survey" },
|
|
446
|
+
]
|
|
447
|
+
: [];
|
|
448
|
+
|
|
449
|
+
// Local state
|
|
450
|
+
const [scope, setScope] = useState<"core" | "non-core">("core");
|
|
451
|
+
const [activePursuits, setActivePursuits] = useState<
|
|
452
|
+
Set<"certification" | "rating">
|
|
453
|
+
>(new Set(["certification"]));
|
|
454
|
+
|
|
455
|
+
// Navigation handlers
|
|
456
|
+
const handleConceptClick = (slug: ConceptSlug) => {
|
|
457
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
458
|
+
|
|
459
|
+
if (selectedConcept === slug) {
|
|
460
|
+
params.delete("concept");
|
|
461
|
+
params.delete("theme");
|
|
462
|
+
params.delete("strategy");
|
|
463
|
+
} else {
|
|
464
|
+
params.set("concept", slug);
|
|
465
|
+
params.delete("theme");
|
|
466
|
+
params.delete("strategy");
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
setUrlState(params.toString());
|
|
470
|
+
// In real app: router.push(`/explore?${params.toString()}`);
|
|
471
|
+
};
|
|
472
|
+
|
|
473
|
+
const handleThemeClick = (themeCode: string) => {
|
|
474
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
475
|
+
|
|
476
|
+
if (selectedTheme === themeCode) {
|
|
477
|
+
if (selectedStrategy) {
|
|
478
|
+
params.delete("strategy");
|
|
479
|
+
} else {
|
|
480
|
+
params.delete("theme");
|
|
481
|
+
params.delete("strategy");
|
|
482
|
+
}
|
|
483
|
+
} else {
|
|
484
|
+
params.set("theme", themeCode);
|
|
485
|
+
params.delete("strategy");
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
setUrlState(params.toString());
|
|
489
|
+
// In real app: router.push(`/explore?${params.toString()}`);
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
const handleStrategyClick = (strategyCode: string) => {
|
|
493
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
494
|
+
|
|
495
|
+
if (selectedStrategy === strategyCode) {
|
|
496
|
+
params.delete("strategy");
|
|
497
|
+
} else {
|
|
498
|
+
params.set("strategy", strategyCode);
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
setUrlState(params.toString());
|
|
502
|
+
// In real app: router.push(`/explore?${params.toString()}`);
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
const handleScopeChange = (newScope: "core" | "non-core") => {
|
|
506
|
+
setScope(newScope);
|
|
507
|
+
};
|
|
508
|
+
|
|
509
|
+
const handlePursuitToggle = (pursuit: "certification" | "rating") => {
|
|
510
|
+
setActivePursuits((prev) => {
|
|
511
|
+
const next = new Set(prev);
|
|
512
|
+
if (next.has(pursuit)) {
|
|
513
|
+
next.delete(pursuit);
|
|
514
|
+
} else {
|
|
515
|
+
next.add(pursuit);
|
|
516
|
+
}
|
|
517
|
+
return next;
|
|
518
|
+
});
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
return (
|
|
522
|
+
<div className="max-w-[322px]">
|
|
523
|
+
<ExploreSidePanelView
|
|
524
|
+
concepts={concepts}
|
|
525
|
+
themes={themes}
|
|
526
|
+
strategies={strategies}
|
|
527
|
+
selectedConcept={selectedConcept}
|
|
528
|
+
selectedTheme={selectedTheme}
|
|
529
|
+
selectedStrategy={selectedStrategy}
|
|
530
|
+
onConceptClick={handleConceptClick}
|
|
531
|
+
onThemeClick={handleThemeClick}
|
|
532
|
+
onStrategyClick={handleStrategyClick}
|
|
533
|
+
scope={scope}
|
|
534
|
+
onScopeChange={handleScopeChange}
|
|
535
|
+
activePursuits={activePursuits}
|
|
536
|
+
onPursuitToggle={handlePursuitToggle}
|
|
537
|
+
/>
|
|
538
|
+
</div>
|
|
539
|
+
);
|
|
540
|
+
},
|
|
467
541
|
};
|
|
468
542
|
|
|
469
543
|
const meta = {
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
}
|
|
544
|
+
title: "Review/Panel",
|
|
545
|
+
component: ExploreSidePanelView,
|
|
546
|
+
tags: ["autodocs"],
|
|
547
|
+
parameters: {
|
|
548
|
+
layout: "padded",
|
|
549
|
+
},
|
|
550
|
+
};
|
|
477
551
|
|
|
478
552
|
export default meta;
|
|
479
553
|
|
|
480
|
-
type ConceptSlug = keyof typeof conceptColors;
|
|
554
|
+
type ConceptSlug = keyof typeof conceptColors;
|