@spatika/react 1.0.0
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/README.md +72 -0
- package/dist/composites/ActionBar.d.ts +7 -0
- package/dist/composites/ActionBar.d.ts.map +1 -0
- package/dist/composites/ActionBar.js +5 -0
- package/dist/composites/AmountInput.d.ts +10 -0
- package/dist/composites/AmountInput.d.ts.map +1 -0
- package/dist/composites/AmountInput.js +7 -0
- package/dist/composites/AppHeader.d.ts +25 -0
- package/dist/composites/AppHeader.d.ts.map +1 -0
- package/dist/composites/AppHeader.js +13 -0
- package/dist/composites/AppSidebar.d.ts +30 -0
- package/dist/composites/AppSidebar.d.ts.map +1 -0
- package/dist/composites/AppSidebar.js +15 -0
- package/dist/composites/BottomSheet.d.ts +36 -0
- package/dist/composites/BottomSheet.d.ts.map +1 -0
- package/dist/composites/BottomSheet.js +37 -0
- package/dist/composites/Breadcrumb.d.ts +10 -0
- package/dist/composites/Breadcrumb.d.ts.map +1 -0
- package/dist/composites/Breadcrumb.js +10 -0
- package/dist/composites/Callout.d.ts +8 -0
- package/dist/composites/Callout.d.ts.map +1 -0
- package/dist/composites/Callout.js +5 -0
- package/dist/composites/Card.d.ts +31 -0
- package/dist/composites/Card.d.ts.map +1 -0
- package/dist/composites/Card.js +33 -0
- package/dist/composites/Chip.d.ts +13 -0
- package/dist/composites/Chip.d.ts.map +1 -0
- package/dist/composites/Chip.js +59 -0
- package/dist/composites/ChipGroup.d.ts +23 -0
- package/dist/composites/ChipGroup.d.ts.map +1 -0
- package/dist/composites/ChipGroup.js +27 -0
- package/dist/composites/CommandSearchField.d.ts +27 -0
- package/dist/composites/CommandSearchField.d.ts.map +1 -0
- package/dist/composites/CommandSearchField.js +17 -0
- package/dist/composites/CoverHero.d.ts +51 -0
- package/dist/composites/CoverHero.d.ts.map +1 -0
- package/dist/composites/CoverHero.js +71 -0
- package/dist/composites/CoverPattern.d.ts +12 -0
- package/dist/composites/CoverPattern.d.ts.map +1 -0
- package/dist/composites/CoverPattern.js +14 -0
- package/dist/composites/DataTableToolbar.d.ts +13 -0
- package/dist/composites/DataTableToolbar.d.ts.map +1 -0
- package/dist/composites/DataTableToolbar.js +7 -0
- package/dist/composites/DividerLabel.d.ts +5 -0
- package/dist/composites/DividerLabel.d.ts.map +1 -0
- package/dist/composites/DividerLabel.js +5 -0
- package/dist/composites/EmptyState.d.ts +16 -0
- package/dist/composites/EmptyState.d.ts.map +1 -0
- package/dist/composites/EmptyState.js +10 -0
- package/dist/composites/EntityCard.d.ts +31 -0
- package/dist/composites/EntityCard.d.ts.map +1 -0
- package/dist/composites/EntityCard.js +21 -0
- package/dist/composites/EntityMediaCard.d.ts +25 -0
- package/dist/composites/EntityMediaCard.d.ts.map +1 -0
- package/dist/composites/EntityMediaCard.js +17 -0
- package/dist/composites/FilterSheet.d.ts +34 -0
- package/dist/composites/FilterSheet.d.ts.map +1 -0
- package/dist/composites/FilterSheet.js +36 -0
- package/dist/composites/FloatingPageChrome.d.ts +90 -0
- package/dist/composites/FloatingPageChrome.d.ts.map +1 -0
- package/dist/composites/FloatingPageChrome.js +67 -0
- package/dist/composites/FormField.d.ts +15 -0
- package/dist/composites/FormField.d.ts.map +1 -0
- package/dist/composites/FormField.js +9 -0
- package/dist/composites/GlassCard.d.ts +13 -0
- package/dist/composites/GlassCard.d.ts.map +1 -0
- package/dist/composites/GlassCard.js +32 -0
- package/dist/composites/HeaderIconButton.d.ts +13 -0
- package/dist/composites/HeaderIconButton.d.ts.map +1 -0
- package/dist/composites/HeaderIconButton.js +12 -0
- package/dist/composites/ListRow.d.ts +9 -0
- package/dist/composites/ListRow.d.ts.map +1 -0
- package/dist/composites/ListRow.js +6 -0
- package/dist/composites/MediaEntryCard.d.ts +25 -0
- package/dist/composites/MediaEntryCard.d.ts.map +1 -0
- package/dist/composites/MediaEntryCard.js +10 -0
- package/dist/composites/MobileTabBar.d.ts +33 -0
- package/dist/composites/MobileTabBar.d.ts.map +1 -0
- package/dist/composites/MobileTabBar.js +19 -0
- package/dist/composites/NotificationBell.d.ts +28 -0
- package/dist/composites/NotificationBell.d.ts.map +1 -0
- package/dist/composites/NotificationBell.js +25 -0
- package/dist/composites/PageHeader.d.ts +11 -0
- package/dist/composites/PageHeader.d.ts.map +1 -0
- package/dist/composites/PageHeader.js +6 -0
- package/dist/composites/PageShell.d.ts +12 -0
- package/dist/composites/PageShell.d.ts.map +1 -0
- package/dist/composites/PageShell.js +8 -0
- package/dist/composites/PageStickyHeader.d.ts +33 -0
- package/dist/composites/PageStickyHeader.d.ts.map +1 -0
- package/dist/composites/PageStickyHeader.js +19 -0
- package/dist/composites/Pagination.d.ts +7 -0
- package/dist/composites/Pagination.d.ts.map +1 -0
- package/dist/composites/Pagination.js +6 -0
- package/dist/composites/PhotoViewer.d.ts +18 -0
- package/dist/composites/PhotoViewer.d.ts.map +1 -0
- package/dist/composites/PhotoViewer.js +37 -0
- package/dist/composites/PinPad.d.ts +29 -0
- package/dist/composites/PinPad.d.ts.map +1 -0
- package/dist/composites/PinPad.js +58 -0
- package/dist/composites/ProfileHero.d.ts +34 -0
- package/dist/composites/ProfileHero.d.ts.map +1 -0
- package/dist/composites/ProfileHero.js +21 -0
- package/dist/composites/QuickFilterRail.d.ts +25 -0
- package/dist/composites/QuickFilterRail.d.ts.map +1 -0
- package/dist/composites/QuickFilterRail.js +18 -0
- package/dist/composites/QuickSettings.d.ts +27 -0
- package/dist/composites/QuickSettings.d.ts.map +1 -0
- package/dist/composites/QuickSettings.js +18 -0
- package/dist/composites/RichTextEditor.d.ts +13 -0
- package/dist/composites/RichTextEditor.d.ts.map +1 -0
- package/dist/composites/RichTextEditor.js +23 -0
- package/dist/composites/SearchField.d.ts +8 -0
- package/dist/composites/SearchField.d.ts.map +1 -0
- package/dist/composites/SearchField.js +8 -0
- package/dist/composites/SectionPanel.d.ts +16 -0
- package/dist/composites/SectionPanel.d.ts.map +1 -0
- package/dist/composites/SectionPanel.js +8 -0
- package/dist/composites/SegmentedControl.d.ts +17 -0
- package/dist/composites/SegmentedControl.d.ts.map +1 -0
- package/dist/composites/SegmentedControl.js +11 -0
- package/dist/composites/StatCard.d.ts +11 -0
- package/dist/composites/StatCard.d.ts.map +1 -0
- package/dist/composites/StatCard.js +6 -0
- package/dist/composites/StatusDot.d.ts +11 -0
- package/dist/composites/StatusDot.d.ts.map +1 -0
- package/dist/composites/StatusDot.js +23 -0
- package/dist/composites/SurfaceCard.d.ts +12 -0
- package/dist/composites/SurfaceCard.d.ts.map +1 -0
- package/dist/composites/SurfaceCard.js +24 -0
- package/dist/composites/Timeline.d.ts +19 -0
- package/dist/composites/Timeline.d.ts.map +1 -0
- package/dist/composites/Timeline.js +12 -0
- package/dist/composites/Toast.d.ts +26 -0
- package/dist/composites/Toast.d.ts.map +1 -0
- package/dist/composites/Toast.js +49 -0
- package/dist/composites/Toolbar.d.ts +6 -0
- package/dist/composites/Toolbar.d.ts.map +1 -0
- package/dist/composites/Toolbar.js +5 -0
- package/dist/composites/ViewFiltersPanel.d.ts +21 -0
- package/dist/composites/ViewFiltersPanel.d.ts.map +1 -0
- package/dist/composites/ViewFiltersPanel.js +11 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +95 -0
- package/dist/lib/animations.d.ts +62 -0
- package/dist/lib/animations.d.ts.map +1 -0
- package/dist/lib/animations.js +37 -0
- package/dist/lib/avatar-utils.d.ts +10 -0
- package/dist/lib/avatar-utils.d.ts.map +1 -0
- package/dist/lib/avatar-utils.js +49 -0
- package/dist/lib/chips.d.ts +10 -0
- package/dist/lib/chips.d.ts.map +1 -0
- package/dist/lib/chips.js +30 -0
- package/dist/lib/cn.d.ts +4 -0
- package/dist/lib/cn.d.ts.map +1 -0
- package/dist/lib/cn.js +6 -0
- package/dist/lib/compose-refs.d.ts +6 -0
- package/dist/lib/compose-refs.d.ts.map +1 -0
- package/dist/lib/compose-refs.js +17 -0
- package/dist/lib/cover-chrome.d.ts +9 -0
- package/dist/lib/cover-chrome.d.ts.map +1 -0
- package/dist/lib/cover-chrome.js +23 -0
- package/dist/lib/cover-pattern.d.ts +75 -0
- package/dist/lib/cover-pattern.d.ts.map +1 -0
- package/dist/lib/cover-pattern.js +135 -0
- package/dist/lib/overlay-stack.d.ts +23 -0
- package/dist/lib/overlay-stack.d.ts.map +1 -0
- package/dist/lib/overlay-stack.js +37 -0
- package/dist/lib/portal.d.ts +12 -0
- package/dist/lib/portal.d.ts.map +1 -0
- package/dist/lib/portal.js +12 -0
- package/dist/lib/slot.d.ts +12 -0
- package/dist/lib/slot.d.ts.map +1 -0
- package/dist/lib/slot.js +55 -0
- package/dist/lib/surfaces.d.ts +14 -0
- package/dist/lib/surfaces.d.ts.map +1 -0
- package/dist/lib/surfaces.js +18 -0
- package/dist/lib/themes.d.ts +16 -0
- package/dist/lib/themes.d.ts.map +1 -0
- package/dist/lib/themes.js +53 -0
- package/dist/lib/typography.d.ts +17 -0
- package/dist/lib/typography.d.ts.map +1 -0
- package/dist/lib/typography.js +16 -0
- package/dist/lib/use-controllable-state.d.ts +12 -0
- package/dist/lib/use-controllable-state.d.ts.map +1 -0
- package/dist/lib/use-controllable-state.js +20 -0
- package/dist/lib/use-cover-chrome-bleed.d.ts +9 -0
- package/dist/lib/use-cover-chrome-bleed.d.ts.map +1 -0
- package/dist/lib/use-cover-chrome-bleed.js +28 -0
- package/dist/lib/use-dismissable.d.ts +13 -0
- package/dist/lib/use-dismissable.d.ts.map +1 -0
- package/dist/lib/use-dismissable.js +33 -0
- package/dist/lib/use-floating-position.d.ts +27 -0
- package/dist/lib/use-floating-position.d.ts.map +1 -0
- package/dist/lib/use-floating-position.js +115 -0
- package/dist/lib/use-focus-trap.d.ts +7 -0
- package/dist/lib/use-focus-trap.d.ts.map +1 -0
- package/dist/lib/use-focus-trap.js +61 -0
- package/dist/lib/use-media-query.d.ts +5 -0
- package/dist/lib/use-media-query.d.ts.map +1 -0
- package/dist/lib/use-media-query.js +19 -0
- package/dist/primitives/Accordion.d.ts +24 -0
- package/dist/primitives/Accordion.d.ts.map +1 -0
- package/dist/primitives/Accordion.js +37 -0
- package/dist/primitives/Alert.d.ts +10 -0
- package/dist/primitives/Alert.d.ts.map +1 -0
- package/dist/primitives/Alert.js +25 -0
- package/dist/primitives/AlertDialog.d.ts +33 -0
- package/dist/primitives/AlertDialog.d.ts.map +1 -0
- package/dist/primitives/AlertDialog.js +96 -0
- package/dist/primitives/Avatar.d.ts +15 -0
- package/dist/primitives/Avatar.d.ts.map +1 -0
- package/dist/primitives/Avatar.js +52 -0
- package/dist/primitives/Badge.d.ts +12 -0
- package/dist/primitives/Badge.d.ts.map +1 -0
- package/dist/primitives/Badge.js +27 -0
- package/dist/primitives/Button.d.ts +14 -0
- package/dist/primitives/Button.d.ts.map +1 -0
- package/dist/primitives/Button.js +37 -0
- package/dist/primitives/Checkbox.d.ts +9 -0
- package/dist/primitives/Checkbox.d.ts.map +1 -0
- package/dist/primitives/Checkbox.js +22 -0
- package/dist/primitives/Command.d.ts +17 -0
- package/dist/primitives/Command.d.ts.map +1 -0
- package/dist/primitives/Command.js +33 -0
- package/dist/primitives/Dialog.d.ts +34 -0
- package/dist/primitives/Dialog.d.ts.map +1 -0
- package/dist/primitives/Dialog.js +96 -0
- package/dist/primitives/DropdownMenu.d.ts +65 -0
- package/dist/primitives/DropdownMenu.d.ts.map +1 -0
- package/dist/primitives/DropdownMenu.js +196 -0
- package/dist/primitives/Input.d.ts +4 -0
- package/dist/primitives/Input.d.ts.map +1 -0
- package/dist/primitives/Input.js +6 -0
- package/dist/primitives/Kbd.d.ts +4 -0
- package/dist/primitives/Kbd.d.ts.map +1 -0
- package/dist/primitives/Kbd.js +6 -0
- package/dist/primitives/Label.d.ts +4 -0
- package/dist/primitives/Label.d.ts.map +1 -0
- package/dist/primitives/Label.js +6 -0
- package/dist/primitives/NativeSelect.d.ts +7 -0
- package/dist/primitives/NativeSelect.d.ts.map +1 -0
- package/dist/primitives/NativeSelect.js +10 -0
- package/dist/primitives/Popover.d.ts +29 -0
- package/dist/primitives/Popover.d.ts.map +1 -0
- package/dist/primitives/Popover.js +95 -0
- package/dist/primitives/Progress.d.ts +8 -0
- package/dist/primitives/Progress.d.ts.map +1 -0
- package/dist/primitives/Progress.js +7 -0
- package/dist/primitives/RadioGroup.d.ts +13 -0
- package/dist/primitives/RadioGroup.d.ts.map +1 -0
- package/dist/primitives/RadioGroup.js +33 -0
- package/dist/primitives/Select.d.ts +33 -0
- package/dist/primitives/Select.d.ts.map +1 -0
- package/dist/primitives/Select.js +178 -0
- package/dist/primitives/Separator.d.ts +7 -0
- package/dist/primitives/Separator.d.ts.map +1 -0
- package/dist/primitives/Separator.js +6 -0
- package/dist/primitives/Sheet.d.ts +28 -0
- package/dist/primitives/Sheet.d.ts.map +1 -0
- package/dist/primitives/Sheet.js +96 -0
- package/dist/primitives/Skeleton.d.ts +4 -0
- package/dist/primitives/Skeleton.d.ts.map +1 -0
- package/dist/primitives/Skeleton.js +6 -0
- package/dist/primitives/Slider.d.ts +12 -0
- package/dist/primitives/Slider.d.ts.map +1 -0
- package/dist/primitives/Slider.js +23 -0
- package/dist/primitives/Spinner.d.ts +6 -0
- package/dist/primitives/Spinner.d.ts.map +1 -0
- package/dist/primitives/Spinner.js +7 -0
- package/dist/primitives/StarRating.d.ts +10 -0
- package/dist/primitives/StarRating.d.ts.map +1 -0
- package/dist/primitives/StarRating.js +11 -0
- package/dist/primitives/Switch.d.ts +8 -0
- package/dist/primitives/Switch.d.ts.map +1 -0
- package/dist/primitives/Switch.js +20 -0
- package/dist/primitives/Table.d.ts +13 -0
- package/dist/primitives/Table.d.ts.map +1 -0
- package/dist/primitives/Table.js +20 -0
- package/dist/primitives/Tabs.d.ts +17 -0
- package/dist/primitives/Tabs.d.ts.map +1 -0
- package/dist/primitives/Tabs.js +30 -0
- package/dist/primitives/Textarea.d.ts +4 -0
- package/dist/primitives/Textarea.d.ts.map +1 -0
- package/dist/primitives/Textarea.js +6 -0
- package/dist/primitives/Tooltip.d.ts +31 -0
- package/dist/primitives/Tooltip.d.ts.map +1 -0
- package/dist/primitives/Tooltip.js +94 -0
- package/dist/theme/OriginThemeProvider.d.ts +31 -0
- package/dist/theme/OriginThemeProvider.d.ts.map +1 -0
- package/dist/theme/OriginThemeProvider.js +37 -0
- package/dist/theme/SpatikaThemeProvider.d.ts +36 -0
- package/dist/theme/SpatikaThemeProvider.d.ts.map +1 -0
- package/dist/theme/SpatikaThemeProvider.js +38 -0
- package/package.json +58 -0
- package/src/composites/ActionBar.tsx +25 -0
- package/src/composites/AmountInput.tsx +40 -0
- package/src/composites/AppHeader.tsx +88 -0
- package/src/composites/AppSidebar.tsx +120 -0
- package/src/composites/BottomSheet.tsx +179 -0
- package/src/composites/Breadcrumb.tsx +42 -0
- package/src/composites/Callout.tsx +22 -0
- package/src/composites/Card.tsx +119 -0
- package/src/composites/Chip.tsx +87 -0
- package/src/composites/ChipGroup.component.test.tsx +31 -0
- package/src/composites/ChipGroup.test.ts +16 -0
- package/src/composites/ChipGroup.tsx +86 -0
- package/src/composites/CommandSearchField.tsx +124 -0
- package/src/composites/CoverHero.tsx +359 -0
- package/src/composites/CoverPattern.tsx +90 -0
- package/src/composites/DataTableToolbar.tsx +48 -0
- package/src/composites/DividerLabel.tsx +22 -0
- package/src/composites/EmptyState.tsx +55 -0
- package/src/composites/EntityCard.tsx +100 -0
- package/src/composites/EntityMediaCard.tsx +118 -0
- package/src/composites/FilterSheet.tsx +178 -0
- package/src/composites/FloatingPageChrome.tsx +294 -0
- package/src/composites/FormField.tsx +44 -0
- package/src/composites/GlassCard.tsx +47 -0
- package/src/composites/HeaderIconButton.tsx +49 -0
- package/src/composites/ListRow.tsx +29 -0
- package/src/composites/MediaEntryCard.tsx +95 -0
- package/src/composites/MobileTabBar.tsx +130 -0
- package/src/composites/NotificationBell.tsx +164 -0
- package/src/composites/PageHeader.tsx +27 -0
- package/src/composites/PageShell.tsx +20 -0
- package/src/composites/PageStickyHeader.tsx +157 -0
- package/src/composites/Pagination.tsx +41 -0
- package/src/composites/PhotoViewer.tsx +142 -0
- package/src/composites/PinPad.tsx +163 -0
- package/src/composites/ProfileHero.tsx +163 -0
- package/src/composites/QuickFilterRail.tsx +92 -0
- package/src/composites/QuickSettings.tsx +120 -0
- package/src/composites/RichTextEditor.tsx +103 -0
- package/src/composites/SearchField.tsx +38 -0
- package/src/composites/SectionPanel.tsx +59 -0
- package/src/composites/SegmentedControl.tsx +62 -0
- package/src/composites/StatCard.tsx +26 -0
- package/src/composites/StatusDot.tsx +40 -0
- package/src/composites/SurfaceCard.tsx +44 -0
- package/src/composites/Timeline.tsx +70 -0
- package/src/composites/Toast.tsx +135 -0
- package/src/composites/Toolbar.tsx +19 -0
- package/src/composites/ViewFiltersPanel.tsx +82 -0
- package/src/composites/chrome.test.tsx +170 -0
- package/src/composites/smoke.test.tsx +49 -0
- package/src/index.ts +355 -0
- package/src/lib/animations.ts +47 -0
- package/src/lib/avatar-utils.ts +52 -0
- package/src/lib/chips.ts +58 -0
- package/src/lib/cn.test.ts +16 -0
- package/src/lib/cn.ts +7 -0
- package/src/lib/compose-refs.ts +21 -0
- package/src/lib/cover-chrome.ts +31 -0
- package/src/lib/cover-pattern.ts +242 -0
- package/src/lib/overlay-stack.ts +44 -0
- package/src/lib/portal.tsx +21 -0
- package/src/lib/slot.tsx +69 -0
- package/src/lib/surfaces.ts +57 -0
- package/src/lib/themes.test.ts +73 -0
- package/src/lib/themes.ts +59 -0
- package/src/lib/tokens.test.ts +52 -0
- package/src/lib/typography.ts +27 -0
- package/src/lib/use-controllable-state.ts +38 -0
- package/src/lib/use-cover-chrome-bleed.ts +33 -0
- package/src/lib/use-dismissable.ts +49 -0
- package/src/lib/use-floating-position.ts +168 -0
- package/src/lib/use-focus-trap.ts +73 -0
- package/src/lib/use-media-query.ts +22 -0
- package/src/primitives/Accordion.tsx +114 -0
- package/src/primitives/Alert.tsx +57 -0
- package/src/primitives/AlertDialog.tsx +270 -0
- package/src/primitives/Avatar.tsx +140 -0
- package/src/primitives/Badge.test.tsx +15 -0
- package/src/primitives/Badge.tsx +43 -0
- package/src/primitives/Button.test.tsx +37 -0
- package/src/primitives/Button.tsx +58 -0
- package/src/primitives/Checkbox.tsx +75 -0
- package/src/primitives/Command.tsx +175 -0
- package/src/primitives/Dialog.tsx +241 -0
- package/src/primitives/DropdownMenu.tsx +552 -0
- package/src/primitives/Input.test.tsx +22 -0
- package/src/primitives/Input.tsx +22 -0
- package/src/primitives/Kbd.tsx +17 -0
- package/src/primitives/Label.tsx +20 -0
- package/src/primitives/NativeSelect.tsx +22 -0
- package/src/primitives/Popover.tsx +209 -0
- package/src/primitives/Progress.tsx +31 -0
- package/src/primitives/RadioGroup.tsx +116 -0
- package/src/primitives/Select.tsx +409 -0
- package/src/primitives/Separator.tsx +30 -0
- package/src/primitives/Sheet.tsx +265 -0
- package/src/primitives/Skeleton.tsx +16 -0
- package/src/primitives/Slider.tsx +97 -0
- package/src/primitives/Spinner.tsx +21 -0
- package/src/primitives/StarRating.tsx +53 -0
- package/src/primitives/Switch.tsx +68 -0
- package/src/primitives/Table.tsx +134 -0
- package/src/primitives/Tabs.tsx +97 -0
- package/src/primitives/Textarea.tsx +20 -0
- package/src/primitives/Tooltip.tsx +193 -0
- package/src/primitives/smoke.test.tsx +34 -0
- package/src/test/setup.ts +1 -0
- package/src/theme/SpatikaThemeProvider.test.tsx +82 -0
- package/src/theme/SpatikaThemeProvider.tsx +112 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
useCallback,
|
|
4
|
+
useContext,
|
|
5
|
+
useMemo,
|
|
6
|
+
useState,
|
|
7
|
+
type ReactNode,
|
|
8
|
+
} from "react";
|
|
9
|
+
import { X } from "lucide-react";
|
|
10
|
+
import { cn } from "../lib/cn";
|
|
11
|
+
|
|
12
|
+
export type ToastTone = "default" | "success" | "warn" | "danger";
|
|
13
|
+
|
|
14
|
+
export type ToastItem = {
|
|
15
|
+
id: string;
|
|
16
|
+
title: string;
|
|
17
|
+
description?: string;
|
|
18
|
+
tone?: ToastTone;
|
|
19
|
+
durationMs?: number;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type ToastContextValue = {
|
|
23
|
+
toasts: ToastItem[];
|
|
24
|
+
toast: (item: Omit<ToastItem, "id"> & { id?: string }) => string;
|
|
25
|
+
dismiss: (id: string) => void;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const ToastContext = createContext<ToastContextValue | null>(null);
|
|
29
|
+
|
|
30
|
+
let toastSeq = 0;
|
|
31
|
+
|
|
32
|
+
export function useToast() {
|
|
33
|
+
const ctx = useContext(ToastContext);
|
|
34
|
+
if (!ctx) throw new Error("useToast must be used within <Toaster />");
|
|
35
|
+
return ctx;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const toneClass: Record<ToastTone, string> = {
|
|
39
|
+
default: "border-border/60",
|
|
40
|
+
success: "border-emerald-500/35 bg-emerald-500/8",
|
|
41
|
+
warn: "border-amber-500/35 bg-amber-500/8",
|
|
42
|
+
danger: "border-destructive/35 bg-destructive/8",
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export type ToasterProps = {
|
|
46
|
+
children?: ReactNode;
|
|
47
|
+
className?: string;
|
|
48
|
+
position?: "top-right" | "bottom-right" | "top-center" | "bottom-center";
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
/** App-level toast host + provider. Wrap the app once and call useToast(). */
|
|
52
|
+
export function Toaster({
|
|
53
|
+
children,
|
|
54
|
+
className,
|
|
55
|
+
position = "bottom-right",
|
|
56
|
+
}: ToasterProps) {
|
|
57
|
+
const [toasts, setToasts] = useState<ToastItem[]>([]);
|
|
58
|
+
|
|
59
|
+
const dismiss = useCallback((id: string) => {
|
|
60
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
61
|
+
}, []);
|
|
62
|
+
|
|
63
|
+
const toast = useCallback(
|
|
64
|
+
(item: Omit<ToastItem, "id"> & { id?: string }) => {
|
|
65
|
+
const id = item.id ?? `toast-${++toastSeq}`;
|
|
66
|
+
const next: ToastItem = {
|
|
67
|
+
id,
|
|
68
|
+
title: item.title,
|
|
69
|
+
description: item.description,
|
|
70
|
+
tone: item.tone ?? "default",
|
|
71
|
+
durationMs: item.durationMs ?? 4200,
|
|
72
|
+
};
|
|
73
|
+
setToasts((prev) => [...prev, next]);
|
|
74
|
+
if (next.durationMs && next.durationMs > 0) {
|
|
75
|
+
window.setTimeout(() => dismiss(id), next.durationMs);
|
|
76
|
+
}
|
|
77
|
+
return id;
|
|
78
|
+
},
|
|
79
|
+
[dismiss],
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
const value = useMemo(() => ({ toasts, toast, dismiss }), [toasts, toast, dismiss]);
|
|
83
|
+
|
|
84
|
+
const positionClass =
|
|
85
|
+
position === "top-right"
|
|
86
|
+
? "top-4 right-4"
|
|
87
|
+
: position === "top-center"
|
|
88
|
+
? "top-4 left-1/2 -translate-x-1/2"
|
|
89
|
+
: position === "bottom-center"
|
|
90
|
+
? "bottom-4 left-1/2 -translate-x-1/2"
|
|
91
|
+
: "bottom-4 right-4";
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<ToastContext.Provider value={value}>
|
|
95
|
+
{children}
|
|
96
|
+
<div
|
|
97
|
+
data-slot="toaster"
|
|
98
|
+
className={cn(
|
|
99
|
+
"pointer-events-none fixed z-[200] flex w-[min(calc(100vw-1.5rem),22rem)] flex-col gap-2",
|
|
100
|
+
positionClass,
|
|
101
|
+
className,
|
|
102
|
+
)}
|
|
103
|
+
>
|
|
104
|
+
{toasts.map((t) => (
|
|
105
|
+
<div
|
|
106
|
+
key={t.id}
|
|
107
|
+
data-slot="toast"
|
|
108
|
+
className={cn(
|
|
109
|
+
"pointer-events-auto rounded-2xl border bg-background p-3.5 shadow-[0_22px_50px_-24px_rgba(15,23,42,0.55)] dark:bg-card",
|
|
110
|
+
toneClass[t.tone ?? "default"],
|
|
111
|
+
)}
|
|
112
|
+
role="status"
|
|
113
|
+
>
|
|
114
|
+
<div className="flex items-start gap-3">
|
|
115
|
+
<div className="min-w-0 flex-1">
|
|
116
|
+
<p className="text-sm font-bold text-foreground">{t.title}</p>
|
|
117
|
+
{t.description ? (
|
|
118
|
+
<p className="mt-0.5 text-xs text-muted-foreground">{t.description}</p>
|
|
119
|
+
) : null}
|
|
120
|
+
</div>
|
|
121
|
+
<button
|
|
122
|
+
type="button"
|
|
123
|
+
aria-label="Dismiss"
|
|
124
|
+
className="rounded-lg p-1 text-muted-foreground transition-colors hover:bg-muted/40 hover:text-foreground"
|
|
125
|
+
onClick={() => dismiss(t.id)}
|
|
126
|
+
>
|
|
127
|
+
<X className="h-3.5 w-3.5" />
|
|
128
|
+
</button>
|
|
129
|
+
</div>
|
|
130
|
+
</div>
|
|
131
|
+
))}
|
|
132
|
+
</div>
|
|
133
|
+
</ToastContext.Provider>
|
|
134
|
+
);
|
|
135
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { cn } from "../lib/cn";
|
|
3
|
+
|
|
4
|
+
export function Toolbar({
|
|
5
|
+
children,
|
|
6
|
+
className,
|
|
7
|
+
}: {
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
}) {
|
|
11
|
+
return (
|
|
12
|
+
<div
|
|
13
|
+
data-slot="toolbar"
|
|
14
|
+
className={cn("app-toolbar flex flex-wrap items-center gap-2 px-3 py-2", className)}
|
|
15
|
+
>
|
|
16
|
+
{children}
|
|
17
|
+
</div>
|
|
18
|
+
);
|
|
19
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import { X } from "lucide-react";
|
|
3
|
+
import { cn } from "../lib/cn";
|
|
4
|
+
import { Button } from "../primitives/Button";
|
|
5
|
+
import { BottomSheet } from "./BottomSheet";
|
|
6
|
+
|
|
7
|
+
export type ViewFiltersPanelProps = {
|
|
8
|
+
open: boolean;
|
|
9
|
+
onOpenChange: (open: boolean) => void;
|
|
10
|
+
title?: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
hasActive?: boolean;
|
|
13
|
+
onClear?: () => void;
|
|
14
|
+
trigger?: ReactNode;
|
|
15
|
+
children: ReactNode;
|
|
16
|
+
topSection?: ReactNode;
|
|
17
|
+
className?: string;
|
|
18
|
+
doneLabel?: string;
|
|
19
|
+
clearLabel?: string;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* View & filters panel — glass bottom sheet with clear / done chrome.
|
|
24
|
+
* Pass arbitrary filter fields as children for full customization.
|
|
25
|
+
*/
|
|
26
|
+
export function ViewFiltersPanel({
|
|
27
|
+
open,
|
|
28
|
+
onOpenChange,
|
|
29
|
+
title = "View & filters",
|
|
30
|
+
description,
|
|
31
|
+
hasActive,
|
|
32
|
+
onClear,
|
|
33
|
+
trigger,
|
|
34
|
+
children,
|
|
35
|
+
topSection,
|
|
36
|
+
className,
|
|
37
|
+
doneLabel = "Done",
|
|
38
|
+
clearLabel = "Clear",
|
|
39
|
+
}: ViewFiltersPanelProps) {
|
|
40
|
+
return (
|
|
41
|
+
<>
|
|
42
|
+
{trigger}
|
|
43
|
+
<BottomSheet open={open} onOpenChange={onOpenChange} className={className}>
|
|
44
|
+
<div className="flex items-start justify-between gap-3 border-b border-border/40 px-4 py-3">
|
|
45
|
+
<div className="min-w-0">
|
|
46
|
+
<h2 className="text-base font-black tracking-tight">{title}</h2>
|
|
47
|
+
{description ? (
|
|
48
|
+
<p className="mt-0.5 text-xs font-medium text-muted-foreground">{description}</p>
|
|
49
|
+
) : null}
|
|
50
|
+
</div>
|
|
51
|
+
<div className="flex shrink-0 items-center gap-1">
|
|
52
|
+
{hasActive && onClear ? (
|
|
53
|
+
<Button type="button" variant="ghost" size="sm" onClick={onClear}>
|
|
54
|
+
{clearLabel}
|
|
55
|
+
</Button>
|
|
56
|
+
) : null}
|
|
57
|
+
<Button
|
|
58
|
+
type="button"
|
|
59
|
+
variant="ghost"
|
|
60
|
+
size="icon"
|
|
61
|
+
aria-label="Close"
|
|
62
|
+
onClick={() => onOpenChange(false)}
|
|
63
|
+
>
|
|
64
|
+
<X className="size-4" />
|
|
65
|
+
</Button>
|
|
66
|
+
</div>
|
|
67
|
+
</div>
|
|
68
|
+
{topSection}
|
|
69
|
+
<div className="max-h-[60vh] space-y-5 overflow-y-auto px-4 py-4">{children}</div>
|
|
70
|
+
<div className="border-t border-border/40 p-4 pb-[calc(1rem+env(safe-area-inset-bottom))]">
|
|
71
|
+
<Button
|
|
72
|
+
type="button"
|
|
73
|
+
className="h-9 w-full rounded-xl text-xs font-black uppercase tracking-widest"
|
|
74
|
+
onClick={() => onOpenChange(false)}
|
|
75
|
+
>
|
|
76
|
+
{doneLabel}
|
|
77
|
+
</Button>
|
|
78
|
+
</div>
|
|
79
|
+
</BottomSheet>
|
|
80
|
+
</>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import userEvent from "@testing-library/user-event";
|
|
3
|
+
import { describe, expect, it, afterEach, vi } from "vitest";
|
|
4
|
+
import {
|
|
5
|
+
FloatingPageChromeBar,
|
|
6
|
+
FloatingPageChromeIdentity,
|
|
7
|
+
FloatingPageChromeSearchField,
|
|
8
|
+
} from "./FloatingPageChrome";
|
|
9
|
+
import { FilterSheet } from "./FilterSheet";
|
|
10
|
+
import { CoverHero } from "./CoverHero";
|
|
11
|
+
import { CoverPattern } from "./CoverPattern";
|
|
12
|
+
import { PageStickyHeader } from "./PageStickyHeader";
|
|
13
|
+
import { MobileTabBar } from "./MobileTabBar";
|
|
14
|
+
import { ProfileHero } from "./ProfileHero";
|
|
15
|
+
import { Home } from "lucide-react";
|
|
16
|
+
import { getCoverPattern } from "../lib/cover-pattern";
|
|
17
|
+
import { useCoverChromeBleed } from "../lib/use-cover-chrome-bleed";
|
|
18
|
+
|
|
19
|
+
describe("FloatingPageChrome", () => {
|
|
20
|
+
it("renders identity title, count, and search", async () => {
|
|
21
|
+
const user = userEvent.setup();
|
|
22
|
+
const onBack = vi.fn();
|
|
23
|
+
const onChange = vi.fn();
|
|
24
|
+
render(
|
|
25
|
+
<FloatingPageChromeBar
|
|
26
|
+
identity={
|
|
27
|
+
<FloatingPageChromeIdentity title="People" count={12} onBack={onBack} />
|
|
28
|
+
}
|
|
29
|
+
search={
|
|
30
|
+
<FloatingPageChromeSearchField
|
|
31
|
+
value="al"
|
|
32
|
+
onChange={onChange}
|
|
33
|
+
onClear={() => onChange("")}
|
|
34
|
+
placeholder="Search people…"
|
|
35
|
+
/>
|
|
36
|
+
}
|
|
37
|
+
/>,
|
|
38
|
+
);
|
|
39
|
+
expect(screen.getByText("People")).toBeInTheDocument();
|
|
40
|
+
expect(screen.getByText("12")).toBeInTheDocument();
|
|
41
|
+
await user.click(screen.getByLabelText("Go back"));
|
|
42
|
+
expect(onBack).toHaveBeenCalled();
|
|
43
|
+
expect(screen.getByPlaceholderText("Search people…")).toHaveValue("al");
|
|
44
|
+
expect(document.querySelector(".glass-page-toolbar")).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it("pins children in a nested scroller", () => {
|
|
48
|
+
render(
|
|
49
|
+
<FloatingPageChromeBar
|
|
50
|
+
identity={<FloatingPageChromeIdentity title="People" count={4} />}
|
|
51
|
+
>
|
|
52
|
+
<p>Directory body</p>
|
|
53
|
+
</FloatingPageChromeBar>,
|
|
54
|
+
);
|
|
55
|
+
expect(document.querySelector(".app-page-chrome")).toBeTruthy();
|
|
56
|
+
expect(document.querySelector(".app-page-chrome-body")).toHaveTextContent("Directory body");
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
describe("PageStickyHeader", () => {
|
|
61
|
+
it("renders title, count, and density slots", () => {
|
|
62
|
+
render(
|
|
63
|
+
<PageStickyHeader
|
|
64
|
+
offsetClassName="top-0"
|
|
65
|
+
title="Insights"
|
|
66
|
+
subtitle="Last 30 days"
|
|
67
|
+
count={8}
|
|
68
|
+
/>,
|
|
69
|
+
);
|
|
70
|
+
expect(screen.getByText("Insights")).toBeInTheDocument();
|
|
71
|
+
expect(screen.getByText("Last 30 days")).toBeInTheDocument();
|
|
72
|
+
expect(screen.getByText("8")).toBeInTheDocument();
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
describe("FilterSheet", () => {
|
|
77
|
+
it("opens a desktop popover from the chrome trigger", async () => {
|
|
78
|
+
const user = userEvent.setup();
|
|
79
|
+
const onOpenChange = vi.fn();
|
|
80
|
+
render(
|
|
81
|
+
<FilterSheet
|
|
82
|
+
open={false}
|
|
83
|
+
onOpenChange={onOpenChange}
|
|
84
|
+
title="View & filters"
|
|
85
|
+
trigger={<button type="button">Filters</button>}
|
|
86
|
+
>
|
|
87
|
+
<p>Status</p>
|
|
88
|
+
</FilterSheet>,
|
|
89
|
+
);
|
|
90
|
+
await user.click(screen.getByText("Filters"));
|
|
91
|
+
expect(onOpenChange).toHaveBeenCalledWith(true);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
describe("CoverPattern", () => {
|
|
96
|
+
it("seeds a stable scene kind", () => {
|
|
97
|
+
const a = getCoverPattern({ seed: "alex", hue: 210 });
|
|
98
|
+
const b = getCoverPattern({ seed: "alex", hue: 210 });
|
|
99
|
+
expect(a.kind).toBe(b.kind);
|
|
100
|
+
expect(a.headerInk).toMatch(/light|dark/);
|
|
101
|
+
expect(a.chromeInk).toMatch(/light|dark/);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
it("renders a cover pattern node", () => {
|
|
105
|
+
const { container } = render(<CoverPattern seed="alex" hue={210} />);
|
|
106
|
+
expect(container.querySelector("[data-cover-pattern]")).toBeTruthy();
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe("CoverHero", () => {
|
|
111
|
+
it("renders title, kicker, and facts", () => {
|
|
112
|
+
render(
|
|
113
|
+
<CoverHero
|
|
114
|
+
title="Friday night · Studio district"
|
|
115
|
+
kicker={<span>Meetup Story</span>}
|
|
116
|
+
facts={[{ key: "when", label: "When", value: "Fri 14 Mar" }]}
|
|
117
|
+
avatars={[{ name: "Alex Rivera" }]}
|
|
118
|
+
/>,
|
|
119
|
+
);
|
|
120
|
+
expect(screen.getByText("Friday night · Studio district")).toBeInTheDocument();
|
|
121
|
+
expect(screen.getByText("Meetup Story")).toBeInTheDocument();
|
|
122
|
+
expect(screen.getByText("When")).toBeInTheDocument();
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
describe("ProfileHero", () => {
|
|
127
|
+
it("renders name, alias, and a notched identity plate", () => {
|
|
128
|
+
const { container } = render(
|
|
129
|
+
<ProfileHero name="Alex Chen" alias="Product designer" coverSeed="alex" />,
|
|
130
|
+
);
|
|
131
|
+
expect(screen.getByText("Alex Chen")).toBeInTheDocument();
|
|
132
|
+
expect(screen.getByText("Product designer")).toBeInTheDocument();
|
|
133
|
+
expect(container.querySelector(".profile-identity")).toBeTruthy();
|
|
134
|
+
expect(container.querySelector(".profile-identity__plate")).toBeTruthy();
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
describe("MobileTabBar", () => {
|
|
139
|
+
it("renders a floating capsule with an active item", () => {
|
|
140
|
+
const { container } = render(
|
|
141
|
+
<MobileTabBar
|
|
142
|
+
items={[{ id: "home", label: "Home", icon: Home, active: true }]}
|
|
143
|
+
/>,
|
|
144
|
+
);
|
|
145
|
+
expect(container.querySelector("[data-app-tabbar]")).toBeTruthy();
|
|
146
|
+
expect(screen.getByText("Home")).toBeInTheDocument();
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
function BleedProbe({ active }: { active: boolean }) {
|
|
151
|
+
useCoverChromeBleed(active, "light");
|
|
152
|
+
return <span>probe</span>;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
describe("useCoverChromeBleed", () => {
|
|
156
|
+
afterEach(() => {
|
|
157
|
+
document.documentElement.removeAttribute("data-cover-chrome-bleed");
|
|
158
|
+
document.documentElement.removeAttribute("data-cover-chrome-ink");
|
|
159
|
+
document.documentElement.removeAttribute("data-profile-cover-bleed");
|
|
160
|
+
document.documentElement.removeAttribute("data-profile-cover-ink");
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it("sets and clears cover bleed attributes", () => {
|
|
164
|
+
const { unmount } = render(<BleedProbe active />);
|
|
165
|
+
expect(document.documentElement.getAttribute("data-cover-chrome-bleed")).toBe("true");
|
|
166
|
+
expect(document.documentElement.getAttribute("data-cover-chrome-ink")).toBe("light");
|
|
167
|
+
unmount();
|
|
168
|
+
expect(document.documentElement.getAttribute("data-cover-chrome-bleed")).toBeNull();
|
|
169
|
+
});
|
|
170
|
+
});
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { render, screen } from "@testing-library/react";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
import { EmptyState } from "./EmptyState";
|
|
4
|
+
import { FormField } from "./FormField";
|
|
5
|
+
import { PageHeader } from "./PageHeader";
|
|
6
|
+
import { StatusDot } from "./StatusDot";
|
|
7
|
+
import { EntityCard, EntityCardChip, EntityCardMeta, EntityCardTitle } from "./EntityCard";
|
|
8
|
+
|
|
9
|
+
describe("composites smoke", () => {
|
|
10
|
+
it("renders EmptyState", () => {
|
|
11
|
+
render(<EmptyState title="Nothing here" description="Try again" />);
|
|
12
|
+
expect(screen.getByText("Nothing here")).toBeInTheDocument();
|
|
13
|
+
expect(screen.getByText("Try again")).toBeInTheDocument();
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
it("renders PageHeader", () => {
|
|
17
|
+
render(<PageHeader title="Directory" description="People" />);
|
|
18
|
+
expect(screen.getByText("Directory")).toBeInTheDocument();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("renders FormField with label", () => {
|
|
22
|
+
render(
|
|
23
|
+
<FormField id="email" label="Email">
|
|
24
|
+
<input id="email" aria-label="Email" />
|
|
25
|
+
</FormField>,
|
|
26
|
+
);
|
|
27
|
+
expect(screen.getByText("Email")).toBeInTheDocument();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("renders StatusDot", () => {
|
|
31
|
+
const { container } = render(<StatusDot tone="success" />);
|
|
32
|
+
expect(container.querySelector('[data-slot="status-dot"]')).toBeTruthy();
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it("renders EntityCard rows", () => {
|
|
36
|
+
render(
|
|
37
|
+
<EntityCard interactive>
|
|
38
|
+
<div>
|
|
39
|
+
<EntityCardTitle>Alex Chen</EntityCardTitle>
|
|
40
|
+
<EntityCardMeta>Product designer</EntityCardMeta>
|
|
41
|
+
</div>
|
|
42
|
+
<EntityCardChip>Active</EntityCardChip>
|
|
43
|
+
</EntityCard>,
|
|
44
|
+
);
|
|
45
|
+
expect(screen.getByText("Alex Chen")).toBeInTheDocument();
|
|
46
|
+
expect(screen.getByText("Product designer")).toBeInTheDocument();
|
|
47
|
+
expect(screen.getByText("Active")).toBeInTheDocument();
|
|
48
|
+
});
|
|
49
|
+
});
|