@liner-fe/prism 2.12.5 → 2.12.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/lib/index.d.ts +4 -2
- package/lib/index.js +12 -18
- package/package.json +4 -4
package/lib/index.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { ToastProps } from '@radix-ui/react-toast';
|
|
|
9
9
|
import * as _artsy_fresnel_dist_Media from '@artsy/fresnel/dist/Media';
|
|
10
10
|
import { breakpointOrigin } from '@liner-fe/design-token';
|
|
11
11
|
import { Popover as Popover$1, Tooltip as Tooltip$1, Checkbox as Checkbox$1, RadioGroup, Select as Select$1, Label as Label$1 } from 'radix-ui';
|
|
12
|
-
import * as
|
|
12
|
+
import * as jotai from 'jotai';
|
|
13
13
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
14
14
|
import { PopoverProps, PopoverPortalProps } from '@radix-ui/react-popover';
|
|
15
15
|
import { IllustProps } from '@liner-fe/illust';
|
|
@@ -463,7 +463,9 @@ declare const SingleSnackbar: (props: SnackbarPropWithId & {
|
|
|
463
463
|
position: "left" | "right";
|
|
464
464
|
}) => react_jsx_runtime.JSX.Element;
|
|
465
465
|
|
|
466
|
-
declare const snackbarAtom:
|
|
466
|
+
declare const snackbarAtom: jotai.PrimitiveAtom<SnackbarPropWithId[]> & {
|
|
467
|
+
init: SnackbarPropWithId[];
|
|
468
|
+
};
|
|
467
469
|
declare const useSnackbar: () => {
|
|
468
470
|
open: (info: SnackbarProp) => void;
|
|
469
471
|
};
|
package/lib/index.js
CHANGED
|
@@ -329,19 +329,16 @@ var Button = forwardRef((props, ref) => /* @__PURE__ */ jsx2(DefaultButton, { ..
|
|
|
329
329
|
Button.displayName = "Button";
|
|
330
330
|
|
|
331
331
|
// src/hooks/useToast.ts
|
|
332
|
-
import { atom,
|
|
332
|
+
import { atom, useSetAtom } from "jotai";
|
|
333
333
|
|
|
334
334
|
// src/types/generateRandomId.ts
|
|
335
335
|
var generateRandomId = /* @__PURE__ */ __name(() => Date.now() + Math.random(), "generateRandomId");
|
|
336
336
|
|
|
337
337
|
// src/hooks/useToast.ts
|
|
338
338
|
import { millisecondsInSecond } from "date-fns/constants";
|
|
339
|
-
var toastAtom = atom(
|
|
340
|
-
default: [],
|
|
341
|
-
key: "toastAtoms"
|
|
342
|
-
});
|
|
339
|
+
var toastAtom = atom([]);
|
|
343
340
|
var useToast = /* @__PURE__ */ __name(() => {
|
|
344
|
-
const setToasts =
|
|
341
|
+
const setToasts = useSetAtom(toastAtom);
|
|
345
342
|
return {
|
|
346
343
|
open: /* @__PURE__ */ __name((toast) => {
|
|
347
344
|
const toastId = generateRandomId();
|
|
@@ -417,7 +414,7 @@ var Paragraph = forwardRef2(
|
|
|
417
414
|
);
|
|
418
415
|
|
|
419
416
|
// src/components/Toast/index.tsx
|
|
420
|
-
import {
|
|
417
|
+
import { useAtomValue, useSetAtom as useSetAtom2 } from "jotai";
|
|
421
418
|
import Lottie from "lottie-web";
|
|
422
419
|
|
|
423
420
|
// src/lottie/loading.json
|
|
@@ -898,7 +895,7 @@ import { millisecondsInSecond as millisecondsInSecond2 } from "date-fns/constant
|
|
|
898
895
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
899
896
|
import { createElement } from "react";
|
|
900
897
|
var Toaster = /* @__PURE__ */ __name(() => {
|
|
901
|
-
const list =
|
|
898
|
+
const list = useAtomValue(toastAtom);
|
|
902
899
|
return /* @__PURE__ */ jsxs3(Provider, { children: [
|
|
903
900
|
list.map((props) => (
|
|
904
901
|
// eslint-disable-next-line react/prop-types
|
|
@@ -908,7 +905,7 @@ var Toaster = /* @__PURE__ */ __name(() => {
|
|
|
908
905
|
] });
|
|
909
906
|
}, "Toaster");
|
|
910
907
|
var SingleToast = /* @__PURE__ */ __name((props) => {
|
|
911
|
-
const setToast =
|
|
908
|
+
const setToast = useSetAtom2(toastAtom);
|
|
912
909
|
const timerRef = useRef();
|
|
913
910
|
const { message, icon, button, timer, toastId, isLoading } = props;
|
|
914
911
|
const [isOpen, setIsOpen] = useState(true);
|
|
@@ -2202,17 +2199,14 @@ var style_module_default14 = {
|
|
|
2202
2199
|
|
|
2203
2200
|
// src/components/Snackbar/index.tsx
|
|
2204
2201
|
import { Toast } from "radix-ui";
|
|
2205
|
-
import {
|
|
2202
|
+
import { useAtomValue as useAtomValue2, useSetAtom as useSetAtom4 } from "jotai";
|
|
2206
2203
|
|
|
2207
2204
|
// src/hooks/useSnackbar.ts
|
|
2208
|
-
import { atom as atom2,
|
|
2205
|
+
import { atom as atom2, useSetAtom as useSetAtom3 } from "jotai";
|
|
2209
2206
|
import { millisecondsInSecond as millisecondsInSecond3 } from "date-fns/constants";
|
|
2210
|
-
var snackbarAtom = atom2(
|
|
2211
|
-
key: "snackbarAtom",
|
|
2212
|
-
default: []
|
|
2213
|
-
});
|
|
2207
|
+
var snackbarAtom = atom2([]);
|
|
2214
2208
|
var useSnackbar = /* @__PURE__ */ __name(() => {
|
|
2215
|
-
const setSnackbar =
|
|
2209
|
+
const setSnackbar = useSetAtom3(snackbarAtom);
|
|
2216
2210
|
return {
|
|
2217
2211
|
open: /* @__PURE__ */ __name((info) => {
|
|
2218
2212
|
const snackbarId = generateRandomId();
|
|
@@ -2438,7 +2432,7 @@ import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs12 } from "react/jsx-r
|
|
|
2438
2432
|
import { createElement as createElement3 } from "react";
|
|
2439
2433
|
var { Provider: Provider2, Root: Root2, Viewport: Viewport2 } = Toast;
|
|
2440
2434
|
var Snackbar = /* @__PURE__ */ __name(() => {
|
|
2441
|
-
const list =
|
|
2435
|
+
const list = useAtomValue2(snackbarAtom);
|
|
2442
2436
|
const rightSnackbars = list.filter((snackbar) => snackbar.position !== "left");
|
|
2443
2437
|
const leftSnackbars = list.filter((snackbar) => snackbar.position === "left");
|
|
2444
2438
|
return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
@@ -2459,7 +2453,7 @@ var Snackbar = /* @__PURE__ */ __name(() => {
|
|
|
2459
2453
|
] });
|
|
2460
2454
|
}, "Snackbar");
|
|
2461
2455
|
var SingleSnackbar = /* @__PURE__ */ __name((props) => {
|
|
2462
|
-
const setSnackbar =
|
|
2456
|
+
const setSnackbar = useSetAtom4(snackbarAtom);
|
|
2463
2457
|
const timerRef = useRef3();
|
|
2464
2458
|
const { snackbarId, description, title, timer } = props;
|
|
2465
2459
|
const [isOpen, setIsOpen] = useState5(true);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@liner-fe/prism",
|
|
3
|
-
"version": "2.12.
|
|
3
|
+
"version": "2.12.7",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"dependencies": {
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"radix-ui": "^1.4.3",
|
|
16
16
|
"react": "18.2.0",
|
|
17
17
|
"react-dom": "18.2.0",
|
|
18
|
-
"
|
|
19
|
-
"@liner-fe/design-token": "^2.5.
|
|
20
|
-
"@liner-fe/design-token-primitive": "^0.2.45",
|
|
18
|
+
"jotai": "^2.11.0",
|
|
19
|
+
"@liner-fe/design-token": "^2.5.50",
|
|
21
20
|
"@liner-fe/icon": "^0.2.73",
|
|
21
|
+
"@liner-fe/design-token-primitive": "^0.2.46",
|
|
22
22
|
"@liner-fe/illust": "^0.2.12"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|