@devalok/shilp-sutra 0.49.0 → 0.49.2

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.
Files changed (162) hide show
  1. package/dist/_chunks/badge-group.js +41 -41
  2. package/dist/_chunks/badge-group.js.map +1 -1
  3. package/dist/_chunks/block-shell.js +1 -1
  4. package/dist/_chunks/chart-container.js +1 -1
  5. package/dist/_chunks/chat.js +6 -15
  6. package/dist/_chunks/chat.js.map +1 -1
  7. package/dist/_chunks/colors.js +2 -2
  8. package/dist/_chunks/document-preview.js +4 -4
  9. package/dist/_chunks/emoji-suggestion.js +5 -5
  10. package/dist/_chunks/emoji-suggestion.js.map +1 -1
  11. package/dist/_chunks/emoji.js +1 -1
  12. package/dist/_chunks/field-state.js +1 -1
  13. package/dist/_chunks/grid-lines.js +1 -1
  14. package/dist/_chunks/image-preview.js +7 -7
  15. package/dist/_chunks/keybinding.js +1 -1
  16. package/dist/_chunks/link-context.js +1 -1
  17. package/dist/_chunks/mention-suggestion.js +2 -2
  18. package/dist/_chunks/mention.js +1 -1
  19. package/dist/_chunks/motion-provider.js +1 -1
  20. package/dist/_chunks/normalize-icon.js +1 -1
  21. package/dist/_chunks/oauth-button.js +2 -2
  22. package/dist/_chunks/popover.js +17 -17
  23. package/dist/_chunks/primitives.js +1 -1
  24. package/dist/_chunks/shared.js +5 -5
  25. package/dist/_chunks/success.js +5 -8
  26. package/dist/_chunks/success.js.map +1 -1
  27. package/dist/_chunks/tiptap.js +11 -11
  28. package/dist/_chunks/tooltip.js +1 -1
  29. package/dist/_chunks/tree-view.js +2 -2
  30. package/dist/_chunks/use-calendar.js +1 -1
  31. package/dist/_chunks/use-controllable-open.js +1 -1
  32. package/dist/_chunks/vendor-client.js +1 -1
  33. package/dist/_chunks/vendor-utils.js +1 -1
  34. package/dist/ai/block-renderer.js +8 -11
  35. package/dist/ai/block-renderer.js.map +1 -1
  36. package/dist/ai/blocks/error.js +1 -1
  37. package/dist/ai/blocks/index.js +2 -2
  38. package/dist/ai/blocks/text.js +1 -1
  39. package/dist/ai/command-bar.d.ts.map +1 -1
  40. package/dist/ai/command-bar.js +8 -39
  41. package/dist/ai/command-bar.js.map +1 -1
  42. package/dist/ai/conversation.js +4 -10
  43. package/dist/ai/conversation.js.map +1 -1
  44. package/dist/ai/devadoot-icon.d.ts.map +1 -1
  45. package/dist/ai/index.js +10 -41
  46. package/dist/ai/index.js.map +1 -1
  47. package/dist/composed/activity-feed.js +3 -3
  48. package/dist/composed/activity-feed.js.map +1 -1
  49. package/dist/composed/avatar-group.js +3 -3
  50. package/dist/composed/avatar-group.js.map +1 -1
  51. package/dist/composed/bulk-action-bar.js +1 -1
  52. package/dist/composed/command-palette.js +6 -6
  53. package/dist/composed/content-card.js +1 -1
  54. package/dist/composed/date-picker/index.js +10 -10
  55. package/dist/composed/emoji-picker.js +4 -4
  56. package/dist/composed/empty-state.d.ts.map +1 -1
  57. package/dist/composed/empty-state.js +23 -33
  58. package/dist/composed/empty-state.js.map +1 -1
  59. package/dist/composed/extensions/emoji-node.js +1 -1
  60. package/dist/composed/extensions/emoji-suggestion.js +1 -1
  61. package/dist/composed/file-preview.js +14 -14
  62. package/dist/composed/filter-bar.js +1 -1
  63. package/dist/composed/multi-select-popover.js +3 -3
  64. package/dist/composed/priority-indicator.js +1 -1
  65. package/dist/composed/responsive-modal.js +21 -21
  66. package/dist/composed/rich-chat-input.js +445 -445
  67. package/dist/composed/rich-chat-input.js.map +1 -1
  68. package/dist/composed/rich-text-editor.js +28 -28
  69. package/dist/composed/schedule-view.js +1 -1
  70. package/dist/composed/schedule-view.js.map +1 -1
  71. package/dist/composed/status-badge.js +1 -1
  72. package/dist/motion/index.js +2 -2
  73. package/dist/shell/bottom-navbar.js +3 -3
  74. package/dist/shell/bottom-navbar.js.map +1 -1
  75. package/dist/shell/index.js +2 -2
  76. package/dist/shell/link-context.js +2 -2
  77. package/dist/shell/notification-center.js +3 -3
  78. package/dist/shell/sidebar.js +2 -2
  79. package/dist/shell/top-bar.js +1 -1
  80. package/dist/ui/accordion.js +14 -14
  81. package/dist/ui/alert-dialog.js +31 -31
  82. package/dist/ui/alert.js +1 -1
  83. package/dist/ui/aspect-ratio.js +1 -1
  84. package/dist/ui/autocomplete.js +7 -7
  85. package/dist/ui/avatar.d.ts.map +1 -1
  86. package/dist/ui/avatar.js +52 -67
  87. package/dist/ui/avatar.js.map +1 -1
  88. package/dist/ui/badge-group.js +1 -1
  89. package/dist/ui/badge.d.ts +2 -0
  90. package/dist/ui/badge.d.ts.map +1 -1
  91. package/dist/ui/badge.js +1 -1
  92. package/dist/ui/banner.js +1 -1
  93. package/dist/ui/breadcrumb.js +1 -1
  94. package/dist/ui/button.js +9 -9
  95. package/dist/ui/button.js.map +1 -1
  96. package/dist/ui/card.js +1 -1
  97. package/dist/ui/charts/area-chart.js +6 -6
  98. package/dist/ui/charts/bar-chart.js +6 -6
  99. package/dist/ui/charts/chart-container.js +1 -1
  100. package/dist/ui/charts/gauge-chart.js +2 -2
  101. package/dist/ui/charts/index.js +2 -2
  102. package/dist/ui/charts/line-chart.js +6 -6
  103. package/dist/ui/charts/pie-chart.js +5 -5
  104. package/dist/ui/charts/radar-chart.js +5 -5
  105. package/dist/ui/charts/sparkline.js +2 -2
  106. package/dist/ui/chat/index.js +2 -2
  107. package/dist/ui/checkbox.js +5 -5
  108. package/dist/ui/collapsible.js +4 -4
  109. package/dist/ui/color-input.js +4 -4
  110. package/dist/ui/combobox.js +8 -8
  111. package/dist/ui/combobox.js.map +1 -1
  112. package/dist/ui/context-menu.js +41 -41
  113. package/dist/ui/dialog.js +25 -25
  114. package/dist/ui/dot.d.ts.map +1 -1
  115. package/dist/ui/dot.js +24 -32
  116. package/dist/ui/dot.js.map +1 -1
  117. package/dist/ui/dropdown-menu.js +51 -51
  118. package/dist/ui/hover-card.js +9 -9
  119. package/dist/ui/icon-button.js +1 -1
  120. package/dist/ui/index.js +6 -6
  121. package/dist/ui/input.js +2 -2
  122. package/dist/ui/label.js +1 -1
  123. package/dist/ui/lib/utils.js +4 -4
  124. package/dist/ui/link.js +1 -1
  125. package/dist/ui/menubar.js +53 -53
  126. package/dist/ui/navigation-menu.js +27 -27
  127. package/dist/ui/number-input.js +2 -2
  128. package/dist/ui/oauth-button/index.js +2 -2
  129. package/dist/ui/pagination.js +1 -1
  130. package/dist/ui/popover.js +2 -2
  131. package/dist/ui/progress.js +2 -2
  132. package/dist/ui/radio.js +2 -2
  133. package/dist/ui/segmented-control.js +1 -1
  134. package/dist/ui/select.js +35 -35
  135. package/dist/ui/separator.js +1 -1
  136. package/dist/ui/sheet.js +22 -22
  137. package/dist/ui/sidebar.js +2 -2
  138. package/dist/ui/skeleton.js +1 -1
  139. package/dist/ui/slider.js +8 -8
  140. package/dist/ui/slider.js.map +1 -1
  141. package/dist/ui/split-button.js +3 -3
  142. package/dist/ui/stat-card.d.ts +2 -0
  143. package/dist/ui/stat-card.d.ts.map +1 -1
  144. package/dist/ui/stat-card.js +94 -126
  145. package/dist/ui/stat-card.js.map +1 -1
  146. package/dist/ui/stat-flash.js +1 -1
  147. package/dist/ui/stepper.js +1 -1
  148. package/dist/ui/surface.js +2 -2
  149. package/dist/ui/switch.js +2 -2
  150. package/dist/ui/table-row-link.js +1 -1
  151. package/dist/ui/tabs.js +13 -13
  152. package/dist/ui/text.js +1 -1
  153. package/dist/ui/textarea.js +2 -2
  154. package/dist/ui/toggle-group.js +1 -1
  155. package/dist/ui/toggle.js +2 -2
  156. package/dist/ui/tooltip.js +16 -16
  157. package/dist/ui/tree-view/index.js +2 -2
  158. package/llms.txt +1 -1
  159. package/mcp-manifest.json +1 -1
  160. package/package.json +1 -1
  161. package/skill/SKILL.md +1 -1
  162. package/skill/references/components.md +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","names":[],"sources":["../../src/ui/button.tsx"],"sourcesContent":["'use client'\n\nimport { Slot, Slottable } from '@primitives/react-slot'\nimport { IconCheck, IconX } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { AnimatePresence, motion, useReducedMotion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { getGroupPositionStyle,useButtonGroup, useButtonGroupItem } from './button-group'\nimport type { ProcessingSpeed } from './button-processing'\nimport { ProcessingOverlay } from './button-processing'\nimport { Icon } from './icon'\nimport type { IconSize } from './icon-context'\nimport { IconProvider } from './icon-context'\nimport type { IconInput } from './lib/icon-input'\nimport { motionProps,springs, tweens } from './lib/motion'\nimport { normalizeIcon } from './lib/normalize-icon'\nimport { cn } from './lib/utils'\nimport { Spinner } from './spinner'\n\nexport const buttonVariants = cva(\n 'relative inline-flex items-center justify-center whitespace-nowrap font-sans select-none overflow-hidden isolate focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-action-disabled disabled:cursor-not-allowed disabled:saturate-[0.3] [&>span:not([data-grain])]:relative [&>span:not([data-grain])]:z-[2]',\n {\n variants: {\n variant: {\n solid: '',\n soft: '',\n outline: 'border',\n ghost: '',\n link: 'underline-offset-4 hover:underline active:opacity-80',\n },\n color: {\n accent: '',\n error: '',\n success: '',\n warning: '',\n neutral: '',\n },\n weight: {\n semibold: 'font-semibold',\n normal: 'font-normal',\n },\n size: {\n xs: 'h-ds-xs-plus rounded-control px-ds-03 text-ds-sm gap-ds-02',\n sm: 'h-ds-sm rounded-control px-ds-04 text-ds-sm gap-ds-02b',\n md: 'h-ds-md rounded-control px-ds-05 text-ds-md gap-ds-03',\n lg: 'h-ds-lg rounded-control px-ds-06 text-ds-base gap-2.5',\n 'compact-xs': 'rounded-control px-ds-02 py-[3px] text-ds-sm gap-ds-02',\n 'compact-sm': 'rounded-control px-ds-03 py-[5px] text-ds-sm gap-ds-02b',\n 'compact-md': 'rounded-control px-ds-04 py-ds-03 text-ds-md gap-ds-03',\n icon: 'h-ds-md w-ds-md rounded-control',\n 'icon-xs': 'h-ds-xs-plus w-ds-xs-plus rounded-control',\n 'icon-sm': 'h-ds-sm w-ds-sm rounded-control',\n 'icon-md': 'h-ds-md w-ds-md rounded-control',\n 'icon-lg': 'h-ds-lg w-ds-lg rounded-control',\n },\n },\n compoundVariants: [\n // ============ SOLID ============ (colored hover shadows — shadow tints with the button's own hue)\n { variant: 'solid', color: 'accent', className: 'bg-accent-9 text-accent-fg hover:bg-accent-10 shadow-raised hover:shadow-brand' },\n { variant: 'solid', color: 'error', className: 'bg-error-9 text-error-fg hover:bg-error-10 shadow-raised hover:shadow-error' },\n { variant: 'solid', color: 'success', className: 'bg-success-9 text-success-fg hover:bg-success-10 shadow-raised hover:shadow-success' },\n { variant: 'solid', color: 'warning', className: 'bg-warning-9 text-warning-fg hover:bg-warning-10 shadow-raised hover:shadow-warning' },\n { variant: 'solid', color: 'neutral', className: 'bg-neutral-5 text-surface-fg hover:bg-neutral-7 shadow-raised' },\n\n // ============ SOFT ============\n { variant: 'soft', color: 'accent', className: 'bg-accent-3 text-accent-11 hover:bg-accent-4 active:bg-accent-5' },\n { variant: 'soft', color: 'error', className: 'bg-error-3 text-error-11 hover:bg-error-4 active:bg-error-5' },\n { variant: 'soft', color: 'success', className: 'bg-success-3 text-success-11 hover:bg-success-4 active:bg-success-5' },\n { variant: 'soft', color: 'warning', className: 'bg-warning-3 text-warning-11 hover:bg-warning-4 active:bg-warning-5' },\n { variant: 'soft', color: 'neutral', className: 'bg-surface-raised-hover text-surface-fg-muted hover:bg-surface-raised-active active:bg-neutral-5' },\n\n // ============ OUTLINE ============\n { variant: 'outline', color: 'accent', className: 'bg-transparent text-accent-11 border-accent-7 hover:bg-accent-3 active:bg-accent-4' },\n { variant: 'outline', color: 'error', className: 'bg-transparent text-error-11 border-error-7 hover:bg-error-3 active:bg-error-4' },\n { variant: 'outline', color: 'success', className: 'bg-transparent text-success-11 border-success-7 hover:bg-success-3 active:bg-success-4' },\n { variant: 'outline', color: 'warning', className: 'bg-transparent text-warning-11 border-warning-7 hover:bg-warning-3 active:bg-warning-4' },\n { variant: 'outline', color: 'neutral', className: 'bg-transparent text-surface-fg border-surface-border-strong hover:bg-surface-raised-hover active:bg-surface-raised-active' },\n\n // ============ GHOST ============\n // ghost+accent uses neutral look for backward compat (most common ghost is toolbar/icon ghost)\n { variant: 'ghost', color: 'accent', className: 'bg-transparent text-surface-fg-muted hover:bg-surface-raised-hover hover:text-surface-fg active:bg-surface-raised-active' },\n { variant: 'ghost', color: 'error', className: 'bg-transparent text-error-11 hover:bg-error-3 active:bg-error-4' },\n { variant: 'ghost', color: 'success', className: 'bg-transparent text-success-11 hover:bg-success-3 active:bg-success-4' },\n { variant: 'ghost', color: 'warning', className: 'bg-transparent text-warning-11 hover:bg-warning-3 active:bg-warning-4' },\n { variant: 'ghost', color: 'neutral', className: 'bg-transparent text-surface-fg-muted hover:bg-surface-raised-hover hover:text-surface-fg active:bg-surface-raised-active' },\n\n // ============ LINK ============\n { variant: 'link', color: 'accent', className: 'text-accent-11' },\n { variant: 'link', color: 'error', className: 'text-error-11' },\n { variant: 'link', color: 'success', className: 'text-success-11' },\n { variant: 'link', color: 'warning', className: 'text-warning-11' },\n { variant: 'link', color: 'neutral', className: 'text-surface-fg-muted' },\n ],\n defaultVariants: {\n variant: 'solid',\n color: 'accent',\n weight: 'semibold',\n size: 'md',\n },\n },\n)\n\n/** Extra horizontal padding for pill shape — rounded ends eat into visual space */\nconst pillPaddingClass: Record<string, string> = {\n xs: 'px-ds-04',\n sm: 'px-ds-05',\n md: 'px-ds-06',\n lg: 'px-ds-07',\n 'compact-xs': 'px-ds-03',\n 'compact-sm': 'px-ds-04',\n 'compact-md': 'px-ds-05',\n}\n\n/** Negative margin to tighten icon side padding — pulls icon closer to button edge */\nconst iconInsetClass: Record<string, { start: string; end: string }> = {\n xs: { start: '-ml-0.5', end: '-mr-0.5' },\n sm: { start: '-ml-1', end: '-mr-1' },\n md: { start: '-ml-1.5', end: '-mr-1.5' },\n lg: { start: '-ml-2', end: '-mr-2' },\n 'compact-xs': { start: '-ml-0.5', end: '-mr-0.5' },\n 'compact-sm': { start: '-ml-0.5', end: '-mr-0.5' },\n 'compact-md': { start: '-ml-1', end: '-mr-1' },\n icon: { start: '', end: '' },\n 'icon-xs': { start: '', end: '' },\n 'icon-sm': { start: '', end: '' },\n 'icon-md': { start: '', end: '' },\n 'icon-lg': { start: '', end: '' },\n}\n\n/** Map button size to spinner size */\nconst BUTTON_TO_SPINNER_SIZE: Record<string, 'sm' | 'md'> = {\n xs: 'sm',\n sm: 'sm',\n md: 'sm',\n lg: 'md',\n 'compact-xs': 'sm',\n 'compact-sm': 'sm',\n 'compact-md': 'sm',\n icon: 'sm',\n 'icon-xs': 'sm',\n 'icon-sm': 'sm',\n 'icon-md': 'sm',\n 'icon-lg': 'md',\n}\n\n/** Map button size to Icon context size */\nconst BUTTON_TO_ICON_SIZE: Record<string, IconSize> = {\n xs: 'xs', sm: 'sm', md: 'md', lg: 'lg',\n 'compact-xs': 'xs', 'compact-sm': 'sm', 'compact-md': 'md',\n icon: 'md', 'icon-xs': 'xs', 'icon-sm': 'sm', 'icon-md': 'md', 'icon-lg': 'lg',\n}\n\n/**\n * Props for Button — the primary action component with a two-axis variant system,\n * multiple size options, icon slots, and a built-in loading state.\n *\n * **Two axes:**\n * - `variant` controls **visual style**: `\"solid\"` (default, filled) | `\"soft\"` (tinted bg) |\n * `\"outline\"` (bordered) | `\"ghost\"` (transparent, for toolbars) | `\"link\"` (underline, inline)\n * - `color` controls **semantic intent**: `\"accent\"` (default, brand) | `\"error\"` (destructive) |\n * `\"success\"` | `\"warning\"` | `\"neutral\"` (subdued)\n *\n * **Sizes:** `xs` | `sm` | `md` (default) | `lg` for text buttons;\n * `compact-xs` | `compact-sm` | `compact-md` for height-less inline buttons;\n * `icon` | `icon-xs` | `icon-sm` | `icon-md` | `icon-lg` for square icon-only buttons.\n *\n * **Shape:** `\"default\"` uses the `--radius-control` token; `\"pill\"` applies `rounded-pill` (fully-rounded).\n *\n * **Weight:** `\"semibold\"` (default) | `\"normal\"` for lighter labels.\n *\n * **Note:** `ghost` + `accent` renders with neutral styling for backward compat —\n * most ghost buttons are toolbar/icon actions where neutral is expected.\n *\n * **Loading:** When `loading={true}` the button is disabled and aria-busy is set.\n * Use `loadingPosition` to control where the spinner appears.\n *\n * @example\n * // Primary save action (default variant + color):\n * <Button onClick={handleSave}>Save changes</Button>\n *\n * @example\n * // Soft success feedback:\n * <Button variant=\"soft\" color=\"success\" startIcon={<Icon icon={IconCheck} />}>\n * Approved\n * </Button>\n *\n * @example\n * // Destructive delete with loading state:\n * <Button variant=\"solid\" color=\"error\" startIcon={<Icon icon={IconTrash} />} loading={isDeleting}>\n * Delete project\n * </Button>\n *\n * @example\n * // Compact pill tag:\n * <Button variant=\"soft\" color=\"warning\" size=\"compact-sm\" shape=\"pill\">\n * Overdue\n * </Button>\n *\n * @example\n * // Ghost toolbar action:\n * <Button variant=\"ghost\" size=\"sm\" startIcon={<Icon icon={IconEdit} />}>\n * Edit\n * </Button>\n */\nexport interface ButtonProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n /** Button shape — 'pill' applies rounded-pill for chip/tag-like buttons */\n shape?: 'default' | 'pill'\n /** Icon element rendered before children — use <Icon icon={...} /> */\n startIcon?: IconInput\n /** Icon element rendered after children — use <Icon icon={...} /> */\n endIcon?: IconInput\n /** Show loading spinner and disable button */\n loading?: boolean\n /** Where to render the spinner: replaces startIcon, endIcon, or centers over children */\n loadingPosition?: 'start' | 'end' | 'center'\n /** Stretch to full width of parent */\n fullWidth?: boolean\n /**\n * Async click handler — auto-manages loading → success/error states.\n * When provided, the button shows a spinner while the promise is pending,\n * then briefly flashes green (success) or red (error) before reverting.\n * Overrides `onClick` and `loading` when active.\n */\n onClickAsync?: (e: React.MouseEvent<HTMLButtonElement>) => Promise<void>\n /** How long (ms) to show the success/error state before reverting. Default: 1500 */\n asyncFeedbackDuration?: number\n\n /**\n * Show processing animation — animated border/glow while content stays visible.\n * `true` = \"working\" speed. Semantic speeds:\n * - `\"ambient\"` (3s) — background sync, file upload\n * - `\"working\"` (2s) — standard API call, generation\n * - `\"urgent\"` (1s) — retry, nearly done\n */\n processing?: boolean | 'ambient' | 'working' | 'urgent'\n\n /** Override processing animation color. Defaults to button's own color. */\n processingColor?: 'accent' | 'error' | 'success' | 'warning' | 'neutral'\n\n /** Disable button during processing. Default: true. Set false for cancel-by-click patterns. */\n processingDisabled?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n color,\n weight,\n size,\n asChild = false,\n shape,\n startIcon,\n endIcon,\n loading: loadingProp = false,\n loadingPosition = 'start',\n fullWidth = false,\n disabled,\n onClick,\n onClickAsync,\n asyncFeedbackDuration = 1500,\n processing: processingProp,\n processingColor,\n processingDisabled = true,\n children,\n ...props\n },\n ref,\n ) => {\n const group = useButtonGroup()\n const groupItem = useButtonGroupItem()\n const resolvedVariant = variant ?? group.variant\n const resolvedColor = color ?? group.color\n const resolvedWeight = weight ?? group.weight ?? 'semibold'\n const resolvedShape = shape ?? group.shape ?? 'default'\n const resolvedSize = size ?? group.size ?? 'md'\n // ButtonGroup can propagate disabled to all children\n const resolvedDisabled = disabled ?? group.disabled\n\n // When inside an attached ButtonGroup, adjust border-radius based on position\n const groupRadiusStyle = groupItem && group.attached !== false\n ? getGroupPositionStyle(groupItem.position, group.orientation ?? 'horizontal')\n : undefined\n // Stretch to fill when inside a vertical or fullWidth ButtonGroup\n const groupStretch = group._stretch ?? false\n\n const prefersReduced = useReducedMotion()\n\n // Refs + effect for smooth width transitions (must be before any early returns)\n const wrapperRef = React.useRef<HTMLSpanElement>(null)\n const btnRef = React.useRef<HTMLButtonElement | null>(null)\n const rafRef = React.useRef<number | undefined>(undefined)\n\n \n React.useEffect(() => {\n const btn = btnRef.current\n const wrapper = wrapperRef.current\n if (!btn || !wrapper || fullWidth || groupStretch || prefersReduced) return\n\n rafRef.current = requestAnimationFrame(() => {\n wrapper.style.width = 'auto'\n const w = btn.offsetWidth\n if (w > 0) {\n wrapper.getBoundingClientRect()\n wrapper.style.width = `${w}px`\n }\n })\n return () => { if (rafRef.current) cancelAnimationFrame(rafRef.current) }\n }) // run on every render to catch content changes\n\n // Async state machine: idle → loading → success | error → idle\n type AsyncState = 'idle' | 'loading' | 'success' | 'error'\n const [asyncState, setAsyncState] = React.useState<AsyncState>('idle')\n const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const isMountedRef = React.useRef(true)\n\n React.useEffect(() => () => {\n isMountedRef.current = false\n clearTimeout(timeoutRef.current)\n }, [])\n\n const handleAsyncClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n if (!onClickAsync || asyncState !== 'idle') return\n setAsyncState('loading')\n onClickAsync(e)\n .then(() => { if (isMountedRef.current) setAsyncState('success') })\n .catch(() => { if (isMountedRef.current) setAsyncState('error') })\n .finally(() => {\n if (isMountedRef.current) {\n timeoutRef.current = setTimeout(() => {\n if (isMountedRef.current) setAsyncState('idle')\n }, asyncFeedbackDuration)\n }\n })\n }\n\n const isAsync = !!onClickAsync\n const loading = isAsync ? asyncState === 'loading' : loadingProp\n const isAsyncFeedback = asyncState === 'success' || asyncState === 'error'\n\n // Processing: explicit prop takes priority, otherwise auto-processing during onClickAsync.\n // Processing is always OFF during async feedback (success/error) so the feedback colors show.\n const autoProcessing = isAsync && asyncState === 'loading' && !processingProp\n const processingSpeed: ProcessingSpeed | undefined = isAsyncFeedback ? undefined\n : processingProp === true ? 'working'\n : processingProp === false || !processingProp\n ? (autoProcessing ? 'working' : undefined)\n : processingProp\n const isProcessing = !!processingSpeed\n const resolvedProcessingColor = processingColor ?? resolvedColor ?? 'accent'\n\n if (asChild) {\n // Slot merges all props into the child element via cloneElement at runtime.\n // We cast here because SlotProps only types React.HTMLAttributes<HTMLElement>,\n // which excludes button-specific attrs like `disabled`.\n const slotProps = {\n className: cn(\n buttonVariants({ variant: resolvedVariant, color: resolvedColor, weight: resolvedWeight, size: resolvedSize }),\n resolvedShape === 'pill' && 'rounded-pill',\n resolvedShape === 'pill' && pillPaddingClass[resolvedSize],\n (fullWidth || groupStretch) && 'w-full',\n className,\n ),\n ref,\n disabled: resolvedDisabled || loading,\n 'aria-busy': loading || undefined,\n ...props,\n } as React.ComponentPropsWithRef<typeof Slot>\n return (\n <Slot {...slotProps}>\n <Slottable>{children}</Slottable>\n </Slot>\n )\n }\n\n const inset = iconInsetClass[resolvedSize] ?? { start: '', end: '' }\n // Dim icons on filled variants (Radix pattern — icon is decorative, text is primary)\n const dimIcon = resolvedVariant === 'solid' || resolvedVariant === 'soft' || resolvedVariant === 'outline'\n\n const renderStartSlot = () => {\n if (loading && loadingPosition === 'start') {\n return (\n <span className={cn('inline-flex shrink-0 items-center justify-center', startIcon && inset.start)}>\n <Spinner size={BUTTON_TO_SPINNER_SIZE[resolvedSize]} variant=\"bare\" />\n </span>\n )\n }\n if (startIcon) {\n return (\n <span className={cn('inline-flex shrink-0 items-center justify-center pointer-events-none', inset.start, dimIcon && 'opacity-90')}>\n {normalizeIcon(startIcon)}\n </span>\n )\n }\n return null\n }\n\n const renderEndSlot = () => {\n if (loading && loadingPosition === 'end') {\n return (\n <span className={cn('inline-flex shrink-0 items-center justify-center', endIcon && inset.end)}>\n <Spinner size={BUTTON_TO_SPINNER_SIZE[resolvedSize]} variant=\"bare\" />\n </span>\n )\n }\n if (endIcon) {\n return (\n <span className={cn('inline-flex shrink-0 items-center justify-center pointer-events-none', inset.end, dimIcon && 'opacity-90')}>\n {normalizeIcon(endIcon)}\n </span>\n )\n }\n return null\n }\n\n // Separate DevalokGrain elements (need to be direct button children for absolute positioning)\n // from text/other content (needs z-elevation above grain)\n const childArray = React.Children.toArray(children)\n const grainElements: React.ReactNode[] = []\n const contentElements: React.ReactNode[] = []\n childArray.forEach((child) => {\n if (React.isValidElement(child) && (child.type as { displayName?: string })?.displayName === 'DevalokGrain') {\n grainElements.push(child)\n } else {\n contentElements.push(child)\n }\n })\n\n const renderChildren = () => {\n if (loading && loadingPosition === 'center') {\n return (\n <span className=\"relative inline-flex items-center justify-center\">\n <span className=\"invisible\">{contentElements}</span>\n <span className=\"absolute inset-0 flex items-center justify-center\">\n <Spinner size={BUTTON_TO_SPINNER_SIZE[resolvedSize]} variant=\"bare\" />\n </span>\n </span>\n )\n }\n // Only wrap in z-elevated span when grain is present (to sit above grain layers).\n // Without grain, render children directly to preserve flex layout.\n if (grainElements.length > 0) {\n return <span>{contentElements}</span>\n }\n return <>{contentElements}</>\n }\n\n // Async feedback: override color to show green/red\n const feedbackColorClass = isAsyncFeedback\n ? asyncState === 'success'\n ? 'bg-success-9 text-success-fg border-transparent hover:bg-success-9'\n : 'bg-error-9 text-error-fg border-transparent hover:bg-error-9'\n : undefined\n\n // Async feedback icon — uses Icon's draw animation for pen-stroke effect\n const asyncFeedbackIcon = isAsyncFeedback ? (\n <span className={cn('inline-flex shrink-0 items-center justify-center pointer-events-none', startIcon && inset.start)}>\n <Icon icon={asyncState === 'success' ? IconCheck : IconX} animate=\"draw\" />\n </span>\n ) : null\n\n const iconSize = BUTTON_TO_ICON_SIZE[resolvedSize] ?? 'md'\n\n const buttonEl = (\n <motion.button\n {...motionProps(props)}\n style={{ ...props.style, ...groupRadiusStyle }}\n className={cn(\n buttonVariants({\n // When processing (and not showing async feedback), force soft variant so ants pop\n variant: isProcessing && !isAsyncFeedback && resolvedVariant !== 'ghost' && resolvedVariant !== 'outline' && resolvedVariant !== 'link' ? 'soft' : resolvedVariant,\n color: resolvedColor,\n weight: resolvedWeight,\n size: resolvedSize,\n }),\n resolvedShape === 'pill' && 'rounded-pill',\n resolvedShape === 'pill' && pillPaddingClass[resolvedSize],\n (fullWidth || groupStretch) && 'w-full',\n // Asymmetric timing: hover-out is slow+relaxed, hover-in is fast+snappy (applied via hover: override)\n !loading && !isAsyncFeedback && 'transition-[color,background-color,border-color,box-shadow,transform,filter] duration-moderate-01 ease-productive-exit',\n !loading && !isAsyncFeedback && 'hover:duration-fast-02 hover:ease-productive-entrance',\n !loading && !isAsyncFeedback && 'active:scale-[0.95] active:brightness-[0.92] active:saturate-[1.1] active:duration-[0ms]',\n feedbackColorClass,\n isAsyncFeedback && 'transition-colors duration-moderate-01 ease-productive-standard',\n isProcessing && processingDisabled && 'pointer-events-none cursor-default',\n className,\n )}\n ref={(el: HTMLButtonElement | null) => {\n btnRef.current = el\n if (typeof ref === 'function') ref(el)\n else if (ref) (ref as React.MutableRefObject<HTMLButtonElement | null>).current = el\n }}\n disabled={resolvedDisabled || (loading && !isProcessing)}\n aria-busy={loading || isProcessing || undefined}\n aria-disabled={isProcessing && processingDisabled || undefined}\n onClick={isAsync ? handleAsyncClick : (isProcessing && processingDisabled ? undefined : onClick)}\n >\n {/* Grain layers render as direct children (need absolute positioning) */}\n {grainElements}\n {/* Content renders above grain via z-[2] span wrapper */}\n {isAsyncFeedback ? asyncFeedbackIcon : renderStartSlot()}\n {isAsyncFeedback ? contentElements : renderChildren()}\n {isAsyncFeedback ? null : renderEndSlot()}\n </motion.button>\n )\n\n // Always wrap in a positioned container so the overlay can render\n // as a sibling OUTSIDE the button (not affected by disabled opacity).\n // Keeping the wrapper always-on prevents React unmount/remount on\n // processing toggle, enabling smooth CSS transitions between states.\n return (\n <IconProvider size={iconSize}>\n <span\n ref={wrapperRef}\n className={cn('relative inline-flex', fullWidth && 'w-full')}\n style={{\n ...(fullWidth || groupStretch || prefersReduced ? undefined : { transition: 'width 0.2s cubic-bezier(0.25, 0.1, 0.25, 1)' }),\n ...groupRadiusStyle,\n }}\n >\n {buttonEl}\n <ProcessingOverlay\n active={isProcessing}\n speed={processingSpeed ?? 'working'}\n color={resolvedProcessingColor}\n />\n </span>\n </IconProvider>\n )\n },\n)\nButton.displayName = 'Button'\n\nexport { Button }\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,IAAa,IAAiB,EAC5B,qZACA;CACE,UAAU;EACR,SAAS;GACP,OAAO;GACP,MAAM;GACN,SAAS;G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import { Slot, Slottable } from '@primitives/react-slot'\nimport { IconCheck, IconX } from '@tabler/icons-react'\nimport { cva, type VariantProps } from 'class-variance-authority'\nimport { AnimatePresence, motion, useReducedMotion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { getGroupPositionStyle,useButtonGroup, useButtonGroupItem } from './button-group'\nimport type { ProcessingSpeed } from './button-processing'\nimport { ProcessingOverlay } from './button-processing'\nimport { Icon } from './icon'\nimport type { IconSize } from './icon-context'\nimport { IconProvider } from './icon-context'\nimport type { IconInput } from './lib/icon-input'\nimport { motionProps,springs, tweens } from './lib/motion'\nimport { normalizeIcon } from './lib/normalize-icon'\nimport { cn } from './lib/utils'\nimport { Spinner } from './spinner'\n\nexport const buttonVariants = cva(\n 'relative inline-flex items-center justify-center whitespace-nowrap font-sans select-none overflow-hidden isolate focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-accent-9 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-action-disabled disabled:cursor-not-allowed disabled:saturate-[0.3] [&>span:not([data-grain])]:relative [&>span:not([data-grain])]:z-[2]',\n {\n variants: {\n variant: {\n solid: '',\n soft: '',\n outline: 'border',\n ghost: '',\n link: 'underline-offset-4 hover:underline active:opacity-80',\n },\n color: {\n accent: '',\n error: '',\n success: '',\n warning: '',\n neutral: '',\n },\n weight: {\n semibold: 'font-semibold',\n normal: 'font-normal',\n },\n size: {\n xs: 'h-ds-xs-plus rounded-control px-ds-03 text-ds-sm gap-ds-02',\n sm: 'h-ds-sm rounded-control px-ds-04 text-ds-sm gap-ds-02b',\n md: 'h-ds-md rounded-control px-ds-05 text-ds-md gap-ds-03',\n lg: 'h-ds-lg rounded-control px-ds-06 text-ds-base gap-2.5',\n 'compact-xs': 'rounded-control px-ds-02 py-[3px] text-ds-sm gap-ds-02',\n 'compact-sm': 'rounded-control px-ds-03 py-[5px] text-ds-sm gap-ds-02b',\n 'compact-md': 'rounded-control px-ds-04 py-ds-03 text-ds-md gap-ds-03',\n icon: 'h-ds-md w-ds-md rounded-control',\n 'icon-xs': 'h-ds-xs-plus w-ds-xs-plus rounded-control',\n 'icon-sm': 'h-ds-sm w-ds-sm rounded-control',\n 'icon-md': 'h-ds-md w-ds-md rounded-control',\n 'icon-lg': 'h-ds-lg w-ds-lg rounded-control',\n },\n },\n compoundVariants: [\n // ============ SOLID ============ (tonal raised shadow; fill deepens on hover — no coloured bloom)\n { variant: 'solid', color: 'accent', className: 'bg-accent-9 text-accent-fg hover:bg-accent-10 shadow-raised' },\n { variant: 'solid', color: 'error', className: 'bg-error-9 text-error-fg hover:bg-error-10 shadow-raised' },\n { variant: 'solid', color: 'success', className: 'bg-success-9 text-success-fg hover:bg-success-10 shadow-raised' },\n { variant: 'solid', color: 'warning', className: 'bg-warning-9 text-warning-fg hover:bg-warning-10 shadow-raised' },\n { variant: 'solid', color: 'neutral', className: 'bg-neutral-5 text-surface-fg hover:bg-neutral-7 shadow-raised' },\n\n // ============ SOFT ============\n { variant: 'soft', color: 'accent', className: 'bg-accent-3 text-accent-11 hover:bg-accent-4 active:bg-accent-5' },\n { variant: 'soft', color: 'error', className: 'bg-error-3 text-error-11 hover:bg-error-4 active:bg-error-5' },\n { variant: 'soft', color: 'success', className: 'bg-success-3 text-success-11 hover:bg-success-4 active:bg-success-5' },\n { variant: 'soft', color: 'warning', className: 'bg-warning-3 text-warning-11 hover:bg-warning-4 active:bg-warning-5' },\n { variant: 'soft', color: 'neutral', className: 'bg-surface-raised-hover text-surface-fg-muted hover:bg-surface-raised-active active:bg-neutral-5' },\n\n // ============ OUTLINE ============\n { variant: 'outline', color: 'accent', className: 'bg-transparent text-accent-11 border-accent-7 hover:bg-accent-3 active:bg-accent-4' },\n { variant: 'outline', color: 'error', className: 'bg-transparent text-error-11 border-error-7 hover:bg-error-3 active:bg-error-4' },\n { variant: 'outline', color: 'success', className: 'bg-transparent text-success-11 border-success-7 hover:bg-success-3 active:bg-success-4' },\n { variant: 'outline', color: 'warning', className: 'bg-transparent text-warning-11 border-warning-7 hover:bg-warning-3 active:bg-warning-4' },\n { variant: 'outline', color: 'neutral', className: 'bg-transparent text-surface-fg border-surface-border-strong hover:bg-surface-raised-hover active:bg-surface-raised-active' },\n\n // ============ GHOST ============\n // ghost+accent uses neutral look for backward compat (most common ghost is toolbar/icon ghost)\n { variant: 'ghost', color: 'accent', className: 'bg-transparent text-surface-fg-muted hover:bg-surface-raised-hover hover:text-surface-fg active:bg-surface-raised-active' },\n { variant: 'ghost', color: 'error', className: 'bg-transparent text-error-11 hover:bg-error-3 active:bg-error-4' },\n { variant: 'ghost', color: 'success', className: 'bg-transparent text-success-11 hover:bg-success-3 active:bg-success-4' },\n { variant: 'ghost', color: 'warning', className: 'bg-transparent text-warning-11 hover:bg-warning-3 active:bg-warning-4' },\n { variant: 'ghost', color: 'neutral', className: 'bg-transparent text-surface-fg-muted hover:bg-surface-raised-hover hover:text-surface-fg active:bg-surface-raised-active' },\n\n // ============ LINK ============\n { variant: 'link', color: 'accent', className: 'text-accent-11' },\n { variant: 'link', color: 'error', className: 'text-error-11' },\n { variant: 'link', color: 'success', className: 'text-success-11' },\n { variant: 'link', color: 'warning', className: 'text-warning-11' },\n { variant: 'link', color: 'neutral', className: 'text-surface-fg-muted' },\n ],\n defaultVariants: {\n variant: 'solid',\n color: 'accent',\n weight: 'semibold',\n size: 'md',\n },\n },\n)\n\n/** Extra horizontal padding for pill shape — rounded ends eat into visual space */\nconst pillPaddingClass: Record<string, string> = {\n xs: 'px-ds-04',\n sm: 'px-ds-05',\n md: 'px-ds-06',\n lg: 'px-ds-07',\n 'compact-xs': 'px-ds-03',\n 'compact-sm': 'px-ds-04',\n 'compact-md': 'px-ds-05',\n}\n\n/** Negative margin to tighten icon side padding — pulls icon closer to button edge */\nconst iconInsetClass: Record<string, { start: string; end: string }> = {\n xs: { start: '-ml-0.5', end: '-mr-0.5' },\n sm: { start: '-ml-1', end: '-mr-1' },\n md: { start: '-ml-1.5', end: '-mr-1.5' },\n lg: { start: '-ml-2', end: '-mr-2' },\n 'compact-xs': { start: '-ml-0.5', end: '-mr-0.5' },\n 'compact-sm': { start: '-ml-0.5', end: '-mr-0.5' },\n 'compact-md': { start: '-ml-1', end: '-mr-1' },\n icon: { start: '', end: '' },\n 'icon-xs': { start: '', end: '' },\n 'icon-sm': { start: '', end: '' },\n 'icon-md': { start: '', end: '' },\n 'icon-lg': { start: '', end: '' },\n}\n\n/** Map button size to spinner size */\nconst BUTTON_TO_SPINNER_SIZE: Record<string, 'sm' | 'md'> = {\n xs: 'sm',\n sm: 'sm',\n md: 'sm',\n lg: 'md',\n 'compact-xs': 'sm',\n 'compact-sm': 'sm',\n 'compact-md': 'sm',\n icon: 'sm',\n 'icon-xs': 'sm',\n 'icon-sm': 'sm',\n 'icon-md': 'sm',\n 'icon-lg': 'md',\n}\n\n/** Map button size to Icon context size */\nconst BUTTON_TO_ICON_SIZE: Record<string, IconSize> = {\n xs: 'xs', sm: 'sm', md: 'md', lg: 'lg',\n 'compact-xs': 'xs', 'compact-sm': 'sm', 'compact-md': 'md',\n icon: 'md', 'icon-xs': 'xs', 'icon-sm': 'sm', 'icon-md': 'md', 'icon-lg': 'lg',\n}\n\n/**\n * Props for Button — the primary action component with a two-axis variant system,\n * multiple size options, icon slots, and a built-in loading state.\n *\n * **Two axes:**\n * - `variant` controls **visual style**: `\"solid\"` (default, filled) | `\"soft\"` (tinted bg) |\n * `\"outline\"` (bordered) | `\"ghost\"` (transparent, for toolbars) | `\"link\"` (underline, inline)\n * - `color` controls **semantic intent**: `\"accent\"` (default, brand) | `\"error\"` (destructive) |\n * `\"success\"` | `\"warning\"` | `\"neutral\"` (subdued)\n *\n * **Sizes:** `xs` | `sm` | `md` (default) | `lg` for text buttons;\n * `compact-xs` | `compact-sm` | `compact-md` for height-less inline buttons;\n * `icon` | `icon-xs` | `icon-sm` | `icon-md` | `icon-lg` for square icon-only buttons.\n *\n * **Shape:** `\"default\"` uses the `--radius-control` token; `\"pill\"` applies `rounded-pill` (fully-rounded).\n *\n * **Weight:** `\"semibold\"` (default) | `\"normal\"` for lighter labels.\n *\n * **Note:** `ghost` + `accent` renders with neutral styling for backward compat —\n * most ghost buttons are toolbar/icon actions where neutral is expected.\n *\n * **Loading:** When `loading={true}` the button is disabled and aria-busy is set.\n * Use `loadingPosition` to control where the spinner appears.\n *\n * @example\n * // Primary save action (default variant + color):\n * <Button onClick={handleSave}>Save changes</Button>\n *\n * @example\n * // Soft success feedback:\n * <Button variant=\"soft\" color=\"success\" startIcon={<Icon icon={IconCheck} />}>\n * Approved\n * </Button>\n *\n * @example\n * // Destructive delete with loading state:\n * <Button variant=\"solid\" color=\"error\" startIcon={<Icon icon={IconTrash} />} loading={isDeleting}>\n * Delete project\n * </Button>\n *\n * @example\n * // Compact pill tag:\n * <Button variant=\"soft\" color=\"warning\" size=\"compact-sm\" shape=\"pill\">\n * Overdue\n * </Button>\n *\n * @example\n * // Ghost toolbar action:\n * <Button variant=\"ghost\" size=\"sm\" startIcon={<Icon icon={IconEdit} />}>\n * Edit\n * </Button>\n */\nexport interface ButtonProps\n extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'color'>,\n VariantProps<typeof buttonVariants> {\n asChild?: boolean\n /** Button shape — 'pill' applies rounded-pill for chip/tag-like buttons */\n shape?: 'default' | 'pill'\n /** Icon element rendered before children — use <Icon icon={...} /> */\n startIcon?: IconInput\n /** Icon element rendered after children — use <Icon icon={...} /> */\n endIcon?: IconInput\n /** Show loading spinner and disable button */\n loading?: boolean\n /** Where to render the spinner: replaces startIcon, endIcon, or centers over children */\n loadingPosition?: 'start' | 'end' | 'center'\n /** Stretch to full width of parent */\n fullWidth?: boolean\n /**\n * Async click handler — auto-manages loading → success/error states.\n * When provided, the button shows a spinner while the promise is pending,\n * then briefly flashes green (success) or red (error) before reverting.\n * Overrides `onClick` and `loading` when active.\n */\n onClickAsync?: (e: React.MouseEvent<HTMLButtonElement>) => Promise<void>\n /** How long (ms) to show the success/error state before reverting. Default: 1500 */\n asyncFeedbackDuration?: number\n\n /**\n * Show processing animation — animated border/glow while content stays visible.\n * `true` = \"working\" speed. Semantic speeds:\n * - `\"ambient\"` (3s) — background sync, file upload\n * - `\"working\"` (2s) — standard API call, generation\n * - `\"urgent\"` (1s) — retry, nearly done\n */\n processing?: boolean | 'ambient' | 'working' | 'urgent'\n\n /** Override processing animation color. Defaults to button's own color. */\n processingColor?: 'accent' | 'error' | 'success' | 'warning' | 'neutral'\n\n /** Disable button during processing. Default: true. Set false for cancel-by-click patterns. */\n processingDisabled?: boolean\n}\n\nconst Button = React.forwardRef<HTMLButtonElement, ButtonProps>(\n (\n {\n className,\n variant,\n color,\n weight,\n size,\n asChild = false,\n shape,\n startIcon,\n endIcon,\n loading: loadingProp = false,\n loadingPosition = 'start',\n fullWidth = false,\n disabled,\n onClick,\n onClickAsync,\n asyncFeedbackDuration = 1500,\n processing: processingProp,\n processingColor,\n processingDisabled = true,\n children,\n ...props\n },\n ref,\n ) => {\n const group = useButtonGroup()\n const groupItem = useButtonGroupItem()\n const resolvedVariant = variant ?? group.variant\n const resolvedColor = color ?? group.color\n const resolvedWeight = weight ?? group.weight ?? 'semibold'\n const resolvedShape = shape ?? group.shape ?? 'default'\n const resolvedSize = size ?? group.size ?? 'md'\n // ButtonGroup can propagate disabled to all children\n const resolvedDisabled = disabled ?? group.disabled\n\n // When inside an attached ButtonGroup, adjust border-radius based on position\n const groupRadiusStyle = groupItem && group.attached !== false\n ? getGroupPositionStyle(groupItem.position, group.orientation ?? 'horizontal')\n : undefined\n // Stretch to fill when inside a vertical or fullWidth ButtonGroup\n const groupStretch = group._stretch ?? false\n\n const prefersReduced = useReducedMotion()\n\n // Refs + effect for smooth width transitions (must be before any early returns)\n const wrapperRef = React.useRef<HTMLSpanElement>(null)\n const btnRef = React.useRef<HTMLButtonElement | null>(null)\n const rafRef = React.useRef<number | undefined>(undefined)\n\n \n React.useEffect(() => {\n const btn = btnRef.current\n const wrapper = wrapperRef.current\n if (!btn || !wrapper || fullWidth || groupStretch || prefersReduced) return\n\n rafRef.current = requestAnimationFrame(() => {\n wrapper.style.width = 'auto'\n const w = btn.offsetWidth\n if (w > 0) {\n wrapper.getBoundingClientRect()\n wrapper.style.width = `${w}px`\n }\n })\n return () => { if (rafRef.current) cancelAnimationFrame(rafRef.current) }\n }) // run on every render to catch content changes\n\n // Async state machine: idle → loading → success | error → idle\n type AsyncState = 'idle' | 'loading' | 'success' | 'error'\n const [asyncState, setAsyncState] = React.useState<AsyncState>('idle')\n const timeoutRef = React.useRef<ReturnType<typeof setTimeout> | undefined>(undefined)\n const isMountedRef = React.useRef(true)\n\n React.useEffect(() => () => {\n isMountedRef.current = false\n clearTimeout(timeoutRef.current)\n }, [])\n\n const handleAsyncClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n if (!onClickAsync || asyncState !== 'idle') return\n setAsyncState('loading')\n onClickAsync(e)\n .then(() => { if (isMountedRef.current) setAsyncState('success') })\n .catch(() => { if (isMountedRef.current) setAsyncState('error') })\n .finally(() => {\n if (isMountedRef.current) {\n timeoutRef.current = setTimeout(() => {\n if (isMountedRef.current) setAsyncState('idle')\n }, asyncFeedbackDuration)\n }\n })\n }\n\n const isAsync = !!onClickAsync\n const loading = isAsync ? asyncState === 'loading' : loadingProp\n const isAsyncFeedback = asyncState === 'success' || asyncState === 'error'\n\n // Processing: explicit prop takes priority, otherwise auto-processing during onClickAsync.\n // Processing is always OFF during async feedback (success/error) so the feedback colors show.\n const autoProcessing = isAsync && asyncState === 'loading' && !processingProp\n const processingSpeed: ProcessingSpeed | undefined = isAsyncFeedback ? undefined\n : processingProp === true ? 'working'\n : processingProp === false || !processingProp\n ? (autoProcessing ? 'working' : undefined)\n : processingProp\n const isProcessing = !!processingSpeed\n const resolvedProcessingColor = processingColor ?? resolvedColor ?? 'accent'\n\n if (asChild) {\n // Slot merges all props into the child element via cloneElement at runtime.\n // We cast here because SlotProps only types React.HTMLAttributes<HTMLElement>,\n // which excludes button-specific attrs like `disabled`.\n const slotProps = {\n className: cn(\n buttonVariants({ variant: resolvedVariant, color: resolvedColor, weight: resolvedWeight, size: resolvedSize }),\n resolvedShape === 'pill' && 'rounded-pill',\n resolvedShape === 'pill' && pillPaddingClass[resolvedSize],\n (fullWidth || groupStretch) && 'w-full',\n className,\n ),\n ref,\n disabled: resolvedDisabled || loading,\n 'aria-busy': loading || undefined,\n ...props,\n } as React.ComponentPropsWithRef<typeof Slot>\n return (\n <Slot {...slotProps}>\n <Slottable>{children}</Slottable>\n </Slot>\n )\n }\n\n const inset = iconInsetClass[resolvedSize] ?? { start: '', end: '' }\n // Dim icons on filled variants (Radix pattern — icon is decorative, text is primary)\n const dimIcon = resolvedVariant === 'solid' || resolvedVariant === 'soft' || resolvedVariant === 'outline'\n\n const renderStartSlot = () => {\n if (loading && loadingPosition === 'start') {\n return (\n <span className={cn('inline-flex shrink-0 items-center justify-center', startIcon && inset.start)}>\n <Spinner size={BUTTON_TO_SPINNER_SIZE[resolvedSize]} variant=\"bare\" />\n </span>\n )\n }\n if (startIcon) {\n return (\n <span className={cn('inline-flex shrink-0 items-center justify-center pointer-events-none', inset.start, dimIcon && 'opacity-90')}>\n {normalizeIcon(startIcon)}\n </span>\n )\n }\n return null\n }\n\n const renderEndSlot = () => {\n if (loading && loadingPosition === 'end') {\n return (\n <span className={cn('inline-flex shrink-0 items-center justify-center', endIcon && inset.end)}>\n <Spinner size={BUTTON_TO_SPINNER_SIZE[resolvedSize]} variant=\"bare\" />\n </span>\n )\n }\n if (endIcon) {\n return (\n <span className={cn('inline-flex shrink-0 items-center justify-center pointer-events-none', inset.end, dimIcon && 'opacity-90')}>\n {normalizeIcon(endIcon)}\n </span>\n )\n }\n return null\n }\n\n // Separate DevalokGrain elements (need to be direct button children for absolute positioning)\n // from text/other content (needs z-elevation above grain)\n const childArray = React.Children.toArray(children)\n const grainElements: React.ReactNode[] = []\n const contentElements: React.ReactNode[] = []\n childArray.forEach((child) => {\n if (React.isValidElement(child) && (child.type as { displayName?: string })?.displayName === 'DevalokGrain') {\n grainElements.push(child)\n } else {\n contentElements.push(child)\n }\n })\n\n const renderChildren = () => {\n if (loading && loadingPosition === 'center') {\n return (\n <span className=\"relative inline-flex items-center justify-center\">\n <span className=\"invisible\">{contentElements}</span>\n <span className=\"absolute inset-0 flex items-center justify-center\">\n <Spinner size={BUTTON_TO_SPINNER_SIZE[resolvedSize]} variant=\"bare\" />\n </span>\n </span>\n )\n }\n // Only wrap in z-elevated span when grain is present (to sit above grain layers).\n // Without grain, render children directly to preserve flex layout.\n if (grainElements.length > 0) {\n return <span>{contentElements}</span>\n }\n return <>{contentElements}</>\n }\n\n // Async feedback: override color to show green/red\n const feedbackColorClass = isAsyncFeedback\n ? asyncState === 'success'\n ? 'bg-success-9 text-success-fg border-transparent hover:bg-success-9'\n : 'bg-error-9 text-error-fg border-transparent hover:bg-error-9'\n : undefined\n\n // Async feedback icon — uses Icon's draw animation for pen-stroke effect\n const asyncFeedbackIcon = isAsyncFeedback ? (\n <span className={cn('inline-flex shrink-0 items-center justify-center pointer-events-none', startIcon && inset.start)}>\n <Icon icon={asyncState === 'success' ? IconCheck : IconX} animate=\"draw\" />\n </span>\n ) : null\n\n const iconSize = BUTTON_TO_ICON_SIZE[resolvedSize] ?? 'md'\n\n const buttonEl = (\n <motion.button\n {...motionProps(props)}\n style={{ ...props.style, ...groupRadiusStyle }}\n className={cn(\n buttonVariants({\n // When processing (and not showing async feedback), force soft variant so ants pop\n variant: isProcessing && !isAsyncFeedback && resolvedVariant !== 'ghost' && resolvedVariant !== 'outline' && resolvedVariant !== 'link' ? 'soft' : resolvedVariant,\n color: resolvedColor,\n weight: resolvedWeight,\n size: resolvedSize,\n }),\n resolvedShape === 'pill' && 'rounded-pill',\n resolvedShape === 'pill' && pillPaddingClass[resolvedSize],\n (fullWidth || groupStretch) && 'w-full',\n // Asymmetric timing: hover-out is slow+relaxed, hover-in is fast+snappy (applied via hover: override)\n !loading && !isAsyncFeedback && 'transition-[color,background-color,border-color,box-shadow,transform,filter] duration-moderate-01 ease-productive-exit',\n !loading && !isAsyncFeedback && 'hover:duration-fast-02 hover:ease-productive-entrance',\n !loading && !isAsyncFeedback && 'active:scale-[0.95] active:brightness-[0.92] active:saturate-[1.1] active:duration-[0ms]',\n feedbackColorClass,\n isAsyncFeedback && 'transition-colors duration-moderate-01 ease-productive-standard',\n isProcessing && processingDisabled && 'pointer-events-none cursor-default',\n className,\n )}\n ref={(el: HTMLButtonElement | null) => {\n btnRef.current = el\n if (typeof ref === 'function') ref(el)\n else if (ref) (ref as React.MutableRefObject<HTMLButtonElement | null>).current = el\n }}\n disabled={resolvedDisabled || (loading && !isProcessing)}\n aria-busy={loading || isProcessing || undefined}\n aria-disabled={isProcessing && processingDisabled || undefined}\n onClick={isAsync ? handleAsyncClick : (isProcessing && processingDisabled ? undefined : onClick)}\n >\n {/* Grain layers render as direct children (need absolute positioning) */}\n {grainElements}\n {/* Content renders above grain via z-[2] span wrapper */}\n {isAsyncFeedback ? asyncFeedbackIcon : renderStartSlot()}\n {isAsyncFeedback ? contentElements : renderChildren()}\n {isAsyncFeedback ? null : renderEndSlot()}\n </motion.button>\n )\n\n // Always wrap in a positioned container so the overlay can render\n // as a sibling OUTSIDE the button (not affected by disabled opacity).\n // Keeping the wrapper always-on prevents React unmount/remount on\n // processing toggle, enabling smooth CSS transitions between states.\n return (\n <IconProvider size={iconSize}>\n <span\n ref={wrapperRef}\n className={cn('relative inline-flex', fullWidth && 'w-full')}\n style={{\n ...(fullWidth || groupStretch || prefersReduced ? undefined : { transition: 'width 0.2s cubic-bezier(0.25, 0.1, 0.25, 1)' }),\n ...groupRadiusStyle,\n }}\n >\n {buttonEl}\n <ProcessingOverlay\n active={isProcessing}\n speed={processingSpeed ?? 'working'}\n color={resolvedProcessingColor}\n />\n </span>\n </IconProvider>\n )\n },\n)\nButton.displayName = 'Button'\n\nexport { Button }\n"],"mappings":";;;;;;;;;;;;;;;;AAoBA,IAAa,IAAiB,EAC5B,qZACA;CACE,UAAU;EACR,SAAS;GACP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
1
1
  "use client";
2
2
  import { motionProps as e, springs as t } from "./lib/motion.js";
3
- import { t as n } from "../_chunks/vendor-utils.js";
3
+ import { cva as n } from "../_chunks/vendor-utils.js";
4
4
  import { cn as r } from "./lib/utils.js";
5
5
  import * as i from "react";
6
6
  import { jsx as a } from "react/jsx-runtime";
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { motionProps as e, tweens as t } from "../lib/motion.js";
3
3
  import { cn as n } from "../lib/utils.js";
4
- import { n as r, r as i, t as a } from "../../_chunks/tooltip.js";
5
- import { r as o, t as s } from "../../_chunks/colors.js";
6
- import { n as c, t as l } from "../../_chunks/grid-lines.js";
7
- import { t as u } from "../../_chunks/chart-container.js";
4
+ import { ChartTooltip as r, Legend as i, useChartTooltip as a } from "../../_chunks/tooltip.js";
5
+ import { resolveColor as o, useReducedMotion as s } from "../../_chunks/colors.js";
6
+ import { Axis as c, GridLines as l } from "../../_chunks/grid-lines.js";
7
+ import { ChartContainer as u } from "../../_chunks/chart-container.js";
8
8
  import * as d from "react";
9
9
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
10
10
  import { motion as h } from "framer-motion";
@@ -12,7 +12,7 @@ import { scaleLinear as g, scalePoint as _ } from "d3-scale";
12
12
  import { area as v, curveLinear as y, curveMonotoneX as b, line as x, stack as S, stackOffsetNone as C, stackOrderNone as w } from "d3-shape";
13
13
  //#region src/ui/charts/area-chart.tsx
14
14
  var T = d.forwardRef(({ data: T, xKey: E, series: D, curved: O = !1, stacked: k = !1, fillOpacity: A = .3, gradient: j = !1, strokeWidth: M = 2, height: N = 300, showGrid: P = !0, showTooltip: F = !0, showLegend: I = !1, animate: L = !0, xLabel: R, yLabel: z, ariaLabel: B, className: V, ...H }, U) => {
15
- let { tooltip: W, show: G, hide: K } = r(), q = o(), J = L && !q, Y = D.map((e, t) => s(e.color, t)), X = d.useId();
15
+ let { tooltip: W, show: G, hide: K } = a(), q = s(), J = L && !q, Y = D.map((e, t) => o(e.color, t)), X = d.useId();
16
16
  return /* @__PURE__ */ m(h.div, {
17
17
  ref: U,
18
18
  className: n("relative", V),
@@ -161,7 +161,7 @@ var T = d.forwardRef(({ data: T, xKey: E, series: D, curved: O = !1, stacked: k
161
161
  ] });
162
162
  }
163
163
  }),
164
- F && /* @__PURE__ */ p(a, { state: W }),
164
+ F && /* @__PURE__ */ p(r, { state: W }),
165
165
  I && D.length > 1 && /* @__PURE__ */ p(i, {
166
166
  items: D.map((e, t) => ({
167
167
  label: e.label,
@@ -1,17 +1,17 @@
1
1
  "use client";
2
2
  import { motionProps as e, tweens as t } from "../lib/motion.js";
3
3
  import { cn as n } from "../lib/utils.js";
4
- import { n as r, r as i, t as a } from "../../_chunks/tooltip.js";
5
- import { r as o, t as s } from "../../_chunks/colors.js";
6
- import { n as c, t as l } from "../../_chunks/grid-lines.js";
7
- import { t as u } from "../../_chunks/chart-container.js";
4
+ import { ChartTooltip as r, Legend as i, useChartTooltip as a } from "../../_chunks/tooltip.js";
5
+ import { resolveColor as o, useReducedMotion as s } from "../../_chunks/colors.js";
6
+ import { Axis as c, GridLines as l } from "../../_chunks/grid-lines.js";
7
+ import { ChartContainer as u } from "../../_chunks/chart-container.js";
8
8
  import * as d from "react";
9
9
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
10
10
  import { motion as h } from "framer-motion";
11
11
  import { scaleBand as g, scaleLinear as _ } from "d3-scale";
12
12
  //#region src/ui/charts/bar-chart.tsx
13
13
  var v = d.forwardRef(({ data: d, xKey: v, yKey: y, orientation: b = "vertical", stacked: x = !1, grouped: S = !1, color: C, height: w = 300, showGrid: T = !0, showTooltip: E = !0, showLegend: D = !1, animate: O = !0, barRadius: k = 4, xLabel: A, yLabel: j, seriesLabels: M, ariaLabel: N, className: P, ...F }, I) => {
14
- let { tooltip: L, show: R, hide: z } = r(), B = o(), V = b === "vertical", H = O && !B, U = Array.isArray(y) ? y : [y], W = U.length > 1, G = W ? U.map((e, t) => s(Array.isArray(C) ? C[t] : typeof C == "string" ? C : void 0, t)) : [s(typeof C == "string" ? C : Array.isArray(C) ? C[0] : void 0, 0)];
14
+ let { tooltip: L, show: R, hide: z } = a(), B = s(), V = b === "vertical", H = O && !B, U = Array.isArray(y) ? y : [y], W = U.length > 1, G = W ? U.map((e, t) => o(Array.isArray(C) ? C[t] : typeof C == "string" ? C : void 0, t)) : [o(typeof C == "string" ? C : Array.isArray(C) ? C[0] : void 0, 0)];
15
15
  return /* @__PURE__ */ m(h.div, {
16
16
  ref: I,
17
17
  className: n("relative", P),
@@ -111,7 +111,7 @@ var v = d.forwardRef(({ data: d, xKey: v, yKey: y, orientation: b = "vertical",
111
111
  ] });
112
112
  }
113
113
  }),
114
- E && /* @__PURE__ */ p(a, { state: L }),
114
+ E && /* @__PURE__ */ p(r, { state: L }),
115
115
  D && W && /* @__PURE__ */ p(i, {
116
116
  items: U.map((e, t) => ({
117
117
  label: M?.[t] ?? e,
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import { t as e } from "../../_chunks/chart-container.js";
2
+ import { ChartContainer as e } from "../../_chunks/chart-container.js";
3
3
  export { e as ChartContainer };
@@ -1,14 +1,14 @@
1
1
  "use client";
2
2
  import { motionProps as e, tweens as t } from "../lib/motion.js";
3
3
  import { cn as n } from "../lib/utils.js";
4
- import { n as r, r as i, t as a } from "../../_chunks/colors.js";
4
+ import { getTransitionDuration as r, resolveColor as i, useReducedMotion as a } from "../../_chunks/colors.js";
5
5
  import * as o from "react";
6
6
  import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
7
  import { motion as l } from "framer-motion";
8
8
  import { arc as u } from "d3-shape";
9
9
  //#region src/ui/charts/gauge-chart.tsx
10
10
  var d = (e) => e * Math.PI / 180, f = o.forwardRef(({ value: o, max: f = 100, min: p = 0, label: m, valueLabel: h, color: g, trackColor: _ = "var(--color-surface-border)", height: v = 200, startAngle: y = -120, endAngle: b = 120, thickness: x = 16, animate: S = !0, className: C, ...w }, T) => {
11
- let E = i(), D = r(E, S ? 600 : 0), O = S && !E, k = a(g, 0), A = v, j = A / 2, M = Math.min(Math.max(o, p), f), N = f === p ? 0 : (M - p) / (f - p), P = y + (b - y) * N, F = typeof h == "function" ? h(M) : typeof h == "string" ? h : String(M), I = u().innerRadius(j - x).outerRadius(j).startAngle(d(y)).endAngle(d(b)).cornerRadius(x / 2), L = u().innerRadius(j - x).outerRadius(j).startAngle(d(y)).endAngle(d(P)).cornerRadius(x / 2), R = I(null) ?? "", z = L(null) ?? "";
11
+ let E = a(), D = r(E, S ? 600 : 0), O = S && !E, k = i(g, 0), A = v, j = A / 2, M = Math.min(Math.max(o, p), f), N = f === p ? 0 : (M - p) / (f - p), P = y + (b - y) * N, F = typeof h == "function" ? h(M) : typeof h == "string" ? h : String(M), I = u().innerRadius(j - x).outerRadius(j).startAngle(d(y)).endAngle(d(b)).cornerRadius(x / 2), L = u().innerRadius(j - x).outerRadius(j).startAngle(d(y)).endAngle(d(P)).cornerRadius(x / 2), R = I(null) ?? "", z = L(null) ?? "";
12
12
  return /* @__PURE__ */ s(l.div, {
13
13
  ref: T,
14
14
  className: n("inline-flex flex-col items-center", C),
@@ -1,6 +1,6 @@
1
1
  "use client";
2
- import { r as e } from "../../_chunks/tooltip.js";
3
- import { t } from "../../_chunks/chart-container.js";
2
+ import { Legend as e } from "../../_chunks/tooltip.js";
3
+ import { ChartContainer as t } from "../../_chunks/chart-container.js";
4
4
  import { AreaChart as n } from "./area-chart.js";
5
5
  import { BarChart as r } from "./bar-chart.js";
6
6
  import { GaugeChart as i } from "./gauge-chart.js";
@@ -1,10 +1,10 @@
1
1
  "use client";
2
2
  import { motionProps as e, tweens as t } from "../lib/motion.js";
3
3
  import { cn as n } from "../lib/utils.js";
4
- import { n as r, r as i, t as a } from "../../_chunks/tooltip.js";
5
- import { r as o, t as s } from "../../_chunks/colors.js";
6
- import { n as c, t as l } from "../../_chunks/grid-lines.js";
7
- import { t as u } from "../../_chunks/chart-container.js";
4
+ import { ChartTooltip as r, Legend as i, useChartTooltip as a } from "../../_chunks/tooltip.js";
5
+ import { resolveColor as o, useReducedMotion as s } from "../../_chunks/colors.js";
6
+ import { Axis as c, GridLines as l } from "../../_chunks/grid-lines.js";
7
+ import { ChartContainer as u } from "../../_chunks/chart-container.js";
8
8
  import * as d from "react";
9
9
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
10
10
  import { motion as h } from "framer-motion";
@@ -12,7 +12,7 @@ import { scaleLinear as g, scalePoint as _ } from "d3-scale";
12
12
  import { curveLinear as v, curveMonotoneX as y, line as b } from "d3-shape";
13
13
  //#region src/ui/charts/line-chart.tsx
14
14
  var x = d.forwardRef(({ data: d, xKey: x, series: S, curved: C = !1, showDots: w = !1, dotSize: T = 4, strokeWidth: E = 2, height: D = 300, showGrid: O = !0, showTooltip: k = !0, showLegend: A = !1, animate: j = !0, xLabel: M, yLabel: N, ariaLabel: P, className: F, ...I }, L) => {
15
- let { tooltip: R, show: z, hide: B } = r(), V = o(), H = j && !V, U = S.map((e, t) => s(e.color, t));
15
+ let { tooltip: R, show: z, hide: B } = a(), V = s(), H = j && !V, U = S.map((e, t) => o(e.color, t));
16
16
  return /* @__PURE__ */ m(h.div, {
17
17
  ref: L,
18
18
  className: n("relative", F),
@@ -119,7 +119,7 @@ var x = d.forwardRef(({ data: d, xKey: x, series: S, curved: C = !1, showDots: w
119
119
  ] });
120
120
  }
121
121
  }),
122
- k && /* @__PURE__ */ p(a, { state: R }),
122
+ k && /* @__PURE__ */ p(r, { state: R }),
123
123
  A && S.length > 1 && /* @__PURE__ */ p(i, {
124
124
  items: S.map((e, t) => ({
125
125
  label: e.label,
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { motionProps as e, tweens as t } from "../lib/motion.js";
3
3
  import { cn as n } from "../lib/utils.js";
4
- import { n as r, r as i, t as a } from "../../_chunks/tooltip.js";
5
- import { r as o, t as s } from "../../_chunks/colors.js";
4
+ import { ChartTooltip as r, Legend as i, useChartTooltip as a } from "../../_chunks/tooltip.js";
5
+ import { resolveColor as o, useReducedMotion as s } from "../../_chunks/colors.js";
6
6
  import * as c from "react";
7
7
  import { useEffect as l, useRef as u, useState as d } from "react";
8
8
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
@@ -10,7 +10,7 @@ import { motion as h } from "framer-motion";
10
10
  import { arc as g, pie as _ } from "d3-shape";
11
11
  //#region src/ui/charts/pie-chart.tsx
12
12
  var v = c.forwardRef(({ data: c, variant: v = "pie", innerRadius: y = .6, padAngle: b = 0, cornerRadius: x = 0, height: S = 300, showTooltip: C = !0, showLegend: w = !1, showLabels: T = !1, animate: E = !0, className: D, centerLabel: O, ariaLabel: k, ...A }, j) => {
13
- let M = u(null), [N, P] = d(0), [F, I] = d(null), { tooltip: L, show: R, hide: z } = r(), B = o(), V = E && !B;
13
+ let M = u(null), [N, P] = d(0), [F, I] = d(null), { tooltip: L, show: R, hide: z } = a(), B = s(), V = E && !B;
14
14
  l(() => {
15
15
  if (!M.current) return;
16
16
  let e = new ResizeObserver((e) => {
@@ -19,7 +19,7 @@ var v = c.forwardRef(({ data: c, variant: v = "pie", innerRadius: y = .6, padAng
19
19
  });
20
20
  return e.observe(M.current), () => e.disconnect();
21
21
  }, []);
22
- let H = (N > 0 ? Math.min(N, S) : S) / 2, U = v === "donut" ? H * y : 0, W = c.map((e, t) => s(e.color, t)), G = c.reduce((e, t) => e + t.value, 0), K = _().value((e) => e.value).padAngle(b).sort(null)(c), q = g().innerRadius(U).outerRadius(H - 2).cornerRadius(x), J = U + (H - 2 - U) * .7, Y = g().innerRadius(J).outerRadius(J);
22
+ let H = (N > 0 ? Math.min(N, S) : S) / 2, U = v === "donut" ? H * y : 0, W = c.map((e, t) => o(e.color, t)), G = c.reduce((e, t) => e + t.value, 0), K = _().value((e) => e.value).padAngle(b).sort(null)(c), q = g().innerRadius(U).outerRadius(H - 2).cornerRadius(x), J = U + (H - 2 - U) * .7, Y = g().innerRadius(J).outerRadius(J);
23
23
  return /* @__PURE__ */ m(h.div, {
24
24
  ref: (e) => {
25
25
  M.current = e, typeof j == "function" ? j(e) : j && (j.current = e);
@@ -97,7 +97,7 @@ var v = c.forwardRef(({ data: c, variant: v = "pie", innerRadius: y = .6, padAng
97
97
  })
98
98
  ]
99
99
  })
100
- }), C && /* @__PURE__ */ p(a, { state: L })] }), w && /* @__PURE__ */ p(i, {
100
+ }), C && /* @__PURE__ */ p(r, { state: L })] }), w && /* @__PURE__ */ p(i, {
101
101
  items: c.map((e, t) => ({
102
102
  label: e.label,
103
103
  color: W[t]
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { motionProps as e, tweens as t } from "../lib/motion.js";
3
3
  import { cn as n } from "../lib/utils.js";
4
- import { n as r, r as i, t as a } from "../../_chunks/tooltip.js";
5
- import { r as o, t as s } from "../../_chunks/colors.js";
4
+ import { ChartTooltip as r, Legend as i, useChartTooltip as a } from "../../_chunks/tooltip.js";
5
+ import { resolveColor as o, useReducedMotion as s } from "../../_chunks/colors.js";
6
6
  import * as c from "react";
7
7
  import { useEffect as l, useRef as u, useState as d } from "react";
8
8
  import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
@@ -10,7 +10,7 @@ import { motion as h } from "framer-motion";
10
10
  import { curveLinearClosed as g, lineRadial as _ } from "d3-shape";
11
11
  //#region src/ui/charts/radar-chart.tsx
12
12
  var v = c.forwardRef(({ data: c, axes: v, series: y, maxValue: b, levels: x = 5, fillOpacity: S = .25, showDots: C = !1, height: w = 300, showTooltip: T = !0, showLegend: E = !1, animate: D = !0, ariaLabel: O, className: k, ...A }, j) => {
13
- let M = u(null), [N, P] = d(0), { tooltip: F, show: I, hide: L } = r(), R = o(), z = D && !R;
13
+ let M = u(null), [N, P] = d(0), { tooltip: F, show: I, hide: L } = a(), R = s(), z = D && !R;
14
14
  l(() => {
15
15
  if (!M.current) return;
16
16
  let e = new ResizeObserver((e) => {
@@ -19,7 +19,7 @@ var v = c.forwardRef(({ data: c, axes: v, series: y, maxValue: b, levels: x = 5,
19
19
  });
20
20
  return e.observe(M.current), () => e.disconnect();
21
21
  }, []);
22
- let B = (N > 0 ? Math.min(N, w) : w) / 2 - 40, V = y.map((e, t) => s(e.color, t)), H = b ?? Math.max(...c.flatMap((e) => y.map((t) => Number(e[t.key]) || 0)), 1), U = 2 * Math.PI / v.length, W = _().radius((e) => B * e / H).angle((e, t) => t * U).curve(g), G = (e) => v.map((t, n) => Number(c[n]?.[e]) || 0), K = (e, t) => {
22
+ let B = (N > 0 ? Math.min(N, w) : w) / 2 - 40, V = y.map((e, t) => o(e.color, t)), H = b ?? Math.max(...c.flatMap((e) => y.map((t) => Number(e[t.key]) || 0)), 1), U = 2 * Math.PI / v.length, W = _().radius((e) => B * e / H).angle((e, t) => t * U).curve(g), G = (e) => v.map((t, n) => Number(c[n]?.[e]) || 0), K = (e, t) => {
23
23
  let n = U * e - Math.PI / 2, r = B * t / H;
24
24
  return {
25
25
  x: r * Math.cos(n),
@@ -156,7 +156,7 @@ var v = c.forwardRef(({ data: c, axes: v, series: y, maxValue: b, levels: x = 5,
156
156
  })
157
157
  ]
158
158
  })
159
- }), T && /* @__PURE__ */ p(a, { state: F })] }), E && /* @__PURE__ */ p(i, {
159
+ }), T && /* @__PURE__ */ p(r, { state: F })] }), E && /* @__PURE__ */ p(i, {
160
160
  items: y.map((e, t) => ({
161
161
  label: e.label,
162
162
  color: V[t]
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { cn as e } from "../lib/utils.js";
3
- import { r as t, t as n } from "../../_chunks/colors.js";
3
+ import { resolveColor as t, useReducedMotion as n } from "../../_chunks/colors.js";
4
4
  import * as r from "react";
5
5
  import { jsx as i, jsxs as a } from "react/jsx-runtime";
6
6
  import { motion as o } from "framer-motion";
@@ -11,7 +11,7 @@ var d = {
11
11
  duration: 1,
12
12
  ease: "easeOut"
13
13
  }, f = r.forwardRef(({ data: r, variant: f = "line", width: p = 120, height: m = 32, color: h, showLastDot: g = !1, strokeWidth: _ = 1.5, animate: v = !0, className: y, ...b }, x) => {
14
- let S = n(h, 0), C = t(), w = v && !C;
14
+ let S = t(h, 0), C = n(), w = v && !C;
15
15
  if (!r.length) return null;
16
16
  let T = f === "bar" ? 1 : _, E = p - T * 2, D = m - T * 2, O = s().domain([0, Math.max(r.length - 1, 1)]).range([T, T + E]), k = Math.min(...r), A = Math.max(...r), j = k === A ? [k - 1, A + 1] : [k, A], M = s().domain(j).range([T + D, T]);
17
17
  if (f === "bar") {
@@ -1,3 +1,3 @@
1
1
  "use client";
2
- import { a as e, c as t, i as n, n as r, o as i, r as a, s as o, t as s } from "../../_chunks/chat.js";
3
- export { t as DateSeparator, i as Message, e as MessageInput, n as MessageList, a as SystemMessage, r as TypingIndicator, s as UnreadSeparator, o as useMessageContext };
2
+ import { DateSeparator as e, Message as t, MessageInput as n, MessageList as r, SystemMessage as i, TypingIndicator as a, UnreadSeparator as o, useMessageContext as s } from "../../_chunks/chat.js";
3
+ export { e as DateSeparator, t as Message, n as MessageInput, r as MessageList, i as SystemMessage, a as TypingIndicator, o as UnreadSeparator, s as useMessageContext };
@@ -1,9 +1,9 @@
1
1
  "use client";
2
- import { Xt as e, Yt as t } from "../_chunks/primitives.js";
2
+ import { Checkbox as e, CheckboxIndicator as t } from "../_chunks/primitives.js";
3
3
  import { durations as n } from "./lib/motion.js";
4
4
  import { cn as r } from "./lib/utils.js";
5
5
  import { useFormField as i } from "./form.js";
6
- import { t as a } from "../_chunks/field-state.js";
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
9
  import { AnimatePresence as c, motion as l } from "framer-motion";
@@ -24,7 +24,7 @@ var u = {
24
24
  let S = _ !== void 0, [C, w] = o.useState(h ? "indeterminate" : !!y), T = i(), E = a(m, T.state), D = b["aria-describedby"] ?? T.helperTextId, O = b["aria-required"] ?? T.required, k = h ? "indeterminate" : S ? _ : C, A = k === !0 || k === "indeterminate", j = o.useCallback((e) => {
25
25
  S || w(e), v?.(e);
26
26
  }, [S, v]);
27
- return /* @__PURE__ */ s(t, {
27
+ return /* @__PURE__ */ s(e, {
28
28
  ref: x,
29
29
  checked: S || h ? k : void 0,
30
30
  defaultChecked: !S && !h ? y : void 0,
@@ -34,7 +34,7 @@ var u = {
34
34
  "aria-describedby": D,
35
35
  "aria-required": O || void 0,
36
36
  ...b,
37
- children: /* @__PURE__ */ s(c, { children: A && /* @__PURE__ */ s(e, {
37
+ children: /* @__PURE__ */ s(c, { children: A && /* @__PURE__ */ s(t, {
38
38
  forceMount: !0,
39
39
  asChild: !0,
40
40
  children: /* @__PURE__ */ s(l.span, {
@@ -84,6 +84,6 @@ var u = {
84
84
  }) })
85
85
  });
86
86
  });
87
- p.displayName = t.displayName;
87
+ p.displayName = e.displayName;
88
88
  //#endregion
89
89
  export { p as Checkbox };
@@ -1,14 +1,14 @@
1
1
  "use client";
2
- import { Bn as e, Rn as t, zn as n } from "../_chunks/primitives.js";
2
+ import { Content$3 as e, Root$9 as t, Trigger$10 as n } from "../_chunks/primitives.js";
3
3
  import { tweens as r } from "./lib/motion.js";
4
4
  import { cn as i } from "./lib/utils.js";
5
5
  import * as a from "react";
6
6
  import { jsx as o } from "react/jsx-runtime";
7
7
  import { motion as s } from "framer-motion";
8
8
  //#region src/ui/collapsible.tsx
9
- var c = n, l = e, u = a.forwardRef(({ className: e, children: n, ...a }, c) => /* @__PURE__ */ o(t, {
9
+ var c = t, l = n, u = a.forwardRef(({ className: t, children: n, ...a }, c) => /* @__PURE__ */ o(e, {
10
10
  ref: c,
11
- className: i("overflow-hidden data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up", e),
11
+ className: i("overflow-hidden data-[state=open]:animate-collapsible-down data-[state=closed]:animate-collapsible-up", t),
12
12
  ...a,
13
13
  children: /* @__PURE__ */ o(s.div, {
14
14
  initial: !1,
@@ -17,6 +17,6 @@ var c = n, l = e, u = a.forwardRef(({ className: e, children: n, ...a }, c) => /
17
17
  children: n
18
18
  })
19
19
  }));
20
- u.displayName = t.displayName;
20
+ u.displayName = e.displayName;
21
21
  //#endregion
22
22
  export { c as Collapsible, u as CollapsibleContent, l as CollapsibleTrigger };
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { durations as e, springs as t } from "./lib/motion.js";
3
3
  import { cn as n } from "./lib/utils.js";
4
- import { t as r } from "../_chunks/vendor-client.js";
5
- import { i, r as a, t as o } from "../_chunks/popover.js";
4
+ import { Z as r } from "../_chunks/vendor-client.js";
5
+ import { Popover as i, PopoverContent as a, PopoverTrigger as o } from "../_chunks/popover.js";
6
6
  import * as s from "react";
7
7
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
8
  import { AnimatePresence as u, motion as d } from "framer-motion";
@@ -174,10 +174,10 @@ var y = s.forwardRef(({ value: y = "#000000", onChange: b, presets: x, disabled:
174
174
  ref: k,
175
175
  className: n("inline-flex flex-col", D),
176
176
  ...O,
177
- children: /* @__PURE__ */ l(o, {
177
+ children: /* @__PURE__ */ l(i, {
178
178
  open: M,
179
179
  onOpenChange: H,
180
- children: [/* @__PURE__ */ c(i, {
180
+ children: [/* @__PURE__ */ c(o, {
181
181
  asChild: !0,
182
182
  children: E === "inline" ? /* @__PURE__ */ c(d.button, {
183
183
  type: "button",
@@ -1,13 +1,13 @@
1
1
  "use client";
2
- import { Gt as e, Jt as t, Kt as n, qt as r } from "../_chunks/primitives.js";
2
+ import { Content2$6 as e, Portal$3 as t, Root2$8 as n, Trigger$8 as r } from "../_chunks/primitives.js";
3
3
  import { IconProvider as ee } from "./icon-context.js";
4
4
  import { springs as te, tweens as ne } from "./lib/motion.js";
5
- import { t as i } from "../_chunks/vendor-utils.js";
5
+ import { cva as i } from "../_chunks/vendor-utils.js";
6
6
  import { cn as a } from "./lib/utils.js";
7
7
  import { Icon as o } from "./icon.js";
8
8
  import { useFormField as s } from "./form.js";
9
- import { t as c } from "../_chunks/normalize-icon.js";
10
- import { t as re } from "../_chunks/field-state.js";
9
+ import { normalizeIcon as c } from "../_chunks/normalize-icon.js";
10
+ import { resolveFieldState as re } from "../_chunks/field-state.js";
11
11
  import * as l from "react";
12
12
  import { Fragment as ie, jsx as u, jsxs as d } from "react/jsx-runtime";
13
13
  import { IconCheck as f, IconChevronDown as p, IconSearch as m, IconX as h } from "@tabler/icons-react";
@@ -126,7 +126,7 @@ var _ = {
126
126
  className: a("inline-flex items-center gap-ds-01 rounded-control-inner bg-accent-2", he),
127
127
  children: [t.label, /* @__PURE__ */ u("button", {
128
128
  type: "button",
129
- className: "inline-flex items-center justify-center rounded-pill outline-hidden hover:scale-110 hover:bg-surface-raised-hover transition-transform duration-fast-01 ease-productive-standard",
129
+ className: "inline-flex items-center justify-center rounded-pill outline-hidden hover:bg-surface-raised-hover transition-colors duration-fast-01 ease-productive-standard",
130
130
  onClick: (t) => de(t, e),
131
131
  "aria-label": `Remove ${t.label}`,
132
132
  tabIndex: -1,
@@ -158,13 +158,13 @@ var _ = {
158
158
  children: w
159
159
  });
160
160
  }, Q = s(), $ = re(M, Q.state), _e = $ === "error", ve = Q.helperTextId, ye = Q.required;
161
- return /* @__PURE__ */ u(r, {
161
+ return /* @__PURE__ */ u(n, {
162
162
  open: I,
163
163
  onOpenChange: fe,
164
164
  children: /* @__PURE__ */ d("div", {
165
165
  className: a("relative", le),
166
166
  ...N,
167
- children: [/* @__PURE__ */ u(t, {
167
+ children: [/* @__PURE__ */ u(r, {
168
168
  asChild: !0,
169
169
  disabled: E,
170
170
  children: /* @__PURE__ */ d("button", {
@@ -186,7 +186,7 @@ var _ = {
186
186
  className: a("ml-ds-02 shrink-0 opacity-50 transition-transform duration-fast-01 ease-productive-standard", I && "rotate-180")
187
187
  })]
188
188
  })
189
- }), /* @__PURE__ */ u(n, { children: /* @__PURE__ */ u(e, {
189
+ }), /* @__PURE__ */ u(t, { children: /* @__PURE__ */ u(e, {
190
190
  asChild: !0,
191
191
  sideOffset: 4,
192
192
  align: "start",