@caratlogic/design-system 0.1.39 → 0.1.40

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/index.esm.js CHANGED
@@ -70259,6 +70259,12 @@ function formatPrimitive(val) {
70259
70259
  }
70260
70260
  return null;
70261
70261
  }
70262
+ // Rich-text fields (from a formatting editor) are stored as HTML; the timeline names the change
70263
+ // without showing the value. Detected by content, since plain-text `notes` (gems, splits) still show.
70264
+ const HTML_TAG_RE = /<\/?[a-z][^>]*>/i;
70265
+ function isRichText(val) {
70266
+ return typeof val === 'string' && HTML_TAG_RE.test(val);
70267
+ }
70262
70268
  const MEDIA_KEYS = new Set(['urls', 'keys']);
70263
70269
  const INTERNAL_KEYS = new Set(['createdAt', 'updatedAt', '__v']);
70264
70270
  function mediaCount(v, singular, plural) {
@@ -70287,6 +70293,10 @@ function flattenRecord(obj, prefix = '') {
70287
70293
  if (INTERNAL_KEYS.has(k))
70288
70294
  continue;
70289
70295
  const label = prefix ? `${prefix} › ${toLabel(k)}` : toLabel(k);
70296
+ if (isRichText(v)) {
70297
+ result.push({ label, value: '', richText: true });
70298
+ continue;
70299
+ }
70290
70300
  if ((k === 'images' || k === 'videos') &&
70291
70301
  typeof v === 'object' &&
70292
70302
  !Array.isArray(v)) {
@@ -70444,8 +70454,13 @@ function generateTitle(row, config) {
70444
70454
  if (productItemsLabel)
70445
70455
  return `${name} updated ${labels.length} fields and product ${productItemsLabel}`;
70446
70456
  const first = labels[0];
70447
- const newVal = newEntries.find((e) => e.label === first)?.value;
70448
- const hasOld = oldEntries.some((e) => e.label === first);
70457
+ const newEntry = newEntries.find((e) => e.label === first);
70458
+ const newVal = newEntry?.value;
70459
+ const oldEntry = oldEntries.find((e) => e.label === first);
70460
+ const hasOld = !!oldEntry;
70461
+ const richChange = richTextChange(oldEntry, newEntry);
70462
+ if (totalCount === 1 && richChange)
70463
+ return `${name} ${richChange} ${first}`;
70449
70464
  if (totalCount === 1)
70450
70465
  return hasOld
70451
70466
  ? `${name} updated ${first} to ${newVal ?? '—'}`
@@ -70559,14 +70574,25 @@ function generateActorAction(row, config) {
70559
70574
  return `performed ${row.action}`;
70560
70575
  }
70561
70576
  }
70577
+ /** "Customer Notes were updated" / "Description was added". */
70578
+ function richTextChangeText(pill) {
70579
+ const verb = /s$/i.test(pill.label) ? 'were' : 'was';
70580
+ return `${pill.label} ${verb} ${pill.changeNote}`;
70581
+ }
70582
+ function richTextChange(oldEntry, newEntry) {
70583
+ if (!oldEntry?.richText && !newEntry?.richText)
70584
+ return undefined;
70585
+ if (oldEntry && newEntry)
70586
+ return 'updated';
70587
+ return newEntry ? 'added' : 'removed';
70588
+ }
70562
70589
  function getChangePills(row, config) {
70563
70590
  const oldV = row.oldValue;
70564
70591
  const newV = row.newValue;
70565
70592
  if (row.action === 'CREATE') {
70566
- return (newV ? flattenRecord(newV) : []).map((e) => ({
70567
- label: e.label,
70568
- newVal: e.value,
70569
- }));
70593
+ return (newV ? flattenRecord(newV) : []).map((e) => e.richText
70594
+ ? { label: e.label, changeNote: 'added' }
70595
+ : { label: e.label, newVal: e.value });
70570
70596
  }
70571
70597
  if (row.action === 'UPDATE') {
70572
70598
  const pills = [];
@@ -70591,13 +70617,14 @@ function getChangePills(row, config) {
70591
70617
  ...newEntries.map((e) => e.label),
70592
70618
  ]),
70593
70619
  ];
70594
- const oldMap = Object.fromEntries(oldEntries.map((e) => [e.label, e.value]));
70595
- const newMap = Object.fromEntries(newEntries.map((e) => [e.label, e.value]));
70596
- pills.push(...labels.map((label) => ({
70597
- label,
70598
- oldVal: oldMap[label],
70599
- newVal: newMap[label],
70600
- })));
70620
+ const oldMap = Object.fromEntries(oldEntries.map((e) => [e.label, e]));
70621
+ const newMap = Object.fromEntries(newEntries.map((e) => [e.label, e]));
70622
+ pills.push(...labels.map((label) => {
70623
+ const changeNote = richTextChange(oldMap[label], newMap[label]);
70624
+ return changeNote
70625
+ ? { label, changeNote }
70626
+ : { label, oldVal: oldMap[label]?.value, newVal: newMap[label]?.value };
70627
+ }));
70601
70628
  // Handle structured productItems: added / removed / updated
70602
70629
  if (hasStructuredItems) {
70603
70630
  const structured = newProductItems;
@@ -70741,10 +70768,13 @@ function getEntryNotes(row, config) {
70741
70768
  row.oldValue?.notes ??
70742
70769
  newV?.notes ??
70743
70770
  mergeParent?.notes;
70744
- return notes || undefined;
70771
+ return notes && !isRichText(notes) ? notes : undefined;
70745
70772
  }
70746
70773
  // ─── ChangePill ───────────────────────────────────────────────────────────────
70747
70774
  function ChangePill({ pill }) {
70775
+ if (pill.changeNote) {
70776
+ return (jsx("span", { className: "inline-flex items-center gap-1 px-2 py-0.5 rounded text-xs border border-border bg-muted text-foreground", children: richTextChangeText(pill) }));
70777
+ }
70748
70778
  const isRemoved = pill.variant === 'removed';
70749
70779
  const isAdded = pill.variant === 'added';
70750
70780
  const isDiff = !isRemoved &&
@@ -70898,6 +70928,9 @@ const PillContent = ({ pill }) => {
70898
70928
  const hasBreadcrumb = labelParts.length > 1;
70899
70929
  const showArrow = pill.oldVal !== undefined && pill.newVal !== undefined;
70900
70930
  const hasOnlyNew = pill.newVal !== undefined && pill.oldVal === undefined;
70931
+ if (pill.changeNote) {
70932
+ return jsx("span", { className: "text-foreground", children: richTextChangeText(pill) });
70933
+ }
70901
70934
  if (pill.variant === 'added') {
70902
70935
  return jsxs("span", { className: "font-semibold text-primary", children: ["+ ", pill.label] });
70903
70936
  }
@@ -79797,5 +79830,5 @@ var RichTextAreaImpl = /*#__PURE__*/Object.freeze({
79797
79830
  RichTextarea: RichTextarea
79798
79831
  });
79799
79832
 
79800
- export { ACTIVITY_CATEGORIES, ACTIVITY_CATEGORY_META, ActionBadge, ActionButtonWithTooltip, ActiveFilterChips, ActivityFeed, AdvancedSearchDrawer, Alert, ApiComboBox, AppSidebar, AuditEntryCard, AuditHistoryPanel, AuditTimeline, AuditTimelineShimmer, Badge, BadgeType, BusinessContactStatusFilter, Button, CUSTOMER_AUDIT_CONFIG, CertificateRowList, ChangePill, Collapsible, CollapsibleCard, CollapsibleContent, CollapsibleTrigger, CompanyCard, ConfirmDialog, ContactTypeFilter, ContainsFilter, CopyButton, CountrySelect, CreateFormPageHeader, CreateFormPageShell, CurrencyDisplayTabs, CurrencyInput, CurrencyToggle, CustomCombobox, CustomFieldInput, CustomFieldValue, CustomTable, CustomizeColumnsDrawer, DATE_PRESET_OPTIONS, DIAMOND_AUDIT_CONFIG, DashboardShell, DataEditableTable, DataTable, DateInput, DateRangeFilter, DetailChip, DetailPageLayout, DetailPageSkeleton, DetailSection, DocumentDeleteDialog, DocumentDetailSkeleton, DocumentHero, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyValue, EntityHeader, FILTER_COUNT_BADGE_CLASS_NAME, Field, FieldSkeleton, FileUploader, FilterCardSkeleton, FilterCellPopover, FilterEmptyState, FilterField, FilterFieldCard, FilterFieldCell, FilterFieldControl, FilterMultiSelect, FilterPanel, FilterSelect, FilterSurface, FilterSurfaceGroup, FilterSurfaceMore, FormSectionCard, FormSectionCardSkeleton, GEM_AUDIT_CONFIG, HistoryEntryCard, HistoryTimeline, HistoryTimelineShimmer, INVOICE_AUDIT_CONFIG, IconButton, IdHyperlinkText, IdListInput, InAppNotificationCard, InAppNotificationsPanel, InfoBanner, InventoryComboBox, InventoryItemCard, InventoryItemRow, InvoiceComboBox, KYCStatusFilter, KeyValueGrid, LAYOUT_AUDIT_CONFIG, LabeledToggle, LineItemsCard, LineProductCell, LineProductThumb, LineProductTypeChip, LineRowActionsMenu, LineTable, LineTableEmpty, MEMO_IN_AUDIT_CONFIG, MEMO_OUT_AUDIT_CONFIG, MediaGallery, MemoInComboBox, MetricCard, MetricRow, MetricTile, Modal, MoreInfoPanel, MoreInfoTrigger, NOT_CAPTURED, Navbar, NavbarActions, NavbarAvatar, NavbarIconButton, NavbarSearch, NavbarTitle, NumberExpressionFilter, NumberInput, NumberRangeInputs, NumberedStepCard, OtpInput, OwnershipFilter, OwnershipSplitCard, PROFORMA_AUDIT_CONFIG, PageHeader, PageTabs, Pagination, PaginationSelect, PartnerShareCard, PickListDropdown, PickListFilter, PriceInput, Protected, PurchaseOrderComboBox, QUOTATION_AUDIT_CONFIG, RadioCardGroup, ReadMoreText, RefreshButton, RichTextarea$1 as RichTextarea, SAVED_SEARCH_NAME_MAX_LENGTH, SEARCHABLE_SELECT_PAGE_SIZE, SafeImage, SaveSearchDialog, SavedSearchChipList, SavedSearchDetail, SavedSearchesMenu, ScaleRangeFilter, ScrollFade, 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, TableRowsSkeleton, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, TagsInput, TextHyperlink, TimePicker, ToggleSwitch, TriStateFilter, TruncateTooltip, TruncatedLabel, WarehouseComboBox, WarehouseFilter, ZoomSplitViewer, asList, asText, badgeVariants, buildBulkShareMessage, buildBulkShareTitle, buildInventoryPublicUrl, buildInventoryRowProps, buildInventoryShareTitle, buildNumberRuleHelp, buildWhatsappUrl, buttonVariants, cn, countries, countryByCode, createVideoMediaItem, describeFilterValue, dropdownMenuItemDestructiveClass, expandScaleRange, fieldTypeIcon, filterSavedSearches, findRegion, flagEmoji, formatAddressLocation, formatDateRange, formatFileSize, formatNumberRange, formatScaleRange, formatSelectedCount, generateActionDescription, generateTitle, getBadgeTypeForStatus, getChangePills, getCountryName, getInitials, getStatesOfCountry, iconButtonVariants, inAppNotificationCardA11y, inAppNotificationsPanelA11y, isBlank, isDuplicateSearchName, isFilterValueActive, isIndiaCountry, isKnownRegion, isPathActive, isValidAlpha2CountryCode, isValidSearchName, isValueEmpty, notify, parseNumberExpression, releaseStaleOverlayBodyLock, renderBadge, resolveCountryCode, resolveDatePreset, resolveDateRange, splitIdList, toAddressFormValues, toBoolValue, toContainsValue, toDateValue, toIdsValue, toListValue, toNumberValue, toScaleValue, useAuditShowMore, useBadge, useButton, useDropdownMenu, useInAppNotificationsPanel, useNavbar, useSidebar, valueOfType, videoThumbnailSrc, watchOverlayBodyLock };
79833
+ export { ACTIVITY_CATEGORIES, ACTIVITY_CATEGORY_META, ActionBadge, ActionButtonWithTooltip, ActiveFilterChips, ActivityFeed, AdvancedSearchDrawer, Alert, ApiComboBox, AppSidebar, AuditEntryCard, AuditHistoryPanel, AuditTimeline, AuditTimelineShimmer, Badge, BadgeType, BusinessContactStatusFilter, Button, CUSTOMER_AUDIT_CONFIG, CertificateRowList, ChangePill, Collapsible, CollapsibleCard, CollapsibleContent, CollapsibleTrigger, CompanyCard, ConfirmDialog, ContactTypeFilter, ContainsFilter, CopyButton, CountrySelect, CreateFormPageHeader, CreateFormPageShell, CurrencyDisplayTabs, CurrencyInput, CurrencyToggle, CustomCombobox, CustomFieldInput, CustomFieldValue, CustomTable, CustomizeColumnsDrawer, DATE_PRESET_OPTIONS, DIAMOND_AUDIT_CONFIG, DashboardShell, DataEditableTable, DataTable, DateInput, DateRangeFilter, DetailChip, DetailPageLayout, DetailPageSkeleton, DetailSection, DocumentDeleteDialog, DocumentDetailSkeleton, DocumentHero, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, EmptyValue, EntityHeader, FILTER_COUNT_BADGE_CLASS_NAME, Field, FieldSkeleton, FileUploader, FilterCardSkeleton, FilterCellPopover, FilterEmptyState, FilterField, FilterFieldCard, FilterFieldCell, FilterFieldControl, FilterMultiSelect, FilterPanel, FilterSelect, FilterSurface, FilterSurfaceGroup, FilterSurfaceMore, FormSectionCard, FormSectionCardSkeleton, GEM_AUDIT_CONFIG, HistoryEntryCard, HistoryTimeline, HistoryTimelineShimmer, INVOICE_AUDIT_CONFIG, IconButton, IdHyperlinkText, IdListInput, InAppNotificationCard, InAppNotificationsPanel, InfoBanner, InventoryComboBox, InventoryItemCard, InventoryItemRow, InvoiceComboBox, KYCStatusFilter, KeyValueGrid, LAYOUT_AUDIT_CONFIG, LabeledToggle, LineItemsCard, LineProductCell, LineProductThumb, LineProductTypeChip, LineRowActionsMenu, LineTable, LineTableEmpty, MEMO_IN_AUDIT_CONFIG, MEMO_OUT_AUDIT_CONFIG, MediaGallery, MemoInComboBox, MetricCard, MetricRow, MetricTile, Modal, MoreInfoPanel, MoreInfoTrigger, NOT_CAPTURED, Navbar, NavbarActions, NavbarAvatar, NavbarIconButton, NavbarSearch, NavbarTitle, NumberExpressionFilter, NumberInput, NumberRangeInputs, NumberedStepCard, OtpInput, OwnershipFilter, OwnershipSplitCard, PROFORMA_AUDIT_CONFIG, PageHeader, PageTabs, Pagination, PaginationSelect, PartnerShareCard, PickListDropdown, PickListFilter, PriceInput, Protected, PurchaseOrderComboBox, QUOTATION_AUDIT_CONFIG, RadioCardGroup, ReadMoreText, RefreshButton, RichTextarea$1 as RichTextarea, SAVED_SEARCH_NAME_MAX_LENGTH, SEARCHABLE_SELECT_PAGE_SIZE, SafeImage, SaveSearchDialog, SavedSearchChipList, SavedSearchDetail, SavedSearchesMenu, ScaleRangeFilter, ScrollFade, 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, TableRowsSkeleton, TableSkeleton, Tabs, TabsContent, TabsList, TabsTrigger, TagsInput, TextHyperlink, TimePicker, ToggleSwitch, TriStateFilter, TruncateTooltip, TruncatedLabel, WarehouseComboBox, WarehouseFilter, ZoomSplitViewer, asList, asText, badgeVariants, buildBulkShareMessage, buildBulkShareTitle, buildInventoryPublicUrl, buildInventoryRowProps, buildInventoryShareTitle, buildNumberRuleHelp, buildWhatsappUrl, buttonVariants, cn, countries, countryByCode, createVideoMediaItem, describeFilterValue, dropdownMenuItemDestructiveClass, expandScaleRange, fieldTypeIcon, filterSavedSearches, findRegion, flagEmoji, formatAddressLocation, formatDateRange, formatFileSize, formatNumberRange, formatScaleRange, formatSelectedCount, generateActionDescription, generateTitle, getBadgeTypeForStatus, getChangePills, getCountryName, getInitials, getStatesOfCountry, iconButtonVariants, inAppNotificationCardA11y, inAppNotificationsPanelA11y, isBlank, isDuplicateSearchName, isFilterValueActive, isIndiaCountry, isKnownRegion, isPathActive, isValidAlpha2CountryCode, isValidSearchName, isValueEmpty, notify, parseNumberExpression, releaseStaleOverlayBodyLock, renderBadge, resolveCountryCode, resolveDatePreset, resolveDateRange, richTextChangeText, splitIdList, toAddressFormValues, toBoolValue, toContainsValue, toDateValue, toIdsValue, toListValue, toNumberValue, toScaleValue, useAuditShowMore, useBadge, useButton, useDropdownMenu, useInAppNotificationsPanel, useNavbar, useSidebar, valueOfType, videoThumbnailSrc, watchOverlayBodyLock };
79801
79834
  //# sourceMappingURL=index.esm.js.map