@caratlogic/design-system 0.1.38 → 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
@@ -15484,7 +15484,10 @@ function formatRuleValue(value, unit) {
15484
15484
  const number = value.toLocaleString('en-US', { maximumFractionDigits: 2 });
15485
15485
  if (!unit)
15486
15486
  return number;
15487
- return unit === '%' ? `${number}%` : `${number} ${unit}`;
15487
+ // Symbols sit right after the number (`60%`, `34°`); words take a space (`2 ct`).
15488
+ return unit === '%' || unit === '°'
15489
+ ? `${number}${unit}`
15490
+ : `${number} ${unit}`;
15488
15491
  }
15489
15492
  /** The help popover's rule list for a column's typical range; rules use short numbers (`1k`) that the field accepts as typed. */
15490
15493
  function buildNumberRuleHelp({ low, high, exact, unit, } = DEFAULT_NUMBER_RULE_EXAMPLES) {
@@ -15739,8 +15742,10 @@ function getPanelClassName(variant, active, className) {
15739
15742
  return cn('flex min-w-0 flex-col gap-3', variant === 'card' && 'rounded-xl border bg-card p-4', variant === 'card' && (active ? 'border-primary' : 'border-border'), variant === 'popover' && 'p-3', className);
15740
15743
  }
15741
15744
  function getTitleClassName(variant) {
15742
- return cn('flex items-center gap-2 text-foreground', variant === 'section'
15743
- ? 'text-xs font-medium text-label'
15745
+ return cn('flex items-center gap-2 text-foreground',
15746
+ // A section title is a field name: between the card title and grey helper text.
15747
+ variant === 'section'
15748
+ ? 'text-xs font-medium text-foreground/70'
15744
15749
  : 'text-sm font-semibold');
15745
15750
  }
15746
15751
 
@@ -70254,6 +70259,12 @@ function formatPrimitive(val) {
70254
70259
  }
70255
70260
  return null;
70256
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
+ }
70257
70268
  const MEDIA_KEYS = new Set(['urls', 'keys']);
70258
70269
  const INTERNAL_KEYS = new Set(['createdAt', 'updatedAt', '__v']);
70259
70270
  function mediaCount(v, singular, plural) {
@@ -70282,6 +70293,10 @@ function flattenRecord(obj, prefix = '') {
70282
70293
  if (INTERNAL_KEYS.has(k))
70283
70294
  continue;
70284
70295
  const label = prefix ? `${prefix} › ${toLabel(k)}` : toLabel(k);
70296
+ if (isRichText(v)) {
70297
+ result.push({ label, value: '', richText: true });
70298
+ continue;
70299
+ }
70285
70300
  if ((k === 'images' || k === 'videos') &&
70286
70301
  typeof v === 'object' &&
70287
70302
  !Array.isArray(v)) {
@@ -70439,8 +70454,13 @@ function generateTitle(row, config) {
70439
70454
  if (productItemsLabel)
70440
70455
  return `${name} updated ${labels.length} fields and product ${productItemsLabel}`;
70441
70456
  const first = labels[0];
70442
- const newVal = newEntries.find((e) => e.label === first)?.value;
70443
- 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}`;
70444
70464
  if (totalCount === 1)
70445
70465
  return hasOld
70446
70466
  ? `${name} updated ${first} to ${newVal ?? '—'}`
@@ -70554,14 +70574,25 @@ function generateActorAction(row, config) {
70554
70574
  return `performed ${row.action}`;
70555
70575
  }
70556
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
+ }
70557
70589
  function getChangePills(row, config) {
70558
70590
  const oldV = row.oldValue;
70559
70591
  const newV = row.newValue;
70560
70592
  if (row.action === 'CREATE') {
70561
- return (newV ? flattenRecord(newV) : []).map((e) => ({
70562
- label: e.label,
70563
- newVal: e.value,
70564
- }));
70593
+ return (newV ? flattenRecord(newV) : []).map((e) => e.richText
70594
+ ? { label: e.label, changeNote: 'added' }
70595
+ : { label: e.label, newVal: e.value });
70565
70596
  }
70566
70597
  if (row.action === 'UPDATE') {
70567
70598
  const pills = [];
@@ -70586,13 +70617,14 @@ function getChangePills(row, config) {
70586
70617
  ...newEntries.map((e) => e.label),
70587
70618
  ]),
70588
70619
  ];
70589
- const oldMap = Object.fromEntries(oldEntries.map((e) => [e.label, e.value]));
70590
- const newMap = Object.fromEntries(newEntries.map((e) => [e.label, e.value]));
70591
- pills.push(...labels.map((label) => ({
70592
- label,
70593
- oldVal: oldMap[label],
70594
- newVal: newMap[label],
70595
- })));
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
+ }));
70596
70628
  // Handle structured productItems: added / removed / updated
70597
70629
  if (hasStructuredItems) {
70598
70630
  const structured = newProductItems;
@@ -70736,10 +70768,13 @@ function getEntryNotes(row, config) {
70736
70768
  row.oldValue?.notes ??
70737
70769
  newV?.notes ??
70738
70770
  mergeParent?.notes;
70739
- return notes || undefined;
70771
+ return notes && !isRichText(notes) ? notes : undefined;
70740
70772
  }
70741
70773
  // ─── ChangePill ───────────────────────────────────────────────────────────────
70742
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
+ }
70743
70778
  const isRemoved = pill.variant === 'removed';
70744
70779
  const isAdded = pill.variant === 'added';
70745
70780
  const isDiff = !isRemoved &&
@@ -70893,6 +70928,9 @@ const PillContent = ({ pill }) => {
70893
70928
  const hasBreadcrumb = labelParts.length > 1;
70894
70929
  const showArrow = pill.oldVal !== undefined && pill.newVal !== undefined;
70895
70930
  const hasOnlyNew = pill.newVal !== undefined && pill.oldVal === undefined;
70931
+ if (pill.changeNote) {
70932
+ return jsx("span", { className: "text-foreground", children: richTextChangeText(pill) });
70933
+ }
70896
70934
  if (pill.variant === 'added') {
70897
70935
  return jsxs("span", { className: "font-semibold text-primary", children: ["+ ", pill.label] });
70898
70936
  }
@@ -79792,5 +79830,5 @@ var RichTextAreaImpl = /*#__PURE__*/Object.freeze({
79792
79830
  RichTextarea: RichTextarea
79793
79831
  });
79794
79832
 
79795
- 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 };
79796
79834
  //# sourceMappingURL=index.esm.js.map