@danxbot/ui 7.9.9 → 9.0.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/dist/index.js +12557 -13254
- package/dist/index.js.map +1 -1
- package/dist/pure.js +110 -172
- package/dist/pure.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/components/Combobox.d.ts +0 -27
- package/dist/types/components/Dialog.d.ts +3 -3
- package/dist/types/components/Markdown.d.ts +35 -0
- package/dist/types/components/Menu.d.ts +10 -45
- package/dist/types/components/Table.d.ts +4 -0
- package/dist/types/components/calendar/format.d.ts +1 -3
- package/dist/types/components/chat/Message.d.ts +1 -9
- package/dist/types/components/chat/StreamingMarkdown.d.ts +11 -0
- package/dist/types/components/overlay-shell.d.ts +18 -0
- package/dist/types/components/rbac/RBACProvider.d.ts +5 -0
- package/dist/types/components/roadmap/OrderedEntityManager.d.ts +41 -0
- package/dist/types/index.d.ts +6 -7
- package/dist/types/lib/pad.d.ts +6 -0
- package/dist/types/lib/syntax/markdown/index.d.ts +2 -2
- package/dist/types/lib/syntax/markdown/parse.d.ts +4 -0
- package/dist/types/lib/syntax/markdown/render.d.ts +0 -27
- package/dist/types/lib/values/absent.d.ts +7 -0
- package/dist/types/lib/values/currency.d.ts +1 -1
- package/dist/types/lib/values/index.d.ts +0 -3
- package/dist/types/pure.d.ts +1 -1
- package/package.json +1 -1
- package/dist/types/components/InfiniteScroller.d.ts +0 -34
- package/dist/types/components/PhoneField.d.ts +0 -17
- package/dist/types/components/calendar/index.d.ts +0 -9
- package/dist/types/components/chat/Markdown.d.ts +0 -22
- package/dist/types/lib/values/email.d.ts +0 -12
- package/dist/types/lib/values/phone.d.ts +0 -68
- package/dist/types/lib/values/url.d.ts +0 -6
package/dist/types/index.d.ts
CHANGED
|
@@ -31,20 +31,19 @@ export { TriStateSwitch, type TriStateSwitchProps, type TriStateSwitchSize, } fr
|
|
|
31
31
|
export { Dialog, DialogClose, AlertDialog, type DialogProps, type AlertDialogProps, } from "./components/Dialog";
|
|
32
32
|
export { Popover, PopoverClose, Tooltip, TooltipProvider, type PopoverProps, type TooltipProps, } from "./components/Popover";
|
|
33
33
|
export { Toaster, ToastProvider, useToast, type ToasterProps, type ToastProviderProps, type ToastOptions, type ToastTone, } from "./components/Toast";
|
|
34
|
-
export { Menu, MenuItem, MenuGroup, MenuRadioGroup, MenuRadioItem, MenuSeparator,
|
|
34
|
+
export { Menu, MenuItem, MenuGroup, MenuRadioGroup, MenuRadioItem, MenuSeparator, type MenuProps, type MenuItemProps, type MenuItemTone, type MenuGroupProps, type MenuRadioGroupProps, type MenuRadioItemProps, } from "./components/Menu";
|
|
35
35
|
export { ThemeMenu, type ThemeMenuProps } from "./components/ThemeMenu";
|
|
36
36
|
export { AppShell, type AppShellProps, type NavItem, type NavSection, } from "./components/AppShell";
|
|
37
37
|
export { FileUpload, type FileUploadProps, type UploadFile } from "./components/FileUpload";
|
|
38
38
|
export { DatePicker, type DatePickerProps, type DateRange } from "./components/DatePicker";
|
|
39
39
|
export { DateCalendar, type DateCalendarProps } from "./components/DateCalendar";
|
|
40
40
|
export { DateField, DateTimeField, type DateFieldProps, type DateTimeFieldProps, } from "./components/DateField";
|
|
41
|
-
export { PhoneField, type PhoneFieldProps } from "./components/PhoneField";
|
|
42
41
|
export { Tree, type TreeProps, type TreeNode } from "./components/Tree";
|
|
43
42
|
export { CommandPalette, useCommandPalette, type CommandPaletteProps, type CommandItem, } from "./components/CommandPalette";
|
|
44
43
|
export { Slider, type SliderProps, type SliderMark } from "./components/Slider";
|
|
45
44
|
export { NumberInput, type NumberInputProps } from "./components/NumberInput";
|
|
46
45
|
export { OTPInput, type OTPInputProps } from "./components/OTPInput";
|
|
47
|
-
export { Combobox, ComboboxItem, ComboboxGroup, MultiCombobox,
|
|
46
|
+
export { Combobox, ComboboxItem, ComboboxGroup, MultiCombobox, type ComboboxProps, type ComboboxItemProps, type ComboboxGroupProps, type MultiComboboxProps, } from "./components/Combobox";
|
|
48
47
|
export { Select, SelectItem, SelectGroup, SelectSeparator, type SelectProps, type SelectItemProps, type SelectGroupProps, } from "./components/Select";
|
|
49
48
|
export { StatusSelect, type StatusSelectProps, type StatusOption } from "./components/StatusSelect";
|
|
50
49
|
export { Card, CardHeader, CardFooter, type CardProps, type CardHeaderProps, } from "./components/Card";
|
|
@@ -53,7 +52,6 @@ export { Tabs, TabList, Tab, TabPanel, type TabsProps, type TabListProps, type T
|
|
|
53
52
|
export { Accordion, AccordionItem, type AccordionProps, type AccordionItemProps, } from "./components/Accordion";
|
|
54
53
|
export { Breadcrumb, Pagination, type BreadcrumbProps, type PaginationProps, type Crumb, } from "./components/Navigation";
|
|
55
54
|
export { PaginationBar, type PaginationBarProps, type PaginationBarMode, } from "./components/PaginationBar";
|
|
56
|
-
export { InfiniteScroller, type InfiniteScrollerProps, type InfiniteScrollerHandle, } from "./components/InfiniteScroller";
|
|
57
55
|
export { Stepper, stepStatus, stepperProgress, advanceBlockReason, assertSteps, type StepperProps, type Step, type StepStatus, type StepperProgress, } from "./components/stepper";
|
|
58
56
|
export { StatusChecklist, tallyChecklist, type StatusChecklistProps, type ChecklistItem, type ChecklistState, type ChecklistTally, } from "./components/checklist";
|
|
59
57
|
export { Toggle, ToggleGroup, Toolbar, ToolbarButton, ToolbarGroup, ToolbarInput, ToolbarSeparator, type ToggleProps, type ToggleGroupProps, type ToolbarProps, type ToolbarButtonProps, type ToolbarGroupProps, type ToolbarInputProps, } from "./components/Toggle";
|
|
@@ -64,6 +62,7 @@ export { Progress, Meter, ProgressRing, type ProgressProps, type MeterProps, typ
|
|
|
64
62
|
export { Stat, StatRow, Sparkline, type StatProps, type StatRowProps, type SparklineProps, type StatSize, type StatTrend, type StatSentiment, } from "./components/Stat";
|
|
65
63
|
export { DataTable, TableEmptyState, CellStack, type DataTableProps, type TableDensity, } from "./components/Table";
|
|
66
64
|
export { CodeEditor, CodeEditorToolbar, CodeEditorCaption, CodeEditorCopyButton, CodeEditorWrapToggle, CodeEditorViewSwitch, type CodeEditorProps, type CodeEditorToolbarProps, type CodeEditorView, } from "./components/CodeEditor";
|
|
65
|
+
export { Markdown, CodeBlock, type MarkdownProps, type CodeBlockProps } from "./components/Markdown";
|
|
67
66
|
export { MarkdownEditor, type MarkdownEditorProps, type MarkdownEditorHandle, } from "./components/MarkdownEditor";
|
|
68
67
|
export { ReadMore, readMoreVariants, type ReadMoreProps } from "./components/ReadMore";
|
|
69
68
|
export { MarkdownSurface, type SurfaceOptions, type Splice } from "./lib/markdown/surface";
|
|
@@ -94,17 +93,17 @@ export { buildBoardModel, resolveMove, applyBoardMoves, useBoard, type BoardMode
|
|
|
94
93
|
export type { BoardAccessors, BoardColumnDef, BoardColumnId, BoardColumnModel, BoardItemId, BoardMove, BoardMoveRequest, BoardMoveSource, BoardMoveVerdict, UseBoardOptions, } from "./lib/board";
|
|
95
94
|
export type { MessageRole, MessagePart, MessagePartType, TextPart, CodePart, ReasoningPart, ToolPart, ToolStatus, FilePart, ComponentPart, ChatFile, ChatMessage, RenderContext, PartRenderer, PartRenderers, ChatComponentRenderer, ChatComponents, } from "./components/chat/types";
|
|
96
95
|
export { Chat, ChatPopover, type ChatProps, type ChatPopoverProps, type ChatSurface, } from "./components/chat/Chat";
|
|
97
|
-
export { Message, MessagePartView, ToolCall,
|
|
96
|
+
export { Message, MessagePartView, ToolCall, type MessageProps, type MessageAction, type MessagePartViewProps, type ToolCallProps, } from "./components/chat/Message";
|
|
98
97
|
export { MessageScroller, type MessageScrollerProps, } from "./components/chat/MessageScroller";
|
|
99
98
|
export { Composer, type ComposerProps } from "./components/chat/Composer";
|
|
100
|
-
export {
|
|
99
|
+
export { StreamingMarkdown, type StreamingMarkdownProps, } from "./components/chat/StreamingMarkdown";
|
|
101
100
|
export { Attachment, AttachmentAction, AttachmentList, AttachmentPreview, type AttachmentProps, type AttachmentActionProps, type AttachmentListProps, type AttachmentPreviewProps, type AttachmentLayout, } from "./components/chat/Attachment";
|
|
102
101
|
export { ModelSelector, type ModelSelectorProps, type ChatModel, } from "./components/chat/ModelSelector";
|
|
103
102
|
export { EffortControl, DEFAULT_EFFORT_LEVELS, type EffortControlProps, type EffortLevel, } from "./components/chat/EffortControl";
|
|
104
103
|
export { ContextMeter, ChatStatus, type ContextMeterProps, type ContextSegment, type UsageLimit, type ChatStatusProps, } from "./components/chat/ContextMeter";
|
|
105
104
|
export { cn } from "./lib/cn";
|
|
106
105
|
export { formatBytes, formatTokens, formatCompactNumber } from "./lib/format";
|
|
107
|
-
export { formatDate, parseDate, formatDateTime, parseDateTime, type FormatDateTimeOptions, type ParseDateTimeOptions, formatCurrency, parseCurrency,
|
|
106
|
+
export { formatDate, parseDate, formatDateTime, parseDateTime, type FormatDateTimeOptions, type ParseDateTimeOptions, formatCurrency, parseCurrency, formatNumber, parseNumber, type FormatNumberOptions, formatBoolean, parseBoolean, type FormatBooleanOptions, } from "./lib/values";
|
|
108
107
|
export { useFillHeight } from "./lib/use-fill-height";
|
|
109
108
|
export { useDebouncedValue } from "./lib/use-debounced-value";
|
|
110
109
|
export { useTheme, useUiScale, useContrast, useMotionPreference, type Theme, type UiScale, type ContrastPreference, type MotionPreference, } from "./lib/preferences";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Zero-pad a non-negative integer to `width` digits — `pad(9)` → `"09"`,
|
|
2
|
+
* `pad(7, 3)` → `"007"`. Internal only: shared by the time and value
|
|
3
|
+
* formatters that print fixed-width calendar/clock fields, not part of the
|
|
4
|
+
* public package surface (DX-3254 — this one-liner used to be redefined
|
|
5
|
+
* independently in four places). */
|
|
6
|
+
export declare function pad(n: number, width?: number): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { parseMarkdown } from "./parse";
|
|
1
|
+
export { parseMarkdown, RE_FENCE } from "./parse";
|
|
2
2
|
export { markdown } from "./grammar";
|
|
3
|
-
export { MarkdownNodes,
|
|
3
|
+
export { MarkdownNodes, sanitizeHref } from "./render";
|
|
4
4
|
export type { MdNode, MdInline, MdListItem, MdCell, MdAlign, MdCodeRenderer } from "./types";
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { type Sink } from "./spans";
|
|
2
2
|
import type { MdNode } from "./types";
|
|
3
|
+
/** Exported so any other layer that needs to find the SAME fence boundaries
|
|
4
|
+
the parser itself will — e.g. `StreamingMarkdown`'s pre-parse balancing
|
|
5
|
+
pass — imports this instead of keeping a second copy of the pattern. */
|
|
6
|
+
export declare const RE_FENCE: RegExp;
|
|
3
7
|
/** The renderer's entry point: tree only, no token bookkeeping. */
|
|
4
8
|
export declare function parseMarkdown(source: string): MdNode[];
|
|
5
9
|
/**
|
|
@@ -6,33 +6,6 @@ export interface MarkdownNodesProps {
|
|
|
6
6
|
renderCode: MdCodeRenderer;
|
|
7
7
|
}
|
|
8
8
|
export declare function MarkdownNodes({ nodes, renderCode }: MarkdownNodesProps): ReactNode;
|
|
9
|
-
/**
|
|
10
|
-
* An inline image, capped to a compact thumbnail and click-to-enlarge.
|
|
11
|
-
*
|
|
12
|
-
* A screenshot dropped into a markdown field (a card comment, a problem
|
|
13
|
-
* statement, a plan record) is the most common image this renders, and an
|
|
14
|
-
* uncapped one would blow past the width of any of those surfaces and,
|
|
15
|
-
* worse, a TALL one (a full-page screenshot) would still run on forever even
|
|
16
|
-
* with a width cap alone — hence a HEIGHT cap here, not a width cap, with
|
|
17
|
-
* `w-auto` left free to shrink for a narrow source image.
|
|
18
|
-
*
|
|
19
|
-
* Clicking opens the full-resolution image in a `Dialog` rather than
|
|
20
|
-
* navigating or replacing the thumbnail in place, so the surrounding prose
|
|
21
|
-
* never loses its layout while the image is being inspected.
|
|
22
|
-
*/
|
|
23
|
-
/**
|
|
24
|
-
* Exported so `components/chat/Markdown.tsx` — the streaming chat renderer,
|
|
25
|
-
* which does NOT go through this file's node tree/parser — can reuse the
|
|
26
|
-
* exact same capped, click-to-enlarge treatment instead of forking it. Two
|
|
27
|
-
* markdown renderers exist in this package on purpose (streaming vs.
|
|
28
|
-
* document); a shared leaf component is how they stay visually identical
|
|
29
|
-
* without duplicating the cap/dialog logic.
|
|
30
|
-
*/
|
|
31
|
-
export declare function MarkdownImage({ src, alt, title }: {
|
|
32
|
-
src: string;
|
|
33
|
-
alt: string;
|
|
34
|
-
title?: string;
|
|
35
|
-
}): ReactNode;
|
|
36
9
|
/**
|
|
37
10
|
* RULE TWO, the implementation: a link's scheme is checked before it is
|
|
38
11
|
* rendered.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** The shared "no value" reading for a blank field — a date, a number, a
|
|
2
|
+
* phone number, a currency amount: nothing recorded. Shared by every
|
|
3
|
+
* formatter that reads absence this way, so the glyph itself never drifts
|
|
4
|
+
* between them (DX-3254). `formatBoolean` does NOT use this — see its own
|
|
5
|
+
* module doc for why a tri-state boolean reads absence as "Unknown"
|
|
6
|
+
* instead. */
|
|
7
|
+
export declare const ABSENT = "\u2014";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* `NaN` / `Infinity` are not real amounts either and render as the em dash —
|
|
5
5
|
* grouped with absence rather than with a malformed string, because unlike
|
|
6
|
-
* `formatDate
|
|
6
|
+
* `formatDate`'s malformed-input case, there is no ORIGINAL
|
|
7
7
|
* user-facing string to show back: the caller already has a `number`, and a
|
|
8
8
|
* non-finite one is a computation defect upstream, not a typo to surface.
|
|
9
9
|
*/
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export { formatDate, parseDate } from "./date";
|
|
2
2
|
export { formatDateTime, parseDateTime, type FormatDateTimeOptions, type ParseDateTimeOptions } from "./datetime";
|
|
3
3
|
export { formatCurrency, parseCurrency } from "./currency";
|
|
4
|
-
export { formatPhone, parsePhone, digitsOfPhoneInProgress, formatPhonePartial } from "./phone";
|
|
5
4
|
export { formatNumber, parseNumber, type FormatNumberOptions } from "./number";
|
|
6
5
|
export { formatBoolean, parseBoolean, type FormatBooleanOptions } from "./boolean";
|
|
7
|
-
export { isValidEmail } from "./email";
|
|
8
|
-
export { isValidUrl } from "./url";
|
package/dist/types/pure.d.ts
CHANGED
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
* about this is a migration and no existing import has to change.
|
|
40
40
|
*/
|
|
41
41
|
export { formatBytes, formatTokens, formatCompactNumber } from "./lib/format";
|
|
42
|
-
export { formatDate, parseDate, formatDateTime, parseDateTime, type FormatDateTimeOptions, type ParseDateTimeOptions, formatCurrency, parseCurrency,
|
|
42
|
+
export { formatDate, parseDate, formatDateTime, parseDateTime, type FormatDateTimeOptions, type ParseDateTimeOptions, formatCurrency, parseCurrency, formatNumber, parseNumber, type FormatNumberOptions, formatBoolean, parseBoolean, type FormatBooleanOptions, } from "./lib/values";
|
|
43
43
|
export { confidenceLevel, CONFIDENCE_LEVEL_LABELS, type ConfidenceLevel } from "./lib/confidence";
|
package/package.json
CHANGED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { type CSSProperties, type Key, type ReactNode, type Ref, type RefObject } from "react";
|
|
2
|
-
export interface InfiniteScrollerHandle {
|
|
3
|
-
/** Mount everything up to `index` (if not already mounted), then scroll that item into view. */
|
|
4
|
-
reveal: (index: number, options?: ScrollIntoViewOptions) => void;
|
|
5
|
-
}
|
|
6
|
-
export interface InfiniteScrollerProps<T> {
|
|
7
|
-
/** Every item. Only a window of them is mounted. */
|
|
8
|
-
items: readonly T[];
|
|
9
|
-
renderItem: (item: T, index: number) => ReactNode;
|
|
10
|
-
/** A stable React key per item. */
|
|
11
|
-
getKey: (item: T, index: number) => Key;
|
|
12
|
-
/** How many items are mounted at first. Default 20. */
|
|
13
|
-
initialCount?: number;
|
|
14
|
-
/** How many more mount each time the end comes into range. Default `initialCount`. */
|
|
15
|
-
batchSize?: number;
|
|
16
|
-
/** Lay items out as a CSS grid with this many equal columns. Omit for a plain vertical list. */
|
|
17
|
-
columns?: number;
|
|
18
|
-
/** How far outside the scroll viewport the end may be before more mount. Default "200px". */
|
|
19
|
-
rootMargin?: string;
|
|
20
|
-
/**
|
|
21
|
-
* The scrolling element to observe against. Default: the nearest ancestor whose `overflow-y`
|
|
22
|
-
* scrolls, else the viewport.
|
|
23
|
-
*/
|
|
24
|
-
root?: RefObject<Element | null>;
|
|
25
|
-
/** Changing this puts the window back to `initialCount` (a genuinely different list). */
|
|
26
|
-
resetKey?: unknown;
|
|
27
|
-
/** Classes for the list/grid element — gaps, padding. */
|
|
28
|
-
className?: string;
|
|
29
|
-
style?: CSSProperties;
|
|
30
|
-
ref?: Ref<InfiniteScrollerHandle>;
|
|
31
|
-
/** Accessible name for the list, when it needs one. */
|
|
32
|
-
"aria-label"?: string;
|
|
33
|
-
}
|
|
34
|
-
export declare function InfiniteScroller<T>({ items, renderItem, getKey, initialCount, batchSize, columns, rootMargin, root, resetKey, className, style, ref, "aria-label": ariaLabel, }: InfiniteScrollerProps<T>): import("react").JSX.Element;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface PhoneFieldProps {
|
|
2
|
-
/** The stored ten-digit form, or null for none. */
|
|
3
|
-
value: string | null;
|
|
4
|
-
/** Reports the new ten-digit value, or null when the person cleared it. Only on commit. */
|
|
5
|
-
onValueChange: (value: string | null) => void;
|
|
6
|
-
/** Told while the box has focus — i.e. while the person's own in-progress digits are on screen. */
|
|
7
|
-
onEditingChange?: (editing: boolean) => void;
|
|
8
|
-
/** The accessible name — required, same reasoning as `DateField`'s. */
|
|
9
|
-
"aria-label": string;
|
|
10
|
-
/** @default "(555) 123-4567" */
|
|
11
|
-
placeholder?: string;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
/** The sentence shown for a committed value that is not ten digits. */
|
|
14
|
-
invalidMessage?: string;
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function PhoneField({ value, onValueChange, onEditingChange, "aria-label": ariaLabel, placeholder, disabled, invalidMessage, className, }: PhoneFieldProps): import("react").JSX.Element;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export { CalendarMonth, type CalendarMonthProps } from "./CalendarMonth";
|
|
2
|
-
export { CalendarTimeGrid, type CalendarTimeGridProps } from "./CalendarTimeGrid";
|
|
3
|
-
export { useNow, type UseNowOptions } from "./use-now";
|
|
4
|
-
export { EventActions, type EventActionsProps } from "./EventActions";
|
|
5
|
-
export { useCalendarDrag, type CalendarDragOptions, type CalendarDragState, } from "./use-calendar-drag";
|
|
6
|
-
export { useEventKeyboard, type EventKeyboardOptions, type EventKeyboardState, } from "./use-event-keyboard";
|
|
7
|
-
export { EVENT_PALETTE, DEFAULT_PALETTE_KEY, isPaletteKey, paletteFor } from "./palette";
|
|
8
|
-
export { cellLabel, dayNumber, eventLabel, formatDateRange, longDate, monthTitle, timeOfDay, weekdayName, zoneLabel, } from "./format";
|
|
9
|
-
export { initialFocusDay, isInMonth, nextDayForKey, useGridNavigation, type GridNavigation, type GridNavigationOptions, } from "./use-grid-navigation";
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export interface CodeBlockProps {
|
|
2
|
-
code: string;
|
|
3
|
-
language?: string;
|
|
4
|
-
filename?: string;
|
|
5
|
-
/** Still filling — suppresses the copy button, which would copy a fragment. */
|
|
6
|
-
streaming?: boolean;
|
|
7
|
-
className?: string;
|
|
8
|
-
}
|
|
9
|
-
export declare function CodeBlock({ code, language, filename, streaming, className }: CodeBlockProps): import("react").JSX.Element;
|
|
10
|
-
export interface MarkdownProps {
|
|
11
|
-
children: string;
|
|
12
|
-
className?: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Blocks are memoised individually.
|
|
16
|
-
*
|
|
17
|
-
* A response is re-parsed on every token, so without this the reconciler
|
|
18
|
-
* rebuilds every finished paragraph each time a word lands at the bottom —
|
|
19
|
-
* which is both wasteful and visible, because re-created DOM loses selection.
|
|
20
|
-
* Someone highlighting a sentence while the answer continues keeps it.
|
|
21
|
-
*/
|
|
22
|
-
export declare const Markdown: import("react").NamedExoticComponent<MarkdownProps>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Whether `value` reads as a plausible email address. An empty (or
|
|
3
|
-
* whitespace-only) value is treated as VALID — clearing the field is not a
|
|
4
|
-
* typo, and a required-field rule belongs to the caller, not this check.
|
|
5
|
-
*
|
|
6
|
-
* SG-909 review fix: the previous regex (`/^[^\s@]+@[^\s@]+\.[^\s@]+$/`)
|
|
7
|
-
* matched the domain half non-specifically, so `"a@b..com"` (an empty label
|
|
8
|
-
* between two dots) passed, and it never looked at trailing punctuation at
|
|
9
|
-
* all, so `"jane@example.com."` and `"jane@example.com,"` — the shape a typo
|
|
10
|
-
* or a sentence's own full stop produces — both passed too.
|
|
11
|
-
*/
|
|
12
|
-
export declare function isValidEmail(value: string): boolean;
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Ten stored digits → `"(555) 123-4567"`. `null` / `undefined` / `""` → `"—"`.
|
|
3
|
-
*
|
|
4
|
-
* A non-empty value that is not exactly ten digits after parsing is returned
|
|
5
|
-
* UNCHANGED — the same "show the corruption, don't hide it behind absence"
|
|
6
|
-
* rule `formatDate` documents. A stored value should already be `parsePhone`'s
|
|
7
|
-
* output; if it is not, that is a data problem worth seeing in the row, not
|
|
8
|
-
* a blank field that looks like nobody ever entered a number.
|
|
9
|
-
*
|
|
10
|
-
* Reuses `formatPhonePartial` for the ten-digit case (SG-909 review) rather
|
|
11
|
-
* than repeating the same three-slice punctuation a second time — passing it
|
|
12
|
-
* exactly ten digits always produces the identical `"(XXX) XXX-XXXX"` string,
|
|
13
|
-
* since `formatPhonePartial` only ever appends a raw, unformatted tail past
|
|
14
|
-
* the tenth digit and there is no tail here.
|
|
15
|
-
*/
|
|
16
|
-
export declare function formatPhone(value: string | null | undefined): string;
|
|
17
|
-
/**
|
|
18
|
-
* A human-typed phone number → ten stored digits, or `null`.
|
|
19
|
-
*
|
|
20
|
-
* Strips everything but digits, so `"(555) 123-4567"`, `"555.123.4567"`,
|
|
21
|
-
* `"555-123-4567 "` and `"5551234567"` all normalise the same way. A leading
|
|
22
|
-
* US country code (`"1"`, making 11 digits total) is dropped — `"+1 (555)
|
|
23
|
-
* 123-4567"` is the same number as `"(555) 123-4567"` and should be stored
|
|
24
|
-
* identically. Anything that is not exactly 10 digits after that — too few,
|
|
25
|
-
* too many, or an 11-digit number NOT starting with `1` (a foreign number
|
|
26
|
-
* mis-typed into a US field, not a US number with an extra digit) — returns
|
|
27
|
-
* `null` rather than truncating or padding a guess into place.
|
|
28
|
-
*
|
|
29
|
-
* THIS is the one place in the file the 11-digit-leading-`1` rule is written
|
|
30
|
-
* (SG-909 review — it used to also live in `digitsOfPhoneInProgress`, which
|
|
31
|
-
* no longer transforms digits at all; see that function's own doc for why).
|
|
32
|
-
*/
|
|
33
|
-
export declare function parsePhone(input: string): string | null;
|
|
34
|
-
/**
|
|
35
|
-
* Every non-digit stripped — nothing else. `PhoneField` (SG-909) keeps this
|
|
36
|
-
* as ITS state while a person is still typing.
|
|
37
|
-
*
|
|
38
|
-
* Deliberately NOT capped at ten and NOT country-code-aware, unlike an
|
|
39
|
-
* earlier revision of this function. That revision silently dropped every
|
|
40
|
-
* digit past the tenth and stripped a leading `"1"` off an 11-digit run —
|
|
41
|
-
* which meant pasting `"555-123-4567 x12"` or `"44 20 7946 0958"` (a UK
|
|
42
|
-
* number) landed at commit as `parsePhone` accepting whatever ten-or-eleven
|
|
43
|
-
* digits happened to survive the cap, saving a DIFFERENT phone number than
|
|
44
|
-
* the one actually typed, with no error and no visible sign anything had
|
|
45
|
-
* been thrown away. `PhoneField` now keeps the full digit sequence — see its
|
|
46
|
-
* own module comment for how it is FORMATTED (first ten punctuated, any rest
|
|
47
|
-
* appended raw) and how `parsePhone` alone decides, at commit, whether the
|
|
48
|
-
* full sequence resolves to a real ten-digit number.
|
|
49
|
-
*/
|
|
50
|
-
export declare function digitsOfPhoneInProgress(input: string): string;
|
|
51
|
-
/**
|
|
52
|
-
* A digit sequence of any length → what the box shows WHILE TYPING —
|
|
53
|
-
* progressively punctuated as each of the first ten digits lands, with any
|
|
54
|
-
* digit past the tenth appended after a space, UNFORMATTED, rather than
|
|
55
|
-
* silently dropped (SG-909 review). `formatPhone` above is the too-late-to-
|
|
56
|
-
* use-here sibling: it takes the STORED ten-digit form and either renders it
|
|
57
|
-
* or hands back a non-ten-digit value unchanged, which would show a partial
|
|
58
|
-
* number completely unpunctuated until the last digit arrived, and would
|
|
59
|
-
* have nowhere to put an eleventh digit at all.
|
|
60
|
-
*
|
|
61
|
-
* The trailing digits past ten are shown, not hidden, specifically so a
|
|
62
|
-
* too-long paste or a stray extra keystroke stays visible for the person to
|
|
63
|
-
* see and correct — `parsePhone` will refuse anything that is not exactly
|
|
64
|
-
* ten digits (or eleven with a leading `1`) at commit, and a refusal against
|
|
65
|
-
* a box that visibly still has extra digits in it is legible; a refusal
|
|
66
|
-
* against a box that silently ate them is not.
|
|
67
|
-
*/
|
|
68
|
-
export declare function formatPhonePartial(digits: string): string;
|