@ttt-productions/ui-core 0.11.34 → 0.11.35

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 (142) hide show
  1. package/README.md +1 -1
  2. package/dist/browser/index.d.ts.map +1 -1
  3. package/dist/browser/index.js +0 -1
  4. package/dist/browser/index.js.map +1 -1
  5. package/dist/browser/reload-recovery-watch.d.ts +0 -4
  6. package/dist/browser/reload-recovery-watch.d.ts.map +1 -1
  7. package/dist/browser/reload-recovery-watch.js +0 -5
  8. package/dist/browser/reload-recovery-watch.js.map +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +0 -1
  11. package/dist/index.js.map +1 -1
  12. package/dist/lib/format-numbers.d.ts +0 -6
  13. package/dist/lib/format-numbers.d.ts.map +1 -1
  14. package/dist/lib/format-numbers.js +0 -6
  15. package/dist/lib/format-numbers.js.map +1 -1
  16. package/dist/lib/reload-recovery.d.ts +1 -9
  17. package/dist/lib/reload-recovery.d.ts.map +1 -1
  18. package/dist/lib/reload-recovery.js +1 -11
  19. package/dist/lib/reload-recovery.js.map +1 -1
  20. package/dist/lib/utils.d.ts +0 -3
  21. package/dist/lib/utils.d.ts.map +1 -1
  22. package/dist/lib/utils.js +0 -3
  23. package/dist/lib/utils.js.map +1 -1
  24. package/dist/react/components/accordion.d.ts.map +1 -1
  25. package/dist/react/components/accordion.js.map +1 -1
  26. package/dist/react/components/action-row.d.ts +0 -7
  27. package/dist/react/components/action-row.d.ts.map +1 -1
  28. package/dist/react/components/action-row.js +1 -5
  29. package/dist/react/components/action-row.js.map +1 -1
  30. package/dist/react/components/button.d.ts +0 -10
  31. package/dist/react/components/button.d.ts.map +1 -1
  32. package/dist/react/components/button.js +2 -7
  33. package/dist/react/components/button.js.map +1 -1
  34. package/dist/react/components/consequence-dialog.d.ts +1 -48
  35. package/dist/react/components/consequence-dialog.d.ts.map +1 -1
  36. package/dist/react/components/consequence-dialog.js +3 -21
  37. package/dist/react/components/consequence-dialog.js.map +1 -1
  38. package/dist/react/components/date-picker.d.ts +0 -17
  39. package/dist/react/components/date-picker.d.ts.map +1 -1
  40. package/dist/react/components/date-picker.js +0 -32
  41. package/dist/react/components/date-picker.js.map +1 -1
  42. package/dist/react/components/date-time-picker.d.ts +0 -23
  43. package/dist/react/components/date-time-picker.d.ts.map +1 -1
  44. package/dist/react/components/date-time-picker.js +0 -19
  45. package/dist/react/components/date-time-picker.js.map +1 -1
  46. package/dist/react/components/dropdown-menu.d.ts +0 -8
  47. package/dist/react/components/dropdown-menu.d.ts.map +1 -1
  48. package/dist/react/components/dropdown-menu.js +1 -2
  49. package/dist/react/components/dropdown-menu.js.map +1 -1
  50. package/dist/react/components/format-control.d.ts +1 -21
  51. package/dist/react/components/format-control.d.ts.map +1 -1
  52. package/dist/react/components/format-control.js +1 -21
  53. package/dist/react/components/format-control.js.map +1 -1
  54. package/dist/react/components/input.d.ts +0 -17
  55. package/dist/react/components/input.d.ts.map +1 -1
  56. package/dist/react/components/input.js +1 -3
  57. package/dist/react/components/input.js.map +1 -1
  58. package/dist/react/components/layout/screen-adaptive-view.d.ts +0 -7
  59. package/dist/react/components/layout/screen-adaptive-view.d.ts.map +1 -1
  60. package/dist/react/components/layout/screen-adaptive-view.js +1 -2
  61. package/dist/react/components/layout/screen-adaptive-view.js.map +1 -1
  62. package/dist/react/components/list-pagination.d.ts +0 -30
  63. package/dist/react/components/list-pagination.d.ts.map +1 -1
  64. package/dist/react/components/list-pagination.js +0 -27
  65. package/dist/react/components/list-pagination.js.map +1 -1
  66. package/dist/react/components/opener-focus.d.ts +1 -7
  67. package/dist/react/components/opener-focus.d.ts.map +1 -1
  68. package/dist/react/components/opener-focus.js +1 -7
  69. package/dist/react/components/opener-focus.js.map +1 -1
  70. package/dist/react/components/pending-guard.d.ts +0 -6
  71. package/dist/react/components/pending-guard.d.ts.map +1 -1
  72. package/dist/react/components/pending-guard.js +0 -6
  73. package/dist/react/components/pending-guard.js.map +1 -1
  74. package/dist/react/components/relative-time.d.ts +0 -8
  75. package/dist/react/components/relative-time.d.ts.map +1 -1
  76. package/dist/react/components/relative-time.js +0 -4
  77. package/dist/react/components/relative-time.js.map +1 -1
  78. package/dist/react/components/reload-recovery-notice.d.ts +0 -14
  79. package/dist/react/components/reload-recovery-notice.d.ts.map +1 -1
  80. package/dist/react/components/reload-recovery-notice.js +0 -5
  81. package/dist/react/components/reload-recovery-notice.js.map +1 -1
  82. package/dist/react/components/scroll-to-top-button.d.ts +1 -25
  83. package/dist/react/components/scroll-to-top-button.d.ts.map +1 -1
  84. package/dist/react/components/scroll-to-top-button.js.map +1 -1
  85. package/dist/react/components/search-dropdown.d.ts +0 -53
  86. package/dist/react/components/search-dropdown.d.ts.map +1 -1
  87. package/dist/react/components/search-dropdown.js +2 -36
  88. package/dist/react/components/search-dropdown.js.map +1 -1
  89. package/dist/react/components/select.d.ts +0 -7
  90. package/dist/react/components/select.d.ts.map +1 -1
  91. package/dist/react/components/select.js +0 -2
  92. package/dist/react/components/select.js.map +1 -1
  93. package/dist/react/components/show-more-toggle.d.ts +0 -16
  94. package/dist/react/components/show-more-toggle.d.ts.map +1 -1
  95. package/dist/react/components/show-more-toggle.js +0 -5
  96. package/dist/react/components/show-more-toggle.js.map +1 -1
  97. package/dist/react/components/spinner.d.ts +0 -14
  98. package/dist/react/components/spinner.d.ts.map +1 -1
  99. package/dist/react/components/spinner.js +0 -8
  100. package/dist/react/components/spinner.js.map +1 -1
  101. package/dist/react/components/switch.d.ts +0 -7
  102. package/dist/react/components/switch.d.ts.map +1 -1
  103. package/dist/react/components/switch.js +0 -2
  104. package/dist/react/components/switch.js.map +1 -1
  105. package/dist/react/components/table.d.ts +0 -10
  106. package/dist/react/components/table.d.ts.map +1 -1
  107. package/dist/react/components/table.js +0 -6
  108. package/dist/react/components/table.js.map +1 -1
  109. package/dist/react/components/textarea.d.ts +0 -11
  110. package/dist/react/components/textarea.d.ts.map +1 -1
  111. package/dist/react/components/textarea.js +1 -3
  112. package/dist/react/components/textarea.js.map +1 -1
  113. package/dist/react/components/toast.d.ts +0 -4
  114. package/dist/react/components/toast.d.ts.map +1 -1
  115. package/dist/react/components/toast.js +3 -24
  116. package/dist/react/components/toast.js.map +1 -1
  117. package/dist/react/components/toaster.d.ts.map +1 -1
  118. package/dist/react/components/toaster.js.map +1 -1
  119. package/dist/react/hooks/use-async-action.d.ts +1 -21
  120. package/dist/react/hooks/use-async-action.d.ts.map +1 -1
  121. package/dist/react/hooks/use-async-action.js +1 -9
  122. package/dist/react/hooks/use-async-action.js.map +1 -1
  123. package/dist/react/hooks/use-cursor-page.d.ts +0 -62
  124. package/dist/react/hooks/use-cursor-page.d.ts.map +1 -1
  125. package/dist/react/hooks/use-cursor-page.js +1 -37
  126. package/dist/react/hooks/use-cursor-page.js.map +1 -1
  127. package/dist/react/hooks/use-paged-list.d.ts +0 -43
  128. package/dist/react/hooks/use-paged-list.d.ts.map +1 -1
  129. package/dist/react/hooks/use-paged-list.js +0 -15
  130. package/dist/react/hooks/use-paged-list.js.map +1 -1
  131. package/dist/react/hooks/use-return-scroll.d.ts +0 -9
  132. package/dist/react/hooks/use-return-scroll.d.ts.map +1 -1
  133. package/dist/react/hooks/use-return-scroll.js +2 -34
  134. package/dist/react/hooks/use-return-scroll.js.map +1 -1
  135. package/dist/react/hooks/use-toast.d.ts +0 -8
  136. package/dist/react/hooks/use-toast.d.ts.map +1 -1
  137. package/dist/react/hooks/use-toast.js +1 -4
  138. package/dist/react/hooks/use-toast.js.map +1 -1
  139. package/dist/react/index.d.ts.map +1 -1
  140. package/dist/react/index.js +0 -6
  141. package/dist/react/index.js.map +1 -1
  142. package/package.json +4 -4
@@ -9,14 +9,6 @@ const SIZE_CLASS = {
9
9
  lg: 'spinner-lg',
10
10
  xl: 'spinner-xl',
11
11
  };
