@loykin/filter-input 0.0.1-dev.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.
@@ -0,0 +1,587 @@
1
+ /*
2
+ * @loykin/filter-input
3
+ *
4
+ * Plain CSS, no Tailwind dependency. Consumers can override with:
5
+ * - CSS custom properties: --bk-*
6
+ * - Semantic class names: .fi-*
7
+ * - classNames props
8
+ */
9
+
10
+ :root {
11
+ --bk-background: oklch(1 0 0);
12
+ --bk-foreground: oklch(0.145 0 0);
13
+ --bk-popover: oklch(1 0 0);
14
+ --bk-popover-foreground: oklch(0.145 0 0);
15
+ --bk-muted: oklch(0.97 0 0);
16
+ --bk-muted-foreground: oklch(0.556 0 0);
17
+ --bk-border: oklch(0.922 0 0);
18
+ --bk-input: oklch(0.922 0 0);
19
+ --bk-ring: oklch(0.708 0 0);
20
+ --bk-primary: oklch(0.205 0 0);
21
+ --bk-primary-foreground: oklch(0.985 0 0);
22
+ --bk-destructive: oklch(0.577 0.245 27.325);
23
+ --bk-radius: 6px;
24
+ /* filter-input 고유 토큰 */
25
+ --bk-fi-control-background: var(--bk-background);
26
+ --bk-fi-control-foreground: var(--bk-foreground);
27
+ --bk-fi-control-border: var(--bk-input);
28
+ --bk-fi-control-placeholder: var(--bk-muted-foreground);
29
+ --bk-fi-separator: var(--bk-border);
30
+ }
31
+
32
+ .dark {
33
+ --bk-background: oklch(0.145 0 0);
34
+ --bk-foreground: oklch(0.985 0 0);
35
+ --bk-popover: oklch(0.205 0 0);
36
+ --bk-popover-foreground: oklch(0.985 0 0);
37
+ --bk-muted: oklch(0.269 0 0);
38
+ --bk-muted-foreground: oklch(0.708 0 0);
39
+ --bk-border: oklch(1 0 0 / 10%);
40
+ --bk-input: oklch(1 0 0 / 15%);
41
+ --bk-ring: oklch(0.556 0 0);
42
+ --bk-primary: oklch(0.985 0 0);
43
+ --bk-primary-foreground: oklch(0.205 0 0);
44
+ --bk-destructive: oklch(0.704 0.191 22.216);
45
+ --bk-fi-separator: oklch(1 0 0 / 20%);
46
+ }
47
+
48
+ .fi-variable {
49
+ display: flex;
50
+ align-items: stretch;
51
+ min-height: 32px;
52
+ min-width: 0;
53
+ overflow: visible;
54
+ border: 1px solid var(--bk-fi-control-border);
55
+ border-radius: var(--bk-radius);
56
+ background: var(--bk-fi-control-background);
57
+ color: var(--bk-fi-control-foreground);
58
+ }
59
+
60
+ .fi-variable:hover {
61
+ border-color: var(--bk-fi-control-border);
62
+ }
63
+
64
+ .fi-variable:focus-within {
65
+ box-shadow: 0 0 0 1px color-mix(in oklab, var(--bk-ring) 50%, transparent);
66
+ }
67
+
68
+ .fi-variable[data-disabled="true"] {
69
+ cursor: not-allowed;
70
+ opacity: 0.5;
71
+ }
72
+
73
+ .fi-variable-label {
74
+ display: flex;
75
+ align-items: center;
76
+ flex-shrink: 0;
77
+ gap: 6px;
78
+ padding: 0 12px;
79
+ border-right: 1px solid var(--bk-fi-separator);
80
+ font-size: 13px;
81
+ font-weight: 600;
82
+ }
83
+
84
+ .fi-variable-value {
85
+ position: relative;
86
+ display: flex;
87
+ align-items: center;
88
+ flex: 1 1 auto;
89
+ min-width: 0;
90
+ }
91
+
92
+ .fi-field {
93
+ width: 100%;
94
+ min-width: 0;
95
+ }
96
+
97
+ .fi-field-label {
98
+ margin-bottom: 6px;
99
+ color: var(--bk-muted-foreground);
100
+ font-size: 11px;
101
+ font-weight: 500;
102
+ }
103
+
104
+ .fi-field-required {
105
+ color: var(--bk-destructive);
106
+ }
107
+
108
+ .fi-control,
109
+ .fi-select,
110
+ .fi-textarea {
111
+ width: 100%;
112
+ min-width: 0;
113
+ border: 1px solid var(--bk-fi-control-border);
114
+ border-radius: var(--bk-radius);
115
+ background: var(--bk-fi-control-background);
116
+ color: var(--bk-fi-control-foreground);
117
+ outline: none;
118
+ font-size: 12px;
119
+ }
120
+
121
+ .fi-control,
122
+ .fi-select {
123
+ height: 32px;
124
+ padding: 0 8px;
125
+ }
126
+
127
+ .fi-textarea {
128
+ min-height: 80px;
129
+ padding: 8px;
130
+ resize: none;
131
+ }
132
+
133
+ .fi-control::placeholder,
134
+ .fi-textarea::placeholder {
135
+ color: var(--bk-fi-control-placeholder);
136
+ }
137
+
138
+ .fi-control:focus-visible,
139
+ .fi-select:focus-visible,
140
+ .fi-textarea:focus-visible {
141
+ border-color: var(--bk-ring);
142
+ box-shadow: 0 0 0 1px color-mix(in oklab, var(--bk-ring) 50%, transparent);
143
+ }
144
+
145
+ .fi-control:disabled,
146
+ .fi-select:disabled,
147
+ .fi-textarea:disabled {
148
+ cursor: not-allowed;
149
+ opacity: 0.5;
150
+ }
151
+
152
+ .fi-variable .fi-control,
153
+ .fi-variable .fi-select,
154
+ .fi-variable .fi-select-trigger,
155
+ .fi-variable .fi-textarea {
156
+ border: 0;
157
+ border-radius: 0;
158
+ background: transparent;
159
+ box-shadow: none;
160
+ }
161
+
162
+ .fi-variable .fi-select-trigger:focus-visible {
163
+ border-color: transparent;
164
+ box-shadow: none;
165
+ }
166
+
167
+ .fi-row {
168
+ display: flex;
169
+ gap: 6px;
170
+ }
171
+
172
+ .fi-stack {
173
+ display: flex;
174
+ flex-direction: column;
175
+ gap: 6px;
176
+ }
177
+
178
+ .fi-range {
179
+ display: grid;
180
+ grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
181
+ gap: 6px;
182
+ }
183
+
184
+ .fi-clear-button {
185
+ height: 32px;
186
+ border: 1px solid var(--bk-border);
187
+ border-radius: var(--bk-radius);
188
+ background: var(--bk-background);
189
+ color: var(--bk-muted-foreground);
190
+ padding: 0 8px;
191
+ font-size: 12px;
192
+ cursor: pointer;
193
+ }
194
+
195
+ .fi-clear-button:hover {
196
+ background: var(--bk-muted);
197
+ color: var(--bk-foreground);
198
+ }
199
+
200
+ .fi-clear-button:disabled {
201
+ opacity: 0.5;
202
+ }
203
+
204
+ .fi-multi {
205
+ position: relative;
206
+ width: 100%;
207
+ }
208
+
209
+ .fi-multi-trigger {
210
+ display: flex;
211
+ align-items: center;
212
+ justify-content: space-between;
213
+ width: 100%;
214
+ min-height: 32px;
215
+ border: 0;
216
+ background: transparent;
217
+ color: var(--bk-fi-control-foreground);
218
+ padding: 4px 8px;
219
+ text-align: left;
220
+ cursor: pointer;
221
+ }
222
+
223
+ .fi-multi-value {
224
+ min-width: 0;
225
+ flex: 1 1 auto;
226
+ }
227
+
228
+ .fi-chevron {
229
+ display: flex;
230
+ align-items: center;
231
+ color: var(--bk-muted-foreground);
232
+ padding-left: 8px;
233
+ flex-shrink: 0;
234
+ }
235
+
236
+ .fi-popover {
237
+ position: absolute;
238
+ left: 0;
239
+ right: 0;
240
+ z-index: 20;
241
+ margin-top: 4px;
242
+ max-height: 256px;
243
+ overflow: auto;
244
+ border: 1px solid var(--bk-border);
245
+ border-radius: var(--bk-radius);
246
+ background: var(--bk-popover);
247
+ color: var(--bk-popover-foreground);
248
+ box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
249
+ }
250
+
251
+ /* legacy alias kept for external use */
252
+ .fi-popover-search {
253
+ padding: 6px;
254
+ border-bottom: 1px solid var(--bk-border);
255
+ }
256
+
257
+ /* Header row: search input + reload button */
258
+ .fi-popup-header {
259
+ display: flex;
260
+ align-items: center;
261
+ gap: 6px;
262
+ padding: 6px;
263
+ border-bottom: 1px solid var(--bk-border);
264
+ }
265
+
266
+ .fi-popup-header .fi-control {
267
+ flex: 1;
268
+ min-width: 0;
269
+ }
270
+
271
+ /* Status row: loading / error / empty message */
272
+ .fi-popup-status {
273
+ display: flex;
274
+ align-items: center;
275
+ gap: 6px;
276
+ padding: 6px 8px;
277
+ border-bottom: 1px solid var(--bk-border);
278
+ font-size: 12px;
279
+ min-height: 32px;
280
+ }
281
+
282
+ .fi-popup-status .fi-loading,
283
+ .fi-popup-status .fi-error,
284
+ .fi-popup-status .fi-empty {
285
+ flex: 1;
286
+ }
287
+
288
+ /* Footer row: reload button only (select, idle state) */
289
+ .fi-popup-footer {
290
+ display: flex;
291
+ align-items: center;
292
+ justify-content: flex-end;
293
+ padding: 4px 6px;
294
+ border-top: 1px solid var(--bk-border);
295
+ }
296
+
297
+ .fi-reload-button {
298
+ display: flex;
299
+ align-items: center;
300
+ justify-content: center;
301
+ flex-shrink: 0;
302
+ width: 24px;
303
+ height: 24px;
304
+ border: 1px solid var(--bk-border);
305
+ border-radius: var(--bk-radius);
306
+ background: transparent;
307
+ color: var(--bk-muted-foreground);
308
+ cursor: pointer;
309
+ padding: 0;
310
+ }
311
+
312
+ .fi-reload-button:hover {
313
+ background: var(--bk-muted);
314
+ color: var(--bk-foreground);
315
+ }
316
+
317
+ .fi-reload-button:disabled {
318
+ opacity: 0.4;
319
+ cursor: not-allowed;
320
+ }
321
+
322
+ .fi-option {
323
+ display: flex;
324
+ align-items: center;
325
+ width: 100%;
326
+ gap: 8px;
327
+ border: 0;
328
+ background: none;
329
+ color: inherit;
330
+ padding: 6px 8px;
331
+ text-align: left;
332
+ font-size: 12px;
333
+ cursor: pointer;
334
+ }
335
+
336
+ .fi-option:hover {
337
+ background: var(--bk-muted);
338
+ }
339
+
340
+ .fi-option:disabled {
341
+ opacity: 0.5;
342
+ }
343
+
344
+ .fi-option-check {
345
+ display: flex;
346
+ align-items: center;
347
+ justify-content: center;
348
+ width: 14px;
349
+ height: 14px;
350
+ flex-shrink: 0;
351
+ border: 1px solid var(--bk-border);
352
+ border-radius: 2px;
353
+ color: var(--bk-primary);
354
+ }
355
+
356
+ .fi-option-check[data-checked] {
357
+ background: var(--bk-primary);
358
+ border-color: var(--bk-primary);
359
+ color: var(--bk-primary-foreground);
360
+ }
361
+
362
+ .fi-option-label {
363
+ min-width: 0;
364
+ flex: 1 1 auto;
365
+ overflow: hidden;
366
+ text-overflow: ellipsis;
367
+ white-space: nowrap;
368
+ }
369
+
370
+ .fi-empty,
371
+ .fi-loading,
372
+ .fi-error,
373
+ .fi-selected-mark,
374
+ .fi-selected-empty,
375
+ .fi-selected-count,
376
+ .fi-selected-summary {
377
+ color: var(--bk-muted-foreground);
378
+ font-size: 12px;
379
+ }
380
+
381
+ .fi-error {
382
+ color: var(--bk-destructive);
383
+ }
384
+
385
+ .fi-selected-list,
386
+ .fi-tag-input {
387
+ display: flex;
388
+ align-items: center;
389
+ flex-wrap: wrap;
390
+ min-width: 0;
391
+ gap: 4px;
392
+ }
393
+
394
+ .fi-tag-input {
395
+ width: 100%;
396
+ min-height: 32px;
397
+ padding: 4px 8px;
398
+ }
399
+
400
+ .fi-tag-input[data-disabled="true"] {
401
+ cursor: not-allowed;
402
+ opacity: 0.5;
403
+ }
404
+
405
+ .fi-tag {
406
+ display: inline-flex;
407
+ align-items: center;
408
+ gap: 4px;
409
+ max-width: 176px;
410
+ height: 20px;
411
+ border: 1px solid var(--bk-border);
412
+ background: var(--bk-muted);
413
+ color: var(--bk-foreground);
414
+ padding: 0 6px;
415
+ font-size: 11px;
416
+ }
417
+
418
+ .fi-tag-label {
419
+ overflow: hidden;
420
+ text-overflow: ellipsis;
421
+ white-space: nowrap;
422
+ }
423
+
424
+ .fi-tag-remove {
425
+ display: flex;
426
+ align-items: center;
427
+ border: 0;
428
+ background: none;
429
+ color: var(--bk-muted-foreground);
430
+ padding: 0;
431
+ cursor: pointer;
432
+ line-height: 1;
433
+ }
434
+
435
+ .fi-tag-remove:hover {
436
+ color: var(--bk-foreground);
437
+ }
438
+
439
+ .fi-tag-overflow {
440
+ display: inline-flex;
441
+ align-items: center;
442
+ height: 20px;
443
+ border: 1px solid var(--bk-border);
444
+ background: var(--bk-background);
445
+ color: var(--bk-muted-foreground);
446
+ padding: 0 6px;
447
+ font-size: 11px;
448
+ }
449
+
450
+ .fi-tag-text-input {
451
+ height: 24px;
452
+ min-width: 96px;
453
+ flex: 1 1 auto;
454
+ border: 0;
455
+ background: transparent;
456
+ color: var(--bk-foreground);
457
+ outline: none;
458
+ padding: 0 4px;
459
+ font-size: 12px;
460
+ }
461
+
462
+ .fi-tag-text-input::placeholder {
463
+ color: var(--bk-muted-foreground);
464
+ }
465
+
466
+ /* ── Custom Select ───────────────────────────────────── */
467
+
468
+ .fi-select-trigger {
469
+ display: inline-flex;
470
+ align-items: center;
471
+ width: 100%;
472
+ height: 32px;
473
+ border: 1px solid var(--bk-fi-control-border);
474
+ border-radius: var(--bk-radius);
475
+ background: var(--bk-fi-control-background);
476
+ color: var(--bk-fi-control-foreground);
477
+ padding: 0 8px;
478
+ font-size: 12px;
479
+ gap: 4px;
480
+ cursor: pointer;
481
+ outline: none;
482
+ user-select: none;
483
+ text-align: left;
484
+ }
485
+
486
+ .fi-select-trigger:focus-visible {
487
+ border-color: var(--bk-ring);
488
+ box-shadow: 0 0 0 1px color-mix(in oklab, var(--bk-ring) 50%, transparent);
489
+ }
490
+
491
+ .fi-select-trigger[data-disabled] {
492
+ cursor: not-allowed;
493
+ opacity: 0.5;
494
+ }
495
+
496
+ .fi-select-value {
497
+ flex: 1;
498
+ min-width: 0;
499
+ overflow: hidden;
500
+ text-overflow: ellipsis;
501
+ white-space: nowrap;
502
+ }
503
+
504
+ .fi-select-value[data-placeholder] {
505
+ color: var(--bk-fi-control-placeholder);
506
+ }
507
+
508
+ .fi-select-icon {
509
+ display: flex;
510
+ align-items: center;
511
+ color: var(--bk-muted-foreground);
512
+ flex-shrink: 0;
513
+ }
514
+
515
+ .fi-select-popup {
516
+ min-width: var(--anchor-width, 120px);
517
+ max-height: 256px;
518
+ overflow-y: auto;
519
+ border: 1px solid var(--bk-border);
520
+ border-radius: var(--bk-radius);
521
+ background: var(--bk-popover);
522
+ color: var(--bk-popover-foreground);
523
+ box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
524
+ outline: none;
525
+ }
526
+
527
+ .fi-select-item {
528
+ display: flex;
529
+ align-items: center;
530
+ width: 100%;
531
+ gap: 8px;
532
+ border: 0;
533
+ background: none;
534
+ color: inherit;
535
+ padding: 6px 8px;
536
+ text-align: left;
537
+ font-size: 12px;
538
+ cursor: pointer;
539
+ outline: none;
540
+ user-select: none;
541
+ }
542
+
543
+ .fi-select-item:hover,
544
+ .fi-select-item[data-highlighted] {
545
+ background: var(--bk-muted);
546
+ }
547
+
548
+ .fi-select-item[data-disabled] {
549
+ opacity: 0.5;
550
+ cursor: not-allowed;
551
+ }
552
+
553
+ .fi-select-item[data-selected] .fi-select-item-text {
554
+ font-weight: 500;
555
+ }
556
+
557
+ .fi-select-item-text {
558
+ flex: 1;
559
+ min-width: 0;
560
+ overflow: hidden;
561
+ text-overflow: ellipsis;
562
+ white-space: nowrap;
563
+ }
564
+
565
+ .fi-select-item-indicator {
566
+ display: flex;
567
+ align-items: center;
568
+ justify-content: center;
569
+ width: 16px;
570
+ height: 16px;
571
+ flex-shrink: 0;
572
+ color: var(--bk-primary);
573
+ }
574
+
575
+ /* ── Multi-select popup (portal-based) ───────────────── */
576
+
577
+ .fi-multi-popup {
578
+ min-width: var(--anchor-width, 160px);
579
+ max-height: 256px;
580
+ overflow-y: auto;
581
+ border: 1px solid var(--bk-border);
582
+ border-radius: var(--bk-radius);
583
+ background: var(--bk-popover);
584
+ color: var(--bk-popover-foreground);
585
+ box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
586
+ outline: none;
587
+ }
@@ -0,0 +1 @@
1
+ declare const styles: string; export default styles;
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@loykin/filter-input",
3
+ "version": "0.0.1-dev.0",
4
+ "description": "Config-driven React filter input with static, searchable, and remote option support.",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ },
15
+ "./styles": {
16
+ "types": "./dist/styles.d.ts",
17
+ "default": "./dist/styles.css"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist"
22
+ ],
23
+ "sideEffects": [
24
+ "./dist/styles.css"
25
+ ],
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "dependencies": {
30
+ "@base-ui/react": "^1.3.0",
31
+ "clsx": "^2.1.1"
32
+ },
33
+ "peerDependencies": {
34
+ "react": "^18.0.0 || ^19.0.0",
35
+ "react-dom": "^18.0.0 || ^19.0.0"
36
+ },
37
+ "devDependencies": {
38
+ "@types/react": "^19.0.0",
39
+ "@types/react-dom": "^19.0.0",
40
+ "tsup": "^8.4.0",
41
+ "typescript": "^5.9.3"
42
+ },
43
+ "keywords": [
44
+ "react",
45
+ "filter",
46
+ "input",
47
+ "select",
48
+ "autocomplete"
49
+ ],
50
+ "repository": {
51
+ "type": "git",
52
+ "url": "https://github.com/loykin/basekit.git",
53
+ "directory": "packages/filter-input"
54
+ },
55
+ "homepage": "https://loykin.github.io/basekit/playground/",
56
+ "bugs": {
57
+ "url": "https://github.com/loykin/basekit/issues"
58
+ },
59
+ "license": "MIT",
60
+ "scripts": {
61
+ "build": "tsc --noEmit && tsup && node scripts/build-css.mjs && echo 'declare const styles: string; export default styles;' > dist/styles.d.ts",
62
+ "build:css": "node scripts/build-css.mjs",
63
+ "dev": "tsup --watch",
64
+ "type-check": "tsc --noEmit"
65
+ }
66
+ }