@boyernick/standard-ui-react 0.1.1-canary.8 → 0.2.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/package.json +5 -3
- package/src/accordion.tsx +5 -2
- package/src/alert-dialog.tsx +1 -1
- package/src/attachment.tsx +5 -2
- package/src/autocomplete.tsx +4 -3
- package/src/block-editor.tsx +1747 -0
- package/src/brand.tsx +2 -2
- package/src/breadcrumb.tsx +14 -7
- package/src/button.tsx +22 -11
- package/src/calendar.tsx +6 -3
- package/src/carousel.tsx +220 -53
- package/src/checkbox.tsx +3 -2
- package/src/code-block.tsx +66 -5
- package/src/collapsible.tsx +4 -2
- package/src/combobox.tsx +4 -3
- package/src/command.tsx +41 -13
- package/src/date-picker.tsx +7 -2
- package/src/dialog.tsx +33 -10
- package/src/empty.tsx +4 -4
- package/src/field.tsx +4 -3
- package/src/filter-group.tsx +143 -0
- package/src/icons.tsx +28 -1
- package/src/illustrations.tsx +219 -141
- package/src/index.ts +245 -18
- package/src/input.tsx +8 -5
- package/src/kbd.tsx +49 -0
- package/src/lib/focus.ts +41 -0
- package/src/lib/popup.ts +1 -1
- package/src/lifeline/company-icon.tsx +71 -0
- package/src/lifeline/index.ts +42 -0
- package/src/lifeline/lifeline-data.ts +97 -0
- package/src/lifeline/lifeline-desktop.tsx +204 -0
- package/src/lifeline/lifeline-event.tsx +108 -0
- package/src/lifeline/lifeline-fireworks.tsx +302 -0
- package/src/lifeline/lifeline-hover-image.tsx +269 -0
- package/src/lifeline/lifeline-icons.tsx +39 -0
- package/src/lifeline/lifeline-intro-timing.ts +105 -0
- package/src/lifeline/lifeline-labels.tsx +24 -0
- package/src/lifeline/lifeline-layout.ts +1 -0
- package/src/lifeline/lifeline-legend.tsx +31 -0
- package/src/lifeline/lifeline-lightbox.tsx +309 -0
- package/src/lifeline/lifeline-marker.tsx +183 -0
- package/src/lifeline/lifeline-people.tsx +99 -0
- package/src/lifeline/lifeline-photos.tsx +366 -0
- package/src/lifeline/lifeline-shell.tsx +135 -0
- package/src/lifeline/lifeline-utils.ts +83 -0
- package/src/lifeline/lifeline-vertical.tsx +482 -0
- package/src/lifeline/lifeline.tsx +69 -0
- package/src/lifeline/types.ts +112 -0
- package/src/lifeline/use-lifeline-intro.ts +130 -0
- package/src/lifeline/use-lifeline-scroll.ts +1011 -0
- package/src/lifeline/use-lifeline-vertical-scroll.ts +271 -0
- package/src/menubar.tsx +9 -2
- package/src/minimap.tsx +296 -0
- package/src/modal.tsx +608 -0
- package/src/navigation-menu.tsx +338 -67
- package/src/number-field.tsx +336 -61
- package/src/otp-field.tsx +4 -3
- package/src/pagination.tsx +262 -42
- package/src/password-protection.tsx +345 -0
- package/src/popover.tsx +1 -1
- package/src/progress.tsx +5 -0
- package/src/questionnaire.tsx +284 -0
- package/src/radio.tsx +4 -2
- package/src/scroll-area.tsx +4 -1
- package/src/select.tsx +5 -2
- package/src/sidebar.tsx +113 -28
- package/src/slider.tsx +66 -6
- package/src/sounds.tsx +6 -10
- package/src/spinner.tsx +105 -32
- package/src/switch.tsx +4 -1
- package/src/table.tsx +82 -15
- package/src/tabs.tsx +189 -38
- package/src/text-animate.tsx +71 -28
- package/src/textarea.tsx +6 -1
- package/src/timeline.tsx +378 -0
- package/src/toast.tsx +214 -35
- package/src/toggle.tsx +4 -2
- package/src/toolbar.tsx +12 -7
- package/src/tooltip.tsx +43 -3
- package/src/video-player.tsx +396 -127
- package/src/image-modal.tsx +0 -110
- package/src/markdown-editor.tsx +0 -302
package/src/icons.tsx
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
"use client"
|
|
2
2
|
|
|
3
3
|
import type { CentralIconBaseProps } from "@central-icons-react/round-outlined-radius-2-stroke-2/CentralIconBase"
|
|
4
|
+
import { IconArrowDown as IconArrowDownBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconArrowDown"
|
|
4
5
|
import { IconBell as IconBellBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconBell"
|
|
5
6
|
import { IconCalendar1 as IconCalendar1Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconCalendar1"
|
|
6
7
|
import { IconChainLink1 as IconChainLink1Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChainLink1"
|
|
8
|
+
import { IconChainLink3 as IconChainLink3Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChainLink3"
|
|
7
9
|
import { IconCheckmark1 as IconCheckmark1Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconCheckmark1"
|
|
8
10
|
import { IconChevronBottom as IconChevronBottomBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChevronBottom"
|
|
9
11
|
import { IconChevronDownSmall as IconChevronDownSmallBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconChevronDownSmall"
|
|
@@ -13,18 +15,26 @@ import { IconCircleInfo as IconCircleInfoBase } from "@central-icons-react/round
|
|
|
13
15
|
import { IconClipboard as IconClipboardBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconClipboard"
|
|
14
16
|
import { IconCrossSmall as IconCrossSmallBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconCrossSmall"
|
|
15
17
|
import { IconDotGrid1x3Horizontal as IconDotGrid1x3HorizontalBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconDotGrid1x3Horizontal"
|
|
18
|
+
import { IconDotGrid2x3 as IconDotGrid2x3Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconDotGrid2x3"
|
|
16
19
|
import { IconExclamationCircle as IconExclamationCircleBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconExclamationCircle"
|
|
17
20
|
import { IconExclamationTriangle as IconExclamationTriangleBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconExclamationTriangle"
|
|
18
21
|
import { IconHome as IconHomeBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconHome"
|
|
22
|
+
import { IconFullScreen as IconFullScreenBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconFullScreen"
|
|
23
|
+
import { IconHighlight as IconHighlightBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconHighlight"
|
|
19
24
|
import { IconMagnifyingGlass as IconMagnifyingGlassBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconMagnifyingGlass"
|
|
20
25
|
import { IconMinusMedium as IconMinusBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconMinusMedium"
|
|
26
|
+
import { IconPause as IconPauseBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconPause"
|
|
21
27
|
import { IconMoon as IconMoonBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconMoon"
|
|
22
28
|
import { IconPeople as IconPeopleBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconPeople"
|
|
29
|
+
import { IconPlay as IconPlayBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconPlay"
|
|
23
30
|
import { IconPlusMedium as IconPlusBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconPlusMedium"
|
|
24
31
|
import { IconSettingsGear1 as IconSettingsGear1Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconSettingsGear1"
|
|
25
32
|
import { IconSquareBehindSquare6 as IconSquareBehindSquare6Base } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconSquareBehindSquare6"
|
|
26
33
|
import { IconStar as IconStarBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconStar"
|
|
34
|
+
import { IconStrikeThrough as IconStrikeThroughBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconStrikeThrough"
|
|
27
35
|
import { IconSun as IconSunBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconSun"
|
|
36
|
+
import { IconVolumeFull as IconVolumeFullBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconVolumeFull"
|
|
37
|
+
import { IconVolumeOff as IconVolumeOffBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconVolumeOff"
|
|
28
38
|
import { IconX as IconXBase } from "@central-icons-react/round-outlined-radius-2-stroke-2/IconX"
|
|
29
39
|
import type { ComponentType } from "react"
|
|
30
40
|
|
|
@@ -42,16 +52,21 @@ export const withCentralIconDefaults = (
|
|
|
42
52
|
): CentralIconComponent => {
|
|
43
53
|
const CentralIcon = ({
|
|
44
54
|
size = CENTRAL_ICON_SIZE,
|
|
55
|
+
// Central's "masked" mode hardcodes one maskId per icon name. A second
|
|
56
|
+
// instance on the page paints as a solid square. Raw mode avoids that.
|
|
57
|
+
mode = "raw",
|
|
45
58
|
...props
|
|
46
|
-
}: CentralIconProps) => <Icon size={size} {
|
|
59
|
+
}: CentralIconProps) => <Icon {...props} size={size} mode={mode} />
|
|
47
60
|
|
|
48
61
|
CentralIcon.displayName = Icon.displayName ?? Icon.name
|
|
49
62
|
return CentralIcon
|
|
50
63
|
}
|
|
51
64
|
|
|
65
|
+
export const IconArrowDown = withCentralIconDefaults(IconArrowDownBase)
|
|
52
66
|
export const IconBell = withCentralIconDefaults(IconBellBase)
|
|
53
67
|
export const IconCalendar1 = withCentralIconDefaults(IconCalendar1Base)
|
|
54
68
|
export const IconChainLink1 = withCentralIconDefaults(IconChainLink1Base)
|
|
69
|
+
export const IconChainLink3 = withCentralIconDefaults(IconChainLink3Base)
|
|
55
70
|
export const IconCheckmark1 = withCentralIconDefaults(IconCheckmark1Base)
|
|
56
71
|
export const IconChevronBottom = withCentralIconDefaults(IconChevronBottomBase)
|
|
57
72
|
export const IconChevronDownSmall = withCentralIconDefaults(
|
|
@@ -67,26 +82,34 @@ export const IconCrossSmall = withCentralIconDefaults(IconCrossSmallBase)
|
|
|
67
82
|
export const IconDotGrid1x3Horizontal = withCentralIconDefaults(
|
|
68
83
|
IconDotGrid1x3HorizontalBase,
|
|
69
84
|
)
|
|
85
|
+
export const IconDotGrid2x3 = withCentralIconDefaults(IconDotGrid2x3Base)
|
|
70
86
|
export const IconExclamationCircle = withCentralIconDefaults(
|
|
71
87
|
IconExclamationCircleBase,
|
|
72
88
|
)
|
|
73
89
|
export const IconExclamationTriangle = withCentralIconDefaults(
|
|
74
90
|
IconExclamationTriangleBase,
|
|
75
91
|
)
|
|
92
|
+
export const IconFullScreen = withCentralIconDefaults(IconFullScreenBase)
|
|
76
93
|
export const IconHome = withCentralIconDefaults(IconHomeBase)
|
|
77
94
|
export const IconMagnifyingGlass = withCentralIconDefaults(
|
|
78
95
|
IconMagnifyingGlassBase,
|
|
79
96
|
)
|
|
80
97
|
export const IconMinus = withCentralIconDefaults(IconMinusBase)
|
|
98
|
+
export const IconPause = withCentralIconDefaults(IconPauseBase)
|
|
81
99
|
export const IconMoon = withCentralIconDefaults(IconMoonBase)
|
|
82
100
|
export const IconPeople = withCentralIconDefaults(IconPeopleBase)
|
|
101
|
+
export const IconPlay = withCentralIconDefaults(IconPlayBase)
|
|
83
102
|
export const IconPlus = withCentralIconDefaults(IconPlusBase)
|
|
84
103
|
export const IconSettingsGear1 = withCentralIconDefaults(IconSettingsGear1Base)
|
|
85
104
|
export const IconSquareBehindSquare6 = withCentralIconDefaults(
|
|
86
105
|
IconSquareBehindSquare6Base,
|
|
87
106
|
)
|
|
88
107
|
export const IconStar = withCentralIconDefaults(IconStarBase)
|
|
108
|
+
export const IconStrikeThrough = withCentralIconDefaults(IconStrikeThroughBase)
|
|
109
|
+
export const IconHighlight = withCentralIconDefaults(IconHighlightBase)
|
|
89
110
|
export const IconSun = withCentralIconDefaults(IconSunBase)
|
|
111
|
+
export const IconVolumeFull = withCentralIconDefaults(IconVolumeFullBase)
|
|
112
|
+
export const IconVolumeOff = withCentralIconDefaults(IconVolumeOffBase)
|
|
90
113
|
export const IconX = withCentralIconDefaults(IconXBase)
|
|
91
114
|
|
|
92
115
|
export const iconGallery = [
|
|
@@ -110,9 +133,13 @@ export const iconGallery = [
|
|
|
110
133
|
{ name: "IconCircleInfo", Icon: IconCircleInfo },
|
|
111
134
|
{ name: "IconClipboard", Icon: IconClipboard },
|
|
112
135
|
{ name: "IconDotGrid1x3Horizontal", Icon: IconDotGrid1x3Horizontal },
|
|
136
|
+
{ name: "IconDotGrid2x3", Icon: IconDotGrid2x3 },
|
|
113
137
|
{ name: "IconSquareBehindSquare6", Icon: IconSquareBehindSquare6 },
|
|
114
138
|
{ name: "IconChainLink1", Icon: IconChainLink1 },
|
|
139
|
+
{ name: "IconChainLink3", Icon: IconChainLink3 },
|
|
115
140
|
{ name: "IconExclamationCircle", Icon: IconExclamationCircle },
|
|
116
141
|
{ name: "IconExclamationTriangle", Icon: IconExclamationTriangle },
|
|
117
142
|
{ name: "IconStar", Icon: IconStar },
|
|
143
|
+
{ name: "IconStrikeThrough", Icon: IconStrikeThrough },
|
|
144
|
+
{ name: "IconHighlight", Icon: IconHighlight },
|
|
118
145
|
] as const
|
package/src/illustrations.tsx
CHANGED
|
@@ -1,167 +1,245 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentProps, ReactNode } from "react"
|
|
2
2
|
import { cn } from "./lib/cn"
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Small, composition-based illustrations for empty states.
|
|
6
|
+
*
|
|
7
|
+
* Built from divs and theme tokens rather than SVG paths, so they follow the
|
|
8
|
+
* palette into dark mode instead of carrying baked-in colours. They are
|
|
9
|
+
* deliberately abstract and monochrome — a miniature of the thing that is
|
|
10
|
+
* missing, not a picture about it. Nothing here uses a brand colour: an empty
|
|
11
|
+
* state is a quiet moment, and an accent turns it into an announcement.
|
|
12
|
+
*/
|
|
5
13
|
|
|
6
|
-
|
|
7
|
-
viewBox: "0 0 240 160",
|
|
8
|
-
fill: "none",
|
|
9
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
10
|
-
} as const
|
|
14
|
+
export type IllustrationProps = ComponentProps<"div">
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
/** Fixed 64×48 stage, so a row of these lines up without ad-hoc sizing. */
|
|
17
|
+
const Frame = ({ className, children, ...props }: IllustrationProps) => (
|
|
18
|
+
<div
|
|
19
|
+
className={cn(
|
|
20
|
+
"inline-flex h-12 w-16 shrink-0 items-center justify-center",
|
|
21
|
+
className,
|
|
22
|
+
)}
|
|
19
23
|
aria-hidden
|
|
20
24
|
{...props}
|
|
21
25
|
>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
className="fill-background-secondary"
|
|
25
|
-
stroke="currentColor"
|
|
26
|
-
strokeWidth="2"
|
|
27
|
-
/>
|
|
28
|
-
<path
|
|
29
|
-
d="M52 65h45l8 13h30l8-13h45"
|
|
30
|
-
stroke="currentColor"
|
|
31
|
-
strokeWidth="2"
|
|
32
|
-
strokeLinejoin="round"
|
|
33
|
-
/>
|
|
34
|
-
<path
|
|
35
|
-
d="M97 31h46"
|
|
36
|
-
className="text-brand-primary"
|
|
37
|
-
stroke="currentColor"
|
|
38
|
-
strokeWidth="4"
|
|
39
|
-
strokeLinecap="round"
|
|
40
|
-
/>
|
|
41
|
-
<circle cx="120" cy="104" r="4" className="fill-brand-primary" />
|
|
42
|
-
</svg>
|
|
26
|
+
{children}
|
|
27
|
+
</div>
|
|
43
28
|
)
|
|
44
29
|
|
|
45
|
-
|
|
30
|
+
/** A sheet. The hairline and radius are sub-pixel on purpose — at this size a
|
|
31
|
+
* 1px border reads as a heavy outline rather than an edge. */
|
|
32
|
+
const Card = ({
|
|
33
|
+
className,
|
|
34
|
+
children,
|
|
35
|
+
}: {
|
|
36
|
+
className?: string
|
|
37
|
+
children?: ReactNode
|
|
38
|
+
}) => (
|
|
39
|
+
<div
|
|
40
|
+
className={cn(
|
|
41
|
+
"relative flex shrink-0 flex-col overflow-hidden rounded-[3px] border-[0.5px] border-border-primary bg-surface p-1 shadow-hairline",
|
|
42
|
+
className,
|
|
43
|
+
)}
|
|
44
|
+
>
|
|
45
|
+
{children}
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
/** A line of content. */
|
|
50
|
+
const Bar = ({ width }: { width: string }) => (
|
|
51
|
+
<div
|
|
52
|
+
className="h-[3px] shrink-0 rounded-[1px] bg-background-tertiary"
|
|
53
|
+
style={{ width }}
|
|
54
|
+
/>
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
/** Nothing here yet — a sheet with no content on it. */
|
|
58
|
+
export const IllustrationEmpty = ({ className, ...props }: IllustrationProps) => (
|
|
59
|
+
<Frame className={className} {...props}>
|
|
60
|
+
<Card className="h-10 w-8" />
|
|
61
|
+
</Frame>
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
/** Something to look through — a sheet behind a lens. */
|
|
65
|
+
export const IllustrationSearch = ({
|
|
46
66
|
className,
|
|
47
67
|
...props
|
|
48
68
|
}: IllustrationProps) => (
|
|
49
|
-
<
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
y="28"
|
|
58
|
-
width="146"
|
|
59
|
-
height="104"
|
|
60
|
-
rx="16"
|
|
61
|
-
className="fill-background-secondary"
|
|
62
|
-
stroke="currentColor"
|
|
63
|
-
strokeWidth="2"
|
|
64
|
-
/>
|
|
65
|
-
<path
|
|
66
|
-
d="M47 54h146"
|
|
67
|
-
stroke="currentColor"
|
|
68
|
-
strokeWidth="2"
|
|
69
|
-
/>
|
|
70
|
-
<circle cx="63" cy="41" r="3" className="fill-brand-primary" />
|
|
71
|
-
<circle cx="74" cy="41" r="3" fill="currentColor" opacity=".45" />
|
|
72
|
-
<circle cx="85" cy="41" r="3" fill="currentColor" opacity=".25" />
|
|
73
|
-
<path
|
|
74
|
-
d="m103 78 34 34m0-34-34 34"
|
|
75
|
-
className="text-brand-primary"
|
|
76
|
-
stroke="currentColor"
|
|
77
|
-
strokeWidth="5"
|
|
78
|
-
strokeLinecap="round"
|
|
79
|
-
/>
|
|
80
|
-
</svg>
|
|
69
|
+
<Frame className={className} {...props}>
|
|
70
|
+
<Card className="h-10 w-8 gap-[3px]">
|
|
71
|
+
<Bar width="80%" />
|
|
72
|
+
<Bar width="55%" />
|
|
73
|
+
<Bar width="35%" />
|
|
74
|
+
</Card>
|
|
75
|
+
<div className="-ml-2.5 mt-4 size-4 rounded-full border-[1.5px] border-border-secondary bg-surface" />
|
|
76
|
+
</Frame>
|
|
81
77
|
)
|
|
82
78
|
|
|
83
|
-
|
|
79
|
+
/** Something went wrong — the stack knocked out of true. */
|
|
80
|
+
export const IllustrationError = ({ className, ...props }: IllustrationProps) => (
|
|
81
|
+
<Frame className={className} {...props}>
|
|
82
|
+
<Card className="h-9 w-7 -rotate-6" />
|
|
83
|
+
<Card className="-ml-3 h-10 w-8 rotate-[7deg] gap-[3px]">
|
|
84
|
+
<Bar width="70%" />
|
|
85
|
+
<Bar width="45%" />
|
|
86
|
+
</Card>
|
|
87
|
+
</Frame>
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
/** Somewhere to put a file — a sheet going into a folder.
|
|
91
|
+
*
|
|
92
|
+
* Two earlier attempts failed for the same reason: an arrow stamped on a
|
|
93
|
+
* sheet, then a sheet on a plain grey slab, both read as a document with
|
|
94
|
+
* something next to it. A folder is its own silhouette — tab, body, a sheet
|
|
95
|
+
* tucked behind the front — so the arrangement carries the meaning and no
|
|
96
|
+
* symbol has to. It is also the one shape here that is not another sheet,
|
|
97
|
+
* which keeps it from reading as the error stack. */
|
|
98
|
+
export const IllustrationUpload = ({
|
|
84
99
|
className,
|
|
85
100
|
...props
|
|
86
101
|
}: IllustrationProps) => (
|
|
87
|
-
<
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
strokeWidth="2"
|
|
100
|
-
/>
|
|
101
|
-
<circle
|
|
102
|
-
cx="120"
|
|
103
|
-
cy="80"
|
|
104
|
-
r="37"
|
|
105
|
-
className="fill-brand-primary text-brand-primary"
|
|
106
|
-
stroke="currentColor"
|
|
107
|
-
strokeWidth="2"
|
|
108
|
-
/>
|
|
109
|
-
<path
|
|
110
|
-
d="m99 80 14 14 29-31"
|
|
111
|
-
className="text-brand-foreground"
|
|
112
|
-
stroke="currentColor"
|
|
113
|
-
strokeWidth="6"
|
|
114
|
-
strokeLinecap="round"
|
|
115
|
-
strokeLinejoin="round"
|
|
116
|
-
/>
|
|
117
|
-
<path
|
|
118
|
-
d="M63 42h13M69.5 35.5v13M168 118h13m-6.5-6.5v13"
|
|
119
|
-
className="text-brand-primary"
|
|
120
|
-
stroke="currentColor"
|
|
121
|
-
strokeWidth="3"
|
|
122
|
-
strokeLinecap="round"
|
|
123
|
-
/>
|
|
124
|
-
</svg>
|
|
102
|
+
<Frame className={className} {...props}>
|
|
103
|
+
<div className="relative h-11 w-12">
|
|
104
|
+
{/* Tucked deep enough that the folder front cuts across it. */}
|
|
105
|
+
<Card className="absolute inset-x-[13px] top-0 h-8 -rotate-6 gap-[3px]">
|
|
106
|
+
<Bar width="70%" />
|
|
107
|
+
<Bar width="45%" />
|
|
108
|
+
</Card>
|
|
109
|
+
{/* Laps 1px into the body so their borders read as one outline. */}
|
|
110
|
+
<div className="absolute bottom-[21px] left-1 h-1.5 w-4 rounded-t-[2px] border-x-[0.5px] border-t-[0.5px] border-border-secondary bg-background-tertiary" />
|
|
111
|
+
<div className="absolute inset-x-1 bottom-0 h-[22px] rounded-[3px] border-[0.5px] border-border-secondary bg-background-tertiary" />
|
|
112
|
+
</div>
|
|
113
|
+
</Frame>
|
|
125
114
|
)
|
|
126
115
|
|
|
127
|
-
|
|
116
|
+
/** Done — a sheet carrying a mark. */
|
|
117
|
+
export const IllustrationSuccess = ({
|
|
128
118
|
className,
|
|
129
119
|
...props
|
|
130
120
|
}: IllustrationProps) => (
|
|
131
|
-
<
|
|
132
|
-
|
|
133
|
-
|
|
121
|
+
<Frame className={className} {...props}>
|
|
122
|
+
<Card className="h-10 w-8 items-center justify-center">
|
|
123
|
+
{/* A check is cheaper as two borders on a rotated box than as a path. */}
|
|
124
|
+
<span className="mb-0.5 h-3 w-1.5 rotate-45 border-r-[1.5px] border-b-[1.5px] border-fg-tertiary" />
|
|
125
|
+
</Card>
|
|
126
|
+
</Frame>
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
/* -------------------------------------------------------------------------
|
|
130
|
+
* File types
|
|
131
|
+
*
|
|
132
|
+
* A second, smaller family. These sit inline — in an attachment row, a list,
|
|
133
|
+
* a preview slot — so they are a bare sheet at 24×30 rather than a hero on a
|
|
134
|
+
* 64×48 stage. Same grammar: a sheet, and marks on it standing in for whatever
|
|
135
|
+
* the file holds.
|
|
136
|
+
*
|
|
137
|
+
* Presentational, like Kbd: they render the type you name. Mapping an
|
|
138
|
+
* extension to a type is the consumer's job, since only the consumer knows
|
|
139
|
+
* what it wants to do with the ones it does not recognise.
|
|
140
|
+
* ---------------------------------------------------------------------- */
|
|
141
|
+
|
|
142
|
+
export type FileIllustrationType =
|
|
143
|
+
| "document"
|
|
144
|
+
| "image"
|
|
145
|
+
| "spreadsheet"
|
|
146
|
+
| "presentation"
|
|
147
|
+
| "video"
|
|
148
|
+
| "audio"
|
|
149
|
+
| "code"
|
|
150
|
+
| "archive"
|
|
151
|
+
| "generic"
|
|
152
|
+
|
|
153
|
+
export type IllustrationFileProps = IllustrationProps & {
|
|
154
|
+
type?: FileIllustrationType
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** A block of colour standing in for content rather than a line of it. */
|
|
158
|
+
const Block = ({ className }: { className?: string }) => (
|
|
159
|
+
<div className={cn("rounded-[1px] bg-background-tertiary", className)} />
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
const marks: Record<FileIllustrationType, ReactNode> = {
|
|
163
|
+
document: (
|
|
164
|
+
<>
|
|
165
|
+
<Bar width="100%" />
|
|
166
|
+
<Bar width="100%" />
|
|
167
|
+
<Bar width="60%" />
|
|
168
|
+
</>
|
|
169
|
+
),
|
|
170
|
+
// A horizon and a sun — the smallest arrangement that reads as a picture.
|
|
171
|
+
image: (
|
|
172
|
+
<div className="relative mt-auto h-3.5 w-full">
|
|
173
|
+
<Block className="absolute top-0 right-1 size-1.5 rounded-full" />
|
|
174
|
+
<Block className="absolute inset-x-0 bottom-0 h-2 [clip-path:polygon(0_100%,38%_28%,62%_100%)]" />
|
|
175
|
+
<Block className="absolute right-0 bottom-0 h-1.5 w-1/2 [clip-path:polygon(0_100%,50%_20%,100%_100%)]" />
|
|
176
|
+
</div>
|
|
177
|
+
),
|
|
178
|
+
spreadsheet: (
|
|
179
|
+
<div className="grid h-full w-full grid-cols-3 grid-rows-3 gap-[1.5px]">
|
|
180
|
+
{Array.from({ length: 9 }, (_, i) => (
|
|
181
|
+
<Block key={i} />
|
|
182
|
+
))}
|
|
183
|
+
</div>
|
|
184
|
+
),
|
|
185
|
+
presentation: (
|
|
186
|
+
<>
|
|
187
|
+
<Block className="h-2.5 w-full" />
|
|
188
|
+
<Bar width="70%" />
|
|
189
|
+
</>
|
|
190
|
+
),
|
|
191
|
+
// A play triangle, cut from a block so it keeps the same fill as everything else.
|
|
192
|
+
video: (
|
|
193
|
+
<div className="m-auto size-3">
|
|
194
|
+
<Block className="size-full [clip-path:polygon(22%_10%,90%_50%,22%_90%)]" />
|
|
195
|
+
</div>
|
|
196
|
+
),
|
|
197
|
+
audio: (
|
|
198
|
+
<div className="m-auto flex h-3.5 items-center gap-[2px]">
|
|
199
|
+
<Block className="h-1.5 w-[2px]" />
|
|
200
|
+
<Block className="h-3.5 w-[2px]" />
|
|
201
|
+
<Block className="h-2.5 w-[2px]" />
|
|
202
|
+
<Block className="h-3.5 w-[2px]" />
|
|
203
|
+
<Block className="h-1.5 w-[2px]" />
|
|
204
|
+
</div>
|
|
205
|
+
),
|
|
206
|
+
code: (
|
|
207
|
+
<>
|
|
208
|
+
<Bar width="55%" />
|
|
209
|
+
<div className="flex w-full pl-1.5">
|
|
210
|
+
<Bar width="70%" />
|
|
211
|
+
</div>
|
|
212
|
+
<div className="flex w-full pl-1.5">
|
|
213
|
+
<Bar width="50%" />
|
|
214
|
+
</div>
|
|
215
|
+
<Bar width="40%" />
|
|
216
|
+
</>
|
|
217
|
+
),
|
|
218
|
+
// A stack, since an archive is other files in a coat.
|
|
219
|
+
archive: (
|
|
220
|
+
<div className="m-auto flex flex-col gap-[2px]">
|
|
221
|
+
<Block className="h-1.5 w-2.5" />
|
|
222
|
+
<Block className="h-1.5 w-2.5" />
|
|
223
|
+
<Block className="h-1.5 w-2.5" />
|
|
224
|
+
</div>
|
|
225
|
+
),
|
|
226
|
+
generic: null,
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/** One file, drawn as the kind of thing it holds. */
|
|
230
|
+
export const IllustrationFile = ({
|
|
231
|
+
type = "generic",
|
|
232
|
+
className,
|
|
233
|
+
...props
|
|
234
|
+
}: IllustrationFileProps) => (
|
|
235
|
+
<div
|
|
236
|
+
className={cn(
|
|
237
|
+
"relative flex h-[30px] w-6 shrink-0 flex-col gap-[3px] overflow-hidden rounded-[3px] border-[0.5px] border-border-primary bg-surface p-1 shadow-hairline",
|
|
238
|
+
className,
|
|
239
|
+
)}
|
|
134
240
|
aria-hidden
|
|
135
241
|
{...props}
|
|
136
242
|
>
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
className="fill-background-secondary"
|
|
140
|
-
stroke="currentColor"
|
|
141
|
-
strokeWidth="2"
|
|
142
|
-
/>
|
|
143
|
-
<path d="M42 58h125" stroke="currentColor" strokeWidth="2" />
|
|
144
|
-
<path
|
|
145
|
-
d="M59 76h48M59 89h34M59 102h53"
|
|
146
|
-
stroke="currentColor"
|
|
147
|
-
strokeWidth="4"
|
|
148
|
-
strokeLinecap="round"
|
|
149
|
-
opacity=".5"
|
|
150
|
-
/>
|
|
151
|
-
<circle
|
|
152
|
-
cx="155"
|
|
153
|
-
cy="91"
|
|
154
|
-
r="27"
|
|
155
|
-
className="fill-surface text-brand-primary"
|
|
156
|
-
stroke="currentColor"
|
|
157
|
-
strokeWidth="5"
|
|
158
|
-
/>
|
|
159
|
-
<path
|
|
160
|
-
d="m174 111 22 22"
|
|
161
|
-
className="text-brand-primary"
|
|
162
|
-
stroke="currentColor"
|
|
163
|
-
strokeWidth="7"
|
|
164
|
-
strokeLinecap="round"
|
|
165
|
-
/>
|
|
166
|
-
</svg>
|
|
243
|
+
{marks[type]}
|
|
244
|
+
</div>
|
|
167
245
|
)
|