smartsell-ui-kit 0.0.6 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/types.cjs ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __copyProps = (to, from, except, desc) => {
7
+ if (from && typeof from === "object" || typeof from === "function") {
8
+ for (let key of __getOwnPropNames(from))
9
+ if (!__hasOwnProp.call(to, key) && key !== except)
10
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
+ }
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+
16
+ // src/types.ts
17
+ var types_exports = {};
18
+ module.exports = __toCommonJS(types_exports);
19
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["export type { ButtonProps } from './components/Button';\nexport type { CardProps } from './components/Card';\nexport type { CardSmallProps } from './components/CardSmall';\nexport type { CheckboxProps } from './components/Checkbox';\nexport type {\n ComposableModalProps,\n ComposableModalSlotRenderProps,\n ComposableModalSlotRenderer,\n ModalSlotContext,\n ModalSlotIds,\n} from './components/ComposableModal';\nexport type {\n DatePickerChangeContext,\n DatePickerChangeReason,\n DatePickerMode,\n DatePickerProps,\n DatePickerValue,\n} from './components/DatePicker';\nexport type { InputProps } from './components/Input';\nexport type {\n ModalAction,\n ModalProps,\n ModalTheme,\n ModalThemeSource,\n StandardModalProps,\n} from './components/Modal';\nexport type { SeparatorOrientation, SeparatorProps } from './components/Separator';\nexport type { SelectProps } from './components/Select';\nexport type {\n SelectAsyncLoadContext,\n SelectAsyncLoadResult,\n SelectAsyncOption,\n SelectAsyncOptionValue,\n SelectAsyncProps,\n} from './components/SelectAsync';\nexport type { TableProps } from './components/Table';\nexport type { TableAsyncProps } from './components/TableAsync';\nexport type { TextareaProps } from './components/Textarea';\nexport type { ControlSize } from './foundation';\nexport type {\n SharedTableProps,\n TableAction,\n TableActionSource,\n TableActionTone,\n TableAsyncLoadContext,\n TableAsyncLoadResult,\n TableColumn,\n TableColumnAlign,\n TableColumnType,\n TableLabels,\n} from './componentsBase/table/types';\nexport type { UiKitThemeTokens } from './foundation';"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -0,0 +1,4 @@
1
+ export { ButtonProps, CardProps, CardSmallProps, CheckboxProps, ComposableModalProps, ComposableModalSlotRenderProps, ComposableModalSlotRenderer, ControlSize, DatePickerChangeContext, DatePickerChangeReason, DatePickerMode, DatePickerProps, DatePickerValue, InputProps, ModalAction, ModalProps, ModalSlotContext, ModalSlotIds, ModalTheme, ModalThemeSource, SelectAsyncLoadContext, SelectAsyncLoadResult, SelectAsyncOption, SelectAsyncOptionValue, SelectAsyncProps, SelectProps, SeparatorOrientation, SeparatorProps, SharedTableProps, StandardModalProps, TableAction, TableActionSource, TableActionTone, TableAsyncLoadContext, TableAsyncLoadResult, TableAsyncProps, TableColumn, TableColumnAlign, TableColumnType, TableLabels, TableProps, TextareaProps, UiKitThemeTokens } from './index.cjs';
2
+ import 'react/jsx-runtime';
3
+ import 'react';
4
+ import 'smartsell-theme';
@@ -0,0 +1,4 @@
1
+ export { ButtonProps, CardProps, CardSmallProps, CheckboxProps, ComposableModalProps, ComposableModalSlotRenderProps, ComposableModalSlotRenderer, ControlSize, DatePickerChangeContext, DatePickerChangeReason, DatePickerMode, DatePickerProps, DatePickerValue, InputProps, ModalAction, ModalProps, ModalSlotContext, ModalSlotIds, ModalTheme, ModalThemeSource, SelectAsyncLoadContext, SelectAsyncLoadResult, SelectAsyncOption, SelectAsyncOptionValue, SelectAsyncProps, SelectProps, SeparatorOrientation, SeparatorProps, SharedTableProps, StandardModalProps, TableAction, TableActionSource, TableActionTone, TableAsyncLoadContext, TableAsyncLoadResult, TableAsyncProps, TableColumn, TableColumnAlign, TableColumnType, TableLabels, TableProps, TextareaProps, UiKitThemeTokens } from './index.js';
2
+ import 'react/jsx-runtime';
3
+ import 'react';
4
+ import 'smartsell-theme';
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=types.js.map
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "smartsell-ui-kit",
3
- "version": "0.0.6",
4
- "description": "Public UI primitives and composable modal helpers for SmartSell Sales custom modules.",
5
- "license": "MIT",
3
+ "version": "0.1.1",
4
+ "description": "Public UI primitives and modal helpers for SmartSell applications.",
5
+ "license": "SEE LICENSE IN LICENSE",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",
8
8
  "module": "./dist/index.js",
@@ -13,10 +13,15 @@
13
13
  "import": "./dist/index.js",
14
14
  "require": "./dist/index.cjs"
15
15
  },
16
- "./modal": {
17
- "types": "./dist/modal.d.ts",
18
- "import": "./dist/modal.js",
19
- "require": "./dist/modal.cjs"
16
+ "./img": {
17
+ "types": "./dist/img/index.d.ts",
18
+ "import": "./dist/img/index.js",
19
+ "require": "./dist/img/index.cjs"
20
+ },
21
+ "./types": {
22
+ "types": "./dist/types.d.ts",
23
+ "import": "./dist/types.js",
24
+ "require": "./dist/types.cjs"
20
25
  }
21
26
  },
22
27
  "files": [
@@ -31,8 +36,14 @@
31
36
  "clean": "rm -rf dist *.tgz",
32
37
  "dev": "tsup --watch",
33
38
  "prepack": "npm run clean && npm run build",
34
- "storybook": "storybook dev -p 6006",
35
- "typecheck": "tsc --noEmit"
39
+ "storybook:clean-cache": "rm -rf node_modules/.cache/storybook node_modules/.cache/sb-vite-plugin-externals",
40
+ "storybook": "npm run storybook:clean-cache && storybook dev -p 3005 --no-open",
41
+ "test": "vitest",
42
+ "test:run": "vitest run",
43
+ "typecheck": "tsc --noEmit",
44
+ "typecheck:storybook": "tsc -p .storybook/tsconfig.json --noEmit",
45
+ "validate": "npm run typecheck && npm run typecheck:storybook && npm run test:run && npm run build",
46
+ "validate:release": "npm run validate && CI=1 STORYBOOK_DISABLE_TELEMETRY=1 npm run build:storybook && npm pack --dry-run"
36
47
  },
37
48
  "keywords": [
38
49
  "smartsell",
@@ -44,26 +55,26 @@
44
55
  "react"
45
56
  ],
46
57
  "peerDependencies": {
47
- "react": ">=17",
48
- "smartsell-sales-sdk": ">=0.0.5"
49
- },
50
- "peerDependenciesMeta": {
51
- "smartsell-sales-sdk": {
52
- "optional": true
53
- }
58
+ "react": ">=18",
59
+ "react-dom": ">=18",
60
+ "smartsell-theme": ">=0.0.10"
54
61
  },
55
62
  "devDependencies": {
63
+ "@fontsource/lato": "^5.2.7",
56
64
  "@storybook/addon-a11y": "^8.6.14",
57
65
  "@storybook/addon-essentials": "^8.6.14",
58
66
  "@storybook/react-vite": "^8.6.14",
67
+ "@testing-library/jest-dom": "^6.6.3",
68
+ "@testing-library/react": "^16.3.0",
59
69
  "@types/react": "^18.3.12",
60
70
  "@types/react-dom": "^18.3.7",
71
+ "jsdom": "^26.1.0",
61
72
  "react": "^18.3.1",
62
73
  "react-dom": "^18.3.1",
63
- "smartsell-sales-sdk": "^0.0.5",
64
- "smartsell-theme": "^0.0.4",
74
+ "smartsell-theme": "^0.0.10",
65
75
  "storybook": "^8.6.14",
66
76
  "tsup": "^8.3.5",
67
- "typescript": "^5.6.2"
77
+ "typescript": "^5.6.2",
78
+ "vitest": "^2.1.9"
68
79
  }
69
80
  }
