@ahrowe/ui 0.40.0 → 0.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. package/README.md +13 -13
  2. package/dist/cjs-types/common/ahroweProvider/ahroweProvider.d.ts +4 -0
  3. package/dist/cjs-types/common/ahroweProvider/ahroweProvider.types.d.ts +12 -0
  4. package/dist/cjs-types/common/ahroweProvider/index.d.ts +2 -0
  5. package/dist/cjs-types/common/bodyEnd/portalHostContext.d.ts +6 -0
  6. package/dist/cjs-types/common/errorBoundary/errorBoundary.types.d.ts +2 -2
  7. package/dist/cjs-types/common/hooks/useOverlay.d.ts +4 -1
  8. package/dist/cjs-types/common/popover/popover.types.d.ts +1 -1
  9. package/dist/cjs-types/common/themeProvider/index.d.ts +1 -1
  10. package/dist/cjs-types/common/themeProvider/theme.types.d.ts +8 -0
  11. package/dist/cjs-types/common/themeProvider/themeProvider.d.ts +7 -9
  12. package/dist/cjs-types/common/themeProvider/themeVariablesContext.d.ts +2 -2
  13. package/dist/cjs-types/common/toast/index.d.ts +1 -2
  14. package/dist/cjs-types/common/toast/toast.types.d.ts +4 -4
  15. package/dist/cjs-types/common/toast/toastHost.d.ts +4 -0
  16. package/dist/cjs-types/common/toast/toastService.d.ts +1 -1
  17. package/dist/cjs-types/index.d.ts +2 -1
  18. package/dist/esm/common/ahroweProvider/ahroweProvider.mjs +2 -0
  19. package/dist/esm/common/ahroweProvider/ahroweProvider.mjs.map +1 -0
  20. package/dist/esm/common/bodyEnd/bodyEnd.mjs +1 -1
  21. package/dist/esm/common/bodyEnd/bodyEnd.mjs.map +1 -1
  22. package/dist/esm/common/bodyEnd/portalHostContext.mjs +2 -0
  23. package/dist/esm/common/bodyEnd/portalHostContext.mjs.map +1 -0
  24. package/dist/esm/common/calendar/calendar.mjs +1 -1
  25. package/dist/esm/common/calendar/calendar.mjs.map +1 -1
  26. package/dist/esm/common/carousel/carousel.module.mjs.map +1 -1
  27. package/dist/esm/common/errorBoundary/errorBoundary.mjs +2 -2
  28. package/dist/esm/common/hooks/useAnchorTracking.mjs.map +1 -1
  29. package/dist/esm/common/hooks/useOverlay.mjs +1 -1
  30. package/dist/esm/common/hooks/useOverlay.mjs.map +1 -1
  31. package/dist/esm/common/modal/modal.mjs +1 -1
  32. package/dist/esm/common/modal/modal.mjs.map +1 -1
  33. package/dist/esm/common/otpInput/otpInput.mjs +1 -1
  34. package/dist/esm/common/otpInput/otpInput.mjs.map +1 -1
  35. package/dist/esm/common/popover/popover.mjs +1 -1
  36. package/dist/esm/common/popover/popover.mjs.map +1 -1
  37. package/dist/esm/common/popover/popover.types.mjs.map +1 -1
  38. package/dist/esm/common/scrollbarProvider/scrollbarProvider.module.mjs.map +1 -1
  39. package/dist/esm/common/themeProvider/themeProvider.mjs +1 -1
  40. package/dist/esm/common/themeProvider/themeProvider.mjs.map +1 -1
  41. package/dist/esm/common/themeProvider/themeVariablesContext.mjs.map +1 -1
  42. package/dist/esm/common/timer/timer.mjs +1 -1
  43. package/dist/esm/common/timer/timer.mjs.map +1 -1
  44. package/dist/esm/common/toast/toastHost.mjs +2 -0
  45. package/dist/esm/common/toast/toastHost.mjs.map +1 -0
  46. package/dist/esm/common/toast/toastService.mjs +1 -1
  47. package/dist/esm/common/toast/toastService.mjs.map +1 -1
  48. package/dist/esm/common/tooltip/tooltip.module.mjs.map +1 -1
  49. package/dist/esm/common/virtualList/virtualList.mjs +1 -1
  50. package/dist/esm/common/virtualList/virtualList.mjs.map +1 -1
  51. package/dist/esm/index.mjs +1 -1
  52. package/dist/index.cjs +3 -3
  53. package/dist/index.cjs.map +1 -1
  54. package/dist/mcp.js +2 -2
  55. package/dist/style.css +1 -1
  56. package/dist/types/common/ahroweProvider/ahroweProvider.d.ts +4 -0
  57. package/dist/types/common/ahroweProvider/ahroweProvider.types.d.ts +12 -0
  58. package/dist/types/common/ahroweProvider/index.d.ts +2 -0
  59. package/dist/types/common/bodyEnd/portalHostContext.d.ts +6 -0
  60. package/dist/types/common/errorBoundary/errorBoundary.types.d.ts +2 -2
  61. package/dist/types/common/hooks/useOverlay.d.ts +4 -1
  62. package/dist/types/common/popover/popover.types.d.ts +1 -1
  63. package/dist/types/common/themeProvider/index.d.ts +1 -1
  64. package/dist/types/common/themeProvider/theme.types.d.ts +8 -0
  65. package/dist/types/common/themeProvider/themeProvider.d.ts +7 -9
  66. package/dist/types/common/themeProvider/themeVariablesContext.d.ts +2 -2
  67. package/dist/types/common/toast/index.d.ts +1 -2
  68. package/dist/types/common/toast/toast.types.d.ts +4 -4
  69. package/dist/types/common/toast/toastHost.d.ts +4 -0
  70. package/dist/types/common/toast/toastService.d.ts +1 -1
  71. package/dist/types/index.d.ts +2 -1
  72. package/docs/AhroweProvider.md +90 -0
  73. package/docs/BodyEnd.md +5 -12
  74. package/docs/Breadcrumb.md +0 -2
  75. package/docs/CLAUDE.md +14 -11
  76. package/docs/CommandPalette.md +0 -2
  77. package/docs/ConfigProvider.md +11 -8
  78. package/docs/ConfirmModal.md +0 -2
  79. package/docs/ErrorBoundary.md +5 -3
  80. package/docs/FormValidatorGroup.md +1 -1
  81. package/docs/KlipyPicker.md +1 -1
  82. package/docs/Menu.md +0 -2
  83. package/docs/Modal.md +1 -3
  84. package/docs/MultiSelect.md +0 -2
  85. package/docs/OtpInput.md +0 -2
  86. package/docs/Popover.md +2 -4
  87. package/docs/RadioGroup.md +1 -1
  88. package/docs/ScrollbarProvider.md +4 -0
  89. package/docs/SplitButton.md +0 -2
  90. package/docs/ThemeProvider.md +13 -10
  91. package/docs/Toast.md +18 -17
  92. package/docs/Tooltip.md +1 -1
  93. package/docs/VirtualList.md +0 -2
  94. package/package.json +1 -1
  95. package/dist/cjs-types/common/toast/toastProvider.d.ts +0 -8
  96. package/dist/esm/common/toast/toastProvider.mjs +0 -2
  97. package/dist/esm/common/toast/toastProvider.mjs.map +0 -1
  98. package/dist/types/common/toast/toastProvider.d.ts +0 -8
