@bitbaum/chatkit 0.2.1 → 0.7.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.
Files changed (63) hide show
  1. package/README.md +104 -8
  2. package/bin/chatkit-check-file-inputs.mjs +87 -0
  3. package/dist/attachments.d.ts +37 -0
  4. package/dist/attachments.d.ts.map +1 -1
  5. package/dist/attachments.js +75 -1
  6. package/dist/attachments.js.map +1 -1
  7. package/dist/composer.d.ts +4 -1
  8. package/dist/composer.d.ts.map +1 -1
  9. package/dist/composer.js +4 -2
  10. package/dist/composer.js.map +1 -1
  11. package/dist/dictation.d.ts +62 -2
  12. package/dist/dictation.d.ts.map +1 -1
  13. package/dist/dictation.js +103 -0
  14. package/dist/dictation.js.map +1 -1
  15. package/dist/image.d.ts +7 -0
  16. package/dist/image.d.ts.map +1 -0
  17. package/dist/image.js +41 -0
  18. package/dist/image.js.map +1 -0
  19. package/dist/index.d.ts +2 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +2 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/react/AttachMenu.d.ts +37 -0
  24. package/dist/react/AttachMenu.d.ts.map +1 -0
  25. package/dist/react/AttachMenu.js +70 -0
  26. package/dist/react/AttachMenu.js.map +1 -0
  27. package/dist/react/Composer.d.ts +24 -2
  28. package/dist/react/Composer.d.ts.map +1 -1
  29. package/dist/react/Composer.js +59 -10
  30. package/dist/react/Composer.js.map +1 -1
  31. package/dist/react/Thread.d.ts +27 -2
  32. package/dist/react/Thread.d.ts.map +1 -1
  33. package/dist/react/Thread.js +17 -4
  34. package/dist/react/Thread.js.map +1 -1
  35. package/dist/react/attach.d.ts +17 -0
  36. package/dist/react/attach.d.ts.map +1 -0
  37. package/dist/react/attach.js +16 -0
  38. package/dist/react/attach.js.map +1 -0
  39. package/dist/react/hooks.d.ts +8 -1
  40. package/dist/react/hooks.d.ts.map +1 -1
  41. package/dist/react/hooks.js +27 -3
  42. package/dist/react/hooks.js.map +1 -1
  43. package/dist/react/icons.d.ts +3 -0
  44. package/dist/react/icons.d.ts.map +1 -1
  45. package/dist/react/icons.js +3 -0
  46. package/dist/react/icons.js.map +1 -1
  47. package/dist/react/index.d.ts +3 -1
  48. package/dist/react/index.d.ts.map +1 -1
  49. package/dist/react/index.js +2 -1
  50. package/dist/react/index.js.map +1 -1
  51. package/dist/react/use-attachments.d.ts.map +1 -1
  52. package/dist/react/use-attachments.js +6 -34
  53. package/dist/react/use-attachments.js.map +1 -1
  54. package/dist/react/use-dictation.d.ts +23 -0
  55. package/dist/react/use-dictation.d.ts.map +1 -1
  56. package/dist/react/use-dictation.js +175 -13
  57. package/dist/react/use-dictation.js.map +1 -1
  58. package/dist/replies.d.ts +41 -0
  59. package/dist/replies.d.ts.map +1 -0
  60. package/dist/replies.js +84 -0
  61. package/dist/replies.js.map +1 -0
  62. package/package.json +9 -1
  63. package/styles.css +179 -3
package/styles.css CHANGED
@@ -47,14 +47,16 @@
47
47
 
48
48
  .ck-composer-wrap,
49
49
  .ck-thread-wrap,
