@lanfermann/ui 0.0.0-stage → 0.1.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.
- package/LICENSE +24 -0
- package/README.md +17 -2
- package/TRADEMARK.md +10 -0
- package/brand/app-icon.svg +1 -0
- package/brand/avatar.svg +1 -0
- package/brand/favicon.svg +1 -0
- package/dist/components/accordion/accordion.d.ts +26 -0
- package/dist/components/accordion/accordion.js +78 -0
- package/dist/components/alert/alert.d.ts +19 -0
- package/dist/components/alert/alert.js +68 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +20 -0
- package/dist/components/alert-dialog/alert-dialog.js +75 -0
- package/dist/components/anchor-heading/anchor-heading.d.ts +19 -0
- package/dist/components/anchor-heading/anchor-heading.js +39 -0
- package/dist/components/avatar/avatar.d.ts +14 -0
- package/dist/components/avatar/avatar.js +42 -0
- package/dist/components/badge/badge.d.ts +12 -0
- package/dist/components/badge/badge.js +27 -0
- package/dist/components/breadcrumbs/breadcrumbs.d.ts +23 -0
- package/dist/components/breadcrumbs/breadcrumbs.js +63 -0
- package/dist/components/button/button-variants.d.ts +15 -0
- package/dist/components/button/button-variants.js +76 -0
- package/dist/components/button/button.d.ts +25 -0
- package/dist/components/button/button.js +50 -0
- package/dist/components/calendar/calendar-selection.js +216 -0
- package/dist/components/calendar/calendar.d.ts +44 -0
- package/dist/components/calendar/calendar.js +208 -0
- package/dist/components/callout/callout.d.ts +21 -0
- package/dist/components/callout/callout.js +75 -0
- package/dist/components/card/card.d.ts +16 -0
- package/dist/components/card/card.js +53 -0
- package/dist/components/checkbox/checkbox.d.ts +9 -0
- package/dist/components/checkbox/checkbox.js +33 -0
- package/dist/components/checkbox-group/checkbox-group.d.ts +18 -0
- package/dist/components/checkbox-group/checkbox-group.js +33 -0
- package/dist/components/code/code.d.ts +7 -0
- package/dist/components/code/code.js +16 -0
- package/dist/components/code-block/code-block-frame.js +146 -0
- package/dist/components/code-block/code-block-live.d.ts +45 -0
- package/dist/components/code-block/code-block-live.js +51 -0
- package/dist/components/code-block/code-block.d.ts +36 -0
- package/dist/components/code-block/code-block.js +51 -0
- package/dist/components/code-block/code-copy.d.ts +12 -0
- package/dist/components/code-block/code-copy.js +71 -0
- package/dist/components/code-block/code-lines-view.d.ts +16 -0
- package/dist/components/code-block/code-lines-view.js +48 -0
- package/dist/components/code-block/code-lines.js +17 -0
- package/dist/components/code-block/code-scroll.js +29 -0
- package/dist/components/code-block/code-surface.js +13 -0
- package/dist/components/code-block/code-tabs-frame.js +85 -0
- package/dist/components/code-block/code-tabs-store.js +25 -0
- package/dist/components/code-block/code-tabs.d.ts +28 -0
- package/dist/components/code-block/code-tabs.js +29 -0
- package/dist/components/code-block/highlight.d.ts +34 -0
- package/dist/components/code-block/highlight.js +258 -0
- package/dist/components/code-block/lines.d.ts +5 -0
- package/dist/components/code-block/lines.js +40 -0
- package/dist/components/collapsible/collapsible.d.ts +19 -0
- package/dist/components/collapsible/collapsible.js +54 -0
- package/dist/components/combobox/combobox.d.ts +84 -0
- package/dist/components/combobox/combobox.js +169 -0
- package/dist/components/container/container.d.ts +16 -0
- package/dist/components/container/container.js +30 -0
- package/dist/components/copy-pill/copy-pill.d.ts +52 -0
- package/dist/components/copy-pill/copy-pill.js +232 -0
- package/dist/components/cta/cta.d.ts +109 -0
- package/dist/components/cta/cta.js +375 -0
- package/dist/components/date-field/date-field.d.ts +40 -0
- package/dist/components/date-field/date-field.js +99 -0
- package/dist/components/date-range-field/date-range-field.d.ts +41 -0
- package/dist/components/date-range-field/date-range-field.js +155 -0
- package/dist/components/dialog/dialog.d.ts +29 -0
- package/dist/components/dialog/dialog.js +96 -0
- package/dist/components/docs-layout/docs-layout.d.ts +17 -0
- package/dist/components/docs-layout/docs-layout.js +46 -0
- package/dist/components/drawer/drawer.d.ts +39 -0
- package/dist/components/drawer/drawer.js +181 -0
- package/dist/components/field/field.d.ts +18 -0
- package/dist/components/field/field.js +77 -0
- package/dist/components/fieldset/fieldset.d.ts +8 -0
- package/dist/components/fieldset/fieldset.js +25 -0
- package/dist/components/figure/figure.d.ts +14 -0
- package/dist/components/figure/figure.js +35 -0
- package/dist/components/form/form.d.ts +31 -0
- package/dist/components/form/form.js +55 -0
- package/dist/components/ground/ground.d.ts +20 -0
- package/dist/components/ground/ground.js +31 -0
- package/dist/components/heading/heading.d.ts +16 -0
- package/dist/components/heading/heading.js +36 -0
- package/dist/components/icon/icon.d.ts +22 -0
- package/dist/components/icon/icon.js +24 -0
- package/dist/components/input/input.d.ts +19 -0
- package/dist/components/input/input.js +46 -0
- package/dist/components/input-group/input-group.d.ts +34 -0
- package/dist/components/input-group/input-group.js +61 -0
- package/dist/components/kbd/kbd.d.ts +6 -0
- package/dist/components/kbd/kbd.js +15 -0
- package/dist/components/link/link-variants.d.ts +13 -0
- package/dist/components/link/link-variants.js +27 -0
- package/dist/components/link/link.d.ts +9 -0
- package/dist/components/link/link.js +18 -0
- package/dist/components/logo/logo-paths.js +22 -0
- package/dist/components/logo/logomark.d.ts +19 -0
- package/dist/components/logo/logomark.js +49 -0
- package/dist/components/logo/wordmark.d.ts +35 -0
- package/dist/components/logo/wordmark.js +48 -0
- package/dist/components/menu/menu.d.ts +26 -0
- package/dist/components/menu/menu.js +132 -0
- package/dist/components/meter/meter.d.ts +29 -0
- package/dist/components/meter/meter.js +68 -0
- package/dist/components/navigation-menu/navigation-menu-variants.d.ts +12 -0
- package/dist/components/navigation-menu/navigation-menu-variants.js +18 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +42 -0
- package/dist/components/navigation-menu/navigation-menu.js +128 -0
- package/dist/components/number-field/number-field.d.ts +32 -0
- package/dist/components/number-field/number-field.js +85 -0
- package/dist/components/page-header/page-header.d.ts +27 -0
- package/dist/components/page-header/page-header.js +48 -0
- package/dist/components/pager/pager.d.ts +24 -0
- package/dist/components/pager/pager.js +51 -0
- package/dist/components/parameter-list/parameter-list.d.ts +34 -0
- package/dist/components/parameter-list/parameter-list.js +70 -0
- package/dist/components/popover/popover.d.ts +15 -0
- package/dist/components/popover/popover.js +64 -0
- package/dist/components/progress/progress.d.ts +19 -0
- package/dist/components/progress/progress.js +67 -0
- package/dist/components/prose/prose.d.ts +13 -0
- package/dist/components/prose/prose.js +22 -0
- package/dist/components/quote/quote.d.ts +21 -0
- package/dist/components/quote/quote.js +46 -0
- package/dist/components/radio/radio.d.ts +12 -0
- package/dist/components/radio/radio.js +37 -0
- package/dist/components/reference-entry/reference-entry.d.ts +25 -0
- package/dist/components/reference-entry/reference-entry.js +66 -0
- package/dist/components/section/section.d.ts +13 -0
- package/dist/components/section/section.js +30 -0
- package/dist/components/segmented-control/segmented-control.d.ts +42 -0
- package/dist/components/segmented-control/segmented-control.js +413 -0
- package/dist/components/select/select.d.ts +70 -0
- package/dist/components/select/select.js +189 -0
- package/dist/components/separator/separator.d.ts +12 -0
- package/dist/components/separator/separator.js +29 -0
- package/dist/components/side-nav/side-nav.d.ts +48 -0
- package/dist/components/side-nav/side-nav.js +89 -0
- package/dist/components/site-footer/site-footer-floor.js +48 -0
- package/dist/components/site-footer/site-footer.d.ts +38 -0
- package/dist/components/site-footer/site-footer.js +96 -0
- package/dist/components/site-header/site-header.d.ts +77 -0
- package/dist/components/site-header/site-header.js +214 -0
- package/dist/components/slider/slider.d.ts +42 -0
- package/dist/components/slider/slider.js +279 -0
- package/dist/components/spinner/spinner.d.ts +15 -0
- package/dist/components/spinner/spinner.js +34 -0
- package/dist/components/switch/switch.d.ts +8 -0
- package/dist/components/switch/switch.js +28 -0
- package/dist/components/table/table.d.ts +83 -0
- package/dist/components/table/table.js +123 -0
- package/dist/components/table-of-contents/table-of-contents.d.ts +32 -0
- package/dist/components/table-of-contents/table-of-contents.js +187 -0
- package/dist/components/tabs/tabs.d.ts +28 -0
- package/dist/components/tabs/tabs.js +124 -0
- package/dist/components/text/text.d.ts +16 -0
- package/dist/components/text/text.js +63 -0
- package/dist/components/textarea/textarea.d.ts +19 -0
- package/dist/components/textarea/textarea.js +30 -0
- package/dist/components/time-field/time-field.d.ts +40 -0
- package/dist/components/time-field/time-field.js +123 -0
- package/dist/components/toast/toast.d.ts +55 -0
- package/dist/components/toast/toast.js +129 -0
- package/dist/components/tooltip/tooltip.d.ts +16 -0
- package/dist/components/tooltip/tooltip.js +41 -0
- package/dist/index.d.ts +79 -0
- package/dist/index.js +77 -0
- package/dist/internal/arrow.js +41 -0
- package/dist/internal/disclosure.js +20 -0
- package/dist/internal/field-context.js +21 -0
- package/dist/internal/field.d.ts +23 -0
- package/dist/internal/field.js +49 -0
- package/dist/internal/glyphs.js +84 -0
- package/dist/internal/iso-date.d.ts +2 -0
- package/dist/internal/iso-date.js +268 -0
- package/dist/internal/overlay.js +40 -0
- package/dist/internal/picker-sheet.js +74 -0
- package/dist/internal/popup.js +37 -0
- package/dist/internal/range-shape.js +295 -0
- package/dist/internal/reduced-motion.js +19 -0
- package/dist/internal/scroll-edges.js +45 -0
- package/dist/internal/trough.js +39 -0
- package/dist/internal/typed-input.d.ts +16 -0
- package/dist/internal/typed-input.js +133 -0
- package/dist/lib/cn.d.ts +11 -0
- package/dist/lib/cn.js +98 -0
- package/dist/motion/inertia.js +111 -0
- package/dist/motion/spring-step.js +35 -0
- package/dist/motion/springs.d.ts +78 -0
- package/dist/motion/springs.js +81 -0
- package/package.json +107 -4
- package/src/styles/base.css +93 -0
- package/src/styles/calendar.css +117 -0
- package/src/styles/code.css +252 -0
- package/src/styles/density.css +53 -0
- package/src/styles/depth.css +501 -0
- package/src/styles/grounds.css +191 -0
- package/src/styles/marks.css +50 -0
- package/src/styles/motion.css +55 -0
- package/src/styles/motion.generated.css +101 -0
- package/src/styles/prose.css +252 -0
- package/src/styles/radius.css +20 -0
- package/src/styles/segmented.css +208 -0
- package/src/styles/slider.css +110 -0
- package/src/styles/status.css +108 -0
- package/src/styles/tabs.css +39 -0
- package/src/styles/toast.css +106 -0
- package/src/styles/touch.css +41 -0
- package/src/styles/type.css +54 -0
- package/src/styles.css +38 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Accordion, AccordionItem, AccordionPanel, AccordionTrigger } from "./components/accordion/accordion.js";
|
|
2
|
+
import { Alert, AlertDescription, AlertTitle } from "./components/alert/alert.js";
|
|
3
|
+
import { AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger } from "./components/alert-dialog/alert-dialog.js";
|
|
4
|
+
import { AnchorHeading } from "./components/anchor-heading/anchor-heading.js";
|
|
5
|
+
import { Avatar, AvatarFallback, AvatarImage } from "./components/avatar/avatar.js";
|
|
6
|
+
import { Badge } from "./components/badge/badge.js";
|
|
7
|
+
import { BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, Breadcrumbs } from "./components/breadcrumbs/breadcrumbs.js";
|
|
8
|
+
import { Button } from "./components/button/button.js";
|
|
9
|
+
import { buttonVariants } from "./components/button/button-variants.js";
|
|
10
|
+
import { Calendar } from "./components/calendar/calendar.js";
|
|
11
|
+
import { Callout } from "./components/callout/callout.js";
|
|
12
|
+
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./components/card/card.js";
|
|
13
|
+
import { Checkbox } from "./components/checkbox/checkbox.js";
|
|
14
|
+
import { CheckboxGroup, CheckboxGroupItems } from "./components/checkbox-group/checkbox-group.js";
|
|
15
|
+
import { Code } from "./components/code/code.js";
|
|
16
|
+
import { CodeBlock } from "./components/code-block/code-block.js";
|
|
17
|
+
import { CodeBlockLive } from "./components/code-block/code-block-live.js";
|
|
18
|
+
import { CodeTabs } from "./components/code-block/code-tabs.js";
|
|
19
|
+
import { Collapsible, CollapsiblePanel, CollapsibleTrigger } from "./components/collapsible/collapsible.js";
|
|
20
|
+
import { Combobox, ComboboxCollection, ComboboxContent, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxSeparator } from "./components/combobox/combobox.js";
|
|
21
|
+
import { Container, containerVariants } from "./components/container/container.js";
|
|
22
|
+
import { CopyPill, CopyPillMark } from "./components/copy-pill/copy-pill.js";
|
|
23
|
+
import { Cta, CtaAction, CtaActions, CtaMessage, CtaText, CtaTitle } from "./components/cta/cta.js";
|
|
24
|
+
import { DateField } from "./components/date-field/date-field.js";
|
|
25
|
+
import { DateRangeField } from "./components/date-range-field/date-range-field.js";
|
|
26
|
+
import { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from "./components/dialog/dialog.js";
|
|
27
|
+
import { DocsLayout, DocsLayoutAside, DocsLayoutMain, DocsLayoutNav } from "./components/docs-layout/docs-layout.js";
|
|
28
|
+
import { Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger } from "./components/drawer/drawer.js";
|
|
29
|
+
import { Field, FieldDescription, FieldError, FieldLabel } from "./components/field/field.js";
|
|
30
|
+
import { Fieldset, FieldsetLegend } from "./components/fieldset/fieldset.js";
|
|
31
|
+
import { Figure, FigureCaption, FigureFrame } from "./components/figure/figure.js";
|
|
32
|
+
import { Form } from "./components/form/form.js";
|
|
33
|
+
import { Ground, useGround } from "./components/ground/ground.js";
|
|
34
|
+
import { Heading } from "./components/heading/heading.js";
|
|
35
|
+
import { Icon } from "./components/icon/icon.js";
|
|
36
|
+
import { Input } from "./components/input/input.js";
|
|
37
|
+
import { InputGroup, InputGroupAddon, InputGroupButton } from "./components/input-group/input-group.js";
|
|
38
|
+
import { Kbd } from "./components/kbd/kbd.js";
|
|
39
|
+
import { Link } from "./components/link/link.js";
|
|
40
|
+
import { linkVariants } from "./components/link/link-variants.js";
|
|
41
|
+
import { Logomark } from "./components/logo/logomark.js";
|
|
42
|
+
import { Wordmark } from "./components/logo/wordmark.js";
|
|
43
|
+
import { Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger } from "./components/menu/menu.js";
|
|
44
|
+
import { Meter, MeterLabel, MeterTrack, MeterValue } from "./components/meter/meter.js";
|
|
45
|
+
import { NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuLinkDescription, NavigationMenuLinkTitle, NavigationMenuList, NavigationMenuTrigger } from "./components/navigation-menu/navigation-menu.js";
|
|
46
|
+
import { navigationMenuEntryVariants } from "./components/navigation-menu/navigation-menu-variants.js";
|
|
47
|
+
import { NumberField, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput } from "./components/number-field/number-field.js";
|
|
48
|
+
import { PageHeader, PageHeaderActions, PageHeaderLead, PageHeaderTitle } from "./components/page-header/page-header.js";
|
|
49
|
+
import { Pager, PagerLink } from "./components/pager/pager.js";
|
|
50
|
+
import { Parameter, ParameterList } from "./components/parameter-list/parameter-list.js";
|
|
51
|
+
import { Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger } from "./components/popover/popover.js";
|
|
52
|
+
import { Progress, ProgressLabel, ProgressTrack, ProgressValue } from "./components/progress/progress.js";
|
|
53
|
+
import { Prose } from "./components/prose/prose.js";
|
|
54
|
+
import { Quote } from "./components/quote/quote.js";
|
|
55
|
+
import { Radio, RadioGroup } from "./components/radio/radio.js";
|
|
56
|
+
import { ReferenceEntry, ReferenceEntryBody, ReferenceEntryHeader, ReferenceEntryMeta, ReferenceEntryName, ReferenceEntryTitle } from "./components/reference-entry/reference-entry.js";
|
|
57
|
+
import { Section } from "./components/section/section.js";
|
|
58
|
+
import { Segment, SegmentedControl } from "./components/segmented-control/segmented-control.js";
|
|
59
|
+
import { Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger } from "./components/select/select.js";
|
|
60
|
+
import { Separator } from "./components/separator/separator.js";
|
|
61
|
+
import { SideNav, SideNavGroup, SideNavLink, SideNavSubLink } from "./components/side-nav/side-nav.js";
|
|
62
|
+
import { SiteFooter, SiteFooterBrand, SiteFooterGroup, SiteFooterLegal, SiteFooterLink, SiteFooterMain, SiteFooterNav, siteFooterLinkClass } from "./components/site-footer/site-footer.js";
|
|
63
|
+
import { SiteHeader, SiteHeaderActions, SiteHeaderBrand, SiteHeaderMenu, SiteHeaderMenuGroup, SiteHeaderMenuLink } from "./components/site-header/site-header.js";
|
|
64
|
+
import { Slider, SliderControl, SliderLabel, SliderThumb, SliderValue } from "./components/slider/slider.js";
|
|
65
|
+
import { Spinner } from "./components/spinner/spinner.js";
|
|
66
|
+
import { Switch } from "./components/switch/switch.js";
|
|
67
|
+
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, TableSortButton } from "./components/table/table.js";
|
|
68
|
+
import { TableOfContents } from "./components/table-of-contents/table-of-contents.js";
|
|
69
|
+
import { Tab, Tabs, TabsList, TabsPanel, TabsPanels } from "./components/tabs/tabs.js";
|
|
70
|
+
import { Text } from "./components/text/text.js";
|
|
71
|
+
import { Textarea } from "./components/textarea/textarea.js";
|
|
72
|
+
import { TimeField } from "./components/time-field/time-field.js";
|
|
73
|
+
import { Toaster, toast, toastManager } from "./components/toast/toast.js";
|
|
74
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./components/tooltip/tooltip.js";
|
|
75
|
+
import { cn, mergeClassName } from "./lib/cn.js";
|
|
76
|
+
import { springs, transitions } from "./motion/springs.js";
|
|
77
|
+
export { Accordion, AccordionItem, AccordionPanel, AccordionTrigger, Alert, AlertDescription, AlertDialog, AlertDialogClose, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, AlertTitle, AnchorHeading, Avatar, AvatarFallback, AvatarImage, Badge, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, Breadcrumbs, Button, Calendar, Callout, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Checkbox, CheckboxGroup, CheckboxGroupItems, Code, CodeBlock, CodeBlockLive, CodeTabs, Collapsible, CollapsiblePanel, CollapsibleTrigger, Combobox, ComboboxCollection, ComboboxContent, ComboboxGroup, ComboboxGroupLabel, ComboboxInput, ComboboxItem, ComboboxSeparator, Container, CopyPill, CopyPillMark, Cta, CtaAction, CtaActions, CtaMessage, CtaText, CtaTitle, DateField, DateRangeField, Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger, DocsLayout, DocsLayoutAside, DocsLayoutMain, DocsLayoutNav, Drawer, DrawerBody, DrawerClose, DrawerContent, DrawerDescription, DrawerFooter, DrawerHeader, DrawerTitle, DrawerTrigger, Field, FieldDescription, FieldError, FieldLabel, Fieldset, FieldsetLegend, Figure, FigureCaption, FigureFrame, Form, Ground, Heading, Icon, Input, InputGroup, InputGroupAddon, InputGroupButton, Kbd, Link, Logomark, Menu, MenuCheckboxItem, MenuContent, MenuGroup, MenuGroupLabel, MenuItem, MenuLinkItem, MenuRadioGroup, MenuRadioItem, MenuSeparator, MenuSub, MenuSubContent, MenuSubTrigger, MenuTrigger, Meter, MeterLabel, MeterTrack, MeterValue, NavigationMenu, NavigationMenuContent, NavigationMenuItem, NavigationMenuLink, NavigationMenuLinkDescription, NavigationMenuLinkTitle, NavigationMenuList, NavigationMenuTrigger, NumberField, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, PageHeader, PageHeaderActions, PageHeaderLead, PageHeaderTitle, Pager, PagerLink, Parameter, ParameterList, Popover, PopoverClose, PopoverContent, PopoverDescription, PopoverTitle, PopoverTrigger, Progress, ProgressLabel, ProgressTrack, ProgressValue, Prose, Quote, Radio, RadioGroup, ReferenceEntry, ReferenceEntryBody, ReferenceEntryHeader, ReferenceEntryMeta, ReferenceEntryName, ReferenceEntryTitle, Section, Segment, SegmentedControl, Select, SelectContent, SelectGroup, SelectGroupLabel, SelectItem, SelectSeparator, SelectTrigger, Separator, SideNav, SideNavGroup, SideNavLink, SideNavSubLink, SiteFooter, SiteFooterBrand, SiteFooterGroup, SiteFooterLegal, SiteFooterLink, SiteFooterMain, SiteFooterNav, SiteHeader, SiteHeaderActions, SiteHeaderBrand, SiteHeaderMenu, SiteHeaderMenuGroup, SiteHeaderMenuLink, Slider, SliderControl, SliderLabel, SliderThumb, SliderValue, Spinner, Switch, Tab, Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableOfContents, TableRow, TableSortButton, Tabs, TabsList, TabsPanel, TabsPanels, Text, Textarea, TimeField, Toaster, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, Wordmark, buttonVariants, cn, containerVariants, linkVariants, mergeClassName, navigationMenuEntryVariants, siteFooterLinkClass, springs, toast, toastManager, transitions, useGround };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
// src/internal/arrow.tsx
|
|
4
|
+
/** The moment the arrow reacts: its link or button is pointed at or holds the keyboard focus. */
|
|
5
|
+
const lead = "in-[a:hover,button:hover,a:focus-visible,button:focus-visible]:translate-0 in-[a:hover,button:hover,a:focus-visible,button:focus-visible]:spring-snap";
|
|
6
|
+
const grow = "in-[a:hover,button:hover,a:focus-visible,button:focus-visible]:scale-100 in-[a:hover,button:hover,a:focus-visible,button:focus-visible]:opacity-100";
|
|
7
|
+
/**
|
|
8
|
+
* The arrow of an action that leads somewhere. At rest it is a chevron. When its link or button
|
|
9
|
+
* is pointed at, the head moves on and a shaft grows out of it behind, so the chevron becomes an
|
|
10
|
+
* arrow; let go, it seats back (`seat`). On a touch screen, where nothing is pointed at, it is the
|
|
11
|
+
* arrow from the start. Under reduced motion nothing travels: the shaft only fades in.
|
|
12
|
+
*
|
|
13
|
+
* Drawn like the glyphs: mitred joins, butt ends, `currentColor`.
|
|
14
|
+
*/
|
|
15
|
+
function ActionArrow({ direction = "right", size = 16, stroke = 1.5, className, ...props }) {
|
|
16
|
+
const out = direction === "out";
|
|
17
|
+
return /* @__PURE__ */ jsxs("svg", {
|
|
18
|
+
"data-slot": "action-arrow",
|
|
19
|
+
width: size,
|
|
20
|
+
height: size,
|
|
21
|
+
viewBox: "0 0 16 16",
|
|
22
|
+
fill: "none",
|
|
23
|
+
stroke: "currentColor",
|
|
24
|
+
strokeWidth: stroke * 16 / size,
|
|
25
|
+
strokeLinejoin: "miter",
|
|
26
|
+
strokeLinecap: "butt",
|
|
27
|
+
"aria-hidden": true,
|
|
28
|
+
className: cn("shrink-0 overflow-visible", direction === "left" && "-scale-x-100", className),
|
|
29
|
+
...props,
|
|
30
|
+
children: [/* @__PURE__ */ jsx("path", {
|
|
31
|
+
"data-part": "shaft",
|
|
32
|
+
d: out ? "M3.75 12.25 11.5 4.5" : "M2.75 8H12",
|
|
33
|
+
className: cn("transition-[translate,scale,opacity] spring-seat [transform-box:fill-box]", out ? "origin-top-right translate-x-[-2px] translate-y-[2px] scale-0" : "origin-right translate-x-[-2.5px] scale-x-0", lead, grow, "pointer-coarse:translate-0 pointer-coarse:scale-100", "motion-reduce:translate-0 motion-reduce:scale-100 motion-reduce:opacity-0", "motion-reduce:in-[a:hover,button:hover,a:focus-visible,button:focus-visible]:opacity-100")
|
|
34
|
+
}), /* @__PURE__ */ jsx("path", {
|
|
35
|
+
"data-part": "head",
|
|
36
|
+
d: out ? "M5.75 4.25H11.75V10.25" : "M8.25 4 12.25 8 8.25 12",
|
|
37
|
+
className: cn("transition-[translate] spring-seat [transform-box:fill-box]", out ? "translate-x-[-2px] translate-y-[2px]" : "translate-x-[-2.5px]", lead, "motion-reduce:translate-0 pointer-coarse:translate-0")
|
|
38
|
+
})]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export { ActionArrow };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/internal/disclosure.ts
|
|
2
|
+
/**
|
|
3
|
+
* A panel that opens under its trigger: the motion an `Accordion` and a `Collapsible` share.
|
|
4
|
+
*
|
|
5
|
+
* It grows to its measured height on `settle` while its content fades in; closing is the faster
|
|
6
|
+
* `leave`. The height itself comes from the part (`--accordion-panel-height`,
|
|
7
|
+
* `--collapsible-panel-height`), so each part adds its own `h-(…)` class.
|
|
8
|
+
*
|
|
9
|
+
* The panel has to clip while it moves, and CSS cannot tell it when it has stopped, so it clips
|
|
10
|
+
* at rest as well. Whatever stands inside therefore keeps a few pixels of padding to the panel's
|
|
11
|
+
* edge, or a focus outline at the edge would be cut off.
|
|
12
|
+
*/
|
|
13
|
+
const disclosurePanel = [
|
|
14
|
+
"overflow-hidden transition-[height,opacity] spring-settle",
|
|
15
|
+
"data-starting-style:h-0 data-starting-style:opacity-0",
|
|
16
|
+
"data-ending-style:h-0 data-ending-style:opacity-0 data-ending-style:spring-leave"
|
|
17
|
+
].join(" ");
|
|
18
|
+
/** The chevron of a disclosure: muted until the row is pointed at, and it turns on `seat`. */
|
|
19
|
+
const disclosureChevron = "text-fg-muted transition-[rotate,color] spring-seat group-hover:text-fg group-data-disabled:text-on-disabled";
|
|
20
|
+
export { disclosureChevron, disclosurePanel };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { createContext } from "react";
|
|
3
|
+
// src/internal/field-context.ts
|
|
4
|
+
/**
|
|
5
|
+
* True inside a wrapper that wears the field look (`InputGroup`). An `Input` rendered there goes
|
|
6
|
+
* bare, so there is one `Input` for both cases.
|
|
7
|
+
*/
|
|
8
|
+
const FieldShellContext = createContext(false);
|
|
9
|
+
/**
|
|
10
|
+
* The surrounding `Field`'s actions: `current.validate()` checks its control now, whatever its
|
|
11
|
+
* `validationMode`. A control that finds out for itself that its text cannot be used (a date
|
|
12
|
+
* field) calls it, so the reason is shown as soon as it is known and not only once the form is
|
|
13
|
+
* submitted. A ref, so reading it never re-renders anything. `null` outside a `Field`.
|
|
14
|
+
*/
|
|
15
|
+
const FieldActionsContext = createContext(null);
|
|
16
|
+
/**
|
|
17
|
+
* Whether the surrounding `Field` is disabled. Base UI tells its own controls; a part of ours
|
|
18
|
+
* that stands beside the control (the button that opens a date field's calendar) asks here.
|
|
19
|
+
*/
|
|
20
|
+
const FieldDisabledContext = createContext(false);
|
|
21
|
+
export { FieldActionsContext, FieldDisabledContext, FieldShellContext };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The look of a text field, for the two ways a field is built.
|
|
3
|
+
*
|
|
4
|
+
* A plain `Input` wears the field itself: the edge, the halo and the states sit on the `<input>`.
|
|
5
|
+
* As soon as something stands beside the text (an icon, a unit, a button, steppers), a wrapper
|
|
6
|
+
* has to wear the field instead and the control inside it goes bare. Then the wrapper reads the
|
|
7
|
+
* control's state: `fieldShell` + `fieldShellSize` on the wrapper, `bareControl` and the
|
|
8
|
+
* `data-field-control` attribute on the control.
|
|
9
|
+
*
|
|
10
|
+
* No `"use client"`: these are class names and one event handler, usable from any module.
|
|
11
|
+
*/
|
|
12
|
+
import "react";
|
|
13
|
+
/**
|
|
14
|
+
* Height, corner and inline padding by size, handed to the parts inside as variables:
|
|
15
|
+
* `--field-pad` (where text starts), `--field-height` and `--field-radius` (for a button that
|
|
16
|
+
* has to fit concentrically).
|
|
17
|
+
*/
|
|
18
|
+
export declare const fieldShellSize: {
|
|
19
|
+
readonly sm: "h-(--control-sm) rounded-sm [--field-height:var(--control-sm)] [--field-pad:var(--field-pad-sm)] [--field-radius:var(--radius-sm)]";
|
|
20
|
+
readonly md: "h-(--control-md) rounded-md [--field-height:var(--control-md)] [--field-pad:var(--field-pad-md)] [--field-radius:var(--radius-md)]";
|
|
21
|
+
readonly lg: "h-(--control-lg) rounded-lg [--field-height:var(--control-lg)] [--field-pad:var(--field-pad-lg)] [--field-radius:var(--radius-lg)]";
|
|
22
|
+
};
|
|
23
|
+
export type FieldSize = keyof typeof fieldShellSize;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/internal/field.ts
|
|
2
|
+
/** What every field shares, however it is built: the white socket and how its shadow moves. */
|
|
3
|
+
const fieldFace = ["bg-surface text-control text-fg depth-field", "transition-[box-shadow,background-color] spring-snap"].join(" ");
|
|
4
|
+
/** How typed text and its placeholder are set. 16px on touch devices, so iOS never zooms. */
|
|
5
|
+
const fieldText = ["pointer-coarse:text-base", "placeholder:text-fg-muted placeholder:italic"].join(" ");
|
|
6
|
+
/**
|
|
7
|
+
* The wrapper that wears the field. The halo follows the control only: a button inside the shell
|
|
8
|
+
* shows its own focus outline, and the field stays quiet. Invalid beats focus, as on `Input`.
|
|
9
|
+
*/
|
|
10
|
+
const fieldShell = [
|
|
11
|
+
"group/field relative flex w-full min-w-0 cursor-text items-center pointer-coarse:text-base",
|
|
12
|
+
fieldFace,
|
|
13
|
+
"has-[[data-field-control]:focus]:depth-field-focus",
|
|
14
|
+
"has-[[data-field-control][data-invalid]]:depth-field-invalid has-[[data-field-control][data-invalid]:focus]:depth-field-invalid",
|
|
15
|
+
"has-[[data-field-control][data-disabled]]:cursor-default has-[[data-field-control][data-disabled]]:bg-disabled has-[[data-field-control][data-disabled]]:depth-flat has-[[data-field-control][data-disabled]]:text-on-disabled"
|
|
16
|
+
].join(" ");
|
|
17
|
+
/**
|
|
18
|
+
* Height, corner and inline padding by size, handed to the parts inside as variables:
|
|
19
|
+
* `--field-pad` (where text starts), `--field-height` and `--field-radius` (for a button that
|
|
20
|
+
* has to fit concentrically).
|
|
21
|
+
*/
|
|
22
|
+
const fieldShellSize = {
|
|
23
|
+
sm: "h-(--control-sm) rounded-sm [--field-height:var(--control-sm)] [--field-pad:var(--field-pad-sm)] [--field-radius:var(--radius-sm)]",
|
|
24
|
+
md: "h-(--control-md) rounded-md [--field-height:var(--control-md)] [--field-pad:var(--field-pad-md)] [--field-radius:var(--radius-md)]",
|
|
25
|
+
lg: "h-(--control-lg) rounded-lg [--field-height:var(--control-lg)] [--field-pad:var(--field-pad-lg)] [--field-radius:var(--radius-lg)]"
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* The control inside a shell: no face of its own, as tall as the shell, taking the room that is
|
|
29
|
+
* left. Where an adornment stands beside it, 8px separate the two instead of the field padding.
|
|
30
|
+
* `outline-hidden` keeps a real outline for forced colours, where the halo is gone.
|
|
31
|
+
*/
|
|
32
|
+
const bareControl = [
|
|
33
|
+
"h-full min-w-0 flex-1 bg-transparent px-(--field-pad) text-control text-fg not-first:pl-2 not-last:pr-2",
|
|
34
|
+
fieldText,
|
|
35
|
+
"focus:outline-hidden",
|
|
36
|
+
"data-disabled:text-on-disabled"
|
|
37
|
+
].join(" ");
|
|
38
|
+
/**
|
|
39
|
+
* A click on the shell's own surface, or on an icon or a unit, goes to the control: the whole
|
|
40
|
+
* field is the target, as it is for a plain input. Buttons and links inside keep their click.
|
|
41
|
+
*/
|
|
42
|
+
function focusFieldControl(event) {
|
|
43
|
+
if (event.target.closest("button, a, input, textarea, select, [role='button']")) return;
|
|
44
|
+
const control = event.currentTarget.querySelector("[data-field-control]");
|
|
45
|
+
if (!control || control.matches(":disabled, [data-disabled]")) return;
|
|
46
|
+
event.preventDefault();
|
|
47
|
+
control.focus();
|
|
48
|
+
}
|
|
49
|
+
export { bareControl, fieldFace, fieldShell, fieldShellSize, fieldText, focusFieldControl };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { cn } from "../lib/cn.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
// src/internal/glyphs.tsx
|
|
4
|
+
function Glyph({ className, children, ...props }) {
|
|
5
|
+
return /* @__PURE__ */ jsx("svg", {
|
|
6
|
+
"data-slot": "glyph",
|
|
7
|
+
width: "12",
|
|
8
|
+
height: "12",
|
|
9
|
+
viewBox: "0 0 12 12",
|
|
10
|
+
fill: "none",
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeWidth: "1.75",
|
|
13
|
+
strokeLinejoin: "miter",
|
|
14
|
+
strokeLinecap: "butt",
|
|
15
|
+
"aria-hidden": true,
|
|
16
|
+
className: cn("shrink-0", className),
|
|
17
|
+
...props,
|
|
18
|
+
children
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/** `pathLength={1}` lets a control draw the tick with `stroke-dashoffset` from 1 to 0. */
|
|
22
|
+
function TickGlyph(props) {
|
|
23
|
+
return /* @__PURE__ */ jsx(Glyph, {
|
|
24
|
+
...props,
|
|
25
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
26
|
+
d: "M2.25 6.4 4.9 9 9.75 3.25",
|
|
27
|
+
pathLength: 1
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
function DashGlyph(props) {
|
|
32
|
+
return /* @__PURE__ */ jsx(Glyph, {
|
|
33
|
+
...props,
|
|
34
|
+
children: /* @__PURE__ */ jsx("path", {
|
|
35
|
+
d: "M2.5 6h7",
|
|
36
|
+
pathLength: 1
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
function ChevronDownGlyph(props) {
|
|
41
|
+
return /* @__PURE__ */ jsx(Glyph, {
|
|
42
|
+
...props,
|
|
43
|
+
children: /* @__PURE__ */ jsx("path", { d: "M2.5 4.25 6 7.75 9.5 4.25" })
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function ChevronRightGlyph(props) {
|
|
47
|
+
return /* @__PURE__ */ jsx(Glyph, {
|
|
48
|
+
...props,
|
|
49
|
+
children: /* @__PURE__ */ jsx("path", { d: "M4.25 2.5 7.75 6 4.25 9.5" })
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function ChevronLeftGlyph(props) {
|
|
53
|
+
return /* @__PURE__ */ jsx(Glyph, {
|
|
54
|
+
...props,
|
|
55
|
+
children: /* @__PURE__ */ jsx("path", { d: "M7.75 2.5 4.25 6 7.75 9.5" })
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function CloseGlyph(props) {
|
|
59
|
+
return /* @__PURE__ */ jsx(Glyph, {
|
|
60
|
+
...props,
|
|
61
|
+
children: /* @__PURE__ */ jsx("path", { d: "M2.75 2.75 9.25 9.25M9.25 2.75 2.75 9.25" })
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/** The steppers of a number field. */
|
|
65
|
+
function PlusGlyph(props) {
|
|
66
|
+
return /* @__PURE__ */ jsx(Glyph, {
|
|
67
|
+
...props,
|
|
68
|
+
children: /* @__PURE__ */ jsx("path", { d: "M6 2.5v7M2.5 6h7" })
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function MinusGlyph(props) {
|
|
72
|
+
return /* @__PURE__ */ jsx(Glyph, {
|
|
73
|
+
...props,
|
|
74
|
+
children: /* @__PURE__ */ jsx("path", { d: "M2.5 6h7" })
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
/** The direction mark of a sortable column: up is ascending; turned, descending. */
|
|
78
|
+
function ArrowUpGlyph(props) {
|
|
79
|
+
return /* @__PURE__ */ jsx(Glyph, {
|
|
80
|
+
...props,
|
|
81
|
+
children: /* @__PURE__ */ jsx("path", { d: "M6 10V2.75M2.5 6 6 2.5 9.5 6" })
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export { ArrowUpGlyph, ChevronDownGlyph, ChevronLeftGlyph, ChevronRightGlyph, CloseGlyph, DashGlyph, MinusGlyph, PlusGlyph, TickGlyph };
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
// src/internal/iso-date.ts
|
|
2
|
+
/**
|
|
3
|
+
* Dates travel as ISO strings (`2026-11-14`): no time and no zone, safe to store and to post.
|
|
4
|
+
* These helpers turn them into local `Date`s for a calendar and back, and read a date the way
|
|
5
|
+
* it is typed in German.
|
|
6
|
+
*/
|
|
7
|
+
const ISO = /^(\d{4})-(\d{2})-(\d{2})$/;
|
|
8
|
+
/** A local date from its parts, or `undefined` if there is no such day (31 February). */
|
|
9
|
+
function fromParts(year, month, day) {
|
|
10
|
+
const date = new Date(year, month - 1, day);
|
|
11
|
+
return date.getFullYear() === year && date.getMonth() === month - 1 && date.getDate() === day ? date : void 0;
|
|
12
|
+
}
|
|
13
|
+
/** `"2026-11-14"` as a local date; `undefined` for anything that is not a real ISO date. */
|
|
14
|
+
function parseIsoDate(value) {
|
|
15
|
+
const match = value ? ISO.exec(value) : null;
|
|
16
|
+
if (!match) return void 0;
|
|
17
|
+
return fromParts(Number(match[1]), Number(match[2]), Number(match[3]));
|
|
18
|
+
}
|
|
19
|
+
/** A local date as `"2026-11-14"`. */
|
|
20
|
+
function toIsoDate(date) {
|
|
21
|
+
const pad = (part, length = 2) => String(part).padStart(length, "0");
|
|
22
|
+
return `${pad(date.getFullYear(), 4)}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
23
|
+
}
|
|
24
|
+
/** A local date as `"14.11.2026"`. */
|
|
25
|
+
function formatGermanDate(date) {
|
|
26
|
+
const pad = (part) => String(part).padStart(2, "0");
|
|
27
|
+
return `${pad(date.getDate())}.${pad(date.getMonth() + 1)}.${date.getFullYear()}`;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Reads a typed date: `14.11.2026`, `14.11.26`, `1.2.2026`, `14.11.` (this year), `14112026`,
|
|
31
|
+
* `141126`, and ISO. A two-digit year is in this century. `undefined` if it is not a real date.
|
|
32
|
+
*/
|
|
33
|
+
function parseGermanDate(text, today = /* @__PURE__ */ new Date()) {
|
|
34
|
+
const typed = text.trim();
|
|
35
|
+
const iso = parseIsoDate(typed);
|
|
36
|
+
if (iso) return iso;
|
|
37
|
+
const match = /^(\d{1,2})\.\s*(\d{1,2})\.\s*(\d{2}|\d{4})?$/.exec(typed) ?? /^(\d{2})(\d{2})(\d{2}|\d{4})$/.exec(typed);
|
|
38
|
+
if (!match) return void 0;
|
|
39
|
+
return fromParts(match[3] === void 0 ? today.getFullYear() : match[3].length === 2 ? 2e3 + Number(match[3]) : Number(match[3]), Number(match[2]), Number(match[1]));
|
|
40
|
+
}
|
|
41
|
+
const ISO_TIME = /^(\d{2}):(\d{2})$/;
|
|
42
|
+
/** `"09:30"` from its parts, or `undefined` if there is no such time (24:00, 9:60). */
|
|
43
|
+
function timeFromParts(hours, minutes) {
|
|
44
|
+
if (!Number.isInteger(hours) || !Number.isInteger(minutes)) return void 0;
|
|
45
|
+
if (hours < 0 || hours > 23 || minutes < 0 || minutes > 59) return void 0;
|
|
46
|
+
return `${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`;
|
|
47
|
+
}
|
|
48
|
+
/** Whether a string is an ISO time of day, `"09:30"`. */
|
|
49
|
+
function isIsoTime(value) {
|
|
50
|
+
const match = value ? ISO_TIME.exec(value) : null;
|
|
51
|
+
return match ? timeFromParts(Number(match[1]), Number(match[2])) !== void 0 : false;
|
|
52
|
+
}
|
|
53
|
+
/** The time a field starts from when none was given: the start of a working day. */
|
|
54
|
+
const DEFAULT_TIME = "09:00";
|
|
55
|
+
/** The end of a range when none was given. */
|
|
56
|
+
const DEFAULT_END_TIME = "17:00";
|
|
57
|
+
/** "am" or "pm" at the end of typed text, however it is written: `PM`, `p.m.`, `p`. */
|
|
58
|
+
const MERIDIEM = /\s*([ap])(?:\.?\s?m\.?)?$/i;
|
|
59
|
+
/**
|
|
60
|
+
* Reads a typed time and returns it as `"09:30"`: `9`, `09`, `9:30`, `9.30`, `930`, `0930`,
|
|
61
|
+
* `9 Uhr`, `9:30 Uhr`, `9h`, and with AM or PM `9 pm`, `9:30 PM`, `930p`. `undefined` if it is
|
|
62
|
+
* not a time of day.
|
|
63
|
+
*/
|
|
64
|
+
function parseGermanTime(text) {
|
|
65
|
+
const half = MERIDIEM.exec(text.trim())?.[1]?.toLowerCase();
|
|
66
|
+
const typed = text.trim().replace(MERIDIEM, "").replace(/\s*(uhr|h)\.?$/i, "").trim();
|
|
67
|
+
const split = /^(\d{1,2})[:.h](\d{2})$/i.exec(typed) ?? /^(\d{1,2})(\d{2})$/.exec(typed);
|
|
68
|
+
const hour = split ? Number(split[1]) : /^\d{1,2}$/.test(typed) ? Number(typed) : void 0;
|
|
69
|
+
if (hour === void 0) return void 0;
|
|
70
|
+
const minutes = split ? Number(split[2]) : 0;
|
|
71
|
+
if (!half) return timeFromParts(hour, minutes);
|
|
72
|
+
if (hour < 1 || hour > 12) return void 0;
|
|
73
|
+
return timeFromParts(hour % 12 + (half === "p" ? 12 : 0), minutes);
|
|
74
|
+
}
|
|
75
|
+
/** `"16:30"` the way it is read: as it is, or `"4:30 PM"` on a 12-hour clock. */
|
|
76
|
+
function formatTime(time, hourCycle = 24) {
|
|
77
|
+
const match = ISO_TIME.exec(time);
|
|
78
|
+
if (!match || hourCycle === 24) return time;
|
|
79
|
+
const hour = Number(match[1]);
|
|
80
|
+
return `${hour % 12 === 0 ? 12 : hour % 12}:${match[2]} ${hour < 12 ? "AM" : "PM"}`;
|
|
81
|
+
}
|
|
82
|
+
/** A time moved by some minutes, staying within the day: 23:50 plus 15 is 00:05. */
|
|
83
|
+
function shiftIsoTime(time, minutes) {
|
|
84
|
+
const match = ISO_TIME.exec(time);
|
|
85
|
+
if (!match) return time;
|
|
86
|
+
const day = 1440;
|
|
87
|
+
const total = ((Number(match[1]) * 60 + Number(match[2]) + minutes) % day + day) % day;
|
|
88
|
+
return timeFromParts(Math.floor(total / 60), total % 60);
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* A moment as it travels: `"2026-11-14"` or, with a time, `"2026-11-14T09:30"`. No zone: it is
|
|
92
|
+
* the wall clock of whoever typed it, which is what an appointment means.
|
|
93
|
+
*/
|
|
94
|
+
function splitIsoMoment(value) {
|
|
95
|
+
if (!value) return void 0;
|
|
96
|
+
const [date = "", time = ""] = value.split("T");
|
|
97
|
+
if (!parseIsoDate(date)) return void 0;
|
|
98
|
+
if (time !== "" && !isIsoTime(time)) return void 0;
|
|
99
|
+
return {
|
|
100
|
+
date,
|
|
101
|
+
time
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/** `"2026-11-14T09:30"` as `"14.11.2026, 09:30"`; a date alone as `"14.11.2026"`. */
|
|
105
|
+
function formatGermanMoment(value, hourCycle = 24) {
|
|
106
|
+
const moment = splitIsoMoment(value);
|
|
107
|
+
if (!moment) return "";
|
|
108
|
+
const date = formatGermanDate(parseIsoDate(moment.date));
|
|
109
|
+
return moment.time ? `${date}, ${formatTime(moment.time, hourCycle)}` : date;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Reads a typed date that may carry a time and returns it as ISO: `14.11.2026, 9:30`,
|
|
113
|
+
* `14.11. 9 Uhr`, `14.11.2026 um 09:30`, `14.11.2026` (then the time is `""`). A number of four
|
|
114
|
+
* digits after the date is a year from 1900 on and a time below that (`14.11. 0930`).
|
|
115
|
+
*/
|
|
116
|
+
function parseGermanMoment(text, today = /* @__PURE__ */ new Date()) {
|
|
117
|
+
const typed = text.trim();
|
|
118
|
+
const iso = splitIsoMoment(typed);
|
|
119
|
+
if (iso) return iso;
|
|
120
|
+
const read = (datePart, timePart) => {
|
|
121
|
+
const date = parseGermanDate(datePart, today);
|
|
122
|
+
const time = parseGermanTime(timePart);
|
|
123
|
+
return date && time ? {
|
|
124
|
+
date: toIsoDate(date),
|
|
125
|
+
time
|
|
126
|
+
} : void 0;
|
|
127
|
+
};
|
|
128
|
+
const marked = /^(.+?)\s*(?:,|\bum\b)\s*(.+)$/i.exec(typed);
|
|
129
|
+
if (marked) return read(marked[1], marked[2]);
|
|
130
|
+
const half = MERIDIEM.exec(typed)?.[0] ?? "";
|
|
131
|
+
const bare = typed.replace(MERIDIEM, "");
|
|
132
|
+
const said = half !== "" || /\s*(?:uhr|h)\.?$/i.test(bare);
|
|
133
|
+
const words = /^(.*\S)\s+(\S+)$/.exec(bare.replace(/\s*(?:uhr|h)\.?$/i, ""));
|
|
134
|
+
if (words) {
|
|
135
|
+
const last = words[2];
|
|
136
|
+
if (!(!said && /^\d{4}$/.test(last) && Number(last) >= 1900)) {
|
|
137
|
+
const moment = read(words[1], last + half);
|
|
138
|
+
if (moment) return moment;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const date = parseGermanDate(typed, today);
|
|
142
|
+
return date ? {
|
|
143
|
+
date: toIsoDate(date),
|
|
144
|
+
time: ""
|
|
145
|
+
} : void 0;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* The start of a range, read in the light of its end: "14." takes month and year from the end,
|
|
149
|
+
* "14.11." the year. If that lands after the end, the month or year before is meant: "28.12. –
|
|
150
|
+
* 03.01.2027" starts in 2026.
|
|
151
|
+
*/
|
|
152
|
+
function startBefore(text, end) {
|
|
153
|
+
const last = parseIsoDate(end.date);
|
|
154
|
+
const day = /^(\d{1,2})\.?((?:\s|,).*)?$/.exec(text);
|
|
155
|
+
if (day) {
|
|
156
|
+
const inMonth = (monthsBack) => {
|
|
157
|
+
const month = new Date(last.getFullYear(), last.getMonth() - monthsBack, 1);
|
|
158
|
+
return parseGermanMoment(`${day[1]}.${month.getMonth() + 1}.${month.getFullYear()}${day[2] ?? ""}`);
|
|
159
|
+
};
|
|
160
|
+
const same = inMonth(0);
|
|
161
|
+
return same && same.date <= end.date ? same : inMonth(1) ?? same;
|
|
162
|
+
}
|
|
163
|
+
const start = parseGermanMoment(text, last);
|
|
164
|
+
if (!start || start.date <= end.date) return start;
|
|
165
|
+
const yearBefore = parseGermanMoment(text, new Date(last.getFullYear() - 1, 0, 1));
|
|
166
|
+
return yearBefore && yearBefore.date !== start.date ? yearBefore : start;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Reads a typed range: `14.11. – 30.11.2026`, `14.–30.11.2026`, `14.11.2026 bis 30.11.2026`,
|
|
170
|
+
* `14.11.-30.11.`, and with times `14.11., 9:00 – 16.11., 17:00` or `14.11. 9–17 Uhr` (one day).
|
|
171
|
+
* A start without a year or month takes them from the end. The two ends come back in order.
|
|
172
|
+
*/
|
|
173
|
+
function parseGermanRange(text, today = /* @__PURE__ */ new Date()) {
|
|
174
|
+
const typed = text.trim();
|
|
175
|
+
const cuts = [];
|
|
176
|
+
for (const match of typed.matchAll(/\s*(?:–|—|\bbis\b|-)\s*/gi)) cuts.push([typed.slice(0, match.index), typed.slice(match.index + match[0].length)]);
|
|
177
|
+
for (const [left, right] of cuts) {
|
|
178
|
+
if (left === "" || right === "") continue;
|
|
179
|
+
const to = parseGermanMoment(right, today);
|
|
180
|
+
if (to) {
|
|
181
|
+
const from = startBefore(left, to);
|
|
182
|
+
if (!from) continue;
|
|
183
|
+
return `${from.date}T${from.time}` <= `${to.date}T${to.time}` ? {
|
|
184
|
+
from,
|
|
185
|
+
to
|
|
186
|
+
} : {
|
|
187
|
+
from: to,
|
|
188
|
+
to: from
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
const from = parseGermanMoment(left, today);
|
|
192
|
+
const time = parseGermanTime(right);
|
|
193
|
+
if (from && from.time && time) {
|
|
194
|
+
const end = {
|
|
195
|
+
date: from.date,
|
|
196
|
+
time
|
|
197
|
+
};
|
|
198
|
+
return from.time <= time ? {
|
|
199
|
+
from,
|
|
200
|
+
to: end
|
|
201
|
+
} : {
|
|
202
|
+
from: end,
|
|
203
|
+
to: from
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/** `{ from, to }` the way it is read: `"14.11.2026 – 30.11.2026"`, with times if it has them. */
|
|
209
|
+
function formatGermanRange(range, hourCycle = 24) {
|
|
210
|
+
const from = formatGermanMoment(range.from, hourCycle);
|
|
211
|
+
const to = formatGermanMoment(range.to, hourCycle);
|
|
212
|
+
return from && to ? `${from} – ${to}` : "";
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* A range as one string, the ISO 8601 way: `"2026-11-14/2026-11-30"`. That is what a range field
|
|
216
|
+
* submits under its name. `""` for no range.
|
|
217
|
+
*/
|
|
218
|
+
function toIsoInterval(range) {
|
|
219
|
+
return range && splitIsoMoment(range.from) && splitIsoMoment(range.to) ? `${range.from}/${range.to}` : "";
|
|
220
|
+
}
|
|
221
|
+
/** `"2026-11-14/2026-11-30"` as `{ from, to }`; both empty for anything else. */
|
|
222
|
+
function parseIsoInterval(interval) {
|
|
223
|
+
const [from = "", to = ""] = (interval ?? "").split("/");
|
|
224
|
+
return splitIsoMoment(from) && splitIsoMoment(to) ? {
|
|
225
|
+
from,
|
|
226
|
+
to
|
|
227
|
+
} : {
|
|
228
|
+
from: "",
|
|
229
|
+
to: ""
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/** Why a day cannot be chosen, as a sentence; nothing if it lies within the limits. */
|
|
233
|
+
function outsideLimits(date, min, max) {
|
|
234
|
+
if ((!min || date >= min) && (!max || date <= max)) return void 0;
|
|
235
|
+
const day = (iso) => formatGermanDate(parseIsoDate(iso));
|
|
236
|
+
if (min && max) return `Bitte wählen Sie ein Datum zwischen dem ${day(min)} und dem ${day(max)}.`;
|
|
237
|
+
return min ? `Bitte wählen Sie ein Datum ab dem ${day(min)}.` : `Bitte wählen Sie ein Datum bis zum ${day(max)}.`;
|
|
238
|
+
}
|
|
239
|
+
/** The place of a day in its week, Monday first: 0 for Monday, 6 for Sunday. */
|
|
240
|
+
function weekdayIndex(date) {
|
|
241
|
+
return (date.getDay() + 6) % 7;
|
|
242
|
+
}
|
|
243
|
+
/** The times of a day in steps of so many minutes, within the limits: `["08:00", "08:15", …]`. */
|
|
244
|
+
function timesOfDay(step, min = "00:00", max = "23:59") {
|
|
245
|
+
const times = [];
|
|
246
|
+
for (let minutes = 0; minutes < 1440; minutes += Math.max(1, Math.round(step))) {
|
|
247
|
+
const time = shiftIsoTime("00:00", minutes);
|
|
248
|
+
if (time >= min && time <= max) times.push(time);
|
|
249
|
+
}
|
|
250
|
+
return times;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Whether a time is one that typed text could become: `"9"` finds 09:00 to 09:45, `"93"` and
|
|
254
|
+
* `"9:3"` find 09:30, `"14"` finds 14:…. On a 12-hour clock `"4"` finds four in the morning and
|
|
255
|
+
* in the afternoon, `"4p"` only the afternoon; the hour may be typed either way, `"16"` too.
|
|
256
|
+
* Text without a digit narrows nothing: every time is offered.
|
|
257
|
+
*/
|
|
258
|
+
function timeMatches(time, typed, hourCycle = 24) {
|
|
259
|
+
const digits = typed.replace(/\D/g, "");
|
|
260
|
+
if (digits === "") return true;
|
|
261
|
+
const half = /\d\s*([ap])/i.exec(typed)?.[1]?.toLowerCase();
|
|
262
|
+
if (half && half === "p" !== time >= "12:00") return false;
|
|
263
|
+
const whole = time.replace(":", "");
|
|
264
|
+
const ways = [whole, whole.replace(/^0/, "")];
|
|
265
|
+
if (hourCycle === 12) ways.push(formatTime(time, 12).replace(/\D/g, ""));
|
|
266
|
+
return ways.some((way) => way.startsWith(digits));
|
|
267
|
+
}
|
|
268
|
+
export { DEFAULT_END_TIME, DEFAULT_TIME, formatGermanDate, formatGermanMoment, formatGermanRange, formatTime, isIsoTime, outsideLimits, parseGermanDate, parseGermanMoment, parseGermanRange, parseGermanTime, parseIsoDate, parseIsoInterval, shiftIsoTime, splitIsoMoment, timeMatches, timesOfDay, toIsoDate, toIsoInterval, weekdayIndex };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// src/internal/overlay.ts
|
|
2
|
+
/**
|
|
3
|
+
* The shared look of the two modal sheets, Dialog and AlertDialog. They are separate Base UI
|
|
4
|
+
* primitives with identical parts, so the class names live here once.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The scrim, as tall as the window with the browser's bars collapsed (`lvh`). Safari 26 tints
|
|
8
|
+
* its status bar and toolbar from what lies under them, so the scrim dims those too and no light
|
|
9
|
+
* strip stays above or below it.
|
|
10
|
+
*/
|
|
11
|
+
const overlayBackdrop = "fixed inset-x-0 top-0 z-50 h-lvh bg-scrim transition-opacity duration-200 ease-out data-starting-style:opacity-0 data-ending-style:opacity-0";
|
|
12
|
+
/**
|
|
13
|
+
* Centres the sheet and keeps it inside the window; long content scrolls inside the sheet. On a
|
|
14
|
+
* phone "the window" is what is visible right now (`dvh`: the browser's bars come and go) and
|
|
15
|
+
* ends above the home indicator.
|
|
16
|
+
*/
|
|
17
|
+
const overlayViewport = "fixed inset-0 z-50 flex max-h-dvh items-center justify-center overflow-hidden p-4 pb-[max(1rem,env(safe-area-inset-bottom))]";
|
|
18
|
+
/**
|
|
19
|
+
* The sheet rises 8px into place on `sheet` and leaves by fading, without travel. Behind a nested
|
|
20
|
+
* dialog it steps back a little (`--nested-dialogs` is 0 otherwise).
|
|
21
|
+
*/
|
|
22
|
+
const overlayPopup = [
|
|
23
|
+
"relative flex max-h-full w-full max-w-md flex-col gap-5 rounded-2xl bg-sheet p-6 text-base text-fg-body depth-overlay outline-hidden",
|
|
24
|
+
"translate-y-[calc(-0.75rem*var(--nested-dialogs,0))] scale-[calc(1-0.04*var(--nested-dialogs,0))]",
|
|
25
|
+
"transition-[opacity,scale,translate] spring-sheet",
|
|
26
|
+
"data-starting-style:translate-y-2 data-starting-style:scale-(--motion-enter-scale) data-starting-style:opacity-0",
|
|
27
|
+
"data-ending-style:opacity-0 data-ending-style:spring-leave"
|
|
28
|
+
].join(" ");
|
|
29
|
+
/** Room on the right for the close button in the corner. */
|
|
30
|
+
const overlayHeader = "flex flex-col gap-1.5 pr-8";
|
|
31
|
+
const overlayTitle = "text-lg leading-snug font-semibold text-balance text-fg";
|
|
32
|
+
const overlayDescription = "text-fg-body";
|
|
33
|
+
/**
|
|
34
|
+
* The part that scrolls when the content is long. It bleeds to the sheet's edges, and keeps 4px
|
|
35
|
+
* of its own so the focus halo of a field at the edge is not clipped.
|
|
36
|
+
*/
|
|
37
|
+
const overlayBody = "-mx-6 -my-1 min-h-0 overflow-y-auto px-6 py-1";
|
|
38
|
+
/** Actions, right-aligned: the way out on the left, the committed action last. */
|
|
39
|
+
const overlayFooter = "flex flex-wrap items-center justify-end gap-2 pt-1";
|
|
40
|
+
export { overlayBackdrop, overlayBody, overlayDescription, overlayFooter, overlayHeader, overlayPopup, overlayTitle, overlayViewport };
|