@@ -1,11 +1,11 @@
1
1
  # ThemeProvider
2
2
 
3
- **When to use:** Required wrapper for the entire component library. Injects all CSS custom properties as inline styles so every component inside can use theme variables. Place it at or near the root of your app.
3
+ **When to use:** Applies a theme to its subtree, injecting its CSS custom properties as inline styles so every component inside can use them. [AhroweProvider](AhroweProvider.md) includes one and takes the same `themes` and `currentThemeId`: use that at the app root, and ThemeProvider on its own for a section with a different theme.
4
4
 
5
5
  **Keywords:** theming, dark mode, gradient
6
6
 
7
7
  **Import:** `import { ThemeProvider } from '@ahrowe/ui'`
8
- **Types:** `import type { Theme, ThemeVariables } from '@ahrowe/ui'`
8
+ **Types:** `import type { Theme, ThemeVariables, ThemeProviderProps } from '@ahrowe/ui'`
9
9
  **Built-in themes:** `import { defaultTheme, lightTheme } from '@ahrowe/ui'`
10
10
 
11
11
  ```tsx
@@ -58,18 +58,21 @@ no `themes` at all. `lightTheme` is its light sibling: same brand colour, invert
58
58
  both to let the user choose.
59
59
 
60
60
  ```tsx
