@seanyeh77/ui 0.45.0 → 0.47.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/dist/bundle.js +19 -19
- package/dist/components/Alert/Alert.d.ts +2 -1
- package/dist/components/Alert/Alert.js +15 -17
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/AppShell/AppShell.d.ts +3 -3
- package/dist/components/AppShell/AppShell.js +9 -10
- package/dist/components/AppShell/AppShell.js.map +1 -1
- package/dist/components/Badge/Badge.d.ts +4 -4
- package/dist/components/Badge/Badge.js +7 -1
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.js +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/Calendar/Calendar.js +6 -2
- package/dist/components/Calendar/Calendar.js.map +1 -1
- package/dist/components/ConsoleLayout/ConsoleLayout.js +15 -12
- package/dist/components/ConsoleLayout/ConsoleLayout.js.map +1 -1
- package/dist/components/DataTable/DataTable.d.ts +8 -0
- package/dist/components/DataTable/DataTable.js +188 -34
- package/dist/components/DataTable/DataTable.js.map +1 -1
- package/dist/components/DataTable/filters.js +10 -4
- package/dist/components/DataTable/filters.js.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +1 -0
- package/dist/components/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/DateRangePicker/DateRangePicker.js +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.js.map +1 -1
- package/dist/components/DetailList/DetailList.d.ts +8 -1
- package/dist/components/DetailList/DetailList.js +16 -2
- package/dist/components/DetailList/DetailList.js.map +1 -1
- package/dist/components/EmptyState/EmptyState.js +19 -1
- package/dist/components/EmptyState/EmptyState.js.map +1 -1
- package/dist/components/EventTimeline/EventTimeline.js +6 -3
- package/dist/components/EventTimeline/EventTimeline.js.map +1 -1
- package/dist/components/FileUpload/FileUpload.js +2 -2
- package/dist/components/FileUpload/FileUpload.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +5 -2
- package/dist/components/Grid/Grid.js +4 -3
- package/dist/components/Grid/Grid.js.map +1 -1
- package/dist/components/InlineCode/InlineCode.js +7 -6
- package/dist/components/InlineCode/InlineCode.js.map +1 -1
- package/dist/components/KpiCard/KpiCard.d.ts +6 -4
- package/dist/components/KpiCard/KpiCard.js +6 -12
- package/dist/components/KpiCard/KpiCard.js.map +1 -1
- package/dist/components/LayerGraph/LayerGraph.js +47 -13
- package/dist/components/LayerGraph/LayerGraph.js.map +1 -1
- package/dist/components/MultiSelect/MultiSelect.js +73 -45
- package/dist/components/MultiSelect/MultiSelect.js.map +1 -1
- package/dist/components/NotificationBell/NotificationBell.d.ts +6 -3
- package/dist/components/NotificationBell/NotificationBell.js +14 -3
- package/dist/components/NotificationBell/NotificationBell.js.map +1 -1
- package/dist/components/PageHeader/PageHeader.d.ts +3 -2
- package/dist/components/PageHeader/PageHeader.js +10 -1
- package/dist/components/PageHeader/PageHeader.js.map +1 -1
- package/dist/components/RelativeTime/RelativeTime.js +4 -3
- package/dist/components/RelativeTime/RelativeTime.js.map +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/SettingsLayout/SettingsLayout.d.ts +6 -4
- package/dist/components/SettingsLayout/SettingsLayout.js +38 -11
- package/dist/components/SettingsLayout/SettingsLayout.js.map +1 -1
- package/dist/components/SideNav/SideNav.d.ts +10 -5
- package/dist/components/SideNav/SideNav.js +10 -6
- package/dist/components/SideNav/SideNav.js.map +1 -1
- package/dist/components/SplitPane/SplitPane.d.ts +2 -2
- package/dist/components/SplitPane/SplitPane.js +29 -9
- package/dist/components/SplitPane/SplitPane.js.map +1 -1
- package/dist/components/TextField/TextField.d.ts +8 -2
- package/dist/components/TextField/TextField.js +59 -13
- package/dist/components/TextField/TextField.js.map +1 -1
- package/dist/components/TopBar/TopBar.d.ts +2 -2
- package/dist/components/TopBar/TopBar.js.map +1 -1
- package/dist/components/Workbench/Workbench.d.ts +8 -5
- package/dist/components/Workbench/Workbench.js +184 -157
- package/dist/components/Workbench/Workbench.js.map +1 -1
- package/dist/components/ZoneMap/ZoneMap.js +4 -4
- package/dist/components/ZoneMap/ZoneMap.js.map +1 -1
- package/dist/components/useFormErrors/useFormErrors.d.ts +5 -2
- package/dist/components/useFormErrors/useFormErrors.js +10 -4
- package/dist/components/useFormErrors/useFormErrors.js.map +1 -1
- package/dist/css/AccentPicker.css +19 -0
- package/dist/css/Alert.css +30 -7
- package/dist/css/AppShell.css +12 -0
- package/dist/css/Calendar.css +7 -0
- package/dist/css/ConsoleLayout.css +3 -0
- package/dist/css/DataTable.css +70 -8
- package/dist/css/DetailList.css +11 -0
- package/dist/css/EmptyState.css +8 -0
- package/dist/css/EventTimeline.css +11 -4
- package/dist/css/Grid.css +15 -0
- package/dist/css/KpiCard.css +1 -0
- package/dist/css/LayerGraph.css +1 -1
- package/dist/css/LoadingBar.css +4 -1
- package/dist/css/LoginCard.css +1 -1
- package/dist/css/MobileTabBar.css +6 -4
- package/dist/css/MultiSelect.css +23 -3
- package/dist/css/Select.css +9 -0
- package/dist/css/SettingsLayout.css +29 -14
- package/dist/css/Tabs.css +36 -17
- package/dist/css/Toast.css +7 -0
- package/dist/css/TopBar.css +6 -3
- package/dist/css/Workbench.css +10 -5
- package/dist/css/base.css +90 -3
- package/dist/css/end.css +5 -2
- package/dist/fonts-latin.css +2 -0
- package/dist/fonts-tc.css +2 -0
- package/dist/format.d.ts +4 -3
- package/dist/format.js +13 -12
- package/dist/format.js.map +1 -1
- package/dist/i18n.js +17 -6
- package/dist/i18n.js.map +1 -1
- package/dist/icons/Icon.d.ts +2 -1
- package/dist/icons/Icon.js +4 -3
- package/dist/icons/Icon.js.map +1 -1
- package/dist/icons/all.js +23 -1
- package/dist/icons/all.js.map +1 -1
- package/dist/icons/names.d.ts +22 -0
- package/dist/icons/names.js +11 -0
- package/dist/icons/names.js.map +1 -1
- package/dist/icons/ph/credit-card.d.ts +10 -0
- package/dist/icons/ph/credit-card.js +11 -0
- package/dist/icons/ph/credit-card.js.map +1 -0
- package/dist/icons/ph/map-pin.d.ts +10 -0
- package/dist/icons/ph/map-pin.js +11 -0
- package/dist/icons/ph/map-pin.js.map +1 -0
- package/dist/icons/ph/package.d.ts +10 -0
- package/dist/icons/ph/package.js +11 -0
- package/dist/icons/ph/package.js.map +1 -0
- package/dist/icons/ph/pause.d.ts +10 -0
- package/dist/icons/ph/pause.js +11 -0
- package/dist/icons/ph/pause.js.map +1 -0
- package/dist/icons/ph/phone.d.ts +10 -0
- package/dist/icons/ph/phone.js +11 -0
- package/dist/icons/ph/phone.js.map +1 -0
- package/dist/icons/ph/play.d.ts +10 -0
- package/dist/icons/ph/play.js +11 -0
- package/dist/icons/ph/play.js.map +1 -0
- package/dist/icons/ph/prohibit.d.ts +10 -0
- package/dist/icons/ph/prohibit.js +11 -0
- package/dist/icons/ph/prohibit.js.map +1 -0
- package/dist/icons/ph/receipt.d.ts +10 -0
- package/dist/icons/ph/receipt.js +11 -0
- package/dist/icons/ph/receipt.js.map +1 -0
- package/dist/icons/ph/shopping-cart.d.ts +10 -0
- package/dist/icons/ph/shopping-cart.js +11 -0
- package/dist/icons/ph/shopping-cart.js.map +1 -0
- package/dist/icons/ph/storefront.d.ts +10 -0
- package/dist/icons/ph/storefront.js +11 -0
- package/dist/icons/ph/storefront.js.map +1 -0
- package/dist/icons/ph/truck.d.ts +10 -0
- package/dist/icons/ph/truck.js +11 -0
- package/dist/icons/ph/truck.js.map +1 -0
- package/dist/icons/store.d.ts +3 -1
- package/dist/icons/store.js +17 -12
- package/dist/icons/store.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/internal/FloatingPanel.js +5 -2
- package/dist/internal/FloatingPanel.js.map +1 -1
- package/dist/internal/clickSteps.js +11 -0
- package/dist/internal/clickSteps.js.map +1 -0
- package/dist/internal/util.js +7 -1
- package/dist/internal/util.js.map +1 -1
- package/dist/styles.css +499 -162
- package/dist/theme.d.ts +7 -0
- package/dist/theme.js +39 -15
- package/dist/theme.js.map +1 -1
- package/docs/Alert.md +1 -1
- package/docs/AppShell.md +4 -4
- package/docs/Badge.md +2 -1
- package/docs/BarChart.md +1 -1
- package/docs/Checkbox.md +2 -2
- package/docs/CodeView.md +12 -22
- package/docs/ConsoleLayout.md +1 -0
- package/docs/DataTable.md +16 -11
- package/docs/DatePicker.md +1 -1
- package/docs/DateRangePicker.md +1 -0
- package/docs/DetailList.md +12 -1
- package/docs/Drawer.md +1 -1
- package/docs/EmptyState.md +1 -0
- package/docs/EventTimeline.md +1 -1
- package/docs/Format.md +2 -1
- package/docs/Graph.md +1 -0
- package/docs/Grid.md +9 -0
- package/docs/KpiCard.md +5 -4
- package/docs/LoadingBar.md +1 -1
- package/docs/LoginCard.md +1 -1
- package/docs/Markdown.md +4 -37
- package/docs/MobileTabBar.md +1 -1
- package/docs/MultiSelect.md +3 -2
- package/docs/NotificationBell.md +2 -2
- package/docs/PageHeader.md +2 -1
- package/docs/RadioGroup.md +1 -1
- package/docs/RelativeTime.md +2 -2
- package/docs/SettingsLayout.md +5 -4
- package/docs/SideNav.md +2 -1
- package/docs/Skeleton.md +2 -2
- package/docs/SplitPane.md +3 -9
- package/docs/Tabs.md +14 -11
- package/docs/Tag.md +4 -3
- package/docs/TextField.md +2 -0
- package/docs/Toast.md +1 -1
- package/docs/TopBar.md +2 -2
- package/docs/Workbench.md +9 -6
- package/docs/agents.md +13 -13
- package/docs/data.md +2 -1
- package/docs/guidelines.md +4 -4
- package/docs/icons.md +2 -2
- package/docs/layout.md +3 -3
- package/docs/theme.md +6 -3
- package/docs/useFormErrors.md +2 -1
- package/package.json +4 -2
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/icons/ph/truck.ts
|
|
3
|
+
/** Phosphor truck: regular and fill. */
|
|
4
|
+
var truck_default = {
|
|
5
|
+
n: "truck",
|
|
6
|
+
r: "<path d=\"M255.42,117l-14-35A15.93,15.93,0,0,0,226.58,72H192V64a8,8,0,0,0-8-8H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H49a32,32,0,0,0,62,0h50a32,32,0,0,0,62,0h17a16,16,0,0,0,16-16V120A7.94,7.94,0,0,0,255.42,117ZM192,88h34.58l9.6,24H192ZM32,72H176v64H32ZM80,208a16,16,0,1,1,16-16A16,16,0,0,1,80,208Zm81-24H111a32,32,0,0,0-62,0H32V152H176v12.31A32.11,32.11,0,0,0,161,184Zm31,24a16,16,0,1,1,16-16A16,16,0,0,1,192,208Zm48-24H223a32.06,32.06,0,0,0-31-24V128h48Z\"/>",
|
|
7
|
+
f: "<path d=\"M255.43,117l-14-35A15.93,15.93,0,0,0,226.58,72H192V64a8,8,0,0,0-8-8H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H49a32,32,0,0,0,62,0h50a32,32,0,0,0,62,0h17a16,16,0,0,0,16-16V120A8.13,8.13,0,0,0,255.43,117ZM80,208a16,16,0,1,1,16-16A16,16,0,0,1,80,208ZM32,136V72H176v64Zm160,72a16,16,0,1,1,16-16A16,16,0,0,1,192,208Zm0-96V88h34.58l9.6,24Z\"/>"
|
|
8
|
+
};
|
|
9
|
+
export { truck_default as default };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=truck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"truck.js","names":[],"sources":["../../../src/icons/ph/truck.ts"],"sourcesContent":["import type { IconGlyph } from '../glyph';\n\n/** Phosphor truck: regular and fill. */\nexport default {\n n: 'truck',\n r: '<path d=\"M255.42,117l-14-35A15.93,15.93,0,0,0,226.58,72H192V64a8,8,0,0,0-8-8H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H49a32,32,0,0,0,62,0h50a32,32,0,0,0,62,0h17a16,16,0,0,0,16-16V120A7.94,7.94,0,0,0,255.42,117ZM192,88h34.58l9.6,24H192ZM32,72H176v64H32ZM80,208a16,16,0,1,1,16-16A16,16,0,0,1,80,208Zm81-24H111a32,32,0,0,0-62,0H32V152H176v12.31A32.11,32.11,0,0,0,161,184Zm31,24a16,16,0,1,1,16-16A16,16,0,0,1,192,208Zm48-24H223a32.06,32.06,0,0,0-31-24V128h48Z\"/>',\n f: '<path d=\"M255.43,117l-14-35A15.93,15.93,0,0,0,226.58,72H192V64a8,8,0,0,0-8-8H32A16,16,0,0,0,16,72V184a16,16,0,0,0,16,16H49a32,32,0,0,0,62,0h50a32,32,0,0,0,62,0h17a16,16,0,0,0,16-16V120A8.13,8.13,0,0,0,255.43,117ZM80,208a16,16,0,1,1,16-16A16,16,0,0,1,80,208ZM32,136V72H176v64Zm160,72a16,16,0,1,1,16-16A16,16,0,0,1,192,208Zm0-96V88h34.58l9.6,24Z\"/>',\n} as const satisfies IconGlyph;\n"],"mappings":";;;AAGA,IAAA,gBAAe;CACb,GAAG;CACH,GAAG;CACH,GAAG;AACL"}
|
package/dist/icons/store.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { IconName } from "./names.js";
|
|
2
2
|
/**
|
|
3
3
|
* Loads icons before they are shown, e.g. the icons above the fold before the first render, so they appear in the first
|
|
4
|
-
* paint instead of a frame later.
|
|
4
|
+
* paint instead of a frame later. Preloaded icons are also the only ones in server renders: with server rendering, await
|
|
5
|
+
* the same names on the server and in the browser before hydrating. Optional: every icon loads on its own the first time
|
|
6
|
+
* it is shown.
|
|
5
7
|
*/
|
|
6
8
|
export declare function preloadIcons(names: Iterable<IconName>): Promise<void>;
|
package/dist/icons/store.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { LOAD, PH_ALIAS } from "./names.js";
|
|
3
3
|
// src/icons/store.ts
|
|
4
|
-
/** Icons
|
|
5
|
-
const
|
|
6
|
-
/** Every icon the browser has:
|
|
4
|
+
/** Icons the page preloaded: the only ones in server renders and while hydrating, the same on both sides. */
|
|
5
|
+
const pinned = /* @__PURE__ */ new Map();
|
|
6
|
+
/** Every icon the browser has: those included by modules and those loaded since. */
|
|
7
7
|
const ready = /* @__PURE__ */ new Map();
|
|
8
8
|
/** Built-in markup to its name, so `d` given an icon's markup still finds its fill version. */
|
|
9
9
|
const byMarkup = /* @__PURE__ */ new Map();
|
|
@@ -20,10 +20,7 @@ const emit = () => listeners.forEach((fn) => fn());
|
|
|
20
20
|
/** Puts icons in the page's code: call at module load, never during a render. */
|
|
21
21
|
function includeIcons(...glyphs) {
|
|
22
22
|
let added = false;
|
|
23
|
-
for (const g of glyphs)
|
|
24
|
-
fixed.set(g.n, g);
|
|
25
|
-
added = add(g) || added;
|
|
26
|
-
}
|
|
23
|
+
for (const g of glyphs) added = add(g) || added;
|
|
27
24
|
if (added) emit();
|
|
28
25
|
}
|
|
29
26
|
const isIconName = (s) => Object.hasOwn(LOAD, s) || Object.hasOwn(PH_ALIAS, s);
|
|
@@ -59,10 +56,18 @@ function loadIcon(key) {
|
|
|
59
56
|
}
|
|
60
57
|
/**
|
|
61
58
|
* Loads icons before they are shown, e.g. the icons above the fold before the first render, so they appear in the first
|
|
62
|
-
* paint instead of a frame later.
|
|
59
|
+
* paint instead of a frame later. Preloaded icons are also the only ones in server renders: with server rendering, await
|
|
60
|
+
* the same names on the server and in the browser before hydrating. Optional: every icon loads on its own the first time
|
|
61
|
+
* it is shown.
|
|
63
62
|
*/
|
|
64
63
|
function preloadIcons(names) {
|
|
65
|
-
return Promise.all([...names].filter(isIconName).map((n) =>
|
|
64
|
+
return Promise.all([...names].filter(isIconName).map((n) => {
|
|
65
|
+
const key = phosphorName(n);
|
|
66
|
+
return loadIcon(key).then(() => {
|
|
67
|
+
const g = ready.get(key);
|
|
68
|
+
if (g) pinned.set(key, g);
|
|
69
|
+
});
|
|
70
|
+
})).then(() => void 0);
|
|
66
71
|
}
|
|
67
72
|
function subscribeIcons(fn) {
|
|
68
73
|
listeners.add(fn);
|
|
@@ -70,8 +75,8 @@ function subscribeIcons(fn) {
|
|
|
70
75
|
}
|
|
71
76
|
/** In the browser: every icon it has. */
|
|
72
77
|
const readyGlyph = (key) => key ? ready.get(key) : void 0;
|
|
73
|
-
/** On the server and while hydrating: only the icons
|
|
74
|
-
const
|
|
75
|
-
export { addLoadedIcons,
|
|
78
|
+
/** On the server and while hydrating: only the preloaded icons, so both render the same markup. */
|
|
79
|
+
const pinnedGlyph = (key) => key ? pinned.get(key) : void 0;
|
|
80
|
+
export { addLoadedIcons, includeIcons, isIconName, loadIcon, nameOfMarkup, phosphorName, pinnedGlyph, preloadIcons, readyGlyph, subscribeIcons };
|
|
76
81
|
|
|
77
82
|
//# sourceMappingURL=store.js.map
|
package/dist/icons/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","names":[],"sources":["../../src/icons/store.ts"],"sourcesContent":["/* Which built-in icons a page has. Each icon is its own module (ph/<name>.ts): a component that always shows an icon\n (a caret, a close x) imports that module and calls includeIcons at load, so the icon
|
|
1
|
+
{"version":3,"file":"store.js","names":[],"sources":["../../src/icons/store.ts"],"sourcesContent":["/* Which built-in icons a page has. Each icon is its own module (ph/<name>.ts): a component that always shows an icon\n (a caret, a close x) imports that module and calls includeIcons at load, so the icon renders at once in the browser.\n Any other name loads its module the first time an Icon shows it; until then the Icon is an empty box of the same\n size. A bundler then ships only the icons a page uses.\n Server render and hydration use only the icons the page preloaded (preloadIcons): which modules called includeIcons\n differs between a server that imports the whole package and a browser bundle that keeps only what the page uses, so\n those icons appear right after hydration instead. */\nimport { LOAD, PH_ALIAS, type IconName, type PhosphorName } from './names';\nimport type { IconGlyph } from './glyph';\n\n/** Icons the page preloaded: the only ones in server renders and while hydrating, the same on both sides. */\nconst pinned = new Map<string, IconGlyph>();\n/** Every icon the browser has: those included by modules and those loaded since. */\nconst ready = new Map<string, IconGlyph>();\n/** Built-in markup to its name, so `d` given an icon's markup still finds its fill version. */\nconst byMarkup = new Map<string, string>();\nconst pending = new Map<string, Promise<void>>();\nconst listeners = new Set<() => void>();\n\nfunction add(g: IconGlyph): boolean {\n if (ready.get(g.n) === g) return false;\n ready.set(g.n, g);\n byMarkup.set(g.r, g.n);\n byMarkup.set(g.f, g.n);\n return true;\n}\n\nconst emit = () => listeners.forEach((fn) => fn());\n\n/** Puts icons in the page's code: call at module load, never during a render. */\nexport function includeIcons(...glyphs: IconGlyph[]): void {\n let added = false;\n for (const g of glyphs) added = add(g) || added;\n if (added) emit();\n}\n\nexport const isIconName = (s: string): s is IconName => Object.hasOwn(LOAD, s) || Object.hasOwn(PH_ALIAS, s);\n\n/** The Phosphor name behind a name or an alias. */\nexport const phosphorName = (name: IconName): PhosphorName => (Object.hasOwn(LOAD, name) ? (name as PhosphorName) : PH_ALIAS[name as keyof typeof PH_ALIAS]);\n\n/** The name behind the markup of a built-in icon the page has. */\nexport const nameOfMarkup = (markup: string): PhosphorName | undefined => byMarkup.get(markup) as PhosphorName | undefined;\n\n/**\n * Gives the browser icons it then has at once, as if loaded: the `icons` export and the single-file bundle. Not used on\n * the server or while hydrating, so a server bundle that keeps `icons` and a browser bundle that drops it still render\n * the same markup.\n */\nexport function addLoadedIcons(glyphs: readonly IconGlyph[]): void {\n let added = false;\n for (const g of glyphs) added = add(g) || added;\n if (added) emit();\n}\n\n/** Loads one icon's module; resolves at once when the page has it. */\nexport function loadIcon(key: PhosphorName): Promise<void> {\n if (ready.has(key)) return Promise.resolve();\n let p = pending.get(key);\n if (!p) {\n p = LOAD[key]().then(\n (m) => {\n pending.delete(key);\n if (add(m.default)) emit();\n },\n (err: unknown) => {\n pending.delete(key);\n throw err;\n },\n );\n pending.set(key, p);\n }\n return p;\n}\n\n/**\n * Loads icons before they are shown, e.g. the icons above the fold before the first render, so they appear in the first\n * paint instead of a frame later. Preloaded icons are also the only ones in server renders: with server rendering, await\n * the same names on the server and in the browser before hydrating. Optional: every icon loads on its own the first time\n * it is shown.\n */\nexport function preloadIcons(names: Iterable<IconName>): Promise<void> {\n return Promise.all(\n [...names].filter(isIconName).map((n) => {\n const key = phosphorName(n);\n return loadIcon(key).then(() => {\n const g = ready.get(key);\n if (g) pinned.set(key, g);\n });\n }),\n ).then(() => undefined);\n}\n\nexport function subscribeIcons(fn: () => void): () => void {\n listeners.add(fn);\n return () => listeners.delete(fn);\n}\n\n/** In the browser: every icon it has. */\nexport const readyGlyph = (key: string | undefined) => (key ? ready.get(key) : undefined);\n/** On the server and while hydrating: only the preloaded icons, so both render the same markup. */\nexport const pinnedGlyph = (key: string | undefined) => (key ? pinned.get(key) : undefined);\n"],"mappings":";;;;AAWA,MAAM,yBAAS,IAAI,IAAuB;;AAE1C,MAAM,wBAAQ,IAAI,IAAuB;;AAEzC,MAAM,2BAAW,IAAI,IAAoB;AACzC,MAAM,0BAAU,IAAI,IAA2B;AAC/C,MAAM,4BAAY,IAAI,IAAgB;AAEtC,SAAS,IAAI,GAAuB;CAClC,IAAI,MAAM,IAAI,EAAE,CAAC,MAAM,GAAG,OAAO;CACjC,MAAM,IAAI,EAAE,GAAG,CAAC;CAChB,SAAS,IAAI,EAAE,GAAG,EAAE,CAAC;CACrB,SAAS,IAAI,EAAE,GAAG,EAAE,CAAC;CACrB,OAAO;AACT;AAEA,MAAM,aAAa,UAAU,SAAS,OAAO,GAAG,CAAC;;AAGjD,SAAgB,aAAa,GAAG,QAA2B;CACzD,IAAI,QAAQ;CACZ,KAAK,MAAM,KAAK,QAAQ,QAAQ,IAAI,CAAC,KAAK;CAC1C,IAAI,OAAO,KAAK;AAClB;AAEA,MAAa,cAAc,MAA6B,OAAO,OAAO,MAAM,CAAC,KAAK,OAAO,OAAO,UAAU,CAAC;;AAG3G,MAAa,gBAAgB,SAAkC,OAAO,OAAO,MAAM,IAAI,IAAK,OAAwB,SAAS;;AAG7H,MAAa,gBAAgB,WAA6C,SAAS,IAAI,MAAM;;;;;;AAO7F,SAAgB,eAAe,QAAoC;CACjE,IAAI,QAAQ;CACZ,KAAK,MAAM,KAAK,QAAQ,QAAQ,IAAI,CAAC,KAAK;CAC1C,IAAI,OAAO,KAAK;AAClB;;AAGA,SAAgB,SAAS,KAAkC;CACzD,IAAI,MAAM,IAAI,GAAG,GAAG,OAAO,QAAQ,QAAQ;CAC3C,IAAI,IAAI,QAAQ,IAAI,GAAG;CACvB,IAAI,CAAC,GAAG;EACN,IAAI,KAAK,IAAI,CAAC,CAAC,CAAC,MACb,MAAM;GACL,QAAQ,OAAO,GAAG;GAClB,IAAI,IAAI,EAAE,OAAO,GAAG,KAAK;EAC3B,IACC,QAAiB;GAChB,QAAQ,OAAO,GAAG;GAClB,MAAM;EACR,CACF;EACA,QAAQ,IAAI,KAAK,CAAC;CACpB;CACA,OAAO;AACT;;;;;;;AAQA,SAAgB,aAAa,OAA0C;CACrE,OAAO,QAAQ,IACb,CAAC,GAAG,KAAK,CAAC,CAAC,OAAO,UAAU,CAAC,CAAC,KAAK,MAAM;EACvC,MAAM,MAAM,aAAa,CAAC;EAC1B,OAAO,SAAS,GAAG,CAAC,CAAC,WAAW;GAC9B,MAAM,IAAI,MAAM,IAAI,GAAG;GACvB,IAAI,GAAG,OAAO,IAAI,KAAK,CAAC;EAC1B,CAAC;CACH,CAAC,CACH,CAAC,CAAC,WAAW,KAAA,CAAS;AACxB;AAEA,SAAgB,eAAe,IAA4B;CACzD,UAAU,IAAI,EAAE;CAChB,aAAa,UAAU,OAAO,EAAE;AAClC;;AAGA,MAAa,cAAc,QAA6B,MAAM,MAAM,IAAI,GAAG,IAAI,KAAA;;AAE/E,MAAa,eAAe,QAA6B,MAAM,OAAO,IAAI,GAAG,IAAI,KAAA"}
|
package/dist/index.d.ts
CHANGED
|
@@ -89,7 +89,7 @@ import { CustomIcon, Icon, IconProps, IconSource } from "./icons/Icon.js";
|
|
|
89
89
|
import { icons } from "./icons/map.js";
|
|
90
90
|
import { preloadIcons } from "./icons/store.js";
|
|
91
91
|
import { MOTION } from "./motion.js";
|
|
92
|
-
import { ThemeSetting, divergeToken, heatToken, initTheme, pickedAccent, resetAccent, setAccent, setTheme, storedAccent, storedTheme, textOn, themePreset } from "./theme.js";
|
|
92
|
+
import { ThemeSetting, divergeToken, heatToken, initTheme, pickedAccent, resetAccent, setAccent, setTheme, storedAccent, storedTheme, textOn, themePreset, themeScript } from "./theme.js";
|
|
93
93
|
import { announce } from "./announce.js";
|
|
94
94
|
import { Workbench, WorkbenchApi, WorkbenchHandle, WorkbenchLayout, WorkbenchProps, WorkbenchRegion, WorkbenchView, useWorkbench } from "./components/Workbench/Workbench.js";
|
|
95
|
-
export { AccentPicker, type AccentPickerProps, ActionBar, type ActionBarAction, type ActionBarProps, AiMark, type AiMarkProps, Alert, type AlertProps, type AlertTone, AppShell, type AppShellProps, Badge, type BadgePreset, type BadgeProps, type BadgeStatus, type BadgeTone, BarChart, type BarChartProps, type BarDatum, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarProps, Card, type CardProps, Checkbox, type CheckboxProps, type CodeLanguage, type CodeLink, CodeText, type CodeTextProps, CodeView, type CodeViewHandle, type CodeViewProps, CommandPalette, type CommandPaletteProps, type ConsoleExtra, ConsoleLayout, type ConsoleLayoutProps, type CountUnit, type CustomIcon, type DangerConfirm, DangerZone, type DangerZoneProps, DataTable, type DataTableColumn, type DataTableFilter, type DataTableProps, type DataTableView, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DayState, type Decimals, DetailList, type DetailListItem, type DetailListProps, Dialog, type DialogProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, ErrorPage, type ErrorPageProps, type EventKind, EventTimeline, type EventTimelineProps, type FieldProps, FileUpload, type FileUploadProps, type FilterOption, type FilterValue, type FormErrors, FormGrid, type FormGridProps, GraphDefs, GraphLegend, type GraphLegendItem, type GraphLegendProps, Grid, type GridProps, type GridRatio, Icon, IconButton, type IconButtonHint, type IconButtonProps, type IconName, type IconProps, type IconSource, InlineCode, type InlineCodeProps, KpiCard, type KpiCardProps, LayerGraph, type LayerGraphEdge, type LayerGraphNode, type LayerGraphProps, type LineBand, LineChart, type LineChartProps, type LineSeries, type LineThreshold, Link, type LinkProps, LoadingBar, type LoadingBarProps, LocaleProvider, type LocaleProviderProps, LoginCard, type LoginCardProps, MOTION, Markdown, type MarkdownProps, Menu, type MenuItem, type MenuProps, Meter, type MeterProps, type MobileTab, MobileTabBar, type MobileTabBarProps, MultiSelect, type MultiSelectOption, type MultiSelectProps, type NavBrand, type NavItem, type NavSection, NotificationBell, type NotificationBellProps, type NotificationItem, type OnRef, type OpenChangeReason, type OpenStateProps, Page, PageHeader, type PageHeaderAction, type PageHeaderProps, type PageProps, type PaletteItem, type PaletteKind, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, ProgressRing, type ProgressRingProps, type ProjectOption, type ProjectStatus, ProjectSwitcher, type ProjectSwitcherProps, RadioGroup, type RadioGroupProps, type RadioOption, type RangeValue, type RefHref, RelativeTime, type RelativeTimeProps, type Row, type RowKey, SearchField, type SearchFieldProps, Section, SectionGroup, type SectionGroupProps, SectionGroupToggle, type SectionGroupToggleProps, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedItem, type SegmentedOption, Select, type SelectOption, type SelectProps, type SettingsCategory, SettingsLayout, type SettingsLayoutProps, SettingsRow, type SettingsRowProps, SettingsSection, type SettingsSectionProps, SideNav, type SideNavProps, Skeleton, type SkeletonProps, SplitPane, type SplitPaneProps, StatusBand, type StatusBandProps, StatusLegend, type StatusSegment, Suggestion, type SuggestionProps, Switch, type SwitchProps, TOAST_DURATION, type TabItem, Tabs, type TabsProps, Tag, type TagProps, Term, type TermDef, type TermProps, type TermsMark, TextArea, type TextAreaProps, TextField, type TextFieldProps, ThemePicker, type ThemePickerProps, type ThemePreset, type ThemeSetting, TimeControl, type TimeControlProps, type TimelineEvent, type TimelineKind, Toast, type ToastAction, type ToastOptions, type ToastProps, type ToastTone, Toaster, type ToasterProps, type Token, type TokenClass, type Tokenizer, Tooltip, type TooltipProps, TopBar, type TopBarProps, type Total, Tour, type TourProps, type TourStep, TreeList, type TreeListProps, type TreeMark, type TreeNode, type UploadFile, type UseFormErrors, Workbench, type WorkbenchApi, type WorkbenchHandle, type WorkbenchLayout, type WorkbenchProps, type WorkbenchRegion, type WorkbenchView, type Zone, ZoneMap, type ZoneMapProps, addMessages, announce, consoleZoom, divergeToken, focusMain, format, heatToken, icons, initTheme, isCodeRef, pickedAccent, preloadIcons, resetAccent, safeHref, setAccent, setLocale, setTheme, storedAccent, storedTheme, subscribeLocale, tr as t, textOn, themePreset, toast, useFormErrors, useLocale, useToast, useTour, useWorkbench };
|
|
95
|
+
export { AccentPicker, type AccentPickerProps, ActionBar, type ActionBarAction, type ActionBarProps, AiMark, type AiMarkProps, Alert, type AlertProps, type AlertTone, AppShell, type AppShellProps, Badge, type BadgePreset, type BadgeProps, type BadgeStatus, type BadgeTone, BarChart, type BarChartProps, type BarDatum, Breadcrumb, type BreadcrumbItem, type BreadcrumbProps, Button, type ButtonProps, Calendar, type CalendarProps, Card, type CardProps, Checkbox, type CheckboxProps, type CodeLanguage, type CodeLink, CodeText, type CodeTextProps, CodeView, type CodeViewHandle, type CodeViewProps, CommandPalette, type CommandPaletteProps, type ConsoleExtra, ConsoleLayout, type ConsoleLayoutProps, type CountUnit, type CustomIcon, type DangerConfirm, DangerZone, type DangerZoneProps, DataTable, type DataTableColumn, type DataTableFilter, type DataTableProps, type DataTableView, DatePicker, type DatePickerProps, type DateRange, DateRangePicker, type DateRangePickerProps, type DayState, type Decimals, DetailList, type DetailListItem, type DetailListProps, Dialog, type DialogProps, Drawer, type DrawerProps, EmptyState, type EmptyStateProps, ErrorPage, type ErrorPageProps, type EventKind, EventTimeline, type EventTimelineProps, type FieldProps, FileUpload, type FileUploadProps, type FilterOption, type FilterValue, type FormErrors, FormGrid, type FormGridProps, GraphDefs, GraphLegend, type GraphLegendItem, type GraphLegendProps, Grid, type GridProps, type GridRatio, Icon, IconButton, type IconButtonHint, type IconButtonProps, type IconName, type IconProps, type IconSource, InlineCode, type InlineCodeProps, KpiCard, type KpiCardProps, LayerGraph, type LayerGraphEdge, type LayerGraphNode, type LayerGraphProps, type LineBand, LineChart, type LineChartProps, type LineSeries, type LineThreshold, Link, type LinkProps, LoadingBar, type LoadingBarProps, LocaleProvider, type LocaleProviderProps, LoginCard, type LoginCardProps, MOTION, Markdown, type MarkdownProps, Menu, type MenuItem, type MenuProps, Meter, type MeterProps, type MobileTab, MobileTabBar, type MobileTabBarProps, MultiSelect, type MultiSelectOption, type MultiSelectProps, type NavBrand, type NavItem, type NavSection, NotificationBell, type NotificationBellProps, type NotificationItem, type OnRef, type OpenChangeReason, type OpenStateProps, Page, PageHeader, type PageHeaderAction, type PageHeaderProps, type PageProps, type PaletteItem, type PaletteKind, Popover, type PopoverProps, ProgressBar, type ProgressBarProps, ProgressRing, type ProgressRingProps, type ProjectOption, type ProjectStatus, ProjectSwitcher, type ProjectSwitcherProps, RadioGroup, type RadioGroupProps, type RadioOption, type RangeValue, type RefHref, RelativeTime, type RelativeTimeProps, type Row, type RowKey, SearchField, type SearchFieldProps, Section, SectionGroup, type SectionGroupProps, SectionGroupToggle, type SectionGroupToggleProps, type SectionProps, SegmentedControl, type SegmentedControlProps, type SegmentedItem, type SegmentedOption, Select, type SelectOption, type SelectProps, type SettingsCategory, SettingsLayout, type SettingsLayoutProps, SettingsRow, type SettingsRowProps, SettingsSection, type SettingsSectionProps, SideNav, type SideNavProps, Skeleton, type SkeletonProps, SplitPane, type SplitPaneProps, StatusBand, type StatusBandProps, StatusLegend, type StatusSegment, Suggestion, type SuggestionProps, Switch, type SwitchProps, TOAST_DURATION, type TabItem, Tabs, type TabsProps, Tag, type TagProps, Term, type TermDef, type TermProps, type TermsMark, TextArea, type TextAreaProps, TextField, type TextFieldProps, ThemePicker, type ThemePickerProps, type ThemePreset, type ThemeSetting, TimeControl, type TimeControlProps, type TimelineEvent, type TimelineKind, Toast, type ToastAction, type ToastOptions, type ToastProps, type ToastTone, Toaster, type ToasterProps, type Token, type TokenClass, type Tokenizer, Tooltip, type TooltipProps, TopBar, type TopBarProps, type Total, Tour, type TourProps, type TourStep, TreeList, type TreeListProps, type TreeMark, type TreeNode, type UploadFile, type UseFormErrors, Workbench, type WorkbenchApi, type WorkbenchHandle, type WorkbenchLayout, type WorkbenchProps, type WorkbenchRegion, type WorkbenchView, type Zone, ZoneMap, type ZoneMapProps, addMessages, announce, consoleZoom, divergeToken, focusMain, format, heatToken, icons, initTheme, isCodeRef, pickedAccent, preloadIcons, resetAccent, safeHref, setAccent, setLocale, setTheme, storedAccent, storedTheme, subscribeLocale, tr as t, textOn, themePreset, themeScript, toast, useFormErrors, useLocale, useToast, useTour, useWorkbench };
|
package/dist/index.js
CHANGED
|
@@ -83,7 +83,7 @@ import { Icon } from "./icons/Icon.js";
|
|
|
83
83
|
import { icons } from "./icons/map.js";
|
|
84
84
|
import { preloadIcons } from "./icons/store.js";
|
|
85
85
|
import { MOTION } from "./motion.js";
|
|
86
|
-
import { divergeToken, heatToken, initTheme, pickedAccent, resetAccent, setAccent, setTheme, storedAccent, storedTheme, textOn, themePreset } from "./theme.js";
|
|
86
|
+
import { divergeToken, heatToken, initTheme, pickedAccent, resetAccent, setAccent, setTheme, storedAccent, storedTheme, textOn, themePreset, themeScript } from "./theme.js";
|
|
87
87
|
import { announce } from "./announce.js";
|
|
88
88
|
import { Workbench, useWorkbench } from "./components/Workbench/Workbench.js";
|
|
89
|
-
export { AccentPicker, ActionBar, AiMark, Alert, AppShell, Badge, BarChart, Breadcrumb, Button, Calendar, Card, Checkbox, CodeText, CodeView, CommandPalette, ConsoleLayout, DangerZone, DataTable, DatePicker, DateRangePicker, DetailList, Dialog, Drawer, EmptyState, ErrorPage, EventTimeline, FileUpload, FormGrid, GraphDefs, GraphLegend, Grid, Icon, IconButton, InlineCode, KpiCard, LayerGraph, LineChart, Link, LoadingBar, LocaleProvider, LoginCard, MOTION, Markdown, Menu, Meter, MobileTabBar, MultiSelect, NotificationBell, Page, PageHeader, Popover, ProgressBar, ProgressRing, ProjectSwitcher, RadioGroup, RelativeTime, SearchField, Section, SectionGroup, SectionGroupToggle, SegmentedControl, Select, SettingsLayout, SettingsRow, SettingsSection, SideNav, Skeleton, SplitPane, StatusBand, StatusLegend, Suggestion, Switch, TOAST_DURATION, Tabs, Tag, Term, TextArea, TextField, ThemePicker, TimeControl, Toast, Toaster, Tooltip, TopBar, Tour, TreeList, Workbench, ZoneMap, addMessages, announce, consoleZoom, divergeToken, focusMain, format, heatToken, icons, initTheme, isCodeRef, pickedAccent, preloadIcons, resetAccent, safeHref, setAccent, setLocale, setTheme, storedAccent, storedTheme, subscribeLocale, tr as t, textOn, themePreset, toast, useFormErrors, useLocale, useToast, useTour, useWorkbench };
|
|
89
|
+
export { AccentPicker, ActionBar, AiMark, Alert, AppShell, Badge, BarChart, Breadcrumb, Button, Calendar, Card, Checkbox, CodeText, CodeView, CommandPalette, ConsoleLayout, DangerZone, DataTable, DatePicker, DateRangePicker, DetailList, Dialog, Drawer, EmptyState, ErrorPage, EventTimeline, FileUpload, FormGrid, GraphDefs, GraphLegend, Grid, Icon, IconButton, InlineCode, KpiCard, LayerGraph, LineChart, Link, LoadingBar, LocaleProvider, LoginCard, MOTION, Markdown, Menu, Meter, MobileTabBar, MultiSelect, NotificationBell, Page, PageHeader, Popover, ProgressBar, ProgressRing, ProjectSwitcher, RadioGroup, RelativeTime, SearchField, Section, SectionGroup, SectionGroupToggle, SegmentedControl, Select, SettingsLayout, SettingsRow, SettingsSection, SideNav, Skeleton, SplitPane, StatusBand, StatusLegend, Suggestion, Switch, TOAST_DURATION, Tabs, Tag, Term, TextArea, TextField, ThemePicker, TimeControl, Toast, Toaster, Tooltip, TopBar, Tour, TreeList, Workbench, ZoneMap, addMessages, announce, consoleZoom, divergeToken, focusMain, format, heatToken, icons, initTheme, isCodeRef, pickedAccent, preloadIcons, resetAccent, safeHref, setAccent, setLocale, setTheme, storedAccent, storedTheme, subscribeLocale, tr as t, textOn, themePreset, themeScript, toast, useFormErrors, useLocale, useToast, useTour, useWorkbench };
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { baseReason } from "./open.js";
|
|
3
|
-
import "react";
|
|
3
|
+
import * as React from "react";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { Popover } from "@base-ui/react/popover";
|
|
6
6
|
// src/internal/FloatingPanel.tsx
|
|
7
7
|
/** A positioned panel next to its trigger: flips when there is no room, closes on Esc and outside press, returns focus. */
|
|
8
8
|
function FloatingPanel({ open, onOpenChange, trigger, side = "bottom", align = "start", sideOffset = 6, className, openOnHover, anchor, boundary, delay = 0, id, focusOnOpen = true, children, ...aria }) {
|
|
9
9
|
const within = boundary?.current ?? void 0;
|
|
10
|
+
const popup = React.useRef(null);
|
|
11
|
+
const initialFocus = focusOnOpen === false ? false : typeof focusOnOpen === "string" ? () => popup.current?.querySelector(focusOnOpen) ?? true : void 0;
|
|
10
12
|
return /* @__PURE__ */ jsxs(Popover.Root, {
|
|
11
13
|
open,
|
|
12
14
|
onOpenChange: (next, details) => onOpenChange(next, baseReason(details?.reason)),
|
|
@@ -28,10 +30,11 @@ function FloatingPanel({ open, onOpenChange, trigger, side = "bottom", align = "
|
|
|
28
30
|
align: "shift"
|
|
29
31
|
} : void 0,
|
|
30
32
|
children: /* @__PURE__ */ jsx(Popover.Popup, {
|
|
33
|
+
ref: popup,
|
|
31
34
|
id,
|
|
32
35
|
className,
|
|
33
36
|
"aria-label": aria["aria-label"],
|
|
34
|
-
initialFocus
|
|
37
|
+
initialFocus,
|
|
35
38
|
children
|
|
36
39
|
})
|
|
37
40
|
}) })]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FloatingPanel.js","names":[],"sources":["../../src/internal/FloatingPanel.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Popover } from '@base-ui/react/popover';\nimport { baseReason, type OpenChangeReason } from './open';\n\nexport interface FloatingPanelProps {\n open: boolean;\n onOpenChange: (open: boolean, reason?: OpenChangeReason) => void;\n /** The element that opens the panel; it must accept a ref (a native element or a component that passes ref on). */\n trigger: React.ReactElement;\n side?: 'top' | 'bottom';\n align?: 'start' | 'center' | 'end';\n sideOffset?: number;\n /** Class of the panel (it carries the look: .ui-datepop, .ui-noti …). */\n className?: string;\n /** Accessible name of the panel. */\n 'aria-label'?: string;\n /** Position against this element instead of the trigger (e.g. the whole field around a calendar button). */\n anchor?: React.RefObject<Element | null>;\n /** Open on hover as well as on press. */\n openOnHover?: boolean;\n /** Keeps the panel inside this element (shifting it sideways, then flipping), not just inside the window: a menu of\n * a table stays over the table instead of covering the panel beside it. */\n boundary?: React.RefObject<Element | null>;\n /** Hover delay before opening, in ms (with openOnHover). Default 0. */\n delay?: number;\n /** Id of the panel, for aria-describedby on the trigger. */\n id?: string;\n /** Move focus into the panel when it opens. Default true. */\n focusOnOpen?: boolean;\n children: React.ReactNode;\n}\n\n/** A positioned panel next to its trigger: flips when there is no room, closes on Esc and outside press, returns focus. */\nexport function FloatingPanel({\n open,\n onOpenChange,\n trigger,\n side = 'bottom',\n align = 'start',\n sideOffset = 6,\n className,\n openOnHover,\n anchor,\n boundary,\n delay = 0,\n id,\n focusOnOpen = true,\n children,\n ...aria\n}: FloatingPanelProps) {\n const within = boundary?.current ?? undefined;\n return (\n <Popover.Root open={open} onOpenChange={(next, details) => onOpenChange(next, baseReason(details?.reason))}>\n <Popover.Trigger render={trigger} openOnHover={openOnHover} delay={delay} closeDelay={150} />\n <Popover.Portal>\n <Popover.Positioner\n className=\"ui-float\"\n side={side}\n align={align}\n sideOffset={sideOffset}\n anchor={anchor}\n collisionBoundary={within}\n collisionPadding={within ? 0 : undefined}\n // Inside a boundary: slid sideways until it fits, rather than swapping its alignment.\n collisionAvoidance={within ? { side: 'flip', align: 'shift' } : undefined}\n >\n <Popover.Popup id={id} className={className} aria-label={aria['aria-label']} initialFocus={
|
|
1
|
+
{"version":3,"file":"FloatingPanel.js","names":[],"sources":["../../src/internal/FloatingPanel.tsx"],"sourcesContent":["import * as React from 'react';\nimport { Popover } from '@base-ui/react/popover';\nimport { baseReason, type OpenChangeReason } from './open';\n\nexport interface FloatingPanelProps {\n open: boolean;\n onOpenChange: (open: boolean, reason?: OpenChangeReason) => void;\n /** The element that opens the panel; it must accept a ref (a native element or a component that passes ref on). */\n trigger: React.ReactElement;\n side?: 'top' | 'bottom';\n align?: 'start' | 'center' | 'end';\n sideOffset?: number;\n /** Class of the panel (it carries the look: .ui-datepop, .ui-noti …). */\n className?: string;\n /** Accessible name of the panel. */\n 'aria-label'?: string;\n /** Position against this element instead of the trigger (e.g. the whole field around a calendar button). */\n anchor?: React.RefObject<Element | null>;\n /** Open on hover as well as on press. */\n openOnHover?: boolean;\n /** Keeps the panel inside this element (shifting it sideways, then flipping), not just inside the window: a menu of\n * a table stays over the table instead of covering the panel beside it. */\n boundary?: React.RefObject<Element | null>;\n /** Hover delay before opening, in ms (with openOnHover). Default 0. */\n delay?: number;\n /** Id of the panel, for aria-describedby on the trigger. */\n id?: string;\n /** Move focus into the panel when it opens: true (the first focusable element), false, or a CSS selector of the\n * element to focus inside the panel (the first focusable element when none matches). Default true. */\n focusOnOpen?: boolean | string;\n children: React.ReactNode;\n}\n\n/** A positioned panel next to its trigger: flips when there is no room, closes on Esc and outside press, returns focus. */\nexport function FloatingPanel({\n open,\n onOpenChange,\n trigger,\n side = 'bottom',\n align = 'start',\n sideOffset = 6,\n className,\n openOnHover,\n anchor,\n boundary,\n delay = 0,\n id,\n focusOnOpen = true,\n children,\n ...aria\n}: FloatingPanelProps) {\n const within = boundary?.current ?? undefined;\n const popup = React.useRef<HTMLDivElement>(null);\n const initialFocus =\n focusOnOpen === false ? false : typeof focusOnOpen === 'string' ? () => popup.current?.querySelector<HTMLElement>(focusOnOpen) ?? true : undefined;\n return (\n <Popover.Root open={open} onOpenChange={(next, details) => onOpenChange(next, baseReason(details?.reason))}>\n <Popover.Trigger render={trigger} openOnHover={openOnHover} delay={delay} closeDelay={150} />\n <Popover.Portal>\n <Popover.Positioner\n className=\"ui-float\"\n side={side}\n align={align}\n sideOffset={sideOffset}\n anchor={anchor}\n collisionBoundary={within}\n collisionPadding={within ? 0 : undefined}\n // Inside a boundary: slid sideways until it fits, rather than swapping its alignment.\n collisionAvoidance={within ? { side: 'flip', align: 'shift' } : undefined}\n >\n <Popover.Popup ref={popup} id={id} className={className} aria-label={aria['aria-label']} initialFocus={initialFocus}>\n {children}\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n );\n}\n"],"mappings":";;;;;;;AAkCA,SAAgB,cAAc,EAC5B,MACA,cACA,SACA,OAAO,UACP,QAAQ,SACR,aAAa,GACb,WACA,aACA,QACA,UACA,QAAQ,GACR,IACA,cAAc,MACd,UACA,GAAG,QACkB;CACrB,MAAM,SAAS,UAAU,WAAW,KAAA;CACpC,MAAM,QAAQ,MAAM,OAAuB,IAAI;CAC/C,MAAM,eACJ,gBAAgB,QAAQ,QAAQ,OAAO,gBAAgB,iBAAiB,MAAM,SAAS,cAA2B,WAAW,KAAK,OAAO,KAAA;CAC3I,OACE,qBAAC,QAAQ,MAAT;EAAoB;EAAM,eAAe,MAAM,YAAY,aAAa,MAAM,WAAW,SAAS,MAAM,CAAC;EAAzG,UAAA,CACE,oBAAC,QAAQ,SAAT;GAAiB,QAAQ;GAAsB;GAAoB;GAAO,YAAY;EAAM,CAAA,GAC5F,oBAAC,QAAQ,QAAT,EAAA,UACE,oBAAC,QAAQ,YAAT;GACE,WAAU;GACJ;GACC;GACK;GACJ;GACR,mBAAmB;GACnB,kBAAkB,SAAS,IAAI,KAAA;GAE/B,oBAAoB,SAAS;IAAE,MAAM;IAAQ,OAAO;GAAQ,IAAI,KAAA;GAEhE,UAAA,oBAAC,QAAQ,OAAT;IAAe,KAAK;IAAW;IAAe;IAAW,cAAY,KAAK;IAA6B;IACpG;GACY,CAAA;EACG,CAAA,EACN,CAAA,CACJ;;AAElB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
// src/internal/clickSteps.ts
|
|
3
|
+
/** The size after one click: the smallest preset larger than now, after the largest back to the smallest. Presets are
|
|
4
|
+
* rounded, sorted and kept unique; within 1 px of a preset counts as on it. */
|
|
5
|
+
function nextPreset(now, presets) {
|
|
6
|
+
const list = [...new Set(presets.map((v) => Math.round(v)))].sort((a, b) => a - b);
|
|
7
|
+
return list.find((v) => v > now + 1) ?? list[0] ?? now;
|
|
8
|
+
}
|
|
9
|
+
export { nextPreset };
|
|
10
|
+
|
|
11
|
+
//# sourceMappingURL=clickSteps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clickSteps.js","names":[],"sources":["../../src/internal/clickSteps.ts"],"sourcesContent":["/* A click on a divider without dragging (one pointer, WCAG 2.5.7): steps through preset sizes, the same as the column\n borders of DataTable. Shared by SplitPane, the Workbench borders and LayerGraph's height bar. */\n\n/** A pointer that moves less than this (px) between down and up clicked; more is a drag. */\nexport const DRAG_MIN = 4;\n\n/** The size after one click: the smallest preset larger than now, after the largest back to the smallest. Presets are\n * rounded, sorted and kept unique; within 1 px of a preset counts as on it. */\nexport function nextPreset(now: number, presets: readonly number[]): number {\n const list = [...new Set(presets.map((v) => Math.round(v)))].sort((a, b) => a - b);\n return list.find((v) => v > now + 1) ?? list[0] ?? now;\n}\n"],"mappings":";;;;AAQA,SAAgB,WAAW,KAAa,SAAoC;CAC1E,MAAM,OAAO,CAAC,GAAG,IAAI,IAAI,QAAQ,KAAK,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,IAAI,CAAC;CACjF,OAAO,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,KAAK,KAAK,MAAM;AACrD"}
|
package/dist/internal/util.js
CHANGED
|
@@ -97,6 +97,12 @@ function nodeText(node) {
|
|
|
97
97
|
}
|
|
98
98
|
return "";
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
/** A number and its unit never break apart: the space between them becomes a no-break space (U+00A0), so
|
|
101
|
+
* 「100 MB」「29 °C」「3 筆」 do not wrap as 「100 / MB」 on a phone, nor a currency before the number (「NT$ 1,280」).
|
|
102
|
+
* Leaves every other space alone. */
|
|
103
|
+
function keepUnits(text) {
|
|
104
|
+
return text.replace(/(\d) (?=°|%|‰|[A-Za-zµΩ]{1,4}(?![A-Za-z])|[\u3400-\u9fff])/g, "$1\xA0").replace(/((?:^|[^\w$])(?:[A-Z]{2}\$|[$€£¥₩])) (?=[-−]?\d)/g, "$1\xA0");
|
|
105
|
+
}
|
|
106
|
+
export { IS_MAC, SHORTCUT, TOUCH_ONLY, browserKey, copyText, cx, digits, idPart, keepUnits, monoNums, nodeText, reduced, resizeObserver, seenOnly, useMedia, useNarrow };
|
|
101
107
|
|
|
102
108
|
//# sourceMappingURL=util.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"util.js","names":[],"sources":["../../src/internal/util.tsx"],"sourcesContent":["import * as React from 'react';\n\n/** A value (a row or node id, a file path) as part of an element id: no spaces, so aria-owns, aria-controls and\n * aria-labelledby, which split their value at spaces, still find it. */\nexport const idPart = (s: string): string => encodeURIComponent(s);\n\n/** Joins the truthy class names. */\nexport function cx(...names: unknown[]): string {\n return names.filter(Boolean).join(' ');\n}\n\n// Text that is only seen: drawn by CSS (::before), so it is neither in the page's text (copy, innerText, text-reading\n// tools) nor read aloud. The readable version goes beside it, visually hidden. Numbers keep Geist Mono.\nexport function seenOnly(text: string, nums: string[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) => <span key={i} className={cx('ui-seen', k >= 0 && 'ui-num')} data-text={k >= 0 ? nums[k] : t} />);\n}\n\n// A translated sentence cut at its number marks (\\u0001, \\u0002, \\u0003): [text, -1] or [mark, its index].\nfunction splitMarks(text: string): [string, number][] {\n return (\n text\n // eslint-disable-next-line no-control-regex -- the marks are control characters on purpose\n .split(/(\\u0001|\\u0002|\\u0003)/)\n .filter(Boolean)\n .map((t) => [t, ['\\u0001', '\\u0002', '\\u0003'].indexOf(t)])\n );\n}\n\n// Puts the numbers of a translated sentence in Geist Mono and leaves the words in the text font.\n// The sentence marks each number with \\u0001, \\u0002 or \\u0003 in the order of nums.\nexport function monoNums(text: string, nums: React.ReactNode[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) =>\n k >= 0 ? (\n <span key={i} className=\"ui-num\">\n {nums[k]}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** localStorage get (no value) or set; null when storage is blocked. */\nexport function store(key: string, value?: string): string | null {\n try {\n if (value === undefined) return localStorage.getItem(key);\n localStorage.setItem(key, value);\n } catch {\n /* storage blocked (private mode, sandboxed frame) */\n }\n return null;\n}\n\nexport function reduced(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nconst nav = typeof navigator !== 'undefined' ? (navigator as Navigator & { userAgentData?: { platform?: string } }) : undefined;\nexport const IS_MAC = /mac|iphone|ipad/i.test(nav?.userAgentData?.platform || nav?.platform || nav?.userAgent || '');\n/** A touch screen as the main input (phones, tablets): no keyboard to press a shortcut with, no hover. Phones and\n * tablets report (pointer: coarse); (hover: none) alone is not used, since Chromium keeps it after touch emulation is\n * turned off and a mouse would then lose its Tooltips. */\nexport const TOUCH_ONLY = '(pointer: coarse)';\nexport const SHORTCUT = IS_MAC ? '⌘K' : 'Ctrl K';\n\n/** Matches a media query and follows changes. false on the server and in the first browser render while hydrating,\n * so the markup matches; then the real match. */\nexport function useMedia(query: string): boolean {\n const sub = React.useCallback(\n (f: () => void) => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return () => {};\n const m = window.matchMedia(query);\n m.addEventListener('change', f);\n return () => m.removeEventListener('change', f);\n },\n [query],\n );\n const get = React.useCallback(() => typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(query).matches, [query]);\n return React.useSyncExternalStore(sub, get, serverFalse);\n}\nconst serverFalse = () => false;\n\n/** A ResizeObserver, or null where there is none (jsdom, old browsers): the first measure then stays. */\nexport function resizeObserver(cb: ResizeObserverCallback): ResizeObserver | null {\n return typeof ResizeObserver === 'function' ? new ResizeObserver(cb) : null;\n}\n\n/** True under 600 px, the same width where cards stack. */\nexport function useNarrow(): boolean {\n return useMedia('(max-width: 599px)');\n}\n\nexport async function copyText(text: string): Promise<void> {\n if (navigator.clipboard?.writeText) {\n try {\n return await navigator.clipboard.writeText(text);\n } catch {\n /* fall back below (insecure context, denied permission) */\n }\n }\n const t = document.createElement('textarea');\n t.value = text;\n t.setAttribute('readonly', '');\n t.style.position = 'fixed';\n t.style.opacity = '0';\n document.body.appendChild(t);\n t.select();\n try {\n if (!document.execCommand('copy')) throw new Error('copy failed');\n } finally {\n document.body.removeChild(t);\n }\n}\n\n/** Text with every number in Geist Mono and the words in the text font, for labels that mix both (「第 1 週」). */\nexport function digits(text: string, numbers = /(\\d[\\d,.:/]*)/): React.ReactNode[] {\n return text.split(numbers).map((t, i) =>\n i % 2 ? (\n <span key={i} className=\"ui-num\">\n {t}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** Alt, Meta or Ctrl held: the key belongs to the browser or the system (Alt+← goes back a page), not to the widget. */\nexport const browserKey = (e: { altKey: boolean; metaKey: boolean; ctrlKey: boolean }): boolean => e.altKey || e.metaKey || e.ctrlKey;\n\n/** The words in a React node, as a screen reader would read them: strings and numbers, through elements' children. */\nexport function nodeText(node: React.ReactNode): string {\n if (node == null || typeof node === 'boolean') return '';\n if (typeof node === 'string' || typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(nodeText).join('');\n if (React.isValidElement(node)) {\n const props = node.props as { 'aria-label'?: string; label?: unknown; children?: React.ReactNode };\n if (typeof props['aria-label'] === 'string') return props['aria-label'];\n return nodeText(props.children) || (typeof props.label === 'string' ? props.label : '');\n }\n return '';\n}\n"],"mappings":";;;;;;AAIA,MAAa,UAAU,MAAsB,mBAAmB,CAAC;;AAGjE,SAAgB,GAAG,GAAG,OA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AAC,CAAC,KAAK,EAAE;CAC1D,IAAI,MAAM,eAAe,IAAI,GAAG;EAC9B,MAAM,QAAQ,KAAK;EACnB,IAAI,OAAO,MAAM,kBAAkB,UAAU,OAAO,MAAM;EAC1D,OAAO,SAAS,MAAM,QAAQ,MAAM,OAAO,MAAM,UAAU,WAAW,MAAM,QAAQ;CACtF;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"util.js","names":[],"sources":["../../src/internal/util.tsx"],"sourcesContent":["import * as React from 'react';\n\n/** A value (a row or node id, a file path) as part of an element id: no spaces, so aria-owns, aria-controls and\n * aria-labelledby, which split their value at spaces, still find it. */\nexport const idPart = (s: string): string => encodeURIComponent(s);\n\n/** Joins the truthy class names. */\nexport function cx(...names: unknown[]): string {\n return names.filter(Boolean).join(' ');\n}\n\n// Text that is only seen: drawn by CSS (::before), so it is neither in the page's text (copy, innerText, text-reading\n// tools) nor read aloud. The readable version goes beside it, visually hidden. Numbers keep Geist Mono.\nexport function seenOnly(text: string, nums: string[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) => <span key={i} className={cx('ui-seen', k >= 0 && 'ui-num')} data-text={k >= 0 ? nums[k] : t} />);\n}\n\n// A translated sentence cut at its number marks (\\u0001, \\u0002, \\u0003): [text, -1] or [mark, its index].\nfunction splitMarks(text: string): [string, number][] {\n return (\n text\n // eslint-disable-next-line no-control-regex -- the marks are control characters on purpose\n .split(/(\\u0001|\\u0002|\\u0003)/)\n .filter(Boolean)\n .map((t) => [t, ['\\u0001', '\\u0002', '\\u0003'].indexOf(t)])\n );\n}\n\n// Puts the numbers of a translated sentence in Geist Mono and leaves the words in the text font.\n// The sentence marks each number with \\u0001, \\u0002 or \\u0003 in the order of nums.\nexport function monoNums(text: string, nums: React.ReactNode[]): React.ReactNode[] {\n return splitMarks(text).map(([t, k], i) =>\n k >= 0 ? (\n <span key={i} className=\"ui-num\">\n {nums[k]}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** localStorage get (no value) or set; null when storage is blocked. */\nexport function store(key: string, value?: string): string | null {\n try {\n if (value === undefined) return localStorage.getItem(key);\n localStorage.setItem(key, value);\n } catch {\n /* storage blocked (private mode, sandboxed frame) */\n }\n return null;\n}\n\nexport function reduced(): boolean {\n return typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia('(prefers-reduced-motion: reduce)').matches;\n}\n\nconst nav = typeof navigator !== 'undefined' ? (navigator as Navigator & { userAgentData?: { platform?: string } }) : undefined;\nexport const IS_MAC = /mac|iphone|ipad/i.test(nav?.userAgentData?.platform || nav?.platform || nav?.userAgent || '');\n/** A touch screen as the main input (phones, tablets): no keyboard to press a shortcut with, no hover. Phones and\n * tablets report (pointer: coarse); (hover: none) alone is not used, since Chromium keeps it after touch emulation is\n * turned off and a mouse would then lose its Tooltips. */\nexport const TOUCH_ONLY = '(pointer: coarse)';\nexport const SHORTCUT = IS_MAC ? '⌘K' : 'Ctrl K';\n\n/** Matches a media query and follows changes. false on the server and in the first browser render while hydrating,\n * so the markup matches; then the real match. */\nexport function useMedia(query: string): boolean {\n const sub = React.useCallback(\n (f: () => void) => {\n if (typeof window === 'undefined' || typeof window.matchMedia !== 'function') return () => {};\n const m = window.matchMedia(query);\n m.addEventListener('change', f);\n return () => m.removeEventListener('change', f);\n },\n [query],\n );\n const get = React.useCallback(() => typeof window !== 'undefined' && typeof window.matchMedia === 'function' && window.matchMedia(query).matches, [query]);\n return React.useSyncExternalStore(sub, get, serverFalse);\n}\nconst serverFalse = () => false;\n\n/** A ResizeObserver, or null where there is none (jsdom, old browsers): the first measure then stays. */\nexport function resizeObserver(cb: ResizeObserverCallback): ResizeObserver | null {\n return typeof ResizeObserver === 'function' ? new ResizeObserver(cb) : null;\n}\n\n/** True under 600 px, the same width where cards stack. */\nexport function useNarrow(): boolean {\n return useMedia('(max-width: 599px)');\n}\n\nexport async function copyText(text: string): Promise<void> {\n if (navigator.clipboard?.writeText) {\n try {\n return await navigator.clipboard.writeText(text);\n } catch {\n /* fall back below (insecure context, denied permission) */\n }\n }\n const t = document.createElement('textarea');\n t.value = text;\n t.setAttribute('readonly', '');\n t.style.position = 'fixed';\n t.style.opacity = '0';\n document.body.appendChild(t);\n t.select();\n try {\n if (!document.execCommand('copy')) throw new Error('copy failed');\n } finally {\n document.body.removeChild(t);\n }\n}\n\n/** Text with every number in Geist Mono and the words in the text font, for labels that mix both (「第 1 週」). */\nexport function digits(text: string, numbers = /(\\d[\\d,.:/]*)/): React.ReactNode[] {\n return text.split(numbers).map((t, i) =>\n i % 2 ? (\n <span key={i} className=\"ui-num\">\n {t}\n </span>\n ) : (\n t\n ),\n );\n}\n\n/** Alt, Meta or Ctrl held: the key belongs to the browser or the system (Alt+← goes back a page), not to the widget. */\nexport const browserKey = (e: { altKey: boolean; metaKey: boolean; ctrlKey: boolean }): boolean => e.altKey || e.metaKey || e.ctrlKey;\n\n/** The words in a React node, as a screen reader would read them: strings and numbers, through elements' children. */\nexport function nodeText(node: React.ReactNode): string {\n if (node == null || typeof node === 'boolean') return '';\n if (typeof node === 'string' || typeof node === 'number') return String(node);\n if (Array.isArray(node)) return node.map(nodeText).join('');\n if (React.isValidElement(node)) {\n const props = node.props as { 'aria-label'?: string; label?: unknown; children?: React.ReactNode };\n if (typeof props['aria-label'] === 'string') return props['aria-label'];\n return nodeText(props.children) || (typeof props.label === 'string' ? props.label : '');\n }\n return '';\n}\n\n/** A number and its unit never break apart: the space between them becomes a no-break space (U+00A0), so\n * 「100 MB」「29 °C」「3 筆」 do not wrap as 「100 / MB」 on a phone, nor a currency before the number (「NT$ 1,280」).\n * Leaves every other space alone. */\nexport function keepUnits(text: string): string {\n return text\n .replace(/(\\d) (?=°|%|‰|[A-Za-zµΩ]{1,4}(?![A-Za-z])|[\\u3400-\\u9fff])/g, '$1\\u00a0')\n .replace(/((?:^|[^\\w$])(?:[A-Z]{2}\\$|[$€£¥₩])) (?=[-−]?\\d)/g, '$1\\u00a0');\n}\n"],"mappings":";;;;;;AAIA,MAAa,UAAU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