@blocknote/ariakit 0.30.1 → 0.31.1

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.
@@ -15,13 +15,17 @@ export const TextInput = forwardRef<
15
15
  className,
16
16
  name,
17
17
  label,
18
+ variant,
18
19
  icon,
19
20
  value,
20
21
  autoFocus,
21
22
  placeholder,
23
+ disabled,
22
24
  onKeyDown,
23
25
  onChange,
24
26
  onSubmit,
27
+ autoComplete,
28
+ rightSection,
25
29
  ...rest
26
30
  } = props;
27
31
 
@@ -33,16 +37,23 @@ export const TextInput = forwardRef<
33
37
  <div className="bn-ak-input-wrapper">
34
38
  {icon}
35
39
  <AriakitFormInput
36
- className={mergeCSSClasses("bn-ak-input", className || "")}
40
+ className={mergeCSSClasses(
41
+ "bn-ak-input",
42
+ className || "",
43
+ variant === "large" ? "bn-ak-input-large" : "",
44
+ )}
37
45
  ref={ref}
38
46
  name={name}
39
47
  value={value}
40
48
  autoFocus={autoFocus}
41
49
  placeholder={placeholder}
50
+ disabled={disabled}
42
51
  onKeyDown={onKeyDown}
43
52
  onChange={onChange}
44
53
  onSubmit={onSubmit}
54
+ autoComplete={autoComplete}
45
55
  />
56
+ {rightSection}
46
57
  </div>
47
58
  </>
48
59
  );
package/src/style.css CHANGED
@@ -11,6 +11,10 @@
11
11
  gap: 0.5rem;
12
12
  }
13
13
 
14
+ .bn-ak-input-wrapper svg {
15
+ width: 24px;
16
+ }
17
+
14
18
  .bn-ak-toolbar {
15
19
  height: fit-content;
16
20
  overflow: scroll;
@@ -68,9 +72,11 @@
68
72
  overflow: visible;
69
73
  }
70
74
 