50
- .ck-starters {
50
+ .ck-starters,
51
+ .ck-replies {
51
52
  font-family: var(--ck-font);
52
53
  color: var(--ck-fg);
53
54
  }
54
55
 
55
56
  .ck-composer-wrap *,
56
57
  .ck-thread-wrap *,
57
- .ck-starters * {
58
+ .ck-starters *,
59
+ .ck-replies * {
58
60
  box-sizing: border-box;
59
61
  }
60
62
 
@@ -195,7 +197,7 @@
195
197
  color: var(--ck-fg);
196
198
  border: 1px solid var(--ck-line-2);
197
199
  }
198
- :where(.ck-composer-wrap, .ck-thread-wrap, .ck-starters) button:focus-visible,
200
+ :where(.ck-composer-wrap, .ck-thread-wrap, .ck-starters, .ck-replies) button:focus-visible,
199
201
  .ck-input:focus-visible {
200
202
  outline: 2px solid var(--ck-accent);
201
203
  outline-offset: 2px;
@@ -275,6 +277,22 @@
275
277
  .ck-voice-wave > span:nth-child(5n) {
276
278
  animation-delay: -0.8s;
277
279
  }
280
+ /* the words as they are heard: one line, its end always in view, the start
281
+ fading out — the person reads the newest words, not the oldest */
282
+ .ck-voice-live {
283
+ flex: 1;
284
+ min-width: 0;
285
+ overflow: hidden;
286
+ white-space: nowrap;
287
+ font-size: 0.9375rem;
288
+ line-height: 1.4;
289
+ color: var(--ck-fg);
290
+ -webkit-mask-image: linear-gradient(to right, transparent, #000 1.75rem);
291
+ mask-image: linear-gradient(to right, transparent, #000 1.75rem);
292
+ }
293
+ .ck-voice-live-dim {
294
+ color: var(--ck-fg-3);
295
+ }
278
296
  .ck-voice-timer {
279
297
  flex-shrink: 0;
280
298
  font-size: 0.9375rem;
@@ -309,6 +327,25 @@
309
327
  flex: 1;
310
328
  min-width: 0;
311
329
  }
330
+ .ck-problem-detail {
331
+ color: var(--ck-muted);
332
+ }
333
+ .ck-problem-retry {
334
+ flex-shrink: 0;
335
+ min-height: 2rem;
336
+ padding: 0 0.75rem;
337
+ border: 1px solid var(--ck-line-2);
338
+ border-radius: 999px;
339
+ background: transparent;
340
+ color: var(--ck-fg);
341
+ font: inherit;
342
+ font-size: 0.875rem;
343
+ cursor: pointer;
344
+ }
345
+ .ck-problem-retry:disabled {
346
+ opacity: 0.5;
347
+ cursor: default;
348
+ }
312
349
  .ck-problem-x {
313
350
  display: inline-flex;
314
351
  flex-shrink: 0;
@@ -651,6 +688,38 @@
651
688
  color: var(--ck-fg);
652
689
  }
653
690
 
691
+ /* suggested replies — under the latest answer, one tap sends */
692
+ .ck-replies {
693
+ display: flex;
694
+ flex-wrap: wrap;
695
+ gap: 0.5rem;
696
+ min-width: 0;
697
+ margin-top: 0.75rem;
698
+ }
699
+ .ck-reply {
700
+ min-width: var(--ck-target);
701
+ min-height: var(--ck-target);
702
+ max-width: 100%;
703
+ padding: 0.5rem 0.875rem;
704
+ border: 1px solid var(--ck-line);
705
+ border-radius: 999px;
706
+ background: var(--ck-bg);
707
+ color: var(--ck-fg);
708
+ font: inherit;
709
+ font-size: 0.9375rem;
710
+ line-height: 1.25;
711
+ text-align: left;
712
+ overflow-wrap: anywhere;
713
+ cursor: pointer;
714
+ }
715
+ .ck-reply:hover {
716
+ border-color: var(--ck-accent);
717
+ }
718
+ .ck-reply:disabled {
719
+ opacity: 0.5;
720
+ cursor: default;
721
+ }
722
+
654
723
  .ck-spin {
655
724
  animation: ck-spin 0.9s linear infinite;
656
725
  }
@@ -687,3 +756,110 @@
687
756
  animation: none;
688
757
  }
689
758
  }
759
+
760
+ /* attach sheet: Camera / Photos / Files, from the bottom edge on a phone —
761
+ where the thumb already is after tapping the paperclip. A native <dialog>
762
+ in the top layer, so no panel around the composer can clip it. */
763
+ .ck-sheet {
764
+ width: 100%;
765
+ max-width: 32rem;
766
+ max-height: none;
767
+ margin: auto auto 0;
768
+ padding: 0;
769
+ border: 0;
770
+ background: transparent;
771
+ color: var(--ck-fg);
772
+ font-family: var(--ck-font);
773
+ }
774
+ .ck-sheet::backdrop {
775
+ background: color-mix(in srgb, #000 40%, transparent);
776
+ }
777
+ .ck-sheet[open] .ck-sheet-panel {
778
+ animation: ck-rise 0.18s ease-out;
779
+ }
780
+ .ck-sheet-panel {
781
+ padding: 0.75rem 1rem calc(1rem + env(safe-area-inset-bottom, 0px));
782
+ border: 1px solid var(--ck-line);
783
+ border-bottom: 0;
784
+ border-radius: var(--ck-radius) var(--ck-radius) 0 0;
785
+ background: var(--ck-bg);
786
+ }
787
+ .ck-sheet-head {
788
+ display: flex;
789
+ align-items: center;
790
+ justify-content: space-between;
791
+ gap: 0.5rem;
792
+ margin-bottom: 0.75rem;
793
+ }
794
+ .ck-sheet-title {
795
+ font-size: 1rem;
796
+ font-weight: 600;
797
+ }
798
+ .ck-sheet-close {
799
+ border-color: transparent;
800
+ background: transparent;
801
+ }
802
+ .ck-attach-sources {
803
+ display: grid;
804
+ grid-auto-flow: column;
805
+ grid-auto-columns: minmax(0, 1fr);
806
+ gap: 0.5rem;
807
+ }
808
+ .ck-attach-source {
809
+ display: flex;
810
+ flex-direction: column;
811
+ align-items: center;
812
+ justify-content: center;
813
+ gap: 0.375rem;
814
+ min-height: 5rem;
815
+ padding: 0.75rem 0.25rem;
816
+ border: 1px solid var(--ck-line);
817
+ border-radius: var(--ck-radius-sm);
818
+ background: var(--ck-raised);
819
+ color: var(--ck-fg);
820
+ font: inherit;
821
+ font-size: 0.9375rem;
822
+ cursor: pointer;
823
+ }
824
+ .ck-attach-source > svg {
825
+ font-size: 1.375rem;
826
+ color: var(--ck-fg-2);
827
+ }
828
+ .ck-attach-source:hover {
829
+ border-color: var(--ck-line-2);
830
+ }
831
+ .ck-attach-source:focus-visible,
832
+ .ck-sheet-close:focus-visible {
833
+ outline: 2px solid var(--ck-accent);
834
+ outline-offset: 2px;
835
+ }
836
+ .ck-attach-trigger {
837
+ display: inline-flex;
838
+ align-items: center;
839
+ justify-content: center;
840
+ gap: 0.375rem;
841
+ min-height: var(--ck-target);
842
+ padding: 0 1rem;
843
+ border: 1px solid var(--ck-line);
844
+ border-radius: 999px;
845
+ background: var(--ck-raised);
846
+ color: var(--ck-fg);
847
+ font: inherit;
848
+ font-size: 0.9375rem;
849
+ cursor: pointer;
850
+ }
851
+ .ck-attach-trigger:disabled {
852
+ cursor: not-allowed;
853
+ opacity: 0.45;
854
+ }
855
+ @keyframes ck-rise {
856
+ from {
857
+ transform: translateY(1.5rem);
858
+ opacity: 0;
859
+ }
860
+ }
861
+ @media (prefers-reduced-motion: reduce) {
862
+ .ck-sheet[open] .ck-sheet-panel {
863
+ animation: none;
864
+ }
865
+ }