@botiverse/raft-ui 0.10.4 → 0.10.6

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/dist/wip.d.mts CHANGED
@@ -1,5 +1,7 @@
1
- import { O as ButtonProps, T as DialogTrigger, i as DialogClose, s as DialogContentProps, t as Dialog, w as DialogTitleProps } from "./index-CDHLWJtB.mjs";
1
+ import { M as StyledProps, O as ButtonProps, T as DialogTrigger, i as DialogClose, j as DataAttributes, s as DialogContentProps, t as Dialog, w as DialogTitleProps } from "./index-CDHLWJtB.mjs";
2
2
  import { CSSProperties, ComponentPropsWithRef, ReactNode } from "react";
3
+ import { Button } from "@base-ui/react/button";
4
+ import { useRender } from "@base-ui/react/use-render";
3
5
  import { Combobox } from "@base-ui/react/combobox";
4
6
  //#region src/components/combobox-select/combobox-select.types.d.ts
5
7
  type ComboboxSelectValue = string | number;
@@ -22,6 +24,12 @@ interface ComboboxSelectMessages {
22
24
  chipDescription: string;
23
25
  inputDescription: string;
24
26
  remove: (label: string) => string;
27
+ /** The placeholder of the search input at the top of the phone's bottom sheet. */
28
+ search: string;
29
+ /** The button that closes the phone's bottom sheet of a multiple select. */
30
+ done: string;
31
+ /** The close button of the phone's bottom sheet. */
32
+ close: string;
25
33
  }
26
34
  type RootProps = Combobox.Root.Props<unknown, boolean>;
27
35
  type ComboboxSelectProps<Option = ComboboxSelectOption, Multiple extends boolean | undefined = false> = Pick<RootProps, "name" | "form" | "required" | "disabled" | "readOnly" | "open" | "defaultOpen" | "onOpenChange" | "onOpenChangeComplete" | "autoHighlight" | "autoComplete" | "inputValue" | "defaultInputValue" | "onInputValueChange"> & Pick<ComponentPropsWithRef<"input">, "id" | "ref" | "aria-label" | "aria-labelledby" | "aria-describedby" | "aria-invalid"> & {
@@ -66,16 +74,31 @@ type ComboboxSelectProps<Option = ComboboxSelectOption, Multiple extends boolean
66
74
  emptyContent?: ReactNode;
67
75
  loadingContent?: ReactNode;
68
76
  messages?: Partial<ComboboxSelectMessages>;
77
+ /**
78
+ * On a phone (a touch screen under 48rem), more selectable options than this open a
79
+ * bottom sheet instead of the anchored list.
80
+ * @default 10
81
+ */
82
+ sheetThreshold?: number;
83
+ /**
84
+ * The title of the phone's bottom sheet. Defaults to the field's name: `aria-label`,
85
+ * the text of `aria-labelledby`, or the `<label>` whose `for` is the field's `id`.
86
+ */
87
+ sheetTitle?: ReactNode;
88
+ /** The text input: the field on a desktop, the search input of the bottom sheet on a phone. */
69
89
  inputProps?: Omit<Combobox.Input.Props, "value" | "defaultValue" | "size" | "children">;
90
+ /** The portal of the list, and of the phone's anchored list and bottom sheet. */
70
91
  portalProps?: Combobox.Portal.Props;
92
+ /** The desktop list's positioner. A phone positions its list itself. */
71
93
  positionerProps?: Omit<Combobox.Positioner.Props, "children">;
94
+ /** The desktop list's popup. */
72
95
  popupProps?: Omit<Combobox.Popup.Props, "children">;
73
96
  className?: string;
74
97
  style?: CSSProperties;
75
98
  };
76
99
  //#endregion
77
100
  //#region src/components/combobox-select/combobox-select.d.ts
