@epilot/spark-ui 0.15.2 → 0.16.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.
Files changed (148) hide show
  1. package/dist/components/accordion.cjs +4 -4
  2. package/dist/components/accordion.cjs.map +1 -1
  3. package/dist/components/accordion.d.ts +1 -1
  4. package/dist/components/accordion.js +4 -4
  5. package/dist/components/accordion.js.map +1 -1
  6. package/dist/components/attachment.cjs +3 -3
  7. package/dist/components/attachment.cjs.map +1 -1
  8. package/dist/components/attachment.js +3 -3
  9. package/dist/components/attachment.js.map +1 -1
  10. package/dist/components/badge.cjs +1 -1
  11. package/dist/components/badge.cjs.map +1 -1
  12. package/dist/components/badge.js +1 -1
  13. package/dist/components/badge.js.map +1 -1
  14. package/dist/components/bar-chart.js +1 -1
  15. package/dist/components/box.cjs +1 -1
  16. package/dist/components/box.cjs.map +1 -1
  17. package/dist/components/box.d.cts +1 -1
  18. package/dist/components/box.d.ts +1 -1
  19. package/dist/components/box.js +1 -1
  20. package/dist/components/box.js.map +1 -1
  21. package/dist/components/breadcrumbs.cjs +1 -1
  22. package/dist/components/breadcrumbs.cjs.map +1 -1
  23. package/dist/components/breadcrumbs.js +1 -1
  24. package/dist/components/breadcrumbs.js.map +1 -1
  25. package/dist/components/bubble.cjs +1 -1
  26. package/dist/components/bubble.cjs.map +1 -1
  27. package/dist/components/bubble.d.cts +1 -1
  28. package/dist/components/bubble.d.ts +1 -1
  29. package/dist/components/bubble.js +1 -1
  30. package/dist/components/bubble.js.map +1 -1
  31. package/dist/components/button.d.cts +2 -2
  32. package/dist/components/button.d.ts +2 -2
  33. package/dist/components/callout.d.cts +1 -1
  34. package/dist/components/callout.d.ts +1 -1
  35. package/dist/components/card.cjs +2 -2
  36. package/dist/components/card.cjs.map +1 -1
  37. package/dist/components/card.d.cts +1 -1
  38. package/dist/components/card.d.ts +1 -1
  39. package/dist/components/card.js +2 -2
  40. package/dist/components/card.js.map +1 -1
  41. package/dist/components/checkbox.cjs +1 -1
  42. package/dist/components/checkbox.cjs.map +1 -1
  43. package/dist/components/checkbox.js +1 -1
  44. package/dist/components/checkbox.js.map +1 -1
  45. package/dist/components/day-of-week-picker.cjs +2 -2
  46. package/dist/components/day-of-week-picker.cjs.map +1 -1
  47. package/dist/components/day-of-week-picker.js +2 -2
  48. package/dist/components/day-of-week-picker.js.map +1 -1
  49. package/dist/components/device-card.cjs +2 -2
  50. package/dist/components/device-card.cjs.map +1 -1
  51. package/dist/components/device-card.js +2 -2
  52. package/dist/components/device-card.js.map +1 -1
  53. package/dist/components/drawer.cjs +1 -1
  54. package/dist/components/drawer.cjs.map +1 -1
  55. package/dist/components/drawer.js +1 -1
  56. package/dist/components/drawer.js.map +1 -1
  57. package/dist/components/dropdown-menu.cjs +4 -4
  58. package/dist/components/dropdown-menu.cjs.map +1 -1
  59. package/dist/components/dropdown-menu.js +4 -4
  60. package/dist/components/dropdown-menu.js.map +1 -1
  61. package/dist/components/empty-state.cjs +1 -1
  62. package/dist/components/empty-state.cjs.map +1 -1
  63. package/dist/components/empty-state.js +1 -1
  64. package/dist/components/empty-state.js.map +1 -1
  65. package/dist/components/feed-in-hero.cjs +1 -1
  66. package/dist/components/feed-in-hero.cjs.map +1 -1
  67. package/dist/components/feed-in-hero.js +1 -1
  68. package/dist/components/feed-in-hero.js.map +1 -1
  69. package/dist/components/field.cjs +1 -1
  70. package/dist/components/field.cjs.map +1 -1
  71. package/dist/components/field.js +1 -1
  72. package/dist/components/field.js.map +1 -1
  73. package/dist/components/info-block.cjs +2 -2
  74. package/dist/components/info-block.cjs.map +1 -1
  75. package/dist/components/info-block.js +2 -2
  76. package/dist/components/info-block.js.map +1 -1
  77. package/dist/components/input-group.cjs +1 -1
  78. package/dist/components/input-group.cjs.map +1 -1
  79. package/dist/components/input-group.d.cts +1 -1
  80. package/dist/components/input-group.d.ts +1 -1
  81. package/dist/components/input-group.js +1 -1
  82. package/dist/components/input-group.js.map +1 -1
  83. package/dist/components/input-otp.cjs +1 -1
  84. package/dist/components/input-otp.cjs.map +1 -1
  85. package/dist/components/input-otp.js +1 -1
  86. package/dist/components/input-otp.js.map +1 -1
  87. package/dist/components/input.cjs +1 -1
  88. package/dist/components/input.cjs.map +1 -1
  89. package/dist/components/input.js +1 -1
  90. package/dist/components/input.js.map +1 -1
  91. package/dist/components/line-chart.cjs +1 -1
  92. package/dist/components/line-chart.js +2 -2
  93. package/dist/components/list.cjs +10 -10
  94. package/dist/components/list.cjs.map +1 -1
  95. package/dist/components/list.d.cts +1 -1
  96. package/dist/components/list.d.ts +1 -1
  97. package/dist/components/list.js +10 -10
  98. package/dist/components/list.js.map +1 -1
  99. package/dist/components/message-scroller.cjs +1 -1
  100. package/dist/components/message-scroller.js +1 -1
  101. package/dist/components/page-header.d.cts +1 -1
  102. package/dist/components/page-header.d.ts +1 -1
  103. package/dist/components/power-history-chart.cjs +1 -1
  104. package/dist/components/power-history-chart.js +2 -2
  105. package/dist/components/power-history.cjs +1 -1
  106. package/dist/components/power-history.js +1 -1
  107. package/dist/components/power-network.cjs +7 -7
  108. package/dist/components/power-network.cjs.map +1 -1
  109. package/dist/components/power-network.js +7 -7
  110. package/dist/components/power-network.js.map +1 -1
  111. package/dist/components/schedule-list.cjs +3 -3
  112. package/dist/components/schedule-list.cjs.map +1 -1
  113. package/dist/components/schedule-list.js +3 -3
  114. package/dist/components/schedule-list.js.map +1 -1
  115. package/dist/components/select.cjs +2 -2
  116. package/dist/components/select.cjs.map +1 -1
  117. package/dist/components/select.js +2 -2
  118. package/dist/components/select.js.map +1 -1
  119. package/dist/components/series-legend.cjs +1 -1
  120. package/dist/components/series-legend.cjs.map +1 -1
  121. package/dist/components/series-legend.js +1 -1
  122. package/dist/components/series-legend.js.map +1 -1
  123. package/dist/components/skeleton.cjs +1 -1
  124. package/dist/components/skeleton.cjs.map +1 -1
  125. package/dist/components/skeleton.js +1 -1
  126. package/dist/components/skeleton.js.map +1 -1
  127. package/dist/components/stat-card.cjs +1 -1
  128. package/dist/components/stat-card.cjs.map +1 -1
  129. package/dist/components/stat-card.js +1 -1
  130. package/dist/components/stat-card.js.map +1 -1
  131. package/dist/components/stepper.cjs +3 -3
  132. package/dist/components/stepper.cjs.map +1 -1
  133. package/dist/components/stepper.js +3 -3
  134. package/dist/components/stepper.js.map +1 -1
  135. package/dist/components/textarea.cjs +1 -1
  136. package/dist/components/textarea.cjs.map +1 -1
  137. package/dist/components/textarea.js +1 -1
  138. package/dist/components/textarea.js.map +1 -1
  139. package/dist/components/time-picker.cjs +1 -1
  140. package/dist/components/time-picker.cjs.map +1 -1
  141. package/dist/components/time-picker.js +1 -1
  142. package/dist/components/time-picker.js.map +1 -1
  143. package/dist/components/toast.cjs +1 -1
  144. package/dist/components/toast.cjs.map +1 -1
  145. package/dist/components/toast.js +1 -1
  146. package/dist/components/toast.js.map +1 -1
  147. package/dist/styles/theme.css +1 -2
  148. package/package.json +1 -1
@@ -61,7 +61,7 @@ const TimePicker = React$1.forwardRef(({ "aria-label": ariaLabel, className, dis
61
61
  if (snapped !== event.currentTarget.value) onValueChange(snapped);
62
62
  },
63
63
  "aria-label": ariaLabel,
64
- className: cn("h-10 w-full rounded-xl bg-base-gray-soft px-3 text-base font-medium text-gray tabular-nums transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className)
64
+ className: cn("h-10 w-full rounded-md bg-base-gray-soft px-3 text-base font-medium text-gray tabular-nums transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50", className)
65
65
  });
66
66
  });
67
67
  TimePicker.displayName = "TimePicker";
