@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.
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/ConfirmDialog/ConfirmDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwE/C,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
1
+ {"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/ConfirmDialog/ConfirmDialog.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAa1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,QAAA,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAoE/C,CAAC;AAEF,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import type { Dispatch, ReactNode, SetStateAction } from 'react';
2
+ import type { LucideIcon } from 'lucide-react';
2
3
  export interface ConfirmDialogInfo {
3
4
  invoiceNumber?: string;
4
5
  invoiceDate?: string;
@@ -18,6 +19,8 @@ export interface ConfirmDialogProps {
18
19
  confirmLabel?: string;
19
20
  cancelLabel?: string;
20
21
  confirmVariant?: 'default' | 'destructive' | 'secondary' | 'outline';
22
+ /** Icon shown in the header badge and confirm button. Defaults to `Trash2`. Only rendered for the `destructive` variant. */
23
+ icon?: LucideIcon;
21
24
  disabled?: boolean;
22
25
  /** Receives `refundToWallet` when applicable (the Cancel Invoice flow). */
23
26
  onConfirm: (refundToWallet?: boolean) => Promise<void> | void;
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmDialog.types.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/ConfirmDialog/ConfirmDialog.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEjE,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC;IACrE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,SAAS,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CACtD"}
1
+ {"version":3,"file":"ConfirmDialog.types.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/ConfirmDialog/ConfirmDialog.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACrC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,SAAS,GAAG,aAAa,GAAG,WAAW,GAAG,SAAS,CAAC;IACrE,4HAA4H;IAC5H,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,2EAA2E;IAC3E,SAAS,EAAE,CAAC,cAAc,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IAC9D,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,uBAAuB;IACtC,cAAc,EAAE,OAAO,CAAC;IACxB,iBAAiB,EAAE,QAAQ,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;CACtD"}
@@ -1 +1 @@
1
- {"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/DateInput/DateInput.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,4CAA4C,CAAC;AACpD,OAAO,yBAAyB,CAAC;AAEjC,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,SAAS,EACT,GAAG,EACH,GAAG,EACH,QAAQ,EACR,WAA2B,GAC5B,EAAE,cAAc,2CAuGhB"}
1
+ {"version":3,"file":"DateInput.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/DateInput/DateInput.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,4CAA4C,CAAC;AACpD,OAAO,yBAAyB,CAAC;AAEjC,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,SAAS,EACT,GAAG,EACH,GAAG,EACH,QAAQ,EACR,WAA2B,GAC5B,EAAE,cAAc,2CA+GhB"}
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextArea.hooks.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/RichTextArea/RichTextArea.hooks.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,EAC/C,QAAQ,EAAE,OAAO,GAChB,MAAM,GAAG,IAAI,CAsBf"}
1
+ {"version":3,"file":"RichTextArea.hooks.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/RichTextArea/RichTextArea.hooks.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvD,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,SAAS,EAC/C,QAAQ,EAAE,OAAO,GAChB,MAAM,GAAG,IAAI,CA4Bf"}
@@ -1,4 +1,4 @@
1
- export declare const EDITOR_EXTENSIONS: (import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-underline").UnderlineOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-text-style").TextStyleOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-text-style").ColorOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any>)[];
1
+ export declare const EDITOR_EXTENSIONS: (import("@tiptap/core").Extension<import("@tiptap/starter-kit").StarterKitOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-text-style").TextStyleOptions, any> | import("@tiptap/core").Extension<import("@tiptap/extension-text-style").ColorOptions, any> | import("@tiptap/core").Mark<import("@tiptap/extension-highlight").HighlightOptions, any>)[];
2
2
  export declare const HIGHLIGHT_COLORS: {
3
3
  value: string;
4
4
  label: string;
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextArea.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/RichTextArea/RichTextArea.utils.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,iBAAiB,2cAe7B,CAAC;AAIF,eAAO,MAAM,gBAAgB;;;GAM5B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,UAAU,OAAO,KAAG,MAIhD,CAAC;AAEJ,eAAO,MAAM,uBAAuB,QAAO,MAkBxC,CAAC"}
1
+ {"version":3,"file":"RichTextArea.utils.d.ts","sourceRoot":"","sources":["../../../../src/components/molecules/RichTextArea/RichTextArea.utils.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,iBAAiB,gXAc7B,CAAC;AAIF,eAAO,MAAM,gBAAgB;;;GAM5B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,UAAU,OAAO,KAAG,MAIhD,CAAC;AAEJ,eAAO,MAAM,uBAAuB,QAAO,MAkBxC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"ImageCropModal.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/FileUploader/ImageCropModal.tsx"],"names":[],"mappings":"AAOA,OAAO,qCAAqC,CAAC;AAkD7C,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,CAAC,WAAW,EAAE,IAAI,KAAK,IAAI,CAAC;CACxC;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,EAAE,mBAAmB,2CAuJrB"}
1
+ {"version":3,"file":"ImageCropModal.d.ts","sourceRoot":"","sources":["../../../../src/components/organisms/FileUploader/ImageCropModal.tsx"],"names":[],"mappings":"AAOA,OAAO,qCAAqC,CAAC;AAkD7C,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,SAAS,EAAE,CAAC,WAAW,EAAE,IAAI,KAAK,IAAI,CAAC;CACxC;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,SAAS,GACV,EAAE,mBAAmB,2CAwJrB"}
package/dist/index.cjs.js CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  var jsxRuntime = require('react/jsx-runtime');
4
4
  var React = require('react');
5
+ var sonner = require('sonner');
5
6
  var ReactDOM = require('react-dom');
6
7
  var reactRouterDom = require('react-router-dom');
7
8
 
@@ -3956,301 +3957,6 @@ const renderBadge = (text, type = BadgeType.SECONDARY, options) => {
3956
3957
  return (jsxRuntime.jsxs(Badge$1, { className: `text-xs flex items-center gap-1 ${className}`, children: [options?.showIcon && IconToRender && (jsxRuntime.jsx(IconToRender, { className: "w-3 h-3" })), text] }));
3957
3958
  };
3958
3959
 
3959
- function __insertCSS(code) {
3960
- if (typeof document == 'undefined') return
3961
- let head = document.head || document.getElementsByTagName('head')[0];
3962
- let style = document.createElement('style');
3963
- style.type = 'text/css';
3964
- head.appendChild(style)
3965
- ;style.styleSheet ? (style.styleSheet.cssText = code) : style.appendChild(document.createTextNode(code));
3966
- }
3967
- Array(12).fill(0);
3968
-
3969
- let toastsCounter = 1;
3970
- class Observer {
3971
- constructor(){
3972
- // We use arrow functions to maintain the correct `this` reference
3973
- this.subscribe = (subscriber)=>{
3974
- this.subscribers.push(subscriber);
3975
- return ()=>{
3976
- const index = this.subscribers.indexOf(subscriber);
3977
- this.subscribers.splice(index, 1);
3978
- };
3979
- };
3980
- this.publish = (data)=>{
3981
- this.subscribers.forEach((subscriber)=>subscriber(data));
3982
- };
3983
- this.addToast = (data)=>{
3984
- this.publish(data);
3985
- this.toasts = [
3986
- ...this.toasts,
3987
- data
3988
- ];
3989
- };
3990
- this.create = (data)=>{
3991
- var _data_id;
3992
- const { message, ...rest } = data;
3993
- const id = typeof (data == null ? void 0 : data.id) === 'number' || ((_data_id = data.id) == null ? void 0 : _data_id.length) > 0 ? data.id : toastsCounter++;
3994
- const alreadyExists = this.toasts.find((toast)=>{
3995
- return toast.id === id;
3996
- });
3997
- const dismissible = data.dismissible === undefined ? true : data.dismissible;
3998
- if (this.dismissedToasts.has(id)) {
3999
- this.dismissedToasts.delete(id);
4000
- }
4001
- if (alreadyExists) {
4002
- this.toasts = this.toasts.map((toast)=>{
4003
- if (toast.id === id) {
4004
- this.publish({
4005
- ...toast,
4006
- ...data,
4007
- id,
4008
- title: message
4009
- });
4010
- return {
4011
- ...toast,
4012
- ...data,
4013
- id,
4014
- dismissible,
4015
- title: message
4016
- };
4017
- }
4018
- return toast;
4019
- });
4020
- } else {
4021
- this.addToast({
4022
- title: message,
4023
- ...rest,
4024
- dismissible,
4025
- id
4026
- });
4027
- }
4028
- return id;
4029
- };
4030
- this.dismiss = (id)=>{
4031
- if (id) {
4032
- this.dismissedToasts.add(id);
4033
- requestAnimationFrame(()=>this.subscribers.forEach((subscriber)=>subscriber({
4034
- id,
4035
- dismiss: true
4036
- })));
4037
- } else {
4038
- this.toasts.forEach((toast)=>{
4039
- this.subscribers.forEach((subscriber)=>subscriber({
4040
- id: toast.id,
4041
- dismiss: true
4042
- }));
4043
- });
4044
- }
4045
- return id;
4046
- };
4047
- this.message = (message, data)=>{
4048
- return this.create({
4049
- ...data,
4050
- message
4051
- });
4052
- };
4053
- this.error = (message, data)=>{
4054
- return this.create({
4055
- ...data,
4056
- message,
4057
- type: 'error'
4058
- });
4059
- };
4060
- this.success = (message, data)=>{
4061
- return this.create({
4062
- ...data,
4063
- type: 'success',
4064
- message
4065
- });
4066
- };
4067
- this.info = (message, data)=>{
4068
- return this.create({
4069
- ...data,
4070
- type: 'info',
4071
- message
4072
- });
4073
- };
4074
- this.warning = (message, data)=>{
4075
- return this.create({
4076
- ...data,
4077
- type: 'warning',
4078
- message
4079
- });
4080
- };
4081
- this.loading = (message, data)=>{
4082
- return this.create({
4083
- ...data,
4084
- type: 'loading',
4085
- message
4086
- });
4087
- };
4088
- this.promise = (promise, data)=>{
4089
- if (!data) {
4090
- // Nothing to show
4091
- return;
4092
- }
4093
- let id = undefined;
4094
- if (data.loading !== undefined) {
4095
- id = this.create({
4096
- ...data,
4097
- promise,
4098
- type: 'loading',
4099
- message: data.loading,
4100
- description: typeof data.description !== 'function' ? data.description : undefined
4101
- });
4102
- }
4103
- const p = Promise.resolve(promise instanceof Function ? promise() : promise);
4104
- let shouldDismiss = id !== undefined;
4105
- let result;
4106
- const originalPromise = p.then(async (response)=>{
4107
- result = [
4108
- 'resolve',
4109
- response
4110
- ];
4111
- const isReactElementResponse = React.isValidElement(response);
4112
- if (isReactElementResponse) {
4113
- shouldDismiss = false;
4114
- this.create({
4115
- id,
4116
- type: 'default',
4117
- message: response
4118
- });
4119
- } else if (isHttpResponse(response) && !response.ok) {
4120
- shouldDismiss = false;
4121
- const promiseData = typeof data.error === 'function' ? await data.error(`HTTP error! status: ${response.status}`) : data.error;
4122
- const description = typeof data.description === 'function' ? await data.description(`HTTP error! status: ${response.status}`) : data.description;
4123
- const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);
4124
- const toastSettings = isExtendedResult ? promiseData : {
4125
- message: promiseData
4126
- };
4127
- this.create({
4128
- id,
4129
- type: 'error',
4130
- description,
4131
- ...toastSettings
4132
- });
4133
- } else if (response instanceof Error) {
4134
- shouldDismiss = false;
4135
- const promiseData = typeof data.error === 'function' ? await data.error(response) : data.error;
4136
- const description = typeof data.description === 'function' ? await data.description(response) : data.description;
4137
- const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);
4138
- const toastSettings = isExtendedResult ? promiseData : {
4139
- message: promiseData
4140
- };
4141
- this.create({
4142
- id,
4143
- type: 'error',
4144
- description,
4145
- ...toastSettings
4146
- });
4147
- } else if (data.success !== undefined) {
4148
- shouldDismiss = false;
4149
- const promiseData = typeof data.success === 'function' ? await data.success(response) : data.success;
4150
- const description = typeof data.description === 'function' ? await data.description(response) : data.description;
4151
- const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);
4152
- const toastSettings = isExtendedResult ? promiseData : {
4153
- message: promiseData
4154
- };
4155
- this.create({
4156
- id,
4157
- type: 'success',
4158
- description,
4159
- ...toastSettings
4160
- });
4161
- }
4162
- }).catch(async (error)=>{
4163
- result = [
4164
- 'reject',
4165
- error
4166
- ];
4167
- if (data.error !== undefined) {
4168
- shouldDismiss = false;
4169
- const promiseData = typeof data.error === 'function' ? await data.error(error) : data.error;
4170
- const description = typeof data.description === 'function' ? await data.description(error) : data.description;
4171
- const isExtendedResult = typeof promiseData === 'object' && !React.isValidElement(promiseData);
4172
- const toastSettings = isExtendedResult ? promiseData : {
4173
- message: promiseData
4174
- };
4175
- this.create({
4176
- id,
4177
- type: 'error',
4178
- description,
4179
- ...toastSettings
4180
- });
4181
- }
4182
- }).finally(()=>{
4183
- if (shouldDismiss) {
4184
- // Toast is still in load state (and will be indefinitely — dismiss it)
4185
- this.dismiss(id);
4186
- id = undefined;
4187
- }
4188
- data.finally == null ? void 0 : data.finally.call(data);
4189
- });
4190
- const unwrap = ()=>new Promise((resolve, reject)=>originalPromise.then(()=>result[0] === 'reject' ? reject(result[1]) : resolve(result[1])).catch(reject));
4191
- if (typeof id !== 'string' && typeof id !== 'number') {
4192
- // cannot Object.assign on undefined
4193
- return {
4194
- unwrap
4195
- };
4196
- } else {
4197
- return Object.assign(id, {
4198
- unwrap
4199
- });
4200
- }
4201
- };
4202
- this.custom = (jsx, data)=>{
4203
- const id = (data == null ? void 0 : data.id) || toastsCounter++;
4204
- this.create({
4205
- jsx: jsx(id),
4206
- id,
4207
- ...data
4208
- });
4209
- return id;
4210
- };
4211
- this.getActiveToasts = ()=>{
4212
- return this.toasts.filter((toast)=>!this.dismissedToasts.has(toast.id));
4213
- };
4214
- this.subscribers = [];
4215
- this.toasts = [];
4216
- this.dismissedToasts = new Set();
4217
- }
4218
- }
4219
- const ToastState = new Observer();
4220
- // bind this to the toast function
4221
- const toastFunction = (message, data)=>{
4222
- const id = (data == null ? void 0 : data.id) || toastsCounter++;
4223
- ToastState.addToast({
4224
- title: message,
4225
- ...data,
4226
- id
4227
- });
4228
- return id;
4229
- };
4230
- const isHttpResponse = (data)=>{
4231
- return data && typeof data === 'object' && 'ok' in data && typeof data.ok === 'boolean' && 'status' in data && typeof data.status === 'number';
4232
- };
4233
- const basicToast = toastFunction;
4234
- const getHistory = ()=>ToastState.toasts;
4235
- const getToasts = ()=>ToastState.getActiveToasts();
4236
- // We use `Object.assign` to maintain the correct types as we would lose them otherwise
4237
- const toast = Object.assign(basicToast, {
4238
- success: ToastState.success,
4239
- info: ToastState.info,
4240
- warning: ToastState.warning,
4241
- error: ToastState.error,
4242
- custom: ToastState.custom,
4243
- message: ToastState.message,
4244
- promise: ToastState.promise,
4245
- dismiss: ToastState.dismiss,
4246
- loading: ToastState.loading
4247
- }, {
4248
- getHistory,
4249
- getToasts
4250
- });
4251
-
4252
- __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%)}");
4253
-
4254
3960
  function AlertTitle({ className, ...props }) {
4255
3961
  return (jsxRuntime.jsx("div", { "data-slot": "alert-title", className: cn('col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight', className), ...props }));
4256
3962
  }
@@ -4621,20 +4327,20 @@ function renderActionSlot(id, action, cancel) {
4621
4327
  return undefined;
4622
4328
  return (jsxRuntime.jsxs("div", { className: "flex shrink-0 items-center gap-1.5 self-center", children: [cancel ? (isDescriptor(cancel) ? (jsxRuntime.jsx(Button$1, { type: "button", size: "xs", variant: "outline", className: "h-7 bg-white text-xs px-3 font-medium", onClick: (e) => {
4623
4329
  cancel.onClick(e);
4624
- toast.dismiss(id);
4330
+ sonner.toast.dismiss(id);
4625
4331
  }, children: cancel.label })) : (cancel)) : null, action ? (isDescriptor(action) ? (jsxRuntime.jsx(Button$1, { type: "button", size: "xs", className: "h-7 text-xs px-3 font-medium", onClick: (e) => {
4626
4332
  action.onClick(e);
4627
- toast.dismiss(id);
4333
+ sonner.toast.dismiss(id);
4628
4334
  }, children: action.label })) : (action)) : null] }));
4629
4335
  }
4630
4336
  function emit(kind, title, options) {
4631
4337
  const { description, action, cancel, ...rest } = options ?? {};
4632
4338
  const hasActions = !!action || !!cancel;
4633
- return toast.custom((id) => {
4339
+ return sonner.toast.custom((id) => {
4634
4340
  // When the toast carries action buttons, drop them below the message as
4635
4341
  // their own row instead of crowding the right side next to the X.
4636
4342
  const renderedDescription = hasActions ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [description ?? null, jsxRuntime.jsx("div", { className: "mt-2 flex items-center justify-end gap-1.5", children: renderActionSlot(id, action, cancel) })] })) : ((description ?? (typeof title === 'string' ? undefined : title)));
4637
- return (jsxRuntime.jsx(Alert, { variant: VARIANT_BY_KIND[kind], appearance: "outline", title: typeof title === 'string' ? title : undefined, description: renderedDescription, onDismiss: () => toast.dismiss(id), className: 'gap-3 bg-card py-3 shadow-[0_10px_15px_-3px_rgba(0,0,0,0.10),0_4px_6px_-4px_rgba(0,0,0,0.10)] ' +
4343
+ return (jsxRuntime.jsx(Alert, { variant: VARIANT_BY_KIND[kind], appearance: "outline", title: typeof title === 'string' ? title : undefined, description: renderedDescription, onDismiss: () => sonner.toast.dismiss(id), className: 'gap-3 bg-card py-3 shadow-[0_10px_15px_-3px_rgba(0,0,0,0.10),0_4px_6px_-4px_rgba(0,0,0,0.10)] ' +
4638
4344
  (hasActions ? 'items-start' : 'items-center') +
4639
4345
  ' [&_[data-slot=alert-title]]:!col-auto [&_[data-slot=alert-description]]:!col-auto [&_[data-slot=alert-description]]:!block [&_[data-slot=alert-dismiss]]:self-start' }));
4640
4346
  }, rest);
@@ -4647,13 +4353,13 @@ const notify = {
4647
4353
  warning: (title, options) => emit('warning', title, options),
4648
4354
  error: (title, options) => emit('destructive', title, options),
4649
4355
  /** Dismiss one toast by id, or all if no id is supplied. */
4650
- dismiss: (id) => toast.dismiss(id),
4356
+ dismiss: (id) => sonner.toast.dismiss(id),
4651
4357
  /**
4652
4358
  * Promise helper — same call signature as sonner's `toast.promise`.
4653
4359
  * Return is widened to `unknown` so the emitted `.d.ts` doesn't reference
4654
4360
  * sonner's non-exported internal result type (TS4023).
4655
4361
  */
4656
- promise: toast.promise.bind(toast),
4362
+ promise: sonner.toast.promise.bind(sonner.toast),
4657
4363
  };
4658
4364
 
4659
4365
  const ActionButtonWithTooltip = ({ icon, tooltip, onClick, disabled = false, colorClass = 'h-5 w-5 p-0 bg-muted text-muted-foreground hover:bg-muted/80 transition-colors rounded-md', }) => {
@@ -12870,7 +12576,7 @@ var Popover$1 = (props) => {
12870
12576
  };
12871
12577
  Popover$1.displayName = POPOVER_NAME;
12872
12578
  var ANCHOR_NAME$2 = "PopoverAnchor";
12873
- var PopoverAnchor = React__namespace.forwardRef(
12579
+ var PopoverAnchor$1 = React__namespace.forwardRef(
12874
12580
  (props, forwardedRef) => {
12875
12581
  const { __scopePopover, ...anchorProps } = props;
12876
12582
  const context = usePopoverContext(ANCHOR_NAME$2, __scopePopover);
@@ -12883,7 +12589,7 @@ var PopoverAnchor = React__namespace.forwardRef(
12883
12589
  return /* @__PURE__ */ jsxRuntime.jsx(Anchor$1, { ...popperScope, ...anchorProps, ref: forwardedRef });
12884
12590
  }
12885
12591
  );
12886
- PopoverAnchor.displayName = ANCHOR_NAME$2;
12592
+ PopoverAnchor$1.displayName = ANCHOR_NAME$2;
12887
12593
  var TRIGGER_NAME$5 = "PopoverTrigger";
12888
12594
  var PopoverTrigger$1 = React__namespace.forwardRef(
12889
12595
  (props, forwardedRef) => {
@@ -13103,6 +12809,7 @@ function getState$2(open) {
13103
12809
  return open ? "open" : "closed";
13104
12810
  }
13105
12811
  var Root2$3 = Popover$1;
12812
+ var Anchor2$1 = PopoverAnchor$1;
13106
12813
  var Trigger$4 = PopoverTrigger$1;
13107
12814
  var Portal$4 = PopoverPortal;
13108
12815
  var Content2$4 = PopoverContent$1;
@@ -13116,6 +12823,9 @@ function PopoverTrigger({ ...props }) {
13116
12823
  function PopoverContent({ className, align = 'center', sideOffset = 8, ...props }) {
13117
12824
  return (jsxRuntime.jsx(Portal$4, { children: jsxRuntime.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 }) }));
13118
12825
  }
12826
+ function PopoverAnchor({ ...props }) {
12827
+ return jsxRuntime.jsx(Anchor2$1, { "data-slot": "popover-anchor", ...props });
12828
+ }
13119
12829
 
13120
12830
  const SCROLL_THRESHOLD = 50;
13121
12831
  function useSearchableSelect({ selectedItem, onChange, getOptionKey, getOptionLabel, getOptionSubLabel, fetchPage, staticOptions, filterFn, preSelectedId, resolveById, pageSize, debounceMs, }) {
@@ -21244,14 +20954,14 @@ function useRefundToWallet(open) {
21244
20954
  return { refundToWallet, setRefundToWallet };
21245
20955
  }
21246
20956
 
21247
- const ConfirmDialog = ({ open, onOpenChange, title, description, info, confirmLabel = 'Yes', cancelLabel = 'Cancel', confirmVariant = 'default', disabled = false, onConfirm, onCancel, }) => {
20957
+ const ConfirmDialog = ({ open, onOpenChange, title, description, info, confirmLabel = 'Yes', cancelLabel = 'Cancel', confirmVariant = 'default', icon: Icon = Trash2, disabled = false, onConfirm, onCancel, }) => {
21248
20958
  const { refundToWallet, setRefundToWallet } = useRefundToWallet(open);
21249
- return (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: jsxRuntime.jsxs(DialogContent, { children: [jsxRuntime.jsxs(DialogHeader, { children: [jsxRuntime.jsxs(DialogTitle, { className: "flex items-center gap-2", children: [confirmVariant === 'destructive' && (jsxRuntime.jsx("span", { className: "inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-destructive/10", children: jsxRuntime.jsx(Trash2, { className: "h-4 w-4 text-destructive" }) })), jsxRuntime.jsx("span", { children: title })] }), description && (jsxRuntime.jsx(DialogDescription, { className: "mt-2", children: description })), info && (jsxRuntime.jsx(InfoCard, { info: info, title: title, refundToWallet: refundToWallet, onRefundChange: setRefundToWallet }))] }), jsxRuntime.jsxs(DialogFooter, { className: "mt-4", children: [jsxRuntime.jsx(Button$1, { variant: "outline", onClick: () => {
20959
+ return (jsxRuntime.jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: jsxRuntime.jsxs(DialogContent, { className: "gap-3 p-5", children: [jsxRuntime.jsxs(DialogHeader, { className: "gap-1.5", children: [jsxRuntime.jsxs(DialogTitle, { className: "flex items-center gap-2", children: [confirmVariant === 'destructive' && (jsxRuntime.jsx("span", { className: "inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-destructive/10", children: jsxRuntime.jsx(Icon, { className: "h-3.5 w-3.5 text-destructive" }) })), jsxRuntime.jsx("span", { children: title })] }), description && jsxRuntime.jsx(DialogDescription, { children: description }), info && (jsxRuntime.jsx(InfoCard, { info: info, title: title, refundToWallet: refundToWallet, onRefundChange: setRefundToWallet }))] }), jsxRuntime.jsxs(DialogFooter, { className: "mt-1", children: [jsxRuntime.jsx(Button$1, { variant: "outline", onClick: () => {
21250
20960
  onCancel?.();
21251
20961
  onOpenChange(false);
21252
20962
  }, disabled: disabled, children: cancelLabel }), jsxRuntime.jsxs(Button$1, { variant: confirmVariant, onClick: async () => {
21253
20963
  await onConfirm(title === 'Cancel Invoice' ? refundToWallet : undefined);
21254
- }, disabled: disabled, className: "ml-3", children: [confirmVariant === 'destructive' && (jsxRuntime.jsx(Trash2, { className: "mr-1.5 h-4 w-4", "aria-hidden": true })), disabled ? 'Please wait...' : confirmLabel] })] })] }) }));
20964
+ }, disabled: disabled, children: [confirmVariant === 'destructive' && (jsxRuntime.jsx(Icon, { className: "h-4 w-4", "aria-hidden": true })), disabled ? 'Please wait...' : confirmLabel] })] })] }) }));
21255
20965
  };
21256
20966
 
21257
20967
  /** Class builder for a segment button in the `segmented` variant. */
@@ -35041,11 +34751,18 @@ function DatePickerHeader({ monthDate, changeYear, changeMonth, decreaseMonth, i
35041
34751
  function DateInput({ value, onChange, onBlur, name, className, min, max, disabled, placeholder = 'Select date', }) {
35042
34752
  const [open, setOpen] = React.useState(false);
35043
34753
  const { minDate, maxDate, minYear, maxYear } = computeDateBounds(min, max);
35044
- const openPicker = () => {
35045
- if (!disabled)
35046
- setOpen(true);
35047
- };
35048
- return (jsxRuntime.jsxs(Popover, { open: open, onOpenChange: setOpen, children: [jsxRuntime.jsx(PopoverTrigger, { asChild: true, children: jsxRuntime.jsxs("button", { type: "button", name: name, onBlur: onBlur, onClick: openPicker, disabled: disabled, "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: [jsxRuntime.jsx("span", { className: cn('truncate text-sm md:text-sm', value ? 'text-foreground' : 'text-placeholder'), children: value ? moment(value).format('DD/MM/YYYY') : placeholder }), jsxRuntime.jsx("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground", children: jsxRuntime.jsx(CalendarDays, { className: "h-4 w-4 stroke-[1.75]" }) })] }) }), jsxRuntime.jsx(PopoverContent, { align: "start", className: "date-range-picker-popover w-auto p-4", children: jsxRuntime.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) => {
34754
+ // NOTE: We drive `open` ourselves from the button's onClick instead of using
34755
+ // Radix's <PopoverTrigger> toggle. When this Popover is nested inside the
34756
+ // modal <SlideOut> (Radix Dialog), the trigger's built-in toggle does not
34757
+ // fire in Safari, so the calendar never opened. Using <PopoverAnchor> (pure
34758
+ // positioning, no event handlers) + a single controlled toggle is the one
34759
+ // source of truth — no double-fire, and it works across browsers. `modal`
34760
+ // lets the open popover own pointer events above the dialog so the calendar
34761
+ // (portalled to <body>) stays clickable.
34762
+ return (jsxRuntime.jsxs(Popover, { open: open, onOpenChange: setOpen, modal: true, children: [jsxRuntime.jsx(PopoverAnchor, { asChild: true, children: jsxRuntime.jsxs("button", { type: "button", name: name, onBlur: onBlur, disabled: disabled, "aria-haspopup": "dialog", "aria-expanded": open, onClick: () => {
34763
+ if (!disabled)
34764
+ setOpen((prev) => !prev);
34765
+ }, "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: [jsxRuntime.jsx("span", { className: cn('truncate text-sm md:text-sm', value ? 'text-foreground' : 'text-placeholder'), children: value ? moment(value).format('DD/MM/YYYY') : placeholder }), jsxRuntime.jsx("span", { className: "inline-flex h-4 w-4 shrink-0 items-center justify-center text-muted-foreground", children: jsxRuntime.jsx(CalendarDays, { className: "h-4 w-4 stroke-[1.75]" }) })] }) }), jsxRuntime.jsx(PopoverContent, { align: "start", className: "date-range-picker-popover w-auto p-4", children: jsxRuntime.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) => {
35049
34766
  onChange(date ?? undefined);
35050
34767
  if (date)
35051
34768
  setOpen(false);
@@ -65194,6 +64911,10 @@ var Highlight = Mark.create({
65194
64911
  }
65195
64912
  });
65196
64913
 
64914
+ // StarterKit v3 already bundles the Underline mark. Re-registering the
64915
+ // standalone @tiptap/extension-underline duplicates the mark, which corrupts
64916
+ // the ProseMirror schema and makes editor.getHTML() throw
64917
+ // ("Cannot read properties of null (reading 'cached')").
65197
64918
  const EDITOR_EXTENSIONS = [
65198
64919
  index_default.configure({
65199
64920
  paragraph: {
@@ -65205,7 +64926,6 @@ const EDITOR_EXTENSIONS = [
65205
64926
  levels: [1, 2, 3],
65206
64927
  },
65207
64928
  }),
65208
- Underline,
65209
64929
  TextStyle,
65210
64930
  Color,
65211
64931
  Highlight.configure({ multicolor: true }),
@@ -73703,7 +73423,7 @@ function ImageCropModal({ open, imageUrl, fileType, onCancel, onConfirm, }) {
73703
73423
  return (jsxRuntime.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
73704
73424
  ? 'border-primary bg-primary/10 text-primary'
73705
73425
  : 'border-transparent bg-[#FAFAFA] text-foreground hover:bg-muted/50 dark:bg-[#262626]'), children: [a.icon, jsxRuntime.jsx("span", { children: a.label })] }, a.key));
73706
- }) })] }), jsxRuntime.jsxs("div", { className: "bg-muted px-6 py-4", children: [jsxRuntime.jsx("div", { className: "flex max-h-[420px] items-center justify-center overflow-auto", children: jsxRuntime.jsx(S, { crop: crop, onChange: (c) => setCrop(c), onComplete: (c) => setCompletedCrop(c), aspect: aspect, keepSelection: true, children: jsxRuntime.jsx("img", { ref: imgRef, src: imageUrl, alt: "Crop preview", onLoad: handleImageLoad, className: "max-h-[400px] object-contain" }) }) }), jsxRuntime.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" })] })] }));
73426
+ }) })] }), jsxRuntime.jsxs("div", { className: "bg-muted px-6 py-4", children: [jsxRuntime.jsx("div", { className: "flex max-h-[420px] items-center justify-center overflow-auto", children: jsxRuntime.jsx(S, { crop: crop, onChange: (c) => setCrop(c), onComplete: (c) => setCompletedCrop(c), aspect: aspect, keepSelection: true, className: "max-h-[400px]", children: jsxRuntime.jsx("img", { ref: imgRef, src: imageUrl, alt: "Crop preview", onLoad: handleImageLoad, className: "block h-auto max-h-[400px] w-auto" }) }) }), jsxRuntime.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" })] })] }));
73707
73427
  }
73708
73428
  async function getCroppedBlob(img, crop, mime) {
73709
73429
  const canvas = document.createElement('canvas');
@@ -76213,6 +75933,8 @@ function useRichTextareaEditor(value, onChange, disabled) {
76213
75933
  content: value,
76214
75934
  editable: !disabled,
76215
75935
  onUpdate: ({ editor }) => {
75936
+ if (editor.isDestroyed)
75937
+ return;
76216
75938
  onChange?.(editor.getHTML());
76217
75939
  },
76218
75940
  editorProps: {
@@ -76222,7 +75944,12 @@ function useRichTextareaEditor(value, onChange, disabled) {
76222
75944
  },
76223
75945
  });
76224
75946
  React.useEffect(() => {
76225
- if (editor && value !== editor.getHTML()) {
75947
+ // `editor.getHTML()` reads `editor.schema`, which TipTap sets to null when
75948
+ // the editor is destroyed. React StrictMode (dev) and editor re-creation
75949
+ // can run this effect against a destroyed editor, so guard before calling
75950
+ // any schema-dependent method — otherwise DOMSerializer.fromSchema(null)
75951
+ // throws "Cannot read properties of null (reading 'cached')".
75952
+ if (editor && !editor.isDestroyed && value !== editor.getHTML()) {
76226
75953
  editor.commands.setContent(value);
76227
75954
  }
76228
75955
  }, [value, editor]);