@siiway/ui-react 0.0.0 → 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/LICENSE +21 -0
- package/README.md +19 -1
- package/dist/components/AppShell.d.ts +29 -0
- package/dist/components/AppShell.d.ts.map +1 -0
- package/dist/components/AppShell.js +220 -0
- package/dist/components/AppShell.js.map +1 -0
- package/dist/components/AuthShell.d.ts +21 -0
- package/dist/components/AuthShell.d.ts.map +1 -0
- package/dist/components/AuthShell.js +53 -0
- package/dist/components/AuthShell.js.map +1 -0
- package/dist/components/BrandMark.d.ts +11 -0
- package/dist/components/BrandMark.d.ts.map +1 -0
- package/dist/components/BrandMark.js +11 -0
- package/dist/components/BrandMark.js.map +1 -0
- package/dist/components/ButtonLink.d.ts +11 -0
- package/dist/components/ButtonLink.d.ts.map +1 -0
- package/dist/components/ButtonLink.js +15 -0
- package/dist/components/ButtonLink.js.map +1 -0
- package/dist/components/CheckboxField.d.ts +15 -0
- package/dist/components/CheckboxField.d.ts.map +1 -0
- package/dist/components/CheckboxField.js +23 -0
- package/dist/components/CheckboxField.js.map +1 -0
- package/dist/components/ColorPickerInput.d.ts +17 -0
- package/dist/components/ColorPickerInput.d.ts.map +1 -0
- package/dist/components/ColorPickerInput.js +97 -0
- package/dist/components/ColorPickerInput.js.map +1 -0
- package/dist/components/CommandPalette.d.ts +65 -0
- package/dist/components/CommandPalette.d.ts.map +1 -0
- package/dist/components/CommandPalette.js +269 -0
- package/dist/components/CommandPalette.js.map +1 -0
- package/dist/components/CopyButton.d.ts +27 -0
- package/dist/components/CopyButton.d.ts.map +1 -0
- package/dist/components/CopyButton.js +20 -0
- package/dist/components/CopyButton.js.map +1 -0
- package/dist/components/CopyIdTrigger.d.ts +31 -0
- package/dist/components/CopyIdTrigger.d.ts.map +1 -0
- package/dist/components/CopyIdTrigger.js +72 -0
- package/dist/components/CopyIdTrigger.js.map +1 -0
- package/dist/components/DataList.d.ts +78 -0
- package/dist/components/DataList.d.ts.map +1 -0
- package/dist/components/DataList.js +150 -0
- package/dist/components/DataList.js.map +1 -0
- package/dist/components/DetailHeader.d.ts +26 -0
- package/dist/components/DetailHeader.d.ts.map +1 -0
- package/dist/components/DetailHeader.js +49 -0
- package/dist/components/DetailHeader.js.map +1 -0
- package/dist/components/DurationInput.d.ts +25 -0
- package/dist/components/DurationInput.d.ts.map +1 -0
- package/dist/components/DurationInput.js +83 -0
- package/dist/components/DurationInput.js.map +1 -0
- package/dist/components/EmptyState.d.ts +14 -0
- package/dist/components/EmptyState.d.ts.map +1 -0
- package/dist/components/EmptyState.js +41 -0
- package/dist/components/EmptyState.js.map +1 -0
- package/dist/components/FormPage.d.ts +22 -0
- package/dist/components/FormPage.d.ts.map +1 -0
- package/dist/components/FormPage.js +65 -0
- package/dist/components/FormPage.js.map +1 -0
- package/dist/components/GetStartedPanel.d.ts +16 -0
- package/dist/components/GetStartedPanel.d.ts.map +1 -0
- package/dist/components/GetStartedPanel.js +96 -0
- package/dist/components/GetStartedPanel.js.map +1 -0
- package/dist/components/LabeledLine.d.ts +12 -0
- package/dist/components/LabeledLine.d.ts.map +1 -0
- package/dist/components/LabeledLine.js +6 -0
- package/dist/components/LabeledLine.js.map +1 -0
- package/dist/components/ListSearch.d.ts +15 -0
- package/dist/components/ListSearch.d.ts.map +1 -0
- package/dist/components/ListSearch.js +23 -0
- package/dist/components/ListSearch.js.map +1 -0
- package/dist/components/LoadingBar.d.ts +8 -0
- package/dist/components/LoadingBar.d.ts.map +1 -0
- package/dist/components/LoadingBar.js +55 -0
- package/dist/components/LoadingBar.js.map +1 -0
- package/dist/components/LoadingPage.d.ts +6 -0
- package/dist/components/LoadingPage.d.ts.map +1 -0
- package/dist/components/LoadingPage.js +25 -0
- package/dist/components/LoadingPage.js.map +1 -0
- package/dist/components/MenuPanel.d.ts +34 -0
- package/dist/components/MenuPanel.d.ts.map +1 -0
- package/dist/components/MenuPanel.js +98 -0
- package/dist/components/MenuPanel.js.map +1 -0
- package/dist/components/Outline.d.ts +23 -0
- package/dist/components/Outline.d.ts.map +1 -0
- package/dist/components/Outline.js +150 -0
- package/dist/components/Outline.js.map +1 -0
- package/dist/components/Overview.d.ts +103 -0
- package/dist/components/Overview.d.ts.map +1 -0
- package/dist/components/Overview.js +286 -0
- package/dist/components/Overview.js.map +1 -0
- package/dist/components/PageHeader.d.ts +19 -0
- package/dist/components/PageHeader.d.ts.map +1 -0
- package/dist/components/PageHeader.js +41 -0
- package/dist/components/PageHeader.js.map +1 -0
- package/dist/components/Pagination.d.ts +19 -0
- package/dist/components/Pagination.d.ts.map +1 -0
- package/dist/components/Pagination.js +47 -0
- package/dist/components/Pagination.js.map +1 -0
- package/dist/components/PasswordInput.d.ts +3 -0
- package/dist/components/PasswordInput.d.ts.map +1 -0
- package/dist/components/PasswordInput.js +29 -0
- package/dist/components/PasswordInput.js.map +1 -0
- package/dist/components/PrevNext.d.ts +16 -0
- package/dist/components/PrevNext.d.ts.map +1 -0
- package/dist/components/PrevNext.js +61 -0
- package/dist/components/PrevNext.js.map +1 -0
- package/dist/components/SearchButton.d.ts +16 -0
- package/dist/components/SearchButton.d.ts.map +1 -0
- package/dist/components/SearchButton.js +63 -0
- package/dist/components/SearchButton.js.map +1 -0
- package/dist/components/SearchField.d.ts +10 -0
- package/dist/components/SearchField.d.ts.map +1 -0
- package/dist/components/SearchField.js +67 -0
- package/dist/components/SearchField.js.map +1 -0
- package/dist/components/Segmented.d.ts +28 -0
- package/dist/components/Segmented.d.ts.map +1 -0
- package/dist/components/Segmented.js +74 -0
- package/dist/components/Segmented.js.map +1 -0
- package/dist/components/Select.d.ts +22 -0
- package/dist/components/Select.d.ts.map +1 -0
- package/dist/components/Select.js +50 -0
- package/dist/components/Select.js.map +1 -0
- package/dist/components/Settings.d.ts +103 -0
- package/dist/components/Settings.d.ts.map +1 -0
- package/dist/components/Settings.js +246 -0
- package/dist/components/Settings.js.map +1 -0
- package/dist/components/SideNav.d.ts +47 -0
- package/dist/components/SideNav.d.ts.map +1 -0
- package/dist/components/SideNav.js +125 -0
- package/dist/components/SideNav.js.map +1 -0
- package/dist/components/Skeletons.d.ts +37 -0
- package/dist/components/Skeletons.d.ts.map +1 -0
- package/dist/components/Skeletons.js +109 -0
- package/dist/components/Skeletons.js.map +1 -0
- package/dist/components/StatusPage.d.ts +49 -0
- package/dist/components/StatusPage.d.ts.map +1 -0
- package/dist/components/StatusPage.js +110 -0
- package/dist/components/StatusPage.js.map +1 -0
- package/dist/components/ThemeMenu.d.ts +13 -0
- package/dist/components/ThemeMenu.d.ts.map +1 -0
- package/dist/components/ThemeMenu.js +18 -0
- package/dist/components/ThemeMenu.js.map +1 -0
- package/dist/components/ThemeSwitch.d.ts +17 -0
- package/dist/components/ThemeSwitch.d.ts.map +1 -0
- package/dist/components/ThemeSwitch.js +25 -0
- package/dist/components/ThemeSwitch.js.map +1 -0
- package/dist/components/TopBar.d.ts +49 -0
- package/dist/components/TopBar.d.ts.map +1 -0
- package/dist/components/TopBar.js +146 -0
- package/dist/components/TopBar.js.map +1 -0
- package/dist/components/ViewBanner.d.ts +17 -0
- package/dist/components/ViewBanner.d.ts.map +1 -0
- package/dist/components/ViewBanner.js +14 -0
- package/dist/components/ViewBanner.js.map +1 -0
- package/dist/hooks/platform.d.ts +7 -0
- package/dist/hooks/platform.d.ts.map +1 -0
- package/dist/hooks/platform.js +19 -0
- package/dist/hooks/platform.js.map +1 -0
- package/dist/hooks/useConfirm.d.ts +23 -0
- package/dist/hooks/useConfirm.d.ts.map +1 -0
- package/dist/hooks/useConfirm.js +55 -0
- package/dist/hooks/useConfirm.js.map +1 -0
- package/dist/hooks/useCopy.d.ts +12 -0
- package/dist/hooks/useCopy.d.ts.map +1 -0
- package/dist/hooks/useCopy.js +39 -0
- package/dist/hooks/useCopy.js.map +1 -0
- package/dist/hooks/useDebouncedSearch.d.ts +8 -0
- package/dist/hooks/useDebouncedSearch.d.ts.map +1 -0
- package/dist/hooks/useDebouncedSearch.js +19 -0
- package/dist/hooks/useDebouncedSearch.js.map +1 -0
- package/dist/hooks/usePageClamp.d.ts +4 -0
- package/dist/hooks/usePageClamp.d.ts.map +1 -0
- package/dist/hooks/usePageClamp.js +17 -0
- package/dist/hooks/usePageClamp.js.map +1 -0
- package/dist/hooks/useSearchShortcut.d.ts +8 -0
- package/dist/hooks/useSearchShortcut.d.ts.map +1 -0
- package/dist/hooks/useSearchShortcut.js +38 -0
- package/dist/hooks/useSearchShortcut.js.map +1 -0
- package/dist/hooks/useThemeMode.d.ts +29 -0
- package/dist/hooks/useThemeMode.d.ts.map +1 -0
- package/dist/hooks/useThemeMode.js +111 -0
- package/dist/hooks/useThemeMode.js.map +1 -0
- package/dist/hooks/useToastMessage.d.ts +22 -0
- package/dist/hooks/useToastMessage.d.ts.map +1 -0
- package/dist/hooks/useToastMessage.js +26 -0
- package/dist/hooks/useToastMessage.js.map +1 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +60 -0
- package/dist/index.js.map +1 -0
- package/dist/provider/UiProvider.d.ts +60 -0
- package/dist/provider/UiProvider.d.ts.map +1 -0
- package/dist/provider/UiProvider.js +144 -0
- package/dist/provider/UiProvider.js.map +1 -0
- package/dist/provider/canvas.d.ts +7 -0
- package/dist/provider/canvas.d.ts.map +1 -0
- package/dist/provider/canvas.js +30 -0
- package/dist/provider/canvas.js.map +1 -0
- package/dist/provider/context.d.ts +69 -0
- package/dist/provider/context.d.ts.map +1 -0
- package/dist/provider/context.js +84 -0
- package/dist/provider/context.js.map +1 -0
- package/dist/theme/createTheme.d.ts +13 -0
- package/dist/theme/createTheme.d.ts.map +1 -0
- package/dist/theme/createTheme.js +18 -0
- package/dist/theme/createTheme.js.map +1 -0
- package/package.json +42 -2
- package/src/components/AppShell.tsx +337 -0
- package/src/components/AuthShell.tsx +104 -0
- package/src/components/BrandMark.tsx +28 -0
- package/src/components/ButtonLink.tsx +40 -0
- package/src/components/CheckboxField.tsx +50 -0
- package/src/components/ColorPickerInput.tsx +190 -0
- package/src/components/CommandPalette.tsx +479 -0
- package/src/components/CopyButton.tsx +76 -0
- package/src/components/CopyIdTrigger.tsx +127 -0
- package/src/components/DataList.tsx +332 -0
- package/src/components/DetailHeader.tsx +108 -0
- package/src/components/DurationInput.tsx +133 -0
- package/src/components/EmptyState.tsx +67 -0
- package/src/components/FormPage.tsx +109 -0
- package/src/components/GetStartedPanel.tsx +132 -0
- package/src/components/LabeledLine.tsx +28 -0
- package/src/components/ListSearch.tsx +64 -0
- package/src/components/LoadingBar.tsx +81 -0
- package/src/components/LoadingPage.tsx +41 -0
- package/src/components/MenuPanel.tsx +163 -0
- package/src/components/Outline.tsx +208 -0
- package/src/components/Overview.tsx +448 -0
- package/src/components/PageHeader.tsx +69 -0
- package/src/components/Pagination.tsx +105 -0
- package/src/components/PasswordInput.tsx +50 -0
- package/src/components/PrevNext.tsx +98 -0
- package/src/components/SearchButton.tsx +90 -0
- package/src/components/SearchField.tsx +97 -0
- package/src/components/Segmented.tsx +136 -0
- package/src/components/Select.tsx +110 -0
- package/src/components/Settings.tsx +432 -0
- package/src/components/SideNav.tsx +258 -0
- package/src/components/Skeletons.tsx +233 -0
- package/src/components/StatusPage.tsx +212 -0
- package/src/components/ThemeMenu.tsx +51 -0
- package/src/components/ThemeSwitch.tsx +49 -0
- package/src/components/TopBar.tsx +293 -0
- package/src/components/ViewBanner.tsx +51 -0
- package/src/hooks/platform.ts +22 -0
- package/src/hooks/useConfirm.tsx +97 -0
- package/src/hooks/useCopy.ts +39 -0
- package/src/hooks/useDebouncedSearch.ts +19 -0
- package/src/hooks/usePageClamp.ts +20 -0
- package/src/hooks/useSearchShortcut.ts +49 -0
- package/src/hooks/useThemeMode.ts +168 -0
- package/src/hooks/useToastMessage.ts +38 -0
- package/src/index.ts +156 -0
- package/src/provider/UiProvider.tsx +256 -0
- package/src/provider/canvas.ts +31 -0
- package/src/provider/context.tsx +145 -0
- package/src/theme/createTheme.ts +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 SiiWay
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
# @siiway/ui-react
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
SiiWay's Fluent UI v9 theme, provider and components for React 18.3 and 19.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
bun add @siiway/ui-react @siiway/ui-core
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
import { UiProvider, PageHeader } from "@siiway/ui-react";
|
|
11
|
+
|
|
12
|
+
<UiProvider scheme="light" accent="#0078d4" locale="en">
|
|
13
|
+
<PageHeader title="Applications" />
|
|
14
|
+
</UiProvider>;
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`react`, `react-dom`, `@fluentui/react-components` and
|
|
18
|
+
`@fluentui/react-icons` are peer dependencies: the package uses your app's
|
|
19
|
+
copies. Documentation: https://ui.siiway.org
|
|
20
|
+
|
|
21
|
+
MIT licensed.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
export interface AppShellProps {
|
|
3
|
+
/** The sidebar, top to bottom: the brand, search, the navigation, an account menu. */
|
|
4
|
+
sidebar: ReactNode;
|
|
5
|
+
/** The page, in the scrolling area beside the sidebar: the `main` landmark. */
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
/** Above the page, such as a `TopBar` whose menu button opens the drawer. */
|
|
8
|
+
header?: ReactNode;
|
|
9
|
+
/** Show `header` only where the sidebar is a drawer, as the bar that opens it. */
|
|
10
|
+
headerOnlyWithDrawer?: boolean;
|
|
11
|
+
/** Whether the drawer is open. */
|
|
12
|
+
open: boolean;
|
|
13
|
+
/** Called to open or close the drawer: with false on Escape, the backdrop,
|
|
14
|
+
* a link in the drawer, `AppShellClose`, or the window growing past
|
|
15
|
+
* `drawerBelow`. */
|
|
16
|
+
onOpenChange: (open: boolean) => void;
|
|
17
|
+
/** The width from which down the sidebar is a drawer: 960 (the default) or
|
|
18
|
+
* 768. `TopBar`'s `menuBelow` has the same default; change both together. */
|
|
19
|
+
drawerBelow?: 768 | 960;
|
|
20
|
+
/** The sidebar's width in px. Defaults to 240. */
|
|
21
|
+
sidebarWidth?: number;
|
|
22
|
+
}
|
|
23
|
+
export declare function AppShell({ sidebar, children, header, headerOnlyWithDrawer, open, onOpenChange, drawerBelow, sidebarWidth, }: AppShellProps): import("react").JSX.Element;
|
|
24
|
+
/** A button that closes the drawer, shown only while the sidebar is one. Put
|
|
25
|
+
* it at the end of the sidebar's first row, by the brand. */
|
|
26
|
+
export declare function AppShellClose({ label, }: {
|
|
27
|
+
/** Defaults to the library's "Close navigation". */ label?: string;
|
|
28
|
+
}): import("react").JSX.Element | null;
|
|
29
|
+
//# sourceMappingURL=AppShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppShell.d.ts","sourceRoot":"","sources":["../../src/components/AppShell.tsx"],"names":[],"mappings":"AAcA,OAAO,EASL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AA2Hf,MAAM,WAAW,aAAa;IAC5B,sFAAsF;IACtF,OAAO,EAAE,SAAS,CAAC;IACnB,+EAA+E;IAC/E,QAAQ,EAAE,SAAS,CAAC;IACpB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,kFAAkF;IAClF,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,kCAAkC;IAClC,IAAI,EAAE,OAAO,CAAC;IACd;;yBAEqB;IACrB,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC;kFAC8E;IAC9E,WAAW,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC;IACxB,kDAAkD;IAClD,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,QAAQ,EACR,MAAM,EACN,oBAAoB,EACpB,IAAI,EACJ,YAAY,EACZ,WAAiB,EACjB,YAAkB,GACnB,EAAE,aAAa,+BA8Hf;AAQD;8DAC8D;AAC9D,wBAAgB,aAAa,CAAC,EAC5B,KAAK,GACN,EAAE;IACD,oDAAoD,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACrE,sCAkBA"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// An app's frame: a sidebar beside the page, which below a width becomes a
|
|
3
|
+
// drawer that slides in over it. Prism's layout, which Vellum and Glint built
|
|
4
|
+
// with Fluent's OverlayDrawer and a width check in JavaScript. This one is CSS,
|
|
5
|
+
// so it renders on the server; only focus and closing need the browser.
|
|
6
|
+
//
|
|
7
|
+
// While a drawer, the sidebar is inert until opened, and again as soon as it
|
|
8
|
+
// starts to close. Open, it is a modal dialog: focus moves into it and Tab
|
|
9
|
+
// wraps around in it, the page behind is
|
|
10
|
+
// inert, and Escape, the backdrop, a link in it, AppShellClose or the window
|
|
11
|
+
// growing past the width close it, with focus back where it was, or on the
|
|
12
|
+
// page when that has gone from view.
|
|
13
|
+
import { Button, makeStyles, mergeClasses, tokens } from "@fluentui/react-components";
|
|
14
|
+
import { DismissRegular } from "@fluentui/react-icons";
|
|
15
|
+
import { createContext, useCallback, useContext, useEffect, useRef, useSyncExternalStore, } from "react";
|
|
16
|
+
import { useCanvasClass } from "../provider/canvas.js";
|
|
17
|
+
import { useUiStrings } from "../provider/context.js";
|
|
18
|
+
const SLIDE = "transform 0.2s ease-out";
|
|
19
|
+
// Below each width the sidebar is a drawer. Griffel needs its media queries
|
|
20
|
+
// written out, so each width has its classes.
|
|
21
|
+
const useStyles = makeStyles({
|
|
22
|
+
shell: {
|
|
23
|
+
display: "flex",
|
|
24
|
+
height: "100vh",
|
|
25
|
+
overflow: "hidden",
|
|
26
|
+
// A phone's collapsing address bar: the visible height, where supported.
|
|
27
|
+
"@supports (height: 100dvh)": { height: "100dvh" },
|
|
28
|
+
},
|
|
29
|
+
sidebar: {
|
|
30
|
+
display: "flex",
|
|
31
|
+
flexDirection: "column",
|
|
32
|
+
flexShrink: 0,
|
|
33
|
+
boxSizing: "border-box",
|
|
34
|
+
borderRight: `1px solid ${tokens.colorNeutralStroke2}`,
|
|
35
|
+
":focus-visible": { outline: "none" },
|
|
36
|
+
},
|
|
37
|
+
drawer768: {
|
|
38
|
+
"@media (max-width: 768px)": {
|
|
39
|
+
position: "fixed",
|
|
40
|
+
top: 0,
|
|
41
|
+
bottom: 0,
|
|
42
|
+
left: 0,
|
|
43
|
+
zIndex: 200,
|
|
44
|
+
transform: "translateX(-100%)",
|
|
45
|
+
visibility: "hidden",
|
|
46
|
+
// Hidden once it has slid out, not before.
|
|
47
|
+
transition: `${SLIDE}, visibility 0s linear 0.2s`,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
drawer960: {
|
|
51
|
+
"@media (max-width: 960px)": {
|
|
52
|
+
position: "fixed",
|
|
53
|
+
top: 0,
|
|
54
|
+
bottom: 0,
|
|
55
|
+
left: 0,
|
|
56
|
+
zIndex: 200,
|
|
57
|
+
transform: "translateX(-100%)",
|
|
58
|
+
visibility: "hidden",
|
|
59
|
+
transition: `${SLIDE}, visibility 0s linear 0.2s`,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
open768: {
|
|
63
|
+
"@media (max-width: 768px)": { transform: "none", visibility: "visible", transition: SLIDE },
|
|
64
|
+
},
|
|
65
|
+
open960: {
|
|
66
|
+
"@media (max-width: 960px)": { transform: "none", visibility: "visible", transition: SLIDE },
|
|
67
|
+
},
|
|
68
|
+
still: {
|
|
69
|
+
"@media (prefers-reduced-motion: reduce)": { transition: "none" },
|
|
70
|
+
},
|
|
71
|
+
backdrop: {
|
|
72
|
+
position: "fixed",
|
|
73
|
+
inset: 0,
|
|
74
|
+
zIndex: 199,
|
|
75
|
+
background: "rgba(0, 0, 0, 0.5)",
|
|
76
|
+
},
|
|
77
|
+
above768: { "@media (min-width: 769px)": { display: "none" } },
|
|
78
|
+
above960: { "@media (min-width: 961px)": { display: "none" } },
|
|
79
|
+
column: {
|
|
80
|
+
flex: 1,
|
|
81
|
+
display: "flex",
|
|
82
|
+
flexDirection: "column",
|
|
83
|
+
minWidth: 0,
|
|
84
|
+
},
|
|
85
|
+
header: { flexShrink: 0 },
|
|
86
|
+
main: {
|
|
87
|
+
flex: 1,
|
|
88
|
+
overflowY: "auto",
|
|
89
|
+
display: "flex",
|
|
90
|
+
flexDirection: "column",
|
|
91
|
+
// Focused only when the drawer closes and its opener has gone.
|
|
92
|
+
":focus-visible": { outline: "none" },
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
// Whether the window is below the width, kept up to date; on the server, and
|
|
96
|
+
// while hydrating, it isn't (the CSS draws the drawer either way).
|
|
97
|
+
function useBelow(query) {
|
|
98
|
+
const subscribe = useCallback((onChange) => {
|
|
99
|
+
const media = window.matchMedia(query);
|
|
100
|
+
media.addEventListener("change", onChange);
|
|
101
|
+
return () => media.removeEventListener("change", onChange);
|
|
102
|
+
}, [query]);
|
|
103
|
+
return useSyncExternalStore(subscribe, () => window.matchMedia(query).matches, () => false);
|
|
104
|
+
}
|
|
105
|
+
// Something focus can go back to: still in the page and drawn.
|
|
106
|
+
function canFocus(element) {
|
|
107
|
+
return !!element && element.isConnected && element.getClientRects().length > 0;
|
|
108
|
+
}
|
|
109
|
+
const TABBABLE = 'a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
110
|
+
// What Tab reaches in the drawer, in order.
|
|
111
|
+
function tabbables(root) {
|
|
112
|
+
return Array.from(root.querySelectorAll(TABBABLE)).filter((element) => element.tabIndex >= 0 && canFocus(element));
|
|
113
|
+
}
|
|
114
|
+
const ShellContext = createContext(null);
|
|
115
|
+
export function AppShell({ sidebar, children, header, headerOnlyWithDrawer, open, onOpenChange, drawerBelow = 960, sidebarWidth = 240, }) {
|
|
116
|
+
const styles = useStyles();
|
|
117
|
+
const strings = useUiStrings();
|
|
118
|
+
const canvas = useCanvasClass();
|
|
119
|
+
const aside = useRef(null);
|
|
120
|
+
const column = useRef(null);
|
|
121
|
+
const main = useRef(null);
|
|
122
|
+
const query = `(max-width: ${drawerBelow}px)`;
|
|
123
|
+
const narrow = drawerBelow === 768;
|
|
124
|
+
const isDrawer = useBelow(query);
|
|
125
|
+
const modal = open && isDrawer;
|
|
126
|
+
// A closed drawer is inert at once, though it takes a moment to slide out.
|
|
127
|
+
// Set here, not as a prop: React 18 and 19 read `inert` differently.
|
|
128
|
+
useEffect(() => {
|
|
129
|
+
const drawer = aside.current;
|
|
130
|
+
if (isDrawer && !open)
|
|
131
|
+
drawer?.setAttribute("inert", "");
|
|
132
|
+
else
|
|
133
|
+
drawer?.removeAttribute("inert");
|
|
134
|
+
}, [isDrawer, open]);
|
|
135
|
+
// Open as a drawer, including an open sidebar the window narrows under:
|
|
136
|
+
// focus in, the page inert, and back out on close.
|
|
137
|
+
useEffect(() => {
|
|
138
|
+
if (!modal)
|
|
139
|
+
return;
|
|
140
|
+
const before = document.activeElement;
|
|
141
|
+
const drawer = aside.current;
|
|
142
|
+
const page = column.current;
|
|
143
|
+
const fallback = main.current;
|
|
144
|
+
drawer?.focus();
|
|
145
|
+
page?.setAttribute("inert", "");
|
|
146
|
+
return () => {
|
|
147
|
+
page?.removeAttribute("inert");
|
|
148
|
+
const active = document.activeElement;
|
|
149
|
+
if (!drawer?.contains(active) && active !== document.body)
|
|
150
|
+
return;
|
|
151
|
+
// The opener may have gone from view, such as a header shown only
|
|
152
|
+
// with the drawer, after the window grew.
|
|
153
|
+
if (canFocus(before))
|
|
154
|
+
before.focus();
|
|
155
|
+
else
|
|
156
|
+
fallback?.focus();
|
|
157
|
+
};
|
|
158
|
+
}, [modal]);
|
|
159
|
+
// A window that grows past the width has no drawer to keep open.
|
|
160
|
+
useEffect(() => {
|
|
161
|
+
if (!open)
|
|
162
|
+
return;
|
|
163
|
+
const media = window.matchMedia(query);
|
|
164
|
+
const onChange = () => {
|
|
165
|
+
if (!media.matches)
|
|
166
|
+
onOpenChange(false);
|
|
167
|
+
};
|
|
168
|
+
media.addEventListener("change", onChange);
|
|
169
|
+
return () => media.removeEventListener("change", onChange);
|
|
170
|
+
}, [open, query, onOpenChange]);
|
|
171
|
+
const onKeyDown = (event) => {
|
|
172
|
+
if (!modal)
|
|
173
|
+
return;
|
|
174
|
+
if (event.key === "Escape") {
|
|
175
|
+
event.stopPropagation();
|
|
176
|
+
onOpenChange(false);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
// Tab wraps around in the drawer, so it never reaches the browser's bar.
|
|
180
|
+
if (event.key !== "Tab" || !aside.current)
|
|
181
|
+
return;
|
|
182
|
+
const stops = tabbables(aside.current);
|
|
183
|
+
const first = stops[0];
|
|
184
|
+
const last = stops[stops.length - 1];
|
|
185
|
+
const active = document.activeElement;
|
|
186
|
+
if (!first || !last) {
|
|
187
|
+
event.preventDefault();
|
|
188
|
+
}
|
|
189
|
+
else if (event.shiftKey && (active === first || active === aside.current)) {
|
|
190
|
+
event.preventDefault();
|
|
191
|
+
last.focus();
|
|
192
|
+
}
|
|
193
|
+
else if (!event.shiftKey && active === last) {
|
|
194
|
+
event.preventDefault();
|
|
195
|
+
first.focus();
|
|
196
|
+
}
|
|
197
|
+
};
|
|
198
|
+
// A link followed from the drawer leaves it behind.
|
|
199
|
+
const onClick = (event) => {
|
|
200
|
+
if (open && event.target.closest("a[href]"))
|
|
201
|
+
onOpenChange(false);
|
|
202
|
+
};
|
|
203
|
+
return (_jsx(ShellContext.Provider, { value: { drawerBelow, close: () => onOpenChange(false) }, children: _jsxs("div", { className: mergeClasses(styles.shell, canvas), children: [open && (_jsx("div", { className: mergeClasses(styles.backdrop, narrow ? styles.above768 : styles.above960), onClick: () => onOpenChange(false) })), _jsx("aside", { ref: aside, tabIndex: -1, role: modal ? "dialog" : undefined, "aria-modal": modal ? true : undefined, "aria-label": modal ? strings.navigation : undefined, className: mergeClasses(styles.sidebar, canvas, narrow ? styles.drawer768 : styles.drawer960, open && (narrow ? styles.open768 : styles.open960), styles.still), style: { width: sidebarWidth }, onKeyDown: onKeyDown, onClick: onClick, children: sidebar }), _jsxs("div", { ref: column, className: styles.column, children: [header != null && (_jsx("div", { className: mergeClasses(styles.header, headerOnlyWithDrawer && (narrow ? styles.above768 : styles.above960)), children: header })), _jsx("main", { ref: main, tabIndex: -1, className: styles.main, children: children })] })] }) }));
|
|
204
|
+
}
|
|
205
|
+
const useCloseStyles = makeStyles({
|
|
206
|
+
close: { flexShrink: 0 },
|
|
207
|
+
above768: { "@media (min-width: 769px)": { display: "none" } },
|
|
208
|
+
above960: { "@media (min-width: 961px)": { display: "none" } },
|
|
209
|
+
});
|
|
210
|
+
/** A button that closes the drawer, shown only while the sidebar is one. Put
|
|
211
|
+
* it at the end of the sidebar's first row, by the brand. */
|
|
212
|
+
export function AppShellClose({ label, }) {
|
|
213
|
+
const styles = useCloseStyles();
|
|
214
|
+
const strings = useUiStrings();
|
|
215
|
+
const shell = useContext(ShellContext);
|
|
216
|
+
if (!shell)
|
|
217
|
+
return null;
|
|
218
|
+
return (_jsx(Button, { appearance: "subtle", size: "small", icon: _jsx(DismissRegular, {}), "aria-label": label ?? strings.closeNavigation, className: mergeClasses(styles.close, shell.drawerBelow === 768 ? styles.above768 : styles.above960), onClick: shell.close }));
|
|
219
|
+
}
|
|
220
|
+
//# sourceMappingURL=AppShell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AppShell.js","sourceRoot":"","sources":["../../src/components/AppShell.tsx"],"names":[],"mappings":";AAAA,2EAA2E;AAC3E,8EAA8E;AAC9E,gFAAgF;AAChF,wEAAwE;AACxE,EAAE;AACF,6EAA6E;AAC7E,2EAA2E;AAC3E,yCAAyC;AACzC,6EAA6E;AAC7E,2EAA2E;AAC3E,qCAAqC;AAErC,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,MAAM,EACN,oBAAoB,GAIrB,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,KAAK,GAAG,yBAAyB,CAAC;AAExC,4EAA4E;AAC5E,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,KAAC,MAAM,IACL,UAAU,EAAC,QAAQ,EACnB,IAAI,EAAC,OAAO,EACZ,IAAI,EAAE,KAAC,cAAc,KAAG,gBACZ,KAAK,IAAI,OAAO,CAAC,eAAe,EAC5C,SAAS,EAAE,YAAY,CACrB,MAAM,CAAC,KAAK,EACZ,KAAK,CAAC,WAAW,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAC9D,EACD,OAAO,EAAE,KAAK,CAAC,KAAK,GACpB,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
export interface AuthShellProps {
|
|
3
|
+
/** The form and what goes with it, stacked in the column. */
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
/** The site at the top left. Leave it out while it isn't known yet. */
|
|
6
|
+
brand?: {
|
|
7
|
+
name: string;
|
|
8
|
+
iconUrl?: string;
|
|
9
|
+
};
|
|
10
|
+
/** Above the column, as wide as it: notices, such as planned maintenance,
|
|
11
|
+
* which matter most to someone who can't sign in. */
|
|
12
|
+
above?: ReactNode;
|
|
13
|
+
/** At the foot of the page, such as legal links. */
|
|
14
|
+
footer?: ReactNode;
|
|
15
|
+
/** The column's width in px. Defaults to 400; a consent screen may want 440. */
|
|
16
|
+
maxWidth?: number;
|
|
17
|
+
/** The space between the column's children in px. Defaults to 20. */
|
|
18
|
+
gap?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare function AuthShell({ children, brand, above, footer, maxWidth, gap, }: AuthShellProps): import("react").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=AuthShell.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthShell.d.ts","sourceRoot":"","sources":["../../src/components/AuthShell.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AA4CvC,MAAM,WAAW,cAAc;IAC7B,6DAA6D;IAC7D,QAAQ,EAAE,SAAS,CAAC;IACpB,uEAAuE;IACvE,KAAK,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3C;0DACsD;IACtD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,oDAAoD;IACpD,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,gFAAgF;IAChF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,SAAS,CAAC,EACxB,QAAQ,EACR,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAc,EACd,GAAQ,GACT,EAAE,cAAc,+BA8BhB"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// A sign-in page's frame: the site at the top left and a narrow column on the
|
|
3
|
+
// canvas for the form, with room for notices above it and legal links at the
|
|
4
|
+
// foot. No card: Prism's sign-in, register, consent and two-factor pages, and
|
|
5
|
+
// Glint's sign-in, laid out alike.
|
|
6
|
+
import { Text, makeStyles, mergeClasses } from "@fluentui/react-components";
|
|
7
|
+
import { useCanvasClass } from "../provider/canvas.js";
|
|
8
|
+
import { BrandMark } from "./BrandMark.js";
|
|
9
|
+
const useStyles = makeStyles({
|
|
10
|
+
page: {
|
|
11
|
+
minHeight: "100vh",
|
|
12
|
+
display: "flex",
|
|
13
|
+
flexDirection: "column",
|
|
14
|
+
boxSizing: "border-box",
|
|
15
|
+
},
|
|
16
|
+
header: {
|
|
17
|
+
display: "flex",
|
|
18
|
+
alignItems: "center",
|
|
19
|
+
gap: "10px",
|
|
20
|
+
minHeight: "64px",
|
|
21
|
+
padding: "0 32px",
|
|
22
|
+
"@media (max-width: 480px)": { padding: "0 20px" },
|
|
23
|
+
},
|
|
24
|
+
main: {
|
|
25
|
+
flex: 1,
|
|
26
|
+
display: "flex",
|
|
27
|
+
flexDirection: "column",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
gap: "20px",
|
|
30
|
+
padding: "8vh 20px 48px",
|
|
31
|
+
"@media (max-width: 480px)": { paddingTop: "24px" },
|
|
32
|
+
},
|
|
33
|
+
// Gone when what's above renders nothing, so it leaves no gap.
|
|
34
|
+
above: {
|
|
35
|
+
width: "100%",
|
|
36
|
+
":empty": { display: "none" },
|
|
37
|
+
},
|
|
38
|
+
column: {
|
|
39
|
+
width: "100%",
|
|
40
|
+
display: "flex",
|
|
41
|
+
flexDirection: "column",
|
|
42
|
+
boxSizing: "border-box",
|
|
43
|
+
},
|
|
44
|
+
footer: {
|
|
45
|
+
padding: "0 20px 16px",
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
export function AuthShell({ children, brand, above, footer, maxWidth = 400, gap = 20, }) {
|
|
49
|
+
const styles = useStyles();
|
|
50
|
+
const canvas = useCanvasClass();
|
|
51
|
+
return (_jsxs("div", { className: mergeClasses(styles.page, canvas), children: [brand ? (_jsxs("header", { className: styles.header, children: [_jsx(BrandMark, { iconUrl: brand.iconUrl }), _jsx(Text, { weight: "semibold", size: 400, children: brand.name })] })) : (_jsx("div", { className: styles.header })), _jsxs("main", { className: styles.main, children: [above != null && (_jsx("div", { className: styles.above, style: { maxWidth }, children: above })), _jsx("div", { className: styles.column, style: { maxWidth, gap }, children: children })] }), footer != null && _jsx("footer", { className: styles.footer, children: footer })] }));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=AuthShell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AuthShell.js","sourceRoot":"","sources":["../../src/components/AuthShell.tsx"],"names":[],"mappings":";AAAA,8EAA8E;AAC9E,6EAA6E;AAC7E,8EAA8E;AAC9E,mCAAmC;AAEnC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC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C,IAAI,EAAE,MAAM,CAAC,aAC9C,KAAK,CAAC,CAAC,CAAC,CACP,kBAAQ,SAAS,EAAE,MAAM,CAAC,MAAM,aAE9B,KAAC,SAAS,IAAC,OAAO,EAAE,KAAK,CAAC,OAAO,GAAI,EACrC,KAAC,IAAI,IAAC,MAAM,EAAC,UAAU,EAAC,IAAI,EAAE,GAAG,YAC9B,KAAK,CAAC,IAAI,GACN,IACA,CACV,CAAC,CAAC,CAAC,CAEF,cAAK,SAAS,EAAE,MAAM,CAAC,MAAM,GAAI,CAClC,EACD,gBAAM,SAAS,EAAE,MAAM,CAAC,IAAI,aACzB,KAAK,IAAI,IAAI,IAAI,CAChB,cAAK,SAAS,EAAE,MAAM,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,YAC9C,KAAK,GACF,CACP,EACD,cAAK,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,YACpD,QAAQ,GACL,IACD,EACN,MAAM,IAAI,IAAI,IAAI,iBAAQ,SAAS,EAAE,MAAM,CAAC,MAAM,YAAG,MAAM,GAAU,IAClE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
interface BrandMarkProps {
|
|
2
|
+
/** The image's alt text. Leave it out when the name is written beside the mark. */
|
|
3
|
+
name?: string | null;
|
|
4
|
+
/** The icon's URL. Without one, the mark renders nothing. */
|
|
5
|
+
iconUrl?: string | null;
|
|
6
|
+
/** Width and height, in pixels. */
|
|
7
|
+
size?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function BrandMark({ name, iconUrl, size }: BrandMarkProps): import("react").JSX.Element | null;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=BrandMark.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrandMark.d.ts","sourceRoot":"","sources":["../../src/components/BrandMark.tsx"],"names":[],"mappings":"AAMA,UAAU,cAAc;IACtB,mFAAmF;IACnF,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,6DAA6D;IAC7D,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAS,EAAE,EAAE,cAAc,sCAYrE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
// Site logo: the configured site icon, or nothing. With no icon set, the
|
|
3
|
+
// site name beside it carries the brand on its own — a placeholder mark
|
|
4
|
+
// would only invent a logo the operator never chose.
|
|
5
|
+
import { Image } from "@fluentui/react-components";
|
|
6
|
+
export function BrandMark({ name, iconUrl, size = 28 }) {
|
|
7
|
+
if (!iconUrl)
|
|
8
|
+
return null;
|
|
9
|
+
return (_jsx(Image, { src: iconUrl, alt: name ?? "", fit: "cover", width: size, height: size, style: { borderRadius: Math.round(size * 0.28), flexShrink: 0 } }));
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=BrandMark.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrandMark.js","sourceRoot":"","sources":["../../src/components/BrandMark.tsx"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,wEAAwE;AACxE,qDAAqD;AAErD,OAAO,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AAWnD,MAAM,UAAU,SAAS,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,GAAG,EAAE,EAAkB;IACpE,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,OAAO,CACL,KAAC,KAAK,IACJ,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,IAAI,IAAI,EAAE,EACf,GAAG,EAAC,OAAO,EACX,KAAK,EAAE,IAAI,EACX,MAAM,EAAE,IAAI,EACZ,KAAK,EAAE,EAAE,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,GAC/D,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ButtonProps } from "@fluentui/react-components";
|
|
2
|
+
import type { ReactElement, ReactNode } from "react";
|
|
3
|
+
export declare function ButtonLink({ to, appearance, size, icon, className, children, }: {
|
|
4
|
+
to: string;
|
|
5
|
+
appearance?: ButtonProps["appearance"];
|
|
6
|
+
size?: ButtonProps["size"];
|
|
7
|
+
icon?: ReactElement;
|
|
8
|
+
className?: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=ButtonLink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonLink.d.ts","sourceRoot":"","sources":["../../src/components/ButtonLink.tsx"],"names":[],"mappings":"AAKA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGrD,wBAAgB,UAAU,CAAC,EACzB,EAAE,EACF,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,QAAQ,GACT,EAAE;IACD,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IACvC,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,IAAI,CAAC,EAAE,YAAY,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;CACrB,+BAWA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// A link drawn as a Fluent button, for a button whose only job is to open a
|
|
3
|
+
// page: as a link, it opens in a new tab on a middle-click, shows its address
|
|
4
|
+
// on hover, and reads as a link to screen readers. It goes through the app's
|
|
5
|
+
// router like any library link.
|
|
6
|
+
import { mergeClasses, useButtonStyles_unstable, useButton_unstable, } from "@fluentui/react-components";
|
|
7
|
+
import { UiLink } from "../provider/context.js";
|
|
8
|
+
export function ButtonLink({ to, appearance, size, icon, className, children, }) {
|
|
9
|
+
// Fluent's own state and classes for a button drawn as an anchor. Only the
|
|
10
|
+
// classes are used: the anchor is the router's.
|
|
11
|
+
const state = useButton_unstable({ as: "a", appearance, size, icon, children }, null);
|
|
12
|
+
useButtonStyles_unstable(state);
|
|
13
|
+
return (_jsxs(UiLink, { to: to, className: mergeClasses(state.root.className, className), children: [state.icon && _jsx("span", { className: state.icon.className, children: icon }), children] }));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=ButtonLink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonLink.js","sourceRoot":"","sources":["../../src/components/ButtonLink.tsx"],"names":[],"mappings":";AAAA,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,gCAAgC;AAEhC,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,kBAAkB,GAEnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,MAAM,UAAU,UAAU,CAAC,EACzB,EAAE,EACF,UAAU,EACV,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,QAAQ,GAQT;IACC,2EAA2E;IAC3E,gDAAgD;IAChD,MAAM,KAAK,GAAG,kBAAkB,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,IAAI,CAAC,CAAC;IACtF,wBAAwB,CAAC,KAAK,CAAC,CAAC;IAChC,OAAO,CACL,MAAC,MAAM,IAAC,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,aACrE,KAAK,CAAC,IAAI,IAAI,eAAM,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,YAAG,IAAI,GAAQ,EAClE,QAAQ,IACF,CACV,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface CheckboxFieldProps {
|
|
2
|
+
/** The checkbox's label. */
|
|
3
|
+
label: string;
|
|
4
|
+
/** A line of explanation under the label, in smaller, dimmer text. */
|
|
5
|
+
hint?: string;
|
|
6
|
+
/** Whether the box is checked. */
|
|
7
|
+
checked: boolean;
|
|
8
|
+
/** Disables the checkbox. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Called with the new checked state. */
|
|
11
|
+
onChange: (checked: boolean) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare function CheckboxField({ label, hint, checked, disabled, onChange }: CheckboxFieldProps): import("react").JSX.Element;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=CheckboxField.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxField.d.ts","sourceRoot":"","sources":["../../src/components/CheckboxField.tsx"],"names":[],"mappings":"AAkBA,UAAU,kBAAkB;IAC1B,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,yCAAyC;IACzC,QAAQ,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;CACtC;AAED,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,kBAAkB,+BAkB7F"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
// A checkbox for a form that applies on submit, with an optional line of
|
|
3
|
+
// explanation under its label. Switches are for things that take effect
|
|
4
|
+
// the moment they flip; inside a form that waits for Save, this is the
|
|
5
|
+
// control to use.
|
|
6
|
+
import { Checkbox, makeStyles, tokens } from "@fluentui/react-components";
|
|
7
|
+
const useStyles = makeStyles({
|
|
8
|
+
// Fluent pads the box; pull it back to the form's text edge.
|
|
9
|
+
root: { marginLeft: "-8px", alignSelf: "flex-start", maxWidth: "100%" },
|
|
10
|
+
label: { display: "flex", flexDirection: "column", gap: "2px" },
|
|
11
|
+
hint: {
|
|
12
|
+
fontSize: tokens.fontSizeBase200,
|
|
13
|
+
lineHeight: tokens.lineHeightBase200,
|
|
14
|
+
color: tokens.colorNeutralForeground3,
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
export function CheckboxField({ label, hint, checked, disabled, onChange }) {
|
|
18
|
+
const styles = useStyles();
|
|
19
|
+
return (_jsx(Checkbox, { className: styles.root, checked: checked, disabled: disabled, onChange: (_, d) => onChange(!!d.checked), label: {
|
|
20
|
+
children: (_jsxs("span", { className: styles.label, children: [_jsx("span", { children: label }), hint && _jsx("span", { className: styles.hint, children: hint })] })),
|
|
21
|
+
} }));
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=CheckboxField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckboxField.js","sourceRoot":"","sources":["../../src/components/CheckboxField.tsx"],"names":[],"mappings":";AAAA,yEAAyE;AACzE,wEAAwE;AACxE,uEAAuE;AACvE,kBAAkB;AAElB,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAE1E,MAAM,SAAS,GAAG,UAAU,CAAC;IAC3B,6DAA6D;IAC7D,IAAI,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,EAAE;IACvE,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,GAAG,EAAE,KAAK,EAAE;IAC/D,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM,CAAC,eAAe;QAChC,UAAU,EAAE,MAAM,CAAC,iBAAiB;QACpC,KAAK,EAAE,MAAM,CAAC,uBAAuB;KACtC;CACF,CAAC,CAAC;AAeH,MAAM,UAAU,aAAa,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAsB;IAC5F,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,OAAO,CACL,KAAC,QAAQ,IACP,SAAS,EAAE,MAAM,CAAC,IAAI,EACtB,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,QAAQ,EAClB,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,EACzC,KAAK,EAAE;YACL,QAAQ,EAAE,CACR,gBAAM,SAAS,EAAE,MAAM,CAAC,KAAK,aAC3B,yBAAO,KAAK,GAAQ,EACnB,IAAI,IAAI,eAAM,SAAS,EAAE,MAAM,CAAC,IAAI,YAAG,IAAI,GAAQ,IAC/C,CACR;SACF,GACD,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ColorPickerInputProps {
|
|
2
|
+
/** The colour as hex, e.g. `#0078d4`, or `null` when empty. */
|
|
3
|
+
value: string | null;
|
|
4
|
+
/** Called with the colour as lowercase `#rrggbb`: as it's picked, or when
|
|
5
|
+
* typed text is read (on blur or Enter). Gets `null` when a `nullable`
|
|
6
|
+
* field is emptied. Text that isn't a hex colour shows an error instead. */
|
|
7
|
+
onChange: (value: string | null) => void;
|
|
8
|
+
/** The field may be left empty, giving `null`. Adds a Clear button while
|
|
9
|
+
* it holds a colour. */
|
|
10
|
+
nullable?: boolean;
|
|
11
|
+
/** The colour the picker starts from while the field is empty. Default
|
|
12
|
+
* `#0078d4`. */
|
|
13
|
+
fallbackColor?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function ColorPickerInput({ value, onChange, nullable, fallbackColor, }: ColorPickerInputProps): import("react").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=ColorPickerInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorPickerInput.d.ts","sourceRoot":"","sources":["../../src/components/ColorPickerInput.tsx"],"names":[],"mappings":"AAqEA,UAAU,qBAAqB;IAC7B,+DAA+D;IAC/D,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB;;iFAE6E;IAC7E,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACzC;6BACyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;qBACiB;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,QAAQ,EACR,QAAgB,EAChB,aAA6B,GAC9B,EAAE,qBAAqB,+BAoGvB"}
|