@papernote/ui 1.10.4 → 1.10.5

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
@@ -2161,6 +2161,286 @@ const validationMessageColors = {
2161
2161
  warning: 'text-warning-600',
2162
2162
  };
2163
2163
 
2164
+ /**
2165
+ * Get the current UTC offset for a timezone
2166
+ */
2167
+ function getTimezoneOffset(timezone) {
2168
+ try {
2169
+ const now = new Date();
2170
+ const formatter = new Intl.DateTimeFormat('en-US', {
2171
+ timeZone: timezone,
2172
+ timeZoneName: 'longOffset',
2173
+ });
2174
+ const parts = formatter.formatToParts(now);
2175
+ const tzPart = parts.find(p => p.type === 'timeZoneName');
2176
+ if (tzPart?.value) {
2177
+ // Extract offset from format like "GMT-05:00" or "GMT+05:30"
2178
+ const match = tzPart.value.match(/GMT([+-]\d{2}:\d{2})/);
2179
+ if (match) {
2180
+ const offsetStr = match[1];
2181
+ const [hours, minutes] = offsetStr.split(':').map(Number);
2182
+ const sign = offsetStr.startsWith('-') ? -1 : 1;
2183
+ const totalMinutes = sign * (Math.abs(hours) * 60 + minutes);
2184
+ return {
2185
+ offset: `UTC${offsetStr}`,
2186
+ offsetMinutes: totalMinutes,
2187
+ };
2188
+ }
2189
+ // Handle "GMT" (UTC+00:00)
2190
+ if (tzPart.value === 'GMT') {
2191
+ return { offset: 'UTC+00:00', offsetMinutes: 0 };
2192
+ }
2193
+ }
2194
+ // Fallback: calculate manually
2195
+ const utcDate = new Date(now.toLocaleString('en-US', { timeZone: 'UTC' }));
2196
+ const tzDate = new Date(now.toLocaleString('en-US', { timeZone: timezone }));
2197
+ const diffMinutes = (tzDate.getTime() - utcDate.getTime()) / 60000;
2198
+ const hours = Math.floor(Math.abs(diffMinutes) / 60);
2199
+ const mins = Math.abs(diffMinutes) % 60;
2200
+ const sign = diffMinutes >= 0 ? '+' : '-';
2201
+ const offset = `UTC${sign}${String(hours).padStart(2, '0')}:${String(mins).padStart(2, '0')}`;
2202
+ return { offset, offsetMinutes: diffMinutes };
2203
+ }
2204
+ catch {
2205
+ return { offset: 'UTC+00:00', offsetMinutes: 0 };
2206
+ }
2207
+ }
2208
+ /**
2209
+ * Comprehensive list of common timezones organized by region
2210
+ */
2211
+ const TIMEZONE_DATA = {
2212
+ Africa: [
2213
+ 'Africa/Cairo',
2214
+ 'Africa/Casablanca',
2215
+ 'Africa/Johannesburg',
2216
+ 'Africa/Lagos',
2217
+ 'Africa/Nairobi',
2218
+ 'Africa/Tunis',
2219
+ ],
2220
+ America: [
2221
+ 'America/Anchorage',
2222
+ 'America/Argentina/Buenos_Aires',
2223
+ 'America/Bogota',
2224
+ 'America/Caracas',
2225
+ 'America/Chicago',
2226
+ 'America/Denver',
2227
+ 'America/Halifax',
2228
+ 'America/Lima',
2229
+ 'America/Los_Angeles',
2230
+ 'America/Mexico_City',
2231
+ 'America/New_York',
2232
+ 'America/Phoenix',
2233
+ 'America/Santiago',
2234
+ 'America/Sao_Paulo',
2235
+ 'America/Toronto',
2236
+ 'America/Vancouver',
2237
+ ],
2238
+ Antarctica: [
2239
+ 'Antarctica/McMurdo',
2240
+ 'Antarctica/Palmer',
2241
+ 'Antarctica/Syowa',
2242
+ ],
2243
+ Asia: [
2244
+ 'Asia/Bangkok',
2245
+ 'Asia/Colombo',
2246
+ 'Asia/Dhaka',
2247
+ 'Asia/Dubai',
2248
+ 'Asia/Hong_Kong',
2249
+ 'Asia/Jakarta',
2250
+ 'Asia/Jerusalem',
2251
+ 'Asia/Karachi',
2252
+ 'Asia/Kathmandu',
2253
+ 'Asia/Kolkata',
2254
+ 'Asia/Kuala_Lumpur',
2255
+ 'Asia/Manila',
2256
+ 'Asia/Qatar',
2257
+ 'Asia/Riyadh',
2258
+ 'Asia/Seoul',
2259
+ 'Asia/Shanghai',
2260
+ 'Asia/Singapore',
2261
+ 'Asia/Taipei',
2262
+ 'Asia/Tehran',
2263
+ 'Asia/Tokyo',
2264
+ ],
2265
+ Atlantic: [
2266
+ 'Atlantic/Azores',
2267
+ 'Atlantic/Bermuda',
2268
+ 'Atlantic/Canary',
2269
+ 'Atlantic/Cape_Verde',
2270
+ 'Atlantic/Reykjavik',
2271
+ ],
2272
+ Australia: [
2273
+ 'Australia/Adelaide',
2274
+ 'Australia/Brisbane',
2275
+ 'Australia/Darwin',
2276
+ 'Australia/Hobart',
2277
+ 'Australia/Melbourne',
2278
+ 'Australia/Perth',
2279
+ 'Australia/Sydney',
2280
+ ],
2281
+ Europe: [
2282
+ 'Europe/Amsterdam',
2283
+ 'Europe/Athens',
2284
+ 'Europe/Berlin',
2285
+ 'Europe/Brussels',
2286
+ 'Europe/Bucharest',
2287
+ 'Europe/Budapest',
2288
+ 'Europe/Copenhagen',
2289
+ 'Europe/Dublin',
2290
+ 'Europe/Helsinki',
2291
+ 'Europe/Istanbul',
2292
+ 'Europe/Lisbon',
2293
+ 'Europe/London',
2294
+ 'Europe/Madrid',
2295
+ 'Europe/Moscow',
2296
+ 'Europe/Oslo',
2297
+ 'Europe/Paris',
2298
+ 'Europe/Prague',
2299
+ 'Europe/Rome',
2300
+ 'Europe/Stockholm',
2301
+ 'Europe/Vienna',
2302
+ 'Europe/Warsaw',
2303
+ 'Europe/Zurich',
2304
+ ],
2305
+ Indian: [
2306
+ 'Indian/Maldives',
2307
+ 'Indian/Mauritius',
2308
+ ],
2309
+ Pacific: [
2310
+ 'Pacific/Auckland',
2311
+ 'Pacific/Fiji',
2312
+ 'Pacific/Guam',
2313
+ 'Pacific/Honolulu',
2314
+ 'Pacific/Noumea',
2315
+ 'Pacific/Pago_Pago',
2316
+ 'Pacific/Tahiti',
2317
+ ],
2318
+ };
2319
+ /**
2320
+ * Region display names
2321
+ */
2322
+ const REGION_LABELS = {
2323
+ Africa: 'Africa',
2324
+ America: 'Americas',
2325
+ Antarctica: 'Antarctica',
2326
+ Asia: 'Asia',
2327
+ Atlantic: 'Atlantic',
2328
+ Australia: 'Australia',
2329
+ Europe: 'Europe',
2330
+ Indian: 'Indian Ocean',
2331
+ Pacific: 'Pacific',
2332
+ };
2333
+ /**
2334
+ * Get the user's local timezone
2335
+ */
2336
+ function getLocalTimezone() {
2337
+ try {
2338
+ return Intl.DateTimeFormat().resolvedOptions().timeZone;
2339
+ }
2340
+ catch {
2341
+ return 'UTC';
2342
+ }
2343
+ }
2344
+ /**
2345
+ * Check if a timezone string is valid
2346
+ */
2347
+ function isValidTimezone(timezone) {
2348
+ try {
2349
+ Intl.DateTimeFormat(undefined, { timeZone: timezone });
2350
+ return true;
2351
+ }
2352
+ catch {
2353
+ return false;
2354
+ }
2355
+ }
2356
+ /**
2357
+ * TimezoneSelector - A searchable dropdown for selecting timezones
2358
+ *
2359
+ * Provides a user-friendly way to select from IANA timezones, organized by
2360
+ * geographic region with UTC offset display.
2361
+ *
2362
+ * @example Basic usage
2363
+ * ```tsx
2364
+ * const [timezone, setTimezone] = useState('America/New_York');
2365
+ *
2366
+ * <TimezoneSelector
2367
+ * label="Select Timezone"
2368
+ * value={timezone}
2369
+ * onChange={setTimezone}
2370
+ * />
2371
+ * ```
2372
+ *
2373
+ * @example With local timezone detection
2374
+ * ```tsx
2375
+ * import { TimezoneSelector, getLocalTimezone } from 'notebook-ui';
2376
+ *
2377
+ * const [timezone, setTimezone] = useState(getLocalTimezone());
2378
+ *
2379
+ * <TimezoneSelector
2380
+ * value={timezone}
2381
+ * onChange={setTimezone}
2382
+ * includeUTC
2383
+ * clearable
2384
+ * />
2385
+ * ```
2386
+ *
2387
+ * @example Filter to specific regions
2388
+ * ```tsx
2389
+ * <TimezoneSelector
2390
+ * value={timezone}
2391
+ * onChange={setTimezone}
2392
+ * regions={['America', 'Europe']}
2393
+ * placeholder="Select US or European timezone..."
2394
+ * />
2395
+ * ```
2396
+ */
2397
+ const TimezoneSelector = React__default.forwardRef(({ value, onChange, label, helperText, error, disabled = false, placeholder = 'Select timezone...', clearable = false, loading = false, size = 'md', includeUTC = true, regions, showOffset = true, }, ref) => {
2398
+ // Build timezone options grouped by region
2399
+ const groups = useMemo(() => {
2400
+ const result = [];
2401
+ // Add UTC as a special option at the top
2402
+ if (includeUTC) {
2403
+ result.push({
2404
+ label: 'Universal',
2405
+ options: [
2406
+ {
2407
+ value: 'UTC',
2408
+ label: showOffset ? 'UTC (UTC+00:00)' : 'UTC',
2409
+ },
2410
+ ],
2411
+ });
2412
+ }
2413
+ // Determine which regions to include
2414
+ const activeRegions = regions || Object.keys(TIMEZONE_DATA);
2415
+ // Build groups for each region
2416
+ for (const region of activeRegions) {
2417
+ const timezones = TIMEZONE_DATA[region];
2418
+ if (!timezones)
2419
+ continue;
2420
+ // Build options with offset info and sort by offset
2421
+ const options = timezones
2422
+ .map(tz => {
2423
+ const { offset, offsetMinutes } = getTimezoneOffset(tz);
2424
+ const city = tz.split('/').pop()?.replace(/_/g, ' ') || tz;
2425
+ return {
2426
+ value: tz,
2427
+ label: showOffset ? `${city} (${offset})` : city,
2428
+ offsetMinutes,
2429
+ };
2430
+ })
2431
+ .sort((a, b) => a.offsetMinutes - b.offsetMinutes)
2432
+ .map(({ value, label }) => ({ value, label }));
2433
+ result.push({
2434
+ label: REGION_LABELS[region],
2435
+ options,
2436
+ });
2437
+ }
2438
+ return result;
2439
+ }, [includeUTC, regions, showOffset]);
2440
+ return (jsx(Select, { ref: ref, groups: groups, value: value, onChange: onChange, label: label, helperText: helperText, error: error, disabled: disabled, placeholder: placeholder, clearable: clearable, loading: loading, size: size, searchable: true, virtualized: false }));
2441
+ });
2442
+ TimezoneSelector.displayName = 'TimezoneSelector';
2443
+
2164
2444
  /**
2165
2445
  * Combobox component - searchable select with typeahead and custom value support.
2166
2446
  *
@@ -11510,14 +11790,17 @@ mobileView = 'auto', cardConfig, cardGap = 'md', cardClassName, }) {
11510
11790
  const columnKey = String(column.key);
11511
11791
  const dynamicWidth = columnWidths[columnKey];
11512
11792
  return (jsx("col", { style: getColumnStyle(column, dynamicWidth) }, index));
11513
- })] }), jsx("thead", { className: `bg-paper-100 sticky top-0 z-10 ${headerClassName}`, children: jsxs("tr", { className: "table-header-row", children: [selectable && (jsx("th", { className: `sticky left-0 bg-paper-100 ${currentDensity.header} border-b ${borderColor} z-20 w-12 ${bordered ? `border ${borderColor}` : ''}`, children: jsx("input", { type: "checkbox", checked: selectedRowsSet.size === data.length && data.length > 0, onChange: handleSelectAll, className: "w-4 h-4 text-accent-600 border-paper-300 rounded focus:ring-accent-400", "aria-label": "Select all rows" }) })), ((expandable || expandedRowConfig) && showExpandChevron) && (jsx("th", { className: `sticky left-0 bg-paper-100 px-2 ${currentDensity.header} border-b ${borderColor} z-19 w-10 ${bordered ? `border ${borderColor}` : ''}` })), allActions.length > 0 && (jsx("th", { className: `sticky left-0 bg-paper-100 ${currentDensity.header} text-center text-xs font-medium text-ink-700 uppercase tracking-wider border-b ${borderColor} z-20 ${bordered ? `border ${borderColor}` : ''}`, style: { width: '28px', padding: 0 } })), visibleColumns.map((column) => {
11793
+ })] }), jsx("thead", { className: `bg-paper-100 sticky top-0 z-10 ${headerClassName}`, children: jsxs("tr", { className: "table-header-row", children: [selectable && (jsx("th", { className: `sticky left-0 bg-paper-100 ${currentDensity.header} border-b ${borderColor} z-20 w-12 ${bordered ? `border ${borderColor}` : ''}`, children: jsx("input", { type: "checkbox", checked: selectedRowsSet.size === data.length && data.length > 0, onChange: handleSelectAll, className: "w-4 h-4 text-accent-600 border-paper-300 rounded focus:ring-accent-400", "aria-label": "Select all rows" }) })), ((expandable || expandedRowConfig) && showExpandChevron) && (jsx("th", { className: `sticky left-0 bg-paper-100 px-2 ${currentDensity.header} border-b ${borderColor} z-19 w-10 ${bordered ? `border ${borderColor}` : ''}` })), allActions.length > 0 && (jsx("th", { className: `sticky left-0 bg-paper-100 text-center text-xs font-medium text-ink-700 uppercase tracking-wider border-b ${borderColor} z-20 ${bordered ? `border ${borderColor}` : ''}`, style: { width: '28px', padding: '0' } })), visibleColumns.map((column, colIdx) => {
11514
11794
  const columnKey = String(column.key);
11515
11795
  const dynamicWidth = columnWidths[columnKey];
11516
11796
  const thRef = useRef(null);
11517
11797
  const isDragging = draggingColumn === columnKey;
11518
11798
  const isDragOver = dragOverColumn === columnKey;
11799
+ // Reduce left padding on first column when there are action buttons (match body cells)
11800
+ const isFirstColumn = colIdx === 0;
11801
+ const headerPaddingClass = isFirstColumn && allActions.length > 0 ? 'pl-3' : '';
11519
11802
  return (jsxs("th", { ref: thRef, draggable: reorderable, onDragStart: (e) => reorderable && handleDragStart(e, columnKey), onDragOver: (e) => reorderable && handleDragOver(e, columnKey), onDragEnd: handleDragEnd, onDrop: (e) => reorderable && handleDrop(e, columnKey), className: `
11520
- ${currentDensity.header} text-left border-b ${borderColor} ${bordered ? `border ${borderColor}` : ''} relative
11803
+ ${currentDensity.header} ${headerPaddingClass} text-left border-b ${borderColor} ${bordered ? `border ${borderColor}` : ''} relative
11521
11804
  ${reorderable ? 'cursor-move' : ''}
11522
11805
  ${isDragging ? 'opacity-50' : ''}
11523
11806
  ${isDragOver ? 'bg-accent-100' : ''}
@@ -58193,5 +58476,5 @@ function Responsive({ mobile, tablet, desktop, }) {
58193
58476
  return jsx(Fragment, { children: mobile || tablet || desktop });
58194
58477
  }
58195
58478
 
58196
- export { Accordion, ActionBar, ActionBarCenter, ActionBarLeft, ActionBarRight, ActionButton, AdminModal, Alert, AlertDialog, AppLayout, Autocomplete, Avatar, BREAKPOINTS, Badge, BottomNavigation, BottomNavigationSpacer, BottomSheet, BottomSheetActions, BottomSheetContent, BottomSheetHeader, Box, Breadcrumbs, Button, ButtonGroup, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CardView, Carousel, Checkbox, CheckboxList, Chip, ChipGroup, Collapsible, ColorPicker, Combobox, ComingSoon, CommandPalette, CompactStat, ConfirmDialog, ContextMenu, ControlBar, CurrencyDisplay, CurrencyInput, Dashboard, DashboardContent, DashboardHeader, DataGrid, DataTable, DataTableCardView, DateDisplay, DatePicker, DateRangePicker, DateTimePicker, DesktopOnly, Drawer, DrawerFooter, DropZone, Dropdown, DropdownTrigger, EmptyState, ErrorBoundary, ExpandablePanel, ExpandablePanelContainer, ExpandablePanelSpacer, ExpandableRowButton, ExpandableToolbar, ExpandedRowEditForm, ExportButton, FORMULA_CATEGORIES, FORMULA_DEFINITIONS, FORMULA_NAMES, FieldArray, FileUpload, FilterBar, FilterControls, FilterStatusBanner, FloatingActionButton, Form, FormContext, FormControl, FormWizard, Grid, GridItem, Hide, HorizontalScroll, HoverCard, InfiniteScroll, Input, KanbanBoard, Layout, Loading, LoadingOverlay, Logo, MarkdownEditor, MaskedInput, Menu, MenuDivider, MobileHeader, MobileHeaderSpacer, MobileLayout, MobileOnly, MobileProvider, Modal, ModalFooter, MultiSelect, NotificationBanner, NotificationBar, NotificationBell, NotificationIndicator, NumberInput, Page, PageHeader, PageLayout, PageNavigation, Pagination, PasswordInput, Popover, Progress, PullToRefresh, QueryTransparency, RadioGroup, Rating, Responsive, RichTextEditor, SearchBar, SearchableList, Select, Separator, Show, Sidebar, SidebarGroup, Skeleton, SkeletonCard$1 as SkeletonCard, SkeletonTable, Slider, Spreadsheet, SpreadsheetReport, Stack, StatCard, StatItem, StatsCardGrid, StatsGrid, StatusBadge, StatusBar, StepIndicator, Stepper, SwipeActions, SwipeableCard, Switch, Tabs, TabsContent, TabsList, TabsRoot, TabsTrigger, Text, Textarea, ThemeToggle, TimePicker, Timeline, Toast, ToastContainer, Tooltip, Transfer, TreeView, TwoColumnContent, UserProfileButton, addErrorMessage, addInfoMessage, addSuccessMessage, addWarningMessage, calculateColumnWidth, createActionsSection, createFiltersSection, createMultiSheetExcel, createPageControlsSection, createQueryDetailsSection, exportDataTableToExcel, exportToExcel, formatStatisticValue, formatStatistics, getFormula, getFormulasByCategory, loadColumnOrder, loadColumnWidths, reorderArray, saveColumnOrder, saveColumnWidths, searchFormulas, statusManager, useBreadcrumbReset, useBreakpoint, useBreakpointValue, useColumnReorder, useColumnResize, useCommandPalette, useConfirmDialog, useFABScroll, useFormContext, useIsDesktop, useIsMobile, useIsTablet, useIsTouchDevice, useMediaQuery, useMobileContext, useOrientation, usePrefersMobile, useResponsiveCallback, useSafeAreaInsets, useViewportSize, withMobileContext };
58479
+ export { Accordion, ActionBar, ActionBarCenter, ActionBarLeft, ActionBarRight, ActionButton, AdminModal, Alert, AlertDialog, AppLayout, Autocomplete, Avatar, BREAKPOINTS, Badge, BottomNavigation, BottomNavigationSpacer, BottomSheet, BottomSheetActions, BottomSheetContent, BottomSheetHeader, Box, Breadcrumbs, Button, ButtonGroup, Calendar, Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, CardView, Carousel, Checkbox, CheckboxList, Chip, ChipGroup, Collapsible, ColorPicker, Combobox, ComingSoon, CommandPalette, CompactStat, ConfirmDialog, ContextMenu, ControlBar, CurrencyDisplay, CurrencyInput, Dashboard, DashboardContent, DashboardHeader, DataGrid, DataTable, DataTableCardView, DateDisplay, DatePicker, DateRangePicker, DateTimePicker, DesktopOnly, Drawer, DrawerFooter, DropZone, Dropdown, DropdownTrigger, EmptyState, ErrorBoundary, ExpandablePanel, ExpandablePanelContainer, ExpandablePanelSpacer, ExpandableRowButton, ExpandableToolbar, ExpandedRowEditForm, ExportButton, FORMULA_CATEGORIES, FORMULA_DEFINITIONS, FORMULA_NAMES, FieldArray, FileUpload, FilterBar, FilterControls, FilterStatusBanner, FloatingActionButton, Form, FormContext, FormControl, FormWizard, Grid, GridItem, Hide, HorizontalScroll, HoverCard, InfiniteScroll, Input, KanbanBoard, Layout, Loading, LoadingOverlay, Logo, MarkdownEditor, MaskedInput, Menu, MenuDivider, MobileHeader, MobileHeaderSpacer, MobileLayout, MobileOnly, MobileProvider, Modal, ModalFooter, MultiSelect, NotificationBanner, NotificationBar, NotificationBell, NotificationIndicator, NumberInput, Page, PageHeader, PageLayout, PageNavigation, Pagination, PasswordInput, Popover, Progress, PullToRefresh, QueryTransparency, RadioGroup, Rating, Responsive, RichTextEditor, SearchBar, SearchableList, Select, Separator, Show, Sidebar, SidebarGroup, Skeleton, SkeletonCard$1 as SkeletonCard, SkeletonTable, Slider, Spreadsheet, SpreadsheetReport, Stack, StatCard, StatItem, StatsCardGrid, StatsGrid, StatusBadge, StatusBar, StepIndicator, Stepper, SwipeActions, SwipeableCard, Switch, Tabs, TabsContent, TabsList, TabsRoot, TabsTrigger, Text, Textarea, ThemeToggle, TimePicker, Timeline, TimezoneSelector, Toast, ToastContainer, Tooltip, Transfer, TreeView, TwoColumnContent, UserProfileButton, addErrorMessage, addInfoMessage, addSuccessMessage, addWarningMessage, calculateColumnWidth, createActionsSection, createFiltersSection, createMultiSheetExcel, createPageControlsSection, createQueryDetailsSection, exportDataTableToExcel, exportToExcel, formatStatisticValue, formatStatistics, getFormula, getFormulasByCategory, getLocalTimezone, isValidTimezone, loadColumnOrder, loadColumnWidths, reorderArray, saveColumnOrder, saveColumnWidths, searchFormulas, statusManager, useBreadcrumbReset, useBreakpoint, useBreakpointValue, useColumnReorder, useColumnResize, useCommandPalette, useConfirmDialog, useFABScroll, useFormContext, useIsDesktop, useIsMobile, useIsTablet, useIsTouchDevice, useMediaQuery, useMobileContext, useOrientation, usePrefersMobile, useResponsiveCallback, useSafeAreaInsets, useViewportSize, withMobileContext };
58197
58480
  //# sourceMappingURL=index.esm.js.map