@justanarthur/modo-ui-notch 0.2.0 → 0.4.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 +11 -11
- package/blocks/activities/agenda/examples.mdx +29 -5
- package/blocks/activities/agenda/index.tsx +438 -181
- package/blocks/activities/clock/examples.mdx +89 -0
- package/blocks/activities/clock/index.tsx +917 -0
- package/blocks/activities/now-playing/examples.mdx +40 -13
- package/blocks/activities/now-playing/index.tsx +399 -120
- package/blocks/activities/weather/examples.mdx +123 -0
- package/blocks/activities/weather/index.tsx +863 -0
- package/blocks/app/expanded-island/examples.mdx +8 -7
- package/blocks/app/expanded-island/index.tsx +22 -4
- package/blocks/app/settings-window/examples.mdx +14 -2
- package/blocks/app/settings-window/index.tsx +33 -10
- package/blocks/system/clipboard/examples.mdx +91 -0
- package/blocks/system/clipboard/index.tsx +773 -0
- package/blocks/system/recent-files/examples.mdx +80 -0
- package/blocks/system/recent-files/index.tsx +627 -0
- package/blocks/system/system-stats/examples.mdx +46 -9
- package/blocks/system/system-stats/index.tsx +445 -104
- package/components/indicators/media-scrubber/examples.mdx +8 -0
- package/components/indicators/media-scrubber/index.tsx +37 -13
- package/components/island/island/examples.mdx +4 -4
- package/components/island/island/index.tsx +2 -2
- package/components/island/island-flash/examples.mdx +15 -18
- package/components/island/island-flash/index.tsx +4 -4
- package/components/island/island-tabs/examples.mdx +5 -5
- package/components/island/widget/examples.mdx +76 -0
- package/components/island/widget/index.tsx +465 -0
- package/dist/blocks/activities/agenda/index.d.ts +2 -1
- package/dist/blocks/activities/agenda/index.js +3 -3
- package/dist/blocks/activities/clock/index.d.ts +3 -0
- package/dist/blocks/activities/clock/index.js +25 -0
- package/dist/blocks/activities/now-playing/index.d.ts +4 -2
- package/dist/blocks/activities/now-playing/index.js +5 -3
- package/dist/blocks/activities/weather/index.d.ts +3 -0
- package/dist/blocks/activities/weather/index.js +21 -0
- package/dist/blocks/app/expanded-island/index.d.ts +1 -1
- package/dist/blocks/app/expanded-island/index.js +4 -3
- package/dist/blocks/app/settings-window/index.d.ts +1 -1
- package/dist/blocks/app/settings-window/index.js +1 -1
- package/dist/blocks/system/clipboard/index.d.ts +3 -0
- package/dist/blocks/system/clipboard/index.js +17 -0
- package/dist/blocks/system/recent-files/index.d.ts +3 -0
- package/dist/blocks/system/recent-files/index.js +19 -0
- package/dist/blocks/system/system-stats/index.d.ts +3 -2
- package/dist/blocks/system/system-stats/index.js +4 -1
- package/dist/components/indicators/media-scrubber/index.d.ts +1 -1
- package/dist/components/indicators/media-scrubber/index.js +1 -1
- package/dist/components/island/island/index.d.ts +1 -1
- package/dist/components/island/island/index.js +2 -2
- package/dist/components/island/island-flash/index.d.ts +1 -1
- package/dist/components/island/island-flash/index.js +1 -1
- package/dist/components/island/island-tabs/index.js +2 -2
- package/dist/components/island/widget/index.d.ts +2 -0
- package/dist/components/island/widget/index.js +32 -0
- package/dist/index.d.ts +15 -15
- package/dist/index.js +104 -58
- package/dist/lib/artwork.d.ts +2 -0
- package/dist/lib/artwork.js +8 -0
- package/dist/lib/geometry.js +1 -1
- package/dist/shared/{chunk-yngkkxz2.d.ts → chunk-0ym9mcqc.d.ts} +10 -6
- package/dist/shared/chunk-2b6gpn8k.js +444 -0
- package/dist/shared/chunk-3hcnf4yx.js +481 -0
- package/dist/shared/chunk-42wab62s.d.ts +197 -0
- package/dist/shared/{chunk-zvh0d3qb.js → chunk-61t2dfte.js} +1 -1
- package/dist/shared/{chunk-9nhpg9t8.d.ts → chunk-6tnq6p89.d.ts} +9 -1
- package/dist/shared/{chunk-hpsabfsd.d.ts → chunk-81fpptwp.d.ts} +1 -1
- package/dist/shared/chunk-93dtpjz7.js +789 -0
- package/dist/shared/{chunk-wwjxs75m.js → chunk-9xtcv3sy.js} +26 -12
- package/dist/shared/chunk-a6njb8db.d.ts +129 -0
- package/dist/shared/chunk-ab8mdg0n.d.ts +149 -0
- package/dist/shared/chunk-evqpf92s.d.ts +168 -0
- package/dist/shared/{chunk-6c1jbefs.d.ts → chunk-fexwzycv.d.ts} +3 -3
- package/dist/shared/chunk-gcyspvgr.js +582 -0
- package/dist/shared/chunk-gejenfap.d.ts +25 -0
- package/dist/shared/chunk-gkj0hjrn.d.ts +136 -0
- package/dist/shared/{chunk-rr5e0g15.d.ts → chunk-j755a1a5.d.ts} +7 -1
- package/dist/shared/chunk-n739am8j.d.ts +112 -0
- package/dist/shared/{chunk-78w7qwp0.js → chunk-ndf79pv5.js} +1 -1
- package/dist/shared/chunk-nwzpekvy.js +774 -0
- package/dist/shared/{chunk-rpfwv3pz.js → chunk-r471sknr.js} +1 -1
- package/dist/shared/chunk-sbrtesdg.d.ts +138 -0
- package/dist/shared/chunk-swc7dqpw.d.ts +115 -0
- package/dist/shared/chunk-t9wqhgzt.js +765 -0
- package/dist/shared/chunk-w5h6ay93.js +72 -0
- package/dist/shared/{chunk-mp1nx0ez.js → chunk-wayv5rhr.js} +15 -4
- package/dist/shared/chunk-wf0jtzhs.js +295 -0
- package/dist/shared/{chunk-sbnrhy5m.js → chunk-y0188bbn.js} +2 -2
- package/dist/shared/chunk-yq5svpk7.js +524 -0
- package/dist/shared/{chunk-s33y1pcq.js → chunk-z3tj1ydg.js} +23 -10
- package/dist/styles.css +151 -49
- package/index.ts +7 -6
- package/lib/artwork.ts +112 -0
- package/lib/geometry.ts +1 -1
- package/mock/activities.tsx +9 -32
- package/mock/artwork.tsx +13 -1
- package/mock/clipboard.tsx +113 -0
- package/mock/clock.tsx +77 -0
- package/mock/data.ts +78 -44
- package/mock/files.tsx +83 -0
- package/mock/island-content.tsx +79 -122
- package/mock/screen.tsx +76 -0
- package/mock/settings.tsx +370 -91
- package/mock/system.ts +49 -0
- package/mock/weather.tsx +135 -0
- package/package.json +7 -2
- package/blocks/activities/shelf/examples.mdx +0 -33
- package/blocks/activities/shelf/index.tsx +0 -289
- package/blocks/activities/timer/examples.mdx +0 -52
- package/blocks/activities/timer/index.tsx +0 -292
- package/blocks/system/controls/examples.mdx +0 -34
- package/blocks/system/controls/index.tsx +0 -167
- package/blocks/system/devices/examples.mdx +0 -25
- package/blocks/system/devices/index.tsx +0 -172
- package/blocks/system/power-alert/examples.mdx +0 -32
- package/blocks/system/power-alert/index.tsx +0 -89
- package/components/indicators/battery-glyph/examples.mdx +0 -22
- package/components/indicators/battery-glyph/index.tsx +0 -91
- package/dist/blocks/activities/shelf/index.d.ts +0 -2
- package/dist/blocks/activities/shelf/index.js +0 -14
- package/dist/blocks/activities/timer/index.d.ts +0 -2
- package/dist/blocks/activities/timer/index.js +0 -19
- package/dist/blocks/system/controls/index.d.ts +0 -2
- package/dist/blocks/system/controls/index.js +0 -10
- package/dist/blocks/system/devices/index.d.ts +0 -2
- package/dist/blocks/system/devices/index.js +0 -12
- package/dist/blocks/system/power-alert/index.d.ts +0 -2
- package/dist/blocks/system/power-alert/index.js +0 -9
- package/dist/components/indicators/battery-glyph/index.d.ts +0 -2
- package/dist/components/indicators/battery-glyph/index.js +0 -9
- package/dist/shared/chunk-2qpcsv5h.d.ts +0 -45
- package/dist/shared/chunk-45gytfr1.d.ts +0 -84
- package/dist/shared/chunk-50ffk4r7.d.ts +0 -69
- package/dist/shared/chunk-5w0yck07.d.ts +0 -32
- package/dist/shared/chunk-7hr53mby.js +0 -116
- package/dist/shared/chunk-b8jb1w72.js +0 -145
- package/dist/shared/chunk-cpewy6yg.js +0 -178
- package/dist/shared/chunk-e3e4s4ds.d.ts +0 -77
- package/dist/shared/chunk-enm6td0p.js +0 -280
- package/dist/shared/chunk-fvedaas2.d.ts +0 -33
- package/dist/shared/chunk-gex38j8x.d.ts +0 -82
- package/dist/shared/chunk-hwtxpzg0.js +0 -69
- package/dist/shared/chunk-phb53x1f.js +0 -252
- package/dist/shared/chunk-r8esmjfs.d.ts +0 -42
- package/dist/shared/chunk-rcp1g9ca.js +0 -70
- package/dist/shared/chunk-rx9sphz2.js +0 -266
- package/dist/shared/chunk-xdeek16r.d.ts +0 -58
- package/dist/shared/chunk-xkzjk1tq.js +0 -206
|
@@ -27,6 +27,8 @@ interface MediaScrubberProps {
|
|
|
27
27
|
label?: string
|
|
28
28
|
/** No seeking. Defaults to `false`. */
|
|
29
29
|
disabled?: boolean
|
|
30
|
+
/** At rest a thin line of progress; the scrubber fades in on hover and focus, and always shows on touch. Defaults to `false`. */
|
|
31
|
+
quiet?: boolean
|
|
30
32
|
/** Classes for the row. */
|
|
31
33
|
className?: string
|
|
32
34
|
}
|
|
@@ -41,6 +43,10 @@ interface MediaScrubberProps {
|
|
|
41
43
|
* press ends, and playback runs on from the seek until the player reports
|
|
42
44
|
* its next `position`, so the thumb never jumps back to the stale one.
|
|
43
45
|
*
|
|
46
|
+
* `quiet` is the player's form: at rest a thin line of progress, so the
|
|
47
|
+
* track reads before the control; the scrubber fades in on hover or focus,
|
|
48
|
+
* and always shows on touch.
|
|
49
|
+
*
|
|
44
50
|
* @example {@include ./examples.mdx}
|
|
45
51
|
*/
|
|
46
52
|
export default function MediaScrubber({
|
|
@@ -51,6 +57,7 @@ export default function MediaScrubber({
|
|
|
51
57
|
size = 'compact',
|
|
52
58
|
label = 'Position',
|
|
53
59
|
disabled = false,
|
|
60
|
+
quiet = false,
|
|
54
61
|
className,
|
|
55
62
|
}: MediaScrubberProps) {
|
|
56
63
|
// Where it runs on from: the last position the player reported, or the last seek.
|
|
@@ -74,19 +81,36 @@ export default function MediaScrubber({
|
|
|
74
81
|
// biome-ignore lint/a11y/noStaticElementInteractions: commits the Slider's drag or key press when it ends
|
|
75
82
|
<div className={cn('flex items-center gap-3', className)} onPointerUp={commit} onKeyUp={commit}>
|
|
76
83
|
<span className="w-9 shrink-0 text-micro tabular-nums text-muted-foreground">{formatClock(value)}</span>
|
|
77
|
-
<
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
<span className="group/scrub relative flex min-w-0 flex-1 items-center">
|
|
85
|
+
<Slider
|
|
86
|
+
className={cn(
|
|
87
|
+
'mb-0 min-w-0 flex-1',
|
|
88
|
+
quiet &&
|
|
89
|
+
'opacity-0 transition-[opacity] duration-fast group-hover/scrub:opacity-100 group-focus-within/scrub:opacity-100 pointer-coarse:opacity-100',
|
|
90
|
+
)}
|
|
91
|
+
size={size}
|
|
92
|
+
label={label}
|
|
93
|
+
showValue={false}
|
|
94
|
+
formatValue={formatClock}
|
|
95
|
+
min={0}
|
|
96
|
+
max={Math.max(1, duration)}
|
|
97
|
+
step={1}
|
|
98
|
+
value={value}
|
|
99
|
+
disabled={disabled}
|
|
100
|
+
onValueChange={v => setDragged(v as number)}
|
|
101
|
+
/>
|
|
102
|
+
{quiet && (
|
|
103
|
+
<span
|
|
104
|
+
aria-hidden
|
|
105
|
+
className="pointer-events-none absolute inset-x-0 h-1 overflow-hidden rounded-full bg-active transition-[opacity] duration-fast group-hover/scrub:opacity-0 group-focus-within/scrub:opacity-0 pointer-coarse:opacity-0"
|
|
106
|
+
>
|
|
107
|
+
<span
|
|
108
|
+
className="block size-full rounded-full bg-foreground"
|
|
109
|
+
style={{ transform: `translateX(${(value / Math.max(1, duration) - 1) * 100}%)` }}
|
|
110
|
+
/>
|
|
111
|
+
</span>
|
|
112
|
+
)}
|
|
113
|
+
</span>
|
|
90
114
|
<span className="w-9 shrink-0 text-right text-micro tabular-nums text-muted-foreground">
|
|
91
115
|
-{formatClock(Math.max(0, duration - value))}
|
|
92
116
|
</span>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Island from './index'
|
|
2
|
-
import { ArtworkTile,
|
|
2
|
+
import { ArtworkTile, DemoIsland, DownloadedFlash, ExpandedPanel, IslandPlayground, PomodoroBubble, ScreenEdge } from '../../../mock/island-content'
|
|
3
3
|
import Equalizer from '../../indicators/equalizer'
|
|
4
4
|
|
|
5
5
|
# States
|
|
@@ -29,7 +29,7 @@ An activity in the wings: its glyph on the left, its live value on the right.
|
|
|
29
29
|
A second activity in a bubble off the right end; it melts off and back through the goo.
|
|
30
30
|
|
|
31
31
|
<ScreenEdge height={64}>
|
|
32
|
-
<Island defaultState="split" leading={<ArtworkTile />} trailing={<Equalizer />} minimal={<
|
|
32
|
+
<Island defaultState="split" leading={<ArtworkTile />} trailing={<Equalizer />} minimal={<PomodoroBubble />} />
|
|
33
33
|
</ScreenEdge>
|
|
34
34
|
|
|
35
35
|
# Flash
|
|
@@ -37,14 +37,14 @@ A second activity in a bubble off the right end; it melts off and back through t
|
|
|
37
37
|
A moment's alert below the notch.
|
|
38
38
|
|
|
39
39
|
<ScreenEdge height={112}>
|
|
40
|
-
<Island defaultState="flash" flash={<
|
|
40
|
+
<Island defaultState="flash" flash={<DownloadedFlash />} />
|
|
41
41
|
</ScreenEdge>
|
|
42
42
|
|
|
43
43
|
# Expanded
|
|
44
44
|
|
|
45
45
|
The open panel: tabs in the wings around the notch, the tab's title and its widget.
|
|
46
46
|
|
|
47
|
-
<ScreenEdge height={
|
|
47
|
+
<ScreenEdge height={260}>
|
|
48
48
|
<Island defaultState="expanded" collapsedState="compact" leading={<ArtworkTile />} trailing={<Equalizer />} expanded={<ExpandedPanel />} />
|
|
49
49
|
</ScreenEdge>
|
|
50
50
|
|
|
@@ -63,7 +63,7 @@ interface IslandProps {
|
|
|
63
63
|
notchHeight?: number
|
|
64
64
|
/** The open island's width in px; it shrinks to the room it has. Defaults to `720`. */
|
|
65
65
|
panelWidth?: number
|
|
66
|
-
/** The open island's height in px. Defaults to `
|
|
66
|
+
/** The open island's height in px. Defaults to `240`. */
|
|
67
67
|
panelHeight?: number
|
|
68
68
|
/** The compact left wing: the activity's glyph (`compact` and `split`). */
|
|
69
69
|
leading?: ReactNode
|
|
@@ -157,7 +157,7 @@ export default function Island({
|
|
|
157
157
|
notchWidth = 185,
|
|
158
158
|
notchHeight = 32,
|
|
159
159
|
panelWidth = 720,
|
|
160
|
-
panelHeight =
|
|
160
|
+
panelHeight = 240,
|
|
161
161
|
leading,
|
|
162
162
|
trailing,
|
|
163
163
|
minimal,
|
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
import IslandFlash from './index'
|
|
2
|
-
import BatteryGlyph from '../../indicators/battery-glyph'
|
|
3
2
|
import Equalizer from '../../indicators/equalizer'
|
|
4
3
|
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
5
|
-
import {
|
|
4
|
+
import { ClipboardCheck, CloudRain, Music, Target } from 'lucide-react'
|
|
6
5
|
|
|
7
|
-
#
|
|
6
|
+
# Focus done
|
|
8
7
|
|
|
9
8
|
The icon and the figure take the tone's hue.
|
|
10
9
|
|
|
11
10
|
<div className="dark w-full max-w-md rounded-box bg-ink px-5 py-4 text-foreground">
|
|
12
11
|
<IslandFlash
|
|
13
|
-
icon={<
|
|
12
|
+
icon={<Target size={18} strokeWidth={1.5} />}
|
|
14
13
|
tone="success"
|
|
15
|
-
title="
|
|
16
|
-
caption="
|
|
17
|
-
value="
|
|
18
|
-
trailing={<BatteryGlyph level={82} charging />}
|
|
14
|
+
title="Focus done"
|
|
15
|
+
caption="Round 2 of 4 · a short break next"
|
|
16
|
+
value="5 min"
|
|
19
17
|
/>
|
|
20
18
|
</div>
|
|
21
19
|
|
|
22
|
-
#
|
|
20
|
+
# Rain soon
|
|
23
21
|
|
|
24
22
|
<div className="dark w-full max-w-md rounded-box bg-ink px-5 py-4 text-foreground">
|
|
25
23
|
<IslandFlash
|
|
26
|
-
icon={<
|
|
24
|
+
icon={<CloudRain size={18} strokeWidth={1.5} />}
|
|
27
25
|
tone="warning"
|
|
28
|
-
title="
|
|
29
|
-
caption="
|
|
30
|
-
value="
|
|
31
|
-
trailing={<BatteryGlyph level={18} />}
|
|
26
|
+
title="Rain soon"
|
|
27
|
+
caption="Light rain for about an hour"
|
|
28
|
+
value="15 min"
|
|
32
29
|
/>
|
|
33
30
|
</div>
|
|
34
31
|
|
|
@@ -36,10 +33,10 @@ The icon and the figure take the tone's hue.
|
|
|
36
33
|
|
|
37
34
|
<div className="dark w-full max-w-md rounded-box bg-ink px-5 py-4 text-foreground">
|
|
38
35
|
<IslandFlash
|
|
39
|
-
icon={<
|
|
40
|
-
title="
|
|
41
|
-
caption="
|
|
42
|
-
action={<Button variant="ghost" size="compact">
|
|
36
|
+
icon={<ClipboardCheck size={18} strokeWidth={1.5} />}
|
|
37
|
+
title="Copied"
|
|
38
|
+
caption="bun run build && bun run check"
|
|
39
|
+
action={<Button variant="ghost" size="compact">Pin</Button>}
|
|
43
40
|
/>
|
|
44
41
|
</div>
|
|
45
42
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
2
|
* Local addition: the layout of a notch app's transient alert, the island's
|
|
3
3
|
* `flash` content. Generalised from Just Notch's power, HUD and now-playing
|
|
4
|
-
* flashes.
|
|
4
|
+
* flashes; the kit's blocks build their own on it.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import { cn } from '@justanarthur/modo-ui/lib/utils'
|
|
@@ -27,9 +27,9 @@ interface IslandFlashProps {
|
|
|
27
27
|
icon?: ReactNode
|
|
28
28
|
/** The hue of the icon and the `value`. Defaults to `'default'`. */
|
|
29
29
|
tone?: IslandFlashTone
|
|
30
|
-
/** A figure at the end, in the tone's hue: `
|
|
30
|
+
/** A figure at the end, in the tone's hue: `15 min`, a level. */
|
|
31
31
|
value?: ReactNode
|
|
32
|
-
/** Content after it, such as
|
|
32
|
+
/** Content after it, such as an Equalizer. */
|
|
33
33
|
trailing?: ReactNode
|
|
34
34
|
/** One control at the far end, such as a ghost Button. */
|
|
35
35
|
action?: ReactNode
|
|
@@ -44,7 +44,7 @@ interface IslandFlashProps {
|
|
|
44
44
|
* It lays out one row the height of the island's flash: the icon in a fixed
|
|
45
45
|
* square, the title and caption truncating beside it, then the `value`, any
|
|
46
46
|
* `trailing` glyph and an `action`. The icon and the value take the tone's
|
|
47
|
-
* status hue (a
|
|
47
|
+
* status hue (a focus round done in success, rain coming in warning); everything else
|
|
48
48
|
* keeps the two text colors. Pass it as the Island's `flash`.
|
|
49
49
|
*
|
|
50
50
|
* @example {@include ./examples.mdx}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import IslandTabs from './index'
|
|
2
2
|
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
3
|
-
import { CalendarDays, Music, Settings
|
|
3
|
+
import { CalendarDays, CloudSun, Music, Settings } from 'lucide-react'
|
|
4
4
|
import { TABS } from '../../../mock/data'
|
|
5
5
|
import { Fit } from '../../../mock/island-content'
|
|
6
6
|
|
|
7
7
|
# Both wings
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Seven tabs balance across the wings, the left one taking the odd one; the pill melts across the gap.
|
|
10
10
|
|
|
11
11
|
<Fit width={720}>
|
|
12
12
|
<div className="dark w-full rounded-box bg-ink px-5 text-foreground">
|
|
@@ -22,11 +22,11 @@ Three tabs balance too, the left wing taking the odd one.
|
|
|
22
22
|
<div className="dark w-full rounded-box bg-ink px-5 text-foreground">
|
|
23
23
|
<IslandTabs
|
|
24
24
|
size="compact"
|
|
25
|
-
defaultValue="
|
|
25
|
+
defaultValue="calendar"
|
|
26
26
|
tabs={[
|
|
27
27
|
{ value: 'now-playing', label: 'Now Playing', icon: Music },
|
|
28
|
-
{ value: 'timer', label: 'Timer', icon: Timer },
|
|
29
28
|
{ value: 'calendar', label: 'Calendar', icon: CalendarDays },
|
|
29
|
+
{ value: 'weather', label: 'Weather', icon: CloudSun },
|
|
30
30
|
]}
|
|
31
31
|
/>
|
|
32
32
|
</div>
|
|
@@ -48,6 +48,6 @@ The default step: 36px tabs for a roomier panel.
|
|
|
48
48
|
|
|
49
49
|
<Fit width={720}>
|
|
50
50
|
<div className="dark w-full rounded-box bg-ink px-5 text-foreground">
|
|
51
|
-
<IslandTabs tabs={TABS} defaultValue="
|
|
51
|
+
<IslandTabs tabs={TABS} defaultValue="system" />
|
|
52
52
|
</div>
|
|
53
53
|
</Fit>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import Widget from './index'
|
|
2
|
+
import Button from '@justanarthur/modo-ui/components/actions/button'
|
|
3
|
+
import { WidgetIsland } from '../../../mock/island-content'
|
|
4
|
+
import { BatteryCharging, Bell, CalendarDays, Clock, MapPin, Pause, Play, Plug, Sparkles, Zap } from 'lucide-react'
|
|
5
|
+
|
|
6
|
+
# Anatomy
|
|
7
|
+
|
|
8
|
+
A context line, the hero (a number on the display role, a name on the title role), its supporting facts, quiet actions, and a supporting column past the hairline.
|
|
9
|
+
|
|
10
|
+
<WidgetIsland tab="system">
|
|
11
|
+
<Widget
|
|
12
|
+
aside={
|
|
13
|
+
<Widget.Section label="Recent">
|
|
14
|
+
<Widget.Row leading="9:12" color="var(--badge-green)">Plugged in at 41%</Widget.Row>
|
|
15
|
+
<Widget.Row leading="8:03" color="var(--badge-amber)" trailing="Low power">Dropped to 20%</Widget.Row>
|
|
16
|
+
<Widget.Row leading="Yesterday">Fully charged</Widget.Row>
|
|
17
|
+
</Widget.Section>
|
|
18
|
+
}
|
|
19
|
+
>
|
|
20
|
+
<Widget.Header icon={BatteryCharging} trailing={<Widget.Action icon={Bell} label="Notify when full" pressed />}>
|
|
21
|
+
MacBook Pro
|
|
22
|
+
</Widget.Header>
|
|
23
|
+
<Widget.Figure value="82" unit="%" color="var(--badge-green)" />
|
|
24
|
+
<Widget.Title>Charging</Widget.Title>
|
|
25
|
+
<Widget.Meta>
|
|
26
|
+
<Widget.MetaItem icon={Clock}>38 min until full</Widget.MetaItem>
|
|
27
|
+
<Widget.MetaItem icon={Plug}>96 W adapter</Widget.MetaItem>
|
|
28
|
+
</Widget.Meta>
|
|
29
|
+
</Widget>
|
|
30
|
+
</WidgetIsland>
|
|
31
|
+
|
|
32
|
+
# Figure
|
|
33
|
+
|
|
34
|
+
`Widget.Figure` sets a number on the display role with its unit (or a word before it) on the title role, digits tabular; `color` takes a data color.
|
|
35
|
+
|
|
36
|
+
<div className="dark flex flex-wrap items-baseline gap-8 rounded-xl bg-ink p-5 text-foreground">
|
|
37
|
+
<Widget.Figure prefix="in" value="12" unit="min" />
|
|
38
|
+
<Widget.Figure value="Now" unit="35 min left" />
|
|
39
|
+
<Widget.Figure value="4:00" unit="PM" />
|
|
40
|
+
<Widget.Figure value="82" unit="%" color="var(--badge-green)" />
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
# Actions
|
|
44
|
+
|
|
45
|
+
`Widget.Action` is a ghost icon button with a tooltip; `pressed` lights a toggle (in a data `color` if given), `emphasis="primary"` is the widget's main action.
|
|
46
|
+
|
|
47
|
+
<div className="dark flex items-center gap-1 rounded-xl bg-ink p-4 text-foreground">
|
|
48
|
+
<Widget.Action icon={Play} label="Play" emphasis="primary" filled />
|
|
49
|
+
<Widget.Action icon={Pause} label="Pause" />
|
|
50
|
+
<Widget.Action icon={Sparkles} label="Enhance" pressed color="var(--badge-violet)" />
|
|
51
|
+
<Widget.Action icon={Zap} label="Low power" disabled />
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
# Rows and chips
|
|
55
|
+
|
|
56
|
+
`Widget.Row` is the island's list row: a muted figure, a color mark, the title and a muted end; `Widget.Chip` a small label one surface up.
|
|
57
|
+
|
|
58
|
+
<div className="dark flex w-full max-w-90 flex-col rounded-xl bg-ink p-4 text-foreground">
|
|
59
|
+
<Widget.Section label="Later today" trailing={<Widget.Chip color="var(--badge-green)">Team offsite</Widget.Chip>}>
|
|
60
|
+
<Widget.Row leading="12:45" color="var(--badge-orange)">Lunch with Ana</Widget.Row>
|
|
61
|
+
<Widget.Row leading="16:00" color="var(--badge-violet)" trailing={<MapPin size={12} strokeWidth={1.5} />}>Ship the island kit</Widget.Row>
|
|
62
|
+
</Widget.Section>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
# Message
|
|
66
|
+
|
|
67
|
+
The empty, permission and error state, across the wide, short island.
|
|
68
|
+
|
|
69
|
+
<WidgetIsland tab="calendar">
|
|
70
|
+
<Widget.Message
|
|
71
|
+
icon={CalendarDays}
|
|
72
|
+
title="See what's next"
|
|
73
|
+
description="Your next event with a countdown, and the rest of today and tomorrow."
|
|
74
|
+
actions={<Button size="compact">Connect calendar</Button>}
|
|
75
|
+
/>
|
|
76
|
+
</WidgetIsland>
|