@robert-stackflow/oneui 0.6.8 → 0.6.16
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/CHANGELOG.md +58 -0
- package/README.md +255 -188
- package/components/AccountItem.module.css +103 -103
- package/components/Alert.d.ts +2 -9
- package/components/Alert.js +2 -40
- package/components/AppShell.d.ts +7 -7
- package/components/AppShell.js +37 -33
- package/components/AppShell.module.css +223 -271
- package/components/AppearanceSettings.js +25 -32
- package/components/Badge.module.css +30 -30
- package/components/Banner.d.ts +17 -0
- package/components/Banner.js +99 -0
- package/components/Banner.module.css +143 -0
- package/components/BarChart.module.css +35 -34
- package/components/Breadcrumb.module.css +97 -97
- package/components/Button.module.css +120 -120
- package/components/Cascader.js +1 -0
- package/components/CharacterPicker.js +2 -0
- package/components/Checkbox.module.css +95 -95
- package/components/Combobox.js +1 -0
- package/components/Combobox.module.css +6 -1
- package/components/CommandPalette.js +2 -2
- package/components/ContributionCalendar.module.css +121 -121
- package/components/Control.module.css +86 -86
- package/components/DataTable.d.ts +3 -2
- package/components/DataTable.js +92 -66
- package/components/DataTable.module.css +3 -31
- package/components/DatePicker.js +1 -0
- package/components/DateRangePicker.js +1 -0
- package/components/Dialog.d.ts +3 -1
- package/components/Dialog.js +11 -4
- package/components/Dialog.module.css +139 -97
- package/components/DialogVariants.d.ts +2 -1
- package/components/DialogVariants.js +35 -7
- package/components/HierarchyPicker.module.css +185 -181
- package/components/IconPicker.js +2 -0
- package/components/Indicator.module.css +83 -83
- package/components/Layout.module.css +82 -82
- package/components/Markdown.d.ts +13 -0
- package/components/Markdown.js +164 -0
- package/components/Markdown.module.css +227 -0
- package/components/MenuItem.module.css +172 -172
- package/components/MultiSelect.js +1 -0
- package/components/MultiSelect.module.css +2 -0
- package/components/NavBar.d.ts +20 -0
- package/components/NavBar.js +197 -0
- package/components/NavBar.module.css +130 -0
- package/components/NavigationSurface.module.css +27 -0
- package/components/Picker.module.css +7 -0
- package/components/Popover.d.ts +6 -1
- package/components/Popover.js +39 -13
- package/components/Popover.module.css +8 -0
- package/components/Progress.module.css +33 -33
- package/components/RadioGroup.module.css +87 -87
- package/components/RangeSlider.module.css +141 -141
- package/components/ResizablePanel.module.css +101 -101
- package/components/ResourceCard.module.css +98 -98
- package/components/SelectSettingRow.d.ts +7 -0
- package/components/SelectSettingRow.js +58 -0
- package/components/SettingRow.d.ts +9 -3
- package/components/SettingRow.js +32 -8
- package/components/SettingRow.module.css +17 -0
- package/components/SettingsLayout.d.ts +15 -3
- package/components/SettingsLayout.js +46 -29
- package/components/SideBar.d.ts +9 -0
- package/components/SideBar.js +30 -0
- package/components/SidebarNavigation.d.ts +24 -3
- package/components/SidebarNavigation.js +274 -47
- package/components/SidebarNavigation.module.css +352 -130
- package/components/Slider.module.css +19 -19
- package/components/Steps.module.css +176 -176
- package/components/Switch.d.ts +3 -1
- package/components/Switch.js +5 -1
- package/components/Switch.module.css +59 -59
- package/components/SwitchSettingRow.d.ts +7 -0
- package/components/SwitchSettingRow.js +45 -0
- package/components/Table.d.ts +8 -1
- package/components/Table.js +34 -17
- package/components/Table.module.css +87 -48
- package/components/TableMarkup.d.ts +2 -1
- package/components/TableMarkup.js +18 -1
- package/components/TableOfContents.d.ts +22 -0
- package/components/TableOfContents.js +462 -0
- package/components/TableOfContents.module.css +252 -0
- package/components/TextAreaSettingRow.d.ts +9 -0
- package/components/TextAreaSettingRow.js +47 -0
- package/components/TextSettingRow.d.ts +9 -0
- package/components/TextSettingRow.js +45 -0
- package/components/ThemePicker.module.css +178 -178
- package/components/ThemeProvider.js +2 -0
- package/components/TimeColumns.module.css +47 -47
- package/components/Timeline.module.css +202 -202
- package/components/Toast.d.ts +8 -1
- package/components/Toast.js +49 -17
- package/components/Toast.module.css +25 -0
- package/components/ToastProvider.d.ts +4 -1
- package/components/ToastProvider.js +67 -12
- package/components/TreeSelect.js +1 -0
- package/components/TreeTable.d.ts +3 -3
- package/components/TreeTable.js +12 -2
- package/components/TreeTable.module.css +57 -53
- package/components/createToaster.d.ts +2 -1
- package/components/createToaster.js +28 -14
- package/components/index.d.ts +18 -1
- package/components/index.js +24 -0
- package/components/motion.d.ts +1 -0
- package/components/motion.js +18 -6
- package/components/settingRowControl.d.ts +7 -0
- package/components/settingRowControl.js +15 -0
- package/package.json +57 -3
- package/styles/base.css +206 -206
- package/styles/blue.css +270 -268
- package/styles/minimal.css +1 -0
package/components/TreeSelect.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Column } from "./Table";
|
|
2
|
-
export type TreeTableProps<T, K extends string | number> = {
|
|
1
|
+
import { type Column, type TableAppearance } from "./Table";
|
|
2
|
+
export type TreeTableProps<T, K extends string | number> = TableAppearance & {
|
|
3
3
|
rows: T[];
|
|
4
4
|
columns: Column<T>[];
|
|
5
5
|
rowKey(row: T): K;
|
|
@@ -12,4 +12,4 @@ export type TreeTableProps<T, K extends string | number> = {
|
|
|
12
12
|
defaultExpandAll?: boolean;
|
|
13
13
|
onExpandedChange?(keys: K[]): void;
|
|
14
14
|
};
|
|
15
|
-
export declare function TreeTable<T, K extends string | number>({ rows, columns, rowKey, getChildren, rowLabel, label, treeColumn, expanded, defaultExpanded, defaultExpandAll, onExpandedChange, }: TreeTableProps<T, K>): import("react").JSX.Element;
|
|
15
|
+
export declare function TreeTable<T, K extends string | number>({ rows, columns, rowKey, getChildren, rowLabel, label, treeColumn, expanded, defaultExpanded, defaultExpandAll, onExpandedChange, striped, density, hoverable, bordered, stickyHeader, }: TreeTableProps<T, K>): import("react").JSX.Element;
|
package/components/TreeTable.js
CHANGED
|
@@ -16,7 +16,12 @@ function TreeTable({
|
|
|
16
16
|
expanded,
|
|
17
17
|
defaultExpanded = [],
|
|
18
18
|
defaultExpandAll = false,
|
|
19
|
-
onExpandedChange
|
|
19
|
+
onExpandedChange,
|
|
20
|
+
striped,
|
|
21
|
+
density,
|
|
22
|
+
hoverable,
|
|
23
|
+
bordered,
|
|
24
|
+
stickyHeader
|
|
20
25
|
}) {
|
|
21
26
|
const [local, setLocal] = useState(() => {
|
|
22
27
|
if (!defaultExpandAll) return defaultExpanded;
|
|
@@ -74,9 +79,14 @@ function TreeTable({
|
|
|
74
79
|
root.current?.querySelectorAll("tbody tr")[index]?.focus();
|
|
75
80
|
};
|
|
76
81
|
const active = visible.some((entry) => entry.key === focused) ? focused : visible[0]?.key;
|
|
77
|
-
return /* @__PURE__ */ jsx("div", { className: s.root, ref: root, children: /* @__PURE__ */ jsx(
|
|
82
|
+
return /* @__PURE__ */ jsx("div", { className: s.root, ref: root, "data-density": density, children: /* @__PURE__ */ jsx(
|
|
78
83
|
Table,
|
|
79
84
|
{
|
|
85
|
+
striped,
|
|
86
|
+
density,
|
|
87
|
+
hoverable,
|
|
88
|
+
bordered,
|
|
89
|
+
stickyHeader,
|
|
80
90
|
label,
|
|
81
91
|
role: "treegrid",
|
|
82
92
|
rows: visible,
|
|
@@ -1,53 +1,57 @@
|
|
|
1
|
-
.root {
|
|
2
|
-
|
|
3
|
-
border-radius: var(--card-radius);
|
|
4
|
-
background: var(--surface);
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
box-shadow: var(--card-shadow, none);
|
|
7
|
-
}
|
|
8
|
-
.root table td {
|
|
9
|
-
padding: 0 18px;
|
|
10
|
-
border-bottom: 0;
|
|
11
|
-
}
|
|
12
|
-
.root table th {
|
|
13
|
-
padding: 14px 18px;
|
|
14
|
-
}
|
|
15
|
-
.root
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
.root
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
gap: 8px;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
48
|
-
.expander
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
1
|
+
.root {
|
|
2
|
+
--table-radius: var(--card-radius);
|
|
3
|
+
border-radius: var(--card-radius);
|
|
4
|
+
background: var(--surface);
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
box-shadow: var(--card-shadow, none);
|
|
7
|
+
}
|
|
8
|
+
.root table td {
|
|
9
|
+
padding: 0 18px;
|
|
10
|
+
border-bottom: 0;
|
|
11
|
+
}
|
|
12
|
+
.root table th {
|
|
13
|
+
padding: 14px 18px;
|
|
14
|
+
}
|
|
15
|
+
.root[data-density="compact"] .cell {
|
|
16
|
+
min-height: 48px;
|
|
17
|
+
padding-block: 8px;
|
|
18
|
+
}
|
|
19
|
+
.root tr:focus-visible {
|
|
20
|
+
outline: 1px solid var(--accent-ink, var(--accent));
|
|
21
|
+
outline-offset: -1px;
|
|
22
|
+
}
|
|
23
|
+
.root table tr[data-tree-root="true"]:not(:first-child) td {
|
|
24
|
+
border-top: 1px solid var(--line);
|
|
25
|
+
}
|
|
26
|
+
.cell {
|
|
27
|
+
--tree-elbow-gap: 8px;
|
|
28
|
+
position: relative;
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
min-height: 72px;
|
|
33
|
+
padding-block: 14px;
|
|
34
|
+
min-width: 260px;
|
|
35
|
+
white-space: normal;
|
|
36
|
+
}
|
|
37
|
+
.expander,
|
|
38
|
+
.spacer {
|
|
39
|
+
flex: 0 0 24px;
|
|
40
|
+
width: 24px;
|
|
41
|
+
height: 26px;
|
|
42
|
+
}
|
|
43
|
+
.content {
|
|
44
|
+
position: relative;
|
|
45
|
+
flex: 1;
|
|
46
|
+
min-width: 0;
|
|
47
|
+
}
|
|
48
|
+
.expander svg {
|
|
49
|
+
width: 14px;
|
|
50
|
+
height: 14px;
|
|
51
|
+
}
|
|
52
|
+
.expander[aria-expanded="false"] svg {
|
|
53
|
+
rotate: -90deg;
|
|
54
|
+
}
|
|
55
|
+
.expander[aria-expanded="true"] svg {
|
|
56
|
+
rotate: 0deg;
|
|
57
|
+
}
|
|
@@ -7,6 +7,7 @@ export interface ToastController {
|
|
|
7
7
|
clear(id?: number): void;
|
|
8
8
|
subscribe(listener: () => void): () => void;
|
|
9
9
|
getSnapshot(): ToastMessage | null;
|
|
10
|
+
getQueueSnapshot?(): readonly ToastMessage[];
|
|
10
11
|
}
|
|
11
|
-
/**
|
|
12
|
+
/** Isolated immutable queue; the latest-message snapshot remains compatible. */
|
|
12
13
|
export declare function createToaster(): ToastController;
|
|
@@ -1,30 +1,43 @@
|
|
|
1
1
|
let nextController = 0;
|
|
2
2
|
function createToaster() {
|
|
3
|
-
let
|
|
3
|
+
let messages = [], counter = 0;
|
|
4
4
|
const listeners = /* @__PURE__ */ new Set();
|
|
5
|
-
const publish = (
|
|
6
|
-
|
|
7
|
-
current = message;
|
|
5
|
+
const publish = (next) => {
|
|
6
|
+
messages = next;
|
|
8
7
|
listeners.forEach((listener) => listener());
|
|
9
8
|
};
|
|
10
|
-
const dismiss = (id
|
|
11
|
-
if (
|
|
12
|
-
|
|
9
|
+
const dismiss = (id) => {
|
|
10
|
+
if (messages.some(
|
|
11
|
+
(message) => (id === void 0 || message.id === id) && !message.closing
|
|
12
|
+
))
|
|
13
|
+
publish(
|
|
14
|
+
messages.map(
|
|
15
|
+
(message) => id === void 0 || message.id === id ? { ...message, closing: true } : message
|
|
16
|
+
)
|
|
17
|
+
);
|
|
13
18
|
};
|
|
14
19
|
return {
|
|
15
20
|
id: "oneui-toast-" + ++nextController,
|
|
16
21
|
notify(message, options) {
|
|
17
|
-
const
|
|
18
|
-
|
|
22
|
+
const config = typeof options === "string" ? { tone: options } : options;
|
|
23
|
+
const existing = config?.id === void 0 ? void 0 : messages.find((entry) => entry.options?.id === config.id);
|
|
24
|
+
const id = existing?.id ?? ++counter;
|
|
25
|
+
const next = {
|
|
19
26
|
message,
|
|
20
27
|
id,
|
|
21
|
-
options:
|
|
22
|
-
|
|
28
|
+
options: { ...existing?.options, ...config },
|
|
29
|
+
closing: false
|
|
30
|
+
};
|
|
31
|
+
publish(
|
|
32
|
+
existing ? messages.map((entry) => entry.id === id ? next : entry) : [...messages, next]
|
|
33
|
+
);
|
|
23
34
|
return () => dismiss(id);
|
|
24
35
|
},
|
|
25
36
|
dismiss,
|
|
26
|
-
clear(id
|
|
27
|
-
|
|
37
|
+
clear(id) {
|
|
38
|
+
publish(
|
|
39
|
+
id === void 0 ? [] : messages.filter((message) => message.id !== id)
|
|
40
|
+
);
|
|
28
41
|
},
|
|
29
42
|
subscribe(listener) {
|
|
30
43
|
listeners.add(listener);
|
|
@@ -32,7 +45,8 @@ function createToaster() {
|
|
|
32
45
|
listeners.delete(listener);
|
|
33
46
|
};
|
|
34
47
|
},
|
|
35
|
-
getSnapshot: () =>
|
|
48
|
+
getSnapshot: () => messages.at(-1) ?? null,
|
|
49
|
+
getQueueSnapshot: () => messages
|
|
36
50
|
};
|
|
37
51
|
}
|
|
38
52
|
export {
|
package/components/index.d.ts
CHANGED
|
@@ -19,7 +19,11 @@ export { SearchField } from "./SearchField";
|
|
|
19
19
|
export { Section } from "./Section";
|
|
20
20
|
export { Segmented } from "./Segmented";
|
|
21
21
|
export { Select } from "./Select";
|
|
22
|
-
export { SettingRow } from "./SettingRow";
|
|
22
|
+
export { SettingRow, type SettingRowProps } from "./SettingRow";
|
|
23
|
+
export { TextSettingRow, type TextSettingRowProps } from "./TextSettingRow";
|
|
24
|
+
export { TextAreaSettingRow, type TextAreaSettingRowProps, } from "./TextAreaSettingRow";
|
|
25
|
+
export { SwitchSettingRow, type SwitchSettingRowProps, } from "./SwitchSettingRow";
|
|
26
|
+
export { SelectSettingRow, type SelectSettingRowProps, } from "./SelectSettingRow";
|
|
23
27
|
export { Skeleton } from "./Skeleton";
|
|
24
28
|
export { SkeletonRows } from "./SkeletonRows";
|
|
25
29
|
export { Switch } from "./Switch";
|
|
@@ -170,3 +174,16 @@ export { BarChart } from "./BarChart";
|
|
|
170
174
|
export { Mark } from "./Layout";
|
|
171
175
|
export { ResourceCard } from "./ResourceCard";
|
|
172
176
|
export { UptimeChart, type UptimePoint } from "./UptimeChart";
|
|
177
|
+
export { SideBar } from "./SideBar";
|
|
178
|
+
export type { SideBarProps } from "./SideBar";
|
|
179
|
+
export { NavBar } from "./NavBar";
|
|
180
|
+
export type { NavBarProps, NavBarItem } from "./NavBar";
|
|
181
|
+
export type { SettingsNavigationItem, SettingsNavigationGroup, } from "./SettingsLayout";
|
|
182
|
+
export { Markdown } from "./Markdown";
|
|
183
|
+
export type { MarkdownProps } from "./Markdown";
|
|
184
|
+
export { Banner } from "./Banner";
|
|
185
|
+
export type { BannerProps } from "./Banner";
|
|
186
|
+
export type { TableAppearance } from "./Table";
|
|
187
|
+
export { TableOfContents } from "./TableOfContents";
|
|
188
|
+
export type { TableOfContentsProps, TableOfContentsItem, } from "./TableOfContents";
|
|
189
|
+
export type { MarkdownCodeTheme } from "./Markdown";
|
package/components/index.js
CHANGED
|
@@ -20,6 +20,16 @@ import { Section } from "./Section.js";
|
|
|
20
20
|
import { Segmented } from "./Segmented.js";
|
|
21
21
|
import { Select } from "./Select.js";
|
|
22
22
|
import { SettingRow } from "./SettingRow.js";
|
|
23
|
+
import { TextSettingRow } from "./TextSettingRow.js";
|
|
24
|
+
import {
|
|
25
|
+
TextAreaSettingRow
|
|
26
|
+
} from "./TextAreaSettingRow.js";
|
|
27
|
+
import {
|
|
28
|
+
SwitchSettingRow
|
|
29
|
+
} from "./SwitchSettingRow.js";
|
|
30
|
+
import {
|
|
31
|
+
SelectSettingRow
|
|
32
|
+
} from "./SelectSettingRow.js";
|
|
23
33
|
import { Skeleton } from "./Skeleton.js";
|
|
24
34
|
import { SkeletonRows } from "./SkeletonRows.js";
|
|
25
35
|
import { Switch } from "./Switch.js";
|
|
@@ -137,6 +147,11 @@ import { BarChart } from "./BarChart.js";
|
|
|
137
147
|
import { Mark } from "./Layout.js";
|
|
138
148
|
import { ResourceCard } from "./ResourceCard.js";
|
|
139
149
|
import { UptimeChart } from "./UptimeChart.js";
|
|
150
|
+
import { SideBar } from "./SideBar.js";
|
|
151
|
+
import { NavBar } from "./NavBar.js";
|
|
152
|
+
import { Markdown } from "./Markdown.js";
|
|
153
|
+
import { Banner } from "./Banner.js";
|
|
154
|
+
import { TableOfContents } from "./TableOfContents.js";
|
|
140
155
|
export {
|
|
141
156
|
Accordion,
|
|
142
157
|
AccountItem,
|
|
@@ -148,6 +163,7 @@ export {
|
|
|
148
163
|
Avatar,
|
|
149
164
|
AvatarGroup,
|
|
150
165
|
Badge,
|
|
166
|
+
Banner,
|
|
151
167
|
BarChart,
|
|
152
168
|
BlockedTab,
|
|
153
169
|
Box,
|
|
@@ -200,10 +216,12 @@ export {
|
|
|
200
216
|
LoadingOverlay,
|
|
201
217
|
LoadingState,
|
|
202
218
|
Mark,
|
|
219
|
+
Markdown,
|
|
203
220
|
Menu,
|
|
204
221
|
MenuItem,
|
|
205
222
|
MessageDialog,
|
|
206
223
|
MultiSelect,
|
|
224
|
+
NavBar,
|
|
207
225
|
NavigationButton,
|
|
208
226
|
NumberInput,
|
|
209
227
|
Page,
|
|
@@ -226,6 +244,7 @@ export {
|
|
|
226
244
|
Segmented,
|
|
227
245
|
Select,
|
|
228
246
|
SelectOptionContent,
|
|
247
|
+
SelectSettingRow,
|
|
229
248
|
SelectTrigger,
|
|
230
249
|
SessionItem,
|
|
231
250
|
SettingRow,
|
|
@@ -233,6 +252,7 @@ export {
|
|
|
233
252
|
SettingsLayout,
|
|
234
253
|
ShellHeader,
|
|
235
254
|
ShortcutInput,
|
|
255
|
+
SideBar,
|
|
236
256
|
SidebarNavigation,
|
|
237
257
|
SimpleGrid,
|
|
238
258
|
Skeleton,
|
|
@@ -246,14 +266,18 @@ export {
|
|
|
246
266
|
Steps,
|
|
247
267
|
Surface,
|
|
248
268
|
Switch,
|
|
269
|
+
SwitchSettingRow,
|
|
249
270
|
SymbolPicker,
|
|
250
271
|
Table,
|
|
251
272
|
TableColumnFilter,
|
|
252
273
|
TableColumnVisibility,
|
|
253
274
|
TableMarkup,
|
|
275
|
+
TableOfContents,
|
|
254
276
|
Tabs,
|
|
255
277
|
TagInput,
|
|
256
278
|
Text,
|
|
279
|
+
TextAreaSettingRow,
|
|
280
|
+
TextSettingRow,
|
|
257
281
|
Textarea,
|
|
258
282
|
ThemePicker,
|
|
259
283
|
ThemeProvider,
|
package/components/motion.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export declare function motionDuration(token: string, fallback?: number): number
|
|
|
4
4
|
export declare const popupExitDuration: () => number;
|
|
5
5
|
export declare function cancelMotion(node: HTMLElement): void;
|
|
6
6
|
export declare function surfaceMotion(node: HTMLElement, phase: Phase, offset?: string, token?: string): Promise<boolean>;
|
|
7
|
+
export declare function toastMotion(node: HTMLElement, phase: Phase, position: string): Promise<boolean>;
|
|
7
8
|
export type MenuSide = "top" | "bottom" | "left" | "right";
|
|
8
9
|
export declare function menuSurfaceMotion(node: HTMLElement, phase: "enter" | "exit", side?: MenuSide): Promise<boolean>;
|
|
9
10
|
export {};
|
package/components/motion.js
CHANGED
|
@@ -15,18 +15,21 @@ function cancelMotion(node) {
|
|
|
15
15
|
state.animation = void 0;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function runMotion(node, phase, offset = "0 -4px", token, profile = "surface") {
|
|
19
19
|
const state = runs.get(node) || { revision: 0 };
|
|
20
20
|
runs.set(node, state);
|
|
21
21
|
const revision = ++state.revision, interrupted = !!state.animation, style = getComputedStyle(node);
|
|
22
22
|
const from = {
|
|
23
23
|
opacity: interrupted ? style.opacity : phase === "enter" ? "0" : phase === "update" ? ".78" : "1",
|
|
24
|
-
translate: interrupted ? style.translate : phase === "enter" ? offset : phase === "update" ? "0 2px" : "0 0"
|
|
24
|
+
translate: interrupted ? style.translate : phase === "enter" ? offset : phase === "update" ? profile === "toast" ? "0 0" : "0 2px" : "0 0"
|
|
25
25
|
};
|
|
26
|
+
const scale = profile === "toast" ? { scale: interrupted ? style.scale : phase === "enter" ? ".96" : "1" } : {};
|
|
27
|
+
Object.assign(from, scale);
|
|
26
28
|
state.animation?.cancel();
|
|
27
29
|
const to = {
|
|
28
30
|
opacity: phase === "exit" ? "0" : "1",
|
|
29
|
-
translate: phase === "exit" ? offset : "0 0"
|
|
31
|
+
translate: phase === "exit" ? offset : "0 0",
|
|
32
|
+
...profile === "toast" ? { scale: phase === "exit" ? ".98" : "1" } : {}
|
|
30
33
|
};
|
|
31
34
|
node.dataset.motionPhase = phase;
|
|
32
35
|
const finish = () => {
|
|
@@ -38,12 +41,13 @@ function surfaceMotion(node, phase, offset = "0 -4px", token) {
|
|
|
38
41
|
return true;
|
|
39
42
|
};
|
|
40
43
|
const duration = motionDuration(
|
|
41
|
-
token || (phase === "enter" ? "--popup-enter" : "--popup-exit")
|
|
44
|
+
token || (phase === "enter" ? "--popup-enter" : "--popup-exit"),
|
|
45
|
+
profile === "toast" ? phase === "enter" ? 280 : phase === "exit" ? 170 : 140 : 180
|
|
42
46
|
);
|
|
43
47
|
if (!duration || !node.isConnected) return Promise.resolve(finish());
|
|
44
48
|
const animation = node.animate([from, to], {
|
|
45
49
|
duration,
|
|
46
|
-
easing: getComputedStyle(document.documentElement).getPropertyValue("--ease").trim() || "ease-out",
|
|
50
|
+
easing: profile === "toast" ? phase === "exit" ? "cubic-bezier(.4,0,1,1)" : "cubic-bezier(.16,1,.3,1)" : getComputedStyle(document.documentElement).getPropertyValue("--ease").trim() || "ease-out",
|
|
47
51
|
fill: "both"
|
|
48
52
|
});
|
|
49
53
|
state.animation = animation;
|
|
@@ -63,6 +67,13 @@ function surfaceMotion(node, phase, offset = "0 -4px", token) {
|
|
|
63
67
|
policy.removeEventListener("change", stop);
|
|
64
68
|
});
|
|
65
69
|
}
|
|
70
|
+
function surfaceMotion(node, phase, offset = "0 -4px", token) {
|
|
71
|
+
return runMotion(node, phase, offset, token);
|
|
72
|
+
}
|
|
73
|
+
function toastMotion(node, phase, position) {
|
|
74
|
+
const offset = position.endsWith("right") ? "14px 0" : position.endsWith("left") ? "-14px 0" : position.startsWith("top") ? "0 -12px" : "0 12px";
|
|
75
|
+
return runMotion(node, phase, offset, `--toast-${phase}`, "toast");
|
|
76
|
+
}
|
|
66
77
|
function menuSurfaceMotion(node, phase, side = "bottom") {
|
|
67
78
|
const offset = {
|
|
68
79
|
top: "0 4px",
|
|
@@ -78,5 +89,6 @@ export {
|
|
|
78
89
|
motionDuration,
|
|
79
90
|
popupExitDuration,
|
|
80
91
|
reducedMotion,
|
|
81
|
-
surfaceMotion
|
|
92
|
+
surfaceMotion,
|
|
93
|
+
toastMotion
|
|
82
94
|
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { SettingRowProps } from "./SettingRow";
|
|
2
|
+
export type SettingControlOptions = Omit<SettingRowProps, "children" | "controlId" | "descriptionId">;
|
|
3
|
+
export declare function useSettingRowControl(id?: string, description?: string, describedBy?: string): {
|
|
4
|
+
controlId: string;
|
|
5
|
+
descriptionId: string | undefined;
|
|
6
|
+
describedBy: string | undefined;
|
|
7
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useId } from "react";
|
|
2
|
+
import { joinIds } from "./field.js";
|
|
3
|
+
function useSettingRowControl(id, description, describedBy) {
|
|
4
|
+
const generated = useId();
|
|
5
|
+
const controlId = id ?? generated;
|
|
6
|
+
const descriptionId = description ? `${controlId}-description` : void 0;
|
|
7
|
+
return {
|
|
8
|
+
controlId,
|
|
9
|
+
descriptionId,
|
|
10
|
+
describedBy: joinIds(descriptionId, describedBy)
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
useSettingRowControl
|
|
15
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@robert-stackflow/oneui",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.16",
|
|
4
4
|
"description": "OneUI React components, application shell and portable visual themes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -867,7 +867,57 @@
|
|
|
867
867
|
"import": "./components/UptimeChart.js",
|
|
868
868
|
"default": "./components/UptimeChart.js"
|
|
869
869
|
},
|
|
870
|
-
"./UptimeChart.module.css": "./components/UptimeChart.module.css"
|
|
870
|
+
"./UptimeChart.module.css": "./components/UptimeChart.module.css",
|
|
871
|
+
"./SideBar": {
|
|
872
|
+
"types": "./components/SideBar.d.ts",
|
|
873
|
+
"import": "./components/SideBar.js",
|
|
874
|
+
"default": "./components/SideBar.js"
|
|
875
|
+
},
|
|
876
|
+
"./NavBar": {
|
|
877
|
+
"types": "./components/NavBar.d.ts",
|
|
878
|
+
"import": "./components/NavBar.js",
|
|
879
|
+
"default": "./components/NavBar.js"
|
|
880
|
+
},
|
|
881
|
+
"./NavigationSurface.module.css": "./components/NavigationSurface.module.css",
|
|
882
|
+
"./NavBar.module.css": "./components/NavBar.module.css",
|
|
883
|
+
"./Markdown": {
|
|
884
|
+
"types": "./components/Markdown.d.ts",
|
|
885
|
+
"import": "./components/Markdown.js",
|
|
886
|
+
"default": "./components/Markdown.js"
|
|
887
|
+
},
|
|
888
|
+
"./Markdown.module.css": "./components/Markdown.module.css",
|
|
889
|
+
"./Banner": {
|
|
890
|
+
"types": "./components/Banner.d.ts",
|
|
891
|
+
"import": "./components/Banner.js",
|
|
892
|
+
"default": "./components/Banner.js"
|
|
893
|
+
},
|
|
894
|
+
"./Banner.module.css": "./components/Banner.module.css",
|
|
895
|
+
"./TableOfContents": {
|
|
896
|
+
"types": "./components/TableOfContents.d.ts",
|
|
897
|
+
"import": "./components/TableOfContents.js",
|
|
898
|
+
"default": "./components/TableOfContents.js"
|
|
899
|
+
},
|
|
900
|
+
"./TableOfContents.module.css": "./components/TableOfContents.module.css",
|
|
901
|
+
"./TextSettingRow": {
|
|
902
|
+
"types": "./components/TextSettingRow.d.ts",
|
|
903
|
+
"import": "./components/TextSettingRow.js",
|
|
904
|
+
"default": "./components/TextSettingRow.js"
|
|
905
|
+
},
|
|
906
|
+
"./TextAreaSettingRow": {
|
|
907
|
+
"types": "./components/TextAreaSettingRow.d.ts",
|
|
908
|
+
"import": "./components/TextAreaSettingRow.js",
|
|
909
|
+
"default": "./components/TextAreaSettingRow.js"
|
|
910
|
+
},
|
|
911
|
+
"./SwitchSettingRow": {
|
|
912
|
+
"types": "./components/SwitchSettingRow.d.ts",
|
|
913
|
+
"import": "./components/SwitchSettingRow.js",
|
|
914
|
+
"default": "./components/SwitchSettingRow.js"
|
|
915
|
+
},
|
|
916
|
+
"./SelectSettingRow": {
|
|
917
|
+
"types": "./components/SelectSettingRow.d.ts",
|
|
918
|
+
"import": "./components/SelectSettingRow.js",
|
|
919
|
+
"default": "./components/SelectSettingRow.js"
|
|
920
|
+
}
|
|
871
921
|
},
|
|
872
922
|
"files": [
|
|
873
923
|
"components",
|
|
@@ -881,7 +931,11 @@
|
|
|
881
931
|
"react-dom": "^19.2.0"
|
|
882
932
|
},
|
|
883
933
|
"dependencies": {
|
|
884
|
-
"
|
|
934
|
+
"hast-util-to-jsx-runtime": "2.3.6",
|
|
935
|
+
"lowlight": "3.3.0",
|
|
936
|
+
"lucide-react": "1.59.0",
|
|
937
|
+
"react-markdown": "10.1.0",
|
|
938
|
+
"remark-gfm": "4.0.1"
|
|
885
939
|
},
|
|
886
940
|
"license": "UNLICENSED",
|
|
887
941
|
"publishConfig": {
|