@@ -1 +1 @@
1
- {"version":3,"file":"time-picker.js","names":["React"],"sources":["../../src/components/time-picker.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\ninterface TimePickerProps {\n /** `HH:MM` 24-hour string. */\n value: string\n onValueChange: (next: string) => void\n disabled?: boolean\n /** Step in seconds (defaults to 60 — minute-resolution). */\n step?: number\n className?: string\n id?: string\n 'aria-label'?: string\n}\n\nconst MINUTES_PER_DAY = 24 * 60\n\n/**\n * Move `HH:mm` one grid step in `direction`, aligning to the `step` grid first.\n * A native `<input type=\"time\">` steps each focused segment by one unit and\n * ignores `step`, so callers that want arrow keys to move by a coarse step\n * (e.g. 5 minutes) route the arrow keys through this instead. Clamped to\n * `00:00`–`23:55` (no wrap); an off-grid start lands on the next grid point in\n * the pressed direction.\n */\nfunction stepGridValue(value: string, step: number, direction: 1 | -1): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const match = /^(\\d{1,2}):(\\d{2})/.exec(value)\n const base = match ? Number(match[1]) * 60 + Number(match[2]) : 0\n const next =\n direction === 1\n ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes\n : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes\n const lastOnGrid =\n Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes\n const clamped = Math.max(0, Math.min(next, lastOnGrid))\n const hh = String(Math.floor(clamped / 60)).padStart(2, '0')\n const mm = String(clamped % 60).padStart(2, '0')\n return `${hh}:${mm}`\n}\n\n/**\n * Round `HH:mm` to the nearest multiple of `step` (used to autofix a typed\n * off-grid value on blur). Already-on-grid values pass through unchanged (so a\n * seconds suffix is preserved); anything that isn't `HH:mm(:ss)` passes through.\n */\nfunction snapToNearestStep(value: string, step: number): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const match = /^(\\d{1,2}):(\\d{2})/.exec(value)\n if (!match) return value\n const minutes = Number(match[2])\n if (minutes % stepMinutes === 0) return value\n const total = Number(match[1]) * 60 + minutes\n const lastOnGrid =\n Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes\n const snapped = Math.min(\n Math.round(total / stepMinutes) * stepMinutes,\n lastOnGrid,\n )\n const hh = String(Math.floor(snapped / 60)).padStart(2, '0')\n const mm = String(snapped % 60).padStart(2, '0')\n return `${hh}:${mm}`\n}\n\nconst TimePicker = React.forwardRef<HTMLInputElement, TimePickerProps>(\n (\n {\n 'aria-label': ariaLabel,\n className,\n disabled,\n id,\n onValueChange,\n step = 60,\n value,\n },\n ref,\n ) => {\n const stepMinutes = Math.floor(step / 60)\n return (\n <input\n ref={ref}\n id={id}\n type=\"time\"\n value={value}\n step={step}\n disabled={disabled}\n onChange={(event) => onValueChange(event.target.value)}\n onKeyDown={(event) => {\n // Native arrows step the focused segment by one unit and ignore step;\n // for a coarse grid, drive up/down through the grid instead.\n if (stepMinutes <= 1) return\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return\n event.preventDefault()\n onValueChange(\n stepGridValue(value, step, event.key === 'ArrowUp' ? 1 : -1),\n )\n }}\n onBlur={(event) => {\n // Autofix a typed off-grid value to the closest grid point on blur.\n if (stepMinutes <= 1) return\n const snapped = snapToNearestStep(event.currentTarget.value, step)\n if (snapped !== event.currentTarget.value) onValueChange(snapped)\n }}\n aria-label={ariaLabel}\n className={cn(\n 'h-10 w-full rounded-xl bg-base-gray-soft px-3 text-base font-medium text-gray tabular-nums transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n />\n )\n },\n)\n\nTimePicker.displayName = 'TimePicker'\n\ninterface TimeRangePickerProps {\n start: string\n end: string\n onStartChange: (next: string) => void\n onEndChange: (next: string) => void\n disabled?: boolean\n startLabel?: string\n endLabel?: string\n /** Step in seconds, forwarded to both inputs (defaults to 60). */\n step?: number\n className?: string\n}\n\nfunction TimeRangePicker({\n className,\n disabled,\n end,\n endLabel = 'End',\n onEndChange,\n onStartChange,\n start,\n startLabel = 'Start',\n step,\n}: TimeRangePickerProps) {\n return (\n <div className={cn('grid grid-cols-2 gap-2', className)}>\n <label className=\"flex flex-col gap-1.5\">\n <span className=\"text-xs font-medium text-gray-light\">\n {startLabel}\n </span>\n <TimePicker\n value={start}\n onValueChange={onStartChange}\n disabled={disabled}\n step={step}\n aria-label={startLabel}\n />\n </label>\n <label className=\"flex flex-col gap-1.5\">\n <span className=\"text-xs font-medium text-gray-light\">{endLabel}</span>\n <TimePicker\n value={end}\n onValueChange={onEndChange}\n disabled={disabled}\n step={step}\n aria-label={endLabel}\n />\n </label>\n </div>\n )\n}\n\nexport { TimePicker, TimeRangePicker }\n"],"mappings":";;;;;AAeA,MAAM,kBAAkB;;;;;;;;;AAUxB,SAAS,cAAc,OAAe,MAAc,WAA2B;CAC7E,MAAM,cAAc,KAAK,MAAM,OAAO,EAAE;CACxC,IAAI,eAAe,GAAG,OAAO;CAC7B,MAAM,QAAQ,qBAAqB,KAAK,KAAK;CAC7C,MAAM,OAAO,QAAQ,OAAO,MAAM,EAAE,IAAI,KAAK,OAAO,MAAM,EAAE,IAAI;CAChE,MAAM,OACJ,cAAc,IACV,KAAK,MAAM,OAAO,WAAW,IAAI,cAAc,cAC/C,KAAK,KAAK,OAAO,WAAW,IAAI,cAAc;CACpD,MAAM,aACJ,KAAK,OAAO,kBAAkB,KAAK,WAAW,IAAI;CACpD,MAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,UAAU,CAAC;CAGtD,OAAO,GAFI,OAAO,KAAK,MAAM,UAAU,EAAE,CAAC,EAAE,SAAS,GAAG,GAE7C,EAAE,GADF,OAAO,UAAU,EAAE,EAAE,SAAS,GAAG,GAC3B;AACnB;;;;;;AAOA,SAAS,kBAAkB,OAAe,MAAsB;CAC9D,MAAM,cAAc,KAAK,MAAM,OAAO,EAAE;CACxC,IAAI,eAAe,GAAG,OAAO;CAC7B,MAAM,QAAQ,qBAAqB,KAAK,KAAK;CAC7C,IAAI,CAAC,OAAO,OAAO;CACnB,MAAM,UAAU,OAAO,MAAM,EAAE;CAC/B,IAAI,UAAU,gBAAgB,GAAG,OAAO;CACxC,MAAM,QAAQ,OAAO,MAAM,EAAE,IAAI,KAAK;CACtC,MAAM,aACJ,KA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CACE,oBAAC,QAAD;IAAM,WAAU;cAAuC;GAAe,CAAA,GACtE,oBAAC,YAAD;IACE,OAAO;IACP,eAAe;IACL;IACJ;IACN,cAAY;GACb,CAAA,CACI;IACJ;;AAET"}
1
+ {"version":3,"file":"time-picker.js","names":["React"],"sources":["../../src/components/time-picker.tsx"],"sourcesContent":["import * as React from 'react'\nimport { cn } from '../utils/cn'\n\ninterface TimePickerProps {\n /** `HH:MM` 24-hour string. */\n value: string\n onValueChange: (next: string) => void\n disabled?: boolean\n /** Step in seconds (defaults to 60 — minute-resolution). */\n step?: number\n className?: string\n id?: string\n 'aria-label'?: string\n}\n\nconst MINUTES_PER_DAY = 24 * 60\n\n/**\n * Move `HH:mm` one grid step in `direction`, aligning to the `step` grid first.\n * A native `<input type=\"time\">` steps each focused segment by one unit and\n * ignores `step`, so callers that want arrow keys to move by a coarse step\n * (e.g. 5 minutes) route the arrow keys through this instead. Clamped to\n * `00:00`–`23:55` (no wrap); an off-grid start lands on the next grid point in\n * the pressed direction.\n */\nfunction stepGridValue(value: string, step: number, direction: 1 | -1): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const match = /^(\\d{1,2}):(\\d{2})/.exec(value)\n const base = match ? Number(match[1]) * 60 + Number(match[2]) : 0\n const next =\n direction === 1\n ? Math.floor(base / stepMinutes) * stepMinutes + stepMinutes\n : Math.ceil(base / stepMinutes) * stepMinutes - stepMinutes\n const lastOnGrid =\n Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes\n const clamped = Math.max(0, Math.min(next, lastOnGrid))\n const hh = String(Math.floor(clamped / 60)).padStart(2, '0')\n const mm = String(clamped % 60).padStart(2, '0')\n return `${hh}:${mm}`\n}\n\n/**\n * Round `HH:mm` to the nearest multiple of `step` (used to autofix a typed\n * off-grid value on blur). Already-on-grid values pass through unchanged (so a\n * seconds suffix is preserved); anything that isn't `HH:mm(:ss)` passes through.\n */\nfunction snapToNearestStep(value: string, step: number): string {\n const stepMinutes = Math.floor(step / 60)\n if (stepMinutes <= 1) return value\n const match = /^(\\d{1,2}):(\\d{2})/.exec(value)\n if (!match) return value\n const minutes = Number(match[2])\n if (minutes % stepMinutes === 0) return value\n const total = Number(match[1]) * 60 + minutes\n const lastOnGrid =\n Math.floor((MINUTES_PER_DAY - 1) / stepMinutes) * stepMinutes\n const snapped = Math.min(\n Math.round(total / stepMinutes) * stepMinutes,\n lastOnGrid,\n )\n const hh = String(Math.floor(snapped / 60)).padStart(2, '0')\n const mm = String(snapped % 60).padStart(2, '0')\n return `${hh}:${mm}`\n}\n\nconst TimePicker = React.forwardRef<HTMLInputElement, TimePickerProps>(\n (\n {\n 'aria-label': ariaLabel,\n className,\n disabled,\n id,\n onValueChange,\n step = 60,\n value,\n },\n ref,\n ) => {\n const stepMinutes = Math.floor(step / 60)\n return (\n <input\n ref={ref}\n id={id}\n type=\"time\"\n value={value}\n step={step}\n disabled={disabled}\n onChange={(event) => onValueChange(event.target.value)}\n onKeyDown={(event) => {\n // Native arrows step the focused segment by one unit and ignore step;\n // for a coarse grid, drive up/down through the grid instead.\n if (stepMinutes <= 1) return\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') return\n event.preventDefault()\n onValueChange(\n stepGridValue(value, step, event.key === 'ArrowUp' ? 1 : -1),\n )\n }}\n onBlur={(event) => {\n // Autofix a typed off-grid value to the closest grid point on blur.\n if (stepMinutes <= 1) return\n const snapped = snapToNearestStep(event.currentTarget.value, step)\n if (snapped !== event.currentTarget.value) onValueChange(snapped)\n }}\n aria-label={ariaLabel}\n className={cn(\n 'h-10 w-full rounded-md bg-base-gray-soft px-3 text-base font-medium text-gray tabular-nums transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50',\n className,\n )}\n />\n )\n },\n)\n\nTimePicker.displayName = 'TimePicker'\n\ninterface TimeRangePickerProps {\n start: string\n end: string\n onStartChange: (next: string) => void\n onEndChange: (next: string) => void\n disabled?: boolean\n startLabel?: string\n endLabel?: string\n /** Step in seconds, forwarded to both inputs (defaults to 60). */\n step?: number\n className?: string\n}\n\nfunction TimeRangePicker({\n className,\n disabled,\n end,\n endLabel = 'End',\n onEndChange,\n onStartChange,\n start,\n startLabel = 'Start',\n step,\n}: TimeRangePickerProps) {\n return (\n <div className={cn('grid grid-cols-2 gap-2', className)}>\n <label className=\"flex flex-col gap-1.5\">\n <span className=\"text-xs font-medium text-gray-light\">\n {startLabel}\n </span>\n <TimePicker\n value={start}\n onValueChange={onStartChange}\n disabled={disabled}\n step={step}\n aria-label={startLabel}\n />\n </label>\n <label className=\"flex flex-col gap-1.5\">\n <span className=\"text-xs font-medium text-gray-light\">{endLabel}</span>\n <TimePicker\n value={end}\n onValueChange={onEndChange}\n disabled={disabled}\n step={step}\n aria-label={endLabel}\n />\n </label>\n </div>\n )\n}\n\nexport { TimePicker, TimeRangePicker }\n"],"mappings":";;;;;AAeA,MAAM,kBAAkB;;;;;;;;;AAUxB,SAAS,cAAc,OAAe,MAAc,WAA2B;CAC7E,MAAM,cAAc,KAAK,MAAM,OAAO,EAAE;CACxC,IAAI,eAAe,GAAG,OAAO;CAC7B,MAAM,QAAQ,qBAAqB,KAAK,KAAK;CAC7C,MAAM,OAAO,QAAQ,OAAO,MAAM,EAAE,IAAI,KAAK,OAAO,MAAM,EAAE,IAAI;CAChE,MAAM,OACJ,cAAc,IACV,KAAK,MAAM,OAAO,WAAW,IAAI,cAAc,cAC/C,KAAK,KAAK,OAAO,WAAW,IAAI,cAAc;CACpD,MAAM,aACJ,KAAK,OAAO,kBAAkB,KAAK,WAAW,IAAI;CACpD,MAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,MAAM,UAAU,CAAC;CAGtD,OAAO,GAFI,OAAO,KAAK,MAAM,UAAU,EAAE,CAAC,EAAE,SAAS,GAAG,GAE7C,EAAE,GADF,OAAO,UAAU,EAAE,EAAE,SAAS,GAAG,GAC3B;AACnB;;;;;;AAOA,S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WACA,UACA,KACA,WAAW,OACX,aACA,eACA,OACA,aAAa,SACb,QACuB;CACvB,OACE,qBAAC,OAAD;EAAK,WAAW,GAAG,0BAA0B,SAAS;YAAtD,CACE,qBAAC,SAAD;GAAO,WAAU;aAAjB,CACE,oBAAC,QAAD;IAAM,WAAU;cACb;GACG,CAAA,GACN,oBAAC,YAAD;IACE,OAAO;IACP,eAAe;IACL;IACJ;IACN,cAAY;GACb,CAAA,CACI;MACP,qBAAC,SAAD;GAAO,WAAU;aAAjB,CACE,oBAAC,QAAD;IAAM,WAAU;cAAuC;GAAe,CAAA,GACtE,oBAAC,YAAD;IACE,OAAO;IACP,eAAe;IACL;IACJ;IACN,cAAY;GACb,CAAA,CACI;IACJ;;AAET"}
@@ -118,7 +118,7 @@ function ToastItem({ closeButton, richColors, toast: toastObject }) {
118
118
  const showClose = toastObject.data?.closeButton ?? closeButton;
119
119
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_base_ui_react_toast.Toast.Root, {
120
120
  "data-slot": "toast",
121
- className: (0, cnfast.cn)("flex items-start gap-2 rounded-md border border-gray-a5 bg-gray-1 p-3 text-gray shadow-md select-none", richColors && tone),
121
+ className: (0, cnfast.cn)("flex items-start gap-2 rounded-lg border border-gray-a5 bg-gray-1 p-3 text-gray shadow-md select-none", richColors && tone),
122
122
  swipeDirection: [
123
123
  "up",
124
124
  "down",
@@ -1 +1 @@
1
- {"version":3,"file":"toast.cjs","names":["ToastPrimitive","Spinner","MaterialSymbol","buttonVariants"],"sources":["../../src/components/toast.tsx"],"sourcesContent":["'use client'\n\nimport { Toast as ToastPrimitive } from '@base-ui/react/toast'\nimport * as React from 'react'\nimport {\n MaterialSymbol,\n type MaterialSymbolIconName,\n} from '../icons/material-symbol'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\nimport { Spinner } from './spinner'\n\ntype ToastType = 'success' | 'info' | 'warning' | 'error' | 'loading'\n\ntype ToastPosition =\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right'\n\n// Per-toast overrides Base UI carries through untouched as opaque `data`.\ntype ToastData = { closeButton?: boolean }\n\n// `label` is the button's content; everything else a `<button>` takes passes\n// straight through, so a caller can set `className`, `disabled`, `type`, and\n// the rest without a new prop for each one.\ntype ToastAction = Omit<\n React.ComponentPropsWithoutRef<'button'>,\n 'children'\n> & {\n label: React.ReactNode\n}\n\ntype ToastOptions = {\n description?: React.ReactNode\n /** Auto-dismiss time in ms. `0` keeps the toast until dismissed. */\n duration?: number\n /** Reuse an id to update a toast in place instead of stacking a new one. */\n id?: string\n closeButton?: boolean\n action?: ToastAction\n onDismiss?: () => void\n /** `high` announces urgently (assertive); the default is polite. */\n priority?: 'low' | 'high'\n}\n\ntype ToastPromiseMessages<Value> = {\n loading: string\n success: string | ((value: Value) => string)\n error: string | ((error: unknown) => string)\n}\n\nconst TOAST_ICONS: Record<\n Exclude<ToastType, 'loading'>,\n { name: MaterialSymbolIconName; className: string }\n> = {\n success: { name: 'check_circle', className: 'text-success-light' },\n info: { name: 'info', className: 'text-info-light' },\n warning: { name: 'warning', className: 'text-warning-light' },\n error: { name: 'cancel', className: 'text-error-light' },\n}\n\n// Opaque radix steps (bg 2, border 6, text 11) so a floating toast never lets\n// page content bleed through the way the alpha `-soft` tokens would. The border\n// carries the tone too, otherwise a tinted toast keeps a grey outline.\nconst TONE_CLASSES: Record<Exclude<ToastType, 'loading'>, string> = {\n success: 'border-green-6 bg-green-2 text-green-11',\n info: 'border-blue-6 bg-blue-2 text-blue-11',\n warning: 'border-orange-6 bg-orange-2 text-orange-11',\n error: 'border-red-6 bg-red-2 text-red-11',\n}\n\n// Mobile-first: every position drops to a full-width stack at the top, which\n// is what the end-customer portal ships. `position` only takes effect from the\n// `sm` breakpoint up.\nconst POSITION_CLASSES: Record<ToastPosition, string> = {\n 'top-left': 'sm:top-4 sm:right-auto sm:bottom-auto sm:left-4',\n 'top-center':\n 'sm:top-4 sm:right-auto sm:bottom-auto sm:left-1/2 sm:-translate-x-1/2',\n 'top-right': 'sm:top-4 sm:right-4 sm:bottom-auto sm:left-auto',\n 'bottom-left': 'sm:top-auto sm:right-auto sm:bottom-4 sm:left-4',\n 'bottom-center':\n 'sm:top-auto sm:right-auto sm:bottom-4 sm:left-1/2 sm:-translate-x-1/2',\n 'bottom-right': 'sm:top-auto sm:right-4 sm:bottom-4 sm:left-auto',\n}\n\nconst manager = ToastPrimitive.createToastManager<ToastData>()\n\nlet sequence = 0\n\n// `label` names the content and `onClick` is wrapped, so neither reaches the\n// DOM button as-is; everything else does.\nfunction actionRest({\n label: _label,\n onClick: _onClick,\n ...rest\n}: ToastAction) {\n return rest\n}\n\nfunction toManagerOptions(\n id: string,\n title: React.ReactNode,\n type: ToastType | undefined,\n options: ToastOptions | undefined,\n) {\n const action = options?.action\n return {\n id,\n title,\n type,\n description: options?.description,\n timeout: options?.duration,\n priority: options?.priority,\n onClose: options?.onDismiss,\n // Base UI leaves the toast open after an action; dismissing matches what\n // callers expect from an \"Undo\" button.\n actionProps: action && {\n ...actionRest(action),\n children: action.label,\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n action.onClick?.(event)\n manager.close(id)\n },\n },\n data: { closeButton: options?.closeButton },\n }\n}\n\nconst emit =\n (type?: ToastType) =>\n (message: React.ReactNode, options?: ToastOptions): string => {\n // an id up front lets the action handler close the toast it belongs to\n const id = options?.id ?? `spark-toast-${(sequence += 1)}`\n return manager.add(toManagerOptions(id, message, type, options))\n }\n\n// A string phase becomes a titled toast of that type; an object phase keeps\n// whatever the caller set and only fills in the type.\nconst phase =\n <Value,>(\n value: ToastPromiseMessages<Value>[keyof ToastPromiseMessages<Value>],\n type: ToastType,\n ) =>\n (result: Value) => {\n const resolved = typeof value === 'function' ? value(result) : value\n return { title: resolved, type }\n }\n\nconst toast = Object.assign(emit(), {\n success: emit('success'),\n info: emit('info'),\n warning: emit('warning'),\n error: emit('error'),\n loading: emit('loading'),\n /** Dismiss one toast, or every toast when called without an id. */\n dismiss: (id?: string) => manager.close(id),\n promise: <Value,>(\n promiseValue: Promise<Value>,\n messages: ToastPromiseMessages<Value>,\n ) =>\n manager.promise(promiseValue, {\n loading: { title: messages.loading, type: 'loading' as const },\n success: phase(messages.success, 'success'),\n error: phase(messages.error as never, 'error'),\n }),\n})\n\nfunction ToastIcon({ type }: { type?: string }) {\n const icon = TOAST_ICONS[type as Exclude<ToastType, 'loading'>]\n if (type !== 'loading' && !icon) return null\n\n // Fixed box matching the title's line height, so the glyph and the spinner\n // both centre on the first line whether or not a description follows.\n return (\n <span\n aria-hidden=\"true\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center\"\n >\n {type === 'loading' ? (\n // Decorative: the toast already announces the loading message, so the\n // spinner must not add a second status live region.\n <Spinner\n className=\"text-gray-11\"\n label=\"\"\n role=\"presentation\"\n size=\"sm\"\n />\n ) : (\n <MaterialSymbol\n className={cn('[--spark-icon-size:20px]', icon.className)}\n name={icon.name}\n />\n )}\n </span>\n )\n}\n\nfunction ToastItem({\n closeButton,\n richColors,\n toast: toastObject,\n}: {\n closeButton: boolean\n richColors: boolean\n toast: ToastPrimitive.Root.ToastObject<ToastData>\n}) {\n const tone = TONE_CLASSES[toastObject.type as Exclude<ToastType, 'loading'>]\n const showClose = toastObject.data?.closeButton ?? closeButton\n\n return (\n <ToastPrimitive.Root\n data-slot=\"toast\"\n className={cn(\n // Skin only. All geometry (position, stacking, transitions, the\n // pointer bridge) lives in styles/index.css, because Tailwind's\n // `utilities` layer outranks `components` and a stray `bottom-0` here\n // would beat the stylesheet's `bottom: auto` on top-anchored stacks.\n // The border is what makes the cards behind the front one legible.\n 'flex items-start gap-2 rounded-md border border-gray-a5 bg-gray-1 p-3 text-gray shadow-md select-none',\n richColors && tone,\n )}\n // the stack is top-anchored on mobile and bottom-anchored above `sm`, so\n // both vertical directions have to dismiss\n swipeDirection={['up', 'down', 'right']}\n toast={toastObject}\n >\n <ToastIcon type={toastObject.type} />\n <ToastPrimitive.Content className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <ToastPrimitive.Title\n className=\"text-sm font-medium\"\n data-slot=\"toast-title\"\n />\n <ToastPrimitive.Description\n className={cn(\n 'text-sm',\n richColors && tone ? 'text-inherit' : 'text-gray-11',\n )}\n data-slot=\"toast-description\"\n />\n </ToastPrimitive.Content>\n {toastObject.actionProps ? (\n <ToastPrimitive.Action\n // -my-2 keeps the 36px control from stretching a single-line row past\n // the 20px text; self-center then lands it on the title when there is\n // no description, and mid-block when there is one\n className={cn(\n buttonVariants({ size: 'small', variant: 'primary' }),\n '-my-2 shrink-0 self-center rounded-full',\n )}\n data-slot=\"toast-action\"\n />\n ) : null}\n {showClose ? (\n <ToastPrimitive.Close\n aria-label=\"Close\"\n className={cn(\n buttonVariants({ size: 'icon-small', variant: 'tertiary' }),\n // -my-1: same reason as the action, for a 28px control\n '-my-1 -mr-1 size-7 shrink-0 self-center text-gray-11',\n )}\n data-slot=\"toast-close\"\n >\n <MaterialSymbol\n aria-hidden=\"true\"\n className=\"[--spark-icon-size:18px]\"\n name=\"close\"\n />\n </ToastPrimitive.Close>\n ) : null}\n </ToastPrimitive.Root>\n )\n}\n\nfunction ToastList({\n closeButton,\n richColors,\n}: {\n closeButton: boolean\n richColors: boolean\n}) {\n const { toasts } = ToastPrimitive.useToastManager<ToastData>()\n\n return toasts.map((toastObject) => (\n <ToastItem\n closeButton={closeButton}\n key={toastObject.id}\n richColors={richColors}\n toast={toastObject}\n />\n ))\n}\n\ntype ToasterProps = {\n className?: string\n /** Corner or edge the toasts stack in. */\n position?: ToastPosition\n /** Close button on every toast; a per-toast `closeButton` wins. */\n closeButton?: boolean\n /** Tinted surfaces for success/info/warning/error toasts. */\n richColors?: boolean\n /** Default auto-dismiss time in ms. `0` disables auto-dismiss. */\n duration?: number\n /** Toasts visible at once before older ones are marked `data-limited`. */\n limit?: number\n /**\n * Vertical edge below the `sm` breakpoint, where the stack is always\n * full-width and `position` does not apply. Defaults to `top`, matching the\n * end-customer portal.\n */\n mobilePosition?: 'top' | 'bottom'\n}\n\nfunction Toaster({\n className,\n closeButton = true,\n duration = 4000,\n limit,\n mobilePosition = 'top',\n position = 'bottom-right',\n richColors = true,\n}: ToasterProps) {\n return (\n <ToastPrimitive.Provider\n limit={limit}\n timeout={duration}\n toastManager={manager}\n >\n <ToastPrimitive.Portal>\n <ToastPrimitive.Viewport\n // block + zero height: the toasts are absolutely positioned against\n // this box's bottom edge, the way Base UI's stacked example works\n className={cn(\n 'fixed inset-x-4 z-50 block h-0 outline-none',\n mobilePosition === 'top' ? 'top-4' : 'bottom-4',\n 'sm:inset-x-auto sm:w-96 sm:max-w-[calc(100vw-2rem)]',\n POSITION_CLASSES[position],\n className,\n )}\n data-mobile-side={mobilePosition}\n data-side={position.startsWith('top') ? 'top' : 'bottom'}\n data-slot=\"toaster\"\n >\n <ToastList closeButton={closeButton} richColors={richColors} />\n </ToastPrimitive.Viewport>\n </ToastPrimitive.Portal>\n </ToastPrimitive.Provider>\n )\n}\n\nexport { Toaster, toast }\nexport type {\n ToastAction,\n ToasterProps,\n ToastOptions,\n ToastPosition,\n ToastPromiseMessages,\n ToastType,\n}\n"],"mappings":";;;;;;;;;;;;;AAsDA,MAAM,cAGF;CACF,SAAS;EAAE,MAAM;EAAgB,WAAW;CAAqB;CACjE,MAAM;EAAE,MAAM;EAAQ,WAAW;CAAkB;CACnD,SAAS;EAAE,MAAM;EAAW,WAAW;CAAqB;CAC5D,OAAO;EAAE,MAAM;EAAU,WAAW;CAAmB;AACzD;AAKA,MAAM,eAA8D;CAClE,SAAS;CACT,MAAM;CACN,SAAS;CACT,OAAO;AACT;AAKA,MAAM,mBAAkD;CACtD,YAAY;CACZ,cACE;CACF,aAAa;CACb,eAAe;CACf,iBACE;CACF,gBAAgB;AAClB;AAEA,MAAM,UAAUA,qBAAAA,MAAe,mBAA8B;AAE7D,IAAI,WAAW;AAIf,SAAS,WAAW,EAClB,OAAO,QACP,SAAS,UACT,GAAG,Q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V,iBAAA,GAAA,kBAAA,KAACD,8BAAAA,gBAAD;KACE,eAAY;KACZ,WAAU;KACV,MAAK;IACN,CAAA;GACmB,CAAA,IACpB;EACe;;AAEzB;AAEA,SAAS,UAAU,EACjB,aACA,cAIC;CACD,MAAM,EAAE,WAAWF,qBAAAA,MAAe,gBAA2B;CAE7D,OAAO,OAAO,KAAK,gBACjB,iBAAA,GAAA,kBAAA,KAAC,WAAD;EACe;EAED;EACZ,OAAO;CACR,GAHM,YAAY,EAGlB,CACF;AACH;AAsBA,SAAS,QAAQ,EACf,WACA,cAAc,MACd,WAAW,KACX,OACA,iBAAiB,OACjB,WAAW,gBACX,aAAa,QACE;CACf,OACE,iBAAA,GAAA,kBAAA,KAACA,qBAAAA,MAAe,UAAhB;EACS;EACP,SAAS;EACT,cAAc;YAEd,iBAAA,GAAA,kBAAA,KAACA,qBAAAA,MAAe,QAAhB,EAAA,UACE,iBAAA,GAAA,kBAAA,KAACA,qBAAAA,MAAe,UAAhB;GAGE,YAAA,GAAA,OAAA,IACE,+CACA,mBAAmB,QAAQ,UAAU,YACrC,uDACA,iBAAiB,WACjB,SACF;GACA,oBAAkB;GAClB,aAAW,SAAS,WAAW,KAAK,IAAI,QAAQ;GAChD,aAAU;aAEV,iBAAA,GAAA,kBAAA,KAAC,WAAD;IAAwB;IAAyB;GAAa,CAAA;EACvC,CAAA,EACJ,CAAA;CACA,CAAA;AAE7B"}
1
+ {"version":3,"file":"toast.cjs","names":["ToastPrimitive","Spinner","MaterialSymbol","buttonVariants"],"sources":["../../src/components/toast.tsx"],"sourcesContent":["'use client'\n\nimport { Toast as ToastPrimitive } from '@base-ui/react/toast'\nimport * as React from 'react'\nimport {\n MaterialSymbol,\n type MaterialSymbolIconName,\n} from '../icons/material-symbol'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\nimport { Spinner } from './spinner'\n\ntype ToastType = 'success' | 'info' | 'warning' | 'error' | 'loading'\n\ntype ToastPosition =\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right'\n\n// Per-toast overrides Base UI carries through untouched as opaque `data`.\ntype ToastData = { closeButton?: boolean }\n\n// `label` is the button's content; everything else a `<button>` takes passes\n// straight through, so a caller can set `className`, `disabled`, `type`, and\n// the rest without a new prop for each one.\ntype ToastAction = Omit<\n React.ComponentPropsWithoutRef<'button'>,\n 'children'\n> & {\n label: React.ReactNode\n}\n\ntype ToastOptions = {\n description?: React.ReactNode\n /** Auto-dismiss time in ms. `0` keeps the toast until dismissed. */\n duration?: number\n /** Reuse an id to update a toast in place instead of stacking a new one. */\n id?: string\n closeButton?: boolean\n action?: ToastAction\n onDismiss?: () => void\n /** `high` announces urgently (assertive); the default is polite. */\n priority?: 'low' | 'high'\n}\n\ntype ToastPromiseMessages<Value> = {\n loading: string\n success: string | ((value: Value) => string)\n error: string | ((error: unknown) => string)\n}\n\nconst TOAST_ICONS: Record<\n Exclude<ToastType, 'loading'>,\n { name: MaterialSymbolIconName; className: string }\n> = {\n success: { name: 'check_circle', className: 'text-success-light' },\n info: { name: 'info', className: 'text-info-light' },\n warning: { name: 'warning', className: 'text-warning-light' },\n error: { name: 'cancel', className: 'text-error-light' },\n}\n\n// Opaque radix steps (bg 2, border 6, text 11) so a floating toast never lets\n// page content bleed through the way the alpha `-soft` tokens would. The border\n// carries the tone too, otherwise a tinted toast keeps a grey outline.\nconst TONE_CLASSES: Record<Exclude<ToastType, 'loading'>, string> = {\n success: 'border-green-6 bg-green-2 text-green-11',\n info: 'border-blue-6 bg-blue-2 text-blue-11',\n warning: 'border-orange-6 bg-orange-2 text-orange-11',\n error: 'border-red-6 bg-red-2 text-red-11',\n}\n\n// Mobile-first: every position drops to a full-width stack at the top, which\n// is what the end-customer portal ships. `position` only takes effect from the\n// `sm` breakpoint up.\nconst POSITION_CLASSES: Record<ToastPosition, string> = {\n 'top-left': 'sm:top-4 sm:right-auto sm:bottom-auto sm:left-4',\n 'top-center':\n 'sm:top-4 sm:right-auto sm:bottom-auto sm:left-1/2 sm:-translate-x-1/2',\n 'top-right': 'sm:top-4 sm:right-4 sm:bottom-auto sm:left-auto',\n 'bottom-left': 'sm:top-auto sm:right-auto sm:bottom-4 sm:left-4',\n 'bottom-center':\n 'sm:top-auto sm:right-auto sm:bottom-4 sm:left-1/2 sm:-translate-x-1/2',\n 'bottom-right': 'sm:top-auto sm:right-4 sm:bottom-4 sm:left-auto',\n}\n\nconst manager = ToastPrimitive.createToastManager<ToastData>()\n\nlet sequence = 0\n\n// `label` names the content and `onClick` is wrapped, so neither reaches the\n// DOM button as-is; everything else does.\nfunction actionRest({\n label: _label,\n onClick: _onClick,\n ...rest\n}: ToastAction) {\n return rest\n}\n\nfunction toManagerOptions(\n id: string,\n title: React.ReactNode,\n type: ToastType | undefined,\n options: ToastOptions | undefined,\n) {\n const action = options?.action\n return {\n id,\n title,\n type,\n description: options?.description,\n timeout: options?.duration,\n priority: options?.priority,\n onClose: options?.onDismiss,\n // Base UI leaves the toast open after an action; dismissing matches what\n // callers expect from an \"Undo\" button.\n actionProps: action && {\n ...actionRest(action),\n children: action.label,\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n action.onClick?.(event)\n manager.close(id)\n },\n },\n data: { closeButton: options?.closeButton },\n }\n}\n\nconst emit =\n (type?: ToastType) =>\n (message: React.ReactNode, options?: ToastOptions): string => {\n // an id up front lets the action handler close the toast it belongs to\n const id = options?.id ?? `spark-toast-${(sequence += 1)}`\n return manager.add(toManagerOptions(id, message, type, options))\n }\n\n// A string phase becomes a titled toast of that type; an object phase keeps\n// whatever the caller set and only fills in the type.\nconst phase =\n <Value,>(\n value: ToastPromiseMessages<Value>[keyof ToastPromiseMessages<Value>],\n type: ToastType,\n ) =>\n (result: Value) => {\n const resolved = typeof value === 'function' ? value(result) : value\n return { title: resolved, type }\n }\n\nconst toast = Object.assign(emit(), {\n success: emit('success'),\n info: emit('info'),\n warning: emit('warning'),\n error: emit('error'),\n loading: emit('loading'),\n /** Dismiss one toast, or every toast when called without an id. */\n dismiss: (id?: string) => manager.close(id),\n promise: <Value,>(\n promiseValue: Promise<Value>,\n messages: ToastPromiseMessages<Value>,\n ) =>\n manager.promise(promiseValue, {\n loading: { title: messages.loading, type: 'loading' as const },\n success: phase(messages.success, 'success'),\n error: phase(messages.error as never, 'error'),\n }),\n})\n\nfunction ToastIcon({ type }: { type?: string }) {\n const icon = TOAST_ICONS[type as Exclude<ToastType, 'loading'>]\n if (type !== 'loading' && !icon) return null\n\n // Fixed box matching the title's line height, so the glyph and the spinner\n // both centre on the first line whether or not a description follows.\n return (\n <span\n aria-hidden=\"true\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center\"\n >\n {type === 'loading' ? (\n // Decorative: the toast already announces the loading message, so the\n // spinner must not add a second status live region.\n <Spinner\n className=\"text-gray-11\"\n label=\"\"\n role=\"presentation\"\n size=\"sm\"\n />\n ) : (\n <MaterialSymbol\n className={cn('[--spark-icon-size:20px]', icon.className)}\n name={icon.name}\n />\n )}\n </span>\n )\n}\n\nfunction ToastItem({\n closeButton,\n richColors,\n toast: toastObject,\n}: {\n closeButton: boolean\n richColors: boolean\n toast: ToastPrimitive.Root.ToastObject<ToastData>\n}) {\n const tone = TONE_CLASSES[toastObject.type as Exclude<ToastType, 'loading'>]\n const showClose = toastObject.data?.closeButton ?? closeButton\n\n return (\n <ToastPrimitive.Root\n data-slot=\"toast\"\n className={cn(\n // Skin only. All geometry (position, stacking, transitions, the\n // pointer bridge) lives in styles/index.css, because Tailwind's\n // `utilities` layer outranks `components` and a stray `bottom-0` here\n // would beat the stylesheet's `bottom: auto` on top-anchored stacks.\n // The border is what makes the cards behind the front one legible.\n 'flex items-start gap-2 rounded-lg border border-gray-a5 bg-gray-1 p-3 text-gray shadow-md select-none',\n richColors && tone,\n )}\n // the stack is top-anchored on mobile and bottom-anchored above `sm`, so\n // both vertical directions have to dismiss\n swipeDirection={['up', 'down', 'right']}\n toast={toastObject}\n >\n <ToastIcon type={toastObject.type} />\n <ToastPrimitive.Content className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <ToastPrimitive.Title\n className=\"text-sm font-medium\"\n data-slot=\"toast-title\"\n />\n <ToastPrimitive.Description\n className={cn(\n 'text-sm',\n richColors && tone ? 'text-inherit' : 'text-gray-11',\n )}\n data-slot=\"toast-description\"\n />\n </ToastPrimitive.Content>\n {toastObject.actionProps ? (\n <ToastPrimitive.Action\n // -my-2 keeps the 36px control from stretching a single-line row past\n // the 20px text; self-center then lands it on the title when there is\n // no description, and mid-block when there is one\n className={cn(\n buttonVariants({ size: 'small', variant: 'primary' }),\n '-my-2 shrink-0 self-center rounded-full',\n )}\n data-slot=\"toast-action\"\n />\n ) : null}\n {showClose ? (\n <ToastPrimitive.Close\n aria-label=\"Close\"\n className={cn(\n buttonVariants({ size: 'icon-small', variant: 'tertiary' }),\n // -my-1: same reason as the action, for a 28px control\n '-my-1 -mr-1 size-7 shrink-0 self-center text-gray-11',\n )}\n data-slot=\"toast-close\"\n >\n <MaterialSymbol\n aria-hidden=\"true\"\n className=\"[--spark-icon-size:18px]\"\n name=\"close\"\n />\n </ToastPrimitive.Close>\n ) : null}\n </ToastPrimitive.Root>\n )\n}\n\nfunction ToastList({\n closeButton,\n richColors,\n}: {\n closeButton: boolean\n richColors: boolean\n}) {\n const { toasts } = ToastPrimitive.useToastManager<ToastData>()\n\n return toasts.map((toastObject) => (\n <ToastItem\n closeButton={closeButton}\n key={toastObject.id}\n richColors={richColors}\n toast={toastObject}\n />\n ))\n}\n\ntype ToasterProps = {\n className?: string\n /** Corner or edge the toasts stack in. */\n position?: ToastPosition\n /** Close button on every toast; a per-toast `closeButton` wins. */\n closeButton?: boolean\n /** Tinted surfaces for success/info/warning/error toasts. */\n richColors?: boolean\n /** Default auto-dismiss time in ms. `0` disables auto-dismiss. */\n duration?: number\n /** Toasts visible at once before older ones are marked `data-limited`. */\n limit?: number\n /**\n * Vertical edge below the `sm` breakpoint, where the stack is always\n * full-width and `position` does not apply. Defaults to `top`, matching the\n * end-customer portal.\n */\n mobilePosition?: 'top' | 'bottom'\n}\n\nfunction Toaster({\n className,\n closeButton = true,\n duration = 4000,\n limit,\n mobilePosition = 'top',\n position = 'bottom-right',\n richColors = true,\n}: ToasterProps) {\n return (\n <ToastPrimitive.Provider\n limit={limit}\n timeout={duration}\n toastManager={manager}\n >\n <ToastPrimitive.Portal>\n <ToastPrimitive.Viewport\n // block + zero height: the toasts are absolutely positioned against\n // this box's bottom edge, the way Base UI's stacked example works\n className={cn(\n 'fixed inset-x-4 z-50 block h-0 outline-none',\n mobilePosition === 'top' ? 'top-4' : 'bottom-4',\n 'sm:inset-x-auto sm:w-96 sm:max-w-[calc(100vw-2rem)]',\n POSITION_CLASSES[position],\n className,\n )}\n data-mobile-side={mobilePosition}\n data-side={position.startsWith('top') ? 'top' : 'bottom'}\n data-slot=\"toaster\"\n >\n <ToastList closeButton={closeButton} richColors={richColors} />\n </ToastPrimitive.Viewport>\n </ToastPrimitive.Portal>\n </ToastPrimitive.Provider>\n )\n}\n\nexport { Toaster, toast }\nexport type {\n ToastAction,\n ToasterProps,\n ToastOptions,\n ToastPosition,\n ToastPromiseMessages,\n ToastType,\n}\n"],"mappings":";;;;;;;;;;;;;AAsDA,MAAM,cAGF;CACF,SAAS;EAAE,MAAM;EAAgB,WAAW;CAAqB;CACjE,MAAM;EAAE,MAAM;EAAQ,WAAW;CAAkB;CACnD,SAAS;EAAE,MAAM;EAAW,WAAW;CAAqB;CAC5D,OAAO;EAAE,MAAM;EAAU,WAAW;CAAmB;AACzD;AAKA,MAAM,eAA8D;CAClE,SAAS;CACT,MAAM;CACN,SAAS;CACT,OAAO;AACT;AAKA,MAAM,mBAAkD;CACtD,YAAY;CACZ,cACE;CACF,aAAa;CACb,eAAe;CACf,iBACE;CACF,gBAAgB;AAClB;AAEA,MAAM,UAAUA,qBAAAA,MAAe,mBAA8B;AAE7D,IAAI,WAAW;AAIf,SAAS,WAAW,EAClB,OAAO,QACP,SAAS,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A,aAAU;cAEV,iBAAA,GAAA,kBAAA,KAACD,8BAAAA,gBAAD;KACE,eAAY;KACZ,WAAU;KACV,MAAK;IACN,CAAA;GACmB,CAAA,IACpB;EACe;;AAEzB;AAEA,SAAS,UAAU,EACjB,aACA,cAIC;CACD,MAAM,EAAE,WAAWF,qBAAAA,MAAe,gBAA2B;CAE7D,OAAO,OAAO,KAAK,gBACjB,iBAAA,GAAA,kBAAA,KAAC,WAAD;EACe;EAED;EACZ,OAAO;CACR,GAHM,YAAY,EAGlB,CACF;AACH;AAsBA,SAAS,QAAQ,EACf,WACA,cAAc,MACd,WAAW,KACX,OACA,iBAAiB,OACjB,WAAW,gBACX,aAAa,QACE;CACf,OACE,iBAAA,GAAA,kBAAA,KAACA,qBAAAA,MAAe,UAAhB;EACS;EACP,SAAS;EACT,cAAc;YAEd,iBAAA,GAAA,kBAAA,KAACA,qBAAAA,MAAe,QAAhB,EAAA,UACE,iBAAA,GAAA,kBAAA,KAACA,qBAAAA,MAAe,UAAhB;GAGE,YAAA,GAAA,OAAA,IACE,+CACA,mBAAmB,QAAQ,UAAU,YACrC,uDACA,iBAAiB,WACjB,SACF;GACA,oBAAkB;GAClB,aAAW,SAAS,WAAW,KAAK,IAAI,QAAQ;GAChD,aAAU;aAEV,iBAAA,GAAA,kBAAA,KAAC,WAAD;IAAwB;IAAyB;GAAa,CAAA;EACvC,CAAA,EACJ,CAAA;CACA,CAAA;AAE7B"}
@@ -115,7 +115,7 @@ function ToastItem({ closeButton, richColors, toast: toastObject }) {
115
115
  const showClose = toastObject.data?.closeButton ?? closeButton;
116
116
  return /* @__PURE__ */ jsxs(Toast.Root, {
117
117
  "data-slot": "toast",
118
- className: cn("flex items-start gap-2 rounded-md border border-gray-a5 bg-gray-1 p-3 text-gray shadow-md select-none", richColors && tone),
118
+ className: cn("flex items-start gap-2 rounded-lg border border-gray-a5 bg-gray-1 p-3 text-gray shadow-md select-none", richColors && tone),
119
119
  swipeDirection: [
120
120
  "up",
121
121
  "down",
@@ -1 +1 @@
1
- {"version":3,"file":"toast.js","names":["ToastPrimitive"],"sources":["../../src/components/toast.tsx"],"sourcesContent":["'use client'\n\nimport { Toast as ToastPrimitive } from '@base-ui/react/toast'\nimport * as React from 'react'\nimport {\n MaterialSymbol,\n type MaterialSymbolIconName,\n} from '../icons/material-symbol'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\nimport { Spinner } from './spinner'\n\ntype ToastType = 'success' | 'info' | 'warning' | 'error' | 'loading'\n\ntype ToastPosition =\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right'\n\n// Per-toast overrides Base UI carries through untouched as opaque `data`.\ntype ToastData = { closeButton?: boolean }\n\n// `label` is the button's content; everything else a `<button>` takes passes\n// straight through, so a caller can set `className`, `disabled`, `type`, and\n// the rest without a new prop for each one.\ntype ToastAction = Omit<\n React.ComponentPropsWithoutRef<'button'>,\n 'children'\n> & {\n label: React.ReactNode\n}\n\ntype ToastOptions = {\n description?: React.ReactNode\n /** Auto-dismiss time in ms. `0` keeps the toast until dismissed. */\n duration?: number\n /** Reuse an id to update a toast in place instead of stacking a new one. */\n id?: string\n closeButton?: boolean\n action?: ToastAction\n onDismiss?: () => void\n /** `high` announces urgently (assertive); the default is polite. */\n priority?: 'low' | 'high'\n}\n\ntype ToastPromiseMessages<Value> = {\n loading: string\n success: string | ((value: Value) => string)\n error: string | ((error: unknown) => string)\n}\n\nconst TOAST_ICONS: Record<\n Exclude<ToastType, 'loading'>,\n { name: MaterialSymbolIconName; className: string }\n> = {\n success: { name: 'check_circle', className: 'text-success-light' },\n info: { name: 'info', className: 'text-info-light' },\n warning: { name: 'warning', className: 'text-warning-light' },\n error: { name: 'cancel', className: 'text-error-light' },\n}\n\n// Opaque radix steps (bg 2, border 6, text 11) so a floating toast never lets\n// page content bleed through the way the alpha `-soft` tokens would. The border\n// carries the tone too, otherwise a tinted toast keeps a grey outline.\nconst TONE_CLASSES: Record<Exclude<ToastType, 'loading'>, string> = {\n success: 'border-green-6 bg-green-2 text-green-11',\n info: 'border-blue-6 bg-blue-2 text-blue-11',\n warning: 'border-orange-6 bg-orange-2 text-orange-11',\n error: 'border-red-6 bg-red-2 text-red-11',\n}\n\n// Mobile-first: every position drops to a full-width stack at the top, which\n// is what the end-customer portal ships. `position` only takes effect from the\n// `sm` breakpoint up.\nconst POSITION_CLASSES: Record<ToastPosition, string> = {\n 'top-left': 'sm:top-4 sm:right-auto sm:bottom-auto sm:left-4',\n 'top-center':\n 'sm:top-4 sm:right-auto sm:bottom-auto sm:left-1/2 sm:-translate-x-1/2',\n 'top-right': 'sm:top-4 sm:right-4 sm:bottom-auto sm:left-auto',\n 'bottom-left': 'sm:top-auto sm:right-auto sm:bottom-4 sm:left-4',\n 'bottom-center':\n 'sm:top-auto sm:right-auto sm:bottom-4 sm:left-1/2 sm:-translate-x-1/2',\n 'bottom-right': 'sm:top-auto sm:right-4 sm:bottom-4 sm:left-auto',\n}\n\nconst manager = ToastPrimitive.createToastManager<ToastData>()\n\nlet sequence = 0\n\n// `label` names the content and `onClick` is wrapped, so neither reaches the\n// DOM button as-is; everything else does.\nfunction actionRest({\n label: _label,\n onClick: _onClick,\n ...rest\n}: ToastAction) {\n return rest\n}\n\nfunction toManagerOptions(\n id: string,\n title: React.ReactNode,\n type: ToastType | undefined,\n options: ToastOptions | undefined,\n) {\n const action = options?.action\n return {\n id,\n title,\n type,\n description: options?.description,\n timeout: options?.duration,\n priority: options?.priority,\n onClose: options?.onDismiss,\n // Base UI leaves the toast open after an action; dismissing matches what\n // callers expect from an \"Undo\" button.\n actionProps: action && {\n ...actionRest(action),\n children: action.label,\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n action.onClick?.(event)\n manager.close(id)\n },\n },\n data: { closeButton: options?.closeButton },\n }\n}\n\nconst emit =\n (type?: ToastType) =>\n (message: React.ReactNode, options?: ToastOptions): string => {\n // an id up front lets the action handler close the toast it belongs to\n const id = options?.id ?? `spark-toast-${(sequence += 1)}`\n return manager.add(toManagerOptions(id, message, type, options))\n }\n\n// A string phase becomes a titled toast of that type; an object phase keeps\n// whatever the caller set and only fills in the type.\nconst phase =\n <Value,>(\n value: ToastPromiseMessages<Value>[keyof ToastPromiseMessages<Value>],\n type: ToastType,\n ) =>\n (result: Value) => {\n const resolved = typeof value === 'function' ? value(result) : value\n return { title: resolved, type }\n }\n\nconst toast = Object.assign(emit(), {\n success: emit('success'),\n info: emit('info'),\n warning: emit('warning'),\n error: emit('error'),\n loading: emit('loading'),\n /** Dismiss one toast, or every toast when called without an id. */\n dismiss: (id?: string) => manager.close(id),\n promise: <Value,>(\n promiseValue: Promise<Value>,\n messages: ToastPromiseMessages<Value>,\n ) =>\n manager.promise(promiseValue, {\n loading: { title: messages.loading, type: 'loading' as const },\n success: phase(messages.success, 'success'),\n error: phase(messages.error as never, 'error'),\n }),\n})\n\nfunction ToastIcon({ type }: { type?: string }) {\n const icon = TOAST_ICONS[type as Exclude<ToastType, 'loading'>]\n if (type !== 'loading' && !icon) return null\n\n // Fixed box matching the title's line height, so the glyph and the spinner\n // both centre on the first line whether or not a description follows.\n return (\n <span\n aria-hidden=\"true\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center\"\n >\n {type === 'loading' ? (\n // Decorative: the toast already announces the loading message, so the\n // spinner must not add a second status live region.\n <Spinner\n className=\"text-gray-11\"\n label=\"\"\n role=\"presentation\"\n size=\"sm\"\n />\n ) : (\n <MaterialSymbol\n className={cn('[--spark-icon-size:20px]', icon.className)}\n name={icon.name}\n />\n )}\n </span>\n )\n}\n\nfunction ToastItem({\n closeButton,\n richColors,\n toast: toastObject,\n}: {\n closeButton: boolean\n richColors: boolean\n toast: ToastPrimitive.Root.ToastObject<ToastData>\n}) {\n const tone = TONE_CLASSES[toastObject.type as Exclude<ToastType, 'loading'>]\n const showClose = toastObject.data?.closeButton ?? closeButton\n\n return (\n <ToastPrimitive.Root\n data-slot=\"toast\"\n className={cn(\n // Skin only. All geometry (position, stacking, transitions, the\n // pointer bridge) lives in styles/index.css, because Tailwind's\n // `utilities` layer outranks `components` and a stray `bottom-0` here\n // would beat the stylesheet's `bottom: auto` on top-anchored stacks.\n // The border is what makes the cards behind the front one legible.\n 'flex items-start gap-2 rounded-md border border-gray-a5 bg-gray-1 p-3 text-gray shadow-md select-none',\n richColors && tone,\n )}\n // the stack is top-anchored on mobile and bottom-anchored above `sm`, so\n // both vertical directions have to dismiss\n swipeDirection={['up', 'down', 'right']}\n toast={toastObject}\n >\n <ToastIcon type={toastObject.type} />\n <ToastPrimitive.Content className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <ToastPrimitive.Title\n className=\"text-sm font-medium\"\n data-slot=\"toast-title\"\n />\n <ToastPrimitive.Description\n className={cn(\n 'text-sm',\n richColors && tone ? 'text-inherit' : 'text-gray-11',\n )}\n data-slot=\"toast-description\"\n />\n </ToastPrimitive.Content>\n {toastObject.actionProps ? (\n <ToastPrimitive.Action\n // -my-2 keeps the 36px control from stretching a single-line row past\n // the 20px text; self-center then lands it on the title when there is\n // no description, and mid-block when there is one\n className={cn(\n buttonVariants({ size: 'small', variant: 'primary' }),\n '-my-2 shrink-0 self-center rounded-full',\n )}\n data-slot=\"toast-action\"\n />\n ) : null}\n {showClose ? (\n <ToastPrimitive.Close\n aria-label=\"Close\"\n className={cn(\n buttonVariants({ size: 'icon-small', variant: 'tertiary' }),\n // -my-1: same reason as the action, for a 28px control\n '-my-1 -mr-1 size-7 shrink-0 self-center text-gray-11',\n )}\n data-slot=\"toast-close\"\n >\n <MaterialSymbol\n aria-hidden=\"true\"\n className=\"[--spark-icon-size:18px]\"\n name=\"close\"\n />\n </ToastPrimitive.Close>\n ) : null}\n </ToastPrimitive.Root>\n )\n}\n\nfunction ToastList({\n closeButton,\n richColors,\n}: {\n closeButton: boolean\n richColors: boolean\n}) {\n const { toasts } = ToastPrimitive.useToastManager<ToastData>()\n\n return toasts.map((toastObject) => (\n <ToastItem\n closeButton={closeButton}\n key={toastObject.id}\n richColors={richColors}\n toast={toastObject}\n />\n ))\n}\n\ntype ToasterProps = {\n className?: string\n /** Corner or edge the toasts stack in. */\n position?: ToastPosition\n /** Close button on every toast; a per-toast `closeButton` wins. */\n closeButton?: boolean\n /** Tinted surfaces for success/info/warning/error toasts. */\n richColors?: boolean\n /** Default auto-dismiss time in ms. `0` disables auto-dismiss. */\n duration?: number\n /** Toasts visible at once before older ones are marked `data-limited`. */\n limit?: number\n /**\n * Vertical edge below the `sm` breakpoint, where the stack is always\n * full-width and `position` does not apply. Defaults to `top`, matching the\n * end-customer portal.\n */\n mobilePosition?: 'top' | 'bottom'\n}\n\nfunction Toaster({\n className,\n closeButton = true,\n duration = 4000,\n limit,\n mobilePosition = 'top',\n position = 'bottom-right',\n richColors = true,\n}: ToasterProps) {\n return (\n <ToastPrimitive.Provider\n limit={limit}\n timeout={duration}\n toastManager={manager}\n >\n <ToastPrimitive.Portal>\n <ToastPrimitive.Viewport\n // block + zero height: the toasts are absolutely positioned against\n // this box's bottom edge, the way Base UI's stacked example works\n className={cn(\n 'fixed inset-x-4 z-50 block h-0 outline-none',\n mobilePosition === 'top' ? 'top-4' : 'bottom-4',\n 'sm:inset-x-auto sm:w-96 sm:max-w-[calc(100vw-2rem)]',\n POSITION_CLASSES[position],\n className,\n )}\n data-mobile-side={mobilePosition}\n data-side={position.startsWith('top') ? 'top' : 'bottom'}\n data-slot=\"toaster\"\n >\n <ToastList closeButton={closeButton} richColors={richColors} />\n </ToastPrimitive.Viewport>\n </ToastPrimitive.Portal>\n </ToastPrimitive.Provider>\n )\n}\n\nexport { Toaster, toast }\nexport type {\n ToastAction,\n ToasterProps,\n ToastOptions,\n ToastPosition,\n ToastPromiseMessages,\n ToastType,\n}\n"],"mappings":";;;;;;;;;;AAsDA,MAAM,cAGF;CACF,SAAS;EAAE,MAAM;EAAgB,WAAW;CAAqB;CACjE,MAAM;EAAE,MAAM;EAAQ,WAAW;CAAkB;CACnD,SAAS;EAAE,MAAM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AEV,oBAAC,gBAAD;KACE,eAAY;KACZ,WAAU;KACV,MAAK;IACN,CAAA;GACmB,CAAA,IACpB;EACe;;AAEzB;AAEA,SAAS,UAAU,EACjB,aACA,cAIC;CACD,MAAM,EAAE,WAAWA,MAAe,gBAA2B;CAE7D,OAAO,OAAO,KAAK,gBACjB,oBAAC,WAAD;EACe;EAED;EACZ,OAAO;CACR,GAHM,YAAY,EAGlB,CACF;AACH;AAsBA,SAAS,QAAQ,EACf,WACA,cAAc,MACd,WAAW,KACX,OACA,iBAAiB,OACjB,WAAW,gBACX,aAAa,QACE;CACf,OACE,oBAACA,MAAe,UAAhB;EACS;EACP,SAAS;EACT,cAAc;YAEd,oBAACA,MAAe,QAAhB,EAAA,UACE,oBAACA,MAAe,UAAhB;GAGE,WAAW,GACT,+CACA,mBAAmB,QAAQ,UAAU,YACrC,uDACA,iBAAiB,WACjB,SACF;GACA,oBAAkB;GAClB,aAAW,SAAS,WAAW,KAAK,IAAI,QAAQ;GAChD,aAAU;aAEV,oBAAC,WAAD;IAAwB;IAAyB;GAAa,CAAA;EACvC,CAAA,EACJ,CAAA;CACA,CAAA;AAE7B"}
1
+ {"version":3,"file":"toast.js","names":["ToastPrimitive"],"sources":["../../src/components/toast.tsx"],"sourcesContent":["'use client'\n\nimport { Toast as ToastPrimitive } from '@base-ui/react/toast'\nimport * as React from 'react'\nimport {\n MaterialSymbol,\n type MaterialSymbolIconName,\n} from '../icons/material-symbol'\nimport { cn } from '../utils/cn'\nimport { buttonVariants } from './button'\nimport { Spinner } from './spinner'\n\ntype ToastType = 'success' | 'info' | 'warning' | 'error' | 'loading'\n\ntype ToastPosition =\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right'\n\n// Per-toast overrides Base UI carries through untouched as opaque `data`.\ntype ToastData = { closeButton?: boolean }\n\n// `label` is the button's content; everything else a `<button>` takes passes\n// straight through, so a caller can set `className`, `disabled`, `type`, and\n// the rest without a new prop for each one.\ntype ToastAction = Omit<\n React.ComponentPropsWithoutRef<'button'>,\n 'children'\n> & {\n label: React.ReactNode\n}\n\ntype ToastOptions = {\n description?: React.ReactNode\n /** Auto-dismiss time in ms. `0` keeps the toast until dismissed. */\n duration?: number\n /** Reuse an id to update a toast in place instead of stacking a new one. */\n id?: string\n closeButton?: boolean\n action?: ToastAction\n onDismiss?: () => void\n /** `high` announces urgently (assertive); the default is polite. */\n priority?: 'low' | 'high'\n}\n\ntype ToastPromiseMessages<Value> = {\n loading: string\n success: string | ((value: Value) => string)\n error: string | ((error: unknown) => string)\n}\n\nconst TOAST_ICONS: Record<\n Exclude<ToastType, 'loading'>,\n { name: MaterialSymbolIconName; className: string }\n> = {\n success: { name: 'check_circle', className: 'text-success-light' },\n info: { name: 'info', className: 'text-info-light' },\n warning: { name: 'warning', className: 'text-warning-light' },\n error: { name: 'cancel', className: 'text-error-light' },\n}\n\n// Opaque radix steps (bg 2, border 6, text 11) so a floating toast never lets\n// page content bleed through the way the alpha `-soft` tokens would. The border\n// carries the tone too, otherwise a tinted toast keeps a grey outline.\nconst TONE_CLASSES: Record<Exclude<ToastType, 'loading'>, string> = {\n success: 'border-green-6 bg-green-2 text-green-11',\n info: 'border-blue-6 bg-blue-2 text-blue-11',\n warning: 'border-orange-6 bg-orange-2 text-orange-11',\n error: 'border-red-6 bg-red-2 text-red-11',\n}\n\n// Mobile-first: every position drops to a full-width stack at the top, which\n// is what the end-customer portal ships. `position` only takes effect from the\n// `sm` breakpoint up.\nconst POSITION_CLASSES: Record<ToastPosition, string> = {\n 'top-left': 'sm:top-4 sm:right-auto sm:bottom-auto sm:left-4',\n 'top-center':\n 'sm:top-4 sm:right-auto sm:bottom-auto sm:left-1/2 sm:-translate-x-1/2',\n 'top-right': 'sm:top-4 sm:right-4 sm:bottom-auto sm:left-auto',\n 'bottom-left': 'sm:top-auto sm:right-auto sm:bottom-4 sm:left-4',\n 'bottom-center':\n 'sm:top-auto sm:right-auto sm:bottom-4 sm:left-1/2 sm:-translate-x-1/2',\n 'bottom-right': 'sm:top-auto sm:right-4 sm:bottom-4 sm:left-auto',\n}\n\nconst manager = ToastPrimitive.createToastManager<ToastData>()\n\nlet sequence = 0\n\n// `label` names the content and `onClick` is wrapped, so neither reaches the\n// DOM button as-is; everything else does.\nfunction actionRest({\n label: _label,\n onClick: _onClick,\n ...rest\n}: ToastAction) {\n return rest\n}\n\nfunction toManagerOptions(\n id: string,\n title: React.ReactNode,\n type: ToastType | undefined,\n options: ToastOptions | undefined,\n) {\n const action = options?.action\n return {\n id,\n title,\n type,\n description: options?.description,\n timeout: options?.duration,\n priority: options?.priority,\n onClose: options?.onDismiss,\n // Base UI leaves the toast open after an action; dismissing matches what\n // callers expect from an \"Undo\" button.\n actionProps: action && {\n ...actionRest(action),\n children: action.label,\n onClick: (event: React.MouseEvent<HTMLButtonElement>) => {\n action.onClick?.(event)\n manager.close(id)\n },\n },\n data: { closeButton: options?.closeButton },\n }\n}\n\nconst emit =\n (type?: ToastType) =>\n (message: React.ReactNode, options?: ToastOptions): string => {\n // an id up front lets the action handler close the toast it belongs to\n const id = options?.id ?? `spark-toast-${(sequence += 1)}`\n return manager.add(toManagerOptions(id, message, type, options))\n }\n\n// A string phase becomes a titled toast of that type; an object phase keeps\n// whatever the caller set and only fills in the type.\nconst phase =\n <Value,>(\n value: ToastPromiseMessages<Value>[keyof ToastPromiseMessages<Value>],\n type: ToastType,\n ) =>\n (result: Value) => {\n const resolved = typeof value === 'function' ? value(result) : value\n return { title: resolved, type }\n }\n\nconst toast = Object.assign(emit(), {\n success: emit('success'),\n info: emit('info'),\n warning: emit('warning'),\n error: emit('error'),\n loading: emit('loading'),\n /** Dismiss one toast, or every toast when called without an id. */\n dismiss: (id?: string) => manager.close(id),\n promise: <Value,>(\n promiseValue: Promise<Value>,\n messages: ToastPromiseMessages<Value>,\n ) =>\n manager.promise(promiseValue, {\n loading: { title: messages.loading, type: 'loading' as const },\n success: phase(messages.success, 'success'),\n error: phase(messages.error as never, 'error'),\n }),\n})\n\nfunction ToastIcon({ type }: { type?: string }) {\n const icon = TOAST_ICONS[type as Exclude<ToastType, 'loading'>]\n if (type !== 'loading' && !icon) return null\n\n // Fixed box matching the title's line height, so the glyph and the spinner\n // both centre on the first line whether or not a description follows.\n return (\n <span\n aria-hidden=\"true\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center\"\n >\n {type === 'loading' ? (\n // Decorative: the toast already announces the loading message, so the\n // spinner must not add a second status live region.\n <Spinner\n className=\"text-gray-11\"\n label=\"\"\n role=\"presentation\"\n size=\"sm\"\n />\n ) : (\n <MaterialSymbol\n className={cn('[--spark-icon-size:20px]', icon.className)}\n name={icon.name}\n />\n )}\n </span>\n )\n}\n\nfunction ToastItem({\n closeButton,\n richColors,\n toast: toastObject,\n}: {\n closeButton: boolean\n richColors: boolean\n toast: ToastPrimitive.Root.ToastObject<ToastData>\n}) {\n const tone = TONE_CLASSES[toastObject.type as Exclude<ToastType, 'loading'>]\n const showClose = toastObject.data?.closeButton ?? closeButton\n\n return (\n <ToastPrimitive.Root\n data-slot=\"toast\"\n className={cn(\n // Skin only. All geometry (position, stacking, transitions, the\n // pointer bridge) lives in styles/index.css, because Tailwind's\n // `utilities` layer outranks `components` and a stray `bottom-0` here\n // would beat the stylesheet's `bottom: auto` on top-anchored stacks.\n // The border is what makes the cards behind the front one legible.\n 'flex items-start gap-2 rounded-lg border border-gray-a5 bg-gray-1 p-3 text-gray shadow-md select-none',\n richColors && tone,\n )}\n // the stack is top-anchored on mobile and bottom-anchored above `sm`, so\n // both vertical directions have to dismiss\n swipeDirection={['up', 'down', 'right']}\n toast={toastObject}\n >\n <ToastIcon type={toastObject.type} />\n <ToastPrimitive.Content className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <ToastPrimitive.Title\n className=\"text-sm font-medium\"\n data-slot=\"toast-title\"\n />\n <ToastPrimitive.Description\n className={cn(\n 'text-sm',\n richColors && tone ? 'text-inherit' : 'text-gray-11',\n )}\n data-slot=\"toast-description\"\n />\n </ToastPrimitive.Content>\n {toastObject.actionProps ? (\n <ToastPrimitive.Action\n // -my-2 keeps the 36px control from stretching a single-line row past\n // the 20px text; self-center then lands it on the title when there is\n // no description, and mid-block when there is one\n className={cn(\n buttonVariants({ size: 'small', variant: 'primary' }),\n '-my-2 shrink-0 self-center rounded-full',\n )}\n data-slot=\"toast-action\"\n />\n ) : null}\n {showClose ? (\n <ToastPrimitive.Close\n aria-label=\"Close\"\n className={cn(\n buttonVariants({ size: 'icon-small', variant: 'tertiary' }),\n // -my-1: same reason as the action, for a 28px control\n '-my-1 -mr-1 size-7 shrink-0 self-center text-gray-11',\n )}\n data-slot=\"toast-close\"\n >\n <MaterialSymbol\n aria-hidden=\"true\"\n className=\"[--spark-icon-size:18px]\"\n name=\"close\"\n />\n </ToastPrimitive.Close>\n ) : null}\n </ToastPrimitive.Root>\n )\n}\n\nfunction ToastList({\n closeButton,\n richColors,\n}: {\n closeButton: boolean\n richColors: boolean\n}) {\n const { toasts } = ToastPrimitive.useToastManager<ToastData>()\n\n return toasts.map((toastObject) => (\n <ToastItem\n closeButton={closeButton}\n key={toastObject.id}\n richColors={richColors}\n toast={toastObject}\n />\n ))\n}\n\ntype ToasterProps = {\n className?: string\n /** Corner or edge the toasts stack in. */\n position?: ToastPosition\n /** Close button on every toast; a per-toast `closeButton` wins. */\n closeButton?: boolean\n /** Tinted surfaces for success/info/warning/error toasts. */\n richColors?: boolean\n /** Default auto-dismiss time in ms. `0` disables auto-dismiss. */\n duration?: number\n /** Toasts visible at once before older ones are marked `data-limited`. */\n limit?: number\n /**\n * Vertical edge below the `sm` breakpoint, where the stack is always\n * full-width and `position` does not apply. Defaults to `top`, matching the\n * end-customer portal.\n */\n mobilePosition?: 'top' | 'bottom'\n}\n\nfunction Toaster({\n className,\n closeButton = true,\n duration = 4000,\n limit,\n mobilePosition = 'top',\n position = 'bottom-right',\n richColors = true,\n}: ToasterProps) {\n return (\n <ToastPrimitive.Provider\n limit={limit}\n timeout={duration}\n toastManager={manager}\n >\n <ToastPrimitive.Portal>\n <ToastPrimitive.Viewport\n // block + zero height: the toasts are absolutely positioned against\n // this box's bottom edge, the way Base UI's stacked example works\n className={cn(\n 'fixed inset-x-4 z-50 block h-0 outline-none',\n mobilePosition === 'top' ? 'top-4' : 'bottom-4',\n 'sm:inset-x-auto sm:w-96 sm:max-w-[calc(100vw-2rem)]',\n POSITION_CLASSES[position],\n className,\n )}\n data-mobile-side={mobilePosition}\n data-side={position.startsWith('top') ? 'top' : 'bottom'}\n data-slot=\"toaster\"\n >\n <ToastList closeButton={closeButton} richColors={richColors} />\n </ToastPrimitive.Viewport>\n </ToastPrimitive.Portal>\n </ToastPrimitive.Provider>\n )\n}\n\nexport { Toaster, toast }\nexport type {\n ToastAction,\n ToasterProps,\n ToastOptions,\n ToastPosition,\n ToastPromiseMessages,\n ToastType,\n}\n"],"mappings":";;;;;;;;;;AAsDA,MAAM,cAGF;CACF,SAAS;EAAE,MAAM;EAAgB,WAAW;CAAqB;CACjE,MAAM;EAAE,MAAM;EAAQ,WAAW;CAAkB;CACnD,SAAS;EAAE,MAAM;EAAW,WAAW;CAAqB;CAC5D,OAAO;EAAE,MAAM;EAAU,WAAW;CAAmB;AACzD;AAKA,MAAM,eAA8D;CAClE,SAAS;CACT,MAAM;CACN,SAAS;CACT,OAAO;AACT;AAKA,MAAM,mBAAkD;CACtD,YAAY;CACZ,cACE;CACF,aAAa;CACb,eAAe;CACf,iBACE;CACF,gBAAgB;AAClB;AAEA,MAAM,UAAUA,MAAe,mBAA8B;AAE7D,IAAI,WAAW;AAIf,SAAS,WAAW,EAClB,OAAO,QACP,SAAS,UACT,GAAG,QACW;CACd,OAAO;AACT;AAEA,SAAS,iBACP,IACA,OACA,MACA,SACA;CACA,MAAM,SAAS,SAAS;CACxB,OAAO;EACL;EACA;EACA;EACA,aAAa,SAAS;EACtB,SAAS,SAAS;EAClB,UAAU,SAAS;EACnB,SAAS,SAAS;EAGlB,aAAa,UAAU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BAAiB,WACjB,SACF;GACA,oBAAkB;GAClB,aAAW,SAAS,WAAW,KAAK,IAAI,QAAQ;GAChD,aAAU;aAEV,oBAAC,WAAD;IAAwB;IAAyB;GAAa,CAAA;EACvC,CAAA,EACJ,CAAA;CACA,CAAA;AAE7B"}
@@ -504,8 +504,8 @@
504
504
  --radius-lg: var(--spark-rounded-lg);
505
505
  --radius-xl: var(--spark-rounded-xl);
506
506
  --radius-2xl: var(--spark-rounded-2xl);
507
+ --radius-3xl: var(--spark-rounded-3xl);
507
508
  --radius-full: 9999px; /* true pill (standard Tailwind); was wired to --spark-rounded-full (0px) */
508
- --radius-circle: 9999px; /* TODO: redundant with rounded-full now; migrate usages + remove */
509
509
  }
510
510
 
511
511
  /*
@@ -627,4 +627,3 @@
627
627
  @source inline(
628
628
  'border-{input,input-active,input-valid,input-invalid,input-disabled}'
629
629
  );
630
- @source inline('rounded-circle');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@epilot/spark-ui",
3
- "version": "0.15.2",
3
+ "version": "0.16.0",
4
4
  "description": "React UI component library from Spark SDK",
5
5
  "homepage": "https://spark-ui.epilot.io/docs/ui",
6
6
  "license": "Apache-2.0",