@caratlogic/design-system 0.1.19 → 0.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/molecules/CustomCombobox/CustomCombobox.d.ts +1 -1
- package/dist/components/molecules/CustomCombobox/CustomCombobox.d.ts.map +1 -1
- package/dist/components/molecules/CustomCombobox/CustomCombobox.types.d.ts +2 -0
- package/dist/components/molecules/CustomCombobox/CustomCombobox.types.d.ts.map +1 -1
- package/dist/components/molecules/DataEditableTable/DataEditableTable.d.ts +1 -1
- package/dist/components/molecules/DataEditableTable/DataEditableTable.d.ts.map +1 -1
- package/dist/components/molecules/DataEditableTable/DataEditableTable.types.d.ts +2 -0
- package/dist/components/molecules/DataEditableTable/DataEditableTable.types.d.ts.map +1 -1
- package/dist/components/molecules/ShareModal/ShareModal.d.ts.map +1 -1
- package/dist/components/molecules/ShareModal/ShareModal.types.d.ts +12 -0
- package/dist/components/molecules/ShareModal/ShareModal.types.d.ts.map +1 -1
- package/dist/components/molecules/ShareModal/ShareModal.utils.d.ts +7 -0
- package/dist/components/molecules/ShareModal/ShareModal.utils.d.ts.map +1 -1
- package/dist/components/molecules/ShareModal/index.d.ts +2 -1
- package/dist/components/molecules/ShareModal/index.d.ts.map +1 -1
- package/dist/components/ui/select.d.ts +3 -1
- package/dist/components/ui/select.d.ts.map +1 -1
- package/dist/index.cjs.js +102 -78
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +102 -79
- package/dist/index.esm.js.map +1 -1
- package/dist/ui.cjs.js +4 -2
- package/dist/ui.cjs.js.map +1 -1
- package/dist/ui.esm.js +4 -2
- package/dist/ui.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.esm.js
CHANGED
|
@@ -21178,9 +21178,9 @@ function useSelectedComboboxOption(value, options) {
|
|
|
21178
21178
|
}, [normalizedValue, options]);
|
|
21179
21179
|
}
|
|
21180
21180
|
|
|
21181
|
-
function CustomCombobox({ options, placeholder = 'Select option...', value, onChange, className, }) {
|
|
21181
|
+
function CustomCombobox({ options, placeholder = 'Select option...', value, onChange, className, emptyMessage = 'No option found.', }) {
|
|
21182
21182
|
const selectedItem = useSelectedComboboxOption(value, options);
|
|
21183
|
-
return (jsx(SearchableSelect, { selectedItem: selectedItem, onChange: (opt) => onChange(opt.label), getOptionKey: (o) => o.value, getOptionLabel: (o) => o.label, options: options, searchPlaceholder: placeholder, emptyMessage:
|
|
21183
|
+
return (jsx(SearchableSelect, { selectedItem: selectedItem, onChange: (opt) => onChange(opt.label), getOptionKey: (o) => o.value, getOptionLabel: (o) => o.label, options: options, searchPlaceholder: placeholder, emptyMessage: emptyMessage, className: className }));
|
|
21184
21184
|
}
|
|
21185
21185
|
|
|
21186
21186
|
function useExpandableRows() {
|
|
@@ -21579,7 +21579,7 @@ function EditableCellContent({ col, row, value, isEditing, width, onEditValueCha
|
|
|
21579
21579
|
return jsx(Fragment$2, { children: clipToWidth(stringValue, width) });
|
|
21580
21580
|
}
|
|
21581
21581
|
|
|
21582
|
-
function DataEditableTable({ data, columns, onRowClick, enableSelection = false, columnStyles = {}, onEditChange, onSaveRow, sortBy, setSortBy, sortOrder, setSortOrder, saving, selectedRows = [], onSelectionChange, isArchiveView = false, selectionInArchiveView = false, permissionKey = '', columnWidths, onColumnResize, pagination, fetchBusinessContacts, showGrid = true, }) {
|
|
21582
|
+
function DataEditableTable({ data, columns, onRowClick, enableSelection = false, columnStyles = {}, onEditChange, onSaveRow, sortBy, setSortBy, sortOrder, setSortOrder, saving, selectedRows = [], onSelectionChange, isArchiveView = false, selectionInArchiveView = false, permissionKey = '', columnWidths, onColumnResize, pagination, fetchBusinessContacts, showGrid = true, emptyState, }) {
|
|
21583
21583
|
const showSelectionColumn = enableSelection && (!isArchiveView || selectionInArchiveView);
|
|
21584
21584
|
const vBorder = showGrid ? 'border-r' : '';
|
|
21585
21585
|
const { localWidths, draggingKey, tableRef, handleResizeMouseDown } = useColumnResize({
|
|
@@ -21603,77 +21603,73 @@ function DataEditableTable({ data, columns, onRowClick, enableSelection = false,
|
|
|
21603
21603
|
setSortOrder('asc');
|
|
21604
21604
|
}
|
|
21605
21605
|
};
|
|
21606
|
-
return (jsxs("div", { className: "w-full h-full rounded-lg border border-border bg-card flex flex-col overflow-hidden", children: [
|
|
21607
|
-
|
|
21608
|
-
|
|
21609
|
-
|
|
21610
|
-
|
|
21611
|
-
const w = localWidths[col.key];
|
|
21612
|
-
const isDragging = draggingKey === col.key;
|
|
21613
|
-
const isPinnedRight = col.key === 'actions';
|
|
21614
|
-
const thStyle = w || isDragging
|
|
21615
|
-
? {
|
|
21616
|
-
width: `var(--col-w-${col.key})`,
|
|
21617
|
-
minWidth: `var(--col-w-${col.key})`,
|
|
21618
|
-
maxWidth: `var(--col-w-${col.key})`,
|
|
21619
|
-
}
|
|
21620
|
-
: isPinnedRight
|
|
21621
|
-
? { width: '72px', minWidth: '72px', maxWidth: '72px' }
|
|
21622
|
-
: undefined;
|
|
21623
|
-
return (jsxs("th", { className: cn('px-4 py-1.5 relative first:!pl-6 text-left whitespace-nowrap font-semibold text-sm border-b border-solid !border-border', vBorder, isArchiveView && !isPinnedRight && 'pl-1', col.sortable && '!cursor-pointer hover:bg-muted/60', isDragging && 'bg-primary/10', isPinnedRight && pinnedHeaderClass()), style: thStyle, onClick: () => handleColumnClick(col.key, col.sortable), children: [jsxs("div", { className: cn('gap-2', w && 'overflow-hidden', col.sortable && 'flex items-center !cursor-pointer', isPinnedRight && 'flex items-center justify-center'), children: [w && typeof col.header === 'string' ? (jsx("span", { className: "truncate", title: col.header, children: col.header })) : (col.header), col.sortable && (jsx(SortIcon, { active: sortBy === col.key, order: sortOrder }))] }), jsx("div", { className: cn('absolute right-0 top-0 h-full w-1.5 z-20 cursor-col-resize select-none transition-colors hover:bg-primary/40', isDragging && 'bg-primary/40'), onMouseDown: (e) => handleResizeMouseDown(e, col.key), onClick: (e) => e.stopPropagation() })] }, col.key.toString()));
|
|
21624
|
-
})] }) }), jsx("tbody", { children: data.length === 0 ? (jsx("tr", { className: "h-12", children: jsx("td", { colSpan: columns.length +
|
|
21625
|
-
(!isArchiveView ? 1 : 0) +
|
|
21626
|
-
(showSelectionColumn ? 1 : 0), className: "text-center p-6 text-muted-foreground", children: "No data available" }) })) : (data.map((row, rowIndex) => {
|
|
21627
|
-
const isEditing = editingRow === row.id && editingRow !== null;
|
|
21628
|
-
const isSaving = savingRow === row.id;
|
|
21629
|
-
const isSelected = selectedSet.has(row.id);
|
|
21630
|
-
const bgClass = isEditing
|
|
21631
|
-
? 'bg-warning/10 hover:bg-warning/10'
|
|
21632
|
-
: isSelected
|
|
21633
|
-
? 'bg-primary/10 hover:bg-primary/10'
|
|
21634
|
-
: rowIndex % 2 === 0
|
|
21635
|
-
? 'bg-card hover:bg-secondary'
|
|
21636
|
-
: 'bg-background hover:bg-secondary';
|
|
21637
|
-
return (jsxs("tr", { className: cn('group/row h-[46px] transition-colors text-sm text-table-cell', bgClass, onRowClick && 'cursor-pointer'), onClick: () => onRowClick?.(row), children: [isArchiveView ? null : (jsx("td", { className: cn('px-3 py-1.5 text-center first:!pl-6 border-b border-solid !border-border', vBorder), children: jsx(Protected, { module: permissionKey, minLevel: PERMISSIONS.WRITE, children: jsx("button", { onClick: (e) => {
|
|
21638
|
-
e.stopPropagation();
|
|
21639
|
-
handleEditIconClick(row.id, row);
|
|
21640
|
-
}, disabled: isSaving, className: cn('p-1 rounded hover:bg-primary/20 transition-colors !cursor-pointer', isEditing
|
|
21641
|
-
? 'text-success'
|
|
21642
|
-
: 'text-muted-foreground'), children: isSaving ? (jsx(LoaderCircle, { size: 16, className: "animate-spin text-primary" })) : isEditing ? (jsx(Check, { size: 16 })) : (jsx(Pencil, { size: 16 })) }) }) })), showSelectionColumn && (jsx("td", { className: cn('px-3 py-1.5 first:!pl-6 border-b border-solid !border-border', vBorder), onClick: (e) => e.stopPropagation(), children: jsx(Checkbox, { checked: isSelected, onCheckedChange: () => toggleRow(row.id) }) })), columns.map((col) => {
|
|
21643
|
-
const value = isEditing
|
|
21644
|
-
? editValues[col.key]
|
|
21645
|
-
: row[col.key];
|
|
21606
|
+
return (jsxs("div", { className: "w-full h-full rounded-lg border border-border bg-card flex flex-col overflow-hidden", children: [jsxs("div", { className: "overflow-auto flex-1", children: [jsxs("table", { ref: tableRef, className: "min-w-[70vh] w-full text-xs text-center border-separate", style: { borderSpacing: 0 }, children: [jsx("thead", { className: "sticky top-0 z-20 !bg-table-header border-b border-border text-secondary-foreground text-sm", children: jsxs("tr", { className: "h-[40px]", children: [!isArchiveView && (jsx("th", { className: cn('px-3 py-1.5 text-left font-semibold w-8 first:!pl-6 border-b border-solid !border-border', vBorder) })), showSelectionColumn && (jsx("th", { className: cn('px-3 py-1.5 text-center font-semibold first:!pl-6 border-b border-solid !border-border', vBorder), children: jsx(Checkbox, { checked: allSelected
|
|
21607
|
+
? true
|
|
21608
|
+
: someSelected
|
|
21609
|
+
? 'indeterminate'
|
|
21610
|
+
: false, onCheckedChange: toggleSelectAll }) })), columns.map((col) => {
|
|
21646
21611
|
const w = localWidths[col.key];
|
|
21612
|
+
const isDragging = draggingKey === col.key;
|
|
21647
21613
|
const isPinnedRight = col.key === 'actions';
|
|
21648
|
-
const
|
|
21614
|
+
const thStyle = w || isDragging
|
|
21649
21615
|
? {
|
|
21650
21616
|
width: `var(--col-w-${col.key})`,
|
|
21651
21617
|
minWidth: `var(--col-w-${col.key})`,
|
|
21652
21618
|
maxWidth: `var(--col-w-${col.key})`,
|
|
21653
21619
|
}
|
|
21654
21620
|
: isPinnedRight
|
|
21621
|
+
? { width: '72px', minWidth: '72px', maxWidth: '72px' }
|
|
21622
|
+
: undefined;
|
|
21623
|
+
return (jsxs("th", { className: cn('px-4 py-1.5 relative first:!pl-6 text-left whitespace-nowrap font-semibold text-sm border-b border-solid !border-border', vBorder, isArchiveView && !isPinnedRight && 'pl-1', col.sortable && '!cursor-pointer hover:bg-muted/60', isDragging && 'bg-primary/10', isPinnedRight && pinnedHeaderClass()), style: thStyle, onClick: () => handleColumnClick(col.key, col.sortable), children: [jsxs("div", { className: cn('gap-2', w && 'overflow-hidden', col.sortable && 'flex items-center !cursor-pointer', isPinnedRight && 'flex items-center justify-center'), children: [w && typeof col.header === 'string' ? (jsx("span", { className: "truncate", title: col.header, children: col.header })) : (col.header), col.sortable && (jsx(SortIcon, { active: sortBy === col.key, order: sortOrder }))] }), jsx("div", { className: cn('absolute right-0 top-0 h-full w-1.5 z-20 cursor-col-resize select-none transition-colors hover:bg-primary/40', isDragging && 'bg-primary/40'), onMouseDown: (e) => handleResizeMouseDown(e, col.key), onClick: (e) => e.stopPropagation() })] }, col.key.toString()));
|
|
21624
|
+
})] }) }), jsx("tbody", { children: data.map((row, rowIndex) => {
|
|
21625
|
+
const isEditing = editingRow === row.id && editingRow !== null;
|
|
21626
|
+
const isSaving = savingRow === row.id;
|
|
21627
|
+
const isSelected = selectedSet.has(row.id);
|
|
21628
|
+
const bgClass = isEditing
|
|
21629
|
+
? 'bg-warning/10 hover:bg-warning/10'
|
|
21630
|
+
: isSelected
|
|
21631
|
+
? 'bg-primary/10 hover:bg-primary/10'
|
|
21632
|
+
: rowIndex % 2 === 0
|
|
21633
|
+
? 'bg-card hover:bg-secondary'
|
|
21634
|
+
: 'bg-background hover:bg-secondary';
|
|
21635
|
+
return (jsxs("tr", { className: cn('group/row h-[46px] transition-colors text-sm text-table-cell', bgClass, onRowClick && 'cursor-pointer'), onClick: () => onRowClick?.(row), children: [isArchiveView ? null : (jsx("td", { className: cn('px-3 py-1.5 text-center first:!pl-6 border-b border-solid !border-border', vBorder), children: jsx(Protected, { module: permissionKey, minLevel: PERMISSIONS.WRITE, children: jsx("button", { onClick: (e) => {
|
|
21636
|
+
e.stopPropagation();
|
|
21637
|
+
handleEditIconClick(row.id, row);
|
|
21638
|
+
}, disabled: isSaving, className: cn('p-1 rounded hover:bg-primary/20 transition-colors !cursor-pointer', isEditing ? 'text-success' : 'text-muted-foreground'), children: isSaving ? (jsx(LoaderCircle, { size: 16, className: "animate-spin text-primary" })) : isEditing ? (jsx(Check, { size: 16 })) : (jsx(Pencil, { size: 16 })) }) }) })), showSelectionColumn && (jsx("td", { className: cn('px-3 py-1.5 first:!pl-6 border-b border-solid !border-border', vBorder), onClick: (e) => e.stopPropagation(), children: jsx(Checkbox, { checked: isSelected, onCheckedChange: () => toggleRow(row.id) }) })), columns.map((col) => {
|
|
21639
|
+
const value = isEditing
|
|
21640
|
+
? editValues[col.key]
|
|
21641
|
+
: row[col.key];
|
|
21642
|
+
const w = localWidths[col.key];
|
|
21643
|
+
const isPinnedRight = col.key === 'actions';
|
|
21644
|
+
const tdStyle = w || draggingKey === col.key
|
|
21655
21645
|
? {
|
|
21656
|
-
width:
|
|
21657
|
-
minWidth:
|
|
21658
|
-
maxWidth:
|
|
21646
|
+
width: `var(--col-w-${col.key})`,
|
|
21647
|
+
minWidth: `var(--col-w-${col.key})`,
|
|
21648
|
+
maxWidth: `var(--col-w-${col.key})`,
|
|
21659
21649
|
}
|
|
21660
|
-
:
|
|
21661
|
-
|
|
21662
|
-
|
|
21663
|
-
|
|
21664
|
-
|
|
21665
|
-
|
|
21666
|
-
|
|
21667
|
-
|
|
21668
|
-
|
|
21669
|
-
|
|
21670
|
-
|
|
21671
|
-
|
|
21672
|
-
|
|
21673
|
-
|
|
21674
|
-
|
|
21675
|
-
|
|
21676
|
-
|
|
21650
|
+
: isPinnedRight
|
|
21651
|
+
? {
|
|
21652
|
+
width: '72px',
|
|
21653
|
+
minWidth: '72px',
|
|
21654
|
+
maxWidth: '72px',
|
|
21655
|
+
}
|
|
21656
|
+
: undefined;
|
|
21657
|
+
// Pinned cells need an OPAQUE bg matching the row state so the
|
|
21658
|
+
// scrolling content underneath doesn't bleed through — no alpha tints.
|
|
21659
|
+
const pinnedBg = isPinnedRight
|
|
21660
|
+
? isEditing
|
|
21661
|
+
? 'bg-[#FEFCE8] dark:bg-[#422006]'
|
|
21662
|
+
: isSelected
|
|
21663
|
+
? 'bg-[#EFF6FF] dark:bg-[#172554]'
|
|
21664
|
+
: 'bg-card group-hover/row:bg-table-header'
|
|
21665
|
+
: '';
|
|
21666
|
+
return (jsx("td", { className: cn('px-4 py-1.5 first:!pl-6 border-b border-border whitespace-nowrap text-table-cell border-solid !border-border', vBorder, isPinnedRight || col.align === 'center'
|
|
21667
|
+
? 'text-center'
|
|
21668
|
+
: typeof value === 'number'
|
|
21669
|
+
? 'text-right'
|
|
21670
|
+
: 'text-left', isArchiveView && !isPinnedRight && 'pl-2', columnStyles?.[col.key.toString()] || '', draggingKey === col.key && 'bg-primary/5', isPinnedRight && pinnedCellClass(pinnedBg)), style: tdStyle, children: jsx(EditableCellContent, { col: col, row: row, value: value, isEditing: isEditing, width: w, onEditValueChange: handleEditValueChange, fetchBusinessContacts: fetchBusinessContacts }) }, col.key.toString()));
|
|
21671
|
+
})] }, row.id));
|
|
21672
|
+
}) })] }), data.length === 0 && (jsx("div", { className: "sticky left-0 flex w-full items-center justify-center p-6 text-sm text-muted-foreground", children: emptyState ?? 'No data available' }))] }), pagination] }));
|
|
21677
21673
|
}
|
|
21678
21674
|
|
|
21679
21675
|
/**
|
|
@@ -37147,7 +37143,7 @@ function SelectTrigger({ className, size = 'default', children, ...props }) {
|
|
|
37147
37143
|
return (jsxs(SelectPrimitive.Trigger, { "data-slot": "select-trigger", "data-size": size, className: cn("border-input-border cursor-pointer data-[placeholder]:!text-[var(--placeholder)] data-[placeholder]:!text-sm [&_[data-placeholder]]:!text-[var(--placeholder)] [&_[data-placeholder]]:!text-sm [&_span[data-placeholder]]:!text-[var(--placeholder)] [&_svg:not([class*='text-'])]:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:bg-input/30 dark:hover:bg-input/50 flex w-full items-center justify-between gap-2 rounded-md border bg-input-background px-3 py-2 text-sm whitespace-nowrap shadow-[0_1px_2px_0_rgba(0,0,0,0.05)] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:bg-muted/50 disabled:text-label data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", className), ...props, children: [children, jsx(SelectPrimitive.Icon, { asChild: true, children: jsx(ChevronDown, { className: "size-4 text-gray-600" }) })] }));
|
|
37148
37144
|
}
|
|
37149
37145
|
function SelectContent({ className, children, position = 'popper', searchable = true, // default: all selects are searchable
|
|
37150
|
-
searchPlaceholder = 'Search...', ...props }) {
|
|
37146
|
+
searchPlaceholder = 'Search...', emptyMessage = 'No options available', ...props }) {
|
|
37151
37147
|
// Use the shared search context provided by Select root
|
|
37152
37148
|
const searchCtx = useSelectSearchContext();
|
|
37153
37149
|
const searchTerm = searchCtx?.searchTerm ?? '';
|
|
@@ -37159,7 +37155,9 @@ searchPlaceholder = 'Search...', ...props }) {
|
|
|
37159
37155
|
return (jsx(SelectPrimitive.Portal, { children: jsxs(SelectPrimitive.Content, { "data-slot": "select-content", className: cn('bg-card cursor-pointer 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 relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-lg border border-border shadow-[0_10px_15px_-3px_rgba(0,0,0,0.10),0_4px_6px_-4px_rgba(0,0,0,0.10)]', position === 'popper' &&
|
|
37160
37156
|
'data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1', className), position: position, ...props, children: [searchable && (jsx("div", { className: "p-2 pb-1", children: jsxs("div", { className: "flex h-9 w-full items-center gap-2 rounded-lg bg-secondary px-3", children: [jsx(Search, { className: "h-4 w-4 shrink-0 text-[#737373]", "aria-hidden": "true" }), jsx("input", { type: "search", className: "min-w-0 flex-1 bg-transparent text-sm text-foreground outline-none placeholder:text-placeholder", placeholder: searchPlaceholder, value: searchTerm, onChange: (e) => setSearchTerm?.(e.target.value),
|
|
37161
37157
|
// prevent keys from interfering with Radix keyboard nav
|
|
37162
|
-
onKeyDown: (e) => e.stopPropagation() })] }) })), jsx(SelectScrollUpButton, {}), jsx(SelectPrimitive.Viewport, {
|
|
37158
|
+
onKeyDown: (e) => e.stopPropagation() })] }) })), jsx(SelectScrollUpButton, {}), jsx(SelectPrimitive.Viewport, { "data-slot": "select-viewport", style: {
|
|
37159
|
+
'--select-empty-message': JSON.stringify(searchTerm ? 'No matching options' : emptyMessage),
|
|
37160
|
+
}, className: cn('p-1 max-h-[12.5rem] overflow-y-auto', 'empty:after:block empty:after:px-2 empty:after:py-4 empty:after:text-center empty:after:text-sm empty:after:text-muted-foreground empty:after:content-(--select-empty-message)', position === 'popper' &&
|
|
37163
37161
|
'w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1'), children: children }), jsx(SelectScrollDownButton, {})] }) }));
|
|
37164
37162
|
}
|
|
37165
37163
|
// 👇 Add searchValue + withCheckbox props here
|
|
@@ -66662,16 +66660,43 @@ const buildFacebookUrl = (url) => `https://www.facebook.com/sharer/sharer.php?u=
|
|
|
66662
66660
|
const buildXUrl = (text, url) => `https://twitter.com/intent/tweet?text=${encodeURIComponent(text)}&url=${encodeURIComponent(url)}`;
|
|
66663
66661
|
const isWebShareAvailable = () => typeof navigator !== 'undefined' && typeof navigator.share === 'function';
|
|
66664
66662
|
const isValidEmail = (value) => /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(value.trim());
|
|
66663
|
+
/**
|
|
66664
|
+
* Bulk share message: the title, then one numbered entry per item with its
|
|
66665
|
+
* caption above its link. Blank lines between entries stop chat clients from
|
|
66666
|
+
* running the links together.
|
|
66667
|
+
*/
|
|
66668
|
+
const buildBulkShareMessage = (title, items) => [
|
|
66669
|
+
title,
|
|
66670
|
+
...items.map((item, index) => `\n${index + 1}. ${item.label}\n${item.url}`),
|
|
66671
|
+
].join('\n');
|
|
66665
66672
|
|
|
66666
66673
|
const WhatsappIcon = ({ className }) => (jsxs("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": "true", className: className, children: [jsx("path", { d: "M17.5 14.4c-.3-.1-1.7-.8-1.9-.9-.3-.1-.5-.1-.7.1s-.8.9-1 1.1-.4.2-.7.1c-1.6-.8-2.7-1.4-3.7-3.2-.3-.5.3-.5.8-1.5.1-.2.1-.4 0-.5l-.9-2.1c-.2-.6-.5-.5-.7-.5h-.6c-.2 0-.5.1-.8.4-.3.3-1 1-1 2.5s1.1 2.9 1.2 3.1c.2.2 2.2 3.3 5.3 4.6 2 .8 2.7.9 3.7.8.6-.1 1.7-.7 1.9-1.3.2-.7.2-1.2.2-1.3-.1-.2-.3-.3-.6-.4Z" }), jsx("path", { d: "M20 4A11 11 0 0 0 4 4a10.9 10.9 0 0 0-1.7 13.4L1 23l5.7-1.5A11 11 0 0 0 23 12 10.9 10.9 0 0 0 20 4Zm-8 18a9.1 9.1 0 0 1-4.6-1.3l-.3-.2-3.4.9.9-3.3-.2-.4A9 9 0 1 1 12 22Z" })] }));
|
|
66667
66674
|
const SocialTile = ({ icon, label, bg, fg, onClick }) => (jsxs("button", { type: "button", onClick: onClick, className: "flex cursor-pointer flex-col items-center gap-2 focus-visible:outline-none", children: [jsx("span", { className: cn('flex h-12 w-12 items-center justify-center rounded-full transition-transform hover:scale-105', bg, fg), children: icon }), jsx("span", { className: "text-xs text-foreground", children: label })] }));
|
|
66668
|
-
const ShareBody = ({ url, urls, title = 'Check this out', entityLabel = 'item', onInviteEmail, hideInvite = false, hideHeader = false, }) => {
|
|
66675
|
+
const ShareBody = ({ url, urls, items, title = 'Check this out', entityLabel = 'item', onInviteEmail, hideInvite = false, hideHeader = false, }) => {
|
|
66669
66676
|
const [email, setEmail] = useState('');
|
|
66670
66677
|
const [sending, setSending] = useState(false);
|
|
66671
|
-
const
|
|
66672
|
-
const
|
|
66678
|
+
const shareItems = items ?? [];
|
|
66679
|
+
const isMulti = shareItems.length > 0 || (urls?.length ?? 0) > 0;
|
|
66680
|
+
const shareUrls = shareItems.length
|
|
66681
|
+
? shareItems.map((item) => item.url)
|
|
66682
|
+
: isMulti
|
|
66683
|
+
? (urls ?? [])
|
|
66684
|
+
: url
|
|
66685
|
+
? [url]
|
|
66686
|
+
: [];
|
|
66673
66687
|
const hasContent = shareUrls.length > 0;
|
|
66674
|
-
|
|
66688
|
+
// Captioned items read as a numbered list; bare urls keep the older format.
|
|
66689
|
+
const shareBody = shareItems.length
|
|
66690
|
+
? buildBulkShareMessage(title, shareItems)
|
|
66691
|
+
: isMulti
|
|
66692
|
+
? [title, ...shareUrls].join('\n')
|
|
66693
|
+
: url;
|
|
66694
|
+
/**
|
|
66695
|
+
* What chat apps receive. A single share puts its link on its own line, the
|
|
66696
|
+
* same shape as one entry of a bulk message — glued to the caption it reads
|
|
66697
|
+
* as one run-on sentence. Copy Link still copies the bare url.
|
|
66698
|
+
*/
|
|
66699
|
+
const shareMessage = isMulti ? shareBody : [title, url].filter(Boolean).join('\n');
|
|
66675
66700
|
const openInPopup = (href) => {
|
|
66676
66701
|
if (!hasContent)
|
|
66677
66702
|
return;
|
|
@@ -66698,7 +66723,7 @@ const ShareBody = ({ url, urls, title = 'Check this out', entityLabel = 'item',
|
|
|
66698
66723
|
return;
|
|
66699
66724
|
}
|
|
66700
66725
|
try {
|
|
66701
|
-
await navigator.share(isMulti ? { title, text:
|
|
66726
|
+
await navigator.share(isMulti ? { title, text: shareMessage } : { url, title, text: shareMessage });
|
|
66702
66727
|
}
|
|
66703
66728
|
catch (e) {
|
|
66704
66729
|
const err = e;
|
|
@@ -66733,16 +66758,14 @@ const ShareBody = ({ url, urls, title = 'Check this out', entityLabel = 'item',
|
|
|
66733
66758
|
};
|
|
66734
66759
|
return (jsxs("div", { className: "flex flex-col gap-3", children: [!hideHeader && (jsxs(Fragment$2, { children: [jsxs("header", { className: "flex flex-col gap-1", children: [jsx("h3", { className: "text-base font-semibold text-foreground", children: "Share" }), jsx("p", { className: "text-xs text-muted-foreground", children: isMulti
|
|
66735
66760
|
? `Anyone with these links can open the public view of the selected ${entityLabel}s.`
|
|
66736
|
-
: `Anyone with the link can open the public view of this ${entityLabel}.` })] }), jsx(Separator, {})] })), jsxs("section", { className: "flex flex-col gap-3", children: [jsx("h4", { className: "text-sm font-medium text-foreground", children: "Social" }), jsxs("div", { className: "grid grid-cols-3 gap-3", children: [jsx(SocialTile, { icon: jsx(WhatsappIcon, { className: "h-6 w-6" }), label: "Whatsapp", bg: "bg-[#25D366]", fg: "text-white", onClick: () => openInPopup(isMulti
|
|
66737
|
-
? buildWhatsappUrl('', shareBody)
|
|
66738
|
-
: buildWhatsappUrl(title, url)) }), !isMulti && (jsx(SocialTile, { icon: jsx(Facebook, { className: "h-6 w-6", fill: "currentColor" }), label: "Facebook", bg: "bg-[#1877F2]", fg: "text-white", onClick: () => openInPopup(buildFacebookUrl(url)) })), !isMulti && (jsx(SocialTile, { icon: jsx(X$2, { className: "h-6 w-6", strokeWidth: 2.5 }), label: "X", bg: "bg-black", fg: "text-white", onClick: () => openInPopup(buildXUrl(title, url)) })), jsx(SocialTile, { icon: jsx(Link2, { className: "h-6 w-6", strokeWidth: 1.5 }), label: "Copy Link", bg: "bg-muted", fg: "text-foreground", onClick: handleCopy }), jsx(SocialTile, { icon: jsx(Share2, { className: "h-6 w-6", strokeWidth: 1.5 }), label: "System Share", bg: "bg-muted", fg: "text-foreground", onClick: handleSystemShare })] })] }), !hideInvite && (jsxs(Fragment$2, { children: [jsx(Separator, {}), jsxs("section", { className: "flex flex-col gap-2", children: [jsx("h4", { className: "text-sm font-medium text-foreground", children: "Invite your Merchants" }), jsxs("form", { className: "flex items-center gap-2", onSubmit: (e) => {
|
|
66761
|
+
: `Anyone with the link can open the public view of this ${entityLabel}.` })] }), jsx(Separator, {})] })), jsxs("section", { className: "flex flex-col gap-3", children: [jsx("h4", { className: "text-sm font-medium text-foreground", children: "Social" }), jsxs("div", { className: "grid grid-cols-3 gap-3", children: [jsx(SocialTile, { icon: jsx(WhatsappIcon, { className: "h-6 w-6" }), label: "Whatsapp", bg: "bg-[#25D366]", fg: "text-white", onClick: () => openInPopup(buildWhatsappUrl('', shareMessage)) }), !isMulti && (jsx(SocialTile, { icon: jsx(Facebook, { className: "h-6 w-6", fill: "currentColor" }), label: "Facebook", bg: "bg-[#1877F2]", fg: "text-white", onClick: () => openInPopup(buildFacebookUrl(url)) })), !isMulti && (jsx(SocialTile, { icon: jsx(X$2, { className: "h-6 w-6", strokeWidth: 2.5 }), label: "X", bg: "bg-black", fg: "text-white", onClick: () => openInPopup(buildXUrl(title, url)) })), jsx(SocialTile, { icon: jsx(Link2, { className: "h-6 w-6", strokeWidth: 1.5 }), label: "Copy Link", bg: "bg-muted", fg: "text-foreground", onClick: handleCopy }), jsx(SocialTile, { icon: jsx(Share2, { className: "h-6 w-6", strokeWidth: 1.5 }), label: "System Share", bg: "bg-muted", fg: "text-foreground", onClick: handleSystemShare })] })] }), !hideInvite && (jsxs(Fragment$2, { children: [jsx(Separator, {}), jsxs("section", { className: "flex flex-col gap-2", children: [jsx("h4", { className: "text-sm font-medium text-foreground", children: "Invite your Merchants" }), jsxs("form", { className: "flex items-center gap-2", onSubmit: (e) => {
|
|
66739
66762
|
e.preventDefault();
|
|
66740
66763
|
void handleSend();
|
|
66741
66764
|
}, children: [jsx("input", { type: "email", value: email, onChange: (e) => setEmail(e.target.value), placeholder: "Example@gmail.com", className: "flex-1 rounded-md border border-border bg-input-background px-3 py-2 text-sm text-foreground outline-none placeholder:text-muted-foreground focus:border-primary focus:ring-2 focus:ring-primary/10" }), jsx(Button$1, { type: "submit", size: "sm", style: { width: '118px' }, className: "bg-primary text-primary-foreground hover:bg-primary/90", disabled: sending, children: sending ? 'Sending…' : 'Send' })] })] })] }))] }));
|
|
66742
66765
|
};
|
|
66743
|
-
const ShareMenu = ({ children, url, urls, title, entityLabel, onInviteEmail, hideInvite, side = 'bottom', align = 'end', open, onOpenChange, }) => (jsxs(Popover, { open: open, onOpenChange: onOpenChange, children: [jsx(PopoverTrigger, { asChild: true, children: children }), jsx(PopoverContent, { side: side, align: align, sideOffset: 8, className: "w-[360px] p-4", children: jsx(ShareBody, { url: url, urls: urls, title: title, entityLabel: entityLabel, onInviteEmail: onInviteEmail, hideInvite: hideInvite }) })] }));
|
|
66744
|
-
const ShareDialog = ({ open, onOpenChange, url, urls, title, entityLabel = 'item', onInviteEmail, hideInvite, stockId, }) => {
|
|
66745
|
-
const count = urls?.length ?? 0;
|
|
66766
|
+
const ShareMenu = ({ children, url, urls, items, title, entityLabel, onInviteEmail, hideInvite, side = 'bottom', align = 'end', open, onOpenChange, }) => (jsxs(Popover, { open: open, onOpenChange: onOpenChange, children: [jsx(PopoverTrigger, { asChild: true, children: children }), jsx(PopoverContent, { side: side, align: align, sideOffset: 8, className: "w-[360px] p-4", children: jsx(ShareBody, { url: url, urls: urls, items: items, title: title, entityLabel: entityLabel, onInviteEmail: onInviteEmail, hideInvite: hideInvite }) })] }));
|
|
66767
|
+
const ShareDialog = ({ open, onOpenChange, url, urls, items, title, entityLabel = 'item', onInviteEmail, hideInvite, stockId, }) => {
|
|
66768
|
+
const count = items?.length ?? urls?.length ?? 0;
|
|
66746
66769
|
const isMulti = count > 0;
|
|
66747
66770
|
const trimmedStockId = stockId?.trim();
|
|
66748
66771
|
const heading = isMulti
|
|
@@ -66752,7 +66775,7 @@ const ShareDialog = ({ open, onOpenChange, url, urls, title, entityLabel = 'item
|
|
|
66752
66775
|
: 'Share';
|
|
66753
66776
|
return (jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: jsxs(DialogContent, { className: "sm:max-w-[400px]", children: [jsxs(DialogHeader, { children: [jsx(DialogTitle, { children: heading }), jsx(DialogDescription, { children: isMulti
|
|
66754
66777
|
? `Anyone with these links can open the public view of the selected ${entityLabel}s.`
|
|
66755
|
-
: `Anyone with the link can open the public view of this ${entityLabel}.` })] }), jsx(ShareBody, { url: url, urls: urls, title: title, entityLabel: entityLabel, onInviteEmail: onInviteEmail, hideInvite: hideInvite, hideHeader: true })] }) }));
|
|
66778
|
+
: `Anyone with the link can open the public view of this ${entityLabel}.` })] }), jsx(ShareBody, { url: url, urls: urls, items: items, title: title, entityLabel: entityLabel, onInviteEmail: onInviteEmail, hideInvite: hideInvite, hideHeader: true })] }) }));
|
|
66756
66779
|
};
|
|
66757
66780
|
|
|
66758
66781
|
const Table = React.forwardRef(({ className, ...props }, ref) => (jsx("table", { ref: ref, className: cn('w-full text-sm text-left border-collapse', className), ...props })));
|
|
@@ -77614,5 +77637,5 @@ var RichTextAreaImpl = /*#__PURE__*/Object.freeze({
|
|
|
77614
77637
|
RichTextarea: RichTextarea
|
|
77615
77638
|
});
|
|
77616
77639
|
|
|
77617
|
-
export { ACTIVITY_CATEGORIES, ACTIVITY_CATEGORY_META, ActionBadge, ActionButtonWithTooltip, ActivityFeed, AdvancedSearchDrawer, Alert, ApiComboBox, AppSidebar, AuditEntryCard, AuditHistoryPanel, AuditTimeline, AuditTimelineShimmer, Badge, BadgeType, BusinessContactStatusFilter, Button, CUSTOMER_AUDIT_CONFIG, CertificateRowList, ChangePill, Collapsible, CollapsibleCard, CollapsibleContent, CollapsibleTrigger, ConfirmDialog, ContactTypeFilter, CopyButton, CountrySelect, CreateFormPageHeader, CreateFormPageShell, CurrencyDisplayTabs, CurrencyInput, CurrencyToggle, CustomCombobox, CustomFieldInput, CustomFieldValue, CustomTable, CustomizeColumnsDrawer, DIAMOND_AUDIT_CONFIG, DashboardShell, DataEditableTable, DataTable, DateInput, DetailChip, DetailPageLayout, DetailPageSkeleton, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyValue, EntityHeader, Field, FieldSkeleton, FileUploader, FilterMultiSelect, FilterSelect, FormSectionCard, FormSectionCardSkeleton, GEM_AUDIT_CONFIG, HistoryEntryCard, HistoryTimeline, HistoryTimelineShimmer, INVOICE_AUDIT_CONFIG, IconButton, IdHyperlinkText, InAppNotificationCard, InAppNotificationsPanel, InfoBanner, InventoryComboBox, InventoryItemCard, InventoryItemRow, InvoiceComboBox, KYCStatusFilter, KeyValueGrid, LAYOUT_AUDIT_CONFIG, LabeledToggle, MEMO_IN_AUDIT_CONFIG, MEMO_OUT_AUDIT_CONFIG, MediaGallery, MemoInComboBox, MetricCard, MetricRow, MetricTile, Modal, MoreInfoPanel, MoreInfoTrigger, NOT_CAPTURED, Navbar, NavbarActions, NavbarAvatar, NavbarIconButton, NavbarSearch, NavbarTitle, NumberInput, NumberedStepCard, OtpInput, OwnershipFilter, OwnershipSplitCard, PROFORMA_AUDIT_CONFIG, PageHeader, PageTabs, Pagination, PaginationSelect, PartnerShareCard, PriceInput, Protected, PurchaseOrderComboBox, QUOTATION_AUDIT_CONFIG, RadioCardGroup, ReadMoreText, RefreshButton, RichTextarea$1 as RichTextarea, SEARCHABLE_SELECT_PAGE_SIZE, SafeImage, SearchBox, SearchInput, SearchableSelect, SectionCard, SectionIcon, SegmentedControl, ShareDialog, ShareMenu, ShimmerTable, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SlideOut, SlideOutClose, SlideOutContent, SlideOutDescription, SlideOutHeader, SlideOutOverlay, SlideOutPortal, SlideOutTitle, SlideOutTrigger, Slider, SpecList, Spinner, SquareSkeleton, StateSelect, StatusBadge$1 as StatusBadge, StatusFilter, Stepper, StockTypeFilter, TablePagination, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, TagsInput, TextHyperlink, TimePicker, ToggleSwitch, TruncateTooltip, WarehouseComboBox, WarehouseFilter, ZoomSplitViewer, asList, asText, badgeVariants, buildBulkShareTitle, buildInventoryPublicUrl, buildInventoryRowProps, buildInventoryShareTitle, buildWhatsappUrl, buttonVariants, cn, countries, countryByCode, createVideoMediaItem, dropdownMenuItemDestructiveClass, fieldTypeIcon, findRegion, flagEmoji, formatAddressLocation, formatFileSize, generateActionDescription, generateTitle, getBadgeTypeForStatus, getChangePills, getCountryName, getInitials, getStatesOfCountry, iconButtonVariants, inAppNotificationCardA11y, inAppNotificationsPanelA11y, isBlank, isIndiaCountry, isKnownRegion, isPathActive, isValidAlpha2CountryCode, isValueEmpty, notify, releaseStaleOverlayBodyLock, renderBadge, resolveCountryCode, toAddressFormValues, useAuditShowMore, useBadge, useButton, useDropdownMenu, useInAppNotificationsPanel, useNavbar, useSidebar, videoThumbnailSrc, watchOverlayBodyLock };
|
|
77640
|
+
export { ACTIVITY_CATEGORIES, ACTIVITY_CATEGORY_META, ActionBadge, ActionButtonWithTooltip, ActivityFeed, AdvancedSearchDrawer, Alert, ApiComboBox, AppSidebar, AuditEntryCard, AuditHistoryPanel, AuditTimeline, AuditTimelineShimmer, Badge, BadgeType, BusinessContactStatusFilter, Button, CUSTOMER_AUDIT_CONFIG, CertificateRowList, ChangePill, Collapsible, CollapsibleCard, CollapsibleContent, CollapsibleTrigger, ConfirmDialog, ContactTypeFilter, CopyButton, CountrySelect, CreateFormPageHeader, CreateFormPageShell, CurrencyDisplayTabs, CurrencyInput, CurrencyToggle, CustomCombobox, CustomFieldInput, CustomFieldValue, CustomTable, CustomizeColumnsDrawer, DIAMOND_AUDIT_CONFIG, DashboardShell, DataEditableTable, DataTable, DateInput, DetailChip, DetailPageLayout, DetailPageSkeleton, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyValue, EntityHeader, Field, FieldSkeleton, FileUploader, FilterMultiSelect, FilterSelect, FormSectionCard, FormSectionCardSkeleton, GEM_AUDIT_CONFIG, HistoryEntryCard, HistoryTimeline, HistoryTimelineShimmer, INVOICE_AUDIT_CONFIG, IconButton, IdHyperlinkText, InAppNotificationCard, InAppNotificationsPanel, InfoBanner, InventoryComboBox, InventoryItemCard, InventoryItemRow, InvoiceComboBox, KYCStatusFilter, KeyValueGrid, LAYOUT_AUDIT_CONFIG, LabeledToggle, MEMO_IN_AUDIT_CONFIG, MEMO_OUT_AUDIT_CONFIG, MediaGallery, MemoInComboBox, MetricCard, MetricRow, MetricTile, Modal, MoreInfoPanel, MoreInfoTrigger, NOT_CAPTURED, Navbar, NavbarActions, NavbarAvatar, NavbarIconButton, NavbarSearch, NavbarTitle, NumberInput, NumberedStepCard, OtpInput, OwnershipFilter, OwnershipSplitCard, PROFORMA_AUDIT_CONFIG, PageHeader, PageTabs, Pagination, PaginationSelect, PartnerShareCard, PriceInput, Protected, PurchaseOrderComboBox, QUOTATION_AUDIT_CONFIG, RadioCardGroup, ReadMoreText, RefreshButton, RichTextarea$1 as RichTextarea, SEARCHABLE_SELECT_PAGE_SIZE, SafeImage, SearchBox, SearchInput, SearchableSelect, SectionCard, SectionIcon, SegmentedControl, ShareDialog, ShareMenu, ShimmerTable, Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupLabel, SidebarHeader, SidebarInset, SidebarMenu, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, SlideOut, SlideOutClose, SlideOutContent, SlideOutDescription, SlideOutHeader, SlideOutOverlay, SlideOutPortal, SlideOutTitle, SlideOutTrigger, Slider, SpecList, Spinner, SquareSkeleton, StateSelect, StatusBadge$1 as StatusBadge, StatusFilter, Stepper, StockTypeFilter, TablePagination, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, TagsInput, TextHyperlink, TimePicker, ToggleSwitch, TruncateTooltip, WarehouseComboBox, WarehouseFilter, ZoomSplitViewer, asList, asText, badgeVariants, buildBulkShareMessage, buildBulkShareTitle, buildInventoryPublicUrl, buildInventoryRowProps, buildInventoryShareTitle, buildWhatsappUrl, buttonVariants, cn, countries, countryByCode, createVideoMediaItem, dropdownMenuItemDestructiveClass, fieldTypeIcon, findRegion, flagEmoji, formatAddressLocation, formatFileSize, generateActionDescription, generateTitle, getBadgeTypeForStatus, getChangePills, getCountryName, getInitials, getStatesOfCountry, iconButtonVariants, inAppNotificationCardA11y, inAppNotificationsPanelA11y, isBlank, isIndiaCountry, isKnownRegion, isPathActive, isValidAlpha2CountryCode, isValueEmpty, notify, releaseStaleOverlayBodyLock, renderBadge, resolveCountryCode, toAddressFormValues, useAuditShowMore, useBadge, useButton, useDropdownMenu, useInAppNotificationsPanel, useNavbar, useSidebar, videoThumbnailSrc, watchOverlayBodyLock };
|
|
77618
77641
|
//# sourceMappingURL=index.esm.js.map
|