12
- /**
13
- * The ONE loading spinner. Every in-progress indicator renders through this
14
- * component (or through a control's `pending` prop, which renders it), so the
15
- * spinner's look, size scale, and color rule have one change point. The
16
- * theme-core `spinner-*` classes own size, animation, and color — including the
17
- * `button .spinner-*` rule that makes an in-button spinner inherit the button's
18
- * text color so it is never primary-on-primary.
19
- */
20
12
  function Spinner({ size = 'xs', label, className }) {
21
13
  if (!label) {
22
14
  return _jsx(Loader2, { className: cn(SIZE_CLASS[size], className), "aria-hidden": "true" });
@@ -1 +1 @@
1
- {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../src/react/components/spinner.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAgBxC,MAAM,UAAU,GAAgC;IAC9C,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;CACjB,CAAC;AAEF;;;;;;;GAOG;AACH,SAAS,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,EAAE,SAAS,EAAgB;IAC9D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAC,OAAO,IAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,iBAAc,MAAM,GAAG,CAAC;IACpF,CAAC;IACD,OAAO,CACL,gBAAM,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,EAAE,CAAC,yCAAyC,EAAE,SAAS,CAAC,aACrF,KAAC,OAAO,IAAC,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,iBAAc,MAAM,GAAG,EAC3D,eAAM,SAAS,EAAC,SAAS,YAAE,KAAK,GAAQ,IACnC,CACR,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["'use client';\n\nimport { Loader2 } from 'lucide-react';\n\nimport { cn } from '../../lib/utils.js';\n\nexport type SpinnerSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\nexport interface SpinnerProps {\n /** Maps onto the theme-core `spinner-*` classes. Defaults to `xs` (the in-control size). */\n size?: SpinnerSize;\n /**\n * Screen-reader text. When set, the spinner becomes a `status` live region that\n * announces it. Omit it for a spinner inside a control that already carries its\n * own busy state (`aria-busy`) — the control speaks for it.\n */\n label?: string;\n className?: string;\n}\n\nconst SIZE_CLASS: Record<SpinnerSize, string> = {\n xs: 'spinner-xs',\n sm: 'spinner-sm',\n md: 'spinner-md',\n lg: 'spinner-lg',\n xl: 'spinner-xl',\n};\n\n/**\n * The ONE loading spinner. Every in-progress indicator renders through this\n * component (or through a control's `pending` prop, which renders it), so the\n * spinner's look, size scale, and color rule have one change point. The\n * theme-core `spinner-*` classes own size, animation, and color — including the\n * `button .spinner-*` rule that makes an in-button spinner inherit the button's\n * text color so it is never primary-on-primary.\n */\nfunction Spinner({ size = 'xs', label, className }: SpinnerProps) {\n if (!label) {\n return <Loader2 className={cn(SIZE_CLASS[size], className)} aria-hidden=\"true\" />;\n }\n return (\n <span role=\"status\" className={cn('inline-flex items-center justify-center', className)}>\n <Loader2 className={SIZE_CLASS[size]} aria-hidden=\"true\" />\n <span className=\"sr-only\">{label}</span>\n </span>\n );\n}\n\nexport { Spinner };\n"]}
1
+ {"version":3,"file":"spinner.js","sourceRoot":"","sources":["../../../src/react/components/spinner.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAUxC,MAAM,UAAU,GAAgC;IAC9C,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;IAChB,EAAE,EAAE,YAAY;CACjB,CAAC;AAEF,SAAS,OAAO,CAAC,EAAE,IAAI,GAAG,IAAI,EAAE,KAAK,EAAE,SAAS,EAAgB;IAC9D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,KAAC,OAAO,IAAC,SAAS,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,SAAS,CAAC,iBAAc,MAAM,GAAG,CAAC;IACpF,CAAC;IACD,OAAO,CACL,gBAAM,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAE,EAAE,CAAC,yCAAyC,EAAE,SAAS,CAAC,aACrF,KAAC,OAAO,IAAC,SAAS,EAAE,UAAU,CAAC,IAAI,CAAC,iBAAc,MAAM,GAAG,EAC3D,eAAM,SAAS,EAAC,SAAS,YAAE,KAAK,GAAQ,IACnC,CACR,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,OAAO,EAAE,CAAC","sourcesContent":["'use client';\n\nimport { Loader2 } from 'lucide-react';\n\nimport { cn } from '../../lib/utils.js';\n\nexport type SpinnerSize = 'xs' | 'sm' | 'md' | 'lg' | 'xl';\n\nexport interface SpinnerProps {\n size?: SpinnerSize;\n label?: string;\n className?: string;\n}\n\nconst SIZE_CLASS: Record<SpinnerSize, string> = {\n xs: 'spinner-xs',\n sm: 'spinner-sm',\n md: 'spinner-md',\n lg: 'spinner-lg',\n xl: 'spinner-xl',\n};\n\nfunction Spinner({ size = 'xs', label, className }: SpinnerProps) {\n if (!label) {\n return <Loader2 className={cn(SIZE_CLASS[size], className)} aria-hidden=\"true\" />;\n }\n return (\n <span role=\"status\" className={cn('inline-flex items-center justify-center', className)}>\n <Loader2 className={SIZE_CLASS[size]} aria-hidden=\"true\" />\n <span className=\"sr-only\">{label}</span>\n </span>\n );\n}\n\nexport { Spinner };\n"]}
@@ -1,13 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import * as SwitchPrimitives from '@radix-ui/react-switch';
3
3
  declare const Switch: React.ForwardRefExoticComponent<Omit<SwitchPrimitives.SwitchProps & React.RefAttributes<HTMLButtonElement>, "ref"> & {
4
- /**
5
- * The change this switch started is in flight: the switch ignores toggling, sets
6
- * `aria-disabled` and `aria-busy`, and spins inside its thumb. It keeps showing the
7
- * COMMITTED state — the caller flips `checked` only once the write lands. It is never
8
- * natively disabled while pending (a `disabled` passed alongside applies once pending
9
- * ends), so the switch the user just pressed keeps focus (FRONTEND-203).
10
- */
11
4
  pending?: boolean;
12
5
  } & React.RefAttributes<HTMLButtonElement>>;
13
6
  export { Switch };
@@ -1 +1 @@
1
- {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/react/components/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAC;AAY3D,QAAA,MAAM,MAAM;IAGR;;;;;;OAMG;cACO,OAAO;2CA4BnB,CAAC;AAGH,OAAO,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../src/react/components/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAC;AAU3D,QAAA,MAAM,MAAM;cAGE,OAAO;2CA4BnB,CAAC;AAGH,OAAO,EAAE,MAAM,EAAE,CAAC"}
@@ -4,8 +4,6 @@ import * as React from 'react';
4
4
  import * as SwitchPrimitives from '@radix-ui/react-switch';
5
5
  import { cn } from '../../lib/utils.js';
6
6
  import { Spinner } from './spinner.js';
7
- // Stopped in the capture phase so neither the caller's click handler nor the switch's own
8
- // toggle runs while a change is in flight.
9
7
  function blockToggle(event) {
10
8
  event.preventDefault();
11
9
  event.stopPropagation();
@@ -1 +1 @@
1
- {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/react/components/switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,0FAA0F;AAC1F,2CAA2C;AAC3C,SAAS,WAAW,CAAC,KAA0C;IAC7D,KAAK,CAAC,cAAc,EAAE,CAAC;IACvB,KAAK,CAAC,eAAe,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAY7B,CAAC,EAAE,SAAS,EAAE,OAAO,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAC7D,KAAC,gBAAgB,CAAC,IAAI,IACpB,SAAS,EAAE,EAAE,CACX,gbAAgb,EAChb,SAAS,CACV,KACG,KAAK,KACL,CAAC,OAAO;QACV,CAAC,CAAC;YACE,WAAW,EAAE,IAAI;YACjB,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,EAAE;YAClB,cAAc,EAAE,WAAW;SAC5B;QACH,CAAC,CAAC,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS,EAC7C,GAAG,EAAE,GAAG,YAER,KAAC,gBAAgB,CAAC,KAAK,IACrB,SAAS,EAAE,EAAE,CACX,uMAAuM,CACxM,YAEA,OAAO,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,GAChB,GACH,CACzB,CAAC,CAAC;AACH,MAAM,CAAC,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as SwitchPrimitives from '@radix-ui/react-switch';\n\nimport { cn } from '../../lib/utils.js';\nimport { Spinner } from './spinner.js';\n\n// Stopped in the capture phase so neither the caller's click handler nor the switch's own\n// toggle runs while a change is in flight.\nfunction blockToggle(event: React.MouseEvent<HTMLButtonElement>) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nconst Switch = React.forwardRef<\n React.ElementRef<typeof SwitchPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> & {\n /**\n * The change this switch started is in flight: the switch ignores toggling, sets\n * `aria-disabled` and `aria-busy`, and spins inside its thumb. It keeps showing the\n * COMMITTED state — the caller flips `checked` only once the write lands. It is never\n * natively disabled while pending (a `disabled` passed alongside applies once pending\n * ends), so the switch the user just pressed keeps focus (FRONTEND-203).\n */\n pending?: boolean;\n }\n>(({ className, pending = false, disabled, ...props }, ref) => (\n <SwitchPrimitives.Root\n className={cn(\n 'peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',\n className,\n )}\n {...props}\n {...(pending\n ? {\n 'aria-busy': true,\n 'aria-disabled': true,\n 'data-pending': '',\n onClickCapture: blockToggle,\n }\n : {})}\n disabled={(disabled && !pending) || undefined}\n ref={ref}\n >\n <SwitchPrimitives.Thumb\n className={cn(\n 'pointer-events-none flex h-5 w-5 items-center justify-center rounded-full bg-background elevation-raised transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0',\n )}\n >\n {pending ? <Spinner size=\"xs\" /> : null}\n </SwitchPrimitives.Thumb>\n </SwitchPrimitives.Root>\n));\nSwitch.displayName = SwitchPrimitives.Root.displayName;\n\nexport { Switch };\n"]}
1
+ {"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/react/components/switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,SAAS,WAAW,CAAC,KAA0C;IAC7D,KAAK,CAAC,cAAc,EAAE,CAAC;IACvB,KAAK,CAAC,eAAe,EAAE,CAAC;AAC1B,CAAC;AAED,MAAM,MAAM,GAAG,KAAK,CAAC,UAAU,CAK7B,CAAC,EAAE,SAAS,EAAE,OAAO,GAAG,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAC7D,KAAC,gBAAgB,CAAC,IAAI,IACpB,SAAS,EAAE,EAAE,CACX,gbAAgb,EAChb,SAAS,CACV,KACG,KAAK,KACL,CAAC,OAAO;QACV,CAAC,CAAC;YACE,WAAW,EAAE,IAAI;YACjB,eAAe,EAAE,IAAI;YACrB,cAAc,EAAE,EAAE;YAClB,cAAc,EAAE,WAAW;SAC5B;QACH,CAAC,CAAC,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS,EAC7C,GAAG,EAAE,GAAG,YAER,KAAC,gBAAgB,CAAC,KAAK,IACrB,SAAS,EAAE,EAAE,CACX,uMAAuM,CACxM,YAEA,OAAO,CAAC,CAAC,CAAC,KAAC,OAAO,IAAC,IAAI,EAAC,IAAI,GAAG,CAAC,CAAC,CAAC,IAAI,GAChB,GACH,CACzB,CAAC,CAAC;AACH,MAAM,CAAC,WAAW,GAAG,gBAAgB,CAAC,IAAI,CAAC,WAAW,CAAC;AAEvD,OAAO,EAAE,MAAM,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport * as SwitchPrimitives from '@radix-ui/react-switch';\n\nimport { cn } from '../../lib/utils.js';\nimport { Spinner } from './spinner.js';\n\nfunction blockToggle(event: React.MouseEvent<HTMLButtonElement>) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nconst Switch = React.forwardRef<\n React.ElementRef<typeof SwitchPrimitives.Root>,\n React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> & {\n pending?: boolean;\n }\n>(({ className, pending = false, disabled, ...props }, ref) => (\n <SwitchPrimitives.Root\n className={cn(\n 'peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 aria-disabled:cursor-not-allowed aria-disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input',\n className,\n )}\n {...props}\n {...(pending\n ? {\n 'aria-busy': true,\n 'aria-disabled': true,\n 'data-pending': '',\n onClickCapture: blockToggle,\n }\n : {})}\n disabled={(disabled && !pending) || undefined}\n ref={ref}\n >\n <SwitchPrimitives.Thumb\n className={cn(\n 'pointer-events-none flex h-5 w-5 items-center justify-center rounded-full bg-background elevation-raised transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0',\n )}\n >\n {pending ? <Spinner size=\"xs\" /> : null}\n </SwitchPrimitives.Thumb>\n </SwitchPrimitives.Root>\n));\nSwitch.displayName = SwitchPrimitives.Root.displayName;\n\nexport { Switch };\n"]}
@@ -7,22 +7,12 @@ declare const TableRow: React.ForwardRefExoticComponent<React.HTMLAttributes<HTM
7
7
  declare const TableHead: React.ForwardRefExoticComponent<React.ThHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
8
8
  export type SortDirection = 'asc' | 'desc';
9
9
  export interface SortableTableHeadProps {
10
- /** The column's full name; always spoken, and shown on a wide table. */
11
10
  label: string;
12
- /** A short form shown while the table is narrow; the spoken name then gives it before `label`. */
13
11
  shortLabel?: string;
14
- /** The column's current sort, or `null` when the table is not sorted by it. */
15
12
  direction: SortDirection | null;
16
13
  onSort: () => void;
17
- /** Classes for the header cell. */
18
14
  className?: string;
19
15
  }
20
- /**
21
- * A column header that sorts its table. The visible labels are hidden from assistive technology
22
- * beside one spoken label, so the header and its button carry the same name ("G, Goals") rather
23
- * than the two visible labels run together. The short label gives way to the full one once the
24
- * nearest size container is 56rem wide.
25
- */
26
16
  declare const SortableTableHead: React.ForwardRefExoticComponent<SortableTableHeadProps & React.RefAttributes<HTMLTableCellElement>>;
27
17
  declare const TableCell: React.ForwardRefExoticComponent<React.TdHTMLAttributes<HTMLTableCellElement> & React.RefAttributes<HTMLTableCellElement>>;
28
18
  declare const TableCaption: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLTableCaptionElement> & React.RefAttributes<HTMLTableCaptionElement>>;
@@ -1 +1 @@
1
- {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/react/components/table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,KAAK,iHAMV,CAAC;AAGF,QAAA,MAAM,WAAW,+HAKf,CAAC;AAGH,QAAA,MAAM,SAAS,+HAKb,CAAC;AAGH,QAAA,MAAM,WAAW,+HASf,CAAC;AAGH,QAAA,MAAM,QAAQ,uHAWb,CAAC;AAGF,QAAA,MAAM,SAAS,2HAYb,CAAC;AAGH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3C,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,kGAAkG;IAClG,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+EAA+E;IAC/E,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,mCAAmC;IACnC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,qGAiCtB,CAAC;AAGF,QAAA,MAAM,SAAS,2HASb,CAAC;AAGH,QAAA,MAAM,YAAY,+HAKhB,CAAC;AAGH,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,YAAY,GACb,CAAC"}
1
+ {"version":3,"file":"table.d.ts","sourceRoot":"","sources":["../../../src/react/components/table.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,QAAA,MAAM,KAAK,iHAMV,CAAC;AAGF,QAAA,MAAM,WAAW,+HAKf,CAAC;AAGH,QAAA,MAAM,SAAS,+HAKb,CAAC;AAGH,QAAA,MAAM,WAAW,+HASf,CAAC;AAGH,QAAA,MAAM,QAAQ,uHAWb,CAAC;AAGF,QAAA,MAAM,SAAS,2HAYb,CAAC;AAGH,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,CAAC;AAE3C,MAAM,WAAW,sBAAsB;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAOD,QAAA,MAAM,iBAAiB,qGAiCtB,CAAC;AAGF,QAAA,MAAM,SAAS,2HASb,CAAC;AAGH,QAAA,MAAM,YAAY,+HAKhB,CAAC;AAGH,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,YAAY,GACb,CAAC"}
@@ -19,12 +19,6 @@ const ARIA_SORT = {
19
19
  asc: 'ascending',
20
20
  desc: 'descending',
21
21
  };
22
- /**
23
- * A column header that sorts its table. The visible labels are hidden from assistive technology
24
- * beside one spoken label, so the header and its button carry the same name ("G, Goals") rather
25
- * than the two visible labels run together. The short label gives way to the full one once the
26
- * nearest size container is 56rem wide.
27
- */
28
22
  const SortableTableHead = React.forwardRef(({ label, shortLabel, direction, onSort, className }, ref) => {
29
23
  const Icon = direction === 'asc' ? ArrowUp : direction === 'desc' ? ArrowDown : ArrowUpDown;
30
24
  return (_jsx(TableHead, { ref: ref, scope: "col", "aria-sort": direction ? ARIA_SORT[direction] : undefined, className: className, children: _jsxs("button", { type: "button", onClick: onSort, className: "inline-flex items-center gap-1 whitespace-nowrap rounded-sm ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2", children: [shortLabel ? (_jsxs(_Fragment, { children: [_jsx("span", { "aria-hidden": "true", className: "@4xl:hidden", children: shortLabel }), _jsx("span", { "aria-hidden": "true", className: "hidden @4xl:inline", children: label }), _jsx("span", { className: "sr-only", children: `${shortLabel}, ${label}` })] })) : (label), _jsx(Icon, { className: "icon-xxs", "aria-hidden": "true" })] }) }));
@@ -1 +1 @@
1
- {"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/react/components/table.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAChC,cAAK,SAAS,EAAC,+BAA+B,YAC5C,gBAAO,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,+BAA+B,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,GACrF,CACP,CACF,CAAC;AACF,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;AAE5B,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAGlC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,gBAAO,GAAG,EAAE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AAG,EAAE,EAAE,CAAC,CAClC,aACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,qEAAqE,EAAE,SAAS,CAAC,KAC3F,KAAK,GACT,CACH,CAAC,CAAC;AACH,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;AAEpC,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAGnC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,kBAAS,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,oCAAoC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CACjG,CAAC,CAAC;AACH,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,YAAY,GACb,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ArrowDown, ArrowUp, ArrowUpDown } from 'lucide-react';\nimport { cn } from '../../lib/utils.js';\n\nconst Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(\n ({ className, ...props }, ref) => (\n <div className=\"relative w-full overflow-auto\">\n <table ref={ref} className={cn('w-full caption-bottom text-sm', className)} {...props} />\n </div>\n ),\n);\nTable.displayName = 'Table';\n\nconst TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <thead ref={ref} className={cn('[&_tr]:border-b', className)} {...props} />\n));\nTableHeader.displayName = 'TableHeader';\n\nconst TableBody = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tbody ref={ref} className={cn('[&_tr:last-child]:border-0', className)} {...props} />\n));\nTableBody.displayName = 'TableBody';\n\nconst TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tfoot\n ref={ref}\n className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}\n {...props}\n />\n));\nTableFooter.displayName = 'TableFooter';\n\nconst TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(\n ({ className, ...props }, ref) => (\n <tr\n ref={ref}\n className={cn(\n 'border-b transition-colors hover:bg-[color:var(--table-row-hover)] data-[state=selected]:bg-muted',\n className,\n )}\n {...props}\n />\n ),\n);\nTableRow.displayName = 'TableRow';\n\nconst TableHead = React.forwardRef<\n HTMLTableCellElement,\n React.ThHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <th\n ref={ref}\n className={cn(\n 'h-12 px-4 text-left align-middle font-bold text-label [&:has([role=checkbox])]:pr-0',\n className,\n )}\n {...props}\n />\n));\nTableHead.displayName = 'TableHead';\n\nexport type SortDirection = 'asc' | 'desc';\n\nexport interface SortableTableHeadProps {\n /** The column's full name; always spoken, and shown on a wide table. */\n label: string;\n /** A short form shown while the table is narrow; the spoken name then gives it before `label`. */\n shortLabel?: string;\n /** The column's current sort, or `null` when the table is not sorted by it. */\n direction: SortDirection | null;\n onSort: () => void;\n /** Classes for the header cell. */\n className?: string;\n}\n\nconst ARIA_SORT: Record<SortDirection, 'ascending' | 'descending'> = {\n asc: 'ascending',\n desc: 'descending',\n};\n\n/**\n * A column header that sorts its table. The visible labels are hidden from assistive technology\n * beside one spoken label, so the header and its button carry the same name (\"G, Goals\") rather\n * than the two visible labels run together. The short label gives way to the full one once the\n * nearest size container is 56rem wide.\n */\nconst SortableTableHead = React.forwardRef<HTMLTableCellElement, SortableTableHeadProps>(\n ({ label, shortLabel, direction, onSort, className }, ref) => {\n const Icon = direction === 'asc' ? ArrowUp : direction === 'desc' ? ArrowDown : ArrowUpDown;\n return (\n <TableHead\n ref={ref}\n scope=\"col\"\n aria-sort={direction ? ARIA_SORT[direction] : undefined}\n className={className}\n >\n <button\n type=\"button\"\n onClick={onSort}\n className=\"inline-flex items-center gap-1 whitespace-nowrap rounded-sm ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\"\n >\n {shortLabel ? (\n <>\n <span aria-hidden=\"true\" className=\"@4xl:hidden\">\n {shortLabel}\n </span>\n <span aria-hidden=\"true\" className=\"hidden @4xl:inline\">\n {label}\n </span>\n <span className=\"sr-only\">{`${shortLabel}, ${label}`}</span>\n </>\n ) : (\n label\n )}\n <Icon className=\"icon-xxs\" aria-hidden=\"true\" />\n </button>\n </TableHead>\n );\n },\n);\nSortableTableHead.displayName = 'SortableTableHead';\n\nconst TableCell = React.forwardRef<\n HTMLTableCellElement,\n React.TdHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <td\n ref={ref}\n className={cn('p-4 align-middle text-label font-bold [&:has([role=checkbox])]:pr-0', className)}\n {...props}\n />\n));\nTableCell.displayName = 'TableCell';\n\nconst TableCaption = React.forwardRef<\n HTMLTableCaptionElement,\n React.HTMLAttributes<HTMLTableCaptionElement>\n>(({ className, ...props }, ref) => (\n <caption ref={ref} className={cn('mt-4 text-sm text-muted-foreground', className)} {...props} />\n));\nTableCaption.displayName = 'TableCaption';\n\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n SortableTableHead,\n TableRow,\n TableCell,\n TableCaption,\n};\n"]}
1
+ {"version":3,"file":"table.js","sourceRoot":"","sources":["../../../src/react/components/table.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAC5B,CAAC,EAAE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BAAoB,YACpD,KAAK,GACD,EACP,eAAM,SAAS,EAAC,SAAS,YAAE,GAAG,UAAU,KAAK,KAAK,EAAE,GAAQ,IAC3D,CACJ,CAAC,CAAC,CAAC,CACF,KAAK,CACN,EACD,KAAC,IAAI,IAAC,SAAS,EAAC,UAAU,iBAAa,MAAM,GAAG,IACzC,GACC,CACb,CAAC;AACJ,CAAC,CACF,CAAC;AACF,iBAAiB,CAAC,WAAW,GAAG,mBAAmB,CAAC;AAEpD,MAAM,SAAS,GAAG,KAAK,CAAC,UAAU,CAGhC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,aACE,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CAAC,qEAAqE,EAAE,SAAS,CAAC,KAC3F,KAAK,GACT,CACH,CAAC,CAAC;AACH,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;AAEpC,MAAM,YAAY,GAAG,KAAK,CAAC,UAAU,CAGnC,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,kBAAS,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,oCAAoC,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CACjG,CAAC,CAAC;AACH,YAAY,CAAC,WAAW,GAAG,cAAc,CAAC;AAE1C,OAAO,EACL,KAAK,EACL,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,iBAAiB,EACjB,QAAQ,EACR,SAAS,EACT,YAAY,GACb,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport { ArrowDown, ArrowUp, ArrowUpDown } from 'lucide-react';\nimport { cn } from '../../lib/utils.js';\n\nconst Table = React.forwardRef<HTMLTableElement, React.HTMLAttributes<HTMLTableElement>>(\n ({ className, ...props }, ref) => (\n <div className=\"relative w-full overflow-auto\">\n <table ref={ref} className={cn('w-full caption-bottom text-sm', className)} {...props} />\n </div>\n ),\n);\nTable.displayName = 'Table';\n\nconst TableHeader = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <thead ref={ref} className={cn('[&_tr]:border-b', className)} {...props} />\n));\nTableHeader.displayName = 'TableHeader';\n\nconst TableBody = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tbody ref={ref} className={cn('[&_tr:last-child]:border-0', className)} {...props} />\n));\nTableBody.displayName = 'TableBody';\n\nconst TableFooter = React.forwardRef<\n HTMLTableSectionElement,\n React.HTMLAttributes<HTMLTableSectionElement>\n>(({ className, ...props }, ref) => (\n <tfoot\n ref={ref}\n className={cn('border-t bg-muted/50 font-medium [&>tr]:last:border-b-0', className)}\n {...props}\n />\n));\nTableFooter.displayName = 'TableFooter';\n\nconst TableRow = React.forwardRef<HTMLTableRowElement, React.HTMLAttributes<HTMLTableRowElement>>(\n ({ className, ...props }, ref) => (\n <tr\n ref={ref}\n className={cn(\n 'border-b transition-colors hover:bg-[color:var(--table-row-hover)] data-[state=selected]:bg-muted',\n className,\n )}\n {...props}\n />\n ),\n);\nTableRow.displayName = 'TableRow';\n\nconst TableHead = React.forwardRef<\n HTMLTableCellElement,\n React.ThHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <th\n ref={ref}\n className={cn(\n 'h-12 px-4 text-left align-middle font-bold text-label [&:has([role=checkbox])]:pr-0',\n className,\n )}\n {...props}\n />\n));\nTableHead.displayName = 'TableHead';\n\nexport type SortDirection = 'asc' | 'desc';\n\nexport interface SortableTableHeadProps {\n label: string;\n shortLabel?: string;\n direction: SortDirection | null;\n onSort: () => void;\n className?: string;\n}\n\nconst ARIA_SORT: Record<SortDirection, 'ascending' | 'descending'> = {\n asc: 'ascending',\n desc: 'descending',\n};\n\nconst SortableTableHead = React.forwardRef<HTMLTableCellElement, SortableTableHeadProps>(\n ({ label, shortLabel, direction, onSort, className }, ref) => {\n const Icon = direction === 'asc' ? ArrowUp : direction === 'desc' ? ArrowDown : ArrowUpDown;\n return (\n <TableHead\n ref={ref}\n scope=\"col\"\n aria-sort={direction ? ARIA_SORT[direction] : undefined}\n className={className}\n >\n <button\n type=\"button\"\n onClick={onSort}\n className=\"inline-flex items-center gap-1 whitespace-nowrap rounded-sm ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2\"\n >\n {shortLabel ? (\n <>\n <span aria-hidden=\"true\" className=\"@4xl:hidden\">\n {shortLabel}\n </span>\n <span aria-hidden=\"true\" className=\"hidden @4xl:inline\">\n {label}\n </span>\n <span className=\"sr-only\">{`${shortLabel}, ${label}`}</span>\n </>\n ) : (\n label\n )}\n <Icon className=\"icon-xxs\" aria-hidden=\"true\" />\n </button>\n </TableHead>\n );\n },\n);\nSortableTableHead.displayName = 'SortableTableHead';\n\nconst TableCell = React.forwardRef<\n HTMLTableCellElement,\n React.TdHTMLAttributes<HTMLTableCellElement>\n>(({ className, ...props }, ref) => (\n <td\n ref={ref}\n className={cn('p-4 align-middle text-label font-bold [&:has([role=checkbox])]:pr-0', className)}\n {...props}\n />\n));\nTableCell.displayName = 'TableCell';\n\nconst TableCaption = React.forwardRef<\n HTMLTableCaptionElement,\n React.HTMLAttributes<HTMLTableCaptionElement>\n>(({ className, ...props }, ref) => (\n <caption ref={ref} className={cn('mt-4 text-sm text-muted-foreground', className)} {...props} />\n));\nTableCaption.displayName = 'TableCaption';\n\nexport {\n Table,\n TableHeader,\n TableBody,\n TableFooter,\n TableHead,\n SortableTableHead,\n TableRow,\n TableCell,\n TableCaption,\n};\n"]}
@@ -1,22 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import type { DeclaredInputFormat } from '@ttt-productions/input-format-core';
3
3
  type NativeTextareaProps = React.ComponentPropsWithoutRef<'textarea'>;
4
- /**
5
- * A multi-line free-text input: its declaration is required, and its length bounds come only from
6
- * that declaration (ENG-005), so `maxLength`, `minLength`, and `required` are not props.
7
- */
8
4
  export type FreeTextTextareaProps = Omit<NativeTextareaProps, 'maxLength' | 'minLength' | 'required'> & {
9
5
  inputFormat: DeclaredInputFormat;
10
6
  textEntry?: never;
11
7
  };
12
- /**
13
- * What a multi-line box that is not free text holds: identifiers (account, document, or case ids),
14
- * or a list of items. The box's text is split into items by the consumer, and each item is judged
15
- * by its own rule (the one-segment id rule, or the item's own field declaration) — so the box has
16
- * no input format of its own.
17
- */
18
8
  export type NonFreeTextareaEntry = 'identifier' | 'list';
19
- /** A multi-line box that is not free text: no input format; native bounds stay the caller's. */
20
9
  export type NonFreeTextTextareaProps = NativeTextareaProps & {
21
10
  textEntry: NonFreeTextareaEntry;
22
11
  inputFormat?: never;
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../src/react/components/textarea.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAI9E,KAAK,mBAAmB,GAAG,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;AAEtE;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,mBAAmB,EACnB,WAAW,GAAG,WAAW,GAAG,UAAU,CACvC,GAAG;IACF,WAAW,EAAE,mBAAmB,CAAC;IACjC,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,MAAM,CAAC;AAEzD,gGAAgG;AAChG,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,GAAG;IAC3D,SAAS,EAAE,oBAAoB,CAAC;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,qBAAqB,GAAG,wBAAwB,CAAC;AAE7E,QAAA,MAAM,QAAQ,2FAmBb,CAAC;AAGF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"textarea.d.ts","sourceRoot":"","sources":["../../../src/react/components/textarea.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAI9E,KAAK,mBAAmB,GAAG,KAAK,CAAC,wBAAwB,CAAC,UAAU,CAAC,CAAC;AAEtE,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,mBAAmB,EACnB,WAAW,GAAG,WAAW,GAAG,UAAU,CACvC,GAAG;IACF,WAAW,EAAE,mBAAmB,CAAC;IACjC,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,MAAM,CAAC;AAEzD,MAAM,MAAM,wBAAwB,GAAG,mBAAmB,GAAG;IAC3D,SAAS,EAAE,oBAAoB,CAAC;IAChC,WAAW,CAAC,EAAE,KAAK,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,qBAAqB,GAAG,wBAAwB,CAAC;AAE7E,QAAA,MAAM,QAAQ,2FAkBb,CAAC;AAGF,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -3,9 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
3
3
  import * as React from 'react';
4
4
  import { cn } from '../../lib/utils.js';
5
5
  import { formatControlAttributes, tidyOnBlur } from './format-control.js';
6
- const Textarea = React.forwardRef(
7
- // `textEntry` only selects the prop shape; it never reaches the DOM.
8
- ({ className, inputFormat, textEntry: _textEntry, onBlur, ...props }, ref) => {
6
+ const Textarea = React.forwardRef(({ className, inputFormat, textEntry: _textEntry, onBlur, ...props }, ref) => {
9
7
  return (_jsx("textarea", { className: cn('flex min-h-[80px] w-full rounded-md border-2 border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm', className), ref: ref, ...props, ...(inputFormat ? formatControlAttributes(inputFormat, props) : {}), onBlur: (event) => {
10
8
  if (inputFormat)
11
9
  tidyOnBlur(event.currentTarget, inputFormat);
@@ -1 +1 @@
1
- {"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../src/react/components/textarea.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAgC1E,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU;AAC/B,qEAAqE;AACrE,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC3E,OAAO,CACL,mBACE,SAAS,EAAE,EAAE,CACX,uTAAuT,EACvT,SAAS,CACV,EACD,GAAG,EAAE,GAAG,KACJ,KAAK,KACL,CAAC,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EACpE,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,IAAI,WAAW;gBAAE,UAAU,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;YAC9D,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AACF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { DeclaredInputFormat } from '@ttt-productions/input-format-core';\nimport { cn } from '../../lib/utils.js';\nimport { formatControlAttributes, tidyOnBlur } from './format-control.js';\n\ntype NativeTextareaProps = React.ComponentPropsWithoutRef<'textarea'>;\n\n/**\n * A multi-line free-text input: its declaration is required, and its length bounds come only from\n * that declaration (ENG-005), so `maxLength`, `minLength`, and `required` are not props.\n */\nexport type FreeTextTextareaProps = Omit<\n NativeTextareaProps,\n 'maxLength' | 'minLength' | 'required'\n> & {\n inputFormat: DeclaredInputFormat;\n textEntry?: never;\n};\n\n/**\n * What a multi-line box that is not free text holds: identifiers (account, document, or case ids),\n * or a list of items. The box's text is split into items by the consumer, and each item is judged\n * by its own rule (the one-segment id rule, or the item's own field declaration) — so the box has\n * no input format of its own.\n */\nexport type NonFreeTextareaEntry = 'identifier' | 'list';\n\n/** A multi-line box that is not free text: no input format; native bounds stay the caller's. */\nexport type NonFreeTextTextareaProps = NativeTextareaProps & {\n textEntry: NonFreeTextareaEntry;\n inputFormat?: never;\n};\n\nexport type TextareaProps = FreeTextTextareaProps | NonFreeTextTextareaProps;\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n // `textEntry` only selects the prop shape; it never reaches the DOM.\n ({ className, inputFormat, textEntry: _textEntry, onBlur, ...props }, ref) => {\n return (\n <textarea\n className={cn(\n 'flex min-h-[80px] w-full rounded-md border-2 border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n className,\n )}\n ref={ref}\n {...props}\n {...(inputFormat ? formatControlAttributes(inputFormat, props) : {})}\n onBlur={(event) => {\n if (inputFormat) tidyOnBlur(event.currentTarget, inputFormat);\n onBlur?.(event);\n }}\n />\n );\n },\n);\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n"]}
1
+ {"version":3,"file":"textarea.js","sourceRoot":"","sources":["../../../src/react/components/textarea.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAqB1E,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAC/B,CAAC,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,GAAG,EAAE,EAAE;IAC3E,OAAO,CACL,mBACE,SAAS,EAAE,EAAE,CACX,uTAAuT,EACvT,SAAS,CACV,EACD,GAAG,EAAE,GAAG,KACJ,KAAK,KACL,CAAC,WAAW,CAAC,CAAC,CAAC,uBAAuB,CAAC,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EACpE,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;YAChB,IAAI,WAAW;gBAAE,UAAU,CAAC,KAAK,CAAC,aAAa,EAAE,WAAW,CAAC,CAAC;YAC9D,MAAM,EAAE,CAAC,KAAK,CAAC,CAAC;QAClB,CAAC,GACD,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AACF,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,CAAC","sourcesContent":["'use client';\n\nimport * as React from 'react';\nimport type { DeclaredInputFormat } from '@ttt-productions/input-format-core';\nimport { cn } from '../../lib/utils.js';\nimport { formatControlAttributes, tidyOnBlur } from './format-control.js';\n\ntype NativeTextareaProps = React.ComponentPropsWithoutRef<'textarea'>;\n\nexport type FreeTextTextareaProps = Omit<\n NativeTextareaProps,\n 'maxLength' | 'minLength' | 'required'\n> & {\n inputFormat: DeclaredInputFormat;\n textEntry?: never;\n};\n\nexport type NonFreeTextareaEntry = 'identifier' | 'list';\n\nexport type NonFreeTextTextareaProps = NativeTextareaProps & {\n textEntry: NonFreeTextareaEntry;\n inputFormat?: never;\n};\n\nexport type TextareaProps = FreeTextTextareaProps | NonFreeTextTextareaProps;\n\nconst Textarea = React.forwardRef<HTMLTextAreaElement, TextareaProps>(\n ({ className, inputFormat, textEntry: _textEntry, onBlur, ...props }, ref) => {\n return (\n <textarea\n className={cn(\n 'flex min-h-[80px] w-full rounded-md border-2 border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm',\n className,\n )}\n ref={ref}\n {...props}\n {...(inputFormat ? formatControlAttributes(inputFormat, props) : {})}\n onBlur={(event) => {\n if (inputFormat) tidyOnBlur(event.currentTarget, inputFormat);\n onBlur?.(event);\n }}\n />\n );\n },\n);\nTextarea.displayName = 'Textarea';\n\nexport { Textarea };\n"]}
@@ -6,18 +6,14 @@ declare const ToastViewport: React.ForwardRefExoticComponent<Omit<ToastPrimitive
6
6
  declare const Toast: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastProps & React.RefAttributes<HTMLLIElement>, "ref"> & VariantProps<(props?: ({
7
7
  variant?: "error" | "default" | "destructive" | "success" | "warning" | null | undefined;
8
8
  } & import("class-variance-authority/types").ClassProp) | undefined) => string> & {
9
- /** ms; ignored when `persistent` is true */
10
9
  duration?: number;
11
- /** show X button */
12
10
  dismissible?: boolean;
13
- /** When true: no auto-dismiss, no countdown bar. */
14
11
  persistent?: boolean;
15
12
  } & React.RefAttributes<HTMLLIElement>>;
16
13
  declare const ToastAction: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastActionProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
17
14
  declare const ToastClose: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastCloseProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
18
15
  declare const ToastTitle: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastTitleProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
19
16
  declare const ToastDescription: React.ForwardRefExoticComponent<Omit<ToastPrimitives.ToastDescriptionProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
20
- /** Exported types for consumers */
21
17
  export type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;
22
18
  export type ToastActionElement = React.ReactElement<typeof ToastAction>;
23
19
  export { ToastProvider, ToastViewport, Toast, ToastTitle, ToastDescription, ToastClose, ToastAction, };
@@ -1 +1 @@
1
- {"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../src/react/components/toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAsDlE,QAAA,MAAM,aAAa,8CAA2B,CAAC;AAE/C,QAAA,MAAM,aAAa,kKAajB,CAAC;AAaH,QAAA,MAAM,KAAK;;;IARP,4CAA4C;eACjC,MAAM;IACjB,oBAAoB;kBACN,OAAO;IACrB,oDAAoD;iBACvC,OAAO;uCAqFvB,CAAC;AAGF,QAAA,MAAM,WAAW,kKAKf,CAAC;AAGH,QAAA,MAAM,UAAU,iKAcd,CAAC;AAGH,QAAA,MAAM,UAAU,2JAKd,CAAC;AAGH,QAAA,MAAM,gBAAgB,iKAKpB,CAAC;AAGH,mCAAmC;AACnC,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,CAAC,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC;AAExE,OAAO,EACL,aAAa,EACb,aAAa,EACb,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,CAAC"}
1
+ {"version":3,"file":"toast.d.ts","sourceRoot":"","sources":["../../../src/react/components/toast.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AA6ClE,QAAA,MAAM,aAAa,8CAA2B,CAAC;AAE/C,QAAA,MAAM,aAAa,kKAajB,CAAC;AAUH,QAAA,MAAM,KAAK;;;eALI,MAAM;kBACH,OAAO;iBACR,OAAO;uCAyEvB,CAAC;AAGF,QAAA,MAAM,WAAW,kKAKf,CAAC;AAGH,QAAA,MAAM,UAAU,iKAcd,CAAC;AAGH,QAAA,MAAM,UAAU,2JAKd,CAAC;AAGH,QAAA,MAAM,gBAAgB,iKAKpB,CAAC;AAGH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,wBAAwB,CAAC,OAAO,KAAK,CAAC,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC;AAExE,OAAO,EACL,aAAa,EACb,aAAa,EACb,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,CAAC"}
@@ -4,23 +4,12 @@ import * as ToastPrimitives from '@radix-ui/react-toast';
4
4
  import { cva } from 'class-variance-authority';
5
5
  import { X } from 'lucide-react';
6
6
  import { cn } from '../../lib/utils.js';
7
- /**
8
- * ui-core Toasts are consumed by multiple apps.
9
- *
10
- * Do NOT rely on app-level CSS (@apply) for critical positioning/visibility.
11
- * Keep all required styling inline as Tailwind utility classes.
12
- */
13
7
  function ToastKeyframes() {
14
- // Inject a tiny global keyframe used by the optional countdown bar.
15
8
  return (_jsx("style", { dangerouslySetInnerHTML: {
16
9
  __html: `@keyframes toast-progress{from{transform:scaleX(1)}to{transform:scaleX(0)}}`,
17
10
  } }));
18
11
  }
19
- const toastVariants = cva(cn(
20
- // base
21
- 'pointer-events-auto relative flex w-full items-start justify-between gap-2 overflow-hidden rounded-md border bg-background p-4 text-foreground elevation-raised duration-[var(--motion-base)] ease-[var(--motion-ease)]',
22
- // radix state/animation
23
- 'data-[state=open]:animate-in data-[state=closed]:animate-out', 'data-[state=closed]:fade-out-80 data-[state=open]:fade-in-80', 'data-[state=closed]:slide-out-to-top-full data-[state=open]:slide-in-from-top-full', 'data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)]', 'data-[swipe=cancel]:translate-x-0 data-[swipe=cancel]:transition-transform', 'data-[swipe=end]:animate-out data-[swipe=end]:slide-out-to-right-full'), {
12
+ const toastVariants = cva(cn('pointer-events-auto relative flex w-full items-start justify-between gap-2 overflow-hidden rounded-md border bg-background p-4 text-foreground elevation-raised duration-[var(--motion-base)] ease-[var(--motion-ease)]', 'data-[state=open]:animate-in data-[state=closed]:animate-out', 'data-[state=closed]:fade-out-80 data-[state=open]:fade-in-80', 'data-[state=closed]:slide-out-to-top-full data-[state=open]:slide-in-from-top-full', 'data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)]', 'data-[swipe=cancel]:translate-x-0 data-[swipe=cancel]:transition-transform', 'data-[swipe=end]:animate-out data-[swipe=end]:slide-out-to-right-full'), {
24
13
  variants: {
25
14
  variant: {
26
15
  default: '',
@@ -38,10 +27,7 @@ const ToastProvider = ToastPrimitives.Provider;
38
27
  const ToastViewport = React.forwardRef(({ className, ...props }, ref) => (_jsx(ToastPrimitives.Viewport, { ref: ref, className: cn('fixed top-0 left-1/2 -translate-x-1/2 z-[100] flex max-h-screen w-full flex-col gap-2 p-4', 'sm:max-w-[480px] md:max-w-[600px]', className), ...props })));
39
28
  ToastViewport.displayName = ToastPrimitives.Viewport.displayName;
40
29
  const Toast = React.forwardRef(({ className, variant, duration, dismissible = true, persistent = false, style, children, onOpenChange, ...props }, ref) => {
41
- // Caller is the source of truth for duration. Persistent toasts disable
42
- // the auto-dismiss entirely by passing `Infinity` to Radix.
43
30
  const effectiveDuration = persistent ? Infinity : (duration ?? 5000);
44
- // pass duration to Radix AND to CSS countdown bar
45
31
  const mergedStyle = {
46
32
  ...style,
47
33
  ['--toast-duration']: `${effectiveDuration}ms`,
@@ -52,15 +38,8 @@ const Toast = React.forwardRef(({ className, variant, duration, dismissible = tr
52
38
  animationTimingFunction: 'linear',
53
39
  animationFillMode: 'forwards',
54
40
  },
55
- // Radix's own auto-close timer PAUSES on pointer-over the viewport,
56
- // focus, and window-blur — but this CSS bar does not. When the bar
57
- // empties we must dismiss regardless of Radix's paused timer, so the
58
- // toast never lingers after the countdown visibly reaches zero.
59
- // Only a bar that ran its course counts as empty: a reduced-motion
60
- // stylesheet that collapses every animation to near zero ends this one
61
- // at once, and closing then would hide the toast before anyone reads
62
- // it. Radix's `duration` above is the motion-independent timer that
63
- // closes the toast in that case.
41
+ // Radix's auto-close timer pauses on hover, focus, and blur but this CSS bar does not, so an emptied bar closes the toast.
42
+ // A reduced-motion stylesheet ends the bar at once; Radix's `duration` closes the toast then.
64
43
  onAnimationEnd: (e) => {
65
44
  if (e.animationName !== 'toast-progress')
66
45
  return;
@@ -1 +1 @@
1
- {"version":3,"file":"toast.js","sourceRoot":"","sources":["../../../src/react/components/toast.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAC;AAExC;;;;;GAKG;AACH,SAAS,cAAc;IACrB,oEAAoE;IACpE,OAAO,CACL,gBACE,uBAAuB,EAAE;YACvB,MAAM,EAAE,6EAA6E;SACtF,GACD,CACH,CAAC;AACJ,CAAC;AAED,MAAM,aAAa,GAAG,GAAG,CACvB,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AK,EAAE,EAAE,GAAG,EAAE,EAAE,CAAC,CAClC,KAAC,eAAe,CAAC,WAAW,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAC9F,CAAC,CAAC;AACH,gBAAgB,CAAC,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC,WAAW,CAAC;AAMvE,OAAO,EACL,aAAa,EACb,aAAa,EACb,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,CAAC","sourcesContent":["import * as React from 'react';\nimport * as ToastPrimitives from '@radix-ui/react-toast';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { X } from 'lucide-react';\n\nimport { cn } from '../../lib/utils.js';\n\n/**\n * ui-core Toasts are consumed by multiple apps.\n *\n * Do NOT rely on app-level CSS (@apply) for critical positioning/visibility.\n * Keep all required styling inline as Tailwind utility classes.\n */\nfunction ToastKeyframes() {\n // Inject a tiny global keyframe used by the optional countdown bar.\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: `@keyframes toast-progress{from{transform:scaleX(1)}to{transform:scaleX(0)}}`,\n }}\n />\n );\n}\n\nconst toastVariants = cva(\n cn(\n // base\n 'pointer-events-auto relative flex w-full items-start justify-between gap-2 overflow-hidden rounded-md border bg-background p-4 text-foreground elevation-raised duration-[var(--motion-base)] ease-[var(--motion-ease)]',\n // radix state/animation\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-80 data-[state=open]:fade-in-80',\n 'data-[state=closed]:slide-out-to-top-full data-[state=open]:slide-in-from-top-full',\n 'data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)]',\n 'data-[swipe=cancel]:translate-x-0 data-[swipe=cancel]:transition-transform',\n 'data-[swipe=end]:animate-out data-[swipe=end]:slide-out-to-right-full',\n ),\n {\n variants: {\n variant: {\n default: '',\n destructive:\n 'border-[color:var(--toast-destructive-border)] bg-[color:var(--toast-destructive)] text-[color:var(--toast-destructive-foreground)]',\n success:\n 'border-[color:var(--toast-success-border)] bg-[color:var(--toast-success)] text-[color:var(--toast-success-foreground)]',\n warning:\n 'border-[color:var(--toast-warning-border)] bg-[color:var(--toast-warning)] text-[color:var(--toast-warning-foreground)]',\n error:\n 'border-[color:var(--toast-destructive-border)] bg-[color:var(--toast-destructive)] text-[color:var(--toast-destructive-foreground)]',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\nconst ToastProvider = ToastPrimitives.Provider;\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n 'fixed top-0 left-1/2 -translate-x-1/2 z-[100] flex max-h-screen w-full flex-col gap-2 p-4',\n 'sm:max-w-[480px] md:max-w-[600px]',\n className,\n )}\n {...props}\n />\n));\nToastViewport.displayName = ToastPrimitives.Viewport.displayName;\n\ntype ToastRootProps = React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants> & {\n /** ms; ignored when `persistent` is true */\n duration?: number;\n /** show X button */\n dismissible?: boolean;\n /** When true: no auto-dismiss, no countdown bar. */\n persistent?: boolean;\n };\n\nconst Toast = React.forwardRef<React.ElementRef<typeof ToastPrimitives.Root>, ToastRootProps>(\n (\n {\n className,\n variant,\n duration,\n dismissible = true,\n persistent = false,\n style,\n children,\n onOpenChange,\n ...props\n },\n ref,\n ) => {\n // Caller is the source of truth for duration. Persistent toasts disable\n // the auto-dismiss entirely by passing `Infinity` to Radix.\n const effectiveDuration = persistent ? Infinity : (duration ?? 5000);\n // pass duration to Radix AND to CSS countdown bar\n const mergedStyle: React.CSSProperties = {\n ...(style as React.CSSProperties),\n ['--toast-duration' as any]: `${effectiveDuration}ms`,\n };\n\n return (\n <ToastPrimitives.Root\n ref={ref}\n duration={effectiveDuration}\n data-variant={variant}\n data-persistent={persistent ? '' : undefined}\n className={cn(toastVariants({ variant }), className)}\n style={mergedStyle}\n onOpenChange={onOpenChange}\n {...props}\n >\n <ToastKeyframes />\n {children}\n\n {/* countdown bar — hidden entirely for persistent toasts */}\n {!persistent ? (\n <div\n aria-hidden\n className={cn('absolute bottom-0 left-0 h-1 w-full bg-foreground/30', 'origin-left')}\n style={{\n animationName: 'toast-progress',\n animationDuration: `${effectiveDuration}ms`,\n animationTimingFunction: 'linear',\n animationFillMode: 'forwards',\n }}\n // Radix's own auto-close timer PAUSES on pointer-over the viewport,\n // focus, and window-blur — but this CSS bar does not. When the bar\n // empties we must dismiss regardless of Radix's paused timer, so the\n // toast never lingers after the countdown visibly reaches zero.\n // Only a bar that ran its course counts as empty: a reduced-motion\n // stylesheet that collapses every animation to near zero ends this one\n // at once, and closing then would hide the toast before anyone reads\n // it. Radix's `duration` above is the motion-independent timer that\n // closes the toast in that case.\n onAnimationEnd={(e) => {\n if (e.animationName !== 'toast-progress') return;\n if (e.elapsedTime * 1000 < effectiveDuration / 2) return;\n onOpenChange?.(false);\n }}\n />\n ) : null}\n\n {/* dismiss button */}\n {dismissible ? (\n <ToastPrimitives.Close\n className={cn(\n 'absolute right-2 top-2 inline-flex h-7 w-7 items-center justify-center rounded-md',\n 'text-foreground/60 hover:text-foreground',\n 'focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background',\n )}\n aria-label=\"Dismiss toast\"\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n ) : null}\n </ToastPrimitives.Root>\n );\n },\n);\nToast.displayName = ToastPrimitives.Root.displayName;\n\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Action ref={ref} className={cn(className)} {...props} />\n));\nToastAction.displayName = ToastPrimitives.Action.displayName;\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n 'absolute right-2 top-2 inline-flex h-7 w-7 items-center justify-center rounded-md',\n 'text-foreground/60 hover:text-foreground',\n 'focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background',\n className,\n )}\n {...props}\n />\n));\nToastClose.displayName = ToastPrimitives.Close.displayName;\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Title ref={ref} className={cn('break-words', className)} {...props} />\n));\nToastTitle.displayName = ToastPrimitives.Title.displayName;\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Description ref={ref} className={cn('break-words', className)} {...props} />\n));\nToastDescription.displayName = ToastPrimitives.Description.displayName;\n\n/** Exported types for consumers */\nexport type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;\nexport type ToastActionElement = React.ReactElement<typeof ToastAction>;\n\nexport {\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n};\n"]}
1
+ {"version":3,"file":"toast.js","sourceRoot":"","sources":["../../../src/react/components/toast.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,eAAe,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,CAAC,EAAE,MAAM,cAAc,CAAC;AAEjC,OAAO,EAAE,EAAE,EAAE,MAAM,oBA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AG,EAAE,EAAE,CAAC,CAClC,KAAC,eAAe,CAAC,WAAW,IAAC,GAAG,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,CAAC,aAAa,EAAE,SAAS,CAAC,KAAM,KAAK,GAAI,CAC9F,CAAC,CAAC;AACH,gBAAgB,CAAC,WAAW,GAAG,eAAe,CAAC,WAAW,CAAC,WAAW,CAAC;AAKvE,OAAO,EACL,aAAa,EACb,aAAa,EACb,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,UAAU,EACV,WAAW,GACZ,CAAC","sourcesContent":["import * as React from 'react';\nimport * as ToastPrimitives from '@radix-ui/react-toast';\nimport { cva, type VariantProps } from 'class-variance-authority';\nimport { X } from 'lucide-react';\n\nimport { cn } from '../../lib/utils.js';\n\nfunction ToastKeyframes() {\n return (\n <style\n dangerouslySetInnerHTML={{\n __html: `@keyframes toast-progress{from{transform:scaleX(1)}to{transform:scaleX(0)}}`,\n }}\n />\n );\n}\n\nconst toastVariants = cva(\n cn(\n 'pointer-events-auto relative flex w-full items-start justify-between gap-2 overflow-hidden rounded-md border bg-background p-4 text-foreground elevation-raised duration-[var(--motion-base)] ease-[var(--motion-ease)]',\n 'data-[state=open]:animate-in data-[state=closed]:animate-out',\n 'data-[state=closed]:fade-out-80 data-[state=open]:fade-in-80',\n 'data-[state=closed]:slide-out-to-top-full data-[state=open]:slide-in-from-top-full',\n 'data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)]',\n 'data-[swipe=cancel]:translate-x-0 data-[swipe=cancel]:transition-transform',\n 'data-[swipe=end]:animate-out data-[swipe=end]:slide-out-to-right-full',\n ),\n {\n variants: {\n variant: {\n default: '',\n destructive:\n 'border-[color:var(--toast-destructive-border)] bg-[color:var(--toast-destructive)] text-[color:var(--toast-destructive-foreground)]',\n success:\n 'border-[color:var(--toast-success-border)] bg-[color:var(--toast-success)] text-[color:var(--toast-success-foreground)]',\n warning:\n 'border-[color:var(--toast-warning-border)] bg-[color:var(--toast-warning)] text-[color:var(--toast-warning-foreground)]',\n error:\n 'border-[color:var(--toast-destructive-border)] bg-[color:var(--toast-destructive)] text-[color:var(--toast-destructive-foreground)]',\n },\n },\n defaultVariants: {\n variant: 'default',\n },\n },\n);\n\nconst ToastProvider = ToastPrimitives.Provider;\n\nconst ToastViewport = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Viewport>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Viewport>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Viewport\n ref={ref}\n className={cn(\n 'fixed top-0 left-1/2 -translate-x-1/2 z-[100] flex max-h-screen w-full flex-col gap-2 p-4',\n 'sm:max-w-[480px] md:max-w-[600px]',\n className,\n )}\n {...props}\n />\n));\nToastViewport.displayName = ToastPrimitives.Viewport.displayName;\n\ntype ToastRootProps = React.ComponentPropsWithoutRef<typeof ToastPrimitives.Root> &\n VariantProps<typeof toastVariants> & {\n duration?: number;\n dismissible?: boolean;\n persistent?: boolean;\n };\n\nconst Toast = React.forwardRef<React.ElementRef<typeof ToastPrimitives.Root>, ToastRootProps>(\n (\n {\n className,\n variant,\n duration,\n dismissible = true,\n persistent = false,\n style,\n children,\n onOpenChange,\n ...props\n },\n ref,\n ) => {\n const effectiveDuration = persistent ? Infinity : (duration ?? 5000);\n const mergedStyle: React.CSSProperties = {\n ...(style as React.CSSProperties),\n ['--toast-duration' as any]: `${effectiveDuration}ms`,\n };\n\n return (\n <ToastPrimitives.Root\n ref={ref}\n duration={effectiveDuration}\n data-variant={variant}\n data-persistent={persistent ? '' : undefined}\n className={cn(toastVariants({ variant }), className)}\n style={mergedStyle}\n onOpenChange={onOpenChange}\n {...props}\n >\n <ToastKeyframes />\n {children}\n\n {!persistent ? (\n <div\n aria-hidden\n className={cn('absolute bottom-0 left-0 h-1 w-full bg-foreground/30', 'origin-left')}\n style={{\n animationName: 'toast-progress',\n animationDuration: `${effectiveDuration}ms`,\n animationTimingFunction: 'linear',\n animationFillMode: 'forwards',\n }}\n // Radix's auto-close timer pauses on hover, focus, and blur but this CSS bar does not, so an emptied bar closes the toast.\n // A reduced-motion stylesheet ends the bar at once; Radix's `duration` closes the toast then.\n onAnimationEnd={(e) => {\n if (e.animationName !== 'toast-progress') return;\n if (e.elapsedTime * 1000 < effectiveDuration / 2) return;\n onOpenChange?.(false);\n }}\n />\n ) : null}\n\n {dismissible ? (\n <ToastPrimitives.Close\n className={cn(\n 'absolute right-2 top-2 inline-flex h-7 w-7 items-center justify-center rounded-md',\n 'text-foreground/60 hover:text-foreground',\n 'focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background',\n )}\n aria-label=\"Dismiss toast\"\n >\n <X className=\"h-4 w-4\" />\n </ToastPrimitives.Close>\n ) : null}\n </ToastPrimitives.Root>\n );\n },\n);\nToast.displayName = ToastPrimitives.Root.displayName;\n\nconst ToastAction = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Action>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Action>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Action ref={ref} className={cn(className)} {...props} />\n));\nToastAction.displayName = ToastPrimitives.Action.displayName;\n\nconst ToastClose = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Close>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Close>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Close\n ref={ref}\n className={cn(\n 'absolute right-2 top-2 inline-flex h-7 w-7 items-center justify-center rounded-md',\n 'text-foreground/60 hover:text-foreground',\n 'focus:outline-hidden focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:ring-offset-background',\n className,\n )}\n {...props}\n />\n));\nToastClose.displayName = ToastPrimitives.Close.displayName;\n\nconst ToastTitle = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Title>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Title>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Title ref={ref} className={cn('break-words', className)} {...props} />\n));\nToastTitle.displayName = ToastPrimitives.Title.displayName;\n\nconst ToastDescription = React.forwardRef<\n React.ElementRef<typeof ToastPrimitives.Description>,\n React.ComponentPropsWithoutRef<typeof ToastPrimitives.Description>\n>(({ className, ...props }, ref) => (\n <ToastPrimitives.Description ref={ref} className={cn('break-words', className)} {...props} />\n));\nToastDescription.displayName = ToastPrimitives.Description.displayName;\n\nexport type ToastProps = React.ComponentPropsWithoutRef<typeof Toast>;\nexport type ToastActionElement = React.ReactElement<typeof ToastAction>;\n\nexport {\n ToastProvider,\n ToastViewport,\n Toast,\n ToastTitle,\n ToastDescription,\n ToastClose,\n ToastAction,\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../../../src/react/components/toaster.tsx"],"names":[],"mappings":"AAaA,wBAAgB,OAAO,gCAkDtB"}
1
+ {"version":3,"file":"toaster.d.ts","sourceRoot":"","sources":["../../../src/react/components/toaster.tsx"],"names":[],"mappings":"AAaA,wBAAgB,OAAO,gCAiDtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"toaster.js","sourceRoot":"","sources":["../../../src/react/components/toaster.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,MAAM,UAAU,OAAO;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAgC,CAAC;IAE5D,OAAO,CACL,MAAC,aAAa,IAAC,cAAc,EAAC,OAAO,EAAC,cAAc,EAAE,EAAE,aACrD,MAAM,CAAC,GAAG,CAAC,CAAC,CAAe,EAAE,EAAE;gBAC9B,MAAM,EACJ,EAAE,EACF,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAO,EACP,QAAQ,EACR,WAAW,EACX,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,GAAG,KAAK,EACT,GAAG,CAAC,CAAC;gBAEN,MAAM,CAAC,GACL,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC;gBAE/D,OAAO,CACL,MAAC,KAAK,IAEJ,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,CAAQ,EACjB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,IAAI,IAAI,EAChC,UAAU,EAAE,UAAU,IAAI,KAAK,KAC1B,KAAa,aAElB,eAAK,SAAS,EAAC,kBAAkB,aAC9B,KAAK,CAAC,CAAC,CAAC,KAAC,UAAU,IAAC,SAAS,EAAC,WAAW,YAAE,KAAK,GAAc,CAAC,CAAC,CAAC,IAAI,EACrE,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,gBAAgB,IAAC,SAAS,EAAC,WAAW,YAAE,WAAW,GAAoB,CACzE,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,MAAM,EACP,KAAC,UAAU,KAAG,KAhBT,EAAE,CAiBD,CACT,CAAC;YACJ,CAAC,CAAC,EAGF,KAAC,aAAa,KAAG,IACH,CACjB,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from './toast.js';\nimport { useToast } from '../hooks/use-toast.js';\nimport type { ToasterToast, ToastVariant } from '../hooks/use-toast.js';\n\nexport function Toaster() {\n const { toasts } = useToast() as { toasts: ToasterToast[] };\n\n return (\n <ToastProvider swipeDirection=\"right\" swipeThreshold={32}>\n {toasts.map((t: ToasterToast) => {\n const {\n id,\n title,\n description,\n action,\n variant,\n duration,\n dismissible,\n persistent,\n open,\n onOpenChange,\n ...props\n } = t;\n\n const v: ToastVariant | 'destructive' =\n variant === 'error' ? 'destructive' : (variant ?? 'default');\n\n return (\n <Toast\n key={id}\n open={open}\n onOpenChange={onOpenChange}\n variant={v as any}\n duration={duration}\n dismissible={dismissible ?? true}\n persistent={persistent ?? false}\n {...(props as any)}\n >\n <div className=\"grid gap-1 pr-10\">\n {title ? <ToastTitle className=\"font-bold\">{title}</ToastTitle> : null}\n {description ? (\n <ToastDescription className=\"font-bold\">{description}</ToastDescription>\n ) : null}\n </div>\n {action}\n <ToastClose />\n </Toast>\n );\n })}\n\n {/* debug: proves viewport is visible/on-screen */}\n <ToastViewport />\n </ToastProvider>\n );\n}\n"]}
1
+ {"version":3,"file":"toaster.js","sourceRoot":"","sources":["../../../src/react/components/toaster.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,KAAK,EACL,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAGjD,MAAM,UAAU,OAAO;IACrB,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAgC,CAAC;IAE5D,OAAO,CACL,MAAC,aAAa,IAAC,cAAc,EAAC,OAAO,EAAC,cAAc,EAAE,EAAE,aACrD,MAAM,CAAC,GAAG,CAAC,CAAC,CAAe,EAAE,EAAE;gBAC9B,MAAM,EACJ,EAAE,EACF,KAAK,EACL,WAAW,EACX,MAAM,EACN,OAAO,EACP,QAAQ,EACR,WAAW,EACX,UAAU,EACV,IAAI,EACJ,YAAY,EACZ,GAAG,KAAK,EACT,GAAG,CAAC,CAAC;gBAEN,MAAM,CAAC,GACL,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,OAAO,IAAI,SAAS,CAAC,CAAC;gBAE/D,OAAO,CACL,MAAC,KAAK,IAEJ,IAAI,EAAE,IAAI,EACV,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,CAAQ,EACjB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,WAAW,IAAI,IAAI,EAChC,UAAU,EAAE,UAAU,IAAI,KAAK,KAC1B,KAAa,aAElB,eAAK,SAAS,EAAC,kBAAkB,aAC9B,KAAK,CAAC,CAAC,CAAC,KAAC,UAAU,IAAC,SAAS,EAAC,WAAW,YAAE,KAAK,GAAc,CAAC,CAAC,CAAC,IAAI,EACrE,WAAW,CAAC,CAAC,CAAC,CACb,KAAC,gBAAgB,IAAC,SAAS,EAAC,WAAW,YAAE,WAAW,GAAoB,CACzE,CAAC,CAAC,CAAC,IAAI,IACJ,EACL,MAAM,EACP,KAAC,UAAU,KAAG,KAhBT,EAAE,CAiBD,CACT,CAAC;YACJ,CAAC,CAAC,EAEF,KAAC,aAAa,KAAG,IACH,CACjB,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport {\n Toast,\n ToastClose,\n ToastDescription,\n ToastProvider,\n ToastTitle,\n ToastViewport,\n} from './toast.js';\nimport { useToast } from '../hooks/use-toast.js';\nimport type { ToasterToast, ToastVariant } from '../hooks/use-toast.js';\n\nexport function Toaster() {\n const { toasts } = useToast() as { toasts: ToasterToast[] };\n\n return (\n <ToastProvider swipeDirection=\"right\" swipeThreshold={32}>\n {toasts.map((t: ToasterToast) => {\n const {\n id,\n title,\n description,\n action,\n variant,\n duration,\n dismissible,\n persistent,\n open,\n onOpenChange,\n ...props\n } = t;\n\n const v: ToastVariant | 'destructive' =\n variant === 'error' ? 'destructive' : (variant ?? 'default');\n\n return (\n <Toast\n key={id}\n open={open}\n onOpenChange={onOpenChange}\n variant={v as any}\n duration={duration}\n dismissible={dismissible ?? true}\n persistent={persistent ?? false}\n {...(props as any)}\n >\n <div className=\"grid gap-1 pr-10\">\n {title ? <ToastTitle className=\"font-bold\">{title}</ToastTitle> : null}\n {description ? (\n <ToastDescription className=\"font-bold\">{description}</ToastDescription>\n ) : null}\n </div>\n {action}\n <ToastClose />\n </Toast>\n );\n })}\n\n <ToastViewport />\n </ToastProvider>\n );\n}\n"]}
@@ -1,30 +1,10 @@
1
1
  export interface UseAsyncActionOptions {
2
- /**
3
- * Receives anything the action throws. REQUIRED, so every call site decides what a
4
- * failure means (surface it, capture it, or accept that another layer already did):
5
- * `run` itself never rejects, so a fire-and-forget `onClick={() => void run()}` can
6
- * never become an unhandled rejection.
7
- */
8
2
  onError: (error: unknown) => void;
9
3
  }
10
4
  export interface AsyncAction<TArgs extends unknown[]> {
11
- /**
12
- * Starts the action unless one is already in flight — a repeat call while pending is
13
- * ignored. Resolves once the action settles: `true` when it completed, `false` when it
14
- * was ignored or threw. Never rejects.
15
- */
16
5
  run: (...args: TArgs) => Promise<boolean>;
17
- /** True from the moment `run` starts the action until it settles. */
18
6
  pending: boolean;
19
7
  }
20
- /**
21
- * Pending state + repeat guard for async work that is NOT a React Query mutation
22
- * (a local media step, a sign-out, an awaited navigation). Feed `pending` to the
23
- * control's own `pending` prop. Server writes stay mutations — this hook does not
24
- * replace the data layer's one mutation path.
25
- *
26
- * The guard is a ref, not the state, so two clicks inside one frame cannot both start
27
- * the action.
28
- */
8
+ /** The guard is a ref, not state, so two clicks inside one frame cannot both start the action. */
29
9
  export declare function useAsyncAction<TArgs extends unknown[]>(action: (...args: TArgs) => Promise<unknown>, options: UseAsyncActionOptions): AsyncAction<TArgs>;
30
10
  //# sourceMappingURL=use-async-action.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-async-action.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-async-action.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,WAAW,CAAC,KAAK,SAAS,OAAO,EAAE;IAClD;;;;OAIG;IACH,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,qEAAqE;IACrE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,SAAS,OAAO,EAAE,EACpD,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,EAC5C,OAAO,EAAE,qBAAqB,GAC7B,WAAW,CAAC,KAAK,CAAC,CAyBpB"}
1
+ {"version":3,"file":"use-async-action.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-async-action.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,WAAW,CAAC,KAAK,SAAS,OAAO,EAAE;IAClD,GAAG,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC1C,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,kGAAkG;AAClG,wBAAgB,cAAc,CAAC,KAAK,SAAS,OAAO,EAAE,EACpD,MAAM,EAAE,CAAC,GAAG,IAAI,EAAE,KAAK,KAAK,OAAO,CAAC,OAAO,CAAC,EAC5C,OAAO,EAAE,qBAAqB,GAC7B,WAAW,CAAC,KAAK,CAAC,CAyBpB"}
@@ -1,14 +1,6 @@
1
1
  'use client';
2
2
  import { useCallback, useRef, useState } from 'react';
3
- /**
4
- * Pending state + repeat guard for async work that is NOT a React Query mutation
5
- * (a local media step, a sign-out, an awaited navigation). Feed `pending` to the
6
- * control's own `pending` prop. Server writes stay mutations — this hook does not
7
- * replace the data layer's one mutation path.
8
- *
9
- * The guard is a ref, not the state, so two clicks inside one frame cannot both start
10
- * the action.
11
- */
3
+ /** The guard is a ref, not state, so two clicks inside one frame cannot both start the action. */
12
4
  export function useAsyncAction(action, options) {
13
5
  const [pending, setPending] = useState(false);
14
6
  const inFlightRef = useRef(false);
@@ -1 +1 @@
1
- {"version":3,"file":"use-async-action.js","sourceRoot":"","sources":["../../../src/react/hooks/use-async-action.ts"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ions {\n /**\n * Receives anything the action throws. REQUIRED, so every call site decides what a\n * failure means (surface it, capture it, or accept that another layer already did):\n * `run` itself never rejects, so a fire-and-forget `onClick={() => void run()}` can\n * never become an unhandled rejection.\n */\n onError: (error: unknown) => void;\n}\n\nexport interface AsyncAction<TArgs extends unknown[]> {\n /**\n * Starts the action unless one is already in flight — a repeat call while pending is\n * ignored. Resolves once the action settles: `true` when it completed, `false` when it\n * was ignored or threw. Never rejects.\n */\n run: (...args: TArgs) => Promise<boolean>;\n /** True from the moment `run` starts the action until it settles. */\n pending: boolean;\n}\n\n/**\n * Pending state + repeat guard for async work that is NOT a React Query mutation\n * (a local media step, a sign-out, an awaited navigation). Feed `pending` to the\n * control's own `pending` prop. Server writes stay mutations — this hook does not\n * replace the data layer's one mutation path.\n *\n * The guard is a ref, not the state, so two clicks inside one frame cannot both start\n * the action.\n */\nexport function useAsyncAction<TArgs extends unknown[]>(\n action: (...args: TArgs) => Promise<unknown>,\n options: UseAsyncActionOptions,\n): AsyncAction<TArgs> {\n const [pending, setPending] = useState(false);\n const inFlightRef = useRef(false);\n const actionRef = useRef(action);\n const onErrorRef = useRef(options.onError);\n actionRef.current = action;\n onErrorRef.current = options.onError;\n\n const run = useCallback(async (...args: TArgs): Promise<boolean> => {\n if (inFlightRef.current) return false;\n inFlightRef.current = true;\n setPending(true);\n try {\n await actionRef.current(...args);\n return true;\n } catch (error) {\n onErrorRef.current(error);\n return false;\n } finally {\n inFlightRef.current = false;\n setPending(false);\n }\n }, []);\n\n return { run, pending };\n}\n"]}
1
+ {"version":3,"file":"use-async-action.js","sourceRoot":"","sources":["../../../src/react/hooks/use-async-action.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAWtD,kGAAkG;AAClG,MAAM,UAAU,cAAc,CAC5B,MAA4C,EAC5C,OAA8B;IAE9B,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC9C,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IACjC,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC;IAC3B,UAAU,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAErC,MAAM,GAAG,GAAG,WAAW,CAAC,KAAK,EAAE,GAAG,IAAW,EAAoB,EAAE;QACjE,IAAI,WAAW,CAAC,OAAO;YAAE,OAAO,KAAK,CAAC;QACtC,WAAW,CAAC,OAAO,GAAG,IAAI,CAAC;QAC3B,UAAU,CAAC,IAAI,CAAC,CAAC;QACjB,IAAI,CAAC;YACH,MAAM,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;QACd,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,UAAU,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC1B,OAAO,KAAK,CAAC;QACf,CAAC;gBAAS,CAAC;YACT,WAAW,CAAC,OAAO,GAAG,KAAK,CAAC;YAC5B,UAAU,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;AAC1B,CAAC","sourcesContent":["'use client';\n\nimport { useCallback, useRef, useState } from 'react';\n\nexport interface UseAsyncActionOptions {\n onError: (error: unknown) => void;\n}\n\nexport interface AsyncAction<TArgs extends unknown[]> {\n run: (...args: TArgs) => Promise<boolean>;\n pending: boolean;\n}\n\n/** The guard is a ref, not state, so two clicks inside one frame cannot both start the action. */\nexport function useAsyncAction<TArgs extends unknown[]>(\n action: (...args: TArgs) => Promise<unknown>,\n options: UseAsyncActionOptions,\n): AsyncAction<TArgs> {\n const [pending, setPending] = useState(false);\n const inFlightRef = useRef(false);\n const actionRef = useRef(action);\n const onErrorRef = useRef(options.onError);\n actionRef.current = action;\n onErrorRef.current = options.onError;\n\n const run = useCallback(async (...args: TArgs): Promise<boolean> => {\n if (inFlightRef.current) return false;\n inFlightRef.current = true;\n setPending(true);\n try {\n await actionRef.current(...args);\n return true;\n } catch (error) {\n onErrorRef.current(error);\n return false;\n } finally {\n inFlightRef.current = false;\n setPending(false);\n }\n }, []);\n\n return { run, pending };\n}\n"]}
@@ -1,77 +1,15 @@
1
1
  import type { ListPaginationState } from './use-paged-list.js';
2
- /**
3
- * Render-time page state for a cursor feed, shaped as {@link ListPaginationState}
4
- * so it drops straight into the ONE `ListPagination` control. Produced by
5
- * {@link CursorPager.paginationFor} once the query for `currentPage` has
6
- * answered with its `hasMore`.
7
- */
8
2
  export interface CursorPage extends ListPaginationState {
9
- /** Never known for cursor pagination — the counter reads "Page N". */
10
3
  totalPages?: undefined;
11
4
  }
12
5
  export interface UseCursorPageOptions {
13
- /** Called after the page actually changed. Same contract as `usePagedList`. */
14
6
  onPageChange?: () => void;
15
- /**
16
- * A snapshot of the query inputs the page number belongs to — a tag, a filter,
17
- * a sort. When it changes, the page is 1 again **in the same render**, so the
18
- * query never fires for "page 4" of inputs whose page 4 may not exist.
19
- *
20
- * Use this when the input change arrives as a prop (there is no event handler
21
- * of yours to hang the reset on); use {@link CursorPager.reset} when your own
22
- * handler already owns the change. Compose several inputs into one string
23
- * (`` `${type}|${projectId ?? ""}` ``) — the type is deliberately narrowed to
24
- * primitives so a fresh object literal cannot pin the list to page 1 forever.
25
- */
26
7
  resetKey?: string | number | boolean | null;
27
8
  }
28
- /**
29
- * What {@link useCursorPage} owns: the page number, the guarded step controls,
30
- * and the return-to-page-1 control.
31
- */
32
9
  export interface CursorPager {
33
- /** 1-based page to feed into the paged query. */
34
10
  currentPage: number;
35
- /**
36
- * Return to page 1 without walking back. Call it from the handler that changes
37
- * the query's inputs (a new filter, a new tag, a new sort) — page 4 of the old
38
- * result set is not page 4 of the new one. A no-op on page 1, so it never
39
- * fires `onPageChange` for nothing.
40
- */
41
11
  reset: () => void;
42
- /**
43
- * Bind the query's answer to the controls: pass the `hasMore` that came back
44
- * for {@link currentPage} and render the result as
45
- * `<ListPagination pagination={…} />`. `hasMore` binds HERE, after the query,
46
- * because that is the only moment it exists — a cursor query needs
47
- * `currentPage` as its input, so `hasMore` cannot be an argument to the hook
48
- * that produces `currentPage`.
49
- */
50
12
  paginationFor: (hasMore: boolean) => CursorPage;
51
13
  }
52
- /**
53
- * Page state for a server-paged (cursor / `hasMore`) list: the 1-based page
54
- * number, the guarded step controls, and the reset — the pieces each
55
- * server-paged surface was otherwise re-declaring as a local `useState(1)` plus
56
- * its own clamped increment/decrement and its own "reset when the filter
57
- * changed" adjustment (ENG-002, ENG-003).
58
- *
59
- * The data stays the caller's, and the two halves bind at different moments:
60
- *
61
- * ```tsx
62
- * const pager = useCursorPage({ resetKey: tag });
63
- * const { data, isFetching } = useThingsByTag(tag, pager.currentPage);
64
- * …
65
- * <ListPagination pagination={pager.paginationFor(data?.hasMore ?? false)} busy={isFetching} />
66
- * ```
67
- *
68
- * The guards live in here, not at the call site: a step that cannot move the
69
- * page changes nothing and does not fire `onPageChange`.
70
- *
71
- * A surface whose data hook ALREADY owns its page state (it returns
72
- * `page`/`hasNextPage`/`nextPage`/`prevPage` itself) does not need this hook —
73
- * it maps those fields onto {@link ListPaginationState} directly. The hook
74
- * exists for the surfaces that would otherwise hand-roll the state.
75
- */
76
14
  export declare function useCursorPage(options?: UseCursorPageOptions): CursorPager;
77
15
  //# sourceMappingURL=use-cursor-page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-cursor-page.d.ts","sourceRoot":"","sources":["../../../src/react/hooks/use-cursor-page.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAE/D;;;;;GAK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