78
- export declare function ComboboxSelect<Option = ComboboxSelectOption, Multiple extends boolean | undefined = false>({ options, multiple, value, defaultValue, onValueChange, labelField, valueField, disabledField, fallbackOption, filterable, filter, remote, onSearch, loading, create, creatable, onCreate, clearable, showArrow, clearFilterAfterSelect, onClear, maxTagCount, size, status, placeholder, renderLabel, renderOption, renderTag, renderCreateLabel, emptyContent, loadingContent, messages, inputProps, portalProps, positionerProps, popupProps, className, style, id: idProp, ref, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, inputValue, defaultInputValue, onInputValueChange, disabled, readOnly, autoHighlight, ...rootProps }: ComboboxSelectProps<Option, Multiple>): import("react").JSX.Element;
101
+ export declare function ComboboxSelect<Option = ComboboxSelectOption, Multiple extends boolean | undefined = false>({ options, multiple, value, defaultValue, onValueChange, labelField, valueField, disabledField, fallbackOption, filterable, filter, remote, onSearch, loading, create, creatable, onCreate, clearable, showArrow, clearFilterAfterSelect, onClear, maxTagCount, size, status, placeholder, renderLabel, renderOption, renderTag, renderCreateLabel, emptyContent, loadingContent, messages, sheetThreshold, sheetTitle, inputProps, portalProps, positionerProps, popupProps, className, style, id: idProp, ref, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, inputValue, defaultInputValue, onInputValueChange, disabled, readOnly, autoHighlight, ...rootProps }: ComboboxSelectProps<Option, Multiple>): import("react").JSX.Element;
79
102
  //#endregion
80
103
  //#region src/components/announcement-dialog/announcement-dialog.d.ts
81
104
  export declare function AnnouncementDialogContent({ className, initialFocus, ref, ...props }: DialogContentProps): import("react").JSX.Element;
