@petrarca/sonnet-ui 0.5.0 → 0.6.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.d.ts CHANGED
@@ -9,6 +9,8 @@ import * as CollapsiblePrimitive from '@radix-ui/react-collapsible';
9
9
  import * as DialogPrimitive from '@radix-ui/react-dialog';
10
10
  import { DialogProps } from '@radix-ui/react-dialog';
11
11
  import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
12
+ import { DatePrecision, TimeGranularity, PageResult } from '@petrarca/sonnet-core';
13
+ import * as SelectPrimitive from '@radix-ui/react-select';
12
14
  import * as LabelPrimitive from '@radix-ui/react-label';
13
15
  import * as PopoverPrimitive from '@radix-ui/react-popover';
14
16
  import * as ScrollAreaPrimitive from '@radix-ui/react-scroll-area';
@@ -17,7 +19,6 @@ import * as TabsPrimitive from '@radix-ui/react-tabs';
17
19
  import * as TooltipPrimitive from '@radix-ui/react-tooltip';
18
20
  import { RowData, PaginationState, OnChangeFn } from '@tanstack/react-table';
19
21
  export { PaginationState } from '@tanstack/react-table';
20
- import { PageResult } from '@petrarca/sonnet-core';
21
22
  import { UISchema, JsonSchemaProperty, JsonSchema } from '@petrarca/sonnet-core/schema';
22
23
  import { EntitySelectMode } from '@petrarca/sonnet-core/hooks';
23
24
  import { EntityOptionFetcher, EntityOption } from '@petrarca/sonnet-core/entityOptions';
