@whity/ui 0.5.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +107 -107
- package/package.json +221 -192
- package/src/access-denied.stories.tsx +179 -179
- package/src/access-denied.tsx +305 -305
- package/src/action-proposal.tsx +338 -302
- package/src/actor-chip.tsx +71 -71
- package/src/agent-activity.tsx +163 -163
- package/src/agent-collaboration.stories.tsx +156 -156
- package/src/agent-run-status.tsx +196 -196
- package/src/alert-dialog.stories.tsx +45 -45
- package/src/alert-dialog.tsx +147 -147
- package/src/alert.stories.tsx +91 -91
- package/src/alert.tsx +89 -89
- package/src/app-sidebar.stories.tsx +195 -195
- package/src/app-sidebar.tsx +604 -500
- package/src/approval-queue.tsx +109 -108
- package/src/audience-group-picker.stories.tsx +198 -198
- package/src/audience-group-picker.tsx +362 -362
- package/src/audience-people-picker.stories.tsx +102 -102
- package/src/audience-people-picker.tsx +279 -279
- package/src/avatar-pattern.ts +138 -0
- package/src/avatar.tsx +125 -83
- package/src/badge.stories.tsx +105 -105
- package/src/badge.tsx +68 -68
- package/src/beta-warning.stories.tsx +79 -79
- package/src/beta-warning.tsx +189 -189
- package/src/bilingual-input.stories.tsx +82 -82
- package/src/bilingual-input.tsx +188 -183
- package/src/board.tsx +216 -0
- package/src/breadcrumb.stories.tsx +51 -51
- package/src/breadcrumb.tsx +90 -90
- package/src/built-on-whity.tsx +52 -0
- package/src/button.stories.tsx +87 -87
- package/src/button.tsx +123 -118
- package/src/card.stories.tsx +423 -423
- package/src/card.tsx +180 -180
- package/src/chart.stories.tsx +66 -66
- package/src/chart.tsx +228 -228
- package/src/checkbox.stories.tsx +62 -62
- package/src/checkbox.tsx +54 -54
- package/src/collapsible.stories.tsx +48 -48
- package/src/collapsible.tsx +34 -34
- package/src/color-card.stories.tsx +61 -61
- package/src/color-card.tsx +270 -270
- package/src/color-picker.stories.tsx +65 -65
- package/src/color-picker.tsx +425 -425
- package/src/column-matcher.tsx +84 -0
- package/src/command-palette.tsx +398 -306
- package/src/confirm-action.tsx +98 -0
- package/src/copy-block.stories.tsx +38 -38
- package/src/copy-block.tsx +85 -85
- package/src/data-table.stories.tsx +200 -200
- package/src/data-table.tsx +1686 -1106
- package/src/date-picker.stories.tsx +61 -61
- package/src/date-picker.tsx +456 -422
- package/src/design-cards.stories.tsx +551 -458
- package/src/dialog.stories.tsx +48 -48
- package/src/dialog.tsx +179 -166
- package/src/display-preferences.tsx +50 -0
- package/src/documents/barcode-svg.stories.tsx +72 -72
- package/src/documents/barcode-svg.tsx +79 -79
- package/src/dropdown-menu.stories.tsx +77 -77
- package/src/dropdown-menu.tsx +271 -271
- package/src/editor/agent-panel.tsx +222 -0
- package/src/editor/agents.stories.tsx +81 -0
- package/src/editor/agents.ts +55 -0
- package/src/editor/behaviour.ts +279 -279
- package/src/editor/block-ids.ts +44 -44
- package/src/editor/block-list.tsx +104 -101
- package/src/editor/block-toolbar.tsx +490 -477
- package/src/editor/bubble.tsx +119 -93
- package/src/editor/catalogue.ts +169 -103
- package/src/editor/collab-rail.tsx +746 -746
- package/src/editor/collab.stories.tsx +207 -207
- package/src/editor/collab.ts +87 -87
- package/src/editor/contract.ts +476 -408
- package/src/editor/convert.ts +414 -362
- package/src/editor/doc-editor.stories.tsx +98 -98
- package/src/editor/doc-editor.tsx +1492 -1287
- package/src/editor/editor.css +636 -536
- package/src/editor/extensions.ts +86 -86
- package/src/editor/field-bar.tsx +154 -0
- package/src/editor/field-picker.tsx +109 -107
- package/src/editor/fields.ts +100 -100
- package/src/editor/gutter.tsx +443 -367
- package/src/editor/index.ts +23 -22
- package/src/editor/label-sheet.tsx +289 -289
- package/src/editor/labels.ts +394 -310
- package/src/editor/link-tools.tsx +141 -141
- package/src/editor/node-views.tsx +461 -450
- package/src/editor/page-view.tsx +372 -353
- package/src/editor/phone.tsx +310 -0
- package/src/editor/plugin-block-view.tsx +230 -0
- package/src/editor/plugin-blocks.stories.tsx +96 -0
- package/src/editor/plugin-blocks.ts +52 -0
- package/src/editor/publish-check.tsx +201 -182
- package/src/editor/rich-blocks.stories.tsx +146 -146
- package/src/editor/sample.ts +40 -40
- package/src/editor/save-block-dialog.tsx +141 -0
- package/src/editor/saved-block-view.tsx +205 -0
- package/src/editor/saved-blocks.stories.tsx +105 -0
- package/src/editor/saved-parts.ts +192 -0
- package/src/editor/schema-rich.ts +156 -150
- package/src/editor/schema.ts +368 -315
- package/src/editor/services.tsx +205 -127
- package/src/editor/slash.ts +64 -64
- package/src/editor/suggesting.ts +372 -372
- package/src/editor/suggestions.ts +763 -763
- package/src/editor/table-keys.ts +66 -66
- package/src/editor/templates.stories.tsx +324 -324
- package/src/editor/toolbar.tsx +364 -358
- package/src/empty-state.stories.tsx +51 -51
- package/src/empty-state.tsx +126 -100
- package/src/empty-state.usage-notes.md +30 -30
- package/src/form.stories.tsx +112 -112
- package/src/form.tsx +176 -176
- package/src/globals.css +20 -20
- package/src/icon-button.tsx +85 -85
- package/src/icon-map.ts +335 -244
- package/src/icon.tsx +41 -41
- package/src/index.ts +90 -67
- package/src/input.stories.tsx +157 -157
- package/src/input.tsx +768 -759
- package/src/kpi-strip.tsx +47 -0
- package/src/localized-text.ts +76 -0
- package/src/locked-screen.stories.tsx +29 -29
- package/src/locked-screen.tsx +75 -61
- package/src/lockup.tsx +42 -0
- package/src/lottie.tsx +441 -0
- package/src/mark.tsx +62 -62
- package/src/math-text.stories.tsx +33 -33
- package/src/math-text.tsx +43 -43
- package/src/menu-bar.stories.tsx +198 -198
- package/src/menu-bar.tsx +373 -373
- package/src/message-thread.tsx +181 -0
- package/src/money/currency.ts +244 -230
- package/src/money/money-input.tsx +131 -0
- package/src/money/money.tsx +33 -0
- package/src/open-on-computer.tsx +150 -0
- package/src/otp-input.tsx +161 -0
- package/src/page-header.stories.tsx +95 -95
- package/src/page-header.tsx +122 -122
- package/src/page-shell.stories.tsx +42 -42
- package/src/page-shell.tsx +32 -32
- package/src/page-states.tsx +277 -0
- package/src/pagination.stories.tsx +45 -45
- package/src/pagination.tsx +98 -98
- package/src/paper-sheet.stories.tsx +88 -0
- package/src/paper-sheet.tsx +85 -0
- package/src/phone-tab-bar.tsx +152 -0
- package/src/plugin-card.stories.tsx +208 -180
- package/src/plugin-card.tsx +931 -848
- package/src/popover.stories.tsx +48 -48
- package/src/popover.tsx +55 -55
- package/src/radio-group.stories.tsx +26 -26
- package/src/radio-group.tsx +44 -44
- package/src/route-flow/editor.tsx +1087 -1014
- package/src/route-flow/model.ts +771 -716
- package/src/save-bar.tsx +94 -0
- package/src/scope-grant.tsx +139 -139
- package/src/screen-too-small.stories.tsx +61 -61
- package/src/screen-too-small.tsx +104 -104
- package/src/search-field.tsx +65 -0
- package/src/select.stories.tsx +44 -44
- package/src/select.tsx +197 -197
- package/src/separator.stories.tsx +34 -34
- package/src/separator.tsx +34 -34
- package/src/sheet.stories.tsx +49 -49
- package/src/sheet.tsx +168 -168
- package/src/skeleton.stories.tsx +28 -28
- package/src/skeleton.tsx +19 -19
- package/src/slider.stories.tsx +78 -78
- package/src/slider.tsx +300 -300
- package/src/spinner.stories.tsx +33 -33
- package/src/spinner.tsx +55 -55
- package/src/stepper.tsx +85 -0
- package/src/switch.stories.tsx +42 -42
- package/src/switch.tsx +41 -41
- package/src/switcher.stories.tsx +111 -111
- package/src/switcher.tsx +131 -131
- package/src/system-state.tsx +55 -0
- package/src/table.stories.tsx +48 -48
- package/src/table.tsx +121 -121
- package/src/tabs.stories.tsx +74 -74
- package/src/tabs.tsx +90 -90
- package/src/tag-input.stories.tsx +67 -67
- package/src/tag-input.tsx +117 -117
- package/src/tenant-logo.tsx +63 -63
- package/src/tenant-switcher.stories.tsx +38 -38
- package/src/tenant-switcher.tsx +164 -164
- package/src/textarea.stories.tsx +27 -27
- package/src/textarea.tsx +18 -18
- package/src/theme-mode.ts +52 -52
- package/src/time-grid.tsx +163 -0
- package/src/time-picker.stories.tsx +62 -62
- package/src/time-picker.tsx +615 -615
- package/src/toggle-group.tsx +138 -138
- package/src/tooltip.stories.tsx +43 -43
- package/src/tooltip.tsx +73 -73
- package/src/top-nav.stories.tsx +58 -58
- package/src/top-nav.tsx +324 -324
- package/src/undo-bar.tsx +107 -107
- package/src/utils.ts +45 -45
- package/src/view-toggle.stories.tsx +84 -84
- package/src/view-toggle.tsx +110 -110
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { cn } from "./utils"
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* A row of headline numbers (docs/design/components/TplReports, TplImport;
|
|
5
|
+
* `.wk-kpis`, `.wk-kpi` in bundle.css), for Reports, Import and Bank. Values
|
|
6
|
+
* are mono and stay left to right; money comes already formatted in normal
|
|
7
|
+
* units with the currency's decimals ("$31,880.00").
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export interface KpiItem {
|
|
11
|
+
label: string
|
|
12
|
+
value: string
|
|
13
|
+
/** The comparison or what the number means ("+12% on September", "At cost"). */
|
|
14
|
+
note?: string
|
|
15
|
+
/** Colours the note: good green, bad red. Never the only signal: the note says it. */
|
|
16
|
+
tone?: "good" | "bad"
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
function KpiStrip({ items, className }: { items: KpiItem[]; className?: string }) {
|
|
20
|
+
return (
|
|
21
|
+
<dl
|
|
22
|
+
data-slot="kpi-strip"
|
|
23
|
+
className={cn("m-0 grid grid-cols-[repeat(auto-fit,minmax(180px,1fr))] gap-3", className)}
|
|
24
|
+
>
|
|
25
|
+
{items.map((item) => (
|
|
26
|
+
<div key={item.label} className="grid gap-1 rounded-card border border-border bg-card px-4 py-3.5">
|
|
27
|
+
<dt className="text-xs text-muted-foreground">{item.label}</dt>
|
|
28
|
+
<dd className="m-0 font-mono text-[1.375rem] font-medium tabular-nums" dir="ltr">
|
|
29
|
+
{item.value}
|
|
30
|
+
</dd>
|
|
31
|
+
{item.note && (
|
|
32
|
+
<dd
|
|
33
|
+
className={cn(
|
|
34
|
+
"m-0 text-xs",
|
|
35
|
+
item.tone === "good" ? "text-success-text" : item.tone === "bad" ? "text-destructive" : "text-muted-foreground"
|
|
36
|
+
)}
|
|
37
|
+
>
|
|
38
|
+
{item.note}
|
|
39
|
+
</dd>
|
|
40
|
+
)}
|
|
41
|
+
</div>
|
|
42
|
+
))}
|
|
43
|
+
</dl>
|
|
44
|
+
)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { KpiStrip }
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text people write in more than one language: one object of language code to
|
|
3
|
+
* text, such as `{ ar: "مجلس المعايير", en: "Standards Board" }` (WHIT-1038).
|
|
4
|
+
*
|
|
5
|
+
* The TypeScript twin of `Whity\Core\i18n\LocalizedText`. The server sends the
|
|
6
|
+
* whole object; the page picks for its reader with {@link localizedText}, by
|
|
7
|
+
* the same rule the server uses when it can show only one string:
|
|
8
|
+
*
|
|
9
|
+
* 1. the reader's language;
|
|
10
|
+
* 2. the text's original language, when it has one (a workspace or unit name:
|
|
11
|
+
* for many institutions the Arabic name is the legal one, so English is
|
|
12
|
+
* never assumed to be the original);
|
|
13
|
+
* 3. English, then Arabic;
|
|
14
|
+
* 4. any language that has text;
|
|
15
|
+
* 5. `fallback`, or "".
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
/** A language => text map, as the API sends it. Missing or blank languages are allowed. */
|
|
19
|
+
export type LocalizedText = Record<string, string | undefined>
|
|
20
|
+
|
|
21
|
+
/** What the readers below accept: a map whose languages may also be null. */
|
|
22
|
+
type LocalizedTextInput = Readonly<Record<string, string | null | undefined>>
|
|
23
|
+
|
|
24
|
+
/** Arabic and English: the two languages a bilingual field offers. */
|
|
25
|
+
export const BILINGUAL = ["ar", "en"] as const
|
|
26
|
+
export type BilingualLanguage = (typeof BILINGUAL)[number]
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* One string for a reader of `language`, by the rule above. A plain string is
|
|
30
|
+
* returned trimmed; `[]` (how PHP encodes an empty map) and null read as empty.
|
|
31
|
+
*/
|
|
32
|
+
export function localizedText(
|
|
33
|
+
text: LocalizedTextInput | string | readonly unknown[] | null | undefined,
|
|
34
|
+
language?: string | null,
|
|
35
|
+
originalLanguage?: string | null,
|
|
36
|
+
fallback = ""
|
|
37
|
+
): string {
|
|
38
|
+
if (typeof text === "string") return text.trim() !== "" ? text.trim() : fallback
|
|
39
|
+
if (text === null || text === undefined || Array.isArray(text)) return fallback
|
|
40
|
+
|
|
41
|
+
const map = text as LocalizedTextInput
|
|
42
|
+
for (const code of [language, originalLanguage, "en", "ar"]) {
|
|
43
|
+
if (!code) continue
|
|
44
|
+
const value = map[code]
|
|
45
|
+
if (typeof value === "string" && value.trim() !== "") return value.trim()
|
|
46
|
+
}
|
|
47
|
+
for (const value of Object.values(map)) {
|
|
48
|
+
if (typeof value === "string" && value.trim() !== "") return value.trim()
|
|
49
|
+
}
|
|
50
|
+
return fallback
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Trimmed, with blank languages left out: what the API stores. */
|
|
54
|
+
export function cleanLocalizedText(text: LocalizedTextInput): Record<string, string> {
|
|
55
|
+
const out: Record<string, string> = {}
|
|
56
|
+
for (const [code, value] of Object.entries(text)) {
|
|
57
|
+
if (typeof value === "string" && value.trim() !== "") out[code] = value.trim()
|
|
58
|
+
}
|
|
59
|
+
return out
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Whether two maps say the same thing once blanks are ignored. */
|
|
63
|
+
export function sameLocalizedText(a: LocalizedTextInput, b: LocalizedTextInput): boolean {
|
|
64
|
+
const left = cleanLocalizedText(a)
|
|
65
|
+
const right = cleanLocalizedText(b)
|
|
66
|
+
const keys = new Set([...Object.keys(left), ...Object.keys(right)])
|
|
67
|
+
for (const key of keys) {
|
|
68
|
+
if (left[key] !== right[key]) return false
|
|
69
|
+
}
|
|
70
|
+
return true
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/** The language of a text typed without one: Arabic letters mean Arabic. */
|
|
74
|
+
export function guessLanguage(text: string): BilingualLanguage {
|
|
75
|
+
return /[-ۿݐ-ݿࢠ-ࣿ]/.test(text) ? "ar" : "en"
|
|
76
|
+
}
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
|
-
|
|
3
|
-
import { Button } from "./button"
|
|
4
|
-
import { LockedScreen } from "./locked-screen"
|
|
5
|
-
|
|
6
|
-
const meta = {
|
|
7
|
-
title: "Primitives/LockedScreen",
|
|
8
|
-
component: LockedScreen,
|
|
9
|
-
tags: ["autodocs"],
|
|
10
|
-
parameters: { layout: "padded" },
|
|
11
|
-
} satisfies Meta<typeof LockedScreen>
|
|
12
|
-
|
|
13
|
-
export default meta
|
|
14
|
-
type Story = StoryObj<typeof meta>
|
|
15
|
-
|
|
16
|
-
export const Default: Story = {
|
|
17
|
-
args: {
|
|
18
|
-
description:
|
|
19
|
-
"Your offline session has expired. Reconnect and sign in again to keep working.",
|
|
20
|
-
},
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const WithReloginAction: Story = {
|
|
24
|
-
args: {
|
|
25
|
-
description:
|
|
26
|
-
"Your offline session has expired. Reconnect and sign in again to keep working.",
|
|
27
|
-
action: <Button>Sign in again</Button>,
|
|
28
|
-
},
|
|
29
|
-
}
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react-vite"
|
|
2
|
+
|
|
3
|
+
import { Button } from "./button"
|
|
4
|
+
import { LockedScreen } from "./locked-screen"
|
|
5
|
+
|
|
6
|
+
const meta = {
|
|
7
|
+
title: "Primitives/LockedScreen",
|
|
8
|
+
component: LockedScreen,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
parameters: { layout: "padded" },
|
|
11
|
+
} satisfies Meta<typeof LockedScreen>
|
|
12
|
+
|
|
13
|
+
export default meta
|
|
14
|
+
type Story = StoryObj<typeof meta>
|
|
15
|
+
|
|
16
|
+
export const Default: Story = {
|
|
17
|
+
args: {
|
|
18
|
+
description:
|
|
19
|
+
"Your offline session has expired. Reconnect and sign in again to keep working.",
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const WithReloginAction: Story = {
|
|
24
|
+
args: {
|
|
25
|
+
description:
|
|
26
|
+
"Your offline session has expired. Reconnect and sign in again to keep working.",
|
|
27
|
+
action: <Button>Sign in again</Button>,
|
|
28
|
+
},
|
|
29
|
+
}
|
package/src/locked-screen.tsx
CHANGED
|
@@ -1,61 +1,75 @@
|
|
|
1
|
-
import * as React from "react"
|
|
2
|
-
import { IconLock } from "@tabler/icons-react"
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
import { IconLock } from "@tabler/icons-react"
|
|
3
|
+
|
|
4
|
+
import { Lottie } from "./lottie"
|
|
5
|
+
import { cn } from "./utils"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Full-page LOCKED state — e.g. an offline-first desktop app whose cached-login
|
|
9
|
+
* TTL has elapsed and must re-authenticate online (WC-desktop-sync). A sibling
|
|
10
|
+
* of {@link AccessDenied}: domain-free, presentational, `role="alert"`.
|
|
11
|
+
*
|
|
12
|
+
* Like AccessDenied, `action` has NO default — the caller supplies the re-login
|
|
13
|
+
* button/link. This primitive owns no auth opinion (a desktop app wires its
|
|
14
|
+
* "sign in again" here; another product might do something else).
|
|
15
|
+
*/
|
|
16
|
+
export interface LockedScreenProps extends Omit<React.ComponentProps<"div">, "title"> {
|
|
17
|
+
icon?: React.ReactNode
|
|
18
|
+
title?: React.ReactNode
|
|
19
|
+
description: React.ReactNode
|
|
20
|
+
action?: React.ReactNode
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function LockedScreen({
|
|
24
|
+
className,
|
|
25
|
+
icon,
|
|
26
|
+
title = "Session locked",
|
|
27
|
+
description,
|
|
28
|
+
action,
|
|
29
|
+
...props
|
|
30
|
+
}: LockedScreenProps) {
|
|
31
|
+
return (
|
|
32
|
+
<div
|
|
33
|
+
data-slot="locked-screen"
|
|
34
|
+
role="alert"
|
|
35
|
+
className={cn(
|
|
36
|
+
"flex min-h-[450px] flex-col items-center justify-center rounded-2xl border border-border bg-card p-8 text-center shadow-sm",
|
|
37
|
+
className
|
|
38
|
+
)}
|
|
39
|
+
{...props}
|
|
40
|
+
>
|
|
41
|
+
{icon ? (
|
|
42
|
+
<div
|
|
43
|
+
data-slot="locked-screen-icon"
|
|
44
|
+
aria-hidden="true"
|
|
45
|
+
className="mb-4 rounded-full bg-muted p-4 text-muted-foreground [&>svg]:size-12"
|
|
46
|
+
>
|
|
47
|
+
{icon}
|
|
48
|
+
</div>
|
|
49
|
+
) : (
|
|
50
|
+
// The security-lock scene (LT.4); the lock icon shows until it is ready.
|
|
51
|
+
<Lottie
|
|
52
|
+
name="security-lock"
|
|
53
|
+
className="mb-4 h-[120px] w-[160px]"
|
|
54
|
+
fallback={
|
|
55
|
+
<span data-slot="locked-screen-icon" className="rounded-full bg-muted p-4 text-muted-foreground [&>svg]:size-12">
|
|
56
|
+
<IconLock />
|
|
57
|
+
</span>
|
|
58
|
+
}
|
|
59
|
+
/>
|
|
60
|
+
)}
|
|
61
|
+
<h2 data-slot="locked-screen-title" className="mb-2 text-xl font-semibold text-foreground">
|
|
62
|
+
{title}
|
|
63
|
+
</h2>
|
|
64
|
+
<div
|
|
65
|
+
data-slot="locked-screen-description"
|
|
66
|
+
className="mb-6 max-w-md text-sm text-muted-foreground"
|
|
67
|
+
>
|
|
68
|
+
{description}
|
|
69
|
+
</div>
|
|
70
|
+
{action}
|
|
71
|
+
</div>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export { LockedScreen }
|
package/src/lockup.tsx
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Mark } from "./mark"
|
|
2
|
+
import { cn } from "./utils"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The horizontal lockup (docs/design/01-logo.md): the mark, then "Whity" in
|
|
6
|
+
* Readex Pro 600, always in Latin letters and always left to right, also in
|
|
7
|
+
* Arabic. The word's cap height is about the plane's side and it starts a
|
|
8
|
+
* short gap after the sheet. `size` is the mark's height in pixels; use 20 or
|
|
9
|
+
* more. Whity's own surfaces only: a white-labelled tenant shows `TenantLogo`.
|
|
10
|
+
*/
|
|
11
|
+
function Lockup({
|
|
12
|
+
size = 32,
|
|
13
|
+
label = "Whity",
|
|
14
|
+
className,
|
|
15
|
+
}: {
|
|
16
|
+
size?: number
|
|
17
|
+
/** The accessible name of the whole lockup. */
|
|
18
|
+
label?: string
|
|
19
|
+
className?: string
|
|
20
|
+
}) {
|
|
21
|
+
return (
|
|
22
|
+
<span
|
|
23
|
+
data-slot="lockup"
|
|
24
|
+
role="img"
|
|
25
|
+
aria-label={label}
|
|
26
|
+
dir="ltr"
|
|
27
|
+
className={cn("inline-flex shrink-0 items-center text-foreground", className)}
|
|
28
|
+
style={{ gap: Math.round(size * 0.16) }}
|
|
29
|
+
>
|
|
30
|
+
<Mark size={size} label="" />
|
|
31
|
+
<span
|
|
32
|
+
aria-hidden="true"
|
|
33
|
+
className="font-display leading-none font-semibold"
|
|
34
|
+
style={{ fontSize: Math.round(size * 0.94), letterSpacing: "-0.01em" }}
|
|
35
|
+
>
|
|
36
|
+
Whity
|
|
37
|
+
</span>
|
|
38
|
+
</span>
|
|
39
|
+
)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export { Lockup }
|