@apliteni/apliteni-ui 0.179.2 → 0.180.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/docs/components.md +16 -7
- package/guidelines/INDEX.md +1 -1
- package/guidelines/the-page.md +12 -0
- package/package.json +1 -1
- package/react/dist/index.d.ts +46 -11
- package/react/dist/index.js +45 -20
- package/src/styles/layout.css +6 -2
- package/src/styles/nav.css +14 -1
package/docs/components.md
CHANGED
|
@@ -140,7 +140,12 @@ account, and you give it the page content. Do not use it for a sign-in page. Use
|
|
|
140
140
|
```
|
|
141
141
|
|
|
142
142
|
`sections` lists the destinations, each with `href`, `label`, `icon` and an optional `count`.
|
|
143
|
-
|
|
143
|
+
A section can hold one level of sub-items in `items`, each with `href`, `label` and an optional
|
|
144
|
+
`count`. That section then opens its sub-items and is not a link itself. To sort the sections
|
|
145
|
+
under group labels instead, give `groups` in place of `sections`: each group has a `label` and its
|
|
146
|
+
`sections`, with no sub-items. A sidebar takes group labels or sub-items, never both, and the
|
|
147
|
+
types refuse the mix. The longest `href` that matches `pathname` is the current section or
|
|
148
|
+
sub-item. The current sub-item stays shown, and its parent row shows as current. `word` names the product, and
|
|
144
149
|
its default is `apliteni-ui`, so set it. `brand` replaces the mark, and `brandHref` is its link,
|
|
145
150
|
`/` by default.
|
|
146
151
|
|
|
@@ -166,13 +171,14 @@ Auto, Light and Dark.
|
|
|
166
171
|
- `searchLabel` gives the words and the accessible name of the search trigger, at every width.
|
|
167
172
|
Its default is "Search or run a command…". `searchShortLabel` is deprecated, and the shell does
|
|
168
173
|
not draw it.
|
|
169
|
-
- `palette` gives the command palette its groups. Without it, the palette lists the sections
|
|
174
|
+
- `palette` gives the command palette its groups. Without it, the palette lists the sections
|
|
175
|
+
under their group labels, or each sub-item with the name of its parent.
|
|
170
176
|
`onNavigate` sends a same-tab pick in the palette to your router, so the page changes without a
|
|
171
177
|
reload. If your `palette` sets its own `onNavigate`, the shell uses that one.
|
|
172
178
|
- `bandControl` stands under the sidebar head. `headControl` is one glyph control in the sidebar
|
|
173
179
|
head, before the fold button.
|
|
174
180
|
|
|
175
|
-
**Routing.** `renderLink` lets your router draw each section link.
|
|
181
|
+
**Routing.** `renderLink` lets your router draw each section and sub-item link.
|
|
176
182
|
|
|
177
183
|
**What the user sees.**
|
|
178
184
|
|
|
@@ -184,13 +190,14 @@ Auto, Light and Dark.
|
|
|
184
190
|
holds the brand mark, the page title on one line, the search trigger and a menu button. In the
|
|
185
191
|
rail layout, it holds only the menu button and the mark. The menu button opens the full section
|
|
186
192
|
list in a drawer. The drawer opens from the side of the menu button: the right in the topbar
|
|
187
|
-
layout and the left in the rail layout. `drawerSide` chooses the side in either layout.
|
|
193
|
+
layout and the left in the rail layout. `drawerSide` chooses the side in either layout. The
|
|
194
|
+
drawer keeps two or more group labels, and leaves out the label of one group. A press
|
|
188
195
|
on a section, Escape or a wider window closes the drawer, and the focus goes back to the menu
|
|
189
196
|
button.
|
|
190
197
|
- Below 560px each band control is a 40px glyph with no border. The search trigger shows only its
|
|
191
198
|
glyph, and keeps the same accessible name.
|
|
192
199
|
- The current section is one quiet fill behind its row. A row under the pointer has a lighter
|
|
193
|
-
fill. In the topbar layout, a shell with one
|
|
200
|
+
fill. In the topbar layout, a shell with one destination and no back link draws no sidebar, no fold
|
|
194
201
|
control and no menu button. The section stays in the command palette. The rail layout always
|
|
195
202
|
draws the rail.
|
|
196
203
|
- In the topbar layout, the theme switch applies the stored theme when the shell mounts, or
|
|
@@ -259,8 +266,10 @@ Use `SidebarNav` for a section list in a layout of your own. In a product page,
|
|
|
259
266
|
active="inv" />
|
|
260
267
|
```
|
|
261
268
|
|
|
262
|
-
It takes flat `items` or captioned `sections`,
|
|
263
|
-
stops at one level. A
|
|
269
|
+
It takes flat `items` or captioned `sections`, rows with sub-items, badges and `renderLink`.
|
|
270
|
+
Nesting stops at one level. A sidebar takes captions or sub-items, never both: the type refuses
|
|
271
|
+
the mix, and in development the component warns. When the current page comes into a group, the
|
|
272
|
+
group opens, and its row shows as current. A collapsed row keeps its name and its count.
|
|
264
273
|
|
|
265
274
|
### Top bar
|
|
266
275
|
|
package/guidelines/INDEX.md
CHANGED
|
@@ -4,7 +4,7 @@ Each row names one guideline page, the screen parts it covers, and when to read
|
|
|
4
4
|
|
|
5
5
|
| Page | Screen parts | When to read |
|
|
6
6
|
| --- | --- | --- |
|
|
7
|
-
| [The page](the-page.md) | The page shell, content width, headings, the main action, nested cards, table density and the page introduction. | Read it before you build any screen. |
|
|
7
|
+
| [The page](the-page.md) | The page shell, the sidebar's grouping, content width, headings, the main action, nested cards, table density and the page introduction. | Read it before you build any screen. |
|
|
8
8
|
| [Dashboards and reports](dashboards-and-reports.md) | Dashboard figures, trends and exceptions, report tables, chart cards and a report export. | Read it before you build a dashboard or a report. |
|
|
9
9
|
| [Destructive actions](destructive-actions.md) | Danger controls, action names and confirmation or undo. | Read it before you add a delete, revoke or remove action. |
|
|
10
10
|
| [Colour and theming](colour-and-theming.md) | Colour tokens, accents, signal colours, theme checks and forced colours. | Read it before you pick colours, accents or check contrast. |
|
package/guidelines/the-page.md
CHANGED
|
@@ -12,6 +12,18 @@
|
|
|
12
12
|
|
|
13
13
|
**Don't:** Move search or the account menu between pages.
|
|
14
14
|
|
|
15
|
+
## Group the sidebar one way
|
|
16
|
+
|
|
17
|
+
<!-- rule: sidebar -->
|
|
18
|
+
|
|
19
|
+
**Rule:** Give the sidebar group labels with no sub-items, or sub-items with no group labels, and never both.
|
|
20
|
+
|
|
21
|
+
**Why:** Both together make a long sidebar that scrolls, so the reader cannot see all the sections at once.
|
|
22
|
+
|
|
23
|
+
**Do:** Put Pending and History under Payouts, with no group labels.
|
|
24
|
+
|
|
25
|
+
**Don't:** Put Payouts and its sub-items under a Money label.
|
|
26
|
+
|
|
15
27
|
## Choose content width
|
|
16
28
|
|
|
17
29
|
<!-- rule: width -->
|
package/package.json
CHANGED
package/react/dist/index.d.ts
CHANGED
|
@@ -952,12 +952,34 @@ type ToastProps = {
|
|
|
952
952
|
declare function useToast(): (notice: ToastNotice) => void;
|
|
953
953
|
declare function Toast({ children, collapse }: ToastProps): react.JSX.Element;
|
|
954
954
|
|
|
955
|
-
|
|
955
|
+
/** A row that goes somewhere: a section, or a sub-item under one. */
|
|
956
|
+
type AppShellLink = {
|
|
956
957
|
href: string;
|
|
957
958
|
label: string;
|
|
958
|
-
icon
|
|
959
|
+
icon?: string;
|
|
959
960
|
count?: number;
|
|
960
961
|
};
|
|
962
|
+
type AppShellSection = AppShellLink & {
|
|
963
|
+
icon: string;
|
|
964
|
+
/** One level of sub-items. The row then opens them and goes nowhere itself, and its
|
|
965
|
+
* `href` only names it. Only in `sections`, never in `groups` (#843). */
|
|
966
|
+
items?: AppShellLink[];
|
|
967
|
+
};
|
|
968
|
+
/** A group label over sections with no sub-items (#843). */
|
|
969
|
+
type AppShellGroup = {
|
|
970
|
+
label: string;
|
|
971
|
+
sections: (AppShellSection & {
|
|
972
|
+
items?: never;
|
|
973
|
+
})[];
|
|
974
|
+
};
|
|
975
|
+
/** The sidebar takes group labels or sub-items, never both (#843). */
|
|
976
|
+
type AppShellNav = {
|
|
977
|
+
sections: AppShellSection[];
|
|
978
|
+
groups?: never;
|
|
979
|
+
} | {
|
|
980
|
+
groups: AppShellGroup[];
|
|
981
|
+
sections?: never;
|
|
982
|
+
};
|
|
961
983
|
/** A product's own row in the account menu, such as Account settings or Support (#736). */
|
|
962
984
|
type AppShellAccountItem = {
|
|
963
985
|
label: string;
|
|
@@ -965,14 +987,13 @@ type AppShellAccountItem = {
|
|
|
965
987
|
href?: string;
|
|
966
988
|
onSelect?: () => void;
|
|
967
989
|
};
|
|
968
|
-
type AppShellProps = {
|
|
969
|
-
sections: AppShellSection[];
|
|
990
|
+
type AppShellProps = AppShellNav & {
|
|
970
991
|
/** The vanilla rail layout, or the existing band layout. */
|
|
971
992
|
layout?: 'rail' | 'topbar';
|
|
972
993
|
/** The side the phone menu drawer opens from. By default it is the menu button's side:
|
|
973
994
|
* right in the topbar layout, left in the rail layout (#790). */
|
|
974
995
|
drawerSide?: 'left' | 'right';
|
|
975
|
-
/** Current router pathname; the longest matching section wins. */
|
|
996
|
+
/** Current router pathname; the longest matching section or sub-item wins. */
|
|
976
997
|
pathname: string;
|
|
977
998
|
title: string;
|
|
978
999
|
children?: ReactNode;
|
|
@@ -1012,9 +1033,9 @@ type AppShellProps = {
|
|
|
1012
1033
|
* can change the page without a reload. A palette's own `onNavigate` wins. */
|
|
1013
1034
|
onNavigate?: (href: string) => void;
|
|
1014
1035
|
/** Spread linkProps onto the router link, including children and onClick. */
|
|
1015
|
-
renderLink?: (section:
|
|
1036
|
+
renderLink?: (section: AppShellLink, linkProps: ComponentPropsWithoutRef<'a'>) => ReactNode;
|
|
1016
1037
|
};
|
|
1017
|
-
declare function AppShell({ sections, pathname, title, children, word, brand, layout, drawerSide, brandHref, width, back, lede, actions, tools, bandControl, headControl, account, accountItems, onSignOut, searchLabel, defaultCollapsed, palette, onNavigate, renderLink }: AppShellProps): react.JSX.Element;
|
|
1038
|
+
declare function AppShell({ sections, groups, pathname, title, children, word, brand, layout, drawerSide, brandHref, width, back, lede, actions, tools, bandControl, headControl, account, accountItems, onSignOut, searchLabel, defaultCollapsed, palette, onNavigate, renderLink }: AppShellProps): react.JSX.Element;
|
|
1018
1039
|
|
|
1019
1040
|
type AuthShellProps = Omit<HTMLAttributes<HTMLDivElement>, 'children'> & {
|
|
1020
1041
|
brand: ReactNode;
|
|
@@ -1310,13 +1331,27 @@ type SidebarNavItem = SidebarNavLeaf & {
|
|
|
1310
1331
|
items?: SidebarNavLeaf[];
|
|
1311
1332
|
defaultOpen?: boolean;
|
|
1312
1333
|
};
|
|
1313
|
-
|
|
1334
|
+
/** A row with no sub-items: the only row a section with a label takes. */
|
|
1335
|
+
type SidebarNavRow = SidebarNavLeaf & {
|
|
1336
|
+
items?: never;
|
|
1337
|
+
defaultOpen?: never;
|
|
1338
|
+
};
|
|
1339
|
+
/** Group labels over plain rows. */
|
|
1340
|
+
type SidebarNavGroup = {
|
|
1314
1341
|
label?: string;
|
|
1342
|
+
items: SidebarNavRow[];
|
|
1343
|
+
};
|
|
1344
|
+
/** Rows that may hold sub-items, under no group label. */
|
|
1345
|
+
type SidebarNavBlock = {
|
|
1346
|
+
label?: never;
|
|
1315
1347
|
items: SidebarNavItem[];
|
|
1316
1348
|
};
|
|
1349
|
+
type SidebarNavSection = SidebarNavGroup | SidebarNavBlock;
|
|
1350
|
+
/** A sidebar takes group labels or sub-items, never both (#843). */
|
|
1351
|
+
type SidebarNavSections = SidebarNavGroup[] | SidebarNavBlock[];
|
|
1317
1352
|
type SidebarNavProps = Omit<ComponentPropsWithoutRef<'nav'>, 'children'> & {
|
|
1318
1353
|
items?: SidebarNavItem[];
|
|
1319
|
-
sections?:
|
|
1354
|
+
sections?: SidebarNavSections;
|
|
1320
1355
|
active?: string;
|
|
1321
1356
|
activeIs?: 'page' | 'section';
|
|
1322
1357
|
collapsed?: boolean;
|
|
@@ -1326,7 +1361,7 @@ type SidebarNavProps = Omit<ComponentPropsWithoutRef<'nav'>, 'children'> & {
|
|
|
1326
1361
|
};
|
|
1327
1362
|
declare const SidebarNav: react.ForwardRefExoticComponent<Omit<Omit<react.DetailedHTMLProps<react.HTMLAttributes<HTMLElement>, HTMLElement>, "ref">, "children"> & {
|
|
1328
1363
|
items?: SidebarNavItem[];
|
|
1329
|
-
sections?:
|
|
1364
|
+
sections?: SidebarNavSections;
|
|
1330
1365
|
active?: string;
|
|
1331
1366
|
activeIs?: "page" | "section";
|
|
1332
1367
|
collapsed?: boolean;
|
|
@@ -1441,4 +1476,4 @@ declare const PAGE_SIZES: readonly number[];
|
|
|
1441
1476
|
declare const DEFAULT_PAGE_SIZE: number;
|
|
1442
1477
|
|
|
1443
1478
|
export { AccentPicker, AccountMenu, AccountWindow, AppShell, AuthShell, Avatar, BackLink, Badge, BusyRegion, Button, Callout, Card, Chart, CheckList, Checkbox, CommandPalette, Confirm, DEFAULT_PAGE_SIZE, DataTable, DatePicker, DeltaValue, Denied, Drawer, DrawerSection, Dropdown, EmptyState, Feedback, Field, FileDrop, FileField, FilterBar, Footer, Icon, KeyValueList, Modal, NavTabs, NumericValue, PAGE_SIZES, Pagination, Pill, RowIdentity, SearchField, Segmented, SelectField, SidebarNav, Skeleton, SkeletonTable, Snippet, StatBand, StatusDot, Success, SuccessCheck, SuccessPanel, Switch, THEME_INIT_SCRIPT, Tabs, TextArea, TextField, ThemeToggle, Timeline, Toast, Tooltip, TopBar, VersionSwitcher, ViewSwitch, sortTableRows, useToast };
|
|
1444
|
-
export type { Accent, AccentPickerProps, AccountMenuProps, AccountReader, AccountSection, AccountWindowProps, AddFilter, AppShellProps, AppShellSection, AuthShellProps, AvatarProps, BackLinkOwnProps, BackLinkProps, BusyRegionProps, ButtonLinkProps, ButtonProps, CalloutProps, CalloutVariant, ChartAreaLook, ChartBridgeStep, ChartBridgeTones, ChartDonutLook, ChartLineLook, ChartLookSeries, ChartPeriod, ChartProps, ChartSeries, ChartSlice, ChartStackedLook, ChartTone, CheckListProps, CheckboxProps, Column, CommandGroup, CommandItem, CommandPaletteProps, ConfirmProps, DataTableProps, DatePickerMode, DatePickerPreset, DatePickerProps, DatePickerRange, DeltaValueProps, DeniedProps, DrawerProps, DrawerSectionProps, DropdownAvatar, DropdownBadge, DropdownEntry, DropdownItem, DropdownProps, DropdownRowProps, DropdownSearch, DropdownSection, DropdownSeparator, EmptyStateProps, EmptyStateVariant, FeedbackPayload, FeedbackProps, FeedbackResult, FeedbackSection, FieldControlProps, FieldProps, FileDropFile, FileDropProps, FileDropStatus, FileFieldProps, Filter, FilterBarProps, FooterColumn, FooterLink, FooterProps, FooterSocial, KeyValueListProps, KeyValueRow, ModalProps, NativeButtonProps, NavTabBadge, NavTabItem, NavTabsProps, NumericValueProps, PaginationProps, PillProps, RowIdentityProps, SearchFieldProps, SegmentOption, SegmentedProps, SelectFieldProps, SidebarNavBadge, SidebarNavItem, SidebarNavLeaf, SidebarNavProps, SidebarNavSection, SkeletonProps, SkeletonTableProps, SnippetProps, StatBandProps, StatDelta, StatFigure, StatTone, StatVariant, StatusDotProps, SuccessCheckProps, SuccessCountdown, SuccessPanelProps, SuccessProps, SwitchProps, TabItem, TableSort, TabsProps, TextAreaProps, TextFieldProps, ThemeToggleProps, TimelineEvent, TimelineEventKind, TimelineProps, ToastNotice, ToastProps, TooltipProps, TopBarProps, Version, VersionSwitcherProps, ViewSwitchItem, ViewSwitchProps };
|
|
1479
|
+
export type { Accent, AccentPickerProps, AccountMenuProps, AccountReader, AccountSection, AccountWindowProps, AddFilter, AppShellGroup, AppShellLink, AppShellProps, AppShellSection, AuthShellProps, AvatarProps, BackLinkOwnProps, BackLinkProps, BusyRegionProps, ButtonLinkProps, ButtonProps, CalloutProps, CalloutVariant, ChartAreaLook, ChartBridgeStep, ChartBridgeTones, ChartDonutLook, ChartLineLook, ChartLookSeries, ChartPeriod, ChartProps, ChartSeries, ChartSlice, ChartStackedLook, ChartTone, CheckListProps, CheckboxProps, Column, CommandGroup, CommandItem, CommandPaletteProps, ConfirmProps, DataTableProps, DatePickerMode, DatePickerPreset, DatePickerProps, DatePickerRange, DeltaValueProps, DeniedProps, DrawerProps, DrawerSectionProps, DropdownAvatar, DropdownBadge, DropdownEntry, DropdownItem, DropdownProps, DropdownRowProps, DropdownSearch, DropdownSection, DropdownSeparator, EmptyStateProps, EmptyStateVariant, FeedbackPayload, FeedbackProps, FeedbackResult, FeedbackSection, FieldControlProps, FieldProps, FileDropFile, FileDropProps, FileDropStatus, FileFieldProps, Filter, FilterBarProps, FooterColumn, FooterLink, FooterProps, FooterSocial, KeyValueListProps, KeyValueRow, ModalProps, NativeButtonProps, NavTabBadge, NavTabItem, NavTabsProps, NumericValueProps, PaginationProps, PillProps, RowIdentityProps, SearchFieldProps, SegmentOption, SegmentedProps, SelectFieldProps, SidebarNavBadge, SidebarNavBlock, SidebarNavGroup, SidebarNavItem, SidebarNavLeaf, SidebarNavProps, SidebarNavRow, SidebarNavSection, SidebarNavSections, SkeletonProps, SkeletonTableProps, SnippetProps, StatBandProps, StatDelta, StatFigure, StatTone, StatVariant, StatusDotProps, SuccessCheckProps, SuccessCountdown, SuccessPanelProps, SuccessProps, SwitchProps, TabItem, TableSort, TabsProps, TextAreaProps, TextFieldProps, ThemeToggleProps, TimelineEvent, TimelineEventKind, TimelineProps, ToastNotice, ToastProps, TooltipProps, TopBarProps, Version, VersionSwitcherProps, ViewSwitchItem, ViewSwitchProps };
|
package/react/dist/index.js
CHANGED
|
@@ -1385,6 +1385,7 @@ var NavTabs = forwardRef6(function NavTabs2({
|
|
|
1385
1385
|
// src/SidebarNav.tsx
|
|
1386
1386
|
import { forwardRef as forwardRef7, useEffect as useEffect6, useId as useId6, useState as useState6 } from "react";
|
|
1387
1387
|
import { ENTRANCE_FALLBACK_MS } from "@apliteni/apliteni-ui/motion";
|
|
1388
|
+
import { safeUrl as safeUrl3 } from "@apliteni/apliteni-ui";
|
|
1388
1389
|
import { Fragment as Fragment9, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
1389
1390
|
var badgeText = (badge) => typeof badge === "object" ? badge.text : badge;
|
|
1390
1391
|
function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
@@ -1392,7 +1393,13 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
1392
1393
|
const group = !sub && !!item.items?.length;
|
|
1393
1394
|
const childActive = group && item.items.some((child) => child.id === active);
|
|
1394
1395
|
const [expanded, setExpanded] = useState6();
|
|
1395
|
-
const
|
|
1396
|
+
const here = childActive ? active : void 0;
|
|
1397
|
+
const [held, setHeld] = useState6(here);
|
|
1398
|
+
if (held !== here) {
|
|
1399
|
+
setHeld(here);
|
|
1400
|
+
if (here !== void 0) setExpanded(void 0);
|
|
1401
|
+
}
|
|
1402
|
+
const open = expanded ?? (childActive || !!item.defaultOpen);
|
|
1396
1403
|
const [entering, setEntering] = useState6(false);
|
|
1397
1404
|
useEffect6(() => {
|
|
1398
1405
|
if (!entering) return;
|
|
@@ -1438,12 +1445,19 @@ function Row({ item, active, activeIs, collapsed, renderLink, sub }) {
|
|
|
1438
1445
|
if (item.disabled) return /* @__PURE__ */ jsx17("li", { children: /* @__PURE__ */ jsx17("span", { ...common, role: "link", "aria-disabled": "true" }) });
|
|
1439
1446
|
const props = {
|
|
1440
1447
|
...common,
|
|
1441
|
-
href: item.href ?? `#${item.id}
|
|
1448
|
+
href: safeUrl3(item.href ?? `#${item.id}`),
|
|
1442
1449
|
target: item.target,
|
|
1443
1450
|
"aria-current": isActive ? activeIs === "section" ? "true" : "page" : void 0
|
|
1444
1451
|
};
|
|
1445
1452
|
return /* @__PURE__ */ jsx17("li", { children: renderLink ? renderLink(item, props) : /* @__PURE__ */ jsx17("a", { ...props }) });
|
|
1446
1453
|
}
|
|
1454
|
+
var development = () => {
|
|
1455
|
+
try {
|
|
1456
|
+
return process.env.NODE_ENV !== "production";
|
|
1457
|
+
} catch {
|
|
1458
|
+
return false;
|
|
1459
|
+
}
|
|
1460
|
+
};
|
|
1447
1461
|
function Section({ section, ...props }) {
|
|
1448
1462
|
const uid = useId6();
|
|
1449
1463
|
return /* @__PURE__ */ jsxs13("div", { className: "ui-nav__section", children: [
|
|
@@ -1463,6 +1477,10 @@ var SidebarNav = forwardRef7(function SidebarNav2({
|
|
|
1463
1477
|
"aria-label": label = "Sidebar",
|
|
1464
1478
|
...rest
|
|
1465
1479
|
}, ref) {
|
|
1480
|
+
const mixed = !!sections?.some((section) => section.label) && sections.some((section) => section.items.some((item) => item.items?.length));
|
|
1481
|
+
useEffect6(() => {
|
|
1482
|
+
if (mixed && development()) console.warn("SidebarNav: a sidebar takes group labels or sub-items, never both. Drop the labels or the sub-items.");
|
|
1483
|
+
}, [mixed]);
|
|
1466
1484
|
return /* @__PURE__ */ jsxs13("nav", { ...rest, ref, "aria-label": label, className: ["ui-nav", "ui-nav--side", collapsed && "is-collapsed", className].filter(Boolean).join(" "), children: [
|
|
1467
1485
|
(sections?.length ? sections : [{ items }]).map((section, index) => /* @__PURE__ */ jsx17(
|
|
1468
1486
|
Section,
|
|
@@ -1745,7 +1763,7 @@ function Drawer({
|
|
|
1745
1763
|
// src/CommandPalette.tsx
|
|
1746
1764
|
import { useCallback as useCallback3, useEffect as useEffect9, useId as useId10, useMemo as useMemo2, useRef as useRef11, useState as useState8 } from "react";
|
|
1747
1765
|
import { createPortal as createPortal5 } from "react-dom";
|
|
1748
|
-
import { rankGroups, icon as icon3 } from "@apliteni/apliteni-ui";
|
|
1766
|
+
import { rankGroups, icon as icon3, safeUrl as safeUrl4 } from "@apliteni/apliteni-ui";
|
|
1749
1767
|
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
1750
1768
|
var cx2 = (...a) => a.filter(Boolean).join(" ");
|
|
1751
1769
|
var Glyph = ({ name, className }) => /* @__PURE__ */ jsx21("span", { className, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon3(name) } });
|
|
@@ -1795,9 +1813,11 @@ function CommandPalette({
|
|
|
1795
1813
|
}
|
|
1796
1814
|
onClose();
|
|
1797
1815
|
if (!item.href) return;
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1816
|
+
const href = safeUrl4(item.href, "");
|
|
1817
|
+
if (!href) return;
|
|
1818
|
+
if (newTab) window.open(href, "_blank", "noopener");
|
|
1819
|
+
else if (onNavigate) onNavigate(href);
|
|
1820
|
+
else window.location.href = href;
|
|
1801
1821
|
}, [onClose, onSelect, onNavigate]);
|
|
1802
1822
|
const onKeyDown = (e) => {
|
|
1803
1823
|
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
@@ -5020,6 +5040,7 @@ import { Fragment as Fragment19, jsx as jsx41, jsxs as jsxs37 } from "react/jsx-
|
|
|
5020
5040
|
var path = (value) => value.split(/[?#]/)[0].replace(/\/+$/, "") || "/";
|
|
5021
5041
|
function AppShell({
|
|
5022
5042
|
sections,
|
|
5043
|
+
groups,
|
|
5023
5044
|
pathname,
|
|
5024
5045
|
title,
|
|
5025
5046
|
children,
|
|
@@ -5053,8 +5074,10 @@ function AppShell({
|
|
|
5053
5074
|
const firstRow = useMemo5(() => ({ get current() {
|
|
5054
5075
|
return menuBody.current?.querySelector(".ui-nav__item") ?? null;
|
|
5055
5076
|
} }), []);
|
|
5077
|
+
const rows = groups ? groups.flatMap((group) => group.sections) : sections;
|
|
5078
|
+
const links = rows.flatMap((row2) => row2.items?.length ? row2.items : [row2]);
|
|
5056
5079
|
const current = path(pathname);
|
|
5057
|
-
const active =
|
|
5080
|
+
const active = links.filter((link) => current === path(link.href) || path(link.href) !== "/" && current.startsWith(`${path(link.href)}/`)).sort((a, b) => path(b.href).length - path(a.href).length)[0];
|
|
5058
5081
|
useEffect19(() => {
|
|
5059
5082
|
setCollapsed(railCollapsed() ?? defaultCollapsed);
|
|
5060
5083
|
}, [defaultCollapsed]);
|
|
@@ -5088,15 +5111,17 @@ function AppShell({
|
|
|
5088
5111
|
setCollapsed(next);
|
|
5089
5112
|
storeRailCollapsed(next);
|
|
5090
5113
|
};
|
|
5114
|
+
const row = ({ href, label, icon: icon9, count }) => ({ id: href, href, label, icon: icon9, badge: layout === "rail" ? void 0 : count });
|
|
5115
|
+
const nav = groups ? groups.map((group) => ({ label: group.label, items: group.sections.map(row) })) : [{ items: sections.map((section) => ({ ...row(section), items: section.items?.map(row) })) }];
|
|
5091
5116
|
const sidebar = (label) => /* @__PURE__ */ jsx41(
|
|
5092
5117
|
SidebarNav,
|
|
5093
5118
|
{
|
|
5094
5119
|
"aria-label": label,
|
|
5095
|
-
|
|
5120
|
+
sections: nav,
|
|
5096
5121
|
active: active?.href,
|
|
5097
5122
|
activeIs: back ? "section" : "page",
|
|
5098
5123
|
renderLink: (item, props) => {
|
|
5099
|
-
const section =
|
|
5124
|
+
const section = links.find((link) => link.href === item.id);
|
|
5100
5125
|
const linkProps = { ...props, onClick: (event) => {
|
|
5101
5126
|
if (!event.metaKey && !event.ctrlKey && !event.shiftKey && !event.altKey) setMenu(false);
|
|
5102
5127
|
} };
|
|
@@ -5105,7 +5130,7 @@ function AppShell({
|
|
|
5105
5130
|
}
|
|
5106
5131
|
);
|
|
5107
5132
|
const foldLabel = collapsed ? "Expand sidebar" : "Collapse sidebar";
|
|
5108
|
-
const navigable =
|
|
5133
|
+
const navigable = links.length > 1 || Boolean(back);
|
|
5109
5134
|
const lockup = /* @__PURE__ */ jsxs37("a", { className: "ui-app__brand", href: brandHref, "aria-label": word, children: [
|
|
5110
5135
|
brand ?? /* @__PURE__ */ jsx41("i", { "aria-hidden": "true", className: "ui-react-app__mark", dangerouslySetInnerHTML: { __html: prism(uid, 24) } }),
|
|
5111
5136
|
/* @__PURE__ */ jsx41("span", { children: word })
|
|
@@ -5278,7 +5303,7 @@ function AppShell({
|
|
|
5278
5303
|
] })
|
|
5279
5304
|
}
|
|
5280
5305
|
),
|
|
5281
|
-
/* @__PURE__ */ jsx41(CommandPalette, { ...palette ?? { groups:
|
|
5306
|
+
/* @__PURE__ */ jsx41(CommandPalette, { ...palette ?? { groups: groups ? groups.map((group) => ({ label: group.label, items: group.sections.map(({ href, label, icon: icon9 }) => ({ id: href, href, label, icon: icon9 })) })) : [{ items: sections.flatMap((section) => section.items?.length ? section.items.map(({ href, label, icon: icon9 }) => ({ id: href, href, label, icon: icon9 ?? section.icon, description: section.label })) : [{ id: section.href, href: section.href, label: section.label, icon: section.icon }]) }] }, onNavigate: palette?.onNavigate ?? onNavigate, open: search, onClose: () => setSearch(false) })
|
|
5282
5307
|
] });
|
|
5283
5308
|
}
|
|
5284
5309
|
|
|
@@ -5294,7 +5319,7 @@ var AuthShell = forwardRef10(function AuthShell2({ brand, children, className, .
|
|
|
5294
5319
|
|
|
5295
5320
|
// src/Footer.tsx
|
|
5296
5321
|
import { useId as useId15 } from "react";
|
|
5297
|
-
import { prism as prism2, safeUrl as
|
|
5322
|
+
import { prism as prism2, safeUrl as safeUrl5 } from "@apliteni/apliteni-ui";
|
|
5298
5323
|
import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
5299
5324
|
var SOCIAL_GLYPHS = {
|
|
5300
5325
|
github: '<path d="M12 2a10 10 0 0 0-3.16 19.49c.5.09.68-.22.68-.48v-1.7c-2.78.6-3.37-1.34-3.37-1.34-.45-1.16-1.11-1.47-1.11-1.47-.9-.62.07-.6.07-.6 1 .07 1.53 1.03 1.53 1.03.9 1.53 2.34 1.09 2.91.83.09-.65.35-1.09.63-1.34-2.22-.25-4.55-1.11-4.55-4.94 0-1.09.39-1.98 1.03-2.68-.1-.25-.45-1.27.1-2.64 0 0 .84-.27 2.75 1.02a9.5 9.5 0 0 1 5 0c1.91-1.29 2.75-1.02 2.75-1.02.55 1.37.2 2.39.1 2.64.64.7 1.03 1.59 1.03 2.68 0 3.84-2.34 4.68-4.57 4.93.36.31.68.92.68 1.85v2.74c0 .27.18.58.69.48A10 10 0 0 0 12 2z"/>',
|
|
@@ -5306,7 +5331,7 @@ var escapeText = (t) => t.replace(/&/g, "&").replace(/</g, "<").replace(/
|
|
|
5306
5331
|
function Legal({ legal, legalLinks, switcher }) {
|
|
5307
5332
|
return /* @__PURE__ */ jsxs39("div", { className: "ui-footer__bar", children: [
|
|
5308
5333
|
/* @__PURE__ */ jsx43("span", { className: "ui-footer__legal", children: legal }),
|
|
5309
|
-
legalLinks && legalLinks.length > 0 && /* @__PURE__ */ jsx43("nav", { className: "ui-footer__legal-links", "aria-label": "Legal", children: legalLinks.map(({ label, href: to }) => /* @__PURE__ */ jsx43("a", { href:
|
|
5334
|
+
legalLinks && legalLinks.length > 0 && /* @__PURE__ */ jsx43("nav", { className: "ui-footer__legal-links", "aria-label": "Legal", children: legalLinks.map(({ label, href: to }) => /* @__PURE__ */ jsx43("a", { href: safeUrl5(to ?? "#"), children: label }, label)) }),
|
|
5310
5335
|
switcher ? /* @__PURE__ */ jsx43("div", { className: "ui-footer__switcher", children: switcher }) : null
|
|
5311
5336
|
] });
|
|
5312
5337
|
}
|
|
@@ -5336,7 +5361,7 @@ function Footer({
|
|
|
5336
5361
|
"a",
|
|
5337
5362
|
{
|
|
5338
5363
|
className: "brand",
|
|
5339
|
-
href:
|
|
5364
|
+
href: safeUrl5(brandHref),
|
|
5340
5365
|
"aria-label": `Apliteni ${word}`,
|
|
5341
5366
|
dangerouslySetInnerHTML: { __html: `${mark}<span>${escapeText(word)}</span>` }
|
|
5342
5367
|
}
|
|
@@ -5350,12 +5375,12 @@ function Footer({
|
|
|
5350
5375
|
const markup = SOCIAL_GLYPHS[icon9];
|
|
5351
5376
|
const fill = icon9 === "mail" ? "none" : "currentColor";
|
|
5352
5377
|
const viewBox = icon9 === "linkedin" ? "0 0 448 512" : "0 0 24 24";
|
|
5353
|
-
return /* @__PURE__ */ jsx43("a", { className: "ui-footer__social", href:
|
|
5378
|
+
return /* @__PURE__ */ jsx43("a", { className: "ui-footer__social", href: safeUrl5(to ?? "#"), "aria-label": label, children: /* @__PURE__ */ jsx43("svg", { viewBox, fill, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: markup } }) }, label);
|
|
5354
5379
|
}) })
|
|
5355
5380
|
] }),
|
|
5356
5381
|
(links || columns.length > 0) && /* @__PURE__ */ jsx43("nav", { className: "ui-footer__nav", "aria-label": "Footer", children: links ?? columns.map(({ title, links: columnLinks }, i) => /* @__PURE__ */ jsxs39("div", { className: "ui-footer__col", children: [
|
|
5357
5382
|
title && /* @__PURE__ */ jsx43("h2", { className: "ui-footer__col-title", children: title }),
|
|
5358
|
-
/* @__PURE__ */ jsx43("ul", { className: "ui-footer__links", children: columnLinks.map(({ label, href: to, target }) => /* @__PURE__ */ jsx43("li", { children: /* @__PURE__ */ jsx43("a", { href:
|
|
5383
|
+
/* @__PURE__ */ jsx43("ul", { className: "ui-footer__links", children: columnLinks.map(({ label, href: to, target }) => /* @__PURE__ */ jsx43("li", { children: /* @__PURE__ */ jsx43("a", { href: safeUrl5(to ?? "#"), target, rel: target ? "noreferrer" : void 0, children: label }) }, label)) })
|
|
5359
5384
|
] }, title ?? i)) })
|
|
5360
5385
|
] }),
|
|
5361
5386
|
bar
|
|
@@ -6930,7 +6955,7 @@ var AccentPicker = forwardRef12(function AccentPicker2({
|
|
|
6930
6955
|
|
|
6931
6956
|
// src/TopBar.tsx
|
|
6932
6957
|
import { Fragment as Fragment22 } from "react";
|
|
6933
|
-
import { prism as prism3, safeUrl as
|
|
6958
|
+
import { prism as prism3, safeUrl as safeUrl6, icon as icon8, ACCOUNT_NAV } from "@apliteni/apliteni-ui";
|
|
6934
6959
|
import { Fragment as Fragment23, jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
6935
6960
|
function TopBar({
|
|
6936
6961
|
brand,
|
|
@@ -6944,7 +6969,7 @@ function TopBar({
|
|
|
6944
6969
|
...rest
|
|
6945
6970
|
}) {
|
|
6946
6971
|
return /* @__PURE__ */ jsx48("header", { ...rest, className: ["topbar", className].filter(Boolean).join(" "), children: /* @__PURE__ */ jsxs43("div", { className: "topbar__in", children: [
|
|
6947
|
-
brand ?? /* @__PURE__ */ jsxs43("a", { className: "brand", href:
|
|
6972
|
+
brand ?? /* @__PURE__ */ jsxs43("a", { className: "brand", href: safeUrl6(brandHref), "aria-label": `Apliteni ${word}`, children: [
|
|
6948
6973
|
/* @__PURE__ */ jsx48("span", { "aria-hidden": "true", dangerouslySetInnerHTML: { __html: prism3("tb-mark", 22) } }),
|
|
6949
6974
|
/* @__PURE__ */ jsx48("span", { children: word })
|
|
6950
6975
|
] }),
|
|
@@ -6960,7 +6985,7 @@ function ViewSwitch({ items, active, label = "View", renderLink }) {
|
|
|
6960
6985
|
const current = item.id === active;
|
|
6961
6986
|
const linkProps = {
|
|
6962
6987
|
className: current ? "cur" : void 0,
|
|
6963
|
-
href:
|
|
6988
|
+
href: safeUrl6(item.href || `#${item.id}`),
|
|
6964
6989
|
target: item.target,
|
|
6965
6990
|
"aria-current": current ? "page" : void 0,
|
|
6966
6991
|
children: item.label
|
|
@@ -7047,7 +7072,7 @@ function AccountMenu2({
|
|
|
7047
7072
|
"a",
|
|
7048
7073
|
{
|
|
7049
7074
|
...props,
|
|
7050
|
-
href: item.disabled ? void 0 : item.href ?
|
|
7075
|
+
href: item.disabled ? void 0 : item.href ? safeUrl6(item.href) : item.value === "sign-out" && onSignOut ? void 0 : safeUrl6(item.value === "sign-out" ? "#logout" : `#${item.value}`),
|
|
7051
7076
|
className: [props.className, !item.disabled && item.value === current && "cur", item.value === "sign-out" && "aout"].filter(Boolean).join(" "),
|
|
7052
7077
|
children: [
|
|
7053
7078
|
item.icon && /* @__PURE__ */ jsx48("span", { "aria-hidden": "true", dangerouslySetInnerHTML: { __html: icon8(item.icon) } }),
|
package/src/styles/layout.css
CHANGED
|
@@ -535,8 +535,8 @@
|
|
|
535
535
|
starts at the panel's edge like the rows above it. */
|
|
536
536
|
.ui-app__drawer .ui-nav--side,
|
|
537
537
|
.ui-app__drawer .ui-nav--side > * { width: 100%; }
|
|
538
|
-
/* The panel's title names
|
|
539
|
-
.ui-app__drawer .ui-nav__cap { display: none; }
|
|
538
|
+
/* The panel's title names one section's list, so its caption stays out; group labels stay (#843). */
|
|
539
|
+
.ui-app__drawer .ui-nav--side:not(:has(> .ui-nav__section + .ui-nav__section)) .ui-nav__cap { display: none; }
|
|
540
540
|
.ui-app__drawer .ui-drawer__footer { justify-content: flex-start; }
|
|
541
541
|
.ui-app__drawer .ui-app__user { width: 100%; }
|
|
542
542
|
/* A finger is the only pointer this width has, so a row and the account block are
|
|
@@ -771,3 +771,7 @@
|
|
|
771
771
|
forced-color-adjust: auto; background: Canvas; color: CanvasText; border-color: CanvasText;
|
|
772
772
|
}
|
|
773
773
|
}
|
|
774
|
+
|
|
775
|
+
/* A folded sub-row has no glyph, so its floating name took the row's only line box with it
|
|
776
|
+
and the row shrank under the pointer. It keeps one line and its padding (#843). */
|
|
777
|
+
:where(.ui-app.is-collapsed) .ui-app__rail .ui-nav__item:not(:has(.ui-nav__ic)) { min-height: calc(1lh + 18px); /* one line plus the row's 9px padding, top and bottom */ }
|
package/src/styles/nav.css
CHANGED
|
@@ -411,7 +411,7 @@
|
|
|
411
411
|
forced-color-adjust: none;
|
|
412
412
|
background: Highlight !important;
|
|
413
413
|
color: HighlightText !important;
|
|
414
|
-
--ring: var(--ring-width) solid CanvasText;
|
|
414
|
+
--ring: var(--ring-width) solid CanvasText; --ring-scroll: var(--ring); /* the row draws --ring-scroll, which the root resolved (#843) */
|
|
415
415
|
}
|
|
416
416
|
.ui-nav__item.is-active:not(.is-disabled) .ui-nav__ic svg,
|
|
417
417
|
.ui-nav__item.is-current:not(.is-disabled) .ui-nav__ic svg,
|
|
@@ -454,3 +454,16 @@
|
|
|
454
454
|
/* The fill is the one mark, so the underline bar, which would paint the accent inside it, is gone. */
|
|
455
455
|
.ui-nav--tabs.is-underline .ui-nav__tab.is-active::after { display: none; /* motion: still — the bar is not drawn while the fill marks the tab */ }
|
|
456
456
|
}
|
|
457
|
+
|
|
458
|
+
/* The parent of the current sub-item takes the current row's ink and weight, so the place
|
|
459
|
+
shows while its list is closed. In the folded rail its full-ink glyph is the mark (#843). */
|
|
460
|
+
.ui-nav__toggle.is-current { color: var(--strong); font-weight: 500; }
|
|
461
|
+
|
|
462
|
+
/* In forced colours a background becomes the canvas, so a folded sub-row's dot vanished.
|
|
463
|
+
A border keeps it: the engine paints it in the text colour, and a filled current row,
|
|
464
|
+
which opts out of the forced palette, keeps its own ink. The second selector is the
|
|
465
|
+
shell's folded rail, which layout.css marks on .ui-app (#843). */
|
|
466
|
+
@media (forced-colors: active) {
|
|
467
|
+
.ui-nav--side.is-collapsed .ui-nav__item:not(:has(.ui-nav__ic))::after,
|
|
468
|
+
:where(.ui-app.is-collapsed) .ui-app__rail .ui-nav__item:not(:has(.ui-nav__ic))::after { box-sizing: border-box; background: none; border: 2.5px solid currentColor; }
|
|
469
|
+
}
|