@@ -89,4 +112,170 @@ export declare function AnnouncementDialogFooter({ className, ...props }: Compon
89
112
  export declare function AnnouncementDialogAction({ className, ...props }: Omit<ButtonProps, "variant">): import("react").JSX.Element;
90
113
  export declare function AnnouncementDialogSecondaryAction({ className, ...props }: Omit<ButtonProps, "variant">): import("react").JSX.Element;
91
114
  //#endregion
92
- export { Dialog as AnnouncementDialog, DialogClose as AnnouncementDialogClose, DialogTrigger as AnnouncementDialogTrigger, type ComboboxSelectGroup, type ComboboxSelectMessages, type ComboboxSelectOption, type ComboboxSelectProps, type ComboboxSelectSelection, type ComboboxSelectValue };
115
+ //#region src/components/comment/comment-card.d.ts
116
+ type CommentCardProps = useRender.ComponentProps<"div"> & {
117
+ /** The discussion people are reading or replying to: an ink border, lifted. */
118
+ active?: boolean;
119
+ };
120
+ /**
121
+ * The card of one discussion: its comments, a line such as "2 replies", and
122
+ * the reply box when it is open. A `div`; which parts it holds (collapsed or
123
+ * open) is the caller's choice. To open it with a click, add
124
+ * `CommentCardTrigger`.
125
+ */
126
+ export declare function CommentCard({ className, render, active, ...props }: CommentCardProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
127
+ type CommentCardTriggerProps = useRender.ComponentProps<"button">;
128
+ /**
129
+ * A button laid over the whole card, for a collapsed card that opens when it
130
+ * is clicked or chosen with the keyboard. It has no text of its own: give it
131
+ * an `aria-label` ("Comment from Martin").
132
+ */
133
+ export declare function CommentCardTrigger({ className, render, ...props }: CommentCardTriggerProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
134
+ type CommentCardMetaProps = useRender.ComponentProps<"div">;
135
+ /**
136
+ * A short line about the discussion, in the caller's words: how many replies
137
+ * it has, that it is about the whole document, or that the passage it was on
138
+ * can no longer be found.
139
+ */
140
+ export declare function CommentCardMeta({ className, render, ...props }: CommentCardMetaProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
141
+ type CommentCardQuoteProps = useRender.ComponentProps<"span">;
142
+ /**
143
+ * The passage the discussion is about, in the caller's words (usually the
144
+ * quoted text). Hidden on screen, where the card's place beside the
145
+ * highlighted passage says it; give it an `id` and point the
146
+ * `aria-describedby` of `CommentCardTrigger` or `CommentMarker` at it, so a
147
+ * screen reader says which passage a card is about.
148
+ */
149
+ export declare function CommentCardQuote({ className, render, ...props }: CommentCardQuoteProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
150
+ //#endregion
151
+ //#region src/components/comment/comment-entry.d.ts
152
+ type CommentEntryProps = useRender.ComponentProps<"div">;
153
+ /** One comment in a discussion: its header, then its text. */
154
+ export declare function CommentEntry({ className, render, ...props }: CommentEntryProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
155
+ type CommentEntryHeaderProps = useRender.ComponentProps<"div">;
156
+ /** One line: the author's `Avatar` (`size="xs"`), `CommentEntryAuthor`, then `CommentEntryTime`. */
157
+ export declare function CommentEntryHeader({ className, render, ...props }: CommentEntryHeaderProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
158
+ type CommentEntryAuthorProps = useRender.ComponentProps<"span">;
159
+ /** Who wrote the comment, in bold. It truncates; the time after it doesn't. */
160
+ export declare function CommentEntryAuthor({ className, render, ...props }: CommentEntryAuthorProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
161
+ type CommentEntryTimeProps = useRender.ComponentProps<"time">;
162
+ /**
163
+ * When the comment was written, right after the author. A `<time>`: pass the
164
+ * moment in `dateTime` (ISO 8601).
165
+ */
166
+ export declare function CommentEntryTime({ className, render, ...props }: CommentEntryTimeProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
167
+ type CommentEntryBodyProps = useRender.ComponentProps<"div"> & {
168
+ /** Cuts the text to 2 lines, for a collapsed card. */
169
+ clamp?: boolean;
170
+ };
171
+ /** What the comment says. */
172
+ export declare function CommentEntryBody({ className, render, clamp, ...props }: CommentEntryBodyProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
173
+ //#endregion
174
+ //#region src/components/comment/comment-highlight.d.ts
175
+ /** The highlight of every passage that has comments (`::highlight(raft-comment)` in styles.css). */
176
+ export declare const COMMENT_HIGHLIGHT = "raft-comment";
177
+ /** The highlight of the passage of the open discussion (`::highlight(raft-comment-active)`). */
178
+ export declare const COMMENT_HIGHLIGHT_ACTIVE = "raft-comment-active";
179
+ /**
180
+ * Highlights the passages comments are on with the CSS Custom Highlight API,
181
+ * so the document's DOM is never changed: no `<mark>` is wrapped around its
182
+ * text. Register the ranges of every anchored comment under
183
+ * `COMMENT_HIGHLIGHT`, and the open discussion's under
184
+ * `COMMENT_HIGHLIGHT_ACTIVE`, which paints over it. Passing no ranges clears
185
+ * the name. Returns a function that clears it.
186
+ *
187
+ * Where the browser has no `CSS.highlights`, it does nothing: the passages are
188
+ * not highlighted, and the cards still say where they belong.
189
+ */
190
+ export declare function setCommentHighlights(name: string, ranges: Iterable<Range>): () => void;
191
+ //#endregion
192
+ //#region src/components/comment/comment-margin.d.ts
193
+ type CommentMarginProps = useRender.ComponentProps<"div"> & {
194
+ /** Space between two cards that would otherwise touch, in px. Default 8. */
195
+ gap?: number;
196
+ };
197
+ /**
198
+ * The column beside a document that holds its comment cards, each level with
199
+ * the passage it is about. It measures its `CommentMarginItem`s with one
200
+ * `ResizeObserver`, resolves their collisions with
201
+ * `resolveCommentMarginLayout`, and takes the height the lowest card needs.
202
+ * Place it beside the document so that its top is the top the items' `top`
203
+ * is measured from.
204
+ */
205
+ export declare function CommentMargin({ className, render, style, gap, ...props }: CommentMarginProps): import("react").JSX.Element;
206
+ type CommentMarginItemProps = useRender.ComponentProps<"div"> & {
207
+ /** Where the card's anchor is: its y, in px, from the top of the margin. */
208
+ top: number;
209
+ /** Pins this card to its anchor and moves the others around it. */
210
+ active?: boolean;
211
+ };
212
+ /**
213
+ * One card's place in a `CommentMargin`. It sits at `top`, or lower when the
214
+ * card above it is in the way; the active one stays at `top` and the others
215
+ * make room. Items with the same `top` keep the order they were first
216
+ * rendered in. The resolved top is `data-top`, applied as a `translateY`.
217
+ */
218
+ export declare function CommentMarginItem({ className, render, style, top, active, ...props }: CommentMarginItemProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
219
+ //#endregion
220
+ //#region src/components/comment/comment-margin-layout.d.ts
221
+ /** One card in the margin: where its anchor is and how tall the card is, in px. */
222
+ type CommentMarginLayoutItem = {
223
+ id: string;
224
+ /** The y of the card's anchor, measured from the top of the margin. */
225
+ top: number;
226
+ /** The card's rendered height. */
227
+ height: number;
228
+ };
229
+ type CommentMarginLayoutOptions = {
230
+ /** Space between two cards that would otherwise touch, in px. Default 8. */
231
+ gap?: number;
232
+ /** The card pinned to its anchor; the others make room around it. */
233
+ activeId?: string | null;
234
+ };
235
+ type CommentMarginLayout = {
236
+ /** The resolved top of each card, by id. */
237
+ tops: Record<string, number>;
238
+ /** The bottom of the lowest card: the height the margin needs. */
239
+ height: number;
240
+ };
241
+ /**
242
+ * Places the cards of a comment margin the way Google Docs does. Cards keep
243
+ * document order (by their anchor's top; equal tops keep the order given) and
244
+ * never overlap: each sits at its anchor, or `gap` below the card before it.
245
+ * The active card is pinned to its anchor instead, the cards above it are
246
+ * pushed up to make room and the cards below it pushed down. Nothing goes
247
+ * above 0: when the cards above the active one don't fit between 0 and its
248
+ * anchor, they stack from 0 and the active card follows them.
249
+ */
250
+ export declare function resolveCommentMarginLayout(items: readonly CommentMarginLayoutItem[], { gap, activeId }?: CommentMarginLayoutOptions): CommentMarginLayout;
251
+ //#endregion
252
+ //#region src/components/comment/comment-marker.d.ts
253
+ type CommentMarkerProps = StyledProps<Button.Props> & DataAttributes & {
254
+ /** The marker of the discussion that is open. */
255
+ active?: boolean;
256
+ };
257
+ /**
258
+ * Where there is no room for a margin: a small button beside a passage that
259
+ * has comments, with the authors' avatars (an `AvatarGroup` of up to 3
260
+ * `size="2xs"` avatars) and the count. It opens the discussion, in a bottom
261
+ * sheet. Give it an `aria-label` that starts with the count ("2 comments").
262
+ */
263
+ export declare function CommentMarker({ className, render, nativeButton, active, ...props }: CommentMarkerProps): import("react").JSX.Element;
264
+ //#endregion
265
+ //#region src/components/comment/use-comment-margin-fits.d.ts
266
+ type UseCommentMarginFitsOptions = {
267
+ /** The narrowest the viewer may be for the margin to show, in px. Default 784. */
268
+ minWidth?: number;
269
+ };
270
+ /**
271
+ * Whether a viewer has room for a comment margin beside its document: true
272
+ * only on a desktop (from 768px with a mouse or a trackpad, the query the
273
+ * desktop metrics use) and while `element`, the viewer that holds the
274
+ * document and the margin, is at least `minWidth` wide. Otherwise show
275
+ * `CommentMarker`s and open discussions in a bottom sheet. Cards and markers
276
+ * are different trees, so this is measured in JavaScript (a
277
+ * `ResizeObserver` on the element), not decided by a container query.
278
+ */
279
+ export declare function useCommentMarginFits(element: Element | null, { minWidth }?: UseCommentMarginFitsOptions): boolean;
280
+ //#endregion
281
+ export { Dialog as AnnouncementDialog, DialogClose as AnnouncementDialogClose, DialogTrigger as AnnouncementDialogTrigger, type ComboboxSelectGroup, type ComboboxSelectMessages, type ComboboxSelectOption, type ComboboxSelectProps, type ComboboxSelectSelection, type ComboboxSelectValue, type CommentCardMetaProps, type CommentCardProps, type CommentCardQuoteProps, type CommentCardTriggerProps, type CommentEntryAuthorProps, type CommentEntryBodyProps, type CommentEntryHeaderProps, type CommentEntryProps, type CommentEntryTimeProps, type CommentMarginItemProps, type CommentMarginLayout, type CommentMarginLayoutItem, type CommentMarginLayoutOptions, type CommentMarginProps, type CommentMarkerProps, type UseCommentMarginFitsOptions };