hikari-components 0.1.8

Core UI components (40+) for the Hikari design system
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
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
276
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
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
// Use theme variables with namespace to avoid conflicts
@use 'variables' as vars;
@use 'mixins' as mix;

// ============================================
// Hikari Sidebar Component - Multi-level Navigation

// ============================================
// Base Sidebar Styles
// ============================================

.hi-sidebar {
  // Layout
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;

  // Appearance - transparent background for integration
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;

  // Overflow handling
  overflow-x: hidden;
  overflow-y: auto;

  // Hide native scrollbar (using custom scrollbar component)
  @include mix.scrollbar-hidden;
}

// ============================================
// Sidebar Section - Top-level collapsible category
// ============================================

.hi-sidebar-section {
  // Layout
  display: flex;
  flex-direction: column;

  // Border between sections
  border-bottom: 1px solid var(--hi-color-border);

  &:last-child {
    border-bottom: none;
  }
}

.hi-sidebar-section-header {
  // Layout
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;

  // Spacing
  padding: 0.875rem 1rem;

  // Cursor
  cursor: pointer;

  // Prevent text selection - behave like a button
  user-select: none;

  // Transition
  transition: all vars.$hikari-duration-fast ease;

  // Hover state is handled by Glow component
  // The Glow wrapper already handles mouse events and updates --glow-intensity-scale
  // We just need to ensure the glow is visible when hovering
}

// Hover state for Glow wrapper around section header
.hi-glow-wrapper:has(.hi-sidebar-section-header) {
  &:hover,
  &[data-glow-hover="true"] {
    --glow-intensity-scale: 0.5;
  }
}

.hi-sidebar-section-title-group {
  // Layout
  display: flex;
  align-items: baseline;
  gap: 0.375rem;
}

.hi-sidebar-section-title-primary {
  // Typography
  font-size: 0.875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--hi-color-text-primary);
}

.hi-sidebar-section-title-secondary {
  // Typography
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--hi-color-text-secondary);
}

.hi-sidebar-section-arrow {
  // Layout
  display: flex;
  align-items: center;
  justify-content: center;

  // Size
  width: 1rem;
  height: 1rem;

  // Color
  color: var(--hi-color-text-secondary);

  // Transition
  transition: transform vars.$hikari-duration-normal ease;

  // Rotated state (expanded)
  &.rotated {
    transform: rotate(180deg);
  }

  // SVG styling
  svg {
    width: 100%;
    height: 100%;
  }
}

.hi-sidebar-section-children {
  // Layout
  display: flex;
  flex-direction: column;

  // Transparent background (blends with page, no "whitewash")
  background: transparent;

  // Hide when collapsed
  &[data-expanded="false"] {
    display: none;
  }
}

// ============================================
// Sidebar Item - Clickable navigation item
// ============================================

.hi-sidebar-item {
  // Layout
  display: flex;
  flex-direction: column;

  // Border between items
  border-bottom: 1px solid var(--hi-color-border);

  &:last-child {
    border-bottom: none;
  }
}

.hi-sidebar-item-header {
  // Layout
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;

  // Spacing
  padding: 0.75rem 1rem 0.75rem 1.5rem;

  // Typography - increase to 14px
  font-size: 0.875rem;  // 14px
  line-height: 1.25;    // 17.5px for proper alignment
  font-weight: 500;
  color: var(--hi-color-text-primary);

  // Cursor - always clickable
  cursor: pointer;
  text-decoration: none;

  // Prevent text selection and dragging - behave like a button
  user-select: none;

  // Transition
  transition: all vars.$hikari-duration-fast ease;

  // Hover state is handled by Glow component
}

// Hover state for Glow wrapper around item header
.hi-glow-wrapper:has(.hi-sidebar-item-header) {
  &:hover,
  &[data-glow-hover="true"] {
    --glow-intensity-scale: 0.5;
  }
}

.hi-sidebar-item-content {
  // Layout
  display: flex;
  align-items: center;
  gap: 0.875rem;  // 14px gap between icon and text

  // Make content fill available space
  flex: 1;

  // Prevent text selection - behave like a button
  user-select: none;

  // Position relative for absolute positioned link
  position: relative;

  // Ensure links inside content fill the entire header area
  & a,
  & .hi-sidebar-item-content-inner {
    color: inherit;
    text-decoration: none;
    // Allow pointer events on links but prevent bubbling to parent
    pointer-events: auto;
    // Make link fill entire header area (offset parent padding)
    position: absolute;
    left: -1.5rem;
    right: -1rem;
    top: -0.75rem;
    bottom: -0.75rem;
    // Inner content for proper layout
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding-left: 1.5rem;
  }
}

.hi-sidebar-item-arrow {
  // Layout
  display: flex;
  align-items: center;
  justify-content: center;

  // Size - visual only, no padding since header handles clicks
  width: 1rem;
  height: 1rem;

  // Cursor - inherit from parent header
  cursor: default;

  // Color - inherit from theme
  color: var(--hi-color-text-secondary);

  // Transition - only rotation
  transition: transform vars.$hikari-duration-normal ease;

  // Rotated state (expanded)
  &.rotated {
    transform: rotate(90deg);
  }

  // SVG styling
  svg {
    width: 100%;
    height: 100%;
  }
}