@@ -1,460 +0,0 @@
1
- // src/components/Modal.tsx
2
- import { useEffect, useMemo, useState } from "react";
3
- import { jsx, jsxs } from "react/jsx-runtime";
4
- var defaultThemeColors = {
5
- background: "#f8fafc",
6
- surface: "#ffffff",
7
- onSurface: "#0f172a",
8
- onBackground: "#0f172a",
9
- primary: "#0f766e",
10
- onPrimary: "#ffffff",
11
- secondary: "#1d4ed8",
12
- onSecondary: "#ffffff",
13
- negative: "#dc2626",
14
- warning: "#d97706"
15
- };
16
- var withAlpha = (hex, alpha) => {
17
- const normalized = hex.replace("#", "").trim();
18
- const value = normalized.length === 3 ? normalized.split("").map((char) => char + char).join("") : normalized;
19
- const red = Number.parseInt(value.slice(0, 2), 16);
20
- const green = Number.parseInt(value.slice(2, 4), 16);
21
- const blue = Number.parseInt(value.slice(4, 6), 16);
22
- return `rgba(${red}, ${green}, ${blue}, ${alpha})`;
23
- };
24
- var isUiKitThemeTokens = (theme) => {
25
- return Boolean(theme && typeof theme === "object" && "theme" in theme);
26
- };
27
- var resolveTheme = (theme) => {
28
- var _a;
29
- const colorOverrides = isUiKitThemeTokens(theme) ? theme.theme.colors : (_a = theme == null ? void 0 : theme.colors) != null ? _a : {};
30
- const colors = {
31
- ...defaultThemeColors,
32
- ...colorOverrides
33
- };
34
- return {
35
- colors,
36
- borderSoft: isUiKitThemeTokens(theme) ? theme.borderSoft : withAlpha(colors.onSurface, 0.1),
37
- borderStrong: isUiKitThemeTokens(theme) ? theme.borderStrong : withAlpha(colors.onSurface, 0.16),
38
- surfaceMuted: isUiKitThemeTokens(theme) ? theme.surfaceMuted : withAlpha(colors.onSurface, 0.04),
39
- surfaceRaised: isUiKitThemeTokens(theme) ? theme.surfaceRaised : withAlpha(colors.surface, 0.94),
40
- overlay: isUiKitThemeTokens(theme) ? theme.overlay : withAlpha("#030712", 0.62),
41
- mutedText: isUiKitThemeTokens(theme) ? theme.mutedText : withAlpha(colors.onSurface, 0.72)
42
- };
43
- };
44
- var normalizeWidth = (maxWidth) => {
45
- if (typeof maxWidth === "number") {
46
- return `${maxWidth}px`;
47
- }
48
- return maxWidth != null ? maxWidth : "720px";
49
- };
50
- var isLikelyMobileViewport = () => {
51
- if (typeof window === "undefined" || typeof navigator === "undefined") {
52
- return false;
53
- }
54
- return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
55
- navigator.userAgent
56
- );
57
- };
58
- var createTitleId = (title) => {
59
- if (typeof title === "string" || typeof title === "number") {
60
- const normalized = String(title).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/(^-|-$)/g, "");
61
- return `smartsell-modal-${normalized || "dialog"}`;
62
- }
63
- return "smartsell-modal-dialog";
64
- };
65
- var isLegacyModalProps = (props) => {
66
- return "showModal" in props;
67
- };
68
- var normalizeLegacyAction = (action, fallbackDisabled = false) => {
69
- var _a, _b, _c;
70
- return {
71
- label: action.name,
72
- onClick: action.onClick,
73
- appearance: (_a = action.type) != null ? _a : "contained",
74
- style: (_b = action.style) != null ? _b : { maxWidth: "150px" },
75
- disabled: (_c = action.disable) != null ? _c : fallbackDisabled
76
- };
77
- };
78
- var normalizeModalProps = (props) => {
79
- var _a, _b;
80
- if (!isLegacyModalProps(props)) {
81
- return props;
82
- }
83
- const isBusy = Boolean(props.isLoading);
84
- const disableAction = Boolean(props.disableActionBtn || props.isLoading);
85
- return {
86
- isOpen: props.showModal,
87
- onClose: props.closeModal,
88
- title: props.title,
89
- children: props.children,
90
- theme: props.theme,
91
- maximized: props.maximized,
92
- contentStyle: props.style,
93
- bodyStyle: props.bodyStyle,
94
- hideCloseButton: props.hideCloseIcon,
95
- disableDismiss: isBusy,
96
- closeOnBackdrop: false,
97
- closeOnEscape: false,
98
- isBusy,
99
- closeAction: props.onlyCloseButton ? {
100
- label: "Close",
101
- onClick: props.closeModal,
102
- appearance: "contained",
103
- disabled: isBusy
104
- } : void 0,
105
- cancelAction: props.onlyCloseButton || !props.cancelButton ? void 0 : {
106
- label: "Cancel",
107
- onClick: props.cancelButton,
108
- appearance: "text",
109
- style: { maxWidth: "100px" }
110
- },
111
- confirmAction: props.onlyCloseButton || props.hideActionButton || !props.action ? void 0 : {
112
- label: (_a = props.actionNameBtn) != null ? _a : "Save",
113
- onClick: props.action,
114
- appearance: "contained",
115
- style: { maxWidth: "100px" },
116
- disabled: disableAction
117
- },
118
- extraActions: props.onlyCloseButton ? void 0 : (_b = props.additionalActions) == null ? void 0 : _b.map((action) => normalizeLegacyAction(action, disableAction))
119
- };
120
- };
121
- function ModalActionButton({
122
- action,
123
- theme
124
- }) {
125
- var _a, _b;
126
- const { colors } = theme;
127
- const {
128
- label,
129
- onClick,
130
- appearance = "contained",
131
- disabled = false,
132
- style
133
- } = action;
134
- const buttonStyle = {
135
- width: "100%",
136
- display: "flex",
137
- alignItems: "center",
138
- justifyContent: "center",
139
- borderRadius: "0.4rem",
140
- padding: appearance === "link" ? 0 : "1.3rem",
141
- boxSizing: "border-box",
142
- cursor: disabled ? "not-allowed" : "pointer",
143
- fontWeight: 700,
144
- fontSize: "1.3rem",
145
- margin: 0,
146
- textAlign: "center",
147
- transition: "0.5s",
148
- opacity: disabled ? 0.5 : 1,
149
- filter: disabled ? "saturate(0)" : void 0
150
- };
151
- if (appearance === "text") {
152
- buttonStyle.background = "none";
153
- buttonStyle.border = "1px solid transparent";
154
- buttonStyle.color = colors.primary;
155
- buttonStyle.boxShadow = "none";
156
- } else if (appearance === "link") {
157
- buttonStyle.background = "none";
158
- buttonStyle.border = "none";
159
- buttonStyle.color = colors.primary;
160
- buttonStyle.boxShadow = "none";
161
- } else if (appearance === "outlined") {
162
- buttonStyle.background = "none";
163
- buttonStyle.border = `2px solid ${colors.primary}`;
164
- buttonStyle.color = colors.primary;
165
- buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.onSurface, 0.08)}`;
166
- } else {
167
- buttonStyle.background = colors.primary;
168
- buttonStyle.border = "1px solid transparent";
169
- buttonStyle.color = colors.onPrimary;
170
- buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.primary, 0.22)}`;
171
- }
172
- return /* @__PURE__ */ jsx(
173
- "div",
174
- {
175
- style: {
176
- width: (_a = style == null ? void 0 : style.width) != null ? _a : (style == null ? void 0 : style.maxWidth) ? "100%" : "max-content",
177
- display: "flex",
178
- alignItems: "center",
179
- justifyContent: "center",
180
- margin: "0 5px",
181
- marginBottom: (_b = style == null ? void 0 : style.marginBottom) != null ? _b : 0,
182
- ...style
183
- },
184
- children: /* @__PURE__ */ jsx(
185
- "button",
186
- {
187
- type: "button",
188
- onClick: disabled ? void 0 : onClick,
189
- disabled,
190
- style: buttonStyle,
191
- children: label
192
- }
193
- )
194
- }
195
- );
196
- }
197
- function UnifiedModal({
198
- isOpen,
199
- onClose,
200
- children,
201
- title,
202
- description,
203
- headerContent,
204
- footer,
205
- confirmAction,
206
- cancelAction,
207
- closeAction,
208
- extraActions,
209
- maxWidth,
210
- closeOnBackdrop = true,
211
- closeOnEscape = true,
212
- hideCloseButton = false,
213
- hideExpandButton = false,
214
- disableDismiss = false,
215
- maximized,
216
- contentStyle,
217
- bodyStyle,
218
- isBusy = false,
219
- theme
220
- }) {
221
- var _a, _b;
222
- const modalTheme = useMemo(() => resolveTheme(theme), [theme]);
223
- const [isMaximized, setIsMaximized] = useState(maximized != null ? maximized : false);
224
- const titleId = useMemo(() => createTitleId(title), [title]);
225
- useEffect(() => {
226
- if (typeof maximized === "boolean") {
227
- setIsMaximized(maximized);
228
- return;
229
- }
230
- if (isLikelyMobileViewport()) {
231
- setIsMaximized(true);
232
- }
233
- }, [maximized]);
234
- useEffect(() => {
235
- if (!isOpen || typeof window === "undefined" || typeof document === "undefined") {
236
- return;
237
- }
238
- const previousOverflow = document.body.style.overflow;
239
- document.body.style.overflow = "hidden";
240
- const handleKeyDown = (event) => {
241
- if (!disableDismiss && closeOnEscape && event.key === "Escape") {
242
- onClose();
243
- }
244
- };
245
- window.addEventListener("keydown", handleKeyDown);
246
- return () => {
247
- document.body.style.overflow = previousOverflow;
248
- window.removeEventListener("keydown", handleKeyDown);
249
- };
250
- }, [closeOnEscape, disableDismiss, isOpen, onClose]);
251
- if (!isOpen) {
252
- return null;
253
- }
254
- const resolvedHeader = headerContent != null ? headerContent : /* @__PURE__ */ jsxs("div", { style: { display: "flex", flexDirection: "column", gap: 8 }, children: [
255
- title ? /* @__PURE__ */ jsx(
256
- "h2",
257
- {
258
- id: titleId,
259
- style: {
260
- margin: 0,
261
- color: modalTheme.colors.onSurface,
262
- fontSize: 30,
263
- fontWeight: 800,
264
- lineHeight: 1.1
265
- },
266
- children: title
267
- }
268
- ) : null,
269
- description ? /* @__PURE__ */ jsx(
270
- "p",
271
- {
272
- style: {
273
- margin: 0,
274
- color: modalTheme.mutedText,
275
- fontSize: 15,
276
- lineHeight: 1.6
277
- },
278
- children: description
279
- }
280
- ) : null
281
- ] });
282
- let footerContent = footer;
283
- if (footerContent === void 0) {
284
- if (closeAction && !closeAction.hidden) {
285
- footerContent = /* @__PURE__ */ jsx(ModalActionButton, { action: closeAction, theme: modalTheme });
286
- } else {
287
- const resolvedActions = [
288
- cancelAction ? { ...cancelAction, appearance: (_a = cancelAction.appearance) != null ? _a : "text" } : void 0,
289
- ...(extraActions != null ? extraActions : []).map((action) => {
290
- var _a2;
291
- return {
292
- ...action,
293
- appearance: (_a2 = action.appearance) != null ? _a2 : "contained"
294
- };
295
- }),
296
- confirmAction ? { ...confirmAction, appearance: (_b = confirmAction.appearance) != null ? _b : "contained" } : void 0
297
- ].reduce((items, action) => {
298
- if (!action || action.hidden) {
299
- return items;
300
- }
301
- items.push(action);
302
- return items;
303
- }, []);
304
- footerContent = resolvedActions.length > 0 ? resolvedActions.map((action, index) => /* @__PURE__ */ jsx(
305
- ModalActionButton,
306
- {
307
- action,
308
- theme: modalTheme
309
- },
310
- `modal-action-${index}`
311
- )) : void 0;
312
- }
313
- }
314
- const shouldRenderFooter = footerContent !== void 0 && footerContent !== null && footerContent !== false;
315
- return /* @__PURE__ */ jsx(
316
- "div",
317
- {
318
- "aria-label": headerContent ? typeof title === "string" ? title : "Dialog" : void 0,
319
- "aria-labelledby": headerContent ? void 0 : title ? titleId : void 0,
320
- "aria-modal": "true",
321
- role: "dialog",
322
- onMouseDown: (event) => {
323
- if (!disableDismiss && closeOnBackdrop && event.target === event.currentTarget) {
324
- onClose();
325
- }
326
- },
327
- style: {
328
- position: "fixed",
329
- inset: 0,
330
- zIndex: 70,
331
- display: "flex",
332
- alignItems: "center",
333
- justifyContent: "center",
334
- padding: isMaximized ? 0 : 16,
335
- backgroundColor: modalTheme.overlay,
336
- backdropFilter: "blur(8px)"
337
- },
338
- children: /* @__PURE__ */ jsxs(
339
- "div",
340
- {
341
- id: isBusy ? "ldg1" : void 0,
342
- style: {
343
- position: "relative",
344
- display: "flex",
345
- flexDirection: "column",
346
- width: isMaximized ? "100vw" : "min(100%, 100%)",
347
- maxWidth: isMaximized ? "100vw" : normalizeWidth(maxWidth),
348
- height: isMaximized ? "100vh" : void 0,
349
- maxHeight: isMaximized ? "100vh" : "calc(100vh - 32px)",
350
- minWidth: isMaximized ? "100vw" : 300,
351
- borderRadius: isMaximized ? 0 : 30,
352
- border: `1px solid ${modalTheme.borderSoft}`,
353
- background: `linear-gradient(180deg, ${modalTheme.surfaceRaised}, ${modalTheme.colors.surface})`,
354
- boxShadow: `0 34px 80px ${withAlpha("#020617", 0.28)}`,
355
- color: modalTheme.colors.onSurface,
356
- overflow: "hidden",
357
- opacity: isBusy ? 0.5 : 1,
358
- ...contentStyle
359
- },
360
- children: [
361
- /* @__PURE__ */ jsxs(
362
- "div",
363
- {
364
- style: {
365
- display: "flex",
366
- alignItems: "flex-start",
367
- justifyContent: "space-between",
368
- gap: 16,
369
- padding: "24px 24px 16px",
370
- borderBottom: `1px solid ${withAlpha(modalTheme.colors.onSurface, 0.06)}`
371
- },
372
- children: [
373
- /* @__PURE__ */ jsx("div", { style: { flex: 1 }, children: resolvedHeader }),
374
- /* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", gap: 10 }, children: [
375
- !hideExpandButton ? /* @__PURE__ */ jsx(
376
- "button",
377
- {
378
- "aria-label": isMaximized ? "Minimize modal" : "Maximize modal",
379
- title: isMaximized ? "Minimize" : "Maximize",
380
- type: "button",
381
- onClick: () => setIsMaximized((current) => !current),
382
- style: {
383
- height: 42,
384
- width: 42,
385
- borderRadius: 999,
386
- border: `1px solid ${modalTheme.borderSoft}`,
387
- backgroundColor: "transparent",
388
- color: modalTheme.colors.onSurface,
389
- cursor: "pointer",
390
- fontSize: 18,
391
- fontWeight: 700
392
- },
393
- children: isMaximized ? "\u25A2" : "\u25A1"
394
- }
395
- ) : null,
396
- !hideCloseButton ? /* @__PURE__ */ jsx(
397
- "button",
398
- {
399
- "aria-label": "Close modal",
400
- type: "button",
401
- onClick: disableDismiss ? void 0 : onClose,
402
- style: {
403
- height: 42,
404
- width: 42,
405
- borderRadius: 999,
406
- border: `1px solid ${modalTheme.borderSoft}`,
407
- backgroundColor: "transparent",
408
- color: modalTheme.colors.onSurface,
409
- cursor: disableDismiss ? "not-allowed" : "pointer",
410
- fontSize: 20,
411
- fontWeight: 700,
412
- opacity: disableDismiss ? 0.5 : 1
413
- },
414
- children: "\xD7"
415
- }
416
- ) : null
417
- ] })
418
- ]
419
- }
420
- ),
421
- /* @__PURE__ */ jsx(
422
- "div",
423
- {
424
- style: {
425
- flex: 1,
426
- minHeight: 0,
427
- overflow: "auto",
428
- padding: 24,
429
- ...bodyStyle
430
- },
431
- children
432
- }
433
- ),
434
- shouldRenderFooter ? /* @__PURE__ */ jsx(
435
- "div",
436
- {
437
- style: {
438
- display: "flex",
439
- justifyContent: "flex-end",
440
- gap: 12,
441
- padding: "16px 24px 24px",
442
- borderTop: `1px solid ${withAlpha(modalTheme.colors.onSurface, 0.06)}`
443
- },
444
- children: footerContent
445
- }
446
- ) : null
447
- ]
448
- }
449
- )
450
- }
451
- );
452
- }
453
- function Modal(props) {
454
- return /* @__PURE__ */ jsx(UnifiedModal, { ...normalizeModalProps(props) });
455
- }
456
-
457
- export {
458
- Modal
459
- };
460
- //# sourceMappingURL=chunk-UIFTQDYM.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/components/Modal.tsx"],"sourcesContent":["import { useEffect, useMemo, useState } from 'react';\nimport type { CSSProperties, ReactNode } from 'react';\n\nimport type { UiKitThemeTokens } from '../theme';\n\ntype ModalActionAppearance = 'text' | 'outlined' | 'contained' | 'link';\n\ntype ModalThemeColors = {\n background: string;\n surface: string;\n onSurface: string;\n onBackground: string;\n primary: string;\n onPrimary: string;\n secondary: string;\n onSecondary: string;\n negative: string;\n warning: string;\n};\n\nexport interface ModalTheme {\n colors?: Partial<ModalThemeColors>;\n}\n\nexport type ModalThemeSource = ModalTheme | UiKitThemeTokens;\n\nexport interface ModalAction {\n label: ReactNode;\n onClick: () => void;\n appearance?: ModalActionAppearance;\n style?: CSSProperties;\n disabled?: boolean;\n hidden?: boolean;\n}\n\ninterface BaseModalProps {\n children?: ReactNode;\n theme?: ModalThemeSource;\n}\n\nexport interface ModalProps extends BaseModalProps {\n isOpen: boolean;\n onClose: () => void;\n title?: ReactNode;\n description?: ReactNode;\n headerContent?: ReactNode;\n footer?: ReactNode;\n confirmAction?: ModalAction;\n cancelAction?: ModalAction;\n closeAction?: ModalAction;\n extraActions?: ModalAction[];\n maxWidth?: number | string;\n closeOnBackdrop?: boolean;\n closeOnEscape?: boolean;\n hideCloseButton?: boolean;\n hideExpandButton?: boolean;\n disableDismiss?: boolean;\n maximized?: boolean;\n contentStyle?: CSSProperties;\n bodyStyle?: CSSProperties;\n isBusy?: boolean;\n}\n\nexport interface LegacyModalAction {\n name: string;\n onClick: () => void;\n type?: ModalActionAppearance;\n style?: CSSProperties;\n disable?: boolean;\n}\n\nexport interface LegacyModalCompatProps extends BaseModalProps {\n title: ReactNode;\n showModal: boolean;\n closeModal: () => void;\n action?: () => void;\n actionNameBtn?: string | undefined;\n hideActionButton?: boolean;\n cancelButton?: () => void;\n disableActionBtn?: boolean;\n isLoading?: boolean;\n onlyCloseButton?: boolean;\n hideCloseIcon?: boolean;\n style?: CSSProperties;\n bodyStyle?: CSSProperties;\n additionalActions?: LegacyModalAction[];\n maximized?: boolean;\n}\n\nexport type LegacyModalProps = LegacyModalCompatProps;\nexport type StandardModalProps = ModalProps;\n\ntype ModalInputProps = ModalProps | LegacyModalCompatProps;\n\nconst defaultThemeColors: ModalThemeColors = {\n background: '#f8fafc',\n surface: '#ffffff',\n onSurface: '#0f172a',\n onBackground: '#0f172a',\n primary: '#0f766e',\n onPrimary: '#ffffff',\n secondary: '#1d4ed8',\n onSecondary: '#ffffff',\n negative: '#dc2626',\n warning: '#d97706',\n};\n\nconst withAlpha = (hex: string, alpha: number): string => {\n const normalized = hex.replace('#', '').trim();\n const value = normalized.length === 3\n ? normalized.split('').map((char) => char + char).join('')\n : normalized;\n\n const red = Number.parseInt(value.slice(0, 2), 16);\n const green = Number.parseInt(value.slice(2, 4), 16);\n const blue = Number.parseInt(value.slice(4, 6), 16);\n\n return `rgba(${red}, ${green}, ${blue}, ${alpha})`;\n};\n\nconst isUiKitThemeTokens = (theme?: ModalThemeSource): theme is UiKitThemeTokens => {\n return Boolean(theme && typeof theme === 'object' && 'theme' in theme);\n};\n\nconst resolveTheme = (theme?: ModalThemeSource) => {\n const colorOverrides = isUiKitThemeTokens(theme)\n ? theme.theme.colors\n : (theme?.colors ?? {});\n\n const colors: ModalThemeColors = {\n ...defaultThemeColors,\n ...colorOverrides,\n };\n\n return {\n colors,\n borderSoft: isUiKitThemeTokens(theme)\n ? theme.borderSoft\n : withAlpha(colors.onSurface, 0.1),\n borderStrong: isUiKitThemeTokens(theme)\n ? theme.borderStrong\n : withAlpha(colors.onSurface, 0.16),\n surfaceMuted: isUiKitThemeTokens(theme)\n ? theme.surfaceMuted\n : withAlpha(colors.onSurface, 0.04),\n surfaceRaised: isUiKitThemeTokens(theme)\n ? theme.surfaceRaised\n : withAlpha(colors.surface, 0.94),\n overlay: isUiKitThemeTokens(theme)\n ? theme.overlay\n : withAlpha('#030712', 0.62),\n mutedText: isUiKitThemeTokens(theme)\n ? theme.mutedText\n : withAlpha(colors.onSurface, 0.72),\n };\n};\n\nconst normalizeWidth = (maxWidth?: number | string): string | number => {\n if (typeof maxWidth === 'number') {\n return `${maxWidth}px`;\n }\n\n return maxWidth ?? '720px';\n};\n\nconst isLikelyMobileViewport = (): boolean => {\n if (typeof window === 'undefined' || typeof navigator === 'undefined') {\n return false;\n }\n\n return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(\n navigator.userAgent,\n );\n};\n\nconst createTitleId = (title?: ReactNode): string => {\n if (typeof title === 'string' || typeof title === 'number') {\n const normalized = String(title)\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/(^-|-$)/g, '');\n\n return `smartsell-modal-${normalized || 'dialog'}`;\n }\n\n return 'smartsell-modal-dialog';\n};\n\nconst isLegacyModalProps = (props: ModalInputProps): props is LegacyModalCompatProps => {\n return 'showModal' in props;\n};\n\nconst normalizeLegacyAction = (\n action: LegacyModalAction,\n fallbackDisabled = false,\n): ModalAction => {\n return {\n label: action.name,\n onClick: action.onClick,\n appearance: action.type ?? 'contained',\n style: action.style ?? { maxWidth: '150px' },\n disabled: action.disable ?? fallbackDisabled,\n };\n};\n\nconst normalizeModalProps = (props: ModalInputProps): ModalProps => {\n if (!isLegacyModalProps(props)) {\n return props;\n }\n\n const isBusy = Boolean(props.isLoading);\n const disableAction = Boolean(props.disableActionBtn || props.isLoading);\n\n return {\n isOpen: props.showModal,\n onClose: props.closeModal,\n title: props.title,\n children: props.children,\n theme: props.theme,\n maximized: props.maximized,\n contentStyle: props.style,\n bodyStyle: props.bodyStyle,\n hideCloseButton: props.hideCloseIcon,\n disableDismiss: isBusy,\n closeOnBackdrop: false,\n closeOnEscape: false,\n isBusy,\n closeAction: props.onlyCloseButton\n ? {\n label: 'Close',\n onClick: props.closeModal,\n appearance: 'contained',\n disabled: isBusy,\n }\n : undefined,\n cancelAction: props.onlyCloseButton || !props.cancelButton\n ? undefined\n : {\n label: 'Cancel',\n onClick: props.cancelButton,\n appearance: 'text',\n style: { maxWidth: '100px' },\n },\n confirmAction: props.onlyCloseButton || props.hideActionButton || !props.action\n ? undefined\n : {\n label: props.actionNameBtn ?? 'Save',\n onClick: props.action,\n appearance: 'contained',\n style: { maxWidth: '100px' },\n disabled: disableAction,\n },\n extraActions: props.onlyCloseButton\n ? undefined\n : props.additionalActions?.map((action) => normalizeLegacyAction(action, disableAction)),\n };\n};\n\nfunction ModalActionButton({\n action,\n theme,\n}: {\n action: ModalAction;\n theme: ReturnType<typeof resolveTheme>;\n}) {\n const { colors } = theme;\n const {\n label,\n onClick,\n appearance = 'contained',\n disabled = false,\n style,\n } = action;\n\n const buttonStyle: CSSProperties = {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n borderRadius: '0.4rem',\n padding: appearance === 'link' ? 0 : '1.3rem',\n boxSizing: 'border-box',\n cursor: disabled ? 'not-allowed' : 'pointer',\n fontWeight: 700,\n fontSize: '1.3rem',\n margin: 0,\n textAlign: 'center',\n transition: '0.5s',\n opacity: disabled ? 0.5 : 1,\n filter: disabled ? 'saturate(0)' : undefined,\n };\n\n if (appearance === 'text') {\n buttonStyle.background = 'none';\n buttonStyle.border = '1px solid transparent';\n buttonStyle.color = colors.primary;\n buttonStyle.boxShadow = 'none';\n } else if (appearance === 'link') {\n buttonStyle.background = 'none';\n buttonStyle.border = 'none';\n buttonStyle.color = colors.primary;\n buttonStyle.boxShadow = 'none';\n } else if (appearance === 'outlined') {\n buttonStyle.background = 'none';\n buttonStyle.border = `2px solid ${colors.primary}`;\n buttonStyle.color = colors.primary;\n buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.onSurface, 0.08)}`;\n } else {\n buttonStyle.background = colors.primary;\n buttonStyle.border = '1px solid transparent';\n buttonStyle.color = colors.onPrimary;\n buttonStyle.boxShadow = `0 14px 28px ${withAlpha(colors.primary, 0.22)}`;\n }\n\n return (\n <div\n style={{\n width: style?.width ?? (style?.maxWidth ? '100%' : 'max-content'),\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n margin: '0 5px',\n marginBottom: style?.marginBottom ?? 0,\n ...style,\n }}\n >\n <button\n type=\"button\"\n onClick={disabled ? undefined : onClick}\n disabled={disabled}\n style={buttonStyle}\n >\n {label}\n </button>\n </div>\n );\n}\n\nfunction UnifiedModal({\n isOpen,\n onClose,\n children,\n title,\n description,\n headerContent,\n footer,\n confirmAction,\n cancelAction,\n closeAction,\n extraActions,\n maxWidth,\n closeOnBackdrop = true,\n closeOnEscape = true,\n hideCloseButton = false,\n hideExpandButton = false,\n disableDismiss = false,\n maximized,\n contentStyle,\n bodyStyle,\n isBusy = false,\n theme,\n}: ModalProps) {\n const modalTheme = useMemo(() => resolveTheme(theme), [theme]);\n const [isMaximized, setIsMaximized] = useState<boolean>(maximized ?? false);\n const titleId = useMemo(() => createTitleId(title), [title]);\n\n useEffect(() => {\n if (typeof maximized === 'boolean') {\n setIsMaximized(maximized);\n return;\n }\n\n if (isLikelyMobileViewport()) {\n setIsMaximized(true);\n }\n }, [maximized]);\n\n useEffect(() => {\n if (!isOpen || typeof window === 'undefined' || typeof document === 'undefined') {\n return;\n }\n\n const previousOverflow = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (!disableDismiss && closeOnEscape && event.key === 'Escape') {\n onClose();\n }\n };\n\n window.addEventListener('keydown', handleKeyDown);\n\n return () => {\n document.body.style.overflow = previousOverflow;\n window.removeEventListener('keydown', handleKeyDown);\n };\n }, [closeOnEscape, disableDismiss, isOpen, onClose]);\n\n if (!isOpen) {\n return null;\n }\n\n const resolvedHeader = headerContent ?? (\n <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>\n {title ? (\n <h2\n id={titleId}\n style={{\n margin: 0,\n color: modalTheme.colors.onSurface,\n fontSize: 30,\n fontWeight: 800,\n lineHeight: 1.1,\n }}\n >\n {title}\n </h2>\n ) : null}\n {description ? (\n <p\n style={{\n margin: 0,\n color: modalTheme.mutedText,\n fontSize: 15,\n lineHeight: 1.6,\n }}\n >\n {description}\n </p>\n ) : null}\n </div>\n );\n\n let footerContent = footer;\n\n if (footerContent === undefined) {\n if (closeAction && !closeAction.hidden) {\n footerContent = <ModalActionButton action={closeAction} theme={modalTheme} />;\n } else {\n const resolvedActions = [\n cancelAction\n ? { ...cancelAction, appearance: cancelAction.appearance ?? 'text' }\n : undefined,\n ...(extraActions ?? []).map((action) => ({\n ...action,\n appearance: action.appearance ?? 'contained',\n })),\n confirmAction\n ? { ...confirmAction, appearance: confirmAction.appearance ?? 'contained' }\n : undefined,\n ].reduce<ModalAction[]>((items, action) => {\n if (!action || action.hidden) {\n return items;\n }\n\n items.push(action);\n return items;\n }, []);\n\n footerContent = resolvedActions.length > 0\n ? resolvedActions.map((action, index) => (\n <ModalActionButton\n key={`modal-action-${index}`}\n action={action}\n theme={modalTheme}\n />\n ))\n : undefined;\n }\n }\n\n const shouldRenderFooter = footerContent !== undefined && footerContent !== null && footerContent !== false;\n\n return (\n <div\n aria-label={headerContent ? (typeof title === 'string' ? title : 'Dialog') : undefined}\n aria-labelledby={headerContent ? undefined : title ? titleId : undefined}\n aria-modal=\"true\"\n role=\"dialog\"\n onMouseDown={(event) => {\n if (!disableDismiss && closeOnBackdrop && event.target === event.currentTarget) {\n onClose();\n }\n }}\n style={{\n position: 'fixed',\n inset: 0,\n zIndex: 70,\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: isMaximized ? 0 : 16,\n backgroundColor: modalTheme.overlay,\n backdropFilter: 'blur(8px)',\n }}\n >\n <div\n id={isBusy ? 'ldg1' : undefined}\n style={{\n position: 'relative',\n display: 'flex',\n flexDirection: 'column',\n width: isMaximized ? '100vw' : 'min(100%, 100%)',\n maxWidth: isMaximized ? '100vw' : normalizeWidth(maxWidth),\n height: isMaximized ? '100vh' : undefined,\n maxHeight: isMaximized ? '100vh' : 'calc(100vh - 32px)',\n minWidth: isMaximized ? '100vw' : 300,\n borderRadius: isMaximized ? 0 : 30,\n border: `1px solid ${modalTheme.borderSoft}`,\n background: `linear-gradient(180deg, ${modalTheme.surfaceRaised}, ${modalTheme.colors.surface})`,\n boxShadow: `0 34px 80px ${withAlpha('#020617', 0.28)}`,\n color: modalTheme.colors.onSurface,\n overflow: 'hidden',\n opacity: isBusy ? 0.5 : 1,\n ...contentStyle,\n }}\n >\n <div\n style={{\n display: 'flex',\n alignItems: 'flex-start',\n justifyContent: 'space-between',\n gap: 16,\n padding: '24px 24px 16px',\n borderBottom: `1px solid ${withAlpha(modalTheme.colors.onSurface, 0.06)}`,\n }}\n >\n <div style={{ flex: 1 }}>{resolvedHeader}</div>\n <div style={{ display: 'flex', alignItems: 'center', gap: 10 }}>\n {!hideExpandButton ? (\n <button\n aria-label={isMaximized ? 'Minimize modal' : 'Maximize modal'}\n title={isMaximized ? 'Minimize' : 'Maximize'}\n type=\"button\"\n onClick={() => setIsMaximized((current) => !current)}\n style={{\n height: 42,\n width: 42,\n borderRadius: 999,\n border: `1px solid ${modalTheme.borderSoft}`,\n backgroundColor: 'transparent',\n color: modalTheme.colors.onSurface,\n cursor: 'pointer',\n fontSize: 18,\n fontWeight: 700,\n }}\n >\n {isMaximized ? '▢' : '□'}\n </button>\n ) : null}\n {!hideCloseButton ? (\n <button\n aria-label=\"Close modal\"\n type=\"button\"\n onClick={disableDismiss ? undefined : onClose}\n style={{\n height: 42,\n width: 42,\n borderRadius: 999,\n border: `1px solid ${modalTheme.borderSoft}`,\n backgroundColor: 'transparent',\n color: modalTheme.colors.onSurface,\n cursor: disableDismiss ? 'not-allowed' : 'pointer',\n fontSize: 20,\n fontWeight: 700,\n opacity: disableDismiss ? 0.5 : 1,\n }}\n >\n ×\n </button>\n ) : null}\n </div>\n </div>\n\n <div\n style={{\n flex: 1,\n minHeight: 0,\n overflow: 'auto',\n padding: 24,\n ...bodyStyle,\n }}\n >\n {children}\n </div>\n\n {shouldRenderFooter ? (\n <div\n style={{\n display: 'flex',\n justifyContent: 'flex-end',\n gap: 12,\n padding: '16px 24px 24px',\n borderTop: `1px solid ${withAlpha(modalTheme.colors.onSurface, 0.06)}`,\n }}\n >\n {footerContent}\n </div>\n ) : null}\n </div>\n </div>\n );\n}\n\nexport function Modal(props: ModalInputProps) {\n return <Unified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