ingeniuscliq-core 0.4.23 → 0.4.25
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/_virtual/index.js +5 -0
- package/dist/_virtual/index2.js +3 -0
- package/dist/_virtual/jsx-runtime.js +5 -0
- package/dist/_virtual/jsx-runtime2.js +3 -0
- package/dist/_virtual/react-jsx-runtime.development.js +3 -0
- package/dist/_virtual/react-jsx-runtime.production.js +3 -0
- package/dist/_virtual/use-sync-external-store-shim.development.js +3 -0
- package/dist/_virtual/use-sync-external-store-shim.production.js +3 -0
- package/dist/components/common/carousel/CustomCarousel.tsx +6 -6
- package/dist/components/common/carousel/CustomCarouselSection.tsx +12 -12
- package/dist/components/common/form/CustomFormField.tsx +6 -6
- package/dist/components/common/form/FormCheckbox.tsx +5 -5
- package/dist/components/common/form/FormInput.tsx +3 -3
- package/dist/components/common/form/FormSelect.tsx +5 -5
- package/dist/components/common/form/FormTextArea.tsx +3 -3
- package/dist/components/common/form/FormWrapper.tsx +2 -2
- package/dist/components/common/logo/Logo.tsx +3 -3
- package/dist/components/common/pagination/CustomPagination.tsx +5 -5
- package/dist/components/common/select/CustomSelect.tsx +4 -4
- package/dist/components/common/spinner/Spinner.tsx +14 -14
- package/dist/components/common/stepper/Stepper.tsx +9 -9
- package/dist/components/layouts/CoreBaseLayout.tsx +5 -5
- package/dist/components/templates/CoreHomeLayout.tsx +2 -2
- package/dist/components/templates/CorePreviewLayout.tsx +2 -2
- package/dist/components/ui/accordion.tsx +14 -14
- package/dist/components/ui/alert-dialog.tsx +27 -27
- package/dist/components/ui/alert.tsx +5 -5
- package/dist/components/ui/avatar.tsx +11 -11
- package/dist/components/ui/badge.tsx +3 -3
- package/dist/components/ui/breadcrumb.tsx +14 -13
- package/dist/components/ui/button.tsx +4 -4
- package/dist/components/ui/card.tsx +8 -8
- package/dist/components/ui/carousel.tsx +14 -13
- package/dist/components/ui/checkbox.tsx +9 -9
- package/dist/components/ui/dialog.tsx +26 -26
- package/dist/components/ui/dropdown-menu.tsx +39 -37
- package/dist/components/ui/form.tsx +9 -9
- package/dist/components/ui/input.tsx +2 -2
- package/dist/components/ui/label.tsx +6 -6
- package/dist/components/ui/pagination.tsx +17 -15
- package/dist/components/ui/popover.tsx +8 -8
- package/dist/components/ui/radio-group.tsx +10 -10
- package/dist/components/ui/select.tsx +40 -38
- package/dist/components/ui/separator.tsx +5 -5
- package/dist/components/ui/sheet.tsx +27 -27
- package/dist/components/ui/skeleton.tsx +2 -2
- package/dist/components/ui/slider.tsx +9 -9
- package/dist/components/ui/stepper.tsx +34 -34
- package/dist/components/ui/switch.tsx +7 -7
- package/dist/components/ui/table.tsx +9 -9
- package/dist/components/ui/tabs.tsx +13 -13
- package/dist/components/ui/textarea.tsx +2 -2
- package/dist/components/ui/tooltip.tsx +8 -8
- package/dist/helpers/axiosGlobal.js +2 -1
- package/dist/hooks/useNotification.js +1 -1
- package/dist/lib/utils.js +2 -2
- package/dist/modules/CoreAuth/classes/CoreAuthBuilder.js +1 -1
- package/dist/modules/CoreAuth/context/AuthContext.tsx +1 -1
- package/dist/modules/CoreAuth/index.js +0 -1
- package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.js +1 -1
- package/dist/modules/CoreCustomization/index.js +0 -1
- package/dist/modules/CoreOrder/classes/CoreOrderBuilder.js +1 -1
- package/dist/modules/CoreOrder/index.js +0 -1
- package/dist/modules/CorePayForm/classes/CorePayFormBuilder.js +1 -1
- package/dist/modules/CorePayForm/index.js +0 -1
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.js +1 -1
- package/dist/modules/CoreProduct/index.js +0 -1
- package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.js +1 -1
- package/dist/modules/CoreShipment/index.js +0 -1
- package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.js +1 -1
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +814 -0
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +751 -0
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +350 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +161 -0
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +137 -0
- package/dist/node_modules/@radix-ui/number/dist/index.js +6 -0
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +305 -0
- package/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js +147 -0
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +25 -0
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +118 -0
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +270 -0
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +145 -0
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +39 -0
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +79 -0
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +321 -0
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +11 -0
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +211 -0
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +267 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +29 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +207 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-label/dist/index.js +24 -0
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +834 -0
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +299 -0
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +283 -0
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +17 -0
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +130 -0
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +43 -0
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +282 -0
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +223 -0
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +1156 -0
- package/dist/node_modules/@radix-ui/react-separator/dist/index.js +30 -0
- package/dist/node_modules/@radix-ui/react-slider/dist/index.js +554 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +99 -0
- package/dist/node_modules/@radix-ui/react-switch/dist/index.js +152 -0
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +187 -0
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +482 -0
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +12 -0
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +70 -0
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +18 -0
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +16 -0
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +7 -0
- package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +15 -0
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +40 -0
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +35 -0
- package/dist/node_modules/@stepperize/core/dist/index.js +3 -0
- package/dist/node_modules/@stepperize/react/dist/index.js +6 -0
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +137 -0
- package/dist/node_modules/axios/index.js +25 -0
- package/dist/node_modules/axios/lib/adapters/adapters.js +81 -0
- package/dist/node_modules/axios/lib/adapters/fetch.js +229 -0
- package/dist/node_modules/axios/lib/adapters/xhr.js +199 -0
- package/dist/node_modules/axios/lib/axios.js +86 -0
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +133 -0
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +23 -0
- package/dist/node_modules/axios/lib/cancel/isCancel.js +5 -0
- package/dist/node_modules/axios/lib/core/Axios.js +238 -0
- package/dist/node_modules/axios/lib/core/AxiosError.js +101 -0
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +312 -0
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +69 -0
- package/dist/node_modules/axios/lib/core/buildFullPath.js +22 -0
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +81 -0
- package/dist/node_modules/axios/lib/core/mergeConfig.js +106 -0
- package/dist/node_modules/axios/lib/core/settle.js +27 -0
- package/dist/node_modules/axios/lib/core/transformData.js +28 -0
- package/dist/node_modules/axios/lib/defaults/index.js +159 -0
- package/dist/node_modules/axios/lib/defaults/transitional.js +7 -0
- package/dist/node_modules/axios/lib/env/data.js +3 -0
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +56 -0
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +71 -0
- package/dist/node_modules/axios/lib/helpers/bind.js +7 -0
- package/dist/node_modules/axios/lib/helpers/buildURL.js +69 -0
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +15 -0
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +48 -0
- package/dist/node_modules/axios/lib/helpers/cookies.js +43 -0
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +93 -0
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +15 -0
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +14 -0
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +16 -0
- package/dist/node_modules/axios/lib/helpers/null.js +4 -0
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +55 -0
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +6 -0
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +46 -0
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +58 -0
- package/dist/node_modules/axios/lib/helpers/speedometer.js +53 -0
- package/dist/node_modules/axios/lib/helpers/spread.js +28 -0
- package/dist/node_modules/axios/lib/helpers/throttle.js +44 -0
- package/dist/node_modules/axios/lib/helpers/toFormData.js +219 -0
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +19 -0
- package/dist/node_modules/axios/lib/helpers/trackStream.js +88 -0
- package/dist/node_modules/axios/lib/helpers/validator.js +99 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +3 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +3 -0
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +5 -0
- package/dist/node_modules/axios/lib/platform/browser/index.js +15 -0
- package/dist/node_modules/axios/lib/platform/common/utils.js +45 -0
- package/dist/node_modules/axios/lib/platform/index.js +9 -0
- package/dist/node_modules/axios/lib/utils.js +780 -0
- package/dist/node_modules/class-variance-authority/dist/index.js +44 -0
- package/dist/node_modules/clsx/dist/clsx.js +3 -0
- package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +1669 -0
- package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +37 -0
- package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +38 -0
- package/dist/node_modules/get-nonce/dist/es2015/index.js +8 -0
- package/dist/node_modules/lucide-react/dist/esm/Icon.js +43 -0
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +30 -0
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +20 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-right.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/check.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +14 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis.js +18 -0
- package/dist/node_modules/lucide-react/dist/esm/icons/x.js +17 -0
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +28 -0
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +363 -0
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +44 -0
- package/dist/node_modules/react/jsx-runtime.js +19 -0
- package/dist/node_modules/react-hook-form/dist/index.esm.js +560 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +9 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +167 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +38 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +21 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +110 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +5 -0
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +7 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +56 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +10 -0
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +31 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +19 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +25 -0
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +51 -0
- package/dist/node_modules/sonner/dist/index.js +299 -0
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +3035 -0
- package/dist/node_modules/tslib/tslib.es6.js +56 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +24 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +48 -0
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +42 -0
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +21 -0
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +77 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +106 -0
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +77 -0
- package/dist/node_modules/use-sync-external-store/shim/index.js +19 -0
- package/dist/node_modules/zustand/esm/react.js +22 -0
- package/dist/node_modules/zustand/esm/vanilla.js +24 -0
- package/package.json +1 -1
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
import 'react-dom';
|
|
3
|
+
|
|
4
|
+
function __insertCSS(code) {
|
|
5
|
+
if (typeof document == 'undefined') return
|
|
6
|
+
let head = document.head || document.getElementsByTagName('head')[0];
|
|
7
|
+
let style = document.createElement('style');
|
|
8
|
+
style.type = 'text/css';
|
|
9
|
+
head.appendChild(style)
|
|
10
|
+
;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code));
|
|
11
|
+
}
|
|
12
|
+
Array(12).fill(0);
|
|
13
|
+
|
|
14
|
+
let toastsCounter = 1;
|
|
15
|
+
class Observer {
|
|
16
|
+
constructor(){
|
|
17
|
+
// We use arrow functions to maintain the correct `this` reference
|
|
18
|
+
this.subscribe = (subscriber)=>{
|
|
19
|
+
this.subscribers.push(subscriber);
|
|
20
|
+
return ()=>{
|
|
21
|
+
const index = this.subscribers.indexOf(subscriber);
|
|
22
|
+
this.subscribers.splice(index, 1);
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
this.publish = (data)=>{
|
|
26
|
+
this.subscribers.forEach((subscriber)=>subscriber(data));
|
|
27
|
+
};
|
|
28
|
+
this.addToast = (data)=>{
|
|
29
|
+
this.publish(data);
|
|
30
|
+
this.toasts = [
|
|
31
|
+
...this.toasts,
|
|
32
|
+
data
|
|
33
|
+
];
|
|
34
|
+
};
|
|
35
|
+
this.create = (data)=>{
|
|
36
|
+
var _data_id;
|
|
37
|
+
const { message, ...rest } = data;
|
|
38
|
+
const id = typeof (data == null ? void 0 : data.id) === 'number' || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
|
|
39
|
+
const alreadyExists = this.toasts.find((toast)=>{
|
|
40
|
+
return toast.id === id;
|
|
41
|
+
});
|
|
42
|
+
const dismissible = data.dismissible === undefined ? true : data.dismissible;
|
|
43
|
+
if (this.dismissedToasts.has(id)) {
|
|
44
|
+
this.dismissedToasts.delete(id);
|
|
45
|
+
}
|
|
46
|
+
if (alreadyExists) {
|
|
47
|
+
this.toasts = this.toasts.map((toast)=>{
|
|
48
|
+
if (toast.id === id) {
|
|
49
|
+
this.publish({
|
|
50
|
+
...toast,
|
|
51
|
+
...data,
|
|
52
|
+
id,
|
|
53
|
+
title: message
|
|
54
|
+
});
|
|
55
|
+
return {
|
|
56
|
+
...toast,
|
|
57
|
+
...data,
|
|
58
|
+
id,
|
|
59
|
+
dismissible,
|
|
60
|
+
title: message
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
return toast;
|
|
64
|
+
});
|
|
65
|
+
} else {
|
|
66
|
+
this.addToast({
|
|
67
|
+
title: message,
|
|
68
|
+
...rest,
|
|
69
|
+
dismissible,
|
|
70
|
+
id
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return id;
|
|
74
|
+
};
|
|
75
|
+
this.dismiss = (id)=>{
|
|
76
|
+
if (id) {
|
|
77
|
+
this.dismissedToasts.add(id);
|
|
78
|
+
requestAnimationFrame(()=>this.subscribers.forEach((subscriber)=>subscriber({
|
|
79
|
+
id,
|
|
80
|
+
dismiss: true
|
|
81
|
+
})));
|
|
82
|
+
} else {
|
|
83
|
+
this.toasts.forEach((toast)=>{
|
|
84
|
+
this.subscribers.forEach((subscriber)=>subscriber({
|
|
85
|
+
id: toast.id,
|
|
86
|
+
dismiss: true
|
|
87
|
+
}));
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return id;
|
|
91
|
+
};
|
|
92
|
+
this.message = (message, data)=>{
|
|
93
|
+
return this.create({
|
|
94
|
+
...data,
|
|
95
|
+
message
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
this.error = (message, data)=>{
|
|
99
|
+
return this.create({
|
|
100
|
+
...data,
|
|
101
|
+
message,
|
|
102
|
+
type: 'error'
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
this.success = (message, data)=>{
|
|
106
|
+
return this.create({
|
|
107
|
+
...data,
|
|
108
|
+
type: 'success',
|
|
109
|
+
message
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
this.info = (message, data)=>{
|
|
113
|
+
return this.create({
|
|
114
|
+
...data,
|
|
115
|
+
type: 'info',
|
|
116
|
+
message
|
|
117
|
+
});
|
|
118
|
+
};
|
|
119
|
+
this.warning = (message, data)=>{
|
|
120
|
+
return this.create({
|
|
121
|
+
...data,
|
|
122
|
+
type: 'warning',
|
|
123
|
+
message
|
|
124
|
+
});
|
|
125
|
+
};
|
|
126
|
+
this.loading = (message, data)=>{
|
|
127
|
+
return this.create({
|
|
128
|
+
...data,
|
|
129
|
+
type: 'loading',
|
|
130
|
+
message
|
|
131
|
+
});
|
|
132
|
+
};
|
|
133
|
+
this.promise = (promise, data)=>{
|
|
134
|
+
if (!data) {
|
|
135
|
+
// Nothing to show
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
let id = undefined;
|
|
139
|
+
if (data.loading !== undefined) {
|
|
140
|
+
id = this.create({
|
|
141
|
+
...data,
|
|
142
|
+
promise,
|
|
143
|
+
type: 'loading',
|
|
144
|
+
message: data.loading,
|
|
145
|
+
description: typeof data.description !== 'function' ? data.description : undefined
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
const p = Promise.resolve(promise instanceof Function ? promise() : promise);
|
|
149
|
+
let shouldDismiss = id !== undefined;
|
|
150
|
+
let result;
|
|
151
|
+
const originalPromise = p.then(async (response)=>{
|
|
152
|
+
result = [
|
|
153
|
+
'resolve',
|
|
154
|
+
response
|
|
155
|
+
];
|
|
156
|
+
const isReactElementResponse = React__default.isValidElement(response);
|
|
157
|
+
if (isReactElementResponse) {
|
|
158
|
+
shouldDismiss = false;
|
|
159
|
+
this.create({
|
|
160
|
+
id,
|
|
161
|
+
type: 'default',
|
|
162
|
+
message: response
|
|
163
|
+
});
|
|
164
|
+
} else if (isHttpResponse(response) && !response.ok) {
|
|
165
|
+
shouldDismiss = false;
|
|
166
|
+
const promiseData = typeof data.error === 'function' ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
|
|
167
|
+
const description = typeof data.description === 'function' ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
|
|
168
|
+
const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
|
|
169
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
170
|
+
message: promiseData
|
|
171
|
+
};
|
|
172
|
+
this.create({
|
|
173
|
+
id,
|
|
174
|
+
type: 'error',
|
|
175
|
+
description,
|
|
176
|
+
...toastSettings
|
|
177
|
+
});
|
|
178
|
+
} else if (response instanceof Error) {
|
|
179
|
+
shouldDismiss = false;
|
|
180
|
+
const promiseData = typeof data.error === 'function' ? await data.error(response) : data.error;
|
|
181
|
+
const description = typeof data.description === 'function' ? await data.description(response) : data.description;
|
|
182
|
+
const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
|
|
183
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
184
|
+
message: promiseData
|
|
185
|
+
};
|
|
186
|
+
this.create({
|
|
187
|
+
id,
|
|
188
|
+
type: 'error',
|
|
189
|
+
description,
|
|
190
|
+
...toastSettings
|
|
191
|
+
});
|
|
192
|
+
} else if (data.success !== undefined) {
|
|
193
|
+
shouldDismiss = false;
|
|
194
|
+
const promiseData = typeof data.success === 'function' ? await data.success(response) : data.success;
|
|
195
|
+
const description = typeof data.description === 'function' ? await data.description(response) : data.description;
|
|
196
|
+
const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
|
|
197
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
198
|
+
message: promiseData
|
|
199
|
+
};
|
|
200
|
+
this.create({
|
|
201
|
+
id,
|
|
202
|
+
type: 'success',
|
|
203
|
+
description,
|
|
204
|
+
...toastSettings
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}).catch(async (error)=>{
|
|
208
|
+
result = [
|
|
209
|
+
'reject',
|
|
210
|
+
error
|
|
211
|
+
];
|
|
212
|
+
if (data.error !== undefined) {
|
|
213
|
+
shouldDismiss = false;
|
|
214
|
+
const promiseData = typeof data.error === 'function' ? await data.error(error) : data.error;
|
|
215
|
+
const description = typeof data.description === 'function' ? await data.description(error) : data.description;
|
|
216
|
+
const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
|
|
217
|
+
const toastSettings = isExtendedResult ? promiseData : {
|
|
218
|
+
message: promiseData
|
|
219
|
+
};
|
|
220
|
+
this.create({
|
|
221
|
+
id,
|
|
222
|
+
type: 'error',
|
|
223
|
+
description,
|
|
224
|
+
...toastSettings
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
}).finally(()=>{
|
|
228
|
+
if (shouldDismiss) {
|
|
229
|
+
// Toast is still in load state (and will be indefinitely — dismiss it)
|
|
230
|
+
this.dismiss(id);
|
|
231
|
+
id = undefined;
|
|
232
|
+
}
|
|
233
|
+
data.finally == null ? void 0 : data.finally.call(data);
|
|
234
|
+
});
|
|
235
|
+
const unwrap = ()=>new Promise((resolve, reject)=>originalPromise.then(()=>result[0] === 'reject' ? reject(result[1]) : resolve(result[1])).catch(reject));
|
|
236
|
+
if (typeof id !== 'string' && typeof id !== 'number') {
|
|
237
|
+
// cannot Object.assign on undefined
|
|
238
|
+
return {
|
|
239
|
+
unwrap
|
|
240
|
+
};
|
|
241
|
+
} else {
|
|
242
|
+
return Object.assign(id, {
|
|
243
|
+
unwrap
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
};
|
|
247
|
+
this.custom = (jsx, data)=>{
|
|
248
|
+
const id = (data == null ? void 0 : data.id) || toastsCounter++;
|
|
249
|
+
this.create({
|
|
250
|
+
jsx: jsx(id),
|
|
251
|
+
id,
|
|
252
|
+
...data
|
|
253
|
+
});
|
|
254
|
+
return id;
|
|
255
|
+
};
|
|
256
|
+
this.getActiveToasts = ()=>{
|
|
257
|
+
return this.toasts.filter((toast)=>!this.dismissedToasts.has(toast.id));
|
|
258
|
+
};
|
|
259
|
+
this.subscribers = [];
|
|
260
|
+
this.toasts = [];
|
|
261
|
+
this.dismissedToasts = new Set();
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const ToastState = new Observer();
|
|
265
|
+
// bind this to the toast function
|
|
266
|
+
const toastFunction = (message, data)=>{
|
|
267
|
+
const id = (data == null ? void 0 : data.id) || toastsCounter++;
|
|
268
|
+
ToastState.addToast({
|
|
269
|
+
title: message,
|
|
270
|
+
...data,
|
|
271
|
+
id
|
|
272
|
+
});
|
|
273
|
+
return id;
|
|
274
|
+
};
|
|
275
|
+
const isHttpResponse = (data)=>{
|
|
276
|
+
return data && typeof data === 'object' && 'ok' in data && typeof data.ok === 'boolean' && 'status' in data && typeof data.status === 'number';
|
|
277
|
+
};
|
|
278
|
+
const basicToast = toastFunction;
|
|
279
|
+
const getHistory = ()=>ToastState.toasts;
|
|
280
|
+
const getToasts = ()=>ToastState.getActiveToasts();
|
|
281
|
+
// We use `Object.assign` to maintain the correct types as we would lose them otherwise
|
|
282
|
+
const toast = Object.assign(basicToast, {
|
|
283
|
+
success: ToastState.success,
|
|
284
|
+
info: ToastState.info,
|
|
285
|
+
warning: ToastState.warning,
|
|
286
|
+
error: ToastState.error,
|
|
287
|
+
custom: ToastState.custom,
|
|
288
|
+
message: ToastState.message,
|
|
289
|
+
promise: ToastState.promise,
|
|
290
|
+
dismiss: ToastState.dismiss,
|
|
291
|
+
loading: ToastState.loading
|
|
292
|
+
}, {
|
|
293
|
+
getHistory,
|
|
294
|
+
getToasts
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
__insertCSS("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");
|
|
298
|
+
|
|
299
|
+
export { toast };
|