@olwiba/ui 0.2.6 → 0.2.7

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.d.ts CHANGED
@@ -143,13 +143,25 @@ interface AppContentProps extends React__default.HTMLAttributes<HTMLDivElement>
143
143
  }
144
144
  declare function AppContent({ spacing, maxWidth, className, children, ...props }: AppContentProps): react_jsx_runtime.JSX.Element;
145
145
 
146
+ /**
147
+ * Responsive ramps per column count. Every ramp starts at a single column —
148
+ * a card grid that stays multi-column on a phone is unreadable — and adds
149
+ * columns at breakpoints wide enough to keep each card legible.
150
+ *
151
+ * Written out in full rather than composed, because Tailwind scans source for
152
+ * complete class strings; a template literal like `xl:grid-cols-${n}` produces
153
+ * nothing at build time.
154
+ */
146
155
  declare const columnsMap: {
147
156
  1: string;
148
157
  2: string;
149
158
  3: string;
150
159
  4: string;
160
+ 5: string;
161
+ 6: string;
151
162
  };
152
163
  declare const gapMap: {
164
+ none: string;
153
165
  sm: string;
154
166
  md: string;
155
167
  lg: string;
@@ -161,8 +173,14 @@ declare const spanMap: {
161
173
  4: string;
162
174
  full: string;
163
175
  };
176
+ type AppGridColumns = keyof typeof columnsMap;
164
177
  interface AppGridProps extends React__default.HTMLAttributes<HTMLDivElement> {
165
- columns?: keyof typeof columnsMap;
178
+ /**
179
+ * Columns at the widest breakpoint. Narrower screens step down through the
180
+ * ramp automatically, so this is "how dense at full width", not a fixed
181
+ * count. Default 3.
182
+ */
183
+ columns?: AppGridColumns;
166
184
  gap?: keyof typeof gapMap;
167
185
  }
168
186
  declare function AppGrid({ columns, gap, className, children, ...props }: AppGridProps): react_jsx_runtime.JSX.Element;
@@ -1191,6 +1209,79 @@ interface DataTableProps<TData> {
1191
1209
  */
1192
1210
  declare function DataTable<TData>({ columns, data, searchKey, searchPlaceholder, selectable, onSelectionChange, pageSize, toolbar, onRowClick, emptyMessage, className, }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
1193
1211
 
1212
+ type ViewMode = 'cards' | 'list';
1213
+ interface UseViewModeReturn {
1214
+ view: ViewMode;
1215
+ setView: (view: ViewMode) => void;
1216
+ /**
1217
+ * False until the stored preference is readable. Render a skeleton or hold
1218
+ * the section until this is true — see the note below on why.
1219
+ */
1220
+ ready: boolean;
1221
+ }
1222
+ /**
1223
+ * Remembered cards/list preference.
1224
+ *
1225
+ * Returns the fallback on the server and on the first client render, then
1226
+ * settles to the stored value once mounted. Returning the stored value
1227
+ * immediately would have the server emit card markup while the client builds
1228
+ * a table — a hydration mismatch — and painting the fallback first flashes
1229
+ * the wrong view at someone who chose the other one. `ready` lets callers
1230
+ * wait for the real answer instead of doing either.
1231
+ *
1232
+ * The key is shared by default so the choice reads as one product-wide
1233
+ * preference: pick list on one page and every page follows. Pass a distinct
1234
+ * key where a page genuinely wants its own.
1235
+ */
1236
+ declare function useViewMode(key?: string, fallback?: ViewMode): UseViewModeReturn;
1237
+
1238
+ interface DataViewProps<TData> {
1239
+ items: TData[];
1240
+ /** Stable key per item. */
1241
+ getRowId: (item: TData) => string;
1242
+ /** Card renderer for the grid view. */
1243
+ renderCard: (item: TData) => React.ReactNode;
1244
+ /** Columns for the list view. */
1245
+ columns: ColumnDef<TData>[];
1246
+ view: ViewMode;
1247
+ /**
1248
+ * False while a persisted preference is still being read. The whole view is
1249
+ * withheld until true — see the note on the component.
1250
+ */
1251
+ ready?: boolean;
1252
+ /** Grid density at the widest breakpoint. Default 3. */
1253
+ gridColumns?: AppGridColumns;
1254
+ gap?: 'none' | 'sm' | 'md' | 'lg';
1255
+ /** Rendered instead of either view when there is nothing to show. */
1256
+ empty?: React.ReactNode;
1257
+ /** Shown while `ready` is false. Defaults to nothing. */
1258
+ placeholder?: React.ReactNode;
1259
+ searchKey?: string;
1260
+ searchPlaceholder?: string;
1261
+ pageSize?: number;
1262
+ emptyMessage?: string;
1263
+ onRowClick?: (row: TData) => void;
1264
+ className?: string;
1265
+ }
1266
+ /**
1267
+ * A collection rendered either as a grid of cards or as a table, from one set
1268
+ * of data.
1269
+ *
1270
+ * Knows nothing about what it is listing: callers supply a card renderer and
1271
+ * table columns. Cards are for "what arrived recently", the table for
1272
+ * comparing many rows at once, and switching between them should not mean two
1273
+ * page implementations that drift apart.
1274
+ *
1275
+ * The `ready` gate is the subtle part, and the reason this is a component
1276
+ * rather than a snippet to copy. A persisted preference cannot be read during
1277
+ * SSR or the first client render, so a page that renders its default
1278
+ * immediately will either mismatch on hydration or visibly flash the wrong
1279
+ * view at anyone who chose the other one. Holding the section until the
1280
+ * preference resolves avoids both, and putting that here means no consumer
1281
+ * has to work it out again.
1282
+ */
1283
+ declare function DataView<TData>({ items, getRowId, renderCard, columns, view, ready, gridColumns, gap, empty, placeholder, searchKey, searchPlaceholder, pageSize, emptyMessage, onRowClick, className, }: DataViewProps<TData>): react_jsx_runtime.JSX.Element;
1284
+
1194
1285
  interface ChartSeries {
1195
1286
  /** Data key to plot. */
1196
1287
  key: string;
@@ -1439,6 +1530,58 @@ interface ImageCardProps extends React.HTMLAttributes<HTMLDivElement> {
1439
1530
  }
1440
1531
  declare function ImageCard({ src, alt, overlay, aspectRatio, children, className, ...props }: ImageCardProps): react_jsx_runtime.JSX.Element;
1441
1532
 
1533
+ declare const bannerAspectClass: {
1534
+ wide: string;
1535
+ video: string;
1536
+ square: string;
1537
+ };
1538
+ interface MediaCardProps extends React.HTMLAttributes<HTMLDivElement> {
1539
+ /**
1540
+ * Banner rendered above the content, clipped to the card's rounded corners.
1541
+ * A ReactNode rather than a src, so a brand fallback, an inline SVG, a map,
1542
+ * or a plain <img> all work — this is the difference from ImageCard, which
1543
+ * takes a URL and is the right choice when you actually have one.
1544
+ */
1545
+ banner?: React.ReactNode;
1546
+ /** Banner proportions. Default 'wide' (3:1), which suits a header strip. */
1547
+ bannerAspect?: keyof typeof bannerAspectClass;
1548
+ /**
1549
+ * Pinned to the bottom of the card. In a grid this is what keeps the
1550
+ * primary action on a shared baseline across a row, however unevenly the
1551
+ * titles above it wrap.
1552
+ */
1553
+ footer?: React.ReactNode;
1554
+ children?: React.ReactNode;
1555
+ }
1556
+ /**
1557
+ * A Card with an optional banner and a bottom-pinned footer.
1558
+ *
1559
+ * Deliberately knows nothing about what it is showing — the domain-shaped
1560
+ * cards (a property, a monitor, an article) compose this and supply their own
1561
+ * content. It exists because "banner, then content, then an action pinned to
1562
+ * the bottom, all the same height across a row" was being hand-rolled per
1563
+ * product, and the equal-height part in particular is easy to get subtly
1564
+ * wrong.
1565
+ *
1566
+ * `h-full` is on the card itself so a bare `<MediaCard>` inside a grid cell
1567
+ * fills that cell without every caller remembering to ask.
1568
+ */
1569
+ declare function MediaCard({ banner, bannerAspect, footer, children, className, ...props }: MediaCardProps): react_jsx_runtime.JSX.Element;
1570
+
1571
+ interface ViewToggleProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'> {
1572
+ view: ViewMode;
1573
+ onChange: (view: ViewMode) => void;
1574
+ labels?: {
1575
+ cards?: string;
1576
+ list?: string;
1577
+ };
1578
+ }
1579
+ /**
1580
+ * Two-state segmented control for switching a collection between cards and a
1581
+ * list. Controlled — pair it with useViewMode to persist the choice.
1582
+ */
1583
+ declare function ViewToggle({ view, onChange, labels, className, ...props }: ViewToggleProps): react_jsx_runtime.JSX.Element;
1584
+
1442
1585
  interface FlowConnectorProps {
1443
1586
  /** Line axis. Default: 'vertical'. */
1444
1587
  direction?: 'vertical' | 'horizontal';
@@ -1714,4 +1857,4 @@ interface UsePaginationReturn {
1714
1857
  }
1715
1858
  declare function usePagination(total: number, pageSize: number): UsePaginationReturn;
1716
1859
 
1717
- export { ActivityFeed, type ActivityFeedItem, type ActivityFeedProps, AnimatedPill, type AnimatedPillProps, AppContent, type AppContentProps, AppGrid, AppGridCell, type AppGridCellProps, type AppGridProps, type AppNavItem, AppScreen, AppShell, type AppShellAction, type AppShellBrand, type AppShellProps, type AppShellRenderLink, type AppShellUser, type AuthFormProps, AuthSection, type AuthSectionProps, Badge, type BadgeProps, type BillingInvoice, BillingPanel, type BillingPanelProps, type BillingPaymentMethod, type BillingUsageMetric, BrandColorSwitchMinimal, Button, type ButtonProps, Card, type CardProps, Carousel, type CarouselProps, ChangelogCard, type ChangelogCardProps, type ChangelogHighlight, ChangelogList, type ChangelogListProps, type ChangelogReleaseType, Chart, type ChartProps, type ChartSeries, Checkbox, type CheckboxProps, CommandMenu, type CommandMenuGroup, type CommandMenuItem, type CommandMenuProps, type ComparisonColumn, ComparisonSection, type ComparisonSectionProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmOptions, type ContactInfoItem, ContactSection, type ContactSectionProps, ContextMenu, type ContextMenuDef, type ContextMenuProps, CountUp, type CountUpProps, CountdownTimer, type CountdownTimerProps, CtaSection, type CtaSectionProps, DataTable, type DataTableProps, DevBanner, type DevBannerProps, Dock, type DockItem, type DockProps, EmptyState, type EmptyStateProps, ErrorPage, type ErrorPageProps, FadeIn, type FadeInProps, FaqSection, type FaqSectionProps, FeatureCard, type FeatureCardProps, type FeatureMarqueeItem, type FeatureMarqueeRow, FeatureMarqueeSection, type FeatureMarqueeSectionProps, FeaturesSection, type FeaturesSectionProps, FileUpload, type FileUploadEntry, type FileUploadProps, FlowBracket, type FlowBracketProps, FlowConnector, type FlowConnectorProps, Footer, type FooterProps, FullPageSpinner, GlassCard, type GlassCardProps, Grid, GridItem, type GridItemProps, type GridProps, type GroupedFeatureGroup, GroupedFeaturesSection, type GroupedFeaturesSectionProps, HeroSection, type HeroSectionProps, type Hotkey, ImageCard, type ImageCardProps, Input, type InputProps, LogoStrip, type LogoStripProps, type MarketingSectionSpacing, ModeSwitchMinimal, Navbar, type NavbarProps, NewsletterSection, type NewsletterSectionProps, type NotificationItem, NotificationToast, type NotificationToastProps, NotificationsPopover, type NotificationsPopoverProps, type NotifyAction, type NotifyOptions, OlwibaUIProvider, type OlwibaUIProviderProps, type OnboardingStep, OnboardingWizard, type OnboardingWizardProps, Overlay, type OverlayProps, type OverlayVariant, PageHeader, type PageHeaderBackButton, type PageHeaderBreadcrumb, type PageHeaderProps, PageTransition, type PageTransitionProps, PhoneFrame, type PhoneFrameProps, type PostAuthor, PostCard, type PostCardProps, PostList, type PostListProps, PricingCard, type PricingCardProps, type PricingFeature, type PricingPlan, PricingSection, type PricingSectionProps, PublicPageFrame, type PublicPageFrameProps, type QualificationColumn, QualificationSection, type QualificationSectionProps, RegisterHotkeys, RootErrorFallback, Section, type SectionProps, SectionTitle, type SectionTitleProps, SettingsSection, type SettingsSectionProps, Sortable, type SortableProps, Spotlight, type SpotlightGroup, type SpotlightItem, type SpotlightProps, Stack, type StackProps, StaggerChildren, type StaggerChildrenProps, StatCard, type StatCardProps, StatsSection, type StatsSectionProps, type StepGroup, type StepItem, StepsSection, type StepsSectionProps, Suspensed, Switch, type SwitchProps, type TeamMember, type TeamMemberRecord, TeamMembersPanel, type TeamMembersPanelProps, TeamSection, type TeamSectionProps, type TechStackItem, TechStackSection, type TechStackSectionProps, TestimonialCard, type TestimonialCardProps, TestimonialsSection, type TestimonialsSectionProps, Textarea, type TextareaProps, ThemeColorUpdater, ThemeSwitchMinimal, type UIMode, Underlay, type UnderlayProps, type UnderlayVariant, UpdateBanner, type UpdateBannerProps, type UpgradeComparisonRow, UpgradePrompt, type UpgradePromptProps, type UseConfirmReturn, type UseControlledOpenReturn, type UsePaginationReturn, VersionBanner, cn, marketingSectionSpacing, notify, useConfirm, useControlledOpen, useCopyToClipboard, useDebounce, useIntersectionObserver, useLocalStorage, useMediaQuery, useMounted, useOlwibaUI, usePagination, useScrolledPast, useUIMode };
1860
+ export { ActivityFeed, type ActivityFeedItem, type ActivityFeedProps, AnimatedPill, type AnimatedPillProps, AppContent, type AppContentProps, AppGrid, AppGridCell, type AppGridCellProps, type AppGridColumns, type AppGridProps, type AppNavItem, AppScreen, AppShell, type AppShellAction, type AppShellBrand, type AppShellProps, type AppShellRenderLink, type AppShellUser, type AuthFormProps, AuthSection, type AuthSectionProps, Badge, type BadgeProps, type BillingInvoice, BillingPanel, type BillingPanelProps, type BillingPaymentMethod, type BillingUsageMetric, BrandColorSwitchMinimal, Button, type ButtonProps, Card, type CardProps, Carousel, type CarouselProps, ChangelogCard, type ChangelogCardProps, type ChangelogHighlight, ChangelogList, type ChangelogListProps, type ChangelogReleaseType, Chart, type ChartProps, type ChartSeries, Checkbox, type CheckboxProps, CommandMenu, type CommandMenuGroup, type CommandMenuItem, type CommandMenuProps, type ComparisonColumn, ComparisonSection, type ComparisonSectionProps, ConfirmDialog, type ConfirmDialogProps, type ConfirmOptions, type ContactInfoItem, ContactSection, type ContactSectionProps, ContextMenu, type ContextMenuDef, type ContextMenuProps, CountUp, type CountUpProps, CountdownTimer, type CountdownTimerProps, CtaSection, type CtaSectionProps, DataTable, type DataTableProps, DataView, type DataViewProps, DevBanner, type DevBannerProps, Dock, type DockItem, type DockProps, EmptyState, type EmptyStateProps, ErrorPage, type ErrorPageProps, FadeIn, type FadeInProps, FaqSection, type FaqSectionProps, FeatureCard, type FeatureCardProps, type FeatureMarqueeItem, type FeatureMarqueeRow, FeatureMarqueeSection, type FeatureMarqueeSectionProps, FeaturesSection, type FeaturesSectionProps, FileUpload, type FileUploadEntry, type FileUploadProps, FlowBracket, type FlowBracketProps, FlowConnector, type FlowConnectorProps, Footer, type FooterProps, FullPageSpinner, GlassCard, type GlassCardProps, Grid, GridItem, type GridItemProps, type GridProps, type GroupedFeatureGroup, GroupedFeaturesSection, type GroupedFeaturesSectionProps, HeroSection, type HeroSectionProps, type Hotkey, ImageCard, type ImageCardProps, Input, type InputProps, LogoStrip, type LogoStripProps, type MarketingSectionSpacing, MediaCard, type MediaCardProps, ModeSwitchMinimal, Navbar, type NavbarProps, NewsletterSection, type NewsletterSectionProps, type NotificationItem, NotificationToast, type NotificationToastProps, NotificationsPopover, type NotificationsPopoverProps, type NotifyAction, type NotifyOptions, OlwibaUIProvider, type OlwibaUIProviderProps, type OnboardingStep, OnboardingWizard, type OnboardingWizardProps, Overlay, type OverlayProps, type OverlayVariant, PageHeader, type PageHeaderBackButton, type PageHeaderBreadcrumb, type PageHeaderProps, PageTransition, type PageTransitionProps, PhoneFrame, type PhoneFrameProps, type PostAuthor, PostCard, type PostCardProps, PostList, type PostListProps, PricingCard, type PricingCardProps, type PricingFeature, type PricingPlan, PricingSection, type PricingSectionProps, PublicPageFrame, type PublicPageFrameProps, type QualificationColumn, QualificationSection, type QualificationSectionProps, RegisterHotkeys, RootErrorFallback, Section, type SectionProps, SectionTitle, type SectionTitleProps, SettingsSection, type SettingsSectionProps, Sortable, type SortableProps, Spotlight, type SpotlightGroup, type SpotlightItem, type SpotlightProps, Stack, type StackProps, StaggerChildren, type StaggerChildrenProps, StatCard, type StatCardProps, StatsSection, type StatsSectionProps, type StepGroup, type StepItem, StepsSection, type StepsSectionProps, Suspensed, Switch, type SwitchProps, type TeamMember, type TeamMemberRecord, TeamMembersPanel, type TeamMembersPanelProps, TeamSection, type TeamSectionProps, type TechStackItem, TechStackSection, type TechStackSectionProps, TestimonialCard, type TestimonialCardProps, TestimonialsSection, type TestimonialsSectionProps, Textarea, type TextareaProps, ThemeColorUpdater, ThemeSwitchMinimal, type UIMode, Underlay, type UnderlayProps, type UnderlayVariant, UpdateBanner, type UpdateBannerProps, type UpgradeComparisonRow, UpgradePrompt, type UpgradePromptProps, type UseConfirmReturn, type UseControlledOpenReturn, type UsePaginationReturn, type UseViewModeReturn, VersionBanner, type ViewMode, ViewToggle, type ViewToggleProps, cn, marketingSectionSpacing, notify, useConfirm, useControlledOpen, useCopyToClipboard, useDebounce, useIntersectionObserver, useLocalStorage, useMediaQuery, useMounted, useOlwibaUI, usePagination, useScrolledPast, useUIMode, useViewMode };