.hi-sidebar-item-children {
  // Layout
  display: flex;
  flex-direction: column;

  // Transparent background (no "whitewash")
  background: transparent;

  // Hide when collapsed
  &[data-expanded="false"] {
    display: none;
  }
}

// ============================================
// Sidebar Leaf - Terminal item without children
// ============================================

.hi-sidebar-leaf {
  // Border between items
  border-bottom: 1px solid var(--hi-color-border);

  &:last-child {
    border-bottom: none;
  }
}

.hi-sidebar-leaf-content {
  // Layout
  display: flex;
  align-items: center;
  gap: 0.875rem;  // 14px gap between icon and text

  // Spacing
  padding: 0.625rem 1rem 0.625rem 2.5rem;

  // Typography - increased to 14px
  font-size: 0.875rem;  // 14px
  line-height: 1.25;    // 17.5px for proper alignment
  font-weight: 400;
  color: var(--hi-color-text-secondary);
  text-decoration: none;

  // Prevent text selection and dragging - behave like a button
  user-select: none;

  // Transition
  transition: all vars.$hikari-duration-fast ease;

  // Cursor
  cursor: pointer;

  // Inherit styling for links - make link fill entire area
  & > a {
    color: inherit;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    height: 100%;
    padding: inherit;
    // Negative margins to extend to parent's edge
    margin: -0.625rem -1rem -0.625rem -2.5rem;
    padding-left: 2.5rem;
  }

  // Hover state - subtle background change
  &:hover {
    color: var(--hi-color-text-primary);
    background: var(--hi-primary);
  }

  // Active state
  &.active {
    color: var(--hi-badge-text, #FFFFFF);
    background: var(--hi-color-primary, var(--hi-primary, #FFC0CB));
    font-weight: 600;
    border-left: 3px solid var(--hi-button-primary-dark, #FF9AA9);
    padding-left: calc(2.5rem - 3px);
    box-shadow: inset 0 0 12px var(--hi-glow-primary-sm, rgba(255, 179, 167, 0.15));
  }
}

// ============================================
// Active State Support
// ============================================

// Add active state styling to item content when parent has data-active
.hi-sidebar-item[data-active="true"] > .hi-sidebar-item-header > .hi-sidebar-item-content {
  color: var(--hi-color-text-primary);  // Use text-primary instead of primary
  background: var(--hi-color-primary);
  font-weight: 500;
  border-left: 3px solid var(--hi-color-primary);
  padding-left: calc(1.5rem - 3px);
  margin-left: -3px;
}

// ============================================
// Nested Level Indentation
// ============================================

// Each nested level adds indentation
.hi-sidebar-item-children .hi-sidebar-item-header {
  padding-left: 2rem;
}

.hi-sidebar-item-children .hi-sidebar-item-children .hi-sidebar-item-header {
  padding-left: 2.5rem;
}

.hi-sidebar-item-children .hi-sidebar-item-children .hi-sidebar-item-children .hi-sidebar-item-header {
  padding-left: 3rem;
}

// ============================================
// Icon Alignment
// ============================================

// Fix Icon component wrapper alignment in flex containers
.hi-sidebar-item-content .hikari-icon,
.hi-sidebar-leaf-content .hikari-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 0.875rem;   // 14px
  height: 0.875rem;  // 14px
}

// Icon size variants (used by Icon component)
// These override default sizes when used in sidebar
.hi-sidebar-item-content .hikari-icon-16,
.hi-sidebar-leaf-content .hikari-icon-16 {
  width: 0.875rem;  // 14px
  height: 0.875rem; // 14px
}

.hi-sidebar-item-content .hikari-icon-24,
.hi-sidebar-leaf-content .hikari-icon-24 {
  width: 1rem;     // 16px
  height: 1rem;    // 16px
}

// Link content inside sidebar items - make them flex containers
// Note: .hi-sidebar-item-content-inner is handled with absolute positioning in .hi-sidebar-item-content
.hi-sidebar-item-content-inner {
  display: flex;
  align-items: center;
  gap: 0.875rem;  // 14px gap between icon and text
  width: 100%;
}

// Direct SVG styling (for inline SVGs)
.hi-sidebar-item-content svg,
.hi-sidebar-leaf-content svg {
  flex-shrink: 0;
  display: block;
  width: 0.875rem;   // 14px
  height: 0.875rem;  // 14px
  color: currentColor;
}

// ============================================
// Responsive Variants
// ============================================

// Compact variant
.hi-sidebar-compact {
  .hi-sidebar-section-header {
    padding: 0.625rem 0.75rem;
  }

  .hi-sidebar-item-header {
    padding: 0.5rem 0.75rem 0.5rem 1.25rem;
  }

  .hi-sidebar-leaf-content {
    padding: 0.5rem 0.75rem 0.5rem 2rem;
  }
}

// Minimal variant (icon-only on small screens)
@media (max-width: 768px) {
  .hi-sidebar-minimal {
    .hi-sidebar-section-title-secondary,
    .hi-sidebar-item-arrow {
      display: none;
    }
  }
}