@caratlogic/design-system 0.0.6 → 0.0.8
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/components/molecules/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/molecules/ConfirmDialog/ConfirmDialog.types.d.ts +3 -0
- package/dist/components/molecules/ConfirmDialog/ConfirmDialog.types.d.ts.map +1 -1
- package/dist/components/molecules/DateInput/DateInput.d.ts.map +1 -1
- package/dist/components/molecules/RichTextArea/RichTextArea.hooks.d.ts.map +1 -1
- package/dist/components/molecules/RichTextArea/RichTextArea.utils.d.ts +1 -1
- package/dist/components/molecules/RichTextArea/RichTextArea.utils.d.ts.map +1 -1
- package/dist/components/organisms/FileUploader/ImageCropModal.d.ts.map +1 -1
- package/dist/index.cjs.js +41 -314
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +35 -308
- package/dist/index.esm.js.map +1 -1
- package/package.json +5 -4
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment as Fragment$2 } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { forwardRef, createElement, useState, useCallback, useMemo, useEffect, useRef, createContext, useContext, useLayoutEffect, cloneElement, createRef, Component, Fragment as Fragment$3, lazy, Suspense, memo, useReducer, PureComponent, useDebugValue } from 'react';
|
|
4
|
+
import { toast } from 'sonner';
|
|
4
5
|
import * as ReactDOM from 'react-dom';
|
|
5
6
|
import ReactDOM__default, { unstable_batchedUpdates, createPortal } from 'react-dom';
|
|
6
7
|
import { Link as Link$1 } from 'react-router-dom';
|
|
@@ -3936,301 +3937,6 @@ const renderBadge = (text, type = BadgeType.SECONDARY, options) => {
|
|
|
3936
3937
|
return (jsxs(Badge$1, { className: `text-xs flex items-center gap-1 ${className}`, children: [options?.showIcon && IconToRender && (jsx(IconToRender, { className: "w-3 h-3" })), text] }));
|
|
3937
3938
|
};
|
|
3938
3939
|
|
|
3939
|
-
function __insertCSS(code) {
|
|
3940
|
-
if (typeof document == 'undefined') return
|
|
3941
|
-
let head = document.head || document.getElementsByTagName('head')[0];
|
|
3942
|
-
let style = document.createElement('style');
|
|
3943
|
-
style.type = 'text/css';
|
|
3944
|
-
head.appendChild(style)
|
|
3945
|
-
;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code));
|
|
3946
|
-
}
|
|
3947
|
-
Array(12).fill(0);
|
|
3948
|
-
|
|
3949
|
-
let toastsCounter = 1;
|
|
3950
|
-
class Observer {
|
|
3951
|
-
constructor(){
|
|
3952
|
-
// We use arrow functions to maintain the correct `this` reference
|
|
3953
|
-
this.subscribe = (subscriber)=>{
|
|
3954
|
-
this.subscribers.push(subscriber);
|
|
3955
|
-
return ()=>{
|
|
3956
|
-
const index = this.subscribers.indexOf(subscriber);
|
|
3957
|
-
this.subscribers.splice(index, 1);
|
|
3958
|
-
};
|
|
3959
|
-
};
|
|
3960
|
-
this.publish = (data)=>{
|
|
3961
|
-
this.subscribers.forEach((subscriber)=>subscriber(data));
|
|
3962
|
-
};
|
|
3963
|
-
this.addToast = (data)=>{
|
|
3964
|
-
this.publish(data);
|
|
3965
|
-
this.toasts = [
|
|
3966
|
-
...this.toasts,
|
|
3967
|
-
data
|
|
3968
|
-
];
|
|
3969
|
-
};
|
|
3970
|
-
this.create = (data)=>{
|
|
3971
|
-
var _data_id;
|
|
3972
|
-
const { message, ...rest } = data;
|
|
3973
|
-
const id = typeof (data == null ? void 0 : data.id) === 'number' || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
|
|
3974
|
-
const alreadyExists = this.toasts.find((toast)=>{
|
|
3975
|
-
return toast.id === id;
|
|
3976
|
-
});
|
|
3977
|
-
const dismissible = data.dismissible === undefined ? true : data.dismissible;
|
|
3978
|
-
if (this.dismissedToasts.has(id)) {
|
|
3979
|
-
this.dismissedToasts.delete(id);
|
|
3980
|
-
}
|
|
3981
|
-
if (alreadyExists) {
|
|
3982
|
-
this.toasts = this.toasts.map((toast)=>{
|
|
3983
|
-
if (toast.id === id) {
|
|
3984
|
-
this.publish({
|
|
3985
|
-
...toast,
|
|
3986
|
-
...data,
|
|
3987
|
-
id,
|
|
3988
|
-
title: message
|
|
3989
|
-
});
|
|
3990
|
-
return {
|
|
3991
|
-
...toast,
|
|
3992
|
-
...data,
|
|
3993
|
-
id,
|
|
3994
|
-
dismissible,
|
|
3995
|
-
title: message
|
|
3996
|
-
};
|
|
3997
|
-
}
|
|
3998
|
-
return toast;
|
|
3999
|
-
});
|
|
4000
|
-
} else {
|
|
4001
|
-
this.addToast({
|
|
4002
|
-
title: message,
|
|
4003
|
-
...rest,
|
|
4004
|
-
dismissible,
|
|
4005
|
-
id
|
|
4006
|
-
});
|
|
4007
|
-
}
|
|
4008
|
-
return id;
|
|
4009
|
-
};
|
|
4010
|
-
this.dismiss = (id)=>{
|
|
4011
|
-
if (id) {
|
|
4012
|
-
this.dismissedToasts.add(id);
|
|
4013
|
-
requestAnimationFrame(()=>this.subscribers.forEach((subscriber)=>subscriber({
|
|
4014
|
-
id,
|
|
4015
|
-
dismiss: true
|
|
4016
|
-
})));
|
|
4017
|
-
} else {
|
|
4018
|
-
this.toasts.forEach((toast)=>{
|
|
4019
|
-
this.subscribers.forEach((subscriber)=>subscriber({
|
|
4020
|
-
id: toast.id,
|
|
4021
|
-
dismiss: true
|
|
4022
|
-
}));
|
|
4023
|
-
});
|
|
4024
|
-
}
|
|
4025
|
-
return id;
|
|
4026
|
-
};
|
|
4027
|
-
this.message = (message, data)=>{
|
|
4028
|
-
return this.create({
|
|
4029
|
-
...data,
|
|
4030
|
-
message
|
|
4031
|
-
});
|
|
4032
|
-
};
|
|
4033
|
-
this.error = (message, data)=>{
|
|
4034
|
-
return this.create({
|
|
4035
|
-
...data,
|
|
4036
|
-
message,
|
|
4037
|
-
type: 'error'
|
|
4038
|
-
});
|
|
4039
|
-
};
|
|
4040
|
-
this.success = (message, data)=>{
|
|
4041
|
-
return this.create({
|
|
4042
|
-
...data,
|
|
4043
|
-
type: 'success',
|
|
4044
|
-
message
|
|
4045
|
-
});
|
|
4046
|
-
};
|
|
4047
|
-
this.info = (message, data)=>{
|
|
4048
|
-
return this.create({
|
|
4049
|
-
...data,
|
|
4050
|
-
type: 'info',
|
|
4051
|
-
message
|
|
4052
|
-
});
|
|
4053
|
-
};
|
|
4054
|
-
this.warning = (message, data)=>{
|
|
4055
|
-
return this.create({
|
|
4056
|
-
...data,
|
|
4057
|
-
type: 'warning',
|
|
4058
|
-
message
|
|
4059
|
-
});
|
|
4060
|
-
};
|
|
4061
|
-
this.loading = (message, data)=>{
|
|
4062
|
-
return this.create({
|
|
4063
|
-
...data,
|
|
4064
|
-
type: 'loading',
|
|
4065
|
-
message
|
|
4066
|
-
});
|
|
4067
|
-
};
|
|
4068
|
-
this.promise = (promise, data)=>{
|
|
4069
|
-
if (!data) {
|
|
4070
|
-
// Nothing to show
|
|
4071
|
-
return;
|
|
4072
|
-
}
|
|
4073
|
-
let id = undefined;
|
|
4074
|
-
if (data.loading !== undefined) {
|
|
4075
|
-
id = this.create({
|
|
4076
|
-
...data,
|
|
4077
|
-
promise,
|
|
4078
|
-
type: 'loading',
|
|
4079
|
-
message: data.loading,
|
|
4080
|
-
description: typeof data.description !== 'function' ? data.description : undefined
|
|
4081
|
-
});
|
|
4082
|
-
}
|
|
4083
|
-
const p = Promise.resolve(promise instanceof Function ? promise() : promise);
|
|
4084
|
-
let shouldDismiss = id !== undefined;
|
|
4085
|
-
let result;
|
|
4086
|
-
const originalPromise = p.then(async (response)=>{
|
|
4087
|
-
result = [
|
|
4088
|
-
'resolve',
|
|
4089
|
-
response
|
|
4090
|
-
];
|
|
4091
|
-
const isReactElementResponse = React__default.isValidElement(response);
|
|
4092
|
-
if (isReactElementResponse) {
|
|
4093
|
-
shouldDismiss = false;
|
|
4094
|
-
this.create({
|
|
4095
|
-
id,
|
|
4096
|
-
type: 'default',
|
|
4097
|
-
message: response
|
|
4098
|
-
});
|
|
4099
|
-
} else if (isHttpResponse(response) && !response.ok) {
|
|
4100
|
-
shouldDismiss = false;
|
|
4101
|
-
const promiseData = typeof data.error === 'function' ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
|
|
4102
|
-
const description = typeof data.description === 'function' ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
|
|
4103
|
-
const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
|
|
4104
|
-
const toastSettings = isExtendedResult ? promiseData : {
|
|
4105
|
-
message: promiseData
|
|
4106
|
-
};
|
|
4107
|
-
this.create({
|
|
4108
|
-
id,
|
|
4109
|
-
type: 'error',
|
|
4110
|
-
description,
|
|
4111
|
-
...toastSettings
|
|
4112
|
-
});
|
|
4113
|
-
} else if (response instanceof Error) {
|
|
4114
|
-
shouldDismiss = false;
|
|
4115
|
-
const promiseData = typeof data.error === 'function' ? await data.error(response) : data.error;
|
|
4116
|
-
const description = typeof data.description === 'function' ? await data.description(response) : data.description;
|
|
4117
|
-
const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
|
|
4118
|
-
const toastSettings = isExtendedResult ? promiseData : {
|
|
4119
|
-
message: promiseData
|
|
4120
|
-
};
|
|
4121
|
-
this.create({
|
|
4122
|
-
id,
|
|
4123
|
-
type: 'error',
|
|
4124
|
-
description,
|
|
4125
|
-
...toastSettings
|
|
4126
|
-
});
|
|
4127
|
-
} else if (data.success !== undefined) {
|
|
4128
|
-
shouldDismiss = false;
|
|
4129
|
-
const promiseData = typeof data.success === 'function' ? await data.success(response) : data.success;
|
|
4130
|
-
const description = typeof data.description === 'function' ? await data.description(response) : data.description;
|
|
4131
|
-
const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
|
|
4132
|
-
const toastSettings = isExtendedResult ? promiseData : {
|
|
4133
|
-
message: promiseData
|
|
4134
|
-
};
|
|
4135
|
-
this.create({
|
|
4136
|
-
id,
|
|
4137
|
-
type: 'success',
|
|
4138
|
-
description,
|
|
4139
|
-
...toastSettings
|
|
4140
|
-
});
|
|
4141
|
-
}
|
|
4142
|
-
}).catch(async (error)=>{
|
|
4143
|
-
result = [
|
|
4144
|
-
'reject',
|
|
4145
|
-
error
|
|
4146
|
-
];
|
|
4147
|
-
if (data.error !== undefined) {
|
|
4148
|
-
shouldDismiss = false;
|
|
4149
|
-
const promiseData = typeof data.error === 'function' ? await data.error(error) : data.error;
|
|
4150
|
-
const description = typeof data.description === 'function' ? await data.description(error) : data.description;
|
|
4151
|
-
const isExtendedResult = typeof promiseData === 'object' && !React__default.isValidElement(promiseData);
|
|
4152
|
-
const toastSettings = isExtendedResult ? promiseData : {
|
|
4153
|
-
message: promiseData
|
|
4154
|
-
};
|
|
4155
|
-
this.create({
|
|
4156
|
-
id,
|
|
4157
|
-
type: 'error',
|
|
4158
|
-
description,
|
|
4159
|
-
...toastSettings
|
|
4160
|
-
});
|
|
4161
|
-
}
|
|
4162
|
-
}).finally(()=>{
|
|
4163
|
-
if (shouldDismiss) {
|
|
4164
|
-
// Toast is still in load state (and will be indefinitely — dismiss it)
|
|
4165
|
-
this.dismiss(id);
|
|
4166
|
-
id = undefined;
|
|
4167
|
-
}
|
|
4168
|
-
data.finally == null ? void 0 : data.finally.call(data);
|
|
4169
|
-
});
|
|
4170
|
-
const unwrap = ()=>new Promise((resolve, reject)=>originalPromise.then(()=>result[0] === 'reject' ? reject(result[1]) : resolve(result[1])).catch(reject));
|
|
4171
|
-
if (typeof id !== 'string' && typeof id !== 'number') {
|
|
4172
|
-
// cannot Object.assign on undefined
|
|
4173
|
-
return {
|
|
4174
|
-
unwrap
|
|
4175
|
-
};
|
|
4176
|
-
} else {
|
|
4177
|
-
return Object.assign(id, {
|
|
4178
|
-
unwrap
|
|
4179
|
-
});
|
|
4180
|
-
}
|
|
4181
|
-
};
|
|
4182
|
-
this.custom = (jsx, data)=>{
|
|
4183
|
-
const id = (data == null ? void 0 : data.id) || toastsCounter++;
|
|
4184
|
-
this.create({
|
|
4185
|
-
jsx: jsx(id),
|
|
4186
|
-
id,
|
|
4187
|
-
...data
|
|
4188
|
-
});
|
|
4189
|
-
return id;
|
|
4190
|
-
};
|
|
4191
|
-
this.getActiveToasts = ()=>{
|
|
4192
|
-
return this.toasts.filter((toast)=>!this.dismissedToasts.has(toast.id));
|
|
4193
|
-
};
|
|
4194
|
-
this.subscribers = [];
|
|
4195
|
-
this.toasts = [];
|
|
4196
|
-
this.dismissedToasts = new Set();
|
|
4197
|
-
}
|
|
4198
|
-
}
|
|
4199
|
-
const ToastState = new Observer();
|
|
4200
|
-
// bind this to the toast function
|
|
4201
|
-
const toastFunction = (message, data)=>{
|
|
4202
|
-
const id = (data == null ? void 0 : data.id) || toastsCounter++;
|
|
4203
|
-
ToastState.addToast({
|
|
4204
|
-
title: message,
|
|
4205
|
-
...data,
|
|
4206
|
-
id
|
|
4207
|
-
});
|
|
4208
|
-
return id;
|
|
4209
|
-
};
|
|
4210
|
-
const isHttpResponse = (data)=>{
|
|
4211
|
-
return data && typeof data === 'object' && 'ok' in data && typeof data.ok === 'boolean' && 'status' in data && typeof data.status === 'number';
|
|
4212
|
-
};
|
|
4213
|
-
const basicToast = toastFunction;
|
|
4214
|
-
const getHistory = ()=>ToastState.toasts;
|
|
4215
|
-
const getToasts = ()=>ToastState.getActiveToasts();
|
|
4216
|
-
// We use `Object.assign` to maintain the correct types as we would lose them otherwise
|
|
4217
|
-
const toast = Object.assign(basicToast, {
|
|
4218
|
-
success: ToastState.success,
|
|
4219
|
-
info: ToastState.info,
|
|
4220
|
-
warning: ToastState.warning,
|
|
4221
|
-
error: ToastState.error,
|
|
4222
|
-
custom: ToastState.custom,
|
|
4223
|
-
message: ToastState.message,
|
|
4224
|
-
promise: ToastState.promise,
|
|
4225
|
-
dismiss: ToastState.dismiss,
|
|
4226
|
-
loading: ToastState.loading
|
|
4227
|
-
}, {
|
|
4228
|
-
getHistory,
|
|
4229
|
-
getToasts
|
|
4230
|
-
});
|
|
4231
|
-
|
|
4232
|
-
__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%)}");
|
|
4233
|
-
|
|
4234
3940
|
function AlertTitle({ className, ...props }) {
|
|
4235
3941
|
return (jsx("div", { "data-slot": "alert-title", className: cn('col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight', className), ...props }));
|
|
4236
3942
|
}
|
|
@@ -12850,7 +12556,7 @@ var Popover$1 = (props) => {
|
|
|
12850
12556
|
};
|
|
12851
12557
|
Popover$1.displayName = POPOVER_NAME;
|
|
12852
12558
|
var ANCHOR_NAME$2 = "PopoverAnchor";
|
|
12853
|
-
var PopoverAnchor = React.forwardRef(
|
|
12559
|
+
var PopoverAnchor$1 = React.forwardRef(
|
|
12854
12560
|
(props, forwardedRef) => {
|
|
12855
12561
|
const { __scopePopover, ...anchorProps } = props;
|
|
12856
12562
|
const context = usePopoverContext(ANCHOR_NAME$2, __scopePopover);
|
|
@@ -12863,7 +12569,7 @@ var PopoverAnchor = React.forwardRef(
|
|
|
12863
12569
|
return /* @__PURE__ */ jsx(Anchor$1, { ...popperScope, ...anchorProps, ref: forwardedRef });
|
|
12864
12570
|
}
|
|
12865
12571
|
);
|
|
12866
|
-
PopoverAnchor.displayName = ANCHOR_NAME$2;
|
|
12572
|
+
PopoverAnchor$1.displayName = ANCHOR_NAME$2;
|
|
12867
12573
|
var TRIGGER_NAME$5 = "PopoverTrigger";
|
|
12868
12574
|
var PopoverTrigger$1 = React.forwardRef(
|
|
12869
12575
|
(props, forwardedRef) => {
|
|
@@ -13083,6 +12789,7 @@ function getState$2(open) {
|
|
|
13083
12789
|
return open ? "open" : "closed";
|
|
13084
12790
|
}
|
|
13085
12791
|
var Root2$3 = Popover$1;
|
|
12792
|
+
var Anchor2$1 = PopoverAnchor$1;
|
|
13086
12793
|
var Trigger$4 = PopoverTrigger$1;
|
|
13087
12794
|
var Portal$4 = PopoverPortal;
|
|
13088
12795
|
var Content2$4 = PopoverContent$1;
|
|
@@ -13096,6 +12803,9 @@ function PopoverTrigger({ ...props }) {
|
|
|
13096
12803
|
function PopoverContent({ className, align = 'center', sideOffset = 8, ...props }) {
|
|
13097
12804
|
return (jsx(Portal$4, { children: jsx(Content2$4, { "data-slot": "popover-content", align: align, sideOffset: sideOffset, className: cn('bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden', className), ...props }) }));
|
|
13098
12805
|
}
|
|
12806
|
+
function PopoverAnchor({ ...props }) {
|
|
12807
|
+
return jsx(Anchor2$1, { "data-slot": "popover-anchor", ...props });
|
|
12808
|
+
}
|
|
13099
12809
|
|
|
13100
12810
|
const SCROLL_THRESHOLD = 50;
|
|
13101
12811
|
function useSearchableSelect({ selectedItem, onChange, getOptionKey, getOptionLabel, getOptionSubLabel, fetchPage, staticOptions, filterFn, preSelectedId, resolveById, pageSize, debounceMs, }) {
|
|
@@ -21224,14 +20934,14 @@ function useRefundToWallet(open) {
|
|
|
21224
20934
|
return { refundToWallet, setRefundToWallet };
|
|
21225
20935
|
}
|
|
21226
20936
|
|
|
21227
|
-
const ConfirmDialog = ({ open, onOpenChange, title, description, info, confirmLabel = 'Yes', cancelLabel = 'Cancel', confirmVariant = 'default', disabled = false, onConfirm, onCancel, }) => {
|
|
20937
|
+
const ConfirmDialog = ({ open, onOpenChange, title, description, info, confirmLabel = 'Yes', cancelLabel = 'Cancel', confirmVariant = 'default', icon: Icon = Trash2, disabled = false, onConfirm, onCancel, }) => {
|
|
21228
20938
|
const { refundToWallet, setRefundToWallet } = useRefundToWallet(open);
|
|
21229
|
-
return (jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: jsxs(DialogContent, { children: [jsxs(DialogHeader, { children: [jsxs(DialogTitle, { className: "flex items-center gap-2", children: [confirmVariant === 'destructive' && (jsx("span", { className: "inline-flex h-
|
|
20939
|
+
return (jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: jsxs(DialogContent, { className: "gap-3 p-5", children: [jsxs(DialogHeader, { className: "gap-1.5", children: [jsxs(DialogTitle, { className: "flex items-center gap-2", children: [confirmVariant === 'destructive' && (jsx("span", { className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-destructive/10", children: jsx(Icon, { className: "h-3.5 w-3.5 text-destructive" }) })), jsx("span", { children: title })] }), description && jsx(DialogDescription, { children: description }), info && (jsx(InfoCard, { info: info, title: title, refundToWallet: refundToWallet, onRefundChange: setRefundToWallet }))] }), jsxs(DialogFooter, { className: "mt-1", children: [jsx(Button$1, { variant: "outline", onClick: () => {
|
|
21230
20940
|
onCancel?.();
|
|
21231
20941
|
onOpenChange(false);
|
|
21232
20942
|
}, disabled: disabled, children: cancelLabel }), jsxs(Button$1, { variant: confirmVariant, onClick: async () => {
|
|
21233
20943
|
await onConfirm(title === 'Cancel Invoice' ? refundToWallet : undefined);
|
|
21234
|
-
}, disabled: disabled,
|
|
20944
|
+
}, disabled: disabled, children: [confirmVariant === 'destructive' && (jsx(Icon, { className: "h-4 w-4", "aria-hidden": true })), disabled ? 'Please wait...' : confirmLabel] })] })] }) }));
|
|
21235
20945
|
};
|
|
21236
20946
|
|
|
21237
20947
|
/** Class builder for a segment button in the `segmented` variant. */
|
|
@@ -35021,11 +34731,18 @@ function DatePickerHeader({ monthDate, changeYear, changeMonth, decreaseMonth, i
|
|
|
35021
34731
|
function DateInput({ value, onChange, onBlur, name, className, min, max, disabled, placeholder = 'Select date', }) {
|
|
35022
34732
|
const [open, setOpen] = useState(false);
|
|
35023
34733
|
const { minDate, maxDate, minYear, maxYear } = computeDateBounds(min, max);
|
|
35024
|
-
|
|
35025
|
-
|
|
35026
|
-
|
|
35027
|
-
|
|
35028
|
-
|
|
34734
|
+
// NOTE: We drive `open` ourselves from the button's onClick instead of using
|
|
34735
|
+
// Radix's <PopoverTrigger> toggle. When this Popover is nested inside the
|
|
34736
|
+
// modal <SlideOut> (Radix Dialog), the trigger's built-in toggle does not
|
|
34737
|
+
// fire in Safari, so the calendar never opened. Using <PopoverAnchor> (pure
|
|
34738
|
+
// positioning, no event handlers) + a single controlled toggle is the one
|
|
34739
|
+
// source of truth — no double-fire, and it works across browsers. `modal`
|
|
34740
|
+
// lets the open popover own pointer events above the dialog so the calendar
|
|
34741
|
+
// (portalled to <body>) stays clickable.
|
|
34742
|
+
return (jsxs(Popover, { open: open, onOpenChange: setOpen, modal: true, children: [jsx(PopoverAnchor, { asChild: true, children: jsxs("button", { type: "button", name: name, onBlur: onBlur, disabled: disabled, "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => {
|
|
34743
|
+
if (!disabled)
|
|
34744
|
+
setOpen((prev) => !prev);
|
|
34745
|
+
}, "data-slot": "input", "data-empty": !value || undefined, className: cn('border-input-border flex h-9 w-full min-w-0 cursor-pointer items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-1 text-left shadow-[0_1px_2px_0_#0000000d] transition-[color,box-shadow] outline-none', 'focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]', 'aria-invalid:ring-destructive/20 aria-invalid:border-destructive', disabled && 'cursor-not-allowed bg-muted text-label', className), children: [jsx("span", { className: cn('truncate text-sm md:text-sm', value ? 'text-foreground' : 'text-placeholder'), children: value ? moment(value).format('DD/MM/YYYY') : placeholder }), jsx("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground", children: jsx(CalendarDays, { className: "h-4 w-4 stroke-[1.75]" }) })] }) }), jsx(PopoverContent, { align: "start", className: "date-range-picker-popover w-auto p-4", children: jsx(DatePicker, { inline: true, selected: value ?? null, minDate: minDate ? moment(minDate, 'YYYY-MM-DD').toDate() : undefined, maxDate: maxDate ? moment(maxDate, 'YYYY-MM-DD').toDate() : undefined, onChange: (date) => {
|
|
35029
34746
|
onChange(date ?? undefined);
|
|
35030
34747
|
if (date)
|
|
35031
34748
|
setOpen(false);
|
|
@@ -65174,6 +64891,10 @@ var Highlight = Mark.create({
|
|
|
65174
64891
|
}
|
|
65175
64892
|
});
|
|
65176
64893
|
|
|
64894
|
+
// StarterKit v3 already bundles the Underline mark. Re-registering the
|
|
64895
|
+
// standalone @tiptap/extension-underline duplicates the mark, which corrupts
|
|
64896
|
+
// the ProseMirror schema and makes editor.getHTML() throw
|
|
64897
|
+
// ("Cannot read properties of null (reading 'cached')").
|
|
65177
64898
|
const EDITOR_EXTENSIONS = [
|
|
65178
64899
|
index_default.configure({
|
|
65179
64900
|
paragraph: {
|
|
@@ -65185,7 +64906,6 @@ const EDITOR_EXTENSIONS = [
|
|
|
65185
64906
|
levels: [1, 2, 3],
|
|
65186
64907
|
},
|
|
65187
64908
|
}),
|
|
65188
|
-
Underline,
|
|
65189
64909
|
TextStyle,
|
|
65190
64910
|
Color,
|
|
65191
64911
|
Highlight.configure({ multicolor: true }),
|
|
@@ -73683,7 +73403,7 @@ function ImageCropModal({ open, imageUrl, fileType, onCancel, onConfirm, }) {
|
|
|
73683
73403
|
return (jsxs("button", { type: "button", onClick: () => setAspectKey(a.key), className: cn('flex cursor-pointer flex-col items-center justify-center gap-1 rounded-lg border px-3 py-3 text-xs transition-colors', selected
|
|
73684
73404
|
? 'border-primary bg-primary/10 text-primary'
|
|
73685
73405
|
: 'border-transparent bg-[#FAFAFA] text-foreground hover:bg-muted/50 dark:bg-[#262626]'), children: [a.icon, jsx("span", { children: a.label })] }, a.key));
|
|
73686
|
-
}) })] }), jsxs("div", { className: "bg-muted px-6 py-4", children: [jsx("div", { className: "flex max-h-[420px] items-center justify-center overflow-auto", children: jsx(S, { crop: crop, onChange: (c) => setCrop(c), onComplete: (c) => setCompletedCrop(c), aspect: aspect, keepSelection: true, children: jsx("img", { ref: imgRef, src: imageUrl, alt: "Crop preview", onLoad: handleImageLoad, className: "max-h-[400px]
|
|
73406
|
+
}) })] }), jsxs("div", { className: "bg-muted px-6 py-4", children: [jsx("div", { className: "flex max-h-[420px] items-center justify-center overflow-auto", children: jsx(S, { crop: crop, onChange: (c) => setCrop(c), onComplete: (c) => setCompletedCrop(c), aspect: aspect, keepSelection: true, className: "max-h-[400px]", children: jsx("img", { ref: imgRef, src: imageUrl, alt: "Crop preview", onLoad: handleImageLoad, className: "block h-auto max-h-[400px] w-auto" }) }) }), jsx("p", { className: "mt-3 text-center text-sm text-muted-foreground", children: "Drag the handles or click and drag on the image to redefine the crop area" })] })] }));
|
|
73687
73407
|
}
|
|
73688
73408
|
async function getCroppedBlob(img, crop, mime) {
|
|
73689
73409
|
const canvas = document.createElement('canvas');
|
|
@@ -76193,6 +75913,8 @@ function useRichTextareaEditor(value, onChange, disabled) {
|
|
|
76193
75913
|
content: value,
|
|
76194
75914
|
editable: !disabled,
|
|
76195
75915
|
onUpdate: ({ editor }) => {
|
|
75916
|
+
if (editor.isDestroyed)
|
|
75917
|
+
return;
|
|
76196
75918
|
onChange?.(editor.getHTML());
|
|
76197
75919
|
},
|
|
76198
75920
|
editorProps: {
|
|
@@ -76202,7 +75924,12 @@ function useRichTextareaEditor(value, onChange, disabled) {
|
|
|
76202
75924
|
},
|
|
76203
75925
|
});
|
|
76204
75926
|
useEffect(() => {
|
|
76205
|
-
|
|
75927
|
+
// `editor.getHTML()` reads `editor.schema`, which TipTap sets to null when
|
|
75928
|
+
// the editor is destroyed. React StrictMode (dev) and editor re-creation
|
|
75929
|
+
// can run this effect against a destroyed editor, so guard before calling
|
|
75930
|
+
// any schema-dependent method — otherwise DOMSerializer.fromSchema(null)
|
|
75931
|
+
// throws "Cannot read properties of null (reading 'cached')".
|
|
75932
|
+
if (editor && !editor.isDestroyed && value !== editor.getHTML()) {
|
|
76206
75933
|
editor.commands.setContent(value);
|
|
76207
75934
|
}
|
|
76208
75935
|
}, [value, editor]);
|