@celestia-island/hikari 0.55.23 → 0.55.25

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": "@celestia-island/hikari",
3
- "version": "0.55.23",
3
+ "version": "0.55.25",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "Hikari Vue 3 component library — production-grade UI components based on shittim-chest design system",
@@ -0,0 +1,237 @@
1
+ @use "../tokens";
2
+
3
+ /* ── HkOtpInput — one cell per character ─────────────────────────────
4
+ * A thin row of `.hk-otp-cell` inputs, styled from the same shell
5
+ * vocabulary as HkInput (55%-surface fill, 14% text border, focus ring
6
+ * on the focused cell) so a code field and a text field sit together
7
+ * without looking like two design systems.
8
+ *
9
+ * L3 hooks carry every geometric knob, so a host can resize the row
10
+ * without touching the library:
11
+ * --hk-otp-cell-size cell width AND height
12
+ * --hk-otp-font-size pin the character's size outright
13
+ * --hk-otp-font-max cap the fitted glyph (set by the size ramps)
14
+ * --hk-otp-gap gap between cells
15
+ * --hk-otp-gap-group gap at the `separated` split
16
+ * The two font knobs are deliberately separate: `-font-size` wins the
17
+ * cascade outright (the cell's font chain reads it first), while
18
+ * `-font-max` is the ramp's ceiling the measured fit clamps under — the
19
+ * fit keeps publishing either way, so releasing a pin needs no event.
20
+ * The size classes are written as complete rule sets (not as deltas over
21
+ * a shared base) on purpose: a `var()` chain whose fallback resolves
22
+ * through an UNSET custom property is invalid at computed-value time, so
23
+ * a ramp declares its cell size, its gap and its font fallback together.
24
+ *
25
+ * Which declarations carry a literal fallback today: the CELL box (width,
26
+ * min-height, radius, durations, easings, the font family and the font
27
+ * size chain), the label and the two messages. The RAMPS' own font values
28
+ * deliberately consume the scale tokens without a literal — they are the
29
+ * design's intended sizes, and a host that loaded this sheet alone still
30
+ * gets a correctly sized row through the fitted-font chain in the cell.
31
+ *
32
+ * Token note: the scale family consumed here (--space-*, --text-*,
33
+ * --radius-*, --duration-*, --ease-*) lives in the canonical scale root,
34
+ * which ships through the `@celestia-island/hikari/styles` aggregate —
35
+ * this sheet `@use`s only ../tokens (the color channels), like every
36
+ * other component sheet. A host that loads ONE component sheet in
37
+ * isolation therefore gets the color tokens but not the scale ones.
38
+ */
39
+
40
+ .hk-otp-wrapper {
41
+ display: block;
42
+ width: 100%;
43
+ }
44
+
45
+ .hk-otp-label {
46
+ display: block;
47
+ font-size: var(--text-xs, 0.75rem);
48
+ font-weight: 600;
49
+ letter-spacing: 0.02em;
50
+ margin-bottom: var(--space-4, 0.25rem);
51
+ color: rgb(var(--color-text) / var(--hk-field-label-alpha, 72%));
52
+ }
53
+
54
+ .hk-otp {
55
+ display: flex;
56
+ align-items: center;
57
+ justify-content: center;
58
+ width: 100%;
59
+ }
60
+
61
+ /* The `separated` split (123 456): a slot that only widens the gap, so
62
+ * the two groups keep the row's own centering. */
63
+ .hk-otp-gap {
64
+ flex: none;
65
+ width: calc(var(--hk-otp-gap-group, 1rem) - var(--hk-otp-gap, 0.5rem));
66
+ }
67
+
68
+ .hk-otp-cell {
69
+ /* Self-declared box model — the cells' centering must not depend on a
70
+ * host reset (same precedent as HkInput's element). */
71
+ box-sizing: border-box;
72
+ /* The ramp size is a CEILING, not a fixed width: with shrink enabled
73
+ * and a 0 floor the row always fits the box it is given, so a card
74
+ * narrower than N x ramp (eight cells in a 290px column, six cells in a
75
+ * phone card) shrinks the cells instead of overflowing the card and
76
+ * hiding the hint beside them. `aspect-ratio` keeps them square as they
77
+ * shrink; `max-width` keeps them from growing past the ramp when the
78
+ * row is wider than it needs. */
79
+ flex: 0 1 auto;
80
+ width: var(--hk-otp-cell-size, 3rem);
81
+ max-width: var(--hk-otp-cell-size, 3rem);
82
+ min-width: 0;
83
+ /* Without this the cells keep an automatic minimum HEIGHT and the square
84
+ * breaks once the width shrinks past the content height (12 cells in a
85
+ * 340px card render 17.67 x 26 without it). */
86
+ min-height: 0;
87
+ aspect-ratio: 1;
88
+ margin: 0;
89
+ padding: 0;
90
+ background: color-mix(in srgb, rgb(var(--color-surface)) 55%, transparent);
91
+ border: 1px solid color-mix(in srgb, rgb(var(--color-text)) 14%, transparent);
92
+ /* --radius-md on purpose: the cells are large, prominent elements
93
+ * (48px at the md ramp), and at the small档's 4px they read as sharp
94
+ * rectangles next to every other control on the auth card (user
95
+ * report on the deployed step-up panel). The theme's radius LEVELS
96
+ * (chest's html[data-radius]) still rule — this only switches which
97
+ * level the cells follow. */
98
+ border-radius: var(--radius-md, 8px);
99
+ outline: none;
100
+ appearance: none;
101
+ -webkit-appearance: none;
102
+ font-family: var(--font-mono, ui-monospace, monospace);
103
+ /* Three levels, most specific first:
104
+ * 1. --hk-otp-font-size — a host pinning the glyph outright.
105
+ * 2. --hk-otp-fitted-font — published PER ROW by the component from a
106
+ * measurement of one cell (see the glyph-fit block in the tsx):
107
+ * CSS cannot size the glyph from the cell's own width, because a
108
+ * container cannot query itself and an input has no children.
109
+ * 3. the literal — for a host that loaded this sheet without the
110
+ * canonical scale root (see the header note).
111
+ * The ramps feed the fit through --hk-otp-font-max instead of writing
112
+ * here, so this property stays free of the fit's own output. */
113
+ font-size: var(--hk-otp-font-size, var(--hk-otp-fitted-font, 1.25rem));
114
+ font-weight: 600;
115
+ line-height: 1;
116
+ font-variant-numeric: tabular-nums;
117
+ text-align: center;
118
+ color: rgb(var(--color-text));
119
+ caret-color: rgb(var(--color-primary));
120
+ transition-property: background-color, border-color, color, box-shadow, opacity;
121
+ transition-duration: var(--duration-normal, 0.3s);
122
+ transition-timing-function: var(--ease-standard, cubic-bezier(0.4, 0, 0.2, 1));
123
+
124
+ /* `text` (not `none`): a drag inside a cell still selects its glyph for
125
+ * the keyboard-replace path, while a stray triple-click selection never
126
+ * bleeds across the visual gaps the cells do not actually have. */
127
+ user-select: text;
128
+
129
+ /* `:not(:focus)` is load-bearing, not decoration: the hover selector
130
+ * weighs (0,4,0) against `:focus`'s (0,2,0), so without the exclusion a
131
+ * focused cell under the pointer painted the HOVER border over the
132
+ * focus border (the focus box-shadow survived, which is exactly why it
133
+ * read as a near-miss rather than an obvious bug). */
134
+ &:hover:not(:focus):not(:disabled):not(:read-only) {
135
+ border-color: var(--c-primary-strong);
136
+ }
137
+
138
+ &:focus {
139
+ border-color: rgb(var(--color-focused-border));
140
+ box-shadow: var(--shadow-focus);
141
+ background: rgb(var(--color-surface));
142
+ }
143
+
144
+ &:disabled {
145
+ opacity: 0.5;
146
+ cursor: not-allowed;
147
+ }
148
+
149
+ &:read-only {
150
+ cursor: default;
151
+ }
152
+
153
+ /* Chromium's autofill paint would otherwise flood the cell with the
154
+ * UA's own yellow/blue and hide the theme surface. */
155
+ &:-webkit-autofill {
156
+ -webkit-text-fill-color: rgb(var(--color-text));
157
+ -webkit-box-shadow: 0 0 0 1000px rgb(var(--color-surface)) inset;
158
+ }
159
+ }
160
+
161
+ /* Size ramps: the cell box and its type scale move together. */
162
+ .hk-otp-sm {
163
+ --hk-otp-cell-size: 2.25rem;
164
+ --hk-otp-font-max: var(--text-base);
165
+ gap: var(--hk-otp-gap, 0.375rem);
166
+ }
167
+
168
+ .hk-otp-md {
169
+ --hk-otp-cell-size: 3rem;
170
+ --hk-otp-font-max: var(--text-xl);
171
+ gap: var(--hk-otp-gap, 0.5rem);
172
+ }
173
+
174
+ .hk-otp-lg {
175
+ --hk-otp-cell-size: 3.5rem;
176
+ --hk-otp-font-max: var(--text-2xl);
177
+ gap: var(--hk-otp-gap, 0.625rem);
178
+ }
179
+
180
+ .hk-otp-disabled {
181
+ opacity: 0.6;
182
+ }
183
+
184
+ .hk-otp-error .hk-otp-cell {
185
+ border-color: var(--c-error-strong);
186
+ }
187
+
188
+ .hk-otp-error .hk-otp-cell:focus {
189
+ border-color: rgb(var(--color-error));
190
+ box-shadow: var(--shadow-focus-error);
191
+ }
192
+
193
+ .hk-otp-error-msg {
194
+ margin: var(--space-6, 0.375rem) 0 0;
195
+ font-size: var(--text-xs, 0.75rem);
196
+ color: rgb(var(--color-error));
197
+ }
198
+
199
+ .hk-otp-hint {
200
+ margin: var(--space-6, 0.375rem) 0 0;
201
+ font-size: var(--text-xs, 0.75rem);
202
+ color: rgb(var(--color-muted));
203
+ }
204
+
205
+ /* Narrow viewports: shrink the ramps a step so a phone card shows the row
206
+ * at its intended pitch rather than at whatever the shrink-to-fit
207
+ * arithmetic lands on. (The cells would fit either way — this is about
208
+ * proportion, not overflow: a six-cell row in a 340px card measures ~40px
209
+ * per cell at this ramp and ~41px from the flexible shrink.) */
210
+ @media (max-width: 480px) {
211
+ .hk-otp-sm {
212
+ --hk-otp-cell-size: 2rem;
213
+ gap: var(--hk-otp-gap, 0.3125rem);
214
+ }
215
+
216
+ .hk-otp-md {
217
+ --hk-otp-cell-size: 2.5rem;
218
+ --hk-otp-font-max: var(--text-lg);
219
+ gap: var(--hk-otp-gap, 0.375rem);
220
+ }
221
+
222
+ .hk-otp-lg {
223
+ --hk-otp-cell-size: 2.75rem;
224
+ --hk-otp-font-max: var(--text-xl);
225
+ gap: var(--hk-otp-gap, 0.5rem);
226
+ }
227
+
228
+ .hk-otp-gap {
229
+ width: calc(var(--hk-otp-gap-group, 0.75rem) - var(--hk-otp-gap, 0.375rem));
230
+ }
231
+ }
232
+
233
+ @media (prefers-reduced-motion: reduce) {
234
+ .hk-otp-cell {
235
+ transition: none;
236
+ }
237
+ }