hikari-components 0.2.0

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
// Use theme variables with namespace to avoid conflicts
@use 'variables' as vars;
@use 'mixins' as mix;
@use './button-vars.scss' as button-vars;

// ============================================
// Hikari Button Component
// Features: Subtle rounded corners, glow effects (via Glow wrapper)
// Three-layer CSS variable system:
// - Layer1: Foundation variables (foundation.scss)
// - Layer2: Component variables (button-vars.scss)
// - Custom: Runtime overrides via AnimationBuilder
//
// NOTE: Primary hover effects are handled by CSS (not Glow wrapper)
// ============================================

// Base button styles
.hi-button {
  // Layout
  display: inline-flex;
  align-items: center;
  justify-content: center;

  // Spacing - use CSS variables
  padding: var(--hi-button-padding-y) var(--hi-button-padding-x);
  margin: 0;
  gap: var(--hi-button-gap);

  // Typography - use CSS variables
  font-family: vars.$hikari-font-family-sans;
  font-size: var(--hi-button-font-size);
  font-weight: var(--hi-button-font-weight);
  line-height: var(--hi-button-line-height);
  letter-spacing: var(--hi-button-letter-spacing);
  color: var(--hi-button-text-color);

  // Appearance - use CSS variables
  border-radius: var(--hi-button-radius);
  border: var(--hi-button-border-width) var(--hi-button-border-style) var(--hi-button-border-color);

  // Cursor & interaction
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  outline: none;

  // Transitions - use CSS variables
  transition: var(--hi-button-transition);

  // Position for pseudo-elements
  position: relative;
  overflow: hidden;

  // Background - use CSS variables
  background-color: var(--hi-button-bg);
  backdrop-filter: var(--hi-button-bg-blur);

  // Active state - scale down effect
  &:active:not(:disabled) {
    transform: scale(0.98);
  }

  // Focus state - only outline, no color changes
  &:focus-visible {
    border-color: var(--hi-button-border-color-focus);
    border-width: var(--hi-button-border-width-focus);
    outline: none;
    color: var(--hi-button-text-color);

    .hikari-icon {
      color: var(--hi-button-icon-color);
    }
  }

  // Disabled state
  &:disabled {
    color: var(--hi-button-text-color-disabled);
    background-color: var(--hi-button-bg-disabled);
    border-color: var(--hi-button-border-color-disabled);
    cursor: not-allowed;
    pointer-events: none;
  }

  // Loading state
  &.hi-button-loading {
    pointer-events: none;
  }
}

// ============================================
// Variant: Primary (Pink glow accent)
// ============================================

.hi-button-primary {
  background: linear-gradient(135deg, var(--hi-color-primary), var(--hi-button-primary-dark));
  color: var(--hi-color-text-on-primary, #ffffff);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(255, 107, 129, 0.15), 0 1px 3px rgba(0, 0, 0, 0.06);

  &:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--hi-button-primary-hover), var(--hi-button-primary-dark));
    box-shadow: var(--hi-glow-button-primary);
  }

  &:focus-visible {
    outline: 2px solid var(--hi-color-primary);
    outline-offset: 2px;
  }

  &:active:not(:disabled) {
    box-shadow:
      0 0 4px var(--hi-color-primary),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
  }
}

// ============================================
// Variant: Secondary (Blue accent)
// ============================================

.hi-button-secondary {
  background-color: var(--hi-color-secondary);
  color: var(--hi-color-text-on-secondary, #ffffff);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(75, 92, 196, 0.15), 0 1px 3px rgba(0, 0, 0, 0.06);

  &:hover:not(:disabled) {
    background-color: var(--hi-button-secondary-hover);
    box-shadow: var(--hi-glow-button-secondary);
  }

  &:focus-visible {
    outline: 2px solid var(--hi-color-secondary);
    outline-offset: 2px;
  }

  &:active:not(:disabled) {
    background-color: var(--hi-button-secondary-dark);
    box-shadow:
      0 0 4px var(--hi-color-secondary),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
  }
}

// ============================================
// Variant: Ghost (Transparent with theme color border)
// ============================================

.hi-button-ghost {
  background-color: transparent;
  color: var(--hi-ghost-text);
  border: 1px solid var(--hi-ghost-border);
  --hi-glow-transparent: true;
  --hi-glow-bg-color: transparent;
  --hi-glow-color: var(--hi-ghost-glow);

  &:hover:not(:disabled) {
    box-shadow: var(--hi-ghost-glow);
  }

  &:focus-visible {
    outline: 2px solid var(--hi-ghost-border);
    outline-offset: 2px;
  }

  &:active:not(:disabled) {
    box-shadow: 0 0 4px var(--hi-ghost-glow);
    transform: scale(0.98);
  }
}

// ============================================
// Variant: Borderless (No border, minimal styling)
// ============================================

.hi-button-borderless {
  background-color: transparent;
  color: var(--hi-ghost-text);
  border: none;
  --hi-glow-transparent: true;
  --hi-glow-bg-color: transparent;
  --hi-glow-color: var(--hi-ghost-glow);

  &:hover:not(:disabled) {
    box-shadow: var(--hi-ghost-glow);
  }

  &:focus-visible {
    outline: 2px solid var(--hi-ghost-border);
    outline-offset: 2px;
  }

  &:active:not(:disabled) {
    box-shadow: 0 0 4px var(--hi-ghost-glow);
    transform: scale(0.98);
  }
}

// ============================================
// Variant: Danger (Red glow accent)
// ============================================

.hi-button-danger {
  background: linear-gradient(135deg, var(--hi-color-danger), var(--hi-button-danger-dark));
  color: var(--hi-color-text-on-danger, #ffffff);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15), 0 1px 3px rgba(0, 0, 0, 0.06);

  &:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--hi-button-danger-hover), var(--hi-button-danger-dark));
    box-shadow: var(--hi-glow-button-danger);
  }

  &:focus-visible {
    outline: 2px solid var(--hi-color-danger);
    outline-offset: 2px;
  }

  &:active:not(:disabled) {
    box-shadow:
      0 0 4px var(--hi-color-danger),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
  }
}

