@optiaxiom/globals 1.0.5 → 1.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -36,18 +36,17 @@ const createToaster = () => {
36
36
  snapshot = [];
37
37
  emit();
38
38
  },
39
- create: (...args) => {
40
- const toast = typeof args[0] === "string" ? {
41
- ...args[1],
42
- title: args[0]
43
- } : args[0];
39
+ create: (message, options) => {
44
40
  const id2 = genId();
45
41
  queue = queue.then(async () => {
46
42
  const item = {
47
43
  id: id2,
48
44
  open: true,
49
45
  ref: { current: null },
50
- toast
46
+ toast: {
47
+ ...options,
48
+ title: message
49
+ }
51
50
  };
52
51
  snapshot = [...snapshot, item];
53
52
  emit();
@@ -25,18 +25,17 @@ const createToaster = () => {
25
25
  snapshot = [];
26
26
  emit();
27
27
  },
28
- create: (...args) => {
29
- const toast = typeof args[0] === "string" ? {
30
- ...args[1],
31
- title: args[0]
32
- } : args[0];
28
+ create: (message, options) => {
33
29
  const id2 = genId();
34
30
  queue = queue.then(async () => {
35
31
  const item = {
36
32
  id: id2,
37
33
  open: true,
38
34
  ref: { current: null },
39
- toast
35
+ toast: {
36
+ ...options,
37
+ title: message
38
+ }
40
39
  };
41
40
  snapshot = [...snapshot, item];
42
41
  emit();
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as react from 'react';
2
- import { RefObject, ReactElement } from 'react';
2
+ import { RefObject } from 'react';
3
3
 
4
4
  declare const AxiomVersionContext: react.Context<string | undefined>;
5
5
 
@@ -196,9 +196,9 @@ type ToastItem = {
196
196
  id: string;
197
197
  open: boolean;
198
198
  ref: RefObject<HTMLElement>;
199
- toast: ReactElement | (ToastOptions & {
199
+ toast: ToastOptions & {
200
200
  title: string;
201
- });
201
+ };
202
202
  };
203
203
  type ToastOptions = {
204
204
  action?: string;
@@ -207,7 +207,7 @@ type ToastOptions = {
207
207
  };
208
208
  type Toaster = {
209
209
  clear: () => void;
210
- create: (...args: [message: string, options?: ToastOptions] | [toast: ReactElement]) => string;
210
+ create: (message: string, options?: ToastOptions) => string;
211
211
  remove: (id: string) => void;
212
212
  store: [
213
213
  subscribe: (onStoreChange: () => void) => () => void,
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "url": "https://github.com/optimizely-axiom/optiaxiom.git"
8
8
  },
9
9
  "type": "module",
10
- "version": "1.0.5",
10
+ "version": "1.0.7",
11
11
  "files": [
12
12
  "dist/**",
13
13
  "LICENSE"
@@ -35,7 +35,7 @@
35
35
  "inter-ui": "^4.1.0"
36
36
  },
37
37
  "devDependencies": {
38
- "@vanilla-extract/css": "^1.17.2",
38
+ "@vanilla-extract/css": "^1.17.3",
39
39
  "react": "^18.3.1",
40
40
  "react-dom": "^18.3.1",
41
41
  "@optiaxiom/shared": "^0.0.0"