@equinor/cpl-error-snackbar-react 0.1.2 → 0.1.3
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/index.d.mts +20 -2
- package/dist/index.d.ts +20 -2
- package/dist/index.js +27 -7
- package/dist/index.mjs +27 -7
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, SetStateAction } from 'react';
|
|
3
|
+
import { ReactNode, SetStateAction, HTMLAttributes } from 'react';
|
|
4
4
|
|
|
5
5
|
interface CopyToClipboardButtonProps {
|
|
6
6
|
value: string;
|
|
@@ -174,7 +174,25 @@ declare const DEFAULT_TIMEOUT_MS_BY_TYPE: {
|
|
|
174
174
|
};
|
|
175
175
|
type Toaster = ReturnType<typeof buildToaster>;
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
type Placement = 'top-right';
|
|
178
|
+
interface ToastContainerInnerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
179
|
+
toasts: Toast[];
|
|
180
|
+
/**
|
|
181
|
+
* The z-index of the toast container.
|
|
182
|
+
*
|
|
183
|
+
* @see {@link DEFAULT_TOAST_CONTAINER_Z_INDEX}
|
|
184
|
+
*
|
|
185
|
+
* @default 1000
|
|
186
|
+
*/
|
|
187
|
+
zIndex?: number;
|
|
188
|
+
deleteToastById: (id: string) => void;
|
|
189
|
+
/**
|
|
190
|
+
* @default "top-right"
|
|
191
|
+
*/
|
|
192
|
+
placement?: Placement;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
interface ToastContainerProps extends Omit<ToastContainerInnerProps, 'toasts' | 'deleteToastById'> {
|
|
178
196
|
toaster: Toaster;
|
|
179
197
|
}
|
|
180
198
|
declare function ToastContainer({ toaster }: ToastContainerProps): react_jsx_runtime.JSX.Element;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import * as react from 'react';
|
|
3
|
-
import { ReactNode, SetStateAction } from 'react';
|
|
3
|
+
import { ReactNode, SetStateAction, HTMLAttributes } from 'react';
|
|
4
4
|
|
|
5
5
|
interface CopyToClipboardButtonProps {
|
|
6
6
|
value: string;
|
|
@@ -174,7 +174,25 @@ declare const DEFAULT_TIMEOUT_MS_BY_TYPE: {
|
|
|
174
174
|
};
|
|
175
175
|
type Toaster = ReturnType<typeof buildToaster>;
|
|
176
176
|
|
|
177
|
-
|
|
177
|
+
type Placement = 'top-right';
|
|
178
|
+
interface ToastContainerInnerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
179
|
+
toasts: Toast[];
|
|
180
|
+
/**
|
|
181
|
+
* The z-index of the toast container.
|
|
182
|
+
*
|
|
183
|
+
* @see {@link DEFAULT_TOAST_CONTAINER_Z_INDEX}
|
|
184
|
+
*
|
|
185
|
+
* @default 1000
|
|
186
|
+
*/
|
|
187
|
+
zIndex?: number;
|
|
188
|
+
deleteToastById: (id: string) => void;
|
|
189
|
+
/**
|
|
190
|
+
* @default "top-right"
|
|
191
|
+
*/
|
|
192
|
+
placement?: Placement;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
interface ToastContainerProps extends Omit<ToastContainerInnerProps, 'toasts' | 'deleteToastById'> {
|
|
178
196
|
toaster: Toaster;
|
|
179
197
|
}
|
|
180
198
|
declare function ToastContainer({ toaster }: ToastContainerProps): react_jsx_runtime.JSX.Element;
|
package/dist/index.js
CHANGED
|
@@ -22,6 +22,18 @@ var __spreadValues = (a, b) => {
|
|
|
22
22
|
return a;
|
|
23
23
|
};
|
|
24
24
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
25
37
|
var __export = (target, all) => {
|
|
26
38
|
for (var name in all)
|
|
27
39
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -641,16 +653,24 @@ var StyledPaper = (0, import_styled_components4.default)(import_eds_core_react3.
|
|
|
641
653
|
|
|
642
654
|
// src/toast/ToastContainerInner.tsx
|
|
643
655
|
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
656
|
+
var DEFAULT_TOAST_CONTAINER_Z_INDEX = 1e3;
|
|
657
|
+
function ToastContainerInner(_a) {
|
|
658
|
+
var _b = _a, {
|
|
659
|
+
deleteToastById,
|
|
660
|
+
toasts,
|
|
661
|
+
placement = "top-right",
|
|
662
|
+
zIndex = DEFAULT_TOAST_CONTAINER_Z_INDEX
|
|
663
|
+
} = _b, containerProps = __objRest(_b, [
|
|
664
|
+
"deleteToastById",
|
|
665
|
+
"toasts",
|
|
666
|
+
"placement",
|
|
667
|
+
"zIndex"
|
|
668
|
+
]);
|
|
669
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Container, __spreadProps(__spreadValues({ $placement: placement, $zIndex: zIndex }, containerProps), { children: toasts.map((toast) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToastItem, { toast, onDelete: deleteToastById }, toast.id)) }));
|
|
651
670
|
}
|
|
652
671
|
var Container = import_styled_components5.default.div`
|
|
653
672
|
position: fixed;
|
|
673
|
+
z-index: ${({ $zIndex }) => $zIndex};
|
|
654
674
|
|
|
655
675
|
padding: 16px;
|
|
656
676
|
margin: -16px;
|
package/dist/index.mjs
CHANGED
|
@@ -17,6 +17,18 @@ var __spreadValues = (a, b) => {
|
|
|
17
17
|
return a;
|
|
18
18
|
};
|
|
19
19
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
20
32
|
var __async = (__this, __arguments, generator) => {
|
|
21
33
|
return new Promise((resolve, reject) => {
|
|
22
34
|
var fulfilled = (value) => {
|
|
@@ -597,16 +609,24 @@ var StyledPaper = styled4(Paper)`
|
|
|
597
609
|
|
|
598
610
|
// src/toast/ToastContainerInner.tsx
|
|
599
611
|
import { jsx as jsx7 } from "react/jsx-runtime";
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
612
|
+
var DEFAULT_TOAST_CONTAINER_Z_INDEX = 1e3;
|
|
613
|
+
function ToastContainerInner(_a) {
|
|
614
|
+
var _b = _a, {
|
|
615
|
+
deleteToastById,
|
|
616
|
+
toasts,
|
|
617
|
+
placement = "top-right",
|
|
618
|
+
zIndex = DEFAULT_TOAST_CONTAINER_Z_INDEX
|
|
619
|
+
} = _b, containerProps = __objRest(_b, [
|
|
620
|
+
"deleteToastById",
|
|
621
|
+
"toasts",
|
|
622
|
+
"placement",
|
|
623
|
+
"zIndex"
|
|
624
|
+
]);
|
|
625
|
+
return /* @__PURE__ */ jsx7(Container, __spreadProps(__spreadValues({ $placement: placement, $zIndex: zIndex }, containerProps), { children: toasts.map((toast) => /* @__PURE__ */ jsx7(ToastItem, { toast, onDelete: deleteToastById }, toast.id)) }));
|
|
607
626
|
}
|
|
608
627
|
var Container = styled5.div`
|
|
609
628
|
position: fixed;
|
|
629
|
+
z-index: ${({ $zIndex }) => $zIndex};
|
|
610
630
|
|
|
611
631
|
padding: 16px;
|
|
612
632
|
margin: -16px;
|