@devalok/shilp-sutra 0.52.0 → 0.54.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/AGENTS.md +7 -1
- package/BREAKING.json +29 -0
- package/MIGRATION.md +61 -0
- package/dist/_chunks/motion-provider.js +7 -6
- package/dist/_chunks/motion-provider.js.map +1 -1
- package/dist/_chunks/success.js +53 -53
- package/dist/ai/command-bar.js +158 -158
- package/dist/ai/command-bar.js.map +1 -1
- package/dist/ai/conversation.js +5 -5
- package/dist/composed/avatar-group.d.ts +11 -9
- package/dist/composed/avatar-group.d.ts.map +1 -1
- package/dist/composed/avatar-group.js +108 -140
- package/dist/composed/avatar-group.js.map +1 -1
- package/dist/composed/bulk-action-bar.d.ts +19 -11
- package/dist/composed/bulk-action-bar.d.ts.map +1 -1
- package/dist/composed/bulk-action-bar.js +81 -110
- package/dist/composed/bulk-action-bar.js.map +1 -1
- package/dist/composed/command-palette.js +17 -17
- package/dist/composed/command-palette.js.map +1 -1
- package/dist/composed/error-boundary.d.ts +15 -3
- package/dist/composed/error-boundary.d.ts.map +1 -1
- package/dist/composed/error-boundary.js +43 -26
- package/dist/composed/error-boundary.js.map +1 -1
- package/dist/composed/loading-skeleton.d.ts +2 -0
- package/dist/composed/loading-skeleton.d.ts.map +1 -1
- package/dist/composed/loading-skeleton.js +79 -56
- package/dist/composed/loading-skeleton.js.map +1 -1
- package/dist/composed/master-detail.d.ts +21 -8
- package/dist/composed/master-detail.d.ts.map +1 -1
- package/dist/composed/master-detail.js +91 -77
- package/dist/composed/master-detail.js.map +1 -1
- package/dist/composed/page-skeletons.d.ts +6 -0
- package/dist/composed/page-skeletons.d.ts.map +1 -1
- package/dist/composed/page-skeletons.js +93 -71
- package/dist/composed/page-skeletons.js.map +1 -1
- package/dist/composed/priority-indicator.d.ts +15 -6
- package/dist/composed/priority-indicator.d.ts.map +1 -1
- package/dist/composed/priority-indicator.js +37 -88
- package/dist/composed/priority-indicator.js.map +1 -1
- package/dist/composed/schedule-view.d.ts +17 -2
- package/dist/composed/schedule-view.d.ts.map +1 -1
- package/dist/composed/schedule-view.js +163 -64
- package/dist/composed/schedule-view.js.map +1 -1
- package/dist/motion/motion-provider.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.d.ts +32 -6
- package/dist/shell/bottom-navbar.d.ts.map +1 -1
- package/dist/shell/bottom-navbar.js +156 -129
- package/dist/shell/bottom-navbar.js.map +1 -1
- package/dist/shell/index.d.ts +5 -3
- package/dist/shell/index.d.ts.map +1 -1
- package/dist/shell/index.js +2 -3
- package/dist/shell/notification-preferences.d.ts.map +1 -1
- package/dist/shell/notification-preferences.js +2 -0
- package/dist/shell/notification-preferences.js.map +1 -1
- package/dist/tokens/primitives.css +6 -2
- package/dist/tokens/utilities.css +6 -0
- package/dist/ui/autocomplete.d.ts +34 -32
- package/dist/ui/autocomplete.d.ts.map +1 -1
- package/dist/ui/autocomplete.js +115 -110
- package/dist/ui/autocomplete.js.map +1 -1
- package/dist/ui/combobox.d.ts +1 -1
- package/dist/ui/combobox.d.ts.map +1 -1
- package/dist/ui/combobox.js +133 -128
- package/dist/ui/combobox.js.map +1 -1
- package/dist/ui/file-upload.d.ts.map +1 -1
- package/dist/ui/file-upload.js +124 -138
- package/dist/ui/file-upload.js.map +1 -1
- package/dist/ui/form.d.ts +7 -0
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/form.js +4 -2
- package/dist/ui/form.js.map +1 -1
- package/dist/ui/icon-button.d.ts +2 -1
- package/dist/ui/icon-button.d.ts.map +1 -1
- package/dist/ui/icon-button.js +1 -1
- package/dist/ui/icon-button.js.map +1 -1
- package/dist/ui/index.js +30 -30
- package/dist/ui/label.d.ts.map +1 -1
- package/dist/ui/label.js +7 -6
- package/dist/ui/label.js.map +1 -1
- package/dist/ui/search-input.js +4 -4
- package/dist/ui/sidebar.js +7 -7
- package/dist/ui/spinner.d.ts.map +1 -1
- package/dist/ui/spinner.js +50 -44
- package/dist/ui/spinner.js.map +1 -1
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +24 -24
- package/dist/ui/switch.js.map +1 -1
- package/dist/ui/table.js +1 -1
- package/dist/ui/table.js.map +1 -1
- package/docs/components/composed/bulk-action-bar.md +9 -3
- package/docs/components/composed/error-boundary.md +18 -2
- package/docs/components/composed/master-detail.md +12 -2
- package/docs/components/composed/page-skeletons.md +2 -2
- package/docs/components/composed/priority-indicator.md +22 -11
- package/docs/components/composed/rich-chat-input.md +18 -6
- package/docs/components/composed/schedule-view.md +20 -5
- package/docs/components/composed/simple-tooltip.md +1 -1
- package/docs/components/shell/app-command-palette.md +2 -1
- package/docs/components/shell/bottom-navbar.md +28 -9
- package/docs/components/shell/command-registry.md +2 -2
- package/docs/components/shell/link-context.md +2 -2
- package/docs/components/shell/top-bar.md +1 -1
- package/docs/components/ui/autocomplete.md +26 -10
- package/docs/components/ui/search-input.md +2 -2
- package/docs/components/ui/slider.md +2 -2
- package/docs/components/ui/split-button.md +3 -3
- package/llms.txt +2 -2
- package/make-kit/Guidelines.md +1 -1
- package/make-kit/components/overview.md +2 -2
- package/make-kit/foundations/surfaces.md +1 -1
- package/mcp-manifest.json +581 -172
- package/package.json +1 -6
- package/skill/SKILL.md +1 -1
- package/skill/chat-skill/README.md +18 -0
- package/skill/chat-skill/SKILL.md +78 -0
- package/skill/chat-skill/chatgpt-instructions.md +26 -0
- package/skill/chat-skill/gemini-instructions.md +25 -0
- package/skill/references/components.md +2 -2
- package/dist/shell/sidebar.d.ts +0 -113
- package/dist/shell/sidebar.d.ts.map +0 -1
- package/dist/shell/sidebar.js +0 -293
- package/dist/shell/sidebar.js.map +0 -1
- package/docs/components/shell/sidebar.md +0 -103
package/dist/ui/index.js
CHANGED
|
@@ -9,35 +9,35 @@ import { AlertDialog as d, AlertDialogAction as f, AlertDialogCancel as p, Alert
|
|
|
9
9
|
import { Alert as S, alertVariants as C } from "./alert.js";
|
|
10
10
|
import { AspectRatio as w } from "./aspect-ratio.js";
|
|
11
11
|
import { FormField as T, FormHelperText as E, useFormField as D } from "./form.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import {
|
|
31
|
-
import {
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
37
|
-
import {
|
|
38
|
-
import {
|
|
39
|
-
import {
|
|
40
|
-
import {
|
|
12
|
+
import { Input as O, inputWrapperVariants as k } from "./input.js";
|
|
13
|
+
import { Autocomplete as A } from "./autocomplete.js";
|
|
14
|
+
import { Dot as j, dotVariants as M } from "./dot.js";
|
|
15
|
+
import { Skeleton as N, SkeletonAvatar as P, SkeletonButton as F, SkeletonChart as I, SkeletonGroup as L, SkeletonImage as R, SkeletonInput as z, SkeletonText as B, skeletonVariants as V } from "./skeleton.js";
|
|
16
|
+
import { Avatar as H, AvatarFallback as U, AvatarImage as W, avatarVariants as G } from "./avatar.js";
|
|
17
|
+
import { BadgeIndicator as K } from "./badge-indicator.js";
|
|
18
|
+
import { BadgeCompound as q, BadgeGroup as J, badgeVariants as Y } from "../_chunks/badge-group.js";
|
|
19
|
+
import { Banner as X, bannerVariants as Z } from "./banner.js";
|
|
20
|
+
import { Breadcrumb as re, BreadcrumbEllipsis as ie, BreadcrumbItem as ae, BreadcrumbLink as oe, BreadcrumbList as se, BreadcrumbPage as ce, BreadcrumbSeparator as le } from "./breadcrumb.js";
|
|
21
|
+
import { ButtonGroup as ue, useButtonGroup as de } from "./button-group.js";
|
|
22
|
+
import { Button as fe, buttonVariants as pe } from "./button.js";
|
|
23
|
+
import { Card as me, CardAction as he, CardBleed as ge, CardContent as _e, CardDescription as ve, CardFooter as ye, CardHeader as be, CardSection as xe, CardTitle as Se, cardVariants as Ce } from "./card.js";
|
|
24
|
+
import { Checkbox as we } from "./checkbox.js";
|
|
25
|
+
import { Code as Te } from "./code.js";
|
|
26
|
+
import { Collapsible as Ee, CollapsibleContent as De, CollapsibleTrigger as Oe } from "./collapsible.js";
|
|
27
|
+
import { Popover as ke, PopoverAnchor as Ae, PopoverContent as je, PopoverTrigger as Me } from "../_chunks/popover.js";
|
|
28
|
+
import { ColorInput as Ne } from "./color-input.js";
|
|
29
|
+
import { ColorSwatch as Pe } from "./color-swatch.js";
|
|
30
|
+
import { Combobox as Fe, comboboxTriggerVariants as Ie } from "./combobox.js";
|
|
31
|
+
import { Container as Le } from "./container.js";
|
|
32
|
+
import { ContextMenu as Re, ContextMenuCheckboxItem as ze, ContextMenuContent as Be, ContextMenuGroup as Ve, ContextMenuItem as He, ContextMenuLabel as Ue, ContextMenuPortal as We, ContextMenuRadioGroup as Ge, ContextMenuRadioItem as Ke, ContextMenuSeparator as qe, ContextMenuShortcut as Je, ContextMenuSub as Ye, ContextMenuSubContent as Xe, ContextMenuSubTrigger as Ze, ContextMenuTrigger as Qe } from "./context-menu.js";
|
|
33
|
+
import { Table as $e, TableBody as et, TableCaption as tt, TableCell as nt, TableFooter as rt, TableHead as it, TableHeader as at, TableRow as ot, TableRowActions as st } from "./table.js";
|
|
34
|
+
import { DropdownMenu as ct, DropdownMenuCheckboxItem as lt, DropdownMenuContent as ut, DropdownMenuGroup as dt, DropdownMenuItem as ft, DropdownMenuLabel as pt, DropdownMenuPortal as mt, DropdownMenuRadioGroup as ht, DropdownMenuRadioItem as gt, DropdownMenuSeparator as _t, DropdownMenuShortcut as vt, DropdownMenuSub as yt, DropdownMenuSubContent as bt, DropdownMenuSubTrigger as xt, DropdownMenuTrigger as St } from "./dropdown-menu.js";
|
|
35
|
+
import { DevalokGrain as Ct } from "./devalok-grain.js";
|
|
36
|
+
import { Dialog as wt, DialogClose as Tt, DialogContent as Et, DialogContentRaw as Dt, DialogDescription as Ot, DialogFooter as kt, DialogHeader as At, DialogOverlay as jt, DialogPortal as Mt, DialogTitle as Nt, DialogTrigger as Pt } from "./dialog.js";
|
|
37
|
+
import { FileUpload as Ft } from "./file-upload.js";
|
|
38
|
+
import { HoverCard as It, HoverCardContent as Lt, HoverCardTrigger as Rt } from "./hover-card.js";
|
|
39
|
+
import { IconButton as zt } from "./icon-button.js";
|
|
40
|
+
import { IconGroup as Bt } from "./icon-group.js";
|
|
41
41
|
import { Label as Vt } from "./label.js";
|
|
42
42
|
import { Separator as Ht } from "./separator.js";
|
|
43
43
|
import { SplitButton as Ut } from "./split-button.js";
|
|
@@ -90,4 +90,4 @@ function Oi() {
|
|
|
90
90
|
//#region src/ui/index.ts
|
|
91
91
|
Oi();
|
|
92
92
|
//#endregion
|
|
93
|
-
export { s as Accordion, c as AccordionContent, l as AccordionItem, u as AccordionTrigger, S as Alert, d as AlertDialog, f as AlertDialogAction, p as AlertDialogCancel, m as AlertDialogContent, h as AlertDialogDescription, g as AlertDialogFooter, _ as AlertDialogHeader, v as AlertDialogOverlay, y as AlertDialogPortal, b as AlertDialogTitle, x as AlertDialogTrigger, w as AspectRatio,
|
|
93
|
+
export { s as Accordion, c as AccordionContent, l as AccordionItem, u as AccordionTrigger, S as Alert, d as AlertDialog, f as AlertDialogAction, p as AlertDialogCancel, m as AlertDialogContent, h as AlertDialogDescription, g as AlertDialogFooter, _ as AlertDialogHeader, v as AlertDialogOverlay, y as AlertDialogPortal, b as AlertDialogTitle, x as AlertDialogTrigger, w as AspectRatio, A as Autocomplete, H as Avatar, U as AvatarFallback, W as AvatarImage, q as Badge, J as BadgeGroup, K as BadgeIndicator, X as Banner, re as Breadcrumb, ie as BreadcrumbEllipsis, ae as BreadcrumbItem, oe as BreadcrumbLink, se as BreadcrumbList, ce as BreadcrumbPage, le as BreadcrumbSeparator, fe as Button, ue as ButtonGroup, me as Card, he as CardAction, ge as CardBleed, _e as CardContent, ve as CardDescription, ye as CardFooter, be as CardHeader, xe as CardSection, Se as CardTitle, we as Checkbox, Te as Code, Ee as Collapsible, De as CollapsibleContent, Oe as CollapsibleTrigger, Ne as ColorInput, Pe as ColorSwatch, Fe as Combobox, Le as Container, Re as ContextMenu, ze as ContextMenuCheckboxItem, Be as ContextMenuContent, Ve as ContextMenuGroup, He as ContextMenuItem, Ue as ContextMenuLabel, We as ContextMenuPortal, Ge as ContextMenuRadioGroup, Ke as ContextMenuRadioItem, qe as ContextMenuSeparator, Je as ContextMenuShortcut, Ye as ContextMenuSub, Xe as ContextMenuSubContent, Ze as ContextMenuSubTrigger, Qe as ContextMenuTrigger, ui as DateSeparator, Ct as DevalokGrain, wt as Dialog, Tt as DialogClose, Et as DialogContent, Dt as DialogContentRaw, Ot as DialogDescription, kt as DialogFooter, At as DialogHeader, jt as DialogOverlay, Mt as DialogPortal, Nt as DialogTitle, Pt as DialogTrigger, j as Dot, ct as DropdownMenu, lt as DropdownMenuCheckboxItem, ut as DropdownMenuContent, dt as DropdownMenuGroup, ft as DropdownMenuItem, pt as DropdownMenuLabel, mt as DropdownMenuPortal, ht as DropdownMenuRadioGroup, gt as DropdownMenuRadioItem, _t as DropdownMenuSeparator, vt as DropdownMenuShortcut, yt as DropdownMenuSub, bt as DropdownMenuSubContent, xt as DropdownMenuSubTrigger, St as DropdownMenuTrigger, Ft as FileUpload, T as FormField, E as FormHelperText, It as HoverCard, Lt as HoverCardContent, Rt as HoverCardTrigger, o as Icon, zt as IconButton, ee as IconContext, Bt as IconGroup, te as IconProvider, O as Input, Vt as Label, vi as Link, Jn as Menubar, Yn as MenubarCheckboxItem, Xn as MenubarContent, Zn as MenubarGroup, Qn as MenubarItem, $n as MenubarLabel, er as MenubarMenu, tr as MenubarPortal, nr as MenubarRadioGroup, rr as MenubarRadioItem, ir as MenubarSeparator, ar as MenubarShortcut, or as MenubarSub, sr as MenubarSubContent, cr as MenubarSubTrigger, lr as MenubarTrigger, di as Message, fi as MessageInput, pi as MessageList, Vn as MultiProgressRing, ur as NavigationMenu, dr as NavigationMenuContent, fr as NavigationMenuIndicator, pr as NavigationMenuItem, mr as NavigationMenuLink, hr as NavigationMenuList, gr as NavigationMenuTrigger, _r as NavigationMenuViewport, Gt as NumberInput, yi as OAuth, bi as OAuthButton, xi as OAuthConnectionRow, Si as OAuthDivider, Ci as OAuthGlyph, wi as OAuthGroup, vr as PaginationContent, yr as PaginationEllipsis, br as PaginationItem, xr as PaginationLink, Sr as PaginationNav, Cr as PaginationNext, wr as PaginationPrevious, Tr as PaginationRoot, ke as Popover, Ae as PopoverAnchor, je as PopoverContent, Me as PopoverTrigger, Mn as Progress, Nn as ProgressIndicator, Pn as ProgressLabel, Hn as ProgressRing, Fn as ProgressRoot, In as ProgressSegment, Ln as ProgressTrack, Rn as ProgressValue, qt as RadioGroup, Jt as RadioGroupItem, Yt as SearchInput, li as SegmentedControl, Xt as Select, Zt as SelectContent, Qt as SelectGroup, $t as SelectItem, en as SelectLabel, tn as SelectScrollDownButton, nn as SelectScrollUpButton, rn as SelectSeparator, Q as SelectTrigger, an as SelectValue, Ht as Separator, Sn as Sheet, Cn as SheetClose, wn as SheetContent, Tn as SheetDescription, En as SheetFooter, Dn as SheetHeader, On as SheetOverlay, kn as SheetPortal, An as SheetTitle, jn as SheetTrigger, Dr as Sidebar, Or as SidebarContent, kr as SidebarFooter, Ar as SidebarGroup, jr as SidebarGroupAction, Mr as SidebarGroupContent, Nr as SidebarGroupLabel, Pr as SidebarHeader, Fr as SidebarInput, Ir as SidebarInset, Lr as SidebarMenu, Rr as SidebarMenuAction, zr as SidebarMenuBadge, Br as SidebarMenuButton, Vr as SidebarMenuItem, Hr as SidebarMenuSkeleton, Ur as SidebarMenuSub, Wr as SidebarMenuSubButton, Gr as SidebarMenuSubItem, Kr as SidebarProvider, qr as SidebarRail, Jr as SidebarSeparator, Yr as SidebarTrigger, N as Skeleton, P as SkeletonAvatar, F as SkeletonButton, I as SkeletonChart, L as SkeletonGroup, R as SkeletonImage, z as SkeletonInput, B as SkeletonText, sn as Slider, a as Spinner, Ut as SplitButton, ai as Stack, Wn as StatCard, Un as StatFlash, ti as Step, ni as Stepper, Gn as Surface, un as Switch, mi as SystemMessage, $e as Table, et as TableBody, tt as TableCaption, nt as TableCell, rt as TableFooter, it as TableHead, at as TableHeader, ot as TableRow, st as TableRowActions, qn as TableRowLink, Zr as Tabs, Qr as TabsContent, $r as TabsList, ei as TabsTrigger, ri as Text, dn as Textarea, pn as Toggle, hn as ToggleGroup, gn as ToggleGroupItem, _n as Tooltip, vn as TooltipContent, yn as TooltipProvider, bn as TooltipTrigger, oi as TreeItem, si as TreeView, xn as TruncatedText, hi as TypingIndicator, gi as UnreadSeparator, Wt as VisuallyHidden, C as alertVariants, G as avatarVariants, Y as badgeVariants, Z as bannerVariants, pe as buttonVariants, Ce as cardVariants, i as cn, Ie as comboboxTriggerVariants, M as dotVariants, Di as formatRelativeTime, Er as generatePagination, Ti as getOAuthLabel, Ei as getOAuthName, k as inputWrapperVariants, Kt as numberInputWrapperVariants, zn as progressIndicatorVariants, Bn as progressTrackVariants, on as selectTriggerVariants, V as skeletonVariants, cn as sliderThumbVariants, ln as sliderTrackVariants, e as springs, t as stagger, Kn as surfaceVariants, ii as textVariants, fn as textareaVariants, mn as toggleVariants, n as tweens, de as useButtonGroup, D as useFormField, ne as useIconContext, _i as useMessageContext, Xr as useSidebar, ci as useTree, r as withReducedMotion };
|
package/dist/ui/label.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/ui/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,QAAA,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../src/ui/label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc,MAAM,yBAAyB,CAAA;AACzD,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAK9B,MAAM,WAAW,UACf,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,cAAc,CAAC,IAAI,CAAC;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB;AAED,QAAA,MAAM,KAAK,qFA4BT,CAAA;AAGF,OAAO,EAAE,KAAK,EAAE,CAAA"}
|
package/dist/ui/label.js
CHANGED
|
@@ -5,14 +5,15 @@ import { useFormField as n } from "./form.js";
|
|
|
5
5
|
import * as r from "react";
|
|
6
6
|
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
7
|
//#region src/ui/label.tsx
|
|
8
|
-
var o = r.forwardRef(({ className: r, required: o, children: s, htmlFor: c,
|
|
9
|
-
let
|
|
8
|
+
var o = r.forwardRef(({ className: r, required: o, children: s, htmlFor: c, id: l, ...u }, d) => {
|
|
9
|
+
let f = n(), p = c ?? f.inputId, m = l ?? f.labelId, h = o ?? f.required;
|
|
10
10
|
return /* @__PURE__ */ a(e, {
|
|
11
|
-
ref:
|
|
12
|
-
|
|
11
|
+
ref: d,
|
|
12
|
+
id: m,
|
|
13
|
+
htmlFor: p,
|
|
13
14
|
className: t("font-sans text-body-md font-medium text-surface-fg leading-none transition-opacity duration-fast-01 ease-productive-standard peer-disabled:opacity-action-disabled", r),
|
|
14
|
-
...
|
|
15
|
-
children: [s,
|
|
15
|
+
...u,
|
|
16
|
+
children: [s, h && /* @__PURE__ */ i("span", {
|
|
16
17
|
className: "text-error-11 ml-ds-01",
|
|
17
18
|
"aria-hidden": "true",
|
|
18
19
|
children: "*"
|
package/dist/ui/label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"label.js","names":[],"sources":["../../src/ui/label.tsx"],"sourcesContent":["'use client'\n\nimport * as LabelPrimitive from '@primitives/react-label'\nimport * as React from 'react'\n\nimport { useFormField } from './form'\nimport { cn } from './lib/utils'\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> {\n required?: boolean\n}\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n LabelProps\n>(({ className, required, children, htmlFor, ...props }, ref) => {\n const fieldCtx = useFormField()\n // Explicit htmlFor wins; otherwise fall back to FormField's inputId.\n const resolvedHtmlFor = htmlFor ?? fieldCtx.inputId\n const resolvedRequired = required ?? fieldCtx.required\n return (\n <LabelPrimitive.Root\n ref={ref}\n htmlFor={resolvedHtmlFor}\n className={cn(\n 'font-sans text-body-md font-medium text-surface-fg leading-none transition-opacity duration-fast-01 ease-productive-standard peer-disabled:opacity-action-disabled',\n className,\n )}\n {...props}\n >\n {children}\n {resolvedRequired && (\n <span className=\"text-error-11 ml-ds-01\" aria-hidden=\"true\">*</span>\n )}\n </LabelPrimitive.Root>\n )\n})\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n"],"mappings":";;;;;;;AAaA,IAAM,IAAQ,EAAM,YAGjB,EAAE,cAAW,aAAU,aAAU,YAAS,GAAG,KAAS,MAAQ;
|
|
1
|
+
{"version":3,"file":"label.js","names":[],"sources":["../../src/ui/label.tsx"],"sourcesContent":["'use client'\n\nimport * as LabelPrimitive from '@primitives/react-label'\nimport * as React from 'react'\n\nimport { useFormField } from './form'\nimport { cn } from './lib/utils'\n\nexport interface LabelProps\n extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root> {\n required?: boolean\n}\n\nconst Label = React.forwardRef<\n React.ElementRef<typeof LabelPrimitive.Root>,\n LabelProps\n>(({ className, required, children, htmlFor, id, ...props }, ref) => {\n const fieldCtx = useFormField()\n // Explicit htmlFor wins; otherwise fall back to FormField's inputId.\n const resolvedHtmlFor = htmlFor ?? fieldCtx.inputId\n // Adopt the field's labelId so non-labellable controls (Combobox div) can point\n // aria-labelledby at this label. Explicit id wins.\n const resolvedId = id ?? fieldCtx.labelId\n const resolvedRequired = required ?? fieldCtx.required\n return (\n <LabelPrimitive.Root\n ref={ref}\n id={resolvedId}\n htmlFor={resolvedHtmlFor}\n className={cn(\n 'font-sans text-body-md font-medium text-surface-fg leading-none transition-opacity duration-fast-01 ease-productive-standard peer-disabled:opacity-action-disabled',\n className,\n )}\n {...props}\n >\n {children}\n {resolvedRequired && (\n <span className=\"text-error-11 ml-ds-01\" aria-hidden=\"true\">*</span>\n )}\n </LabelPrimitive.Root>\n )\n})\nLabel.displayName = LabelPrimitive.Root.displayName\n\nexport { Label }\n"],"mappings":";;;;;;;AAaA,IAAM,IAAQ,EAAM,YAGjB,EAAE,cAAW,aAAU,aAAU,YAAS,OAAI,GAAG,KAAS,MAAQ;CACnE,IAAM,IAAW,EAAa,GAExB,IAAkB,KAAW,EAAS,SAGtC,IAAa,KAAM,EAAS,SAC5B,IAAmB,KAAY,EAAS;CAC9C,OACE,kBAAC,GAAD;EACO;EACL,IAAI;EACJ,SAAS;EACT,WAAW,EACT,sKACA,CACF;EACA,GAAI;YARN,CAUG,GACA,KACC,kBAAC,QAAD;GAAM,WAAU;GAAyB,eAAY;aAAO;EAAO,CAAA,CAElD;;AAEzB,CAAC;AACD,EAAM,cAAA,EAAkC"}
|
package/dist/ui/search-input.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { springs as e } from "./lib/motion.js";
|
|
3
3
|
import { Spinner as t } from "./spinner.js";
|
|
4
4
|
import { Icon as n } from "./icon.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { Input as r } from "./input.js";
|
|
6
|
+
import { Button as i } from "./button.js";
|
|
7
7
|
import * as a from "react";
|
|
8
8
|
import { jsx as o } from "react/jsx-runtime";
|
|
9
9
|
import { IconSearch as s, IconX as c } from "@tabler/icons-react";
|
|
@@ -25,7 +25,7 @@ var d = a.forwardRef(({ className: a, value: d, onClear: f, loading: p, size: m
|
|
|
25
25
|
scale: .8
|
|
26
26
|
},
|
|
27
27
|
transition: e.snappy,
|
|
28
|
-
children: /* @__PURE__ */ o(
|
|
28
|
+
children: /* @__PURE__ */ o(i, {
|
|
29
29
|
type: "button",
|
|
30
30
|
variant: "ghost",
|
|
31
31
|
size: "icon-xs",
|
|
@@ -35,7 +35,7 @@ var d = a.forwardRef(({ className: a, value: d, onClear: f, loading: p, size: m
|
|
|
35
35
|
children: /* @__PURE__ */ o(n, { icon: c })
|
|
36
36
|
})
|
|
37
37
|
}) });
|
|
38
|
-
return /* @__PURE__ */ o(
|
|
38
|
+
return /* @__PURE__ */ o(r, {
|
|
39
39
|
ref: _,
|
|
40
40
|
size: m,
|
|
41
41
|
startSection: /* @__PURE__ */ o(n, { icon: s }),
|
package/dist/ui/sidebar.js
CHANGED
|
@@ -5,9 +5,9 @@ import { cva as n } from "../_chunks/vendor-utils.js";
|
|
|
5
5
|
import { cn as r } from "./lib/utils.js";
|
|
6
6
|
import { Icon as i } from "./icon.js";
|
|
7
7
|
import { useIsMobile as a } from "../hooks/use-mobile.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
8
|
+
import { Input as o } from "./input.js";
|
|
9
|
+
import { Skeleton as s } from "./skeleton.js";
|
|
10
|
+
import { Button as c } from "./button.js";
|
|
11
11
|
import { Separator as l } from "./separator.js";
|
|
12
12
|
import { Tooltip as u, TooltipContent as d, TooltipProvider as f, TooltipTrigger as p } from "./tooltip.js";
|
|
13
13
|
import { Sheet as m, SheetContent as h } from "./sheet.js";
|
|
@@ -139,7 +139,7 @@ var M = _(({ side: e = "left", variant: t = "sidebar", collapsible: n = "offcanv
|
|
|
139
139
|
M.displayName = "Sidebar";
|
|
140
140
|
var N = _(({ className: e, onClick: t, ...n }, a) => {
|
|
141
141
|
let { toggleSidebar: o } = A();
|
|
142
|
-
return /* @__PURE__ */ E(
|
|
142
|
+
return /* @__PURE__ */ E(c, {
|
|
143
143
|
ref: a,
|
|
144
144
|
"data-sidebar": "trigger",
|
|
145
145
|
variant: "ghost",
|
|
@@ -179,7 +179,7 @@ var F = _(({ className: e, ...t }, n) => /* @__PURE__ */ T("main", {
|
|
|
179
179
|
...t
|
|
180
180
|
}));
|
|
181
181
|
F.displayName = "SidebarInset";
|
|
182
|
-
var I = _(({ className: e, wrapperClassName: t, ...n }, i) => /* @__PURE__ */ T(
|
|
182
|
+
var I = _(({ className: e, wrapperClassName: t, ...n }, i) => /* @__PURE__ */ T(o, {
|
|
183
183
|
ref: i,
|
|
184
184
|
"data-sidebar": "input",
|
|
185
185
|
size: "sm",
|
|
@@ -326,10 +326,10 @@ var X = _(({ className: e, showIcon: t = !1, ...n }, i) => {
|
|
|
326
326
|
"data-sidebar": "menu-skeleton",
|
|
327
327
|
className: r("flex h-ds-sm items-center gap-ds-03 rounded-control px-ds-03", e),
|
|
328
328
|
...n,
|
|
329
|
-
children: [t && /* @__PURE__ */ T(
|
|
329
|
+
children: [t && /* @__PURE__ */ T(s, {
|
|
330
330
|
className: "h-ico-sm w-ico-sm rounded-control",
|
|
331
331
|
"data-sidebar": "menu-skeleton-icon"
|
|
332
|
-
}), /* @__PURE__ */ T(
|
|
332
|
+
}), /* @__PURE__ */ T(s, {
|
|
333
333
|
className: "h-4 max-w-(--skeleton-width) flex-1",
|
|
334
334
|
"data-sidebar": "menu-skeleton-text",
|
|
335
335
|
style: { "--skeleton-width": a }
|
package/dist/ui/spinner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/ui/spinner.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAgB9B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACzB,yCAAyC;IACzC,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAA;IACxC,iEAAiE;IACjE,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;IAC3B,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAyBD,QAAA,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"spinner.d.ts","sourceRoot":"","sources":["../../src/ui/spinner.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAgB9B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,WAAW,YAAY;IAC3B,6DAA6D;IAC7D,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACzB,yCAAyC;IACzC,KAAK,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,OAAO,CAAA;IACxC,iEAAiE;IACjE,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAA;IAC3B,8DAA8D;IAC9D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;IACvB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAyBD,QAAA,MAAM,OAAO,sFA+OZ,CAAA;AAGD,OAAO,EAAE,OAAO,EAAE,CAAA"}
|
package/dist/ui/spinner.js
CHANGED
|
@@ -26,15 +26,21 @@ var s = {
|
|
|
26
26
|
error: "var(--color-error-9)"
|
|
27
27
|
}, m = "M7 12.5l3 3 7-7", h = "M8 8l8 8M16 8l-8 8", g = "M5 12.5l4 4 10-10", _ = "M6 6l12 12M18 6l-12 12", v = t.forwardRef(({ size: v = "md", state: y = "spinning", variant: b = "filled", delay: x = 0, onComplete: S, className: C }, w) => {
|
|
28
28
|
let T = o(), [E, D] = t.useState(x === 0);
|
|
29
|
-
|
|
29
|
+
t.useEffect(() => {
|
|
30
30
|
if (x <= 0) {
|
|
31
31
|
D(!0);
|
|
32
32
|
return;
|
|
33
33
|
}
|
|
34
34
|
let e = setTimeout(() => D(!0), x);
|
|
35
35
|
return () => clearTimeout(e);
|
|
36
|
-
}, [x])
|
|
37
|
-
let O =
|
|
36
|
+
}, [x]);
|
|
37
|
+
let O = t.useRef(S);
|
|
38
|
+
if (t.useEffect(() => {
|
|
39
|
+
O.current = S;
|
|
40
|
+
}), t.useEffect(() => {
|
|
41
|
+
T && (y === "success" || y === "error") && O.current?.();
|
|
42
|
+
}, [T, y]), !E) return null;
|
|
43
|
+
let k = c[v], A = l[v], j = y === "spinning", M = y === "success" || y === "error", N = b === "filled", P = b === "bare" && y === "spinning" ? "currentColor" : p[y], F = N ? "white" : "currentColor", I = N ? m : g, L = N ? h : _, R = .4, z = N ? .5 : .35, B = .35;
|
|
38
44
|
return /* @__PURE__ */ r("span", {
|
|
39
45
|
ref: w,
|
|
40
46
|
role: "status",
|
|
@@ -45,50 +51,50 @@ var s = {
|
|
|
45
51
|
fill: "none",
|
|
46
52
|
xmlns: "http://www.w3.org/2000/svg",
|
|
47
53
|
children: [
|
|
48
|
-
T ? !(
|
|
54
|
+
T ? !(M && !N) && /* @__PURE__ */ n("circle", {
|
|
49
55
|
cx: "12",
|
|
50
56
|
cy: "12",
|
|
51
57
|
r: u,
|
|
52
58
|
stroke: "var(--color-surface-border)",
|
|
53
|
-
strokeWidth:
|
|
59
|
+
strokeWidth: k,
|
|
54
60
|
fill: "none"
|
|
55
61
|
}) : /* @__PURE__ */ n(a.circle, {
|
|
56
62
|
cx: "12",
|
|
57
63
|
cy: "12",
|
|
58
64
|
r: u,
|
|
59
65
|
stroke: "var(--color-surface-border)",
|
|
60
|
-
strokeWidth:
|
|
66
|
+
strokeWidth: k,
|
|
61
67
|
fill: "none",
|
|
62
|
-
animate: { opacity:
|
|
68
|
+
animate: { opacity: M && !N ? 0 : 1 },
|
|
63
69
|
transition: {
|
|
64
70
|
duration: .2,
|
|
65
|
-
delay:
|
|
71
|
+
delay: M && !N ? R : 0
|
|
66
72
|
}
|
|
67
73
|
}),
|
|
68
74
|
T ? /* @__PURE__ */ n("circle", {
|
|
69
75
|
cx: "12",
|
|
70
76
|
cy: "12",
|
|
71
77
|
r: u,
|
|
72
|
-
stroke:
|
|
73
|
-
strokeWidth:
|
|
78
|
+
stroke: P,
|
|
79
|
+
strokeWidth: k,
|
|
74
80
|
fill: "none",
|
|
75
81
|
strokeLinecap: "round",
|
|
76
|
-
strokeDasharray:
|
|
82
|
+
strokeDasharray: j ? `${d * .75} ${d * .25}` : `${d} 0`,
|
|
77
83
|
style: {
|
|
78
84
|
transformOrigin: "center",
|
|
79
|
-
transform:
|
|
80
|
-
opacity:
|
|
85
|
+
transform: j ? "rotate(-90deg)" : void 0,
|
|
86
|
+
opacity: M && !N ? 0 : 1
|
|
81
87
|
}
|
|
82
88
|
}) : /* @__PURE__ */ n(a.circle, {
|
|
83
89
|
cx: "12",
|
|
84
90
|
cy: "12",
|
|
85
91
|
r: u,
|
|
86
|
-
stroke:
|
|
87
|
-
strokeWidth:
|
|
92
|
+
stroke: P,
|
|
93
|
+
strokeWidth: k,
|
|
88
94
|
fill: "none",
|
|
89
95
|
strokeLinecap: "round",
|
|
90
96
|
style: { transformOrigin: "center" },
|
|
91
|
-
animate:
|
|
97
|
+
animate: j ? {
|
|
92
98
|
rotate: [0, 360],
|
|
93
99
|
strokeDasharray: [
|
|
94
100
|
`${d * .1} ${d * .9}`,
|
|
@@ -98,9 +104,9 @@ var s = {
|
|
|
98
104
|
} : {
|
|
99
105
|
rotate: 0,
|
|
100
106
|
strokeDasharray: `${d} 0`,
|
|
101
|
-
...!
|
|
107
|
+
...!N && { opacity: 0 }
|
|
102
108
|
},
|
|
103
|
-
transition:
|
|
109
|
+
transition: j ? {
|
|
104
110
|
rotate: {
|
|
105
111
|
duration: 1,
|
|
106
112
|
repeat: Infinity,
|
|
@@ -117,26 +123,26 @@ var s = {
|
|
|
117
123
|
ease: "easeOut"
|
|
118
124
|
},
|
|
119
125
|
strokeDasharray: {
|
|
120
|
-
duration:
|
|
126
|
+
duration: R,
|
|
121
127
|
ease: "easeInOut"
|
|
122
128
|
},
|
|
123
|
-
...!
|
|
129
|
+
...!N && { opacity: {
|
|
124
130
|
duration: .2,
|
|
125
|
-
delay:
|
|
131
|
+
delay: R
|
|
126
132
|
} }
|
|
127
133
|
}
|
|
128
134
|
}),
|
|
129
|
-
/* @__PURE__ */ n(i, { children:
|
|
135
|
+
/* @__PURE__ */ n(i, { children: M && N && (T ? /* @__PURE__ */ n("circle", {
|
|
130
136
|
cx: "12",
|
|
131
137
|
cy: "12",
|
|
132
|
-
r: u +
|
|
133
|
-
fill:
|
|
138
|
+
r: u + k / 2,
|
|
139
|
+
fill: P,
|
|
134
140
|
stroke: "none"
|
|
135
141
|
}, "fill-static") : /* @__PURE__ */ n(a.circle, {
|
|
136
142
|
cx: "12",
|
|
137
143
|
cy: "12",
|
|
138
|
-
r: u +
|
|
139
|
-
fill:
|
|
144
|
+
r: u + k / 2,
|
|
145
|
+
fill: P,
|
|
140
146
|
stroke: "none",
|
|
141
147
|
initial: { opacity: 0 },
|
|
142
148
|
animate: { opacity: 1 },
|
|
@@ -148,16 +154,16 @@ var s = {
|
|
|
148
154
|
style: { transformOrigin: "center" }
|
|
149
155
|
}, "fill")) }),
|
|
150
156
|
/* @__PURE__ */ n(i, { children: y === "success" && (T ? /* @__PURE__ */ n("path", {
|
|
151
|
-
d:
|
|
152
|
-
stroke:
|
|
153
|
-
strokeWidth:
|
|
157
|
+
d: I,
|
|
158
|
+
stroke: F,
|
|
159
|
+
strokeWidth: A,
|
|
154
160
|
strokeLinecap: "round",
|
|
155
161
|
strokeLinejoin: "round",
|
|
156
162
|
fill: "none"
|
|
157
163
|
}, "check-static") : /* @__PURE__ */ n(a.path, {
|
|
158
|
-
d:
|
|
159
|
-
stroke:
|
|
160
|
-
strokeWidth:
|
|
164
|
+
d: I,
|
|
165
|
+
stroke: F,
|
|
166
|
+
strokeWidth: A,
|
|
161
167
|
strokeLinecap: "round",
|
|
162
168
|
strokeLinejoin: "round",
|
|
163
169
|
fill: "none",
|
|
@@ -171,27 +177,27 @@ var s = {
|
|
|
171
177
|
},
|
|
172
178
|
transition: {
|
|
173
179
|
pathLength: {
|
|
174
|
-
duration:
|
|
180
|
+
duration: B,
|
|
175
181
|
ease: "easeOut",
|
|
176
|
-
delay:
|
|
182
|
+
delay: z
|
|
177
183
|
},
|
|
178
184
|
opacity: {
|
|
179
185
|
duration: .1,
|
|
180
|
-
delay:
|
|
186
|
+
delay: z
|
|
181
187
|
}
|
|
182
188
|
},
|
|
183
189
|
onAnimationComplete: () => S?.()
|
|
184
190
|
}, "check")) }),
|
|
185
191
|
/* @__PURE__ */ n(i, { children: y === "error" && (T ? /* @__PURE__ */ n("path", {
|
|
186
|
-
d:
|
|
187
|
-
stroke:
|
|
188
|
-
strokeWidth:
|
|
192
|
+
d: L,
|
|
193
|
+
stroke: F,
|
|
194
|
+
strokeWidth: A,
|
|
189
195
|
strokeLinecap: "round",
|
|
190
196
|
fill: "none"
|
|
191
197
|
}, "x-static") : /* @__PURE__ */ n(a.path, {
|
|
192
|
-
d:
|
|
193
|
-
stroke:
|
|
194
|
-
strokeWidth:
|
|
198
|
+
d: L,
|
|
199
|
+
stroke: F,
|
|
200
|
+
strokeWidth: A,
|
|
195
201
|
strokeLinecap: "round",
|
|
196
202
|
fill: "none",
|
|
197
203
|
initial: {
|
|
@@ -204,13 +210,13 @@ var s = {
|
|
|
204
210
|
},
|
|
205
211
|
transition: {
|
|
206
212
|
pathLength: {
|
|
207
|
-
duration:
|
|
213
|
+
duration: B,
|
|
208
214
|
ease: "easeOut",
|
|
209
|
-
delay:
|
|
215
|
+
delay: z
|
|
210
216
|
},
|
|
211
217
|
opacity: {
|
|
212
218
|
duration: .1,
|
|
213
|
-
delay:
|
|
219
|
+
delay: z
|
|
214
220
|
}
|
|
215
221
|
},
|
|
216
222
|
onAnimationComplete: () => S?.()
|
package/dist/ui/spinner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spinner.js","names":[],"sources":["../../src/ui/spinner.tsx"],"sourcesContent":["'use client'\n\nimport {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from 'framer-motion'\nimport * as React from 'react'\n\nimport { cn } from './lib/utils'\n\nconst sizeClasses = {\n sm: 'h-ico-sm w-ico-sm',\n md: 'h-ico-md w-ico-md',\n lg: 'h-ico-lg w-ico-lg',\n} as const\n\n/** Arc stroke width per size */\nconst arcStrokeWidths = { sm: 3, md: 3, lg: 4 } as const\n\n/** Thinner icon stroke for checkmark / X — feels lighter and more refined */\nconst iconStrokeWidths = { sm: 1.8, md: 2, lg: 2.5 } as const\n\n/**\n * Props for Spinner — an animated arc spinner with optional success (checkmark) and error (X)\n * state transitions, powered by Framer Motion.\n *\n * **Sizes:** `sm` (16px) | `md` (20px, default) | `lg` (24px)\n *\n * **States:**\n * - `spinning` (default): Rotating arc with Material Design-style pulse\n * - `success`: Arc completes to filled green circle, white checkmark draws in\n * - `error`: Arc completes to filled red circle, white X draws in\n *\n * **Variants:**\n * - `filled` (default): Semantic colored fill + white icon — for standalone contexts\n * - `bare`: No fill, icon uses `currentColor` — for embedding in buttons, toolbars, etc.\n *\n * **Accessibility:** `role=\"status\"` with sr-only text that updates per state.\n * Respects `prefers-reduced-motion` — shows static icons with opacity crossfades.\n *\n * @example\n * <Spinner /> // basic arc spinner\n * <Spinner size=\"sm\" /> // small\n * <Spinner state=\"success\" /> // filled green circle + white check\n * <Spinner state=\"success\" variant=\"bare\" /> // just the check, currentColor\n * <Spinner state=\"error\" /> // filled red circle + white X\n * <Spinner delay={150} /> // no render until 150ms\n * <Spinner state=\"success\" onComplete={handleDone} /> // callback after animation\n */\nexport interface SpinnerProps {\n /** sm | md | lg — maps to icon size tokens. Default: 'md' */\n size?: 'sm' | 'md' | 'lg'\n /** Current state. Default: 'spinning' */\n state?: 'spinning' | 'success' | 'error'\n /** Visual variant for success/error states. Default: 'filled' */\n variant?: 'filled' | 'bare'\n /** Delay in ms before showing (avoids flicker). Default: 0 */\n delay?: number\n /** Fires when success/error transition animation completes */\n onComplete?: () => void\n className?: string\n}\n\nconst RADIUS = 10\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nconst srText: Record<string, string> = {\n spinning: 'Loading...',\n success: 'Complete',\n error: 'Error',\n}\n\nconst stateColors: Record<string, string> = {\n spinning: 'var(--color-accent-9)',\n success: 'var(--color-success-9)',\n error: 'var(--color-error-9)',\n}\n\n// Filled variant — icons fit inside the filled circle\nconst CHECKMARK_D = 'M7 12.5l3 3 7-7'\nconst X_MARK_D = 'M8 8l8 8M16 8l-8 8'\n\n// Bare variant — larger icons since there's no circle constraining them\nconst CHECKMARK_BARE_D = 'M5 12.5l4 4 10-10'\nconst X_MARK_BARE_D = 'M6 6l12 12M18 6l-12 12'\n\nconst Spinner = React.forwardRef<HTMLSpanElement, SpinnerProps>(\n ({ size = 'md', state = 'spinning', variant = 'filled', delay = 0, onComplete, className }, ref) => {\n const prefersReduced = useReducedMotion()\n const [visible, setVisible] = React.useState(delay === 0)\n\n React.useEffect(() => {\n if (delay <= 0) {\n setVisible(true)\n return\n }\n const timer = setTimeout(() => setVisible(true), delay)\n return () => clearTimeout(timer)\n }, [delay])\n\n if (!visible) return null\n\n const arcSw = arcStrokeWidths[size]\n const iconSw = iconStrokeWidths[size]\n const isSpinning = state === 'spinning'\n const isFinal = state === 'success' || state === 'error'\n const isFilled = variant === 'filled'\n const color = variant === 'bare' && state === 'spinning' ? 'currentColor' : stateColors[state]\n\n // Icon stroke: white on filled backgrounds, currentColor on bare\n const iconColor = isFilled ? 'white' : 'currentColor'\n const checkPath = isFilled ? CHECKMARK_D : CHECKMARK_BARE_D\n const xPath = isFilled ? X_MARK_D : X_MARK_BARE_D\n\n // ── Sequence timing (seconds) ──────────────────────────────────\n // Filled: arc completes → fill fades in → white icon draws\n // Bare: arc completes + fades out → currentColor icon draws\n const ARC_COMPLETE = 0.4\n const FILL_DELAY = 0.3\n const FILL_DURATION = 0.25\n const ICON_DELAY = isFilled ? 0.5 : 0.35\n const ICON_DURATION = 0.35\n\n return (\n <span ref={ref} role=\"status\" className={cn('inline-flex', className)}>\n <svg\n className={sizeClasses[size]}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {/* Background track circle — hidden in bare final state */}\n {prefersReduced ? (\n !(isFinal && !isFilled) && (\n <circle\n cx=\"12\"\n cy=\"12\"\n r={RADIUS}\n stroke=\"var(--color-surface-border)\"\n strokeWidth={arcSw}\n fill=\"none\"\n />\n )\n ) : (\n <motion.circle\n cx=\"12\"\n cy=\"12\"\n r={RADIUS}\n stroke=\"var(--color-surface-border)\"\n strokeWidth={arcSw}\n fill=\"none\"\n animate={{ opacity: isFinal && !isFilled ? 0 : 1 }}\n transition={{ duration: 0.2, delay: isFinal && !isFilled ? ARC_COMPLETE : 0 }}\n />\n )}\n\n {/* Animated arc — spins when loading, completes to full circle on state change */}\n {prefersReduced ? (\n <circle\n cx=\"12\"\n cy=\"12\"\n r={RADIUS}\n stroke={color}\n strokeWidth={arcSw}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeDasharray={\n isSpinning\n ? `${CIRCUMFERENCE * 0.75} ${CIRCUMFERENCE * 0.25}`\n : `${CIRCUMFERENCE} 0`\n }\n style={{\n transformOrigin: 'center',\n transform: isSpinning ? 'rotate(-90deg)' : undefined,\n opacity: isFinal && !isFilled ? 0 : 1,\n }}\n />\n ) : (\n <motion.circle\n cx=\"12\"\n cy=\"12\"\n r={RADIUS}\n stroke={color}\n strokeWidth={arcSw}\n fill=\"none\"\n strokeLinecap=\"round\"\n style={{ transformOrigin: 'center' }}\n animate={\n isSpinning\n ? {\n rotate: [0, 360],\n strokeDasharray: [\n `${CIRCUMFERENCE * 0.1} ${CIRCUMFERENCE * 0.9}`,\n `${CIRCUMFERENCE * 0.75} ${CIRCUMFERENCE * 0.25}`,\n `${CIRCUMFERENCE * 0.1} ${CIRCUMFERENCE * 0.9}`,\n ],\n }\n : {\n rotate: 0,\n strokeDasharray: `${CIRCUMFERENCE} 0`,\n // In bare mode, fade out the arc after it completes\n ...(!isFilled && { opacity: 0 }),\n }\n }\n transition={\n isSpinning\n ? {\n rotate: { duration: 1, repeat: Infinity, ease: 'linear' },\n strokeDasharray: { duration: 1.5, repeat: Infinity, ease: 'easeInOut' },\n }\n : {\n rotate: { duration: 0.3, ease: 'easeOut' },\n strokeDasharray: { duration: ARC_COMPLETE, ease: 'easeInOut' },\n ...(!isFilled && { opacity: { duration: 0.2, delay: ARC_COMPLETE } }),\n }\n }\n />\n )}\n\n {/* Filled circle — fades in after arc completes, covers track (filled variant only) */}\n <AnimatePresence>\n {isFinal && isFilled &&\n (prefersReduced ? (\n <circle\n key=\"fill-static\"\n cx=\"12\"\n cy=\"12\"\n r={RADIUS + arcSw / 2}\n fill={color}\n stroke=\"none\"\n />\n ) : (\n <motion.circle\n key=\"fill\"\n cx=\"12\"\n cy=\"12\"\n r={RADIUS + arcSw / 2}\n fill={color}\n stroke=\"none\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ duration: FILL_DURATION, delay: FILL_DELAY, ease: 'easeOut' }}\n style={{ transformOrigin: 'center' }}\n />\n ))}\n </AnimatePresence>\n\n {/* Checkmark — white on filled, currentColor on bare */}\n <AnimatePresence>\n {state === 'success' &&\n (prefersReduced ? (\n <path\n key=\"check-static\"\n d={checkPath}\n stroke={iconColor}\n strokeWidth={iconSw}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n />\n ) : (\n <motion.path\n key=\"check\"\n d={checkPath}\n stroke={iconColor}\n strokeWidth={iconSw}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n initial={{ pathLength: 0, opacity: 0 }}\n animate={{ pathLength: 1, opacity: 1 }}\n transition={{\n pathLength: { duration: ICON_DURATION, ease: 'easeOut', delay: ICON_DELAY },\n opacity: { duration: 0.1, delay: ICON_DELAY },\n }}\n onAnimationComplete={() => onComplete?.()}\n />\n ))}\n </AnimatePresence>\n\n {/* X mark — white on filled, currentColor on bare */}\n <AnimatePresence>\n {state === 'error' &&\n (prefersReduced ? (\n <path\n key=\"x-static\"\n d={xPath}\n stroke={iconColor}\n strokeWidth={iconSw}\n strokeLinecap=\"round\"\n fill=\"none\"\n />\n ) : (\n <motion.path\n key=\"x\"\n d={xPath}\n stroke={iconColor}\n strokeWidth={iconSw}\n strokeLinecap=\"round\"\n fill=\"none\"\n initial={{ pathLength: 0, opacity: 0 }}\n animate={{ pathLength: 1, opacity: 1 }}\n transition={{\n pathLength: { duration: ICON_DURATION, ease: 'easeOut', delay: ICON_DELAY },\n opacity: { duration: 0.1, delay: ICON_DELAY },\n }}\n onAnimationComplete={() => onComplete?.()}\n />\n ))}\n </AnimatePresence>\n </svg>\n <span className=\"sr-only\">{srText[state]}</span>\n </span>\n )\n },\n)\nSpinner.displayName = 'Spinner'\n\nexport { Spinner }\n"],"mappings":";;;;;;AAWA,IAAM,IAAc;CAClB,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAGM,IAAkB;CAAE,IAAI;CAAG,IAAI;CAAG,IAAI;AAAE,GAGxC,IAAmB;CAAE,IAAI;CAAK,IAAI;CAAG,IAAI;AAAI,GA2C7C,IAAS,IACT,IAAgB,IAAI,KAAK,KAAK,GAE9B,IAAiC;CACrC,UAAU;CACV,SAAS;CACT,OAAO;AACT,GAEM,IAAsC;CAC1C,UAAU;CACV,SAAS;CACT,OAAO;AACT,GAGM,IAAc,mBACd,IAAW,sBAGX,IAAmB,qBACnB,IAAgB,0BAEhB,IAAU,EAAM,YACnB,EAA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\nimport {\n AnimatePresence,\n motion,\n useReducedMotion,\n} from 'framer-motion'\nimport * as React from 'react'\n\nimport { cn } from './lib/utils'\n\nconst sizeClasses = {\n sm: 'h-ico-sm w-ico-sm',\n md: 'h-ico-md w-ico-md',\n lg: 'h-ico-lg w-ico-lg',\n} as const\n\n/** Arc stroke width per size */\nconst arcStrokeWidths = { sm: 3, md: 3, lg: 4 } as const\n\n/** Thinner icon stroke for checkmark / X — feels lighter and more refined */\nconst iconStrokeWidths = { sm: 1.8, md: 2, lg: 2.5 } as const\n\n/**\n * Props for Spinner — an animated arc spinner with optional success (checkmark) and error (X)\n * state transitions, powered by Framer Motion.\n *\n * **Sizes:** `sm` (16px) | `md` (20px, default) | `lg` (24px)\n *\n * **States:**\n * - `spinning` (default): Rotating arc with Material Design-style pulse\n * - `success`: Arc completes to filled green circle, white checkmark draws in\n * - `error`: Arc completes to filled red circle, white X draws in\n *\n * **Variants:**\n * - `filled` (default): Semantic colored fill + white icon — for standalone contexts\n * - `bare`: No fill, icon uses `currentColor` — for embedding in buttons, toolbars, etc.\n *\n * **Accessibility:** `role=\"status\"` with sr-only text that updates per state.\n * Respects `prefers-reduced-motion` — shows static icons with opacity crossfades.\n *\n * @example\n * <Spinner /> // basic arc spinner\n * <Spinner size=\"sm\" /> // small\n * <Spinner state=\"success\" /> // filled green circle + white check\n * <Spinner state=\"success\" variant=\"bare\" /> // just the check, currentColor\n * <Spinner state=\"error\" /> // filled red circle + white X\n * <Spinner delay={150} /> // no render until 150ms\n * <Spinner state=\"success\" onComplete={handleDone} /> // callback after animation\n */\nexport interface SpinnerProps {\n /** sm | md | lg — maps to icon size tokens. Default: 'md' */\n size?: 'sm' | 'md' | 'lg'\n /** Current state. Default: 'spinning' */\n state?: 'spinning' | 'success' | 'error'\n /** Visual variant for success/error states. Default: 'filled' */\n variant?: 'filled' | 'bare'\n /** Delay in ms before showing (avoids flicker). Default: 0 */\n delay?: number\n /** Fires when success/error transition animation completes */\n onComplete?: () => void\n className?: string\n}\n\nconst RADIUS = 10\nconst CIRCUMFERENCE = 2 * Math.PI * RADIUS\n\nconst srText: Record<string, string> = {\n spinning: 'Loading...',\n success: 'Complete',\n error: 'Error',\n}\n\nconst stateColors: Record<string, string> = {\n spinning: 'var(--color-accent-9)',\n success: 'var(--color-success-9)',\n error: 'var(--color-error-9)',\n}\n\n// Filled variant — icons fit inside the filled circle\nconst CHECKMARK_D = 'M7 12.5l3 3 7-7'\nconst X_MARK_D = 'M8 8l8 8M16 8l-8 8'\n\n// Bare variant — larger icons since there's no circle constraining them\nconst CHECKMARK_BARE_D = 'M5 12.5l4 4 10-10'\nconst X_MARK_BARE_D = 'M6 6l12 12M18 6l-12 12'\n\nconst Spinner = React.forwardRef<HTMLSpanElement, SpinnerProps>(\n ({ size = 'md', state = 'spinning', variant = 'filled', delay = 0, onComplete, className }, ref) => {\n const prefersReduced = useReducedMotion()\n const [visible, setVisible] = React.useState(delay === 0)\n\n React.useEffect(() => {\n if (delay <= 0) {\n setVisible(true)\n return\n }\n const timer = setTimeout(() => setVisible(true), delay)\n return () => clearTimeout(timer)\n }, [delay])\n\n // Under reduced-motion the success/error paths render statically (no\n // onAnimationComplete), so fire the documented onComplete contract here.\n const onCompleteRef = React.useRef(onComplete)\n React.useEffect(() => { onCompleteRef.current = onComplete })\n React.useEffect(() => {\n if (prefersReduced && (state === 'success' || state === 'error')) {\n onCompleteRef.current?.()\n }\n }, [prefersReduced, state])\n\n if (!visible) return null\n\n const arcSw = arcStrokeWidths[size]\n const iconSw = iconStrokeWidths[size]\n const isSpinning = state === 'spinning'\n const isFinal = state === 'success' || state === 'error'\n const isFilled = variant === 'filled'\n const color = variant === 'bare' && state === 'spinning' ? 'currentColor' : stateColors[state]\n\n // Icon stroke: white on filled backgrounds, currentColor on bare\n const iconColor = isFilled ? 'white' : 'currentColor'\n const checkPath = isFilled ? CHECKMARK_D : CHECKMARK_BARE_D\n const xPath = isFilled ? X_MARK_D : X_MARK_BARE_D\n\n // ── Sequence timing (seconds) ──────────────────────────────────\n // Filled: arc completes → fill fades in → white icon draws\n // Bare: arc completes + fades out → currentColor icon draws\n const ARC_COMPLETE = 0.4\n const FILL_DELAY = 0.3\n const FILL_DURATION = 0.25\n const ICON_DELAY = isFilled ? 0.5 : 0.35\n const ICON_DURATION = 0.35\n\n return (\n <span ref={ref} role=\"status\" className={cn('inline-flex', className)}>\n <svg\n className={sizeClasses[size]}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n {/* Background track circle — hidden in bare final state */}\n {prefersReduced ? (\n !(isFinal && !isFilled) && (\n <circle\n cx=\"12\"\n cy=\"12\"\n r={RADIUS}\n stroke=\"var(--color-surface-border)\"\n strokeWidth={arcSw}\n fill=\"none\"\n />\n )\n ) : (\n <motion.circle\n cx=\"12\"\n cy=\"12\"\n r={RADIUS}\n stroke=\"var(--color-surface-border)\"\n strokeWidth={arcSw}\n fill=\"none\"\n animate={{ opacity: isFinal && !isFilled ? 0 : 1 }}\n transition={{ duration: 0.2, delay: isFinal && !isFilled ? ARC_COMPLETE : 0 }}\n />\n )}\n\n {/* Animated arc — spins when loading, completes to full circle on state change */}\n {prefersReduced ? (\n <circle\n cx=\"12\"\n cy=\"12\"\n r={RADIUS}\n stroke={color}\n strokeWidth={arcSw}\n fill=\"none\"\n strokeLinecap=\"round\"\n strokeDasharray={\n isSpinning\n ? `${CIRCUMFERENCE * 0.75} ${CIRCUMFERENCE * 0.25}`\n : `${CIRCUMFERENCE} 0`\n }\n style={{\n transformOrigin: 'center',\n transform: isSpinning ? 'rotate(-90deg)' : undefined,\n opacity: isFinal && !isFilled ? 0 : 1,\n }}\n />\n ) : (\n <motion.circle\n cx=\"12\"\n cy=\"12\"\n r={RADIUS}\n stroke={color}\n strokeWidth={arcSw}\n fill=\"none\"\n strokeLinecap=\"round\"\n style={{ transformOrigin: 'center' }}\n animate={\n isSpinning\n ? {\n rotate: [0, 360],\n strokeDasharray: [\n `${CIRCUMFERENCE * 0.1} ${CIRCUMFERENCE * 0.9}`,\n `${CIRCUMFERENCE * 0.75} ${CIRCUMFERENCE * 0.25}`,\n `${CIRCUMFERENCE * 0.1} ${CIRCUMFERENCE * 0.9}`,\n ],\n }\n : {\n rotate: 0,\n strokeDasharray: `${CIRCUMFERENCE} 0`,\n // In bare mode, fade out the arc after it completes\n ...(!isFilled && { opacity: 0 }),\n }\n }\n transition={\n isSpinning\n ? {\n rotate: { duration: 1, repeat: Infinity, ease: 'linear' },\n strokeDasharray: { duration: 1.5, repeat: Infinity, ease: 'easeInOut' },\n }\n : {\n rotate: { duration: 0.3, ease: 'easeOut' },\n strokeDasharray: { duration: ARC_COMPLETE, ease: 'easeInOut' },\n ...(!isFilled && { opacity: { duration: 0.2, delay: ARC_COMPLETE } }),\n }\n }\n />\n )}\n\n {/* Filled circle — fades in after arc completes, covers track (filled variant only) */}\n <AnimatePresence>\n {isFinal && isFilled &&\n (prefersReduced ? (\n <circle\n key=\"fill-static\"\n cx=\"12\"\n cy=\"12\"\n r={RADIUS + arcSw / 2}\n fill={color}\n stroke=\"none\"\n />\n ) : (\n <motion.circle\n key=\"fill\"\n cx=\"12\"\n cy=\"12\"\n r={RADIUS + arcSw / 2}\n fill={color}\n stroke=\"none\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ duration: FILL_DURATION, delay: FILL_DELAY, ease: 'easeOut' }}\n style={{ transformOrigin: 'center' }}\n />\n ))}\n </AnimatePresence>\n\n {/* Checkmark — white on filled, currentColor on bare */}\n <AnimatePresence>\n {state === 'success' &&\n (prefersReduced ? (\n <path\n key=\"check-static\"\n d={checkPath}\n stroke={iconColor}\n strokeWidth={iconSw}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n />\n ) : (\n <motion.path\n key=\"check\"\n d={checkPath}\n stroke={iconColor}\n strokeWidth={iconSw}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n fill=\"none\"\n initial={{ pathLength: 0, opacity: 0 }}\n animate={{ pathLength: 1, opacity: 1 }}\n transition={{\n pathLength: { duration: ICON_DURATION, ease: 'easeOut', delay: ICON_DELAY },\n opacity: { duration: 0.1, delay: ICON_DELAY },\n }}\n onAnimationComplete={() => onComplete?.()}\n />\n ))}\n </AnimatePresence>\n\n {/* X mark — white on filled, currentColor on bare */}\n <AnimatePresence>\n {state === 'error' &&\n (prefersReduced ? (\n <path\n key=\"x-static\"\n d={xPath}\n stroke={iconColor}\n strokeWidth={iconSw}\n strokeLinecap=\"round\"\n fill=\"none\"\n />\n ) : (\n <motion.path\n key=\"x\"\n d={xPath}\n stroke={iconColor}\n strokeWidth={iconSw}\n strokeLinecap=\"round\"\n fill=\"none\"\n initial={{ pathLength: 0, opacity: 0 }}\n animate={{ pathLength: 1, opacity: 1 }}\n transition={{\n pathLength: { duration: ICON_DURATION, ease: 'easeOut', delay: ICON_DELAY },\n opacity: { duration: 0.1, delay: ICON_DELAY },\n }}\n onAnimationComplete={() => onComplete?.()}\n />\n ))}\n </AnimatePresence>\n </svg>\n <span className=\"sr-only\">{srText[state]}</span>\n </span>\n )\n },\n)\nSpinner.displayName = 'Spinner'\n\nexport { Spinner }\n"],"mappings":";;;;;;AAWA,IAAM,IAAc;CAClB,IAAI;CACJ,IAAI;CACJ,IAAI;AACN,GAGM,IAAkB;CAAE,IAAI;CAAG,IAAI;CAAG,IAAI;AAAE,GAGxC,IAAmB;CAAE,IAAI;CAAK,IAAI;CAAG,IAAI;AAAI,GA2C7C,IAAS,IACT,IAAgB,IAAI,KAAK,KAAK,GAE9B,IAAiC;CACrC,UAAU;CACV,SAAS;CACT,OAAO;AACT,GAEM,IAAsC;CAC1C,UAAU;CACV,SAAS;CACT,OAAO;AACT,GAGM,IAAc,mBACd,IAAW,sBAGX,IAAmB,qBACnB,IAAgB,0BAEhB,IAAU,EAAM,YACnB,EAAE,UAAO,MAAM,WAAQ,YAAY,aAAU,UAAU,WAAQ,GAAG,eAAY,gBAAa,MAAQ;C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;EAAa,CAAA,CAC3C;;AAEV,CACF;AACA,EAAQ,cAAc"}
|
package/dist/ui/switch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,gBAAgB,MAAM,0BAA0B,CAAA;AAE5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,mBAAmB,CAAA;AAuBtE,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC;IAC/F,yJAAyJ;IACzJ,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACzB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAA;IACxC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC5B;AAED,QAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,gBAAgB,MAAM,0BAA0B,CAAA;AAE5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,mBAAmB,CAAA;AAuBtE,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC;IAC/F,yJAAyJ;IACzJ,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACzB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAA;IACxC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC5B;AAED,QAAA,MAAM,MAAM,uFA8DV,CAAA;AAGF,OAAO,EAAE,MAAM,EAAE,CAAA"}
|
package/dist/ui/switch.js
CHANGED
|
@@ -6,9 +6,9 @@ import { useFormField as i } from "./form.js";
|
|
|
6
6
|
import { resolveFieldState as a } from "../_chunks/field-state.js";
|
|
7
7
|
import * as o from "react";
|
|
8
8
|
import { jsx as s } from "react/jsx-runtime";
|
|
9
|
-
import { motion as c } from "framer-motion";
|
|
9
|
+
import { motion as c, useReducedMotion as l } from "framer-motion";
|
|
10
10
|
//#region src/ui/switch.tsx
|
|
11
|
-
var
|
|
11
|
+
var u = {
|
|
12
12
|
sm: {
|
|
13
13
|
track: "h-6 w-[38px]",
|
|
14
14
|
thumb: "h-5 w-5",
|
|
@@ -24,40 +24,40 @@ var l = {
|
|
|
24
24
|
thumb: "h-6 w-6",
|
|
25
25
|
travel: 24
|
|
26
26
|
}
|
|
27
|
-
},
|
|
27
|
+
}, d = {
|
|
28
28
|
error: "border-error-7 data-[state=checked]:bg-error-9",
|
|
29
29
|
warning: "border-warning-7 data-[state=checked]:bg-warning-9",
|
|
30
30
|
success: "border-success-7 data-[state=checked]:bg-success-9"
|
|
31
|
-
},
|
|
31
|
+
}, f = {
|
|
32
32
|
accent: "data-[state=checked]:bg-accent-9",
|
|
33
33
|
success: "data-[state=checked]:bg-success-9",
|
|
34
34
|
warning: "data-[state=checked]:bg-warning-9"
|
|
35
|
-
},
|
|
36
|
-
let
|
|
37
|
-
|
|
38
|
-
}, [
|
|
35
|
+
}, p = o.forwardRef(({ className: p, state: m, size: h = "md", color: g = "accent", thumbIcon: _, checked: v, defaultChecked: y, onCheckedChange: b, ...x }, S) => {
|
|
36
|
+
let C = i(), w = a(m, C.state), T = x["aria-describedby"] ?? C.helperTextId, E = x["aria-required"] ?? C.required, [D, O] = o.useState(y ?? !1), k = v === void 0 ? D : v, A = l(), j = typeof document < "u" && (document.dir === "rtl" || document.documentElement.dir === "rtl"), { track: M, thumb: N, travel: P } = u[h], F = o.useCallback((e) => {
|
|
37
|
+
v === void 0 && O(e), b?.(e);
|
|
38
|
+
}, [v, b]);
|
|
39
39
|
return /* @__PURE__ */ s(e, {
|
|
40
|
-
className: r("touch-target peer inline-flex shrink-0 cursor-pointer items-center rounded-pill border-2 border-surface-border-strong shadow-raised transition-colors duration-fast-01 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-action-disabled data-[state=checked]:border-transparent data-[state=unchecked]:bg-surface-border-strong data-[state=unchecked]:hover:bg-surface-raised-active",
|
|
41
|
-
checked:
|
|
42
|
-
defaultChecked:
|
|
43
|
-
onCheckedChange:
|
|
44
|
-
"aria-invalid":
|
|
45
|
-
"aria-describedby":
|
|
46
|
-
"aria-required":
|
|
47
|
-
...
|
|
48
|
-
ref:
|
|
40
|
+
className: r("touch-target peer inline-flex shrink-0 cursor-pointer items-center rounded-pill border-2 border-surface-border-strong shadow-raised transition-colors duration-fast-01 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-action-disabled data-[state=checked]:border-transparent data-[state=unchecked]:bg-surface-border-strong data-[state=unchecked]:hover:bg-surface-raised-active", M, f[g], w && d[w], p),
|
|
41
|
+
checked: v,
|
|
42
|
+
defaultChecked: y,
|
|
43
|
+
onCheckedChange: F,
|
|
44
|
+
"aria-invalid": w === "error" || void 0,
|
|
45
|
+
"aria-describedby": T,
|
|
46
|
+
"aria-required": E || void 0,
|
|
47
|
+
...x,
|
|
48
|
+
ref: S,
|
|
49
49
|
children: /* @__PURE__ */ s(t, {
|
|
50
50
|
asChild: !0,
|
|
51
51
|
children: /* @__PURE__ */ s(c.span, {
|
|
52
|
-
className: r("pointer-events-none flex items-center justify-center rounded-pill bg-accent-fg shadow-raised-hover ring-0",
|
|
53
|
-
animate: { x:
|
|
54
|
-
whileTap: { scale: .85 },
|
|
55
|
-
transition: n.snappy,
|
|
56
|
-
children:
|
|
52
|
+
className: r("pointer-events-none flex items-center justify-center rounded-pill bg-accent-fg shadow-raised-hover ring-0", N),
|
|
53
|
+
animate: { x: (k ? P : 0) * (j ? -1 : 1) },
|
|
54
|
+
whileTap: A ? void 0 : { scale: .85 },
|
|
55
|
+
transition: A ? { duration: 0 } : n.snappy,
|
|
56
|
+
children: _
|
|
57
57
|
})
|
|
58
58
|
})
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
-
|
|
61
|
+
p.displayName = e.displayName;
|
|
62
62
|
//#endregion
|
|
63
|
-
export {
|
|
63
|
+
export { p as Switch };
|