@chai-ui/react 0.8.0 → 0.10.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.
package/src/index.ts CHANGED
@@ -11,6 +11,7 @@ export * from "./useMediaAnalyzer.js";
11
11
  // to import from @chai-ui/react.
12
12
  export {
13
13
  createFalEngine,
14
+ createFalTranscriber,
14
15
  createOpenRouterEngine,
15
16
  createMockEngine,
16
17
  mockEngine,
@@ -41,6 +42,9 @@ export type {
41
42
  MediaKind,
42
43
  ModelOption,
43
44
  OutputKind,
45
+ Transcribe,
46
+ VoiceClip,
47
+ VoiceInputConfig,
44
48
  ParameterOption,
45
49
  RegionBox,
46
50
  RegionFormat,
@@ -4,6 +4,7 @@ import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState } fr
4
4
  import { MdOutlinedTextField } from "@material/web/textfield/outlined-text-field.js";
5
5
  import { MdCheckbox } from "@material/web/checkbox/checkbox.js";
6
6
  import { Toggle } from "./Toggle.js";
7
+ import { CheckIcon } from "../icons.js";
7
8
 
8
9
  const MdOutlinedTextFieldElement = createComponent({
9
10
  react: React,
@@ -26,18 +27,6 @@ const MdCheckboxElement = createComponent({
26
27
  elementClass: MdCheckbox,
27
28
  });
28
29
 
29
- /** MD3 "check" symbol (Figma) — marking the selected row in any option list below. */
30
- function CheckIcon() {
31
- return (
32
- <svg viewBox="0 0 18 18" fill="none" aria-hidden="true">
33
- <path
34
- d="M7.1625 13.5L2.8875 9.225L3.95625 8.15625L7.1625 11.3625L14.0438 4.48125L15.1125 5.55L7.1625 13.5Z"
35
- fill="currentColor"
36
- />
37
- </svg>
38
- );
39
- }
40
-
41
30
  export interface SearchMenuOption {
42
31
  id: string;
43
32
  /** Shown on the trigger once this option is selected, and used for search-filtering. Keep this the short/canonical name. */
package/src/style.css CHANGED
@@ -751,6 +751,99 @@
751
751
  flex-wrap: wrap;
752
752
  }
753
753
 
754
+ .chai-composer__controls-end {
755
+ display: flex;
756
+ align-items: center;
757
+ gap: var(--chai-space-2);
758
+ }
759
+
760
+ /* Voice input: the mic left of submit. While recording it becomes a stop
761
+ button (a filled square in a ringed circle) and a waveform replaces the
762
+ prompt; while transcribing, a spinner. */
763
+ .chai-composer__voice {
764
+ display: flex;
765
+ align-items: center;
766
+ }
767
+
768
+ .chai-composer__voice-button {
769
+ display: flex;
770
+ align-items: center;
771
+ justify-content: center;
772
+ width: 40px;
773
+ height: 40px;
774
+ padding: 0;
775
+ border: 2px solid transparent;
776
+ border-radius: var(--chai-radius-full);
777
+ background: transparent;
778
+ color: var(--chai-composer-text);
779
+ cursor: pointer;
780
+ transition: background-color var(--chai-motion-duration-fast) var(--chai-motion-easing-standard);
781
+ }
782
+
783
+ .chai-composer__voice-button:hover:not(:disabled) {
784
+ background: var(--chai-composer-hover);
785
+ }
786
+
787
+ .chai-composer__voice-button:disabled {
788
+ cursor: not-allowed;
789
+ opacity: 0.5;
790
+ }
791
+
792
+ .chai-composer__voice-button svg {
793
+ width: 24px;
794
+ height: 24px;
795
+ }
796
+
797
+ .chai-composer__voice[data-status="recording"] .chai-composer__voice-button {
798
+ border-color: var(--chai-composer-text);
799
+ background: var(--chai-composer-hover);
800
+ }
801
+
802
+ .chai-composer__voice[data-status="recording"] .chai-composer__voice-button svg {
803
+ width: 18px;
804
+ height: 18px;
805
+ }
806
+
807
+ /* Same row height as the prompt it stands in for. */
808
+ .chai-composer__waveform {
809
+ display: flex;
810
+ align-items: center;
811
+ gap: var(--chai-space-3);
812
+ min-height: var(--chai-type-leading-body-large);
813
+ }
814
+
815
+ .chai-composer__waveform-bars {
816
+ flex: 1;
817
+ display: flex;
818
+ align-items: center;
819
+ justify-content: space-between;
820
+ height: var(--chai-type-leading-body-large);
821
+ min-width: 0;
822
+ }
823
+
824
+ .chai-composer__waveform-bar {
825
+ width: 2px;
826
+ border-radius: var(--chai-radius-full);
827
+ background: var(--chai-composer-text);
828
+ }
829
+
830
+ .chai-composer__waveform-time {
831
+ color: var(--chai-composer-text);
832
+ font-family: var(--chai-type-family-material);
833
+ font-size: var(--chai-type-size-label-large);
834
+ font-weight: var(--chai-type-weight-material-medium);
835
+ font-variant-numeric: tabular-nums;
836
+ }
837
+
838
+ .chai-composer__voice-spinner {
839
+ width: 20px;
840
+ height: 20px;
841
+ border-radius: 50%;
842
+ border: 2px solid var(--chai-color-semantic-control-border-faint);
843
+ border-top-color: var(--chai-color-semantic-accent);
844
+ animation: chai-spin var(--chai-motion-duration-steep) linear infinite;
845
+ }
846
+
754
847
  /* Neutral trigger text, not `--md-sys-color-primary` green (account
755
848
  holder correction: "don't make dropdown select menu buttons green when
756
849
  they don't need to be"). */