61
- import { ThemeProvider, defaultTheme, lightTheme, useTheme } from '@ahrowe/ui';
61
+ import { AhroweProvider, defaultTheme, lightTheme, useTheme } from '@ahrowe/ui';
62
62
 
63
- function App() {
63
+ // A new array on every render reads as a theme change, so keep it at module scope.
64
+ const THEMES = [defaultTheme, lightTheme];
65
+
66
+ function Root() {
64
67
  const { currentThemeId, setCurrentThemeId } = useTheme(defaultTheme.id);
65
68
 
66
69
  return (
67
- <ThemeProvider themes={[defaultTheme, lightTheme]} currentThemeId={currentThemeId}>
70
+ <AhroweProvider themes={THEMES} currentThemeId={currentThemeId}>
68
71
  <button onClick={() => setCurrentThemeId(currentThemeId === 'light' ? 'default' : 'light')}>
69
72
  Toggle theme
70
73
  </button>
71
74
  <App />
72
- </ThemeProvider>
75
+ </AhroweProvider>
73
76
  );
74
77
  }
75
78
  ```
@@ -116,9 +119,9 @@ interface Theme {
116
119
  | `themes` | `Theme[]` | Theme definitions — defaults to built-in default theme |
117
120
  | `currentThemeId` | `string` | Active theme id — must match one of the `themes[].id` values |
118
121
 
119
- **Note:** Without `ThemeProvider`, all CSS variables are undefined and components will be unstyled.
122
+ **Note:** Without a `ThemeProvider` or `AhroweProvider` above them, all CSS variables are undefined and components will be unstyled.
120
123
 
121
- **Base typography:** The wrapper also sets `font-family`, `font-size`, `font-weight`, and `color` from the theme's `--default-font`, `--default-font-size`, `--default-font-weight`, and `--text-color`, so everything inside — including content portaled into a `#bodyEnd` placed within the provider — inherits the theme's base text style without each component having to set it.
124
+ **Base typography:** The wrapper also sets `font-family`, `font-size`, `font-weight`, and `color` from the theme's `--default-font`, `--default-font-size`, `--default-font-weight`, and `--text-color`, so everything inside — including what `AhroweProvider` portals — inherits the theme's base text style without each component having to set it.
122
125
 
123
126
  ## Gradient primary
124
127
 
@@ -202,7 +205,7 @@ through its own variable (`--slider-range-color`, `--pagination-active-backgroun
202
205
 
203
206
  ## Nested providers and portals
204
207
 
205
- Providers nest: an inner one overrides the variables it declares and inherits the rest, so a differently-themed panel inside a themed app works without restating the whole theme.
208
+ Providers nest: an inner one overrides the variables it declares and inherits the rest, so a differently-themed panel inside a themed app works without restating the whole theme. Only the outermost one sets the page's `<meta name="theme-color">` to its `--primary-color`; an inner one themes its section, not the browser.
206
209
 
207
- A portal breaks that by default, because theme variables travel by CSS inheritance and a portal escapes the subtree. Anything rendered through `BodyEnd` — `Tooltip`, `Dropdown`, `InputDropdown`, `ColorPicker`, `Menu`, `Popover`, `Modal`, `Toast` — therefore carries the nearest provider's variables with it, so an open panel matches the panel that opened it rather than whatever wraps `#bodyEnd`.
210
+ A portal breaks that by default, because theme variables travel by CSS inheritance and a portal escapes the subtree. Anything rendered through `BodyEnd` — `Tooltip`, `Dropdown`, `InputDropdown`, `ColorPicker`, `Menu`, `Popover`, `Modal`, `Toast` — therefore carries the nearest provider's variables with it, so an open panel matches the panel that opened it rather than whatever wraps the element it portals into.
208
211
 
package/docs/Toast.md CHANGED
@@ -4,21 +4,21 @@
4
4
 
5
5
  **Keywords:** snackbar, notification popup
6
6
 
7
- **Import:** `import { ToastProvider, showToast } from '@ahrowe/ui'`
8
- **Types:** `import type { ToastOptions, ToastType, ToastPosition } from '@ahrowe/ui'`
7
+ **Import:** `import { showToast } from '@ahrowe/ui'`
8
+ **Types:** `import type { ToastOptions, ToastContextConfig, ToastLabels, ToastType, ToastPosition } from '@ahrowe/ui'`
9
9
 
10
- **Setup:** Wrap your app with `ToastProvider` (inside `ThemeProvider`):
10
+ **Setup:** [AhroweProvider](AhroweProvider.md) shows the toasts. Its `toast` prop sets the defaults for all of them:
11
11
 
12
12
  ```tsx
13
- import { ThemeProvider, ToastProvider } from '@ahrowe/ui';
13
+ import { AhroweProvider } from '@ahrowe/ui';
14
14
 
15
- <ThemeProvider>
16
- <ToastProvider position="bottom-right" duration={3000}>
17
- <App />
18
- </ToastProvider>
19
- </ThemeProvider>
15
+ <AhroweProvider toast={{ position: 'bottom-right', duration: 3000 }}>
16
+ <App />
17
+ </AhroweProvider>
20
18
  ```
21
19
 
20
+ `ToastProvider` was removed in 0.41. It took the same settings as props: move them into `toast`.
21
+
22
22
  **Usage:** Call `showToast` anywhere — no component hierarchy required:
23
23
 
24
24
  ```tsx
@@ -56,16 +56,17 @@ showToast('Done', {
56
56
  });
57
57
  ```
58
58
 
59
- **ToastProviderProps** (default config for all toasts):
59
+ **ToastContextConfig**, the `toast` prop. Every key but `allowStacking` can also be passed to a single `showToast`:
60
60
 
61
- | Prop | Type | Default | Description |
62
- |------|------|---------|-------------|
63
- | `position` | `ToastPosition` | `'bottom-right'` | Screen position |
64
- | `duration` | `number` | `3000` | Auto-dismiss delay in ms; `0` = persistent |
65
- | `showRemainingTime` | `boolean` | `false` | Show a progress bar draining to zero |
66
- | `showCloseButton` | `boolean` | `false` | Show × button |
61
+ | Key | Type | Default | Description |
62
+ |-----|------|---------|-------------|
63
+ | `position` | `ToastPosition` | `'top-right'` | Screen position |
64
+ | `duration` | `number` | `4000` | Auto-dismiss delay in ms; `0` = persistent |
65
+ | `showRemainingTime` | `boolean` | `true` | Show a progress bar draining to zero |
66
+ | `showCloseButton` | `boolean` | `true` | Show × button |
67
67
  | `allowStacking` | `boolean` | `true` | Allow multiple toasts simultaneously |
68
68
  | `pauseOnHover` | `boolean` | `true` | Pause the auto-dismiss timer while the toast is hovered or focused |
69
+ | `labels` | `ToastLabels` | | See **Labels** |
69
70
 
70
71
  **Swipe to dismiss:** on touch devices, every toast can be dragged away to dismiss it, on top of the close button and auto-dismiss timer. A fast flick dismisses even without dragging far; dragging pauses the auto-dismiss timer for the duration of the gesture (regardless of `pauseOnHover`) and a vertical drag is left alone so it doesn't fight the page's own scrolling. It's gated to coarse (touch) pointers only — on mouse/trackpad devices the close button and auto-dismiss already cover it, and a drag there is more likely to be a text selection than an intentional dismiss.
71
72
 
@@ -75,7 +76,7 @@ showToast('Done', {
75
76
 
76
77
  **Slots:** `root` `icon` `content` `closeButton` `progressBar`
77
78
 
78
- **Labels:** `close` — the dismiss button's screen-reader name. Set it on `ToastProvider` for the whole app (`labels={{ close: 'Schließen' }}`), or per toast through the `showToast` options. Type: `ToastLabels`.
79
+ **Labels:** `close`, the dismiss button's screen-reader name. Set it for the whole app in `AhroweProvider`'s `toast={{ labels: { close: 'Schließen' } }}`, or per toast with `showToast('Saved', { labels: { close: 'Schließen' } })`. Type: `ToastLabels`.
79
80
 
80
81
  ## Sizing
81
82
 
package/docs/Tooltip.md CHANGED
@@ -77,4 +77,4 @@ The default bubble is an **inverse of the page** rather than a fixed colour: it
77
77
 
78
78
  The bubble, its arrow, the `details` badge and the error variant all scale with the theme's text. The bubble's `max-width` is `em`, so it bounds a line measure rather than a pixel count as the text grows.
79
79
 
80
- The badge derives its size from `--default-font-size` directly rather than from `em`. It renders inline wherever you put it, so an `em` would measure the surrounding text instead of the theme; the bubble can use `em` because it is portaled to `#bodyEnd` and always lands on the theme's own size.
80
+ The badge derives its size from `--default-font-size` directly rather than from `em`. It renders inline wherever you put it, so an `em` would measure the surrounding text instead of the theme; the bubble can use `em` because it is portalled to the end of the app and always lands on the theme's own size.
@@ -7,8 +7,6 @@
7
7
  **Import:** `import { VirtualList } from '@ahrowe/ui'`
8
8
  **Types:** `import type { VirtualListProps, VirtualListColumn, VirtualListHandle, VirtualListSort } from '@ahrowe/ui'`
9
9
 
10
- **Requires:** `<div id="bodyEnd"></div>` in your app **only if** you use the column-visibility toggle (the gear menu) — its popover is a `Popover` that renders via portal. Lists without columns, or with `showColumnToggle={false}`, don't need it.
11
-
12
10
  ```tsx
13
11
  import { VirtualList } from '@ahrowe/ui';
14
12
  import type { VirtualListColumn } from '@ahrowe/ui';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ahrowe/ui",
3
- "version": "0.40.0",
3
+ "version": "0.41.1",
4
4
  "description": "A React UI component library with theming, CSS Modules, and TypeScript support",
5
5
  "keywords": [
6
6
  "agent",
@@ -1,8 +0,0 @@
1
- import { default as React, ReactNode } from 'react';
2
- import { ToastContextConfig } from './toast.types.js';
3
- interface ToastProviderProps extends ToastContextConfig {
4
- children: ReactNode;
5
- }
6
- declare function ToastProvider({ children, position, duration, showRemainingTime, showCloseButton, allowStacking, pauseOnHover, labels, }: ToastProviderProps): React.JSX.Element;
7
- export default ToastProvider;
8
- export type { ToastProviderProps };
@@ -1,2 +0,0 @@
1
- "use client";import e from"../bodyEnd/bodyEnd.mjs";import t from"./toast.module.mjs";import n from"./toast.mjs";import{_registerToastHandler as r,_unregisterToastHandler as i}from"./toastService.mjs";import{useCallback as a,useEffect as o,useRef as s,useState as c}from"react";import l from"classnames";import{Fragment as u,jsx as d,jsxs as f}from"react/jsx-runtime";var p={position:`top-right`,duration:4e3,showRemainingTime:!0,showCloseButton:!0,allowStacking:!0,pauseOnHover:!0,labels:{close:`Close`}},m=220;function h(e){return t[`container-${e}`]}function g({children:g,position:_=p.position,duration:v=p.duration,showRemainingTime:y=p.showRemainingTime,showCloseButton:b=p.showCloseButton,allowStacking:x=p.allowStacking,pauseOnHover:S=p.pauseOnHover,labels:C}){let[w,T]=c([]),E=s(0),D=a(e=>{T(t=>t.map(t=>t.id===e?{...t,dismissing:!0}:t)),setTimeout(()=>{T(t=>t.filter(t=>t.id!==e))},m)},[]),O=a((e,t)=>{let n={position:t?.position??_,duration:t?.duration??v,showRemainingTime:t?.showRemainingTime??y,showCloseButton:t?.showCloseButton??b,pauseOnHover:t?.pauseOnHover??S,type:t?.type??`default`,classNames:t?.classNames,styles:t?.styles};E.current+=1;let r={id:`toast-${E.current}`,content:e,options:n,dismissing:!1};T(e=>!x&&e.length>0?(setTimeout(()=>{T([r])},m),e.map(e=>({...e,dismissing:!0}))):[...e,r])},[_,v,y,b,x,S]);o(()=>(r(O),()=>i()),[O]);let k=w.reduce((e,t)=>{let n=t.options.position;return e[n]||(e[n]=[]),e[n].push(t),e},{});return f(u,{children:[g,d(e,{children:Object.entries(k).map(([e,r])=>d(`div`,{className:l(t.container,h(e)),children:r.map(t=>d(n,{item:t,isBottom:e.startsWith(`bottom`),onDismiss:D,labels:{...p.labels,...C,...t.labels}},t.id))},e))})]})}export{g as default};
2
- //# sourceMappingURL=toastProvider.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"toastProvider.mjs","names":[],"sources":["../../../../package/common/toast/toastProvider.tsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport cx from 'classnames';\nimport BodyEnd from 'components/common/bodyEnd';\n\nimport styles from './toast.module.pcss';\nimport Toast from './toast';\nimport { _registerToastHandler, _unregisterToastHandler } from './toastService';\nimport type {\n ToastContextConfig,\n ToastItem,\n ToastOptions,\n ResolvedToastOptions,\n ToastPosition,\n ToastLabels,\n} from './toast.types';\nimport type { ReactNode } from 'react';\n\nconst DEFAULTS: Required<ToastContextConfig> = {\n position: 'top-right',\n duration: 4000,\n showRemainingTime: true,\n showCloseButton: true,\n allowStacking: true,\n pauseOnHover: true,\n labels: { close: 'Close' },\n};\n\nconst DISMISS_ANIMATION_MS = 220;\n\nfunction positionToClass(position: ToastPosition): string {\n return styles[`container-${position}`];\n}\n\ninterface ToastProviderProps extends ToastContextConfig {\n children: ReactNode;\n}\n\nfunction ToastProvider({\n children,\n position = DEFAULTS.position,\n duration = DEFAULTS.duration,\n showRemainingTime = DEFAULTS.showRemainingTime,\n showCloseButton = DEFAULTS.showCloseButton,\n allowStacking = DEFAULTS.allowStacking,\n pauseOnHover = DEFAULTS.pauseOnHover,\n labels,\n}: ToastProviderProps) {\n const [toasts, setToasts] = useState<ToastItem[]>([]);\n const counterRef = useRef(0);\n\n const dismiss = useCallback((id: string) => {\n setToasts((prev) => prev.map((t) => (t.id === id ? { ...t, dismissing: true } : t)));\n setTimeout(() => {\n setToasts((prev) => prev.filter((t) => t.id !== id));\n }, DISMISS_ANIMATION_MS);\n }, []);\n\n const addToast = useCallback(\n (content: ReactNode, options?: ToastOptions) => {\n const resolved: ResolvedToastOptions = {\n position: options?.position ?? position,\n duration: options?.duration ?? duration,\n showRemainingTime: options?.showRemainingTime ?? showRemainingTime,\n showCloseButton: options?.showCloseButton ?? showCloseButton,\n pauseOnHover: options?.pauseOnHover ?? pauseOnHover,\n type: options?.type ?? 'default',\n classNames: options?.classNames,\n styles: options?.styles,\n };\n\n counterRef.current += 1;\n const id = `toast-${counterRef.current}`;\n const newToast: ToastItem = { id, content, options: resolved, dismissing: false };\n\n setToasts((prev) => {\n if (!allowStacking && prev.length > 0) {\n // Mark all existing as dismissing, then replace\n setTimeout(() => {\n setToasts([newToast]);\n }, DISMISS_ANIMATION_MS);\n return prev.map((t) => ({ ...t, dismissing: true }));\n }\n return [...prev, newToast];\n });\n },\n [position, duration, showRemainingTime, showCloseButton, allowStacking, pauseOnHover],\n );\n\n useEffect(() => {\n _registerToastHandler(addToast);\n return () => _unregisterToastHandler();\n }, [addToast]);\n\n // Group toasts by position so per-toast position overrides work correctly\n const byPosition = toasts.reduce<Record<string, ToastItem[]>>((acc, t) => {\n const pos = t.options.position;\n if (!acc[pos]) acc[pos] = [];\n acc[pos].push(t);\n return acc;\n }, {});\n\n return (\n <>\n {children}\n <BodyEnd>\n {Object.entries(byPosition).map(([pos, items]) => (\n <div key={pos} className={cx(styles.container, positionToClass(pos as typeof position))}>\n {items.map((item) => (\n <Toast\n key={item.id}\n item={item}\n isBottom={pos.startsWith('bottom')}\n onDismiss={dismiss}\n labels={{ ...DEFAULTS.labels, ...labels, ...item.labels } as Required<ToastLabels>}\n />\n ))}\n </div>\n ))}\n </BodyEnd>\n </>\n );\n}\n\nexport default ToastProvider;\nexport type { ToastProviderProps };\n"],"mappings":"+WAiBA,IAAM,EAAyC,CAC7C,SAAU,YACV,SAAU,IACV,kBAAmB,GACnB,gBAAiB,GACjB,cAAe,GACf,aAAc,GACd,OAAQ,CAAE,MAAO,OAAQ,CAC3B,EAEM,EAAuB,IAE7B,SAAS,EAAgB,EAAiC,CACxD,OAAO,EAAO,aAAa,IAC7B,CAMA,SAAS,EAAc,CACrB,WACA,WAAW,EAAS,SACpB,WAAW,EAAS,SACpB,oBAAoB,EAAS,kBAC7B,kBAAkB,EAAS,gBAC3B,gBAAgB,EAAS,cACzB,eAAe,EAAS,aACxB,UACqB,CACrB,GAAM,CAAC,EAAQ,GAAa,EAAsB,CAAC,CAAC,EAC9C,EAAa,EAAO,CAAC,EAErB,EAAU,EAAa,GAAe,CAC1C,EAAW,GAAS,EAAK,IAAK,GAAO,EAAE,KAAO,EAAK,CAAE,GAAG,EAAG,WAAY,EAAK,EAAI,CAAE,CAAC,EACnF,eAAiB,CACf,EAAW,GAAS,EAAK,OAAQ,GAAM,EAAE,KAAO,CAAE,CAAC,CACrD,EAAG,CAAoB,CACzB,EAAG,CAAC,CAAC,EAEC,EAAW,GACd,EAAoB,IAA2B,CAC9C,IAAM,EAAiC,CACrC,SAAU,GAAS,UAAY,EAC/B,SAAU,GAAS,UAAY,EAC/B,kBAAmB,GAAS,mBAAqB,EACjD,gBAAiB,GAAS,iBAAmB,EAC7C,aAAc,GAAS,cAAgB,EACvC,KAAM,GAAS,MAAQ,UACvB,WAAY,GAAS,WACrB,OAAQ,GAAS,MACnB,EAEA,EAAW,SAAW,EAEtB,IAAM,EAAsB,CAAE,GAAA,SADV,EAAW,UACG,UAAS,QAAS,EAAU,WAAY,EAAM,EAEhF,EAAW,GACL,CAAC,GAAiB,EAAK,OAAS,GAElC,eAAiB,CACf,EAAU,CAAC,CAAQ,CAAC,CACtB,EAAG,CAAoB,EAChB,EAAK,IAAK,IAAO,CAAE,GAAG,EAAG,WAAY,EAAK,EAAE,GAE9C,CAAC,GAAG,EAAM,CAAQ,CAC1B,CACH,EACA,CAAC,EAAU,EAAU,EAAmB,EAAiB,EAAe,CAAY,CACtF,EAEA,OACE,EAAsB,CAAQ,MACjB,EAAwB,GACpC,CAAC,CAAQ,CAAC,EAGb,IAAM,EAAa,EAAO,QAAqC,EAAK,IAAM,CACxE,IAAM,EAAM,EAAE,QAAQ,SAGtB,OAFK,EAAI,KAAM,EAAI,GAAO,CAAC,GAC3B,EAAI,EAAI,CAAC,KAAK,CAAC,EACR,CACT,EAAG,CAAC,CAAC,EAEL,OACE,EAAA,EAAA,CAAA,SAAA,CACG,EACD,EAAC,EAAD,CAAA,SACG,OAAO,QAAQ,CAAU,CAAC,CAAC,KAAK,CAAC,EAAK,KACrC,EAAC,MAAD,CAAe,UAAW,EAAG,EAAO,UAAW,EAAgB,CAAsB,CAAC,EACnF,SAAA,EAAM,IAAK,GACV,EAAC,EAAD,CAEQ,OACN,SAAU,EAAI,WAAW,QAAQ,EACjC,UAAW,EACX,OAAQ,CAAE,GAAG,EAAS,OAAQ,GAAG,EAAQ,GAAG,EAAK,MAAO,CACzD,EALM,EAAK,EAKX,CACF,CACE,EAVK,CAUL,CACN,CACM,CAAA,CACT,CAAA,CAAA,CAEN"}
@@ -1,8 +0,0 @@
1
- import { default as React, ReactNode } from 'react';
2
- import { ToastContextConfig } from './toast.types.js';
3
- interface ToastProviderProps extends ToastContextConfig {
4
- children: ReactNode;
5
- }
6
- declare function ToastProvider({ children, position, duration, showRemainingTime, showCloseButton, allowStacking, pauseOnHover, labels, }: ToastProviderProps): React.JSX.Element;
7
- export default ToastProvider;
8
- export type { ToastProviderProps };