71
- .bn-ariakit .bn-suggestion-menu {
75
+ .bn-ariakit .bn-suggestion-menu,
76
+ .bn-ariakit .ai-suggestion-menu {
72
77
  height: fit-content;
73
78
  max-height: inherit;
79
+ overflow: auto;
74
80
  }
75
81
 
76
82
  .bn-ariakit .bn-color-picker-dropdown {
@@ -81,14 +87,31 @@
81
87
  flex: 1;
82
88
  }
83
89
 
90
+ .bn-suggestion-menu-item-small .bn-ak-suggestion-menu-item-title {
91
+ font-size: 0.875rem;
92
+ }
93
+
84
94
  .bn-ak-suggestion-menu-item-subtitle {
85
95
  font-size: 0.7rem;
86
96
  }
87
97
 
98
+ .bn-suggestion-menu-item-small .bn-ak-suggestion-menu-item-subtitle {
99
+ display: none;
100
+ }
101
+
88
102
  .bn-ak-suggestion-menu-item-section[data-position="left"] {
103
+ align-items: center;
104
+ display: flex;
105
+ justify-content: center;
106
+
89
107
  padding: 8px;
90
108
  }
91
109
 
110
+ .bn-suggestion-menu-item-small
111
+ .bn-ak-suggestion-menu-item-section[data-position="left"] {
112
+ padding: 0;
113
+ }
114
+
92
115
  .bn-ak-suggestion-menu-item-section[data-position="right"] {
93
116
  --border: rgb(0 0 0/13%);
94
117
  --highlight: rgb(255 255 255/20%);
@@ -103,6 +126,24 @@
103
126
  padding-inline: 4px;
104
127
  }
105
128
 
129
+ @keyframes spin {
130
+ 0% {
131
+ transform: rotate(0deg);
132
+ }
133
+ 100% {
134
+ transform: rotate(360deg);
135
+ }
136
+ }
137
+
138
+ .bn-ariakit .bn-suggestion-menu-loader {
139
+ align-items: center;
140
+ animation: spin 1s linear infinite;
141
+ display: flex;
142
+ height: 16px;
143
+ justify-content: center;
144
+ width: 16px;
145
+ }
146
+
106
147
  .bn-ariakit .bn-grid-suggestion-menu {
107
148
  background: var(--bn-colors-menu-background);
108
149
  border-radius: var(--bn-border-radius-large);
@@ -309,6 +350,48 @@
309
350
  padding: 0;
310
351
  }
311
352
 
353
+ .bn-ariakit .bn-combobox .bn-ak-input-wrapper {
354
+ display: flex;
355
+ border-radius: 0.5rem;
356
+ border-width: 1px;
357
+ border-style: solid;
358
+ border-color: hsl(204 20% 88%);
359
+ background-color: hsl(204 20% 100%);
360
+ padding: 0.5rem;
361
+ color: hsl(204 4% 0%);
362
+ box-shadow:
363
+ 0 10px 15px -3px rgb(0 0 0 / 0.1),
364
+ 0 4px 6px -4px rgb(0 0 0 / 0.1);
365
+ }
366
+
367
+ .bn-ariakit .bn-combobox .bn-ak-input-wrapper:where(.dark, .dark *) {
368
+ border-color: hsl(204 4% 24%);
369
+ background-color: hsl(204 4% 16%);
370
+ color: hsl(204 20% 100%);
371
+ box-shadow:
372
+ 0 10px 15px -3px rgb(0 0 0 / 0.25),
373
+ 0 4px 6px -4px rgb(0 0 0 / 0.1);
374
+ }
375
+
376
+ .bn-ariakit .bn-combobox .bn-ak-input {
377
+ background: transparent;
378
+ border: none;
379
+ box-shadow: none;
380
+ outline: none;
381
+ }
382
+
383
+ .bn-ariakit .bn-combobox .bn-combobox-icon,
384
+ .bn-ariakit .bn-combobox .bn-combobox-right-section {
385
+ align-items: start;
386
+ display: flex;
387
+ justify-content: center;
388
+ width: 24px;
389
+ }
390
+
391
+ .bn-ariakit .bn-combobox .bn-combobox-error {
392
+ color: var(--bn-colors-highlights-red-background);
393
+ }
394
+
312
395
  .bn-ariakit .bn-comment-actions-wrapper {
313
396
  align-items: start;
314
397
  display: flex;
@@ -19,7 +19,7 @@ export const SuggestionMenuItem = forwardRef<
19
19
 
20
20
  const overflow = elementOverflow(
21
21
  itemRef.current,
22
- document.querySelector(".bn-suggestion-menu")!,
22
+ document.querySelector(".bn-suggestion-menu, #ai-suggestion-menu")!, // TODO
23
23
  );
24
24
 
25
25
  if (overflow === "top") {
@@ -34,6 +34,7 @@ export const SuggestionMenuItem = forwardRef<
34
34
  className={mergeCSSClasses("bn-ak-menu-item", className || "")}
35
35
  ref={mergeRefs([ref, itemRef])}
36
36
  id={id}
37
+ onMouseDown={(event) => event.preventDefault()}
37
38
  onClick={onClick}
38
39
  role="option"
39
40
  aria-selected={isSelected || undefined}
@@ -6,13 +6,22 @@ export const SuggestionMenuLoader = forwardRef<
6
6
  HTMLDivElement,
7
7
  ComponentProps["SuggestionMenu"]["Loader"]
8
8
  >((props, ref) => {
9
- const { className, children, ...rest } = props;
9
+ const { className, ...rest } = props;
10
10
 
11
11
  assertEmpty(rest);
12
12
 
13
13
  return (
14
14
  <div className={className} ref={ref}>
15
- {children}
15
+ {/* Taken from Google Material Icons */}
16
+ {/* https://fonts.google.com/icons?selected=Material+Symbols+Rounded:progress_activity:FILL@0;wght@400;GRAD@0;opsz@24&icon.query=load&icon.size=24&icon.color=%23e8eaed&icon.set=Material+Symbols&icon.style=Rounded&icon.platform=web */}
17
+ <svg
18
+ xmlns="http://www.w3.org/2000/svg"
19
+ height="1em"
20
+ viewBox="0 -960 960 960"
21
+ width="1em"
22
+ fill="#e8eaed">
23
+ <path d="M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 31.5-155.5t86-127Q252-817 325-848.5T480-880q17 0 28.5 11.5T520-840q0 17-11.5 28.5T480-800q-133 0-226.5 93.5T160-480q0 133 93.5 226.5T480-160q133 0 226.5-93.5T800-480q0-17 11.5-28.5T840-520q17 0 28.5 11.5T880-480q0 82-31.5 155t-86 127.5q-54.5 54.5-127 86T480-80Z" />
24
+ </svg>
16
25
  </div>
17
26
  );
18
27
  });
@@ -4,8 +4,7 @@ import { assertEmpty, mergeCSSClasses } from "@blocknote/core";
4
4
  import { ComponentProps } from "@blocknote/react";
5
5
  import { forwardRef } from "react";
6
6
 
7
- type ToolbarProps = ComponentProps["FormattingToolbar"]["Root"] &
8
- ComponentProps["LinkToolbar"]["Root"];
7
+ type ToolbarProps = ComponentProps["Generic"]["Toolbar"]["Root"];
9
8
 
10
9
  export const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(
11
10
  (props, ref) => {
@@ -9,8 +9,7 @@ import { assertEmpty, isSafari, mergeCSSClasses } from "@blocknote/core";
9
9
  import { ComponentProps } from "@blocknote/react";
10
10
  import { forwardRef } from "react";
11
11
 
12
- type ToolbarButtonProps = ComponentProps["FormattingToolbar"]["Button"] &
13
- ComponentProps["LinkToolbar"]["Button"];
12
+ type ToolbarButtonProps = ComponentProps["Generic"]["Toolbar"]["Button"];
14
13
 
15
14
  /**
16
15
  * Helper for basic buttons that show in the formatting toolbar.
@@ -2,11 +2,15 @@ export declare const TextInput: import("react").ForwardRefExoticComponent<{
2
2
  className?: string;
3
3
  name: string;
4
4
  label?: string;
5
+ variant?: "default" | "large";
5
6
  icon: import("react").ReactNode;
7
+ rightSection?: import("react").ReactNode;
6
8
  autoFocus?: boolean;
7
- placeholder: string;
9
+ placeholder?: string;
10
+ disabled?: boolean;
8
11
  value: string;
9
12
  onKeyDown: (event: import("react").KeyboardEvent<HTMLInputElement>) => void;
10
13
  onChange: (event: import("react").ChangeEvent<HTMLInputElement>) => void;
11
14
  onSubmit?: () => void;
15
+ autoComplete?: import("react").HTMLInputAutoCompleteAttribute;
12
16
  } & import("react").RefAttributes<HTMLInputElement>>;
@@ -3,5 +3,5 @@ export declare const SuggestionMenuItem: import("react").ForwardRefExoticCompone
3
3
  id: string;
4
4
  isSelected: boolean;
5
5
  onClick: () => void;
6
- item: import("@blocknote/react").DefaultReactSuggestionItem;
6
+ item: Omit<import("@blocknote/react").DefaultReactSuggestionItem, "onItemClick">;
7
7
  } & import("react").RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,3 @@
1
1
  export declare const SuggestionMenuLoader: import("react").ForwardRefExoticComponent<{
2
2
  className?: string;
3
- children?: import("react").ReactNode;
4
3
  } & import("react").RefAttributes<HTMLDivElement>>;