@sovereignfs/ui 0.45.0 → 0.83.1
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/Accordion.module.css +1 -1
- package/dist/Alert.module.css +1 -1
- package/dist/AppsLauncher.module.css +96 -0
- package/dist/Avatar.module.css +1 -1
- package/dist/Badge.module.css +30 -7
- package/dist/BalanceChip.module.css +1 -1
- package/dist/Button.module.css +18 -2
- package/dist/Card.module.css +1 -1
- package/dist/CardTile.module.css +181 -0
- package/dist/CodeTextarea.module.css +1 -1
- package/dist/Collapsible.module.css +1 -1
- package/dist/ColorPicker.module.css +132 -0
- package/dist/Combobox.module.css +2 -2
- package/dist/Command.module.css +1 -1
- package/dist/ConfirmDialog.module.css +2 -2
- package/dist/ConsentPrompt.module.css +21 -0
- package/dist/DatePicker.module.css +1 -1
- package/dist/Dialog.module.css +130 -21
- package/dist/Drawer.module.css +36 -7
- package/dist/Header.module.css +62 -0
- package/dist/HeaderFooterLayout.module.css +21 -0
- package/dist/IconPicker.module.css +1 -1
- package/dist/Input.module.css +1 -1
- package/dist/Kbd.module.css +1 -1
- package/dist/LegalLinks.module.css +24 -0
- package/dist/Markdown.module.css +73 -0
- package/dist/Menu.module.css +1 -0
- package/dist/Message.module.css +1 -1
- package/dist/MessageScroller.module.css +12 -1
- package/dist/MobileAppsDrawer.module.css +82 -0
- package/dist/MobileFooter.module.css +73 -0
- package/dist/MobileHeader.module.css +76 -0
- package/dist/NavList.module.css +130 -0
- package/dist/NavTabs.module.css +1 -1
- package/dist/NotificationsPanel.module.css +258 -0
- package/dist/OverlayHeader.module.css +1 -1
- package/dist/PageContainer.module.css +82 -0
- package/dist/PageHeader.module.css +54 -0
- package/dist/PageLayout.module.css +51 -0
- package/dist/Popover.module.css +1 -1
- package/dist/QuantityStepper.module.css +1 -1
- package/dist/Resizable.module.css +3 -3
- package/dist/RootLayout.module.css +12 -0
- package/dist/SegmentedControl.module.css +1 -1
- package/dist/Select.module.css +1 -1
- package/dist/Sheet.module.css +4 -1
- package/dist/SplitPane.module.css +4 -4
- package/dist/StatusBadge.module.css +1 -1
- package/dist/StepStrip.module.css +53 -0
- package/dist/SuggestionInput.module.css +2 -2
- package/dist/SwipableMobileCarousel.module.css +64 -0
- package/dist/SwipableMobileCarouselDots.module.css +64 -0
- package/dist/SwipableMobileCarouselSlideParts.module.css +29 -0
- package/dist/SwipeStack.module.css +101 -0
- package/dist/SystemBanner.module.css +10 -0
- package/dist/Table.module.css +2 -2
- package/dist/Tabs.module.css +1 -1
- package/dist/TagInput.module.css +2 -2
- package/dist/Textarea.module.css +9 -1
- package/dist/ThreeColumnLayout.module.css +35 -0
- package/dist/Toast.module.css +62 -3
- package/dist/Tooltip.module.css +1 -1
- package/dist/UserMenu.module.css +90 -0
- package/dist/index.d.ts +1680 -30
- package/dist/index.js +4618 -1443
- package/dist/tokens/primitives.css +36 -0
- package/dist/tokens/semantic.css +32 -0
- package/dist/tokens/theme-presets.css +33 -0
- package/package.json +32 -12
- package/src/__tests__/package-json.test.ts +8 -0
- package/src/components/Accordion/Accordion.module.css +1 -1
- package/src/components/Alert/Alert.module.css +1 -1
- package/src/components/AppsLauncher/AppsLauncher.module.css +96 -0
- package/src/components/AppsLauncher/AppsLauncher.stories.tsx +58 -0
- package/src/components/AppsLauncher/AppsLauncher.tsx +117 -0
- package/src/components/AppsLauncher/__tests__/AppsLauncher.test.tsx +52 -0
- package/src/components/Avatar/Avatar.module.css +1 -1
- package/src/components/Badge/Badge.module.css +30 -7
- package/src/components/Badge/Badge.stories.tsx +16 -4
- package/src/components/Badge/Badge.tsx +8 -11
- package/src/components/Badge/__tests__/Badge.test.tsx +4 -2
- package/src/components/BalanceChip/BalanceChip.module.css +1 -1
- package/src/components/Button/Button.module.css +18 -2
- package/src/components/Card/Card.module.css +1 -1
- package/src/components/CardTile/CardTile.module.css +181 -0
- package/src/components/CardTile/CardTile.stories.tsx +86 -0
- package/src/components/CardTile/CardTile.tsx +128 -0
- package/src/components/CardTile/__tests__/CardTile.test.tsx +56 -0
- package/src/components/CodeTextarea/CodeTextarea.module.css +1 -1
- package/src/components/Collapsible/Collapsible.module.css +1 -1
- package/src/components/ColorPicker/ColorPicker.module.css +132 -0
- package/src/components/ColorPicker/ColorPicker.stories.tsx +80 -0
- package/src/components/ColorPicker/ColorPicker.tsx +157 -0
- package/src/components/ColorPicker/__tests__/ColorPicker.test.tsx +117 -0
- package/src/components/Combobox/Combobox.module.css +2 -2
- package/src/components/Command/Command.module.css +1 -1
- package/src/components/ConfirmDialog/ConfirmDialog.module.css +2 -2
- package/src/components/ConfirmDialog/ConfirmDialog.tsx +28 -2
- package/src/components/ConfirmDialog/__tests__/ConfirmDialog.test.tsx +71 -3
- package/src/components/ConsentPrompt/ConsentPrompt.module.css +21 -0
- package/src/components/ConsentPrompt/ConsentPrompt.stories.tsx +31 -0
- package/src/components/ConsentPrompt/ConsentPrompt.tsx +66 -0
- package/src/components/ContextMenu/ContextMenu.tsx +1 -1
- package/src/components/DatePicker/DatePicker.module.css +1 -1
- package/src/components/DeviceOnlyGate/DeviceOnlyGate.tsx +58 -0
- package/src/components/DeviceOnlyGate/__tests__/DeviceOnlyGate.test.tsx +45 -0
- package/src/components/DeviceStorageKeyGate/DeviceStorageKeyGate.tsx +100 -0
- package/src/components/DeviceStorageKeyGate/__tests__/DeviceStorageKeyGate.test.tsx +119 -0
- package/src/components/Dialog/Dialog.module.css +130 -21
- package/src/components/Dialog/Dialog.stories.tsx +179 -2
- package/src/components/Dialog/Dialog.tsx +137 -94
- package/src/components/Dialog/__tests__/Dialog.test.tsx +190 -9
- package/src/components/DragHandleRow/DragHandleRow.tsx +2 -21
- package/src/components/Drawer/Drawer.module.css +36 -7
- package/src/components/Drawer/Drawer.stories.tsx +44 -0
- package/src/components/Drawer/Drawer.tsx +27 -66
- package/src/components/Drawer/__tests__/Drawer.test.tsx +55 -6
- package/src/components/GripIcon/GripIcon.tsx +27 -0
- package/src/components/Header/Header.module.css +62 -0
- package/src/components/Header/Header.stories.tsx +452 -0
- package/src/components/Header/Header.tsx +102 -0
- package/src/components/Header/__tests__/Header.test.tsx +104 -0
- package/src/components/HeaderFooterLayout/HeaderFooterLayout.module.css +21 -0
- package/src/components/HeaderFooterLayout/HeaderFooterLayout.stories.tsx +111 -0
- package/src/components/HeaderFooterLayout/HeaderFooterLayout.tsx +54 -0
- package/src/components/HeaderFooterLayout/__tests__/HeaderFooterLayout.test.tsx +58 -0
- package/src/components/Icon/icons/arrow-left-right.tsx +23 -0
- package/src/components/Icon/icons/bold.tsx +20 -0
- package/src/components/Icon/icons/calendar.tsx +4 -4
- package/src/components/Icon/icons/carrot.tsx +3 -3
- package/src/components/Icon/icons/circle-chevron-left.tsx +21 -0
- package/src/components/Icon/icons/code.tsx +21 -0
- package/src/components/Icon/icons/copy.tsx +21 -0
- package/src/components/Icon/icons/credit-card.tsx +21 -0
- package/src/components/Icon/icons/database.tsx +22 -0
- package/src/components/Icon/icons/download.tsx +22 -0
- package/src/components/Icon/icons/file-text.tsx +24 -0
- package/src/components/Icon/icons/folder-closed.tsx +21 -0
- package/src/components/Icon/icons/folder-open.tsx +20 -0
- package/src/components/Icon/icons/folder.tsx +20 -0
- package/src/components/Icon/icons/folders.tsx +21 -0
- package/src/components/Icon/icons/hat-glasses.tsx +24 -0
- package/src/components/Icon/icons/history.tsx +22 -0
- package/src/components/Icon/icons/inbox.tsx +21 -0
- package/src/components/Icon/icons/index.ts +169 -1
- package/src/components/Icon/icons/italic.tsx +22 -0
- package/src/components/Icon/icons/layers.tsx +22 -0
- package/src/components/Icon/icons/layout-dashboard.tsx +23 -0
- package/src/components/Icon/icons/layout-grid.tsx +23 -0
- package/src/components/Icon/icons/link.tsx +21 -0
- package/src/components/Icon/icons/list-ordered.tsx +25 -0
- package/src/components/Icon/icons/list.tsx +25 -0
- package/src/components/Icon/icons/luggage.tsx +24 -0
- package/src/components/Icon/icons/map-pin.tsx +21 -0
- package/src/components/Icon/icons/menu.tsx +22 -0
- package/src/components/Icon/icons/minus.tsx +20 -0
- package/src/components/Icon/icons/paint-bucket.tsx +23 -0
- package/src/components/Icon/icons/panel-left.tsx +21 -0
- package/src/components/Icon/icons/pin.tsx +21 -0
- package/src/components/Icon/icons/rectangle-ellipsis.tsx +23 -0
- package/src/components/Icon/icons/refresh-cw.tsx +23 -0
- package/src/components/Icon/icons/rotate-cw.tsx +21 -0
- package/src/components/Icon/icons/route.tsx +22 -0
- package/src/components/Icon/icons/send.tsx +21 -0
- package/src/components/Icon/icons/share-2.tsx +24 -0
- package/src/components/Icon/icons/sheet.tsx +24 -0
- package/src/components/Icon/icons/smartphone.tsx +21 -0
- package/src/components/Icon/icons/square-kanban.tsx +23 -0
- package/src/components/Icon/icons/table.tsx +23 -0
- package/src/components/Icon/icons/user-round-plus.tsx +23 -0
- package/src/components/Icon/icons/users.tsx +23 -0
- package/src/components/IconPicker/IconPicker.module.css +1 -1
- package/src/components/Input/Input.module.css +1 -1
- package/src/components/Input/Input.tsx +8 -2
- package/src/components/Kbd/Kbd.module.css +1 -1
- package/src/components/LegalLinks/LegalLinks.module.css +24 -0
- package/src/components/LegalLinks/LegalLinks.stories.tsx +22 -0
- package/src/components/LegalLinks/LegalLinks.tsx +40 -0
- package/src/components/Markdown/Markdown.module.css +73 -0
- package/src/components/Markdown/Markdown.stories.tsx +40 -0
- package/src/components/Markdown/Markdown.tsx +305 -0
- package/src/components/Markdown/__tests__/Markdown.test.tsx +144 -0
- package/src/components/Menu/Menu.module.css +1 -0
- package/src/components/Menu/Menu.tsx +72 -22
- package/src/components/Menu/__tests__/Menu.test.tsx +30 -0
- package/src/components/Menubar/Menubar.tsx +1 -1
- package/src/components/Message/Message.module.css +1 -1
- package/src/components/MessageScroller/MessageScroller.module.css +12 -1
- package/src/components/MessageScroller/MessageScroller.tsx +12 -0
- package/src/components/MobileAppsDrawer/MobileAppsDrawer.module.css +82 -0
- package/src/components/MobileAppsDrawer/MobileAppsDrawer.tsx +78 -0
- package/src/components/MobileAppsDrawer/__tests__/MobileAppsDrawer.test.tsx +80 -0
- package/src/components/MobileFooter/MobileFooter.module.css +73 -0
- package/src/components/MobileFooter/MobileFooter.stories.tsx +47 -0
- package/src/components/MobileFooter/MobileFooter.tsx +122 -0
- package/src/components/MobileFooter/__tests__/MobileFooter.test.tsx +129 -0
- package/src/components/MobileHeader/MobileHeader.module.css +76 -0
- package/src/components/MobileHeader/MobileHeader.stories.tsx +57 -0
- package/src/components/MobileHeader/MobileHeader.tsx +90 -0
- package/src/components/MobileHeader/__tests__/MobileHeader.test.tsx +113 -0
- package/src/components/NavList/NavList.module.css +130 -0
- package/src/components/NavList/NavList.tsx +136 -0
- package/src/components/NavList/__tests__/NavList.test.tsx +109 -0
- package/src/components/NavTabs/NavTabs.module.css +1 -1
- package/src/components/NavTabs/NavTabs.tsx +39 -11
- package/src/components/NotificationsPanel/NotificationsPanel.module.css +258 -0
- package/src/components/NotificationsPanel/NotificationsPanel.stories.tsx +61 -0
- package/src/components/NotificationsPanel/NotificationsPanel.tsx +187 -0
- package/src/components/NotificationsPanel/__tests__/NotificationsPanel.test.tsx +78 -0
- package/src/components/OfflineGate/OfflineGate.tsx +44 -0
- package/src/components/OfflineGate/__tests__/OfflineGate.test.tsx +66 -0
- package/src/components/OverlayHeader/OverlayHeader.module.css +1 -1
- package/src/components/OverlayHeader/OverlayHeader.tsx +19 -4
- package/src/components/OverlayHeader/__tests__/OverlayHeader.test.tsx +18 -0
- package/src/components/PageContainer/PageContainer.module.css +82 -0
- package/src/components/PageContainer/PageContainer.tsx +64 -0
- package/src/components/PageContainer/__tests__/PageContainer.test.tsx +70 -0
- package/src/components/PageHeader/PageHeader.module.css +54 -0
- package/src/components/PageHeader/PageHeader.tsx +157 -2
- package/src/components/PageHeader/__tests__/PageHeader.test.tsx +103 -0
- package/src/components/PageLayout/PageLayout.module.css +51 -0
- package/src/components/PageLayout/PageLayout.stories.tsx +73 -0
- package/src/components/PageLayout/PageLayout.tsx +51 -0
- package/src/components/PageLayout/__tests__/PageLayout.test.tsx +34 -0
- package/src/components/Popover/Popover.module.css +1 -1
- package/src/components/Popover/Popover.tsx +86 -4
- package/src/components/Popover/__tests__/Popover.test.tsx +165 -0
- package/src/components/QuantityStepper/QuantityStepper.module.css +1 -1
- package/src/components/Resizable/Resizable.module.css +3 -3
- package/src/components/ResponsiveSurface/ResponsiveSurface.tsx +24 -0
- package/src/components/ResponsiveSurface/__tests__/ResponsiveSurface.test.tsx +73 -0
- package/src/components/RootLayout/RootLayout.module.css +12 -0
- package/src/components/RootLayout/RootLayout.stories.tsx +125 -0
- package/src/components/RootLayout/RootLayout.tsx +185 -0
- package/src/components/RootLayout/__tests__/RootLayout.test.tsx +161 -0
- package/src/components/SegmentedControl/SegmentedControl.module.css +1 -1
- package/src/components/Select/Select.module.css +1 -1
- package/src/components/Sheet/Sheet.module.css +4 -1
- package/src/components/Sheet/Sheet.tsx +14 -56
- package/src/components/SplitPane/SplitPane.module.css +4 -4
- package/src/components/StatusBadge/StatusBadge.module.css +1 -1
- package/src/components/StepStrip/StepStrip.module.css +53 -0
- package/src/components/StepStrip/StepStrip.tsx +74 -0
- package/src/components/SuggestionInput/SuggestionInput.module.css +2 -2
- package/src/components/SwipableMobileCarousel/SwipableMobileCarousel.module.css +64 -0
- package/src/components/SwipableMobileCarousel/SwipableMobileCarousel.tsx +243 -0
- package/src/components/SwipableMobileCarousel/SwipableMobileCarouselSlide.tsx +35 -0
- package/src/components/SwipableMobileCarousel/SwipableMobileCarouselSlideBody.tsx +42 -0
- package/src/components/SwipableMobileCarousel/SwipableMobileCarouselSlideFooter.tsx +18 -0
- package/src/components/SwipableMobileCarousel/SwipableMobileCarouselSlideHeader.tsx +21 -0
- package/src/components/SwipableMobileCarousel/SwipableMobileCarouselSlideParts.module.css +29 -0
- package/src/components/SwipableMobileCarousel/__tests__/SwipableMobileCarousel.test.tsx +214 -0
- package/src/components/SwipableMobileCarousel/__tests__/SwipableMobileCarouselDevGuard.test.tsx +61 -0
- package/src/components/SwipableMobileCarousel/context.ts +13 -0
- package/src/components/SwipableMobileCarouselDots/SwipableMobileCarouselDots.module.css +64 -0
- package/src/components/SwipableMobileCarouselDots/SwipableMobileCarouselDots.tsx +73 -0
- package/src/components/SwipableMobileCarouselDots/__tests__/SwipableMobileCarouselDots.test.tsx +63 -0
- package/src/components/SwipeStack/SwipeStack.module.css +101 -0
- package/src/components/SwipeStack/SwipeStack.tsx +199 -0
- package/src/components/SwipeStack/SwipeStackCard.tsx +22 -0
- package/src/components/SwipeStack/__tests__/SwipeStack.test.tsx +169 -0
- package/src/components/SystemBanner/SystemBanner.module.css +10 -0
- package/src/components/Table/Table.module.css +2 -2
- package/src/components/Tabs/Tabs.module.css +1 -1
- package/src/components/TagInput/TagInput.module.css +2 -2
- package/src/components/Textarea/Textarea.module.css +9 -1
- package/src/components/Textarea/Textarea.tsx +28 -5
- package/src/components/Textarea/__tests__/Textarea.test.tsx +23 -1
- package/src/components/ThreeColumnLayout/ThreeColumnLayout.module.css +35 -0
- package/src/components/ThreeColumnLayout/ThreeColumnLayout.stories.tsx +152 -0
- package/src/components/ThreeColumnLayout/ThreeColumnLayout.tsx +87 -0
- package/src/components/ThreeColumnLayout/__tests__/ThreeColumnLayout.test.tsx +78 -0
- package/src/components/Toast/Toast.module.css +62 -3
- package/src/components/Toast/Toast.stories.tsx +1 -1
- package/src/components/Tooltip/Tooltip.module.css +1 -1
- package/src/components/UserMenu/UserMenu.module.css +90 -0
- package/src/components/UserMenu/UserMenu.stories.tsx +49 -0
- package/src/components/UserMenu/UserMenu.tsx +132 -0
- package/src/components/UserMenu/__tests__/UserMenu.test.tsx +77 -0
- package/src/hooks/__tests__/useCarouselRouteSync.test.tsx +126 -0
- package/src/hooks/__tests__/useIsOffline.test.tsx +53 -0
- package/src/hooks/__tests__/useOfflineTileState.test.tsx +69 -0
- package/src/hooks/__tests__/usePublishShellChromeHeight.test.tsx +118 -0
- package/src/hooks/__tests__/useReorderSensors.test.ts +26 -0
- package/src/hooks/__tests__/useResponsiveLayout.test.tsx +87 -0
- package/src/hooks/__tests__/useSnapCarousel.test.tsx +175 -0
- package/src/hooks/__tests__/useSwipeReveal.test.tsx +110 -0
- package/src/hooks/__tests__/useSwipeStack.test.tsx +155 -0
- package/src/hooks/index.ts +27 -0
- package/src/hooks/useCarouselRouteSync.ts +92 -0
- package/src/hooks/useIsOffline.ts +41 -0
- package/src/hooks/useOfflineTileState.ts +45 -0
- package/src/hooks/usePublishShellChromeHeight.ts +96 -0
- package/src/hooks/useReorderSensors.ts +88 -0
- package/src/hooks/useResponsiveLayout.ts +36 -0
- package/src/hooks/useSnapCarousel.ts +284 -0
- package/src/hooks/useSwipeReveal.ts +107 -0
- package/src/hooks/useSwipeStack.ts +235 -0
- package/src/index.ts +124 -3
- package/src/overlay-shell.ts +159 -0
- package/src/stories/DesignSystemOverview.stories.tsx +933 -6
- package/src/stories/DeviceOnlyGate.stories.tsx +35 -0
- package/src/stories/DeviceStorageKeyGate.stories.tsx +57 -0
- package/src/stories/GripIcon.stories.tsx +29 -0
- package/src/stories/InteractionHooks.stories.tsx +483 -0
- package/src/stories/LayoutSystem.stories.tsx +639 -0
- package/src/stories/MenuEntries.stories.tsx +86 -0
- package/src/stories/MobilePatterns.stories.tsx +247 -2
- package/src/stories/NavList.stories.tsx +147 -0
- package/src/stories/NavTabs.stories.tsx +18 -0
- package/src/stories/OfflineGate.stories.tsx +42 -0
- package/src/stories/PageContainer.stories.tsx +82 -0
- package/src/stories/PageHeader.stories.tsx +65 -1
- package/src/stories/ResponsiveSurface.stories.tsx +47 -0
- package/src/stories/StepStrip.stories.tsx +76 -0
- package/src/stories/SwipableMobileCarousel.stories.tsx +362 -0
- package/src/stories/SwipeStack.stories.tsx +200 -0
- package/src/stories/Textarea.stories.tsx +12 -0
- package/src/stories/TokenGallery.stories.tsx +115 -0
- package/src/tokens/primitives.css +36 -0
- package/src/tokens/semantic.css +32 -0
- package/src/tokens/theme-presets.css +33 -0
- package/src/tokens/theme-presets.ts +72 -0
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
/* role — neutral fill, border */
|
|
20
20
|
.role {
|
|
21
21
|
background: var(--sv-color-surface-sunken);
|
|
22
|
-
border:
|
|
22
|
+
border: var(--sv-border-width-hairline) solid var(--sv-color-border);
|
|
23
23
|
color: var(--sv-color-text-primary);
|
|
24
24
|
font-weight: var(--sv-font-weight-semibold);
|
|
25
25
|
}
|
|
@@ -31,32 +31,32 @@
|
|
|
31
31
|
|
|
32
32
|
.chipGreen {
|
|
33
33
|
background: var(--sv-color-success-surface);
|
|
34
|
-
border:
|
|
34
|
+
border: var(--sv-border-width-hairline) solid var(--sv-color-success-border);
|
|
35
35
|
color: var(--sv-color-success-text);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
.chipAmber {
|
|
39
39
|
background: var(--sv-color-warning-surface);
|
|
40
|
-
border:
|
|
40
|
+
border: var(--sv-border-width-hairline) solid var(--sv-color-warning-border);
|
|
41
41
|
color: var(--sv-color-warning-text);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
.chipRed {
|
|
45
45
|
background: var(--sv-color-error-surface);
|
|
46
|
-
border:
|
|
46
|
+
border: var(--sv-border-width-hairline) solid var(--sv-color-error-border);
|
|
47
47
|
color: var(--sv-color-error-text);
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
.chipNeutral {
|
|
51
51
|
background: var(--sv-color-surface-sunken);
|
|
52
|
-
border:
|
|
52
|
+
border: var(--sv-border-width-hairline) solid var(--sv-color-border);
|
|
53
53
|
color: var(--sv-color-text-muted);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
/* mono — monospace font, neutral surface, for type tags / versions */
|
|
57
57
|
.mono {
|
|
58
58
|
background: var(--sv-color-surface-sunken);
|
|
59
|
-
border:
|
|
59
|
+
border: var(--sv-border-width-hairline) solid var(--sv-color-border);
|
|
60
60
|
color: var(--sv-color-text-muted);
|
|
61
61
|
font-family: var(--sv-font-family-mono);
|
|
62
62
|
}
|
|
@@ -66,7 +66,15 @@
|
|
|
66
66
|
composed partials fighting over the same properties. `.role.md`,
|
|
67
67
|
`.status.md`, and `.mono.md` reproduce the badge's original (and, until
|
|
68
68
|
now, only) sizing exactly, so the default (no `size` prop) renders
|
|
69
|
-
pixel-identical to before this scale existed.
|
|
69
|
+
pixel-identical to before this scale existed. `xs` was added later, for a
|
|
70
|
+
badge sitting inline next to larger text where `sm` (already the smallest
|
|
71
|
+
type-scale token, `--sv-font-size-label`) still read oversized — it needed
|
|
72
|
+
a new, smaller primitive (`--sv-font-size-2xs`) rather than reusing one. */
|
|
73
|
+
.role.xs {
|
|
74
|
+
padding: 1px 3px;
|
|
75
|
+
font-size: var(--sv-font-size-2xs);
|
|
76
|
+
}
|
|
77
|
+
|
|
70
78
|
.role.sm {
|
|
71
79
|
padding: 1px var(--sv-space-1);
|
|
72
80
|
font-size: var(--sv-font-size-label);
|
|
@@ -82,6 +90,11 @@
|
|
|
82
90
|
font-size: var(--sv-font-size-sm);
|
|
83
91
|
}
|
|
84
92
|
|
|
93
|
+
.mono.xs {
|
|
94
|
+
padding: 1px 3px;
|
|
95
|
+
font-size: var(--sv-font-size-2xs);
|
|
96
|
+
}
|
|
97
|
+
|
|
85
98
|
.mono.sm {
|
|
86
99
|
padding: 1px var(--sv-space-1);
|
|
87
100
|
font-size: var(--sv-font-size-label);
|
|
@@ -100,6 +113,11 @@
|
|
|
100
113
|
/* status keeps a tighter left edge than right at every size — the dot +
|
|
101
114
|
gap already read as space before the text, so a full padding-inline-start
|
|
102
115
|
would double it up. */
|
|
116
|
+
.status.xs {
|
|
117
|
+
padding: 1px 3px 1px 2px;
|
|
118
|
+
font-size: var(--sv-font-size-2xs);
|
|
119
|
+
}
|
|
120
|
+
|
|
103
121
|
.status.sm {
|
|
104
122
|
padding: 1px var(--sv-space-1) 1px 3px;
|
|
105
123
|
font-size: var(--sv-font-size-label);
|
|
@@ -122,6 +140,11 @@
|
|
|
122
140
|
flex-shrink: 0;
|
|
123
141
|
}
|
|
124
142
|
|
|
143
|
+
.xs .dot {
|
|
144
|
+
width: 4px;
|
|
145
|
+
height: 4px;
|
|
146
|
+
}
|
|
147
|
+
|
|
125
148
|
.sm .dot {
|
|
126
149
|
width: 5px;
|
|
127
150
|
height: 5px;
|
|
@@ -10,13 +10,13 @@ const meta = {
|
|
|
10
10
|
docs: {
|
|
11
11
|
description: {
|
|
12
12
|
component:
|
|
13
|
-
'Compact label for roles (`role`), lifecycle states (`status`), and type/version tags (`mono`).
|
|
13
|
+
'Compact label for roles (`role`), lifecycle states (`status`), and type/version tags (`mono`). Four sizes (`xs`/`sm`/`md`/`lg`); ALL CAPS by default, or set `uppercase={false}` for title case. RSC-safe — no state.',
|
|
14
14
|
},
|
|
15
15
|
},
|
|
16
16
|
},
|
|
17
17
|
argTypes: {
|
|
18
18
|
variant: { control: 'select', options: ['role', 'status', 'mono'] },
|
|
19
|
-
size: { control: 'select', options: ['sm', 'md', 'lg'] },
|
|
19
|
+
size: { control: 'select', options: ['xs', 'sm', 'md', 'lg'] },
|
|
20
20
|
status: {
|
|
21
21
|
control: 'select',
|
|
22
22
|
options: ['active', 'enabled', 'deactivated', 'failed', 'invited', 'pending', 'neutral'],
|
|
@@ -56,7 +56,7 @@ export const MonoPlatform: Story = { args: { variant: 'mono', children: 'platfor
|
|
|
56
56
|
export const MonoCommunity: Story = { args: { variant: 'mono', children: 'community' } };
|
|
57
57
|
export const MonoVersion: Story = { args: { variant: 'mono', children: 'v0.1.0' } };
|
|
58
58
|
|
|
59
|
-
/** sm / md (default) / lg side by side, across all three variants. */
|
|
59
|
+
/** xs / sm / md (default) / lg side by side, across all three variants. */
|
|
60
60
|
export const Sizes: Story = {
|
|
61
61
|
render: () => {
|
|
62
62
|
const rowStyle: React.CSSProperties = { display: 'flex', alignItems: 'center', gap: 8 };
|
|
@@ -65,6 +65,9 @@ export const Sizes: Story = {
|
|
|
65
65
|
<div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
|
|
66
66
|
<div style={sectionStyle}>
|
|
67
67
|
<div style={rowStyle}>
|
|
68
|
+
<Badge variant="role" size="xs">
|
|
69
|
+
Owner
|
|
70
|
+
</Badge>
|
|
68
71
|
<Badge variant="role" size="sm">
|
|
69
72
|
Owner
|
|
70
73
|
</Badge>
|
|
@@ -76,6 +79,9 @@ export const Sizes: Story = {
|
|
|
76
79
|
</Badge>
|
|
77
80
|
</div>
|
|
78
81
|
<div style={rowStyle}>
|
|
82
|
+
<Badge variant="status" status="active" size="xs">
|
|
83
|
+
Active
|
|
84
|
+
</Badge>
|
|
79
85
|
<Badge variant="status" status="active" size="sm">
|
|
80
86
|
Active
|
|
81
87
|
</Badge>
|
|
@@ -87,6 +93,9 @@ export const Sizes: Story = {
|
|
|
87
93
|
</Badge>
|
|
88
94
|
</div>
|
|
89
95
|
<div style={rowStyle}>
|
|
96
|
+
<Badge variant="mono" size="xs">
|
|
97
|
+
v0.1.0
|
|
98
|
+
</Badge>
|
|
90
99
|
<Badge variant="mono" size="sm">
|
|
91
100
|
v0.1.0
|
|
92
101
|
</Badge>
|
|
@@ -193,8 +202,11 @@ export const AllVariants: Story = {
|
|
|
193
202
|
</div>
|
|
194
203
|
</div>
|
|
195
204
|
<div style={sectionStyle}>
|
|
196
|
-
<span style={headingStyle}>Sizes (sm / md / lg)</span>
|
|
205
|
+
<span style={headingStyle}>Sizes (xs / sm / md / lg)</span>
|
|
197
206
|
<div style={{ ...groupStyle, alignItems: 'center' }}>
|
|
207
|
+
<Badge variant="role" size="xs">
|
|
208
|
+
Owner
|
|
209
|
+
</Badge>
|
|
198
210
|
<Badge variant="role" size="sm">
|
|
199
211
|
Owner
|
|
200
212
|
</Badge>
|
|
@@ -2,20 +2,17 @@ import type { ReactNode } from 'react';
|
|
|
2
2
|
import styles from './Badge.module.css';
|
|
3
3
|
|
|
4
4
|
export type BadgeVariant = 'role' | 'status' | 'mono';
|
|
5
|
-
export type BadgeSize = 'sm' | 'md' | 'lg';
|
|
5
|
+
export type BadgeSize = 'xs' | 'sm' | 'md' | 'lg';
|
|
6
6
|
export type BadgeStatus =
|
|
7
|
-
| '
|
|
8
|
-
| 'enabled'
|
|
9
|
-
| 'deactivated'
|
|
10
|
-
| 'failed'
|
|
11
|
-
| 'invited'
|
|
12
|
-
| 'pending'
|
|
13
|
-
| 'neutral';
|
|
7
|
+
'active' | 'enabled' | 'deactivated' | 'failed' | 'invited' | 'pending' | 'neutral';
|
|
14
8
|
|
|
15
9
|
export interface BadgeProps {
|
|
16
10
|
variant?: BadgeVariant;
|
|
17
|
-
/** 'sm' | 'md' (default) | 'lg'. 'md' is the badge's original — and
|
|
18
|
-
* now, only — size, so the default renders unchanged.
|
|
11
|
+
/** 'xs' | 'sm' | 'md' (default) | 'lg'. 'md' is the badge's original — and
|
|
12
|
+
* until now, only — size, so the default renders unchanged. 'xs' is the
|
|
13
|
+
* smallest tier (`--sv-font-size-2xs`, 10px) — for a badge sitting inline
|
|
14
|
+
* next to larger text (e.g. a status chip beside a card's headline value)
|
|
15
|
+
* where even 'sm' still reads oversized next to it. */
|
|
19
16
|
size?: BadgeSize;
|
|
20
17
|
/** Only relevant when variant="status" — determines the dot colour. */
|
|
21
18
|
status?: BadgeStatus;
|
|
@@ -54,7 +51,7 @@ const STATUS_CHIP_CLASS: Record<BadgeStatus, string> = {
|
|
|
54
51
|
* - `status` tinted chip with leading colour dot — for Active / Deactivated / etc.
|
|
55
52
|
* - `mono` monospace font, neutral surface — for platform / community / v0.1.0
|
|
56
53
|
*
|
|
57
|
-
*
|
|
54
|
+
* Four sizes (`xs`/`sm`/`md`/`lg`, default `md`). ALL CAPS by default
|
|
58
55
|
* (`uppercase`) — set `uppercase={false}` for a title-case badge instead.
|
|
59
56
|
*/
|
|
60
57
|
export function Badge({
|
|
@@ -69,8 +69,10 @@ describe('Badge', () => {
|
|
|
69
69
|
expect(screen.getByText('Admin').closest('span')?.className).toContain('md');
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
it('applies sm and lg size classes', () => {
|
|
73
|
-
const { rerender } = render(<Badge size="
|
|
72
|
+
it('applies xs, sm, and lg size classes', () => {
|
|
73
|
+
const { rerender } = render(<Badge size="xs">Admin</Badge>);
|
|
74
|
+
expect(screen.getByText('Admin').closest('span')?.className).toContain('xs');
|
|
75
|
+
rerender(<Badge size="sm">Admin</Badge>);
|
|
74
76
|
expect(screen.getByText('Admin').closest('span')?.className).toContain('sm');
|
|
75
77
|
rerender(<Badge size="lg">Admin</Badge>);
|
|
76
78
|
expect(screen.getByText('Admin').closest('span')?.className).toContain('lg');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
max-width: 100%;
|
|
5
5
|
min-height: 24px;
|
|
6
6
|
padding: 2px var(--sv-space-2);
|
|
7
|
-
border:
|
|
7
|
+
border: var(--sv-border-width-hairline) solid var(--sv-color-border);
|
|
8
8
|
border-radius: var(--sv-radius-full);
|
|
9
9
|
font-family: var(--sv-font-family);
|
|
10
10
|
font-size: var(--sv-font-size-xs);
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
align-items: center;
|
|
4
4
|
justify-content: center;
|
|
5
5
|
gap: var(--sv-space-2);
|
|
6
|
-
border:
|
|
6
|
+
border: var(--sv-border-width-hairline) solid transparent;
|
|
7
7
|
border-radius: var(--sv-radius-md);
|
|
8
8
|
font-family: var(--sv-font-family);
|
|
9
9
|
font-weight: var(--sv-font-weight-medium);
|
|
@@ -12,10 +12,15 @@
|
|
|
12
12
|
/* Removes the ~300ms double-tap-to-zoom delay on touch — this is a tap
|
|
13
13
|
target, never a pinch-zoom surface. */
|
|
14
14
|
touch-action: manipulation;
|
|
15
|
+
/* --sv-button-shadow defaults to `none` (semantic.css) — this box-shadow
|
|
16
|
+
line is a no-op for every theme that doesn't set it (RFC 0094). */
|
|
17
|
+
box-shadow: var(--sv-button-shadow);
|
|
15
18
|
transition:
|
|
16
19
|
background-color 0.15s ease,
|
|
17
20
|
border-color 0.15s ease,
|
|
18
|
-
color 0.15s ease
|
|
21
|
+
color 0.15s ease,
|
|
22
|
+
transform 0.1s ease,
|
|
23
|
+
box-shadow 0.1s ease;
|
|
19
24
|
}
|
|
20
25
|
|
|
21
26
|
.button:focus-visible {
|
|
@@ -28,6 +33,17 @@
|
|
|
28
33
|
cursor: not-allowed;
|
|
29
34
|
}
|
|
30
35
|
|
|
36
|
+
/* --sv-button-press-x/-y default to 0 (semantic.css) — translate(0, 0) is a
|
|
37
|
+
no-op, so this rule only produces a visible "press into shadow" effect
|
|
38
|
+
for a theme preset that sets non-zero values (RFC 0094). Unguarded by
|
|
39
|
+
(hover: hover) deliberately: :active press feedback is wanted on every
|
|
40
|
+
input type, the same reasoning documented for Button's existing
|
|
41
|
+
color-mix() :active background changes below. */
|
|
42
|
+
.button:active:not(:disabled) {
|
|
43
|
+
transform: translate(var(--sv-button-press-x), var(--sv-button-press-y));
|
|
44
|
+
box-shadow: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
31
47
|
/* Touch target: gated to (pointer: coarse) — the *primary* pointer, not
|
|
32
48
|
(any-pointer: coarse) — so a touchscreen laptop with mouse/trackpad as
|
|
33
49
|
primary keeps desktop density (see mobile design-system plan, Part 4 #5). */
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
exists. */
|
|
7
7
|
.card {
|
|
8
8
|
background: var(--sv-color-surface-raised);
|
|
9
|
-
border:
|
|
9
|
+
border: var(--sv-border-width-hairline) solid var(--sv-color-border);
|
|
10
10
|
border-radius: var(--sv-radius-lg);
|
|
11
11
|
box-shadow: var(--sv-shadow-card);
|
|
12
12
|
}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
.grid {
|
|
2
|
+
display: grid;
|
|
3
|
+
grid-template-columns: repeat(auto-fill, minmax(var(--sv-card-tile-min-width, 200px), 1fr));
|
|
4
|
+
gap: var(--sv-space-4);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/* A fixed column width (not `1fr`, and — as important — not `max-content`
|
|
8
|
+
either) — every real consumer of `dense` mode (Docs' folder/document
|
|
9
|
+
tiles, this file's own Storybook gallery) pairs it with `variant="icon"`
|
|
10
|
+
tiles carrying a name of unpredictable length that must ellipsis-truncate
|
|
11
|
+
past a point. `max-content` was tried first, on the reasoning that "a
|
|
12
|
+
tile keeps its own natural width instead of stretching to fill leftover
|
|
13
|
+
row space, so the empty area around a small icon tile stays roughly
|
|
14
|
+
square" — but `max-content` track sizing through this grid's nested
|
|
15
|
+
grid → flex → block(/inline-block) → text chain did not reliably account
|
|
16
|
+
for a descendant label's true content width in practice: measured live,
|
|
17
|
+
a 110px-wide label landed in a track that resolved to 97px, silently
|
|
18
|
+
overflowing with no ellipsis ever triggering (not the intended "grows to
|
|
19
|
+
fit," and not truncated either — just broken). A uniform fixed width
|
|
20
|
+
sidesteps that whole class of bug: every tile in a `dense` grid is
|
|
21
|
+
exactly `--sv-card-tile-min-width` wide, full stop, and the descendant
|
|
22
|
+
label (an `overflow: hidden; text-overflow: ellipsis` `inline-block` with
|
|
23
|
+
`max-width: 100%`) truncates reliably against that always-known width —
|
|
24
|
+
short names still read as compact/square, long ones truncate cleanly
|
|
25
|
+
instead of bleeding past their tile. Tighter gap to match. */
|
|
26
|
+
.gridDense {
|
|
27
|
+
grid-template-columns: repeat(auto-fill, var(--sv-card-tile-min-width, 200px));
|
|
28
|
+
gap: var(--sv-space-2);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/* Chrome (border/radius/shadow/background) lives on this outer box, same
|
|
32
|
+
tokens `Card` itself uses — but padding-free, so `.banner` below can
|
|
33
|
+
bleed all the way to the edges, which `Card`'s single padded box can't
|
|
34
|
+
do. */
|
|
35
|
+
.tile {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
height: 100%;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
border: 1px solid var(--sv-color-border);
|
|
41
|
+
border-radius: var(--sv-radius-lg);
|
|
42
|
+
background: var(--sv-color-surface-raised);
|
|
43
|
+
box-shadow: var(--sv-shadow-card);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.banner {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
justify-content: center;
|
|
50
|
+
height: 40px;
|
|
51
|
+
color: var(--sv-color-text-subtle);
|
|
52
|
+
/* Neutral default when no `bannerColor` is supplied — an inline style
|
|
53
|
+
on the element overrides this. */
|
|
54
|
+
background-color: var(--sv-color-surface-sunken);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.footer {
|
|
58
|
+
padding: var(--sv-space-3) var(--sv-space-4);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* `variant="icon"` modifier — a plain "Finder icon" tile: no card chrome,
|
|
62
|
+
just a large centered icon with a label beneath it. `.banner`/`.footer`
|
|
63
|
+
are the same two elements the card variant uses, restyled here rather
|
|
64
|
+
than duplicated, so both variants stay structurally identical. */
|
|
65
|
+
.tileIcon {
|
|
66
|
+
align-items: center;
|
|
67
|
+
border: none;
|
|
68
|
+
border-radius: var(--sv-radius-md);
|
|
69
|
+
background: none;
|
|
70
|
+
box-shadow: none;
|
|
71
|
+
padding: var(--sv-space-3) var(--sv-space-2);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
@media (hover: hover) {
|
|
75
|
+
.tileIcon:hover {
|
|
76
|
+
background: var(--sv-color-surface-sunken);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.tileIcon .banner {
|
|
81
|
+
height: auto;
|
|
82
|
+
background: none;
|
|
83
|
+
color: var(--sv-color-text-muted);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.tileIcon .banner svg {
|
|
87
|
+
width: 48px;
|
|
88
|
+
height: 48px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/* `width: 100%` is load-bearing, not decorative — `.tile` sets
|
|
92
|
+
`align-items: center` (so the icon banner centers itself horizontally),
|
|
93
|
+
and cross-axis `center` alignment sizes a flex item to its own preferred
|
|
94
|
+
(content-based) width and centers *that* within the container, rather
|
|
95
|
+
than clamping it to the container's width the way `stretch` would.
|
|
96
|
+
Without an explicit width here, a `nowrap` + `text-overflow: ellipsis`
|
|
97
|
+
label inside (a consumer's own truncation CSS) keeps its full
|
|
98
|
+
content-driven preferred width and gets centered straddling both edges of
|
|
99
|
+
`.tile` — `overflow: hidden` on `.tile` doesn't help, since this child's
|
|
100
|
+
box is genuinely laid out wider than its own container, not merely
|
|
101
|
+
painting past an already-settled one. `min-width: 0` alone (the more
|
|
102
|
+
common flex-truncation fix) does NOT fix this specific case: that only
|
|
103
|
+
lifts the auto-min-size floor that blocks *shrinking under stretch*, and
|
|
104
|
+
this axis was never being stretched to begin with. Confirmed live at a
|
|
105
|
+
viewport narrow enough that `.tile`'s own resolved width is well under
|
|
106
|
+
the label's preferred width — only `width: 100%` actually constrains it;
|
|
107
|
+
a wider test viewport had accidentally masked the bug by giving `.tile`
|
|
108
|
+
enough natural room that the oversized `.footer` fit anyway. */
|
|
109
|
+
.tileIcon .footer {
|
|
110
|
+
width: 100%;
|
|
111
|
+
min-width: 0;
|
|
112
|
+
padding: var(--sv-space-2) 0 0;
|
|
113
|
+
color: var(--sv-color-text-primary);
|
|
114
|
+
text-align: center;
|
|
115
|
+
text-decoration: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/* Plain centered placeholder — no banner strip, so a ghost "add new" tile
|
|
119
|
+
reads as an empty slot rather than mimicking a real tile's anatomy.
|
|
120
|
+
`min-height` matches a real `.tile`'s own natural height (banner +
|
|
121
|
+
single-line footer) so the two read as the same size. */
|
|
122
|
+
.newTile {
|
|
123
|
+
display: flex;
|
|
124
|
+
align-items: center;
|
|
125
|
+
justify-content: center;
|
|
126
|
+
gap: var(--sv-space-2);
|
|
127
|
+
min-height: 87px;
|
|
128
|
+
width: 100%;
|
|
129
|
+
height: 100%;
|
|
130
|
+
color: var(--sv-color-text-muted);
|
|
131
|
+
border: 1px dashed var(--sv-color-border-strong);
|
|
132
|
+
border-radius: var(--sv-radius-lg);
|
|
133
|
+
background: none;
|
|
134
|
+
cursor: pointer;
|
|
135
|
+
transition:
|
|
136
|
+
border-color 0.15s ease,
|
|
137
|
+
color 0.15s ease;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
@media (hover: hover) {
|
|
141
|
+
.newTile:hover {
|
|
142
|
+
border-color: var(--sv-color-text-muted);
|
|
143
|
+
color: var(--sv-color-text-primary);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.newTile:focus-visible {
|
|
148
|
+
outline: 2px solid var(--sv-color-focus-ring);
|
|
149
|
+
outline-offset: 2px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* `variant="icon"` modifier — matches a `variant="icon"` `CardTile`'s own
|
|
153
|
+
footprint. Icon-only, no visible label (see `NewCardTile`'s own doc
|
|
154
|
+
comment) — a plain "+" at the DS's own `size="md"` (unlike
|
|
155
|
+
`.tileIcon .banner svg`'s real-content 48px override, deliberately not
|
|
156
|
+
repeated here) reads as self-explanatory once every sibling tile in the
|
|
157
|
+
grid is already an unlabeled icon.
|
|
158
|
+
`width`/`height: 100%` (not `auto`, despite this being a "shrink to
|
|
159
|
+
content" variant conceptually) — a real `CardTile` sibling in the same
|
|
160
|
+
`dense` grid fills its grid cell via the grid's own item-stretch, which
|
|
161
|
+
only reaches an `auto`-sized *direct* grid child; wrapping this trigger
|
|
162
|
+
in a `Menu`/`Popover` (`HomeWorkbooksList.tsx`'s "add workbook" tile)
|
|
163
|
+
inserts an intermediate `display: inline-flex` container between this
|
|
164
|
+
button and the grid, and a flex container's default cross/main-axis
|
|
165
|
+
sizing does not itself relay grid-stretch through to a `width: auto`
|
|
166
|
+
flex child — confirmed live: the button rendered full-height but only
|
|
167
|
+
as wide as its own icon+padding (~38px) inside a 160px cell. Explicit
|
|
168
|
+
100% percentages resolve against whichever immediate parent box is
|
|
169
|
+
sized to the grid cell — the grid track directly, or the intermediate
|
|
170
|
+
flex container once IT has already been stretched to that width — so
|
|
171
|
+
this works correctly either way, unlike relying on stretch alone. */
|
|
172
|
+
.newTileIcon {
|
|
173
|
+
flex-direction: column;
|
|
174
|
+
justify-content: center;
|
|
175
|
+
gap: 0;
|
|
176
|
+
width: 100%;
|
|
177
|
+
height: 100%;
|
|
178
|
+
min-height: 0;
|
|
179
|
+
padding: var(--sv-space-3) var(--sv-space-2);
|
|
180
|
+
border-radius: var(--sv-radius-md);
|
|
181
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import { Icon } from '../Icon/Icon';
|
|
3
|
+
import { CardTile, CardTileGrid, NewCardTile } from './CardTile';
|
|
4
|
+
|
|
5
|
+
const meta = {
|
|
6
|
+
title: 'Components/CardTile',
|
|
7
|
+
component: CardTile,
|
|
8
|
+
parameters: {
|
|
9
|
+
layout: 'padded',
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component:
|
|
13
|
+
'A colored/iconed banner over a footer label, used as a grid of navigable tiles (projects, boards, and similar top-level entities). Pair with `CardTileGrid` for layout and `NewCardTile` for the grid\'s "add new" affordance. Not link-aware — wrap a tile in the host framework\'s own link component to make it navigable.',
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
args: {
|
|
18
|
+
children: 'Q4 Planning',
|
|
19
|
+
},
|
|
20
|
+
} satisfies Meta<typeof CardTile>;
|
|
21
|
+
|
|
22
|
+
export default meta;
|
|
23
|
+
type Story = StoryObj<typeof meta>;
|
|
24
|
+
|
|
25
|
+
export const Default: Story = {};
|
|
26
|
+
|
|
27
|
+
export const WithBannerIcon: Story = {
|
|
28
|
+
args: {
|
|
29
|
+
banner: <Icon name="folder" size="lg" aria-hidden={true} />,
|
|
30
|
+
children: 'Q4 Planning',
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const WithBannerColor: Story = {
|
|
35
|
+
args: {
|
|
36
|
+
bannerColor: '#c7d8ff',
|
|
37
|
+
children: 'Marketing site',
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const Grid: Story = {
|
|
42
|
+
render: () => (
|
|
43
|
+
<CardTileGrid>
|
|
44
|
+
<CardTile banner={<Icon name="folder" size="lg" aria-hidden={true} />}>Q4 Planning</CardTile>
|
|
45
|
+
<CardTile bannerColor="#ffd8c7">Design reviews</CardTile>
|
|
46
|
+
<CardTile bannerColor="#c7ffd9">Onboarding</CardTile>
|
|
47
|
+
<NewCardTile label="New project" />
|
|
48
|
+
</CardTileGrid>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/** `variant="icon"` — a plain "Finder icon" tile: no card chrome, just a large centered icon with a label beneath it. */
|
|
53
|
+
export const IconVariant: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
variant: 'icon',
|
|
56
|
+
banner: <Icon name="folder-closed" size="lg" aria-hidden={true} />,
|
|
57
|
+
children: 'Handbook',
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
/** `dense` — natural-width tiles (no stretch-to-fill) with a tighter gap, the pairing `variant="icon"` tiles normally want. `NewCardTile`'s own `variant="icon"` matches the same footprint, so the "add new" tile sits naturally alongside the rest instead of stretching into a wide pill. */
|
|
62
|
+
export const IconVariantGrid: Story = {
|
|
63
|
+
render: () => (
|
|
64
|
+
<CardTileGrid dense minTileWidth={100}>
|
|
65
|
+
<CardTile variant="icon" banner={<Icon name="folder-closed" size="lg" aria-hidden={true} />}>
|
|
66
|
+
Handbook
|
|
67
|
+
</CardTile>
|
|
68
|
+
<CardTile variant="icon" banner={<Icon name="folder-closed" size="lg" aria-hidden={true} />}>
|
|
69
|
+
Q4 Planning
|
|
70
|
+
</CardTile>
|
|
71
|
+
<CardTile variant="icon" banner={<Icon name="folder-closed" size="lg" aria-hidden={true} />}>
|
|
72
|
+
Design reviews
|
|
73
|
+
</CardTile>
|
|
74
|
+
<NewCardTile variant="icon" label="New" />
|
|
75
|
+
</CardTileGrid>
|
|
76
|
+
),
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
export const NewTile: StoryObj<typeof NewCardTile> = {
|
|
80
|
+
render: () => <NewCardTile label="New document" />,
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/** `variant="icon"` — matches a `variant="icon"` `CardTile`'s footprint (icon above a short label) instead of the default horizontal pill. */
|
|
84
|
+
export const NewTileIconVariant: StoryObj<typeof NewCardTile> = {
|
|
85
|
+
render: () => <NewCardTile variant="icon" label="New" />,
|
|
86
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, CSSProperties, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { Icon } from '../Icon/Icon';
|
|
3
|
+
import type { IconName } from '../Icon/Icon';
|
|
4
|
+
import styles from './CardTile.module.css';
|
|
5
|
+
|
|
6
|
+
export interface CardTileGridProps {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
/** Minimum tile width (px) before the grid wraps to fewer columns. */
|
|
9
|
+
minTileWidth?: number;
|
|
10
|
+
className?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Tight spacing with tiles that keep their natural width instead of
|
|
13
|
+
* stretching to fill the row — for small `variant="icon"` tiles (e.g. a
|
|
14
|
+
* folder grid), where the default grid's spacious gap and `1fr`-stretched
|
|
15
|
+
* columns leave a lot of empty space around a tile that's really just an
|
|
16
|
+
* icon + short label.
|
|
17
|
+
*/
|
|
18
|
+
dense?: boolean;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Responsive grid of `CardTile`/`NewCardTile` children — `repeat(auto-fill, minmax(minTileWidth, 1fr))`, or `minmax(minTileWidth, max-content)` with a tighter gap when `dense`. */
|
|
22
|
+
export function CardTileGrid({
|
|
23
|
+
children,
|
|
24
|
+
minTileWidth = 200,
|
|
25
|
+
className,
|
|
26
|
+
dense = false,
|
|
27
|
+
}: CardTileGridProps) {
|
|
28
|
+
const style = { '--sv-card-tile-min-width': `${minTileWidth}px` } as CSSProperties;
|
|
29
|
+
return (
|
|
30
|
+
<div
|
|
31
|
+
className={[styles.grid, dense && styles.gridDense, className].filter(Boolean).join(' ')}
|
|
32
|
+
style={style}
|
|
33
|
+
>
|
|
34
|
+
{children}
|
|
35
|
+
</div>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface CardTileProps extends HTMLAttributes<HTMLDivElement> {
|
|
40
|
+
/** Content centered in the tile's full-bleed top banner — typically an `<Icon>`. Omit for a plain strip. */
|
|
41
|
+
banner?: ReactNode;
|
|
42
|
+
/** Banner background color (applied inline). Falls back to a neutral sunken-surface strip when omitted. Ignored by `variant="icon"`, which has no banner box. */
|
|
43
|
+
bannerColor?: string;
|
|
44
|
+
/** Tile footer content — typically the item's name. */
|
|
45
|
+
children: ReactNode;
|
|
46
|
+
/**
|
|
47
|
+
* `"card"` (default): a bordered card with a colored/iconed banner strip
|
|
48
|
+
* over a footer label. `"icon"`: a plain "Finder icon" tile — no card
|
|
49
|
+
* chrome at all, just a large centered icon with a label beneath it. Use
|
|
50
|
+
* `"icon"` for entities that read as a single glyph + name (e.g. a
|
|
51
|
+
* folder), where a bordered card reads as heavier than the content needs.
|
|
52
|
+
*/
|
|
53
|
+
variant?: 'card' | 'icon';
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* A colored/iconed banner over a footer label — a card shape `Card` can't
|
|
58
|
+
* express, since `Card`'s `padding` prop always pads its single box with no
|
|
59
|
+
* way for a top region to bleed to the edges. Not link-aware: wrap it in the
|
|
60
|
+
* host framework's own link component (e.g. Next's `<Link>`) to make it
|
|
61
|
+
* navigable, same as every existing consumer of this pattern does.
|
|
62
|
+
*/
|
|
63
|
+
export function CardTile({
|
|
64
|
+
banner,
|
|
65
|
+
bannerColor,
|
|
66
|
+
children,
|
|
67
|
+
className,
|
|
68
|
+
variant = 'card',
|
|
69
|
+
...rest
|
|
70
|
+
}: CardTileProps) {
|
|
71
|
+
const isIcon = variant === 'icon';
|
|
72
|
+
return (
|
|
73
|
+
<div
|
|
74
|
+
className={[styles.tile, isIcon && styles.tileIcon, className].filter(Boolean).join(' ')}
|
|
75
|
+
{...rest}
|
|
76
|
+
>
|
|
77
|
+
<div
|
|
78
|
+
className={styles.banner}
|
|
79
|
+
aria-hidden="true"
|
|
80
|
+
style={!isIcon && bannerColor ? { backgroundColor: bannerColor } : undefined}
|
|
81
|
+
>
|
|
82
|
+
{banner}
|
|
83
|
+
</div>
|
|
84
|
+
<div className={styles.footer}>{children}</div>
|
|
85
|
+
</div>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface NewCardTileProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
90
|
+
/** Icon shown beside the label (`"card"`) or alone (`"icon"`). Defaults to `"plus"`. */
|
|
91
|
+
icon?: IconName;
|
|
92
|
+
/** Visible next to the icon for `"card"`. For `"icon"`, not rendered as text — used as the button's `aria-label` instead, since the tile is icon-only. */
|
|
93
|
+
label: string;
|
|
94
|
+
/**
|
|
95
|
+
* `"card"` (default): a dashed box matching a `variant="card"` `CardTile`'s
|
|
96
|
+
* footprint — icon beside a visible label. `"icon"`: matches a
|
|
97
|
+
* `variant="icon"` `CardTile`'s footprint instead, but icon-only, no
|
|
98
|
+
* visible label — a plain "+" reads as self-explanatory once every
|
|
99
|
+
* sibling tile in the same `dense` grid is already an unlabeled icon
|
|
100
|
+
* (the dashed border alone marks it as the "add new" affordance).
|
|
101
|
+
*/
|
|
102
|
+
variant?: 'card' | 'icon';
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Dashed ghost tile matching a real `CardTile`'s footprint — the grid's own "add new" affordance. */
|
|
106
|
+
export function NewCardTile({
|
|
107
|
+
icon = 'plus',
|
|
108
|
+
label,
|
|
109
|
+
type = 'button',
|
|
110
|
+
variant = 'card',
|
|
111
|
+
className,
|
|
112
|
+
...rest
|
|
113
|
+
}: NewCardTileProps) {
|
|
114
|
+
const isIcon = variant === 'icon';
|
|
115
|
+
return (
|
|
116
|
+
<button
|
|
117
|
+
type={type}
|
|
118
|
+
className={[styles.newTile, isIcon && styles.newTileIcon, className]
|
|
119
|
+
.filter(Boolean)
|
|
120
|
+
.join(' ')}
|
|
121
|
+
{...rest}
|
|
122
|
+
aria-label={isIcon ? label : undefined}
|
|
123
|
+
>
|
|
124
|
+
<Icon name={icon} size={isIcon ? 'md' : 'sm'} aria-hidden={true} />
|
|
125
|
+
{!isIcon && label}
|
|
126
|
+
</button>
|
|
127
|
+
);
|
|
128
|
+
}
|