@vlrc-fe/components 3.0.4 → 3.0.5
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/CHANGELOG.md +12 -0
- package/dist/ConfirmModal.cjs +40 -48
- package/dist/ConfirmModal.d.ts +5 -21
- package/dist/ConfirmModal.d.ts.map +1 -1
- package/dist/ConfirmModal.js +41 -48
- package/dist/Modal.cjs +12 -16
- package/dist/Modal.d.ts +2 -14
- package/dist/Modal.d.ts.map +1 -1
- package/dist/Modal.js +12 -16
- package/dist/MultiSelect/MultiSelect.cjs +0 -1
- package/dist/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/MultiSelect/MultiSelect.js +0 -1
- package/dist/MultiSelect/useMultiSelect.cjs +1 -0
- package/dist/MultiSelect/useMultiSelect.d.ts.map +1 -1
- package/dist/MultiSelect/useMultiSelect.js +1 -0
- package/dist/MultiSelect/utils.cjs +2 -2
- package/dist/MultiSelect/utils.js +2 -2
- package/dist/Typography/Link.cjs +3 -5
- package/dist/Typography/Link.d.ts +1 -1
- package/dist/Typography/Link.d.ts.map +1 -1
- package/dist/Typography/Link.js +3 -5
- package/dist/Typography/Paragraph.cjs +3 -5
- package/dist/Typography/Paragraph.d.ts +1 -1
- package/dist/Typography/Paragraph.d.ts.map +1 -1
- package/dist/Typography/Paragraph.js +3 -5
- package/dist/Typography/Text.cjs +3 -4
- package/dist/Typography/Text.d.ts +1 -1
- package/dist/Typography/Text.d.ts.map +1 -1
- package/dist/Typography/Text.js +4 -5
- package/dist/Typography/Title.cjs +4 -4
- package/dist/Typography/Title.d.ts +1 -1
- package/dist/Typography/Title.d.ts.map +1 -1
- package/dist/Typography/Title.js +5 -5
- package/dist/Typography/Typography.d.ts +8 -4
- package/dist/Typography/Typography.d.ts.map +1 -1
- package/dist/Typography/index.d.ts +0 -3
- package/dist/Typography/index.d.ts.map +1 -1
- package/dist/Typography/index.js +1 -4
- package/dist/Typography/types.d.ts +4 -0
- package/dist/Typography/types.d.ts.map +1 -1
- package/dist/assets/stylex.css +32 -8
- package/dist/astryx.cjs +1 -10
- package/dist/astryx.d.ts +0 -1
- package/dist/astryx.d.ts.map +1 -1
- package/dist/astryx.js +0 -2
- package/dist/index.cjs +2 -12
- package/dist/index.d.ts +2 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -6
- package/dist/layout/Box.cjs +44 -67
- package/dist/layout/Box.d.ts +3 -5
- package/dist/layout/Box.d.ts.map +1 -1
- package/dist/layout/Box.js +44 -67
- package/dist/layout/Center.cjs +13 -24
- package/dist/layout/Center.d.ts +2 -2
- package/dist/layout/Center.d.ts.map +1 -1
- package/dist/layout/Center.js +13 -24
- package/dist/layout/Container.cjs +21 -10
- package/dist/layout/Container.d.ts +3 -5
- package/dist/layout/Container.d.ts.map +1 -1
- package/dist/layout/Container.js +21 -10
- package/dist/layout/Stack.cjs +55 -93
- package/dist/layout/Stack.d.ts +5 -5
- package/dist/layout/Stack.d.ts.map +1 -1
- package/dist/layout/Stack.js +55 -93
- package/dist/layout/index.d.ts +1 -1
- package/dist/layout/index.js +2 -2
- package/dist/lazyLoad.cjs +1 -1
- package/dist/lazyLoad.d.ts.map +1 -1
- package/dist/lazyLoad.js +1 -1
- package/dist/theme/index.cjs +1 -1
- package/dist/theme/index.js +1 -1
- package/dist/theme/zIndex.cjs +0 -2
- package/dist/theme/zIndex.d.ts +4 -4
- package/dist/theme/zIndex.d.ts.map +1 -1
- package/dist/theme.css +32 -8
- package/dist/ui/aspect-ratio.cjs +0 -1
- package/dist/ui/aspect-ratio.d.ts.map +1 -1
- package/dist/ui/aspect-ratio.js +0 -1
- package/dist/ui/avatar.cjs +0 -1
- package/dist/ui/avatar.d.ts.map +1 -1
- package/dist/ui/avatar.js +0 -1
- package/dist/ui/calendar.cjs +0 -1
- package/dist/ui/calendar.d.ts.map +1 -1
- package/dist/ui/calendar.js +0 -1
- package/dist/ui/carousel.cjs +0 -1
- package/dist/ui/carousel.d.ts.map +1 -1
- package/dist/ui/carousel.js +0 -1
- package/dist/ui/checkbox.cjs +4 -8
- package/dist/ui/checkbox.d.ts +1 -1
- package/dist/ui/checkbox.d.ts.map +1 -1
- package/dist/ui/checkbox.js +5 -9
- package/dist/ui/circular-progress.cjs +25 -20
- package/dist/ui/circular-progress.d.ts +3 -3
- package/dist/ui/circular-progress.d.ts.map +1 -1
- package/dist/ui/circular-progress.js +25 -20
- package/dist/ui/code-block.cjs +180 -176
- package/dist/ui/code-block.d.ts +17 -9
- package/dist/ui/code-block.d.ts.map +1 -1
- package/dist/ui/code-block.js +181 -177
- package/dist/ui/collapsible.cjs +0 -1
- package/dist/ui/collapsible.d.ts.map +1 -1
- package/dist/ui/collapsible.js +0 -1
- package/dist/ui/compare-slider.cjs +2 -3
- package/dist/ui/compare-slider.d.ts +3 -2
- package/dist/ui/compare-slider.d.ts.map +1 -1
- package/dist/ui/compare-slider.js +3 -4
- package/dist/ui/context-menu.cjs +0 -1
- package/dist/ui/context-menu.d.ts.map +1 -1
- package/dist/ui/context-menu.js +0 -1
- package/dist/ui/copy-button.cjs +2 -3
- package/dist/ui/copy-button.d.ts +1 -1
- package/dist/ui/copy-button.d.ts.map +1 -1
- package/dist/ui/copy-button.js +3 -4
- package/dist/ui/dialog.cjs +2 -0
- package/dist/ui/dialog.d.ts.map +1 -1
- package/dist/ui/dialog.js +2 -0
- package/dist/ui/drawer.cjs +2 -0
- package/dist/ui/drawer.d.ts.map +1 -1
- package/dist/ui/drawer.js +2 -0
- package/dist/ui/editable.cjs +1 -0
- package/dist/ui/editable.d.ts.map +1 -1
- package/dist/ui/editable.js +1 -0
- package/dist/ui/empty.cjs +37 -52
- package/dist/ui/empty.d.ts +5 -5
- package/dist/ui/empty.d.ts.map +1 -1
- package/dist/ui/empty.js +38 -53
- package/dist/ui/file-upload.cjs +0 -1
- package/dist/ui/file-upload.d.ts.map +1 -1
- package/dist/ui/file-upload.js +0 -1
- package/dist/ui/flex.cjs +3 -4
- package/dist/ui/flex.d.ts +3 -2
- package/dist/ui/flex.d.ts.map +1 -1
- package/dist/ui/flex.js +3 -4
- package/dist/ui/form.cjs +0 -1
- package/dist/ui/form.d.ts.map +1 -1
- package/dist/ui/form.js +0 -1
- package/dist/ui/gauge.cjs +2 -4
- package/dist/ui/gauge.d.ts +3 -2
- package/dist/ui/gauge.d.ts.map +1 -1
- package/dist/ui/gauge.js +2 -4
- package/dist/ui/grid.cjs +7 -7
- package/dist/ui/grid.d.ts +7 -3
- package/dist/ui/grid.d.ts.map +1 -1
- package/dist/ui/grid.js +7 -8
- package/dist/ui/hover-card.cjs +0 -1
- package/dist/ui/hover-card.d.ts.map +1 -1
- package/dist/ui/hover-card.js +0 -1
- package/dist/ui/input-group.cjs +17 -23
- package/dist/ui/input-group.d.ts +2 -2
- package/dist/ui/input-group.d.ts.map +1 -1
- package/dist/ui/input-group.js +17 -23
- package/dist/ui/marker.cjs +78 -75
- package/dist/ui/marker.d.ts +7 -4
- package/dist/ui/marker.d.ts.map +1 -1
- package/dist/ui/marker.js +79 -76
- package/dist/ui/masonry.cjs +2 -4
- package/dist/ui/masonry.d.ts +1 -1
- package/dist/ui/masonry.d.ts.map +1 -1
- package/dist/ui/masonry.js +3 -5
- package/dist/ui/menubar.cjs +0 -1
- package/dist/ui/menubar.d.ts.map +1 -1
- package/dist/ui/menubar.js +0 -1
- package/dist/ui/progress.cjs +6 -5
- package/dist/ui/progress.d.ts +3 -3
- package/dist/ui/progress.d.ts.map +1 -1
- package/dist/ui/progress.js +6 -5
- package/dist/ui/questionnaire.cjs +138 -135
- package/dist/ui/questionnaire.d.ts +21 -11
- package/dist/ui/questionnaire.d.ts.map +1 -1
- package/dist/ui/questionnaire.js +139 -136
- package/dist/ui/rating.cjs +2 -3
- package/dist/ui/rating.d.ts +3 -2
- package/dist/ui/rating.d.ts.map +1 -1
- package/dist/ui/rating.js +3 -4
- package/dist/ui/resizable.cjs +0 -1
- package/dist/ui/resizable.d.ts.map +1 -1
- package/dist/ui/resizable.js +0 -1
- package/dist/ui/row-col.cjs +4 -6
- package/dist/ui/row-col.d.ts +6 -4
- package/dist/ui/row-col.d.ts.map +1 -1
- package/dist/ui/row-col.js +5 -7
- package/dist/ui/scroll-area.cjs +40 -53
- package/dist/ui/scroll-area.d.ts +1 -1
- package/dist/ui/scroll-area.d.ts.map +1 -1
- package/dist/ui/scroll-area.js +40 -53
- package/dist/ui/segmented.cjs +2 -3
- package/dist/ui/segmented.d.ts +3 -2
- package/dist/ui/segmented.d.ts.map +1 -1
- package/dist/ui/segmented.js +3 -4
- package/dist/ui/sheet.cjs +2 -0
- package/dist/ui/sheet.d.ts.map +1 -1
- package/dist/ui/sheet.js +2 -0
- package/dist/ui/sidebar.cjs +0 -1
- package/dist/ui/sidebar.d.ts.map +1 -1
- package/dist/ui/sidebar.js +0 -1
- package/dist/ui/signature-pad.cjs +148 -147
- package/dist/ui/signature-pad.d.ts +17 -9
- package/dist/ui/signature-pad.d.ts.map +1 -1
- package/dist/ui/signature-pad.js +149 -148
- package/dist/ui/stat.cjs +57 -71
- package/dist/ui/stat.d.ts +8 -8
- package/dist/ui/stat.d.ts.map +1 -1
- package/dist/ui/stat.js +57 -71
- package/dist/ui/switch.cjs +4 -8
- package/dist/ui/switch.d.ts +1 -1
- package/dist/ui/switch.d.ts.map +1 -1
- package/dist/ui/switch.js +5 -9
- package/dist/utils.cjs +1 -6
- package/dist/utils.d.ts +2 -12
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [3.0.5] - 2026-11-20
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- **Modern Web Guidance & Baseline 2026 Enhancements**:
|
|
8
|
+
- Enhanced all UI primitives and composite components to meet the Modern Web Baseline 2026 standard.
|
|
9
|
+
- Eliminated redundant `forwardRef` wrappers and legacy workarounds in favor of React 19 standard ref-as-prop pattern.
|
|
10
|
+
- Refined Typography (`Text`, `Title`, `Paragraph`, `Link`) and Layout primitives (`Box`, `Stack`, `Container`, `Center`, `Flex`) with strict zero magic values, leveraging design tokens exclusively.
|
|
11
|
+
- Modernized Modal and Dialog components with accessible ARIA landmarks, CSS Anchor Positioning compatibility, and focus management.
|
|
12
|
+
- Validated 0 findings across the entire Modern Web Guidance analyzer corpus (38 qualified guides).
|
|
13
|
+
- Cleaned up redundant split files and exports across core packages for minimal footprint.
|
|
14
|
+
|
|
3
15
|
## [3.0.4] - 2026-11-19
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/ConfirmModal.cjs
CHANGED
|
@@ -22,6 +22,7 @@ var styles = {
|
|
|
22
22
|
k1xSpc: "x78zum5",
|
|
23
23
|
kXwgrk: "xdt5ytf",
|
|
24
24
|
kOIVth: "x15iy025",
|
|
25
|
+
kZeWKH: "xish69e",
|
|
25
26
|
$$css: true
|
|
26
27
|
},
|
|
27
28
|
sizeXxs: {
|
|
@@ -151,51 +152,43 @@ var sizeStyles = {
|
|
|
151
152
|
xl: styles.sizeXl,
|
|
152
153
|
xxl: styles.sizeXxl
|
|
153
154
|
};
|
|
155
|
+
var TYPE_CONFIG = {
|
|
156
|
+
warning: {
|
|
157
|
+
Icon: require_Icons.Icons.AlertTriangle,
|
|
158
|
+
iconStyle: styles.iconWarning,
|
|
159
|
+
btnStyle: styles.btnWarning
|
|
160
|
+
},
|
|
161
|
+
info: {
|
|
162
|
+
Icon: require_Icons.Icons.Info,
|
|
163
|
+
iconStyle: styles.iconInfo,
|
|
164
|
+
btnStyle: styles.btnInfo
|
|
165
|
+
},
|
|
166
|
+
success: {
|
|
167
|
+
Icon: require_Icons.Icons.CheckCircle2,
|
|
168
|
+
iconStyle: styles.iconSuccess,
|
|
169
|
+
btnStyle: styles.btnSuccess
|
|
170
|
+
},
|
|
171
|
+
danger: {
|
|
172
|
+
Icon: require_Icons.Icons.XCircle,
|
|
173
|
+
iconStyle: styles.iconDanger,
|
|
174
|
+
btnStyle: styles.btnDanger
|
|
175
|
+
}
|
|
176
|
+
};
|
|
154
177
|
/**
|
|
155
178
|
* Confirmation dialog for critical user actions (deletions, warnings, approvals).
|
|
156
|
-
*
|
|
157
|
-
* 7-tier sizing scale, and unified prop conventions matching Modal.
|
|
179
|
+
* Built with Meta StyleX and Radix UI Dialog with native overscroll containment.
|
|
158
180
|
*/
|
|
159
|
-
function ConfirmModal({ open
|
|
160
|
-
const isModalOpen = open ?? isOpen ?? true;
|
|
161
|
-
const isPending = isLoading ?? loading ?? false;
|
|
162
|
-
const rawType = type ?? variant ?? "warning";
|
|
163
|
-
const resolvedType = rawType === "error" ? "danger" : rawType;
|
|
164
|
-
const resolvedMessage = message ?? description;
|
|
165
|
-
const resolvedLoadingText = loadingText ?? processingText ?? "Processing...";
|
|
181
|
+
function ConfirmModal({ open = true, onCancel, onConfirm, title, message, children, confirmText = "Confirm", cancelText = "Cancel", closeLabel = "Close", processingText = "Processing...", loadingText, type = "warning", isLoading = false, size = "md", width, footer, sx, className }) {
|
|
166
182
|
const handleDismiss = () => {
|
|
167
|
-
if (!
|
|
183
|
+
if (!isLoading) onCancel?.();
|
|
168
184
|
};
|
|
169
185
|
const handleConfirm = () => {
|
|
170
|
-
if (!
|
|
186
|
+
if (!isLoading) onConfirm?.();
|
|
171
187
|
};
|
|
172
|
-
const Icon =
|
|
173
|
-
warning: require_Icons.Icons.AlertTriangle,
|
|
174
|
-
info: require_Icons.Icons.Info,
|
|
175
|
-
success: require_Icons.Icons.CheckCircle2,
|
|
176
|
-
danger: require_Icons.Icons.XCircle
|
|
177
|
-
}[resolvedType];
|
|
178
|
-
const typeStyles = {
|
|
179
|
-
warning: {
|
|
180
|
-
icon: styles.iconWarning,
|
|
181
|
-
btn: styles.btnWarning
|
|
182
|
-
},
|
|
183
|
-
info: {
|
|
184
|
-
icon: styles.iconInfo,
|
|
185
|
-
btn: styles.btnInfo
|
|
186
|
-
},
|
|
187
|
-
success: {
|
|
188
|
-
icon: styles.iconSuccess,
|
|
189
|
-
btn: styles.btnSuccess
|
|
190
|
-
},
|
|
191
|
-
danger: {
|
|
192
|
-
icon: styles.iconDanger,
|
|
193
|
-
btn: styles.btnDanger
|
|
194
|
-
}
|
|
195
|
-
}[resolvedType];
|
|
188
|
+
const { Icon, iconStyle, btnStyle } = TYPE_CONFIG[type] ?? TYPE_CONFIG.warning;
|
|
196
189
|
const sizeStyle = sizeStyles[size] ?? styles.sizeMd;
|
|
197
190
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dialog.Dialog, {
|
|
198
|
-
open
|
|
191
|
+
open,
|
|
199
192
|
onOpenChange: (val) => !val && handleDismiss(),
|
|
200
193
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_dialog.DialogContent, {
|
|
201
194
|
showCloseButton: false,
|
|
@@ -207,16 +200,16 @@ function ConfirmModal({ open, isOpen, onClose, onCancel, onConfirm, onOk, title,
|
|
|
207
200
|
className,
|
|
208
201
|
style: width ? { maxWidth: width } : void 0,
|
|
209
202
|
onEscapeKeyDown: (e) => {
|
|
210
|
-
if (
|
|
203
|
+
if (isLoading) e.preventDefault();
|
|
211
204
|
},
|
|
212
205
|
onPointerDownOutside: (e_0) => {
|
|
213
|
-
if (
|
|
206
|
+
if (isLoading) e_0.preventDefault();
|
|
214
207
|
},
|
|
215
208
|
children: [
|
|
216
209
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
217
210
|
type: "button",
|
|
218
211
|
onClick: handleDismiss,
|
|
219
|
-
disabled:
|
|
212
|
+
disabled: isLoading,
|
|
220
213
|
className: "x10l6tqk x1u62bzc x1nwpe0i x9psvww x78pyy4 xw3nh4a xc342km xjbqb8w x1ypdohk x78zum5 x6s0dn4 xl56j7k x1a2a7pz xfyfa0t x9p52ec x8aud5w xk2swo9 x13nj1q9 x1s07b3s xijokvz",
|
|
221
214
|
"aria-label": closeLabel,
|
|
222
215
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Icons.Icons.X, { className: "xw4jnvo x1qx5ct2" })
|
|
@@ -225,7 +218,7 @@ function ConfirmModal({ open, isOpen, onClose, onCancel, onConfirm, onOk, title,
|
|
|
225
218
|
className: "x78zum5 x1cy8zhl x1fsutb xnywu7s",
|
|
226
219
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
227
220
|
className: "x78zum5 x6s0dn4 xl56j7k x2lah0s xrhwvvd",
|
|
228
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { ..._stylexjs_stylex.props(styles.typeIcon,
|
|
221
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Icon, { ..._stylexjs_stylex.props(styles.typeIcon, iconStyle) })
|
|
229
222
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
230
223
|
className: "xeuugli x845mor",
|
|
231
224
|
children: [
|
|
@@ -238,34 +231,34 @@ function ConfirmModal({ open, isOpen, onClose, onCancel, onConfirm, onOk, title,
|
|
|
238
231
|
children: title
|
|
239
232
|
})
|
|
240
233
|
}),
|
|
241
|
-
|
|
234
|
+
message ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dialog.DialogDescription, {
|
|
242
235
|
asChild: true,
|
|
243
236
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Text.Text, {
|
|
244
237
|
type: "muted",
|
|
245
238
|
sx: styles.message,
|
|
246
|
-
children:
|
|
239
|
+
children: message
|
|
247
240
|
})
|
|
248
241
|
}) : null,
|
|
249
242
|
children
|
|
250
243
|
]
|
|
251
244
|
})]
|
|
252
245
|
}),
|
|
253
|
-
footer
|
|
246
|
+
footer ?? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
254
247
|
className: "x78zum5 x13a6bvl xb6y1gh xdj266r",
|
|
255
248
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
256
249
|
type: "button",
|
|
257
250
|
variant: "outline",
|
|
258
251
|
onClick: handleDismiss,
|
|
259
|
-
disabled:
|
|
252
|
+
disabled: isLoading,
|
|
260
253
|
sx: styles.cancelBtn,
|
|
261
254
|
children: cancelText
|
|
262
255
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
263
256
|
type: "button",
|
|
264
257
|
variant: type === "danger" ? "destructive" : "default",
|
|
265
258
|
onClick: handleConfirm,
|
|
266
|
-
isLoading
|
|
267
|
-
sx: [styles.confirmBtn,
|
|
268
|
-
children:
|
|
259
|
+
isLoading,
|
|
260
|
+
sx: [styles.confirmBtn, btnStyle],
|
|
261
|
+
children: isLoading ? loadingText ?? processingText : confirmText
|
|
269
262
|
})]
|
|
270
263
|
})
|
|
271
264
|
]
|
|
@@ -273,4 +266,3 @@ function ConfirmModal({ open, isOpen, onClose, onCancel, onConfirm, onOk, title,
|
|
|
273
266
|
});
|
|
274
267
|
}
|
|
275
268
|
exports.ConfirmModal = ConfirmModal;
|
|
276
|
-
exports.default = ConfirmModal;
|
package/dist/ConfirmModal.d.ts
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import * as stylex from '@stylexjs/stylex';
|
|
3
3
|
import type { ComponentSize } from './theme/types';
|
|
4
|
-
export type ConfirmModalType = 'warning' | 'info' | 'success' | 'danger'
|
|
4
|
+
export type ConfirmModalType = 'warning' | 'info' | 'success' | 'danger';
|
|
5
5
|
export interface ConfirmModalProps {
|
|
6
6
|
/** Controls visibility of the confirmation modal dialog. */
|
|
7
7
|
open?: boolean;
|
|
8
|
-
/** Alias for `open` maintaining backward compatibility. */
|
|
9
|
-
isOpen?: boolean;
|
|
10
8
|
/** Callback fired when the dialog is dismissed or cancel button clicked. */
|
|
11
|
-
onClose?: () => void;
|
|
12
|
-
/** Alias for `onClose` (consistent with Modal `onCancel`). */
|
|
13
9
|
onCancel?: () => void;
|
|
14
10
|
/** Callback fired when the user confirms the action. */
|
|
15
11
|
onConfirm?: () => void;
|
|
16
|
-
/** Alias for `onConfirm`. */
|
|
17
|
-
onOk?: () => void;
|
|
18
12
|
/** Dialog heading title summarizing the intent. */
|
|
19
13
|
title: ReactNode;
|
|
20
|
-
/**
|
|
14
|
+
/** Explanatory message describing the consequences of the action. */
|
|
21
15
|
message?: ReactNode;
|
|
22
|
-
/** Alias for `message` (consistent with Modal `description`). */
|
|
23
|
-
description?: ReactNode;
|
|
24
16
|
/** Optional body content rendered inside the dialog body. */
|
|
25
17
|
children?: ReactNode;
|
|
26
18
|
/** Text shown on the confirmation button (defaults to "Confirm"). */
|
|
@@ -31,16 +23,12 @@ export interface ConfirmModalProps {
|
|
|
31
23
|
closeLabel?: string;
|
|
32
24
|
/** Text shown when an async confirmation is pending (defaults to "Processing..."). */
|
|
33
25
|
processingText?: string;
|
|
34
|
-
/** Alias for
|
|
26
|
+
/** Alias for processingText */
|
|
35
27
|
loadingText?: string;
|
|
36
28
|
/** Semantic type determining the accent color and icon. */
|
|
37
29
|
type?: ConfirmModalType;
|
|
38
|
-
/** Alias for `type` to follow design system variant conventions. */
|
|
39
|
-
variant?: ConfirmModalType;
|
|
40
30
|
/** Whether the confirmation request is currently pending. */
|
|
41
31
|
isLoading?: boolean;
|
|
42
|
-
/** Alias for `isLoading`. */
|
|
43
|
-
loading?: boolean;
|
|
44
32
|
/** Sizing tier across the universal 7-level scale. Defaults to 'md'. */
|
|
45
33
|
size?: ComponentSize;
|
|
46
34
|
/** Maximum width in pixels or CSS unit (overrides size preset). */
|
|
@@ -52,13 +40,9 @@ export interface ConfirmModalProps {
|
|
|
52
40
|
/** Additional CSS class names. */
|
|
53
41
|
className?: string;
|
|
54
42
|
}
|
|
55
|
-
/** Legacy type alias */
|
|
56
|
-
export type ConfirmationDialogProps = ConfirmModalProps;
|
|
57
43
|
/**
|
|
58
44
|
* Confirmation dialog for critical user actions (deletions, warnings, approvals).
|
|
59
|
-
*
|
|
60
|
-
* 7-tier sizing scale, and unified prop conventions matching Modal.
|
|
45
|
+
* Built with Meta StyleX and Radix UI Dialog with native overscroll containment.
|
|
61
46
|
*/
|
|
62
|
-
export declare function ConfirmModal({ open,
|
|
63
|
-
export default ConfirmModal;
|
|
47
|
+
export declare function ConfirmModal({ open, onCancel, onConfirm, title, message, children, confirmText, cancelText, closeLabel, processingText, loadingText, type, isLoading, size, width, footer, sx, className, }: ConfirmModalProps): import("react").JSX.Element;
|
|
64
48
|
//# sourceMappingURL=ConfirmModal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmModal.d.ts","sourceRoot":"","sources":["../src/ConfirmModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfirmModal.d.ts","sourceRoot":"","sources":["../src/ConfirmModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AA8LnD,MAAM,MAAM,gBAAgB,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;AAEzE,MAAM,WAAW,iBAAiB;IAChC,4DAA4D;IAC5D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,mDAAmD;IACnD,KAAK,EAAE,SAAS,CAAC;IACjB,qEAAqE;IACrE,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,6DAA6D;IAC7D,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,qEAAqE;IACrE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,8DAA8D;IAC9D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sFAAsF;IACtF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,2DAA2D;IAC3D,IAAI,CAAC,EAAE,gBAAgB,CAAC;IACxB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,wEAAwE;IACxE,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,mEAAmE;IACnE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,qEAAqE;IACrE,EAAE,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC;IACzB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAaD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,EAC3B,IAAW,EACX,QAAQ,EACR,SAAS,EACT,KAAK,EACL,OAAO,EACP,QAAQ,EACR,WAAuB,EACvB,UAAqB,EACrB,UAAoB,EACpB,cAAgC,EAChC,WAAW,EACX,IAAgB,EAChB,SAAiB,EACjB,IAAW,EACX,KAAK,EACL,MAAM,EACN,EAAE,EACF,SAAS,GACV,EAAE,iBAAiB,+BAkFnB"}
|
package/dist/ConfirmModal.js
CHANGED
|
@@ -20,6 +20,7 @@ var styles = {
|
|
|
20
20
|
k1xSpc: "x78zum5",
|
|
21
21
|
kXwgrk: "xdt5ytf",
|
|
22
22
|
kOIVth: "x15iy025",
|
|
23
|
+
kZeWKH: "xish69e",
|
|
23
24
|
$$css: true
|
|
24
25
|
},
|
|
25
26
|
sizeXxs: {
|
|
@@ -149,51 +150,43 @@ var sizeStyles = {
|
|
|
149
150
|
xl: styles.sizeXl,
|
|
150
151
|
xxl: styles.sizeXxl
|
|
151
152
|
};
|
|
153
|
+
var TYPE_CONFIG = {
|
|
154
|
+
warning: {
|
|
155
|
+
Icon: Icons.AlertTriangle,
|
|
156
|
+
iconStyle: styles.iconWarning,
|
|
157
|
+
btnStyle: styles.btnWarning
|
|
158
|
+
},
|
|
159
|
+
info: {
|
|
160
|
+
Icon: Icons.Info,
|
|
161
|
+
iconStyle: styles.iconInfo,
|
|
162
|
+
btnStyle: styles.btnInfo
|
|
163
|
+
},
|
|
164
|
+
success: {
|
|
165
|
+
Icon: Icons.CheckCircle2,
|
|
166
|
+
iconStyle: styles.iconSuccess,
|
|
167
|
+
btnStyle: styles.btnSuccess
|
|
168
|
+
},
|
|
169
|
+
danger: {
|
|
170
|
+
Icon: Icons.XCircle,
|
|
171
|
+
iconStyle: styles.iconDanger,
|
|
172
|
+
btnStyle: styles.btnDanger
|
|
173
|
+
}
|
|
174
|
+
};
|
|
152
175
|
/**
|
|
153
176
|
* Confirmation dialog for critical user actions (deletions, warnings, approvals).
|
|
154
|
-
*
|
|
155
|
-
* 7-tier sizing scale, and unified prop conventions matching Modal.
|
|
177
|
+
* Built with Meta StyleX and Radix UI Dialog with native overscroll containment.
|
|
156
178
|
*/
|
|
157
|
-
function ConfirmModal({ open
|
|
158
|
-
const isModalOpen = open ?? isOpen ?? true;
|
|
159
|
-
const isPending = isLoading ?? loading ?? false;
|
|
160
|
-
const rawType = type ?? variant ?? "warning";
|
|
161
|
-
const resolvedType = rawType === "error" ? "danger" : rawType;
|
|
162
|
-
const resolvedMessage = message ?? description;
|
|
163
|
-
const resolvedLoadingText = loadingText ?? processingText ?? "Processing...";
|
|
179
|
+
function ConfirmModal({ open = true, onCancel, onConfirm, title, message, children, confirmText = "Confirm", cancelText = "Cancel", closeLabel = "Close", processingText = "Processing...", loadingText, type = "warning", isLoading = false, size = "md", width, footer, sx, className }) {
|
|
164
180
|
const handleDismiss = () => {
|
|
165
|
-
if (!
|
|
181
|
+
if (!isLoading) onCancel?.();
|
|
166
182
|
};
|
|
167
183
|
const handleConfirm = () => {
|
|
168
|
-
if (!
|
|
184
|
+
if (!isLoading) onConfirm?.();
|
|
169
185
|
};
|
|
170
|
-
const Icon =
|
|
171
|
-
warning: Icons.AlertTriangle,
|
|
172
|
-
info: Icons.Info,
|
|
173
|
-
success: Icons.CheckCircle2,
|
|
174
|
-
danger: Icons.XCircle
|
|
175
|
-
}[resolvedType];
|
|
176
|
-
const typeStyles = {
|
|
177
|
-
warning: {
|
|
178
|
-
icon: styles.iconWarning,
|
|
179
|
-
btn: styles.btnWarning
|
|
180
|
-
},
|
|
181
|
-
info: {
|
|
182
|
-
icon: styles.iconInfo,
|
|
183
|
-
btn: styles.btnInfo
|
|
184
|
-
},
|
|
185
|
-
success: {
|
|
186
|
-
icon: styles.iconSuccess,
|
|
187
|
-
btn: styles.btnSuccess
|
|
188
|
-
},
|
|
189
|
-
danger: {
|
|
190
|
-
icon: styles.iconDanger,
|
|
191
|
-
btn: styles.btnDanger
|
|
192
|
-
}
|
|
193
|
-
}[resolvedType];
|
|
186
|
+
const { Icon, iconStyle, btnStyle } = TYPE_CONFIG[type] ?? TYPE_CONFIG.warning;
|
|
194
187
|
const sizeStyle = sizeStyles[size] ?? styles.sizeMd;
|
|
195
188
|
return /* @__PURE__ */ jsx(Dialog, {
|
|
196
|
-
open
|
|
189
|
+
open,
|
|
197
190
|
onOpenChange: (val) => !val && handleDismiss(),
|
|
198
191
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
199
192
|
showCloseButton: false,
|
|
@@ -205,16 +198,16 @@ function ConfirmModal({ open, isOpen, onClose, onCancel, onConfirm, onOk, title,
|
|
|
205
198
|
className,
|
|
206
199
|
style: width ? { maxWidth: width } : void 0,
|
|
207
200
|
onEscapeKeyDown: (e) => {
|
|
208
|
-
if (
|
|
201
|
+
if (isLoading) e.preventDefault();
|
|
209
202
|
},
|
|
210
203
|
onPointerDownOutside: (e_0) => {
|
|
211
|
-
if (
|
|
204
|
+
if (isLoading) e_0.preventDefault();
|
|
212
205
|
},
|
|
213
206
|
children: [
|
|
214
207
|
/* @__PURE__ */ jsx("button", {
|
|
215
208
|
type: "button",
|
|
216
209
|
onClick: handleDismiss,
|
|
217
|
-
disabled:
|
|
210
|
+
disabled: isLoading,
|
|
218
211
|
className: "x10l6tqk x1u62bzc x1nwpe0i x9psvww x78pyy4 xw3nh4a xc342km xjbqb8w x1ypdohk x78zum5 x6s0dn4 xl56j7k x1a2a7pz xfyfa0t x9p52ec x8aud5w xk2swo9 x13nj1q9 x1s07b3s xijokvz",
|
|
219
212
|
"aria-label": closeLabel,
|
|
220
213
|
children: /* @__PURE__ */ jsx(Icons.X, { className: "xw4jnvo x1qx5ct2" })
|
|
@@ -223,7 +216,7 @@ function ConfirmModal({ open, isOpen, onClose, onCancel, onConfirm, onOk, title,
|
|
|
223
216
|
className: "x78zum5 x1cy8zhl x1fsutb xnywu7s",
|
|
224
217
|
children: [/* @__PURE__ */ jsx("div", {
|
|
225
218
|
className: "x78zum5 x6s0dn4 xl56j7k x2lah0s xrhwvvd",
|
|
226
|
-
children: /* @__PURE__ */ jsx(Icon, { ...stylex.props(styles.typeIcon,
|
|
219
|
+
children: /* @__PURE__ */ jsx(Icon, { ...stylex.props(styles.typeIcon, iconStyle) })
|
|
227
220
|
}), /* @__PURE__ */ jsxs("div", {
|
|
228
221
|
className: "xeuugli x845mor",
|
|
229
222
|
children: [
|
|
@@ -236,38 +229,38 @@ function ConfirmModal({ open, isOpen, onClose, onCancel, onConfirm, onOk, title,
|
|
|
236
229
|
children: title
|
|
237
230
|
})
|
|
238
231
|
}),
|
|
239
|
-
|
|
232
|
+
message ? /* @__PURE__ */ jsx(DialogDescription, {
|
|
240
233
|
asChild: true,
|
|
241
234
|
children: /* @__PURE__ */ jsx(Text, {
|
|
242
235
|
type: "muted",
|
|
243
236
|
sx: styles.message,
|
|
244
|
-
children:
|
|
237
|
+
children: message
|
|
245
238
|
})
|
|
246
239
|
}) : null,
|
|
247
240
|
children
|
|
248
241
|
]
|
|
249
242
|
})]
|
|
250
243
|
}),
|
|
251
|
-
footer
|
|
244
|
+
footer ?? /* @__PURE__ */ jsxs("div", {
|
|
252
245
|
className: "x78zum5 x13a6bvl xb6y1gh xdj266r",
|
|
253
246
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
254
247
|
type: "button",
|
|
255
248
|
variant: "outline",
|
|
256
249
|
onClick: handleDismiss,
|
|
257
|
-
disabled:
|
|
250
|
+
disabled: isLoading,
|
|
258
251
|
sx: styles.cancelBtn,
|
|
259
252
|
children: cancelText
|
|
260
253
|
}), /* @__PURE__ */ jsx(Button, {
|
|
261
254
|
type: "button",
|
|
262
255
|
variant: type === "danger" ? "destructive" : "default",
|
|
263
256
|
onClick: handleConfirm,
|
|
264
|
-
isLoading
|
|
265
|
-
sx: [styles.confirmBtn,
|
|
266
|
-
children:
|
|
257
|
+
isLoading,
|
|
258
|
+
sx: [styles.confirmBtn, btnStyle],
|
|
259
|
+
children: isLoading ? loadingText ?? processingText : confirmText
|
|
267
260
|
})]
|
|
268
261
|
})
|
|
269
262
|
]
|
|
270
263
|
})
|
|
271
264
|
});
|
|
272
265
|
}
|
|
273
|
-
export { ConfirmModal
|
|
266
|
+
export { ConfirmModal };
|
package/dist/Modal.cjs
CHANGED
|
@@ -13,6 +13,7 @@ var styles = {
|
|
|
13
13
|
kOIVth: "xxhr3t",
|
|
14
14
|
kmVPX3: "x1717udv",
|
|
15
15
|
kzqmXN: "xh8yej3",
|
|
16
|
+
kZeWKH: "xish69e",
|
|
16
17
|
$$css: true
|
|
17
18
|
},
|
|
18
19
|
sizeXxs: {
|
|
@@ -76,24 +77,19 @@ var sizeStyles = {
|
|
|
76
77
|
};
|
|
77
78
|
/**
|
|
78
79
|
* Standard modal dialog component for VLRC applications.
|
|
79
|
-
* Built on top of Radix UI Dialog and styled with Meta StyleX.
|
|
80
|
-
* Supports configurable 7-tier sizing ('xxs' - 'xxl'), built-in loading states,
|
|
81
|
-
* and unified prop conventions aligned with ConfirmModal.
|
|
80
|
+
* Built on top of Radix UI Dialog and styled with Meta StyleX with overscroll containment.
|
|
82
81
|
*/
|
|
83
|
-
function Modal({ open
|
|
84
|
-
const isVisible = open ?? isOpen ?? true;
|
|
85
|
-
const isPending = isLoading ?? loading ?? false;
|
|
86
|
-
const resolvedDescription = description ?? message;
|
|
82
|
+
function Modal({ open = true, title, description, children, footer, size = "md", width, confirmText = "Confirm", cancelText = "Cancel", isLoading = false, loadingText, onCancel, onConfirm, sx, className }) {
|
|
87
83
|
const handleDismiss = () => {
|
|
88
|
-
if (!
|
|
84
|
+
if (!isLoading) onCancel?.();
|
|
89
85
|
};
|
|
90
86
|
const handleConfirm = () => {
|
|
91
|
-
if (!
|
|
87
|
+
if (!isLoading) onConfirm?.();
|
|
92
88
|
};
|
|
93
|
-
const hasConfirmAction = Boolean(onConfirm
|
|
89
|
+
const hasConfirmAction = Boolean(onConfirm);
|
|
94
90
|
const sizeStyle = sizeStyles[size] ?? styles.sizeMd;
|
|
95
91
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dialog.Dialog, {
|
|
96
|
-
open
|
|
92
|
+
open,
|
|
97
93
|
onOpenChange: (val) => !val && handleDismiss(),
|
|
98
94
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_dialog.DialogContent, {
|
|
99
95
|
sx: [
|
|
@@ -106,7 +102,7 @@ function Modal({ open, isOpen, title, description, message, children, footer, si
|
|
|
106
102
|
children: [
|
|
107
103
|
/* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_dialog.DialogHeader, {
|
|
108
104
|
sx: styles.header,
|
|
109
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dialog.DialogTitle, { children: title }),
|
|
105
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dialog.DialogTitle, { children: title }), description ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dialog.DialogDescription, { children: description }) : null]
|
|
110
106
|
}),
|
|
111
107
|
children ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
112
108
|
className: "x12lumcd x1odjw0f x1qhpy6z xgepmj6",
|
|
@@ -114,17 +110,17 @@ function Modal({ open, isOpen, title, description, message, children, footer, si
|
|
|
114
110
|
}) : null,
|
|
115
111
|
(footer || hasConfirmAction) && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_dialog.DialogFooter, {
|
|
116
112
|
sx: styles.footer,
|
|
117
|
-
children: footer
|
|
113
|
+
children: footer ?? /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
118
114
|
className: "x78zum5 xh8yej3 x13a6bvl x13z6uf9",
|
|
119
115
|
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
120
116
|
variant: "outline",
|
|
121
117
|
onClick: handleDismiss,
|
|
122
|
-
disabled:
|
|
118
|
+
disabled: isLoading,
|
|
123
119
|
children: cancelText
|
|
124
120
|
}), hasConfirmAction ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_button.Button, {
|
|
125
121
|
onClick: handleConfirm,
|
|
126
|
-
disabled:
|
|
127
|
-
children:
|
|
122
|
+
disabled: isLoading,
|
|
123
|
+
children: isLoading && loadingText ? loadingText : confirmText
|
|
128
124
|
}) : null]
|
|
129
125
|
})
|
|
130
126
|
})
|
package/dist/Modal.d.ts
CHANGED
|
@@ -4,18 +4,12 @@ import type { ComponentSize } from './theme/types';
|
|
|
4
4
|
export interface ModalProps {
|
|
5
5
|
/** Whether the modal dialog is currently visible and open. */
|
|
6
6
|
open?: boolean;
|
|
7
|
-
/** Alias for `open` for consistent prop usage across modal components. */
|
|
8
|
-
isOpen?: boolean;
|
|
9
7
|
/** Callback fired when the cancel button, close icon, or backdrop is clicked. */
|
|
10
8
|
onCancel?: () => void;
|
|
11
|
-
/** Alias for `onCancel` (consistent with ConfirmModal `onClose`). */
|
|
12
|
-
onClose?: () => void;
|
|
13
9
|
/** Primary title rendered in the modal header. */
|
|
14
10
|
title: ReactNode;
|
|
15
11
|
/** Optional secondary subtitle or description below the title. */
|
|
16
12
|
description?: ReactNode;
|
|
17
|
-
/** Alias for `description` (consistent with ConfirmModal `message`). */
|
|
18
|
-
message?: ReactNode;
|
|
19
13
|
/** Main body content rendered inside the scrollable dialog area. */
|
|
20
14
|
children?: ReactNode;
|
|
21
15
|
/** Custom footer node replacing the default cancel/confirm button row. */
|
|
@@ -30,12 +24,8 @@ export interface ModalProps {
|
|
|
30
24
|
cancelText?: string;
|
|
31
25
|
/** Callback fired when the primary confirmation button is clicked. */
|
|
32
26
|
onConfirm?: () => void;
|
|
33
|
-
/** Alias for `onConfirm`. */
|
|
34
|
-
onOk?: () => void;
|
|
35
27
|
/** If true, displays a loading state and disables modal action buttons. */
|
|
36
28
|
isLoading?: boolean;
|
|
37
|
-
/** Alias for `isLoading`. */
|
|
38
|
-
loading?: boolean;
|
|
39
29
|
/** Text displayed when confirmation action is loading. */
|
|
40
30
|
loadingText?: string;
|
|
41
31
|
/** Custom StyleX style overrides applied to the dialog container. */
|
|
@@ -45,9 +35,7 @@ export interface ModalProps {
|
|
|
45
35
|
}
|
|
46
36
|
/**
|
|
47
37
|
* Standard modal dialog component for VLRC applications.
|
|
48
|
-
* Built on top of Radix UI Dialog and styled with Meta StyleX.
|
|
49
|
-
* Supports configurable 7-tier sizing ('xxs' - 'xxl'), built-in loading states,
|
|
50
|
-
* and unified prop conventions aligned with ConfirmModal.
|
|
38
|
+
* Built on top of Radix UI Dialog and styled with Meta StyleX with overscroll containment.
|
|
51
39
|
*/
|
|
52
|
-
export declare function Modal({ open,
|
|
40
|
+
export declare function Modal({ open, title, description, children, footer, size, width, confirmText, cancelText, isLoading, loadingText, onCancel, onConfirm, sx, className, }: ModalProps): import("react").JSX.Element;
|
|
53
41
|
//# sourceMappingURL=Modal.d.ts.map
|
package/dist/Modal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../src/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"Modal.d.ts","sourceRoot":"","sources":["../src/Modal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAuEnD,MAAM,WAAW,UAAU;IACzB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,kDAAkD;IAClD,KAAK,EAAE,SAAS,CAAC;IACjB,kEAAkE;IAClE,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,0EAA0E;IAC1E,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,wEAAwE;IACxE,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,+EAA+E;IAC/E,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,sDAAsD;IACtD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,2EAA2E;IAC3E,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,qEAAqE;IACrE,EAAE,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC;IACzB,kCAAkC;IAClC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,EACpB,IAAW,EACX,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,IAAW,EACX,KAAK,EACL,WAAuB,EACvB,UAAqB,EACrB,SAAiB,EACjB,WAAW,EACX,QAAQ,EACR,SAAS,EACT,EAAE,EACF,SAAS,GACV,EAAE,UAAU,+BA6CZ"}
|
package/dist/Modal.js
CHANGED
|
@@ -11,6 +11,7 @@ var styles = {
|
|
|
11
11
|
kOIVth: "xxhr3t",
|
|
12
12
|
kmVPX3: "x1717udv",
|
|
13
13
|
kzqmXN: "xh8yej3",
|
|
14
|
+
kZeWKH: "xish69e",
|
|
14
15
|
$$css: true
|
|
15
16
|
},
|
|
16
17
|
sizeXxs: {
|
|
@@ -74,24 +75,19 @@ var sizeStyles = {
|
|
|
74
75
|
};
|
|
75
76
|
/**
|
|
76
77
|
* Standard modal dialog component for VLRC applications.
|
|
77
|
-
* Built on top of Radix UI Dialog and styled with Meta StyleX.
|
|
78
|
-
* Supports configurable 7-tier sizing ('xxs' - 'xxl'), built-in loading states,
|
|
79
|
-
* and unified prop conventions aligned with ConfirmModal.
|
|
78
|
+
* Built on top of Radix UI Dialog and styled with Meta StyleX with overscroll containment.
|
|
80
79
|
*/
|
|
81
|
-
function Modal({ open
|
|
82
|
-
const isVisible = open ?? isOpen ?? true;
|
|
83
|
-
const isPending = isLoading ?? loading ?? false;
|
|
84
|
-
const resolvedDescription = description ?? message;
|
|
80
|
+
function Modal({ open = true, title, description, children, footer, size = "md", width, confirmText = "Confirm", cancelText = "Cancel", isLoading = false, loadingText, onCancel, onConfirm, sx, className }) {
|
|
85
81
|
const handleDismiss = () => {
|
|
86
|
-
if (!
|
|
82
|
+
if (!isLoading) onCancel?.();
|
|
87
83
|
};
|
|
88
84
|
const handleConfirm = () => {
|
|
89
|
-
if (!
|
|
85
|
+
if (!isLoading) onConfirm?.();
|
|
90
86
|
};
|
|
91
|
-
const hasConfirmAction = Boolean(onConfirm
|
|
87
|
+
const hasConfirmAction = Boolean(onConfirm);
|
|
92
88
|
const sizeStyle = sizeStyles[size] ?? styles.sizeMd;
|
|
93
89
|
return /* @__PURE__ */ jsx(Dialog, {
|
|
94
|
-
open
|
|
90
|
+
open,
|
|
95
91
|
onOpenChange: (val) => !val && handleDismiss(),
|
|
96
92
|
children: /* @__PURE__ */ jsxs(DialogContent, {
|
|
97
93
|
sx: [
|
|
@@ -104,7 +100,7 @@ function Modal({ open, isOpen, title, description, message, children, footer, si
|
|
|
104
100
|
children: [
|
|
105
101
|
/* @__PURE__ */ jsxs(DialogHeader, {
|
|
106
102
|
sx: styles.header,
|
|
107
|
-
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }),
|
|
103
|
+
children: [/* @__PURE__ */ jsx(DialogTitle, { children: title }), description ? /* @__PURE__ */ jsx(DialogDescription, { children: description }) : null]
|
|
108
104
|
}),
|
|
109
105
|
children ? /* @__PURE__ */ jsx("div", {
|
|
110
106
|
className: "x12lumcd x1odjw0f x1qhpy6z xgepmj6",
|
|
@@ -112,17 +108,17 @@ function Modal({ open, isOpen, title, description, message, children, footer, si
|
|
|
112
108
|
}) : null,
|
|
113
109
|
(footer || hasConfirmAction) && /* @__PURE__ */ jsx(DialogFooter, {
|
|
114
110
|
sx: styles.footer,
|
|
115
|
-
children: footer
|
|
111
|
+
children: footer ?? /* @__PURE__ */ jsxs("div", {
|
|
116
112
|
className: "x78zum5 xh8yej3 x13a6bvl x13z6uf9",
|
|
117
113
|
children: [/* @__PURE__ */ jsx(Button, {
|
|
118
114
|
variant: "outline",
|
|
119
115
|
onClick: handleDismiss,
|
|
120
|
-
disabled:
|
|
116
|
+
disabled: isLoading,
|
|
121
117
|
children: cancelText
|
|
122
118
|
}), hasConfirmAction ? /* @__PURE__ */ jsx(Button, {
|
|
123
119
|
onClick: handleConfirm,
|
|
124
|
-
disabled:
|
|
125
|
-
children:
|
|
120
|
+
disabled: isLoading,
|
|
121
|
+
children: isLoading && loadingText ? loadingText : confirmText
|
|
126
122
|
}) : null]
|
|
127
123
|
})
|
|
128
124
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../src/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAU/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AA6E/C,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CAoMpD,CAAC;
|
|
1
|
+
{"version":3,"file":"MultiSelect.d.ts","sourceRoot":"","sources":["../../src/MultiSelect/MultiSelect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAU/C,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AA6E/C,QAAA,MAAM,WAAW,EAAE,iBAAiB,CAAC,gBAAgB,CAoMpD,CAAC;eAEa,WAAW"}
|
|
@@ -46,6 +46,7 @@ var useMultiSelect = ({ forwardedRef, ...props }) => {
|
|
|
46
46
|
]);
|
|
47
47
|
const handleInputKeyDown = (event) => {
|
|
48
48
|
if (disabled) return;
|
|
49
|
+
if (event.nativeEvent.isComposing || event.keyCode === 229) return;
|
|
49
50
|
if (event.key === "Enter") setIsPopoverOpen(true);
|
|
50
51
|
else if (event.key === "Backspace" && !event.currentTarget.value) {
|
|
51
52
|
const newSelectedValues = [...selectedValues];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useMultiSelect.d.ts","sourceRoot":"","sources":["../../src/MultiSelect/useMultiSelect.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,KAAK,GAAG,EACR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