// ============================================
// Variant: Success (Green glow accent)
// ============================================

.hi-button-success {
  background: linear-gradient(135deg, var(--hi-color-success), var(--hi-button-success-dark));
  color: var(--hi-color-text-on-success, #ffffff);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15), 0 1px 3px rgba(0, 0, 0, 0.06);

  &:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--hi-button-success-hover), var(--hi-button-success-dark));
    box-shadow: var(--hi-glow-button-success);
  }

  &:focus-visible {
    outline: 2px solid var(--hi-color-success);
    outline-offset: 2px;
  }

  &:active:not(:disabled) {
    box-shadow:
      0 0 4px var(--hi-color-success),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(0.98);
  }
}

// ============================================
// Size Variants - Use CSS Variables
// ============================================

.hi-button-sm,
.hi-button-md,
.hi-button-lg {
  // Variables already defined in button-vars.scss
}

// ============================================
// Block Variant
// ============================================

.hi-button-block {
  display: flex;
  width: 100%;
}

// ============================================
// Loading Spinner
// ============================================

.hi-button-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: hi-spin 0.6s linear infinite;
  opacity: 0.9;
}

// ============================================
// Icon styling - Use CSS Variables
// ============================================

button.hi-button .hikari-icon {
  color: var(--hi-button-icon-color);
  fill: var(--hi-button-icon-fill);
  opacity: var(--hi-button-icon-fill-opacity);
}

button.hi-button:active .hikari-icon {
  color: var(--hi-button-icon-color-active);
}

button.hi-button:disabled .hikari-icon {
  color: var(--hi-button-icon-color-disabled);
}

// SVG elements inherit color from parent
button .hikari-icon svg,
button .hikari-icon svg path,
button .hikari-icon svg circle,
button .hikari-icon svg rect,
button .hikari-icon svg ellipse,
button .hikari-icon svg polygon,
button .hikari-icon svg polyline,
button .hikari-icon svg line {
  color: inherit;
}

// ============================================
// Icon and Suffix wrappers - Use CSS Variables
// ============================================

button.hi-button:not(.hi-icon-button) {
  .hi-button-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: var(--hi-button-icon-size);
    height: var(--hi-button-icon-size);

    .hikari-icon {
      width: var(--hi-button-icon-size);
      height: var(--hi-button-icon-size);
    }

    .hikari-icon svg {
      width: var(--hi-button-icon-size);
      height: var(--hi-button-icon-size);
    }
  }

  .hi-button-suffix {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;

    .hi-arrow {
      width: var(--hi-button-icon-size);
      height: var(--hi-button-icon-size);
    }

    .hi-arrow svg {
      width: var(--hi-button-icon-size);
      height: var(--hi-button-icon-size);
    }

    .hikari-icon {
      width: var(--hi-button-icon-size);
      height: var(--hi-button-icon-size);
    }

    .hikari-icon svg {
      width: var(--hi-button-icon-size);
      height: var(--hi-button-icon-size);
    }
  }
}

// ============================================
// Space-between layout (icon + text + suffix)
// ============================================

button.hi-button-space-between {
  justify-content: space-between;

  > *:not(.hi-button-icon):not(.hi-button-suffix) {
    flex: 1;
    text-align: center;
    line-height: var(--hi-button-line-height);
  }

  .hi-button-icon,
  .hi-button-suffix {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }
}

// ============================================
// Button width variants
// ============================================

.hi-button-width-auto {
  width: auto;
}

.hi-button-width-120 {
  width: 120px;
}

.hi-button-width-140 {
  width: 140px;
}

.hi-button-width-160 {
  width: 160px;
}

// ============================================
// Animation Keyframes
// ============================================

@keyframes hi-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}