@@ -228,6 +229,144 @@ declare const DropdownMenuShortcut: {
228
229
 
229
230
  declare const Input: React$1.ForwardRefExoticComponent<Omit<React$1.DetailedHTMLProps<React$1.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref"> & React$1.RefAttributes<HTMLInputElement>>;
230
231
 
232
+ /** Renders a field-level error message below an input. */
233
+ declare function InputError({ error, }: {
234
+ error: string | undefined;
235
+ }): React$1.ReactElement | null;
236
+
237
+ /**
238
+ * DateInput -- text input with a calendar popover for a single date.
239
+ *
240
+ * The value is a partial ISO 8601 date string -- `"YYYY"`, `"YYYY-MM"`, or
241
+ * `"YYYY-MM-DD"` depending on `precision`. Typed entry is parsed leniently
242
+ * (see {@link parseDate}); `"t"`, `"today"`, or `"."` enter the current date;
243
+ * calendar selection drills down to the terminal precision. Empty value emits "".
244
+ */
245
+
246
+ interface DateInputProps {
247
+ /** Partial ISO date string (`YYYY`, `YYYY-MM`, or `YYYY-MM-DD`), or "". */
248
+ value?: string;
249
+ /** Called with the new partial ISO date string, or "" when cleared. */
250
+ onChange: (value: string) => void;
251
+ /** Selection precision. Default `"day"`. */
252
+ precision?: DatePrecision;
253
+ /** BCP-47 locale override for display/parsing. Defaults to the app locale. */
254
+ locale?: string;
255
+ id?: string;
256
+ name?: string;
257
+ placeholder?: string;
258
+ required?: boolean;
259
+ disabled?: boolean;
260
+ error?: string;
261
+ className?: string;
262
+ onBlur?: () => void;
263
+ }
264
+ declare function DateInput({ value, onChange, precision, locale, id, name, placeholder, required, disabled, error, className, onBlur, }: DateInputProps): React$1.ReactElement;
265
+
266
+ /**
267
+ * Calendar -- month/year/decade grid for selecting a single day.
268
+ *
269
+ * A controlled, dependency-light calendar operating on native `Date`. Renders
270
+ * three drill-down views (days, months, years) with header navigation. Styling
271
+ * uses semantic design tokens only.
272
+ */
273
+
274
+ interface CalendarProps {
275
+ /** Currently selected day, or null. */
276
+ value: Date | null;
277
+ /** Called when the user picks a date at the terminal precision. */
278
+ onSelect: (date: Date) => void;
279
+ /** Month shown when no value is selected. Defaults to today. */
280
+ defaultViewDate?: Date;
281
+ /**
282
+ * Precision at which selection completes: `"year"` stops on the years view,
283
+ * `"month"` on the months view, `"day"` on the days view (default).
284
+ */
285
+ precision?: DatePrecision;
286
+ /** BCP-47 locale for month/weekday labels and week-start. */
287
+ locale?: string;
288
+ }
289
+ declare function Calendar({ value, onSelect, defaultViewDate, precision, locale, }: CalendarProps): React$1.ReactElement;
290
+
291
+ /**
292
+ * TimeInput -- text input for a zone-free time of day.
293
+ *
294
+ * The value is a normalized ISO time string -- `"HH:mm"` (minute granularity,
295
+ * default) or `"HH:mm:ss"` (second granularity). A time of day carries no date
296
+ * and no timezone (Temporal.PlainTime); consumers that need an instant combine
297
+ * it with a date and zone at persistence time. Typed entry is parsed leniently
298
+ * (see {@link parseTime}); `"n"`, `"now"`, or `"."` enter the current time.
299
+ * Empty value emits "".
300
+ */
301
+
302
+ interface TimeInputProps {
303
+ /** Normalized ISO time string (`"HH:mm"` or `"HH:mm:ss"`), or "". */
304
+ value?: string;
305
+ /** Called with the new normalized ISO time string, or "" when cleared. */
306
+ onChange: (value: string) => void;
307
+ /** Time granularity. Default `"minute"`. */
308
+ granularity?: TimeGranularity;
309
+ id?: string;
310
+ name?: string;
311
+ placeholder?: string;
312
+ required?: boolean;
313
+ disabled?: boolean;
314
+ error?: string;
315
+ className?: string;
316
+ onBlur?: () => void;
317
+ }
318
+ declare function TimeInput({ value, onChange, granularity, id, name, placeholder, required, disabled, error, className, onBlur, }: TimeInputProps): React$1.ReactElement;
319
+
320
+ /**
321
+ * DateTimeInput -- combined date + time entry for a plain wall-clock datetime.
322
+ *
323
+ * The value is a plain wall-clock ISO string `"YYYY-MM-DDTHH:mm[:ss]"` with no
324
+ * timezone (Temporal.PlainDateTime). Timezone is intentionally not part of the
325
+ * input: a wall-clock datetime means "this local time", and resolving it to an
326
+ * absolute instant (UTC) is the consumer's responsibility at persistence time.
327
+ *
328
+ * The optional `timeZone` prop is a pass-through context value (e.g. a clinic's
329
+ * zone supplied programmatically) shown as a hint -- it is never applied to the
330
+ * value and is never entered by the user. Cross-zone apps that need an explicit
331
+ * zone picker should compose one separately.
332
+ *
333
+ * Composes {@link DateInput} (day precision) and {@link TimeInput}.
334
+ */
335
+
336
+ interface DateTimeInputProps {
337
+ /** Plain wall-clock ISO datetime `"YYYY-MM-DDTHH:mm[:ss]"`, or "". */
338
+ value?: string;
339
+ /** Called with the new plain wall-clock ISO datetime, or "" when cleared. */
340
+ onChange: (value: string) => void;
341
+ /** Time granularity. Default `"minute"`. */
342
+ granularity?: TimeGranularity;
343
+ /**
344
+ * Optional timezone context (IANA id, e.g. `"Europe/Berlin"`). Shown as a
345
+ * hint only; never applied to the value and never user-entered.
346
+ */
347
+ timeZone?: string;
348
+ /** BCP-47 locale override for the date part. Defaults to the app locale. */
349
+ locale?: string;
350
+ idPrefix?: string;
351
+ required?: boolean;
352
+ disabled?: boolean;
353
+ error?: string;
354
+ className?: string;
355
+ onBlur?: () => void;
356
+ }
357
+ declare function DateTimeInput({ value, onChange, granularity, timeZone, locale, idPrefix, required, disabled, error, className, onBlur, }: DateTimeInputProps): React$1.ReactElement;
358
+
359
+ declare const Select: React$1.FC<SelectPrimitive.SelectProps>;
360
+ declare const SelectGroup: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & React$1.RefAttributes<HTMLDivElement>>;
361
+ declare const SelectValue: React$1.ForwardRefExoticComponent<SelectPrimitive.SelectValueProps & React$1.RefAttributes<HTMLSpanElement>>;
362
+ declare const SelectTrigger: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectTriggerProps & React$1.RefAttributes<HTMLButtonElement>, "ref"> & React$1.RefAttributes<HTMLButtonElement>>;
363
+ declare const SelectScrollUpButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollUpButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
364
+ declare const SelectScrollDownButton: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectScrollDownButtonProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
365
+ declare const SelectContent: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectContentProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
366
+ declare const SelectLabel: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectLabelProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
367
+ declare const SelectItem: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
368
+ declare const SelectSeparator: React$1.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React$1.RefAttributes<HTMLDivElement>, "ref"> & React$1.RefAttributes<HTMLDivElement>>;
369
+
231
370
  declare function InputGroup({ className, ...props }: React$1.ComponentProps<"div">): react_jsx_runtime.JSX.Element;
232
371
  declare const inputGroupAddonVariants: (props?: ({
233
372
  align?: "inline-start" | "inline-end" | "block-start" | "block-end" | null | undefined;
@@ -1190,4 +1329,4 @@ type Props = {
1190
1329
  */
1191
1330
  declare function ClipboardMenu({ onAddItem }: Props): react_jsx_runtime.JSX.Element;
1192
1331
 
1193
- export { Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, CELL_RENDERERS, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CellRenderer, type CellRendererProps, Checkbox, ClipboardButton, ClipboardItemComponent as ClipboardItem, ClipboardMenu, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EntitySelect, type EntitySelectProps, EntityTable, type EntityTableProps, EntityTree, type EntityTreeHandle, type EntityTreeProps, IconButton, type IconButtonProps, Input, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Popover, PopoverContent, PopoverTrigger, PropertyList, type PropertyListLayout, type PropertyListProps, PropertyValue, type PropertyValueProps, ResizeHandle, type ResizeHandleProps, type ResolvedColumn, type RowAction, ScrollArea, ScrollBar, SearchInput, type SearchMode, Separator, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetTitle, SheetTrigger, SimpleGroup, SimpleStack, SimpleTooltip, Skeleton, Spinner, Stepper, StepperContent, StepperDescription, StepperIndicator, StepperItem, StepperList, StepperNext, StepperPrev, type StepperProps, StepperSeparator, StepperTitle, StepperTrigger, type TableUiSchema, Tabs, TabsContent, TabsList, TabsSeparator, TabsTrigger, Textarea, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TreeNode, TreeView, type TreeViewHandle, type TreeViewProps, badgeVariants, buttonVariants, createRenderer, useStore as useStepper };
1332
+ export { Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Badge, type BadgeProps, Button, CELL_RENDERERS, Calendar, type CalendarProps, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, type CellRenderer, type CellRendererProps, Checkbox, ClipboardButton, ClipboardItemComponent as ClipboardItem, ClipboardMenu, Collapsible, CollapsibleContent, CollapsibleTrigger, Command, CommandDialog, CommandEmpty, CommandGroup, CommandInput, CommandItem, CommandList, CommandSeparator, CommandShortcut, DateInput, type DateInputProps, DateTimeInput, type DateTimeInputProps, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EntitySelect, type EntitySelectProps, EntityTable, type EntityTableProps, EntityTree, type EntityTreeHandle, type EntityTreeProps, IconButton, type IconButtonProps, Input, InputError, InputGroup, InputGroupAddon, InputGroupButton, InputGroupInput, InputGroupText, InputGroupTextarea, Label, Popover, PopoverContent, PopoverTrigger, PropertyList, type PropertyListLayout, type PropertyListProps, PropertyValue, type PropertyValueProps, ResizeHandle, type ResizeHandleProps, type ResolvedColumn, type RowAction, ScrollArea, ScrollBar, SearchInput, type SearchMode, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetBody, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetTitle, SheetTrigger, SimpleGroup, SimpleStack, SimpleTooltip, Skeleton, Spinner, Stepper, StepperContent, StepperDescription, StepperIndicator, StepperItem, StepperList, StepperNext, StepperPrev, type StepperProps, StepperSeparator, StepperTitle, StepperTrigger, type TableUiSchema, Tabs, TabsContent, TabsList, TabsSeparator, TabsTrigger, Textarea, TimeInput, type TimeInputProps, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type TreeNode, TreeView, type TreeViewHandle, type TreeViewProps, badgeVariants, buttonVariants, createRenderer, useStore as useStepper };