Text Utilities
toPascalCase
Converts a kebab-case or dash-separated string to PascalCase.text- String to convert (e.g., “my-component-name”)
capitalize
Capitalizes the first letter of a string.text- String to capitalize
Icon Utilities
resolveIcon
Asynchronously resolves an icon from a string name or returns the IconSource directly.icon- Icon name as string or IconSource object. If string, attempts to import from@invopop/ui-icons
Country Utilities
getCountryName
Gets the full country name from a country code using the Intl API.code- ISO 3166-1 alpha-2 country code (e.g., “US”, “GB”) or “global”
Status Utilities
getStatusType
Maps status code strings to FeedItemStatus types.status- Status code string (“OK”, “KO”, “ERR”, “RUN”, “QUEUED”, “SKIP”, “SIGNED”)
OK→successKO→failureERR→alertRUN→runQUEUED→queuedSKIP→skipSIGNED→signed
Scroll Utilities
getScrollableContainer
Finds the nearest scrollable parent element.element- Starting element to search from
scrollIntoTableView
Scrolls an element into view within a table, accounting for sticky headers and row heights.element- Table row or cell element to scroll into view
- Sticky table headers (80px offset)
- Additional row visibility for context
- Smooth scrolling behavior
- Both above and below viewport scenarios
Focus Utilities
isInputFocused
Checks if any text input, textarea, or contenteditable element currently has focus.true if an input element has focus, false otherwise
Description:
Useful for determining whether keyboard shortcuts should be active. Detects focus on:
- Text inputs (type: text, search, email, password, url)
- Textarea elements
- ContentEditable elements
Date Utilities
toCalendarDate
Converts a JavaScript Date to a CalendarDate object for use with date pickers.date- JavaScript Date object
@internationalized/date
Example:
datesFromToday
Generates a comprehensive set of date ranges relative to today.Style Utilities (from utils.ts)
cn
Merges and deduplicates Tailwind CSS classes using clsx and tailwind-merge....inputs- Class names, objects, or arrays to merge
styleToString
Converts a style object to a CSS string.style- Object with CSS property keys and values
flyAndScale
Creates a fly-in and scale animation for Svelte transitions.node- DOM element to animateparams- Optional animation parametersy- Vertical offset in pixels (default: -8)x- Horizontal offset in pixels (default: 0)start- Initial scale (default: 0.95)duration- Animation duration in ms (default: 150)
Action Utilities (from clickOutside.js)
clickOutside
Svelte action that dispatches a custom event when clicking outside an element.node- Element to watch for outside clicks
click_outside- Dispatched when clicking outside the element
- Closing dropdowns when clicking outside
- Dismissing modals
- Hiding tooltips or popovers
- Any “click away” behavior