@rvx/ui 0.3.8 → 0.4.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/common/events.d.ts +0 -40
- package/dist/common/events.d.ts.map +1 -1
- package/dist/common/theme.d.ts +3 -134
- package/dist/common/theme.d.ts.map +1 -1
- package/dist/common/theme.js +25 -2
- package/dist/common/theme.js.map +1 -1
- package/dist/common/writing-mode.d.ts +0 -58
- package/dist/common/writing-mode.d.ts.map +1 -1
- package/dist/components/breadcrumbs.d.ts.map +1 -1
- package/dist/components/breadcrumbs.js +3 -4
- package/dist/components/breadcrumbs.js.map +1 -1
- package/dist/components/button.d.ts +0 -18
- package/dist/components/button.d.ts.map +1 -1
- package/dist/components/button.js +3 -4
- package/dist/components/button.js.map +1 -1
- package/dist/components/card.d.ts +1 -1
- package/dist/components/card.d.ts.map +1 -1
- package/dist/components/card.js +4 -5
- package/dist/components/card.js.map +1 -1
- package/dist/components/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox.js +4 -5
- package/dist/components/checkbox.js.map +1 -1
- package/dist/components/collapse.d.ts.map +1 -1
- package/dist/components/collapse.js +7 -10
- package/dist/components/collapse.js.map +1 -1
- package/dist/components/column.d.ts +0 -6
- package/dist/components/column.d.ts.map +1 -1
- package/dist/components/column.js +4 -5
- package/dist/components/column.js.map +1 -1
- package/dist/components/control-group.d.ts.map +1 -1
- package/dist/components/control-group.js +3 -4
- package/dist/components/control-group.js.map +1 -1
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/dialog.js +14 -10
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/dropdown-input.d.ts +1 -1
- package/dist/components/dropdown-input.d.ts.map +1 -1
- package/dist/components/dropdown.d.ts +0 -88
- package/dist/components/dropdown.d.ts.map +1 -1
- package/dist/components/dropdown.js +7 -8
- package/dist/components/dropdown.js.map +1 -1
- package/dist/components/error.d.ts.map +1 -1
- package/dist/components/error.js +2 -3
- package/dist/components/error.js.map +1 -1
- package/dist/components/flex-space.d.ts.map +1 -1
- package/dist/components/flex-space.js +3 -4
- package/dist/components/flex-space.js.map +1 -1
- package/dist/components/heading.d.ts +0 -3
- package/dist/components/heading.d.ts.map +1 -1
- package/dist/components/heading.js +2 -3
- package/dist/components/heading.js.map +1 -1
- package/dist/components/label.d.ts.map +1 -1
- package/dist/components/label.js +2 -3
- package/dist/components/label.js.map +1 -1
- package/dist/components/layer.d.ts +0 -63
- package/dist/components/layer.d.ts.map +1 -1
- package/dist/components/link.d.ts +0 -33
- package/dist/components/link.d.ts.map +1 -1
- package/dist/components/link.js +2 -3
- package/dist/components/link.js.map +1 -1
- package/dist/components/nav-list.d.ts +0 -8
- package/dist/components/nav-list.d.ts.map +1 -1
- package/dist/components/nav-list.js +4 -6
- package/dist/components/nav-list.js.map +1 -1
- package/dist/components/notifications.d.ts +4 -1
- package/dist/components/notifications.d.ts.map +1 -1
- package/dist/components/notifications.js +5 -11
- package/dist/components/notifications.js.map +1 -1
- package/dist/components/page.d.ts.map +1 -1
- package/dist/components/page.js +4 -5
- package/dist/components/page.js.map +1 -1
- package/dist/components/placeholder.d.ts.map +1 -1
- package/dist/components/placeholder.js +3 -4
- package/dist/components/placeholder.js.map +1 -1
- package/dist/components/popout.d.ts +0 -96
- package/dist/components/popout.d.ts.map +1 -1
- package/dist/components/popover.d.ts +0 -88
- package/dist/components/popover.d.ts.map +1 -1
- package/dist/components/popover.js +9 -9
- package/dist/components/popover.js.map +1 -1
- package/dist/components/radio-buttons.d.ts.map +1 -1
- package/dist/components/radio-buttons.js +4 -5
- package/dist/components/radio-buttons.js.map +1 -1
- package/dist/components/row.d.ts.map +1 -1
- package/dist/components/row.js +4 -5
- package/dist/components/row.js.map +1 -1
- package/dist/components/scroll-view.d.ts.map +1 -1
- package/dist/components/scroll-view.js +8 -9
- package/dist/components/scroll-view.js.map +1 -1
- package/dist/components/secondary.d.ts.map +1 -1
- package/dist/components/secondary.js +2 -3
- package/dist/components/secondary.js.map +1 -1
- package/dist/components/separated.d.ts.map +1 -1
- package/dist/components/separated.js +2 -3
- package/dist/components/separated.js.map +1 -1
- package/dist/components/slider.d.ts.map +1 -1
- package/dist/components/slider.js +2 -3
- package/dist/components/slider.js.map +1 -1
- package/dist/components/tabs.d.ts.map +1 -1
- package/dist/components/tabs.js +8 -9
- package/dist/components/tabs.js.map +1 -1
- package/dist/components/text-input.d.ts +0 -31
- package/dist/components/text-input.d.ts.map +1 -1
- package/dist/components/text-input.js +2 -3
- package/dist/components/text-input.js.map +1 -1
- package/dist/components/text.d.ts.map +1 -1
- package/dist/components/text.js +2 -3
- package/dist/components/text.js.map +1 -1
- package/dist/components/validation-rules.d.ts +0 -2
- package/dist/components/validation-rules.d.ts.map +1 -1
- package/dist/components/validation.d.ts +0 -49
- package/dist/components/validation.d.ts.map +1 -1
- package/dist/components/value.d.ts.map +1 -1
- package/dist/components/value.js +2 -3
- package/dist/components/value.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/package.json +12 -7
- package/src/common/theme.tsx +28 -163
- package/src/components/breadcrumbs.tsx +4 -5
- package/src/components/button.tsx +3 -4
- package/src/components/card.tsx +5 -6
- package/src/components/checkbox.tsx +5 -7
- package/src/components/collapse.tsx +9 -13
- package/src/components/column.tsx +4 -5
- package/src/components/control-group.tsx +3 -4
- package/src/components/dialog.tsx +14 -11
- package/src/components/dropdown-input.tsx +1 -1
- package/src/components/dropdown.tsx +7 -8
- package/src/components/error.tsx +2 -3
- package/src/components/flex-space.tsx +3 -4
- package/src/components/heading.tsx +2 -3
- package/src/components/label.tsx +2 -3
- package/src/components/link.tsx +2 -3
- package/src/components/nav-list.tsx +4 -6
- package/src/components/notifications.tsx +15 -17
- package/src/components/page.tsx +6 -7
- package/src/components/placeholder.tsx +5 -6
- package/src/components/popover.tsx +10 -10
- package/src/components/radio-buttons.tsx +6 -7
- package/src/components/row.tsx +4 -5
- package/src/components/scroll-view.tsx +8 -9
- package/src/components/secondary.tsx +2 -3
- package/src/components/separated.tsx +2 -3
- package/src/components/slider.tsx +2 -5
- package/src/components/tabs.tsx +8 -9
- package/src/components/text-input.tsx +2 -3
- package/src/components/text.tsx +2 -3
- package/src/components/value.tsx +2 -3
- package/src/index.tsx +2 -0
- package/src/types.d.ts +5 -0
- package/{src/theme/components/breadcrumbs.scss → theme/components/breadcrumbs.module.css} +12 -12
- package/theme/components/button.module.css +168 -0
- package/theme/components/card.module.css +50 -0
- package/{src/theme/components/checkbox.scss → theme/components/checkbox.module.css} +5 -5
- package/{src/theme/components/collapse.scss → theme/components/collapse.module.css} +19 -19
- package/{src/theme/components/column.scss → theme/components/column.module.css} +32 -10
- package/{src/theme/components/control-group.scss → theme/components/control-group.module.css} +2 -2
- package/theme/components/dialog.module.css +63 -0
- package/{src/theme/components/dropdown.scss → theme/components/dropdown.module.css} +9 -9
- package/theme/components/error.module.css +4 -0
- package/{src/theme/components/heading.scss → theme/components/heading.module.css} +8 -8
- package/{src/theme/components/label.scss → theme/components/label.module.css} +2 -10
- package/{src/theme/components/link.scss → theme/components/link.module.css} +0 -1
- package/theme/components/nav-list.module.css +76 -0
- package/theme/components/notifications.module.css +31 -0
- package/{src/theme/components/page.scss → theme/components/page.module.css} +6 -10
- package/{src/theme/components/placeholder.scss → theme/components/placeholder.module.css} +3 -3
- package/{src/theme/components/popover.scss → theme/components/popover.module.css} +9 -9
- package/theme/components/row.module.css +36 -0
- package/{src/theme/components/scroll-view.scss → theme/components/scroll-view.module.css} +19 -21
- package/theme/components/secondary.module.css +4 -0
- package/{src/theme/components/separated.scss → theme/components/separated.module.css} +2 -2
- package/{src/theme/components/slider.scss → theme/components/slider.module.css} +2 -1
- package/theme/components/tabs.module.css +71 -0
- package/theme/components/text-input.module.css +45 -0
- package/theme/global.css +118 -0
- package/dist/common/theme-test.d.ts +0 -8
- package/dist/common/theme-test.d.ts.map +0 -1
- package/dist/common/theme-test.js +0 -13
- package/dist/common/theme-test.js.map +0 -1
- package/dist/components/checkbox-test.d.ts +0 -4
- package/dist/components/checkbox-test.d.ts.map +0 -1
- package/dist/components/checkbox-test.js +0 -31
- package/dist/components/checkbox-test.js.map +0 -1
- package/dist/components/collapse-test.d.ts +0 -9
- package/dist/components/collapse-test.d.ts.map +0 -1
- package/dist/components/collapse-test.js +0 -15
- package/dist/components/collapse-test.js.map +0 -1
- package/dist/test.d.ts +0 -4
- package/dist/test.d.ts.map +0 -1
- package/dist/test.js +0 -4
- package/dist/test.js.map +0 -1
- package/dist/theme.module.css +0 -1290
- package/dist/theme.module.css.map +0 -1
- package/src/common/theme-test.tsx +0 -18
- package/src/components/checkbox-test.tsx +0 -35
- package/src/components/collapse-test.tsx +0 -23
- package/src/test.tsx +0 -3
- package/src/theme/base.scss +0 -121
- package/src/theme/common.scss +0 -42
- package/src/theme/components/button.scss +0 -164
- package/src/theme/components/card.scss +0 -41
- package/src/theme/components/dialog.scss +0 -65
- package/src/theme/components/error.scss +0 -12
- package/src/theme/components/nav-list.scss +0 -91
- package/src/theme/components/notifications.scss +0 -61
- package/src/theme/components/row.scss +0 -22
- package/src/theme/components/secondary.scss +0 -4
- package/src/theme/components/tabs.scss +0 -90
- package/src/theme/components/text-input.scss +0 -50
- package/src/theme/theme.scss +0 -31
- /package/{src/theme/components/flex-space.scss → theme/components/flex-space.module.css} +0 -0
- /package/{src/theme/components/radio-buttons.scss → theme/components/radio-buttons.module.css} +0 -0
- /package/{src/theme/components/text.scss → theme/components/text.module.css} +0 -0
- /package/{src/theme/components/value.scss → theme/components/value.module.css} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/column.module.css";
|
|
1
2
|
import { ClassValue, Expression, map, StyleValue } from "rvx";
|
|
2
|
-
import { THEME } from "../common/theme.js";
|
|
3
3
|
import { SizeContext } from "../common/types.js";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -13,12 +13,11 @@ export function Column(props: {
|
|
|
13
13
|
id?: Expression<string | undefined>;
|
|
14
14
|
children?: unknown;
|
|
15
15
|
}): unknown {
|
|
16
|
-
const theme = THEME.current;
|
|
17
16
|
return <div
|
|
18
17
|
class={[
|
|
19
|
-
|
|
20
|
-
map(props.size, size =>
|
|
21
|
-
map(props.padded, padded => padded ?
|
|
18
|
+
styles.column,
|
|
19
|
+
map(props.size, size => styles[size ?? "content"]),
|
|
20
|
+
map(props.padded, padded => padded ? styles.padded : undefined),
|
|
22
21
|
props.class,
|
|
23
22
|
]}
|
|
24
23
|
style={props.style}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/control-group.module.css";
|
|
1
2
|
import { ClassValue, Expression, map, StyleValue } from "rvx";
|
|
2
|
-
import { THEME } from "../common/theme.js";
|
|
3
3
|
|
|
4
4
|
export function ControlGroup(props: {
|
|
5
5
|
class?: ClassValue;
|
|
@@ -8,12 +8,11 @@ export function ControlGroup(props: {
|
|
|
8
8
|
children?: unknown;
|
|
9
9
|
column?: Expression<boolean | undefined>;
|
|
10
10
|
}): unknown {
|
|
11
|
-
const theme = THEME.current;
|
|
12
11
|
return <div
|
|
13
12
|
class={[
|
|
14
|
-
|
|
13
|
+
styles.control_group,
|
|
15
14
|
props.class,
|
|
16
|
-
map(props.column, column => column ?
|
|
15
|
+
map(props.column, column => column ? styles.column : styles.row),
|
|
17
16
|
]}
|
|
18
17
|
style={props.style}
|
|
19
18
|
id={props.id}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/dialog.module.css";
|
|
1
2
|
import { $, captureSelf, ClassValue, Context, Emitter, Event, Expression, map, render, StyleValue, teardown, uniqueId } from "rvx";
|
|
2
3
|
import { TASKS, Tasks, useMicrotask } from "rvx/async";
|
|
3
4
|
import { inOverlayContext } from "../common/context.js";
|
|
4
|
-
import { Column,
|
|
5
|
+
import { Column, Group } from "./column.js";
|
|
6
|
+
import { FlexSpace } from "./flex-space.js";
|
|
7
|
+
import { Heading } from "./heading.js";
|
|
5
8
|
import { LAYER, Layer } from "./layer.js";
|
|
9
|
+
import { Row } from "./row.js";
|
|
10
|
+
import { Separated } from "./separated.js";
|
|
11
|
+
import { Text } from "./text.js";
|
|
6
12
|
|
|
7
13
|
export class DialogAbortError extends Error { }
|
|
8
14
|
|
|
@@ -83,8 +89,6 @@ export function DialogBody(props: {
|
|
|
83
89
|
"aria-labelledby"?: Expression<string | undefined>;
|
|
84
90
|
"aria-describedby"?: Expression<string | undefined>;
|
|
85
91
|
}): unknown {
|
|
86
|
-
const theme = THEME.current;
|
|
87
|
-
|
|
88
92
|
let titleId: string | undefined;
|
|
89
93
|
let descriptionId: string | undefined;
|
|
90
94
|
const head: unknown[] = [];
|
|
@@ -100,7 +104,7 @@ export function DialogBody(props: {
|
|
|
100
104
|
|
|
101
105
|
const body = <div
|
|
102
106
|
class={[
|
|
103
|
-
|
|
107
|
+
styles.container,
|
|
104
108
|
props.class,
|
|
105
109
|
]}
|
|
106
110
|
style={[
|
|
@@ -114,22 +118,22 @@ export function DialogBody(props: {
|
|
|
114
118
|
aria-labelledby={map(props["aria-labelledby"], v => v ?? titleId)}
|
|
115
119
|
aria-describedby={map(props["aria-describedby"], v => v ?? descriptionId)}
|
|
116
120
|
>
|
|
117
|
-
<Separated class={
|
|
121
|
+
<Separated class={styles.body}>
|
|
118
122
|
{head.length > 0 ? <Group padded>{head}</Group> : undefined}
|
|
119
123
|
{props.children}
|
|
120
124
|
</Separated>
|
|
121
125
|
</div> as HTMLElement;
|
|
122
126
|
|
|
123
127
|
useMicrotask(() => {
|
|
124
|
-
if (
|
|
128
|
+
if (styles.fadein) {
|
|
125
129
|
body.offsetParent;
|
|
126
|
-
body.classList.add(
|
|
130
|
+
body.classList.add(styles.fadein);
|
|
127
131
|
}
|
|
128
132
|
});
|
|
129
133
|
|
|
130
134
|
DIALOG_FADEOUT.current?.(tasks => {
|
|
131
|
-
if (
|
|
132
|
-
body.classList.add(
|
|
135
|
+
if (styles.fadeout) {
|
|
136
|
+
body.classList.add(styles.fadeout);
|
|
133
137
|
}
|
|
134
138
|
const duration = parseInt(getComputedStyle(body).getPropertyValue("--layout-transition-ms"));
|
|
135
139
|
if (Number.isSafeInteger(duration)) {
|
|
@@ -150,11 +154,10 @@ export function DialogFooter(props: {
|
|
|
150
154
|
links?: unknown;
|
|
151
155
|
children?: unknown;
|
|
152
156
|
}): unknown {
|
|
153
|
-
const theme = THEME.current;
|
|
154
157
|
return <Group padded>
|
|
155
158
|
<Row
|
|
156
159
|
class={[
|
|
157
|
-
|
|
160
|
+
styles.footer,
|
|
158
161
|
props.class,
|
|
159
162
|
]}
|
|
160
163
|
style={props.style}
|
|
@@ -15,7 +15,7 @@ export function DropdownInput<T>(props: {
|
|
|
15
15
|
value: Expression<T>;
|
|
16
16
|
values: Expression<DropdownValue<T>[]>;
|
|
17
17
|
|
|
18
|
-
variant?: ButtonVariant
|
|
18
|
+
variant?: Expression<ButtonVariant | undefined>;
|
|
19
19
|
disabled?: Expression<boolean | undefined>;
|
|
20
20
|
|
|
21
21
|
class?: ClassValue;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/dropdown.module.css";
|
|
1
2
|
import { $, ClassValue, Expression, For, get, map, memo, render, StyleValue, uniqueId, View, watch } from "rvx";
|
|
2
3
|
import { optionalString } from "rvx/convert";
|
|
3
4
|
import { Action, createPassiveActionEvent, handleActionEvent, isKey, startDelayedHoverOnMouseenter } from "../common/events.js";
|
|
4
|
-
import { THEME } from "../common/theme.js";
|
|
5
5
|
import { LAYER } from "./layer.js";
|
|
6
6
|
import { Popout, PopoutAlignment, PopoutPlacement } from "./popout.js";
|
|
7
7
|
|
|
@@ -89,7 +89,6 @@ export function createDropdown(props: {
|
|
|
89
89
|
alignment: map(props.alignment, v => v ?? "start"),
|
|
90
90
|
foreignEvents: props.foreignEvents,
|
|
91
91
|
content: ({ popout, placement }) => {
|
|
92
|
-
const theme = THEME.current;
|
|
93
92
|
const layer = LAYER.current!;
|
|
94
93
|
|
|
95
94
|
const activeItem = $<DropdownItem | undefined>(undefined);
|
|
@@ -159,7 +158,7 @@ export function createDropdown(props: {
|
|
|
159
158
|
});
|
|
160
159
|
|
|
161
160
|
const content = <div class={[
|
|
162
|
-
|
|
161
|
+
styles.content,
|
|
163
162
|
]}>
|
|
164
163
|
<For each={items}>
|
|
165
164
|
{item => {
|
|
@@ -189,8 +188,8 @@ export function createDropdown(props: {
|
|
|
189
188
|
const root = <div
|
|
190
189
|
id={id}
|
|
191
190
|
class={[
|
|
192
|
-
|
|
193
|
-
() => activeItem.value === item &&
|
|
191
|
+
styles.item,
|
|
192
|
+
() => activeItem.value === item && styles.item_active,
|
|
194
193
|
]}
|
|
195
194
|
role="option"
|
|
196
195
|
aria-selected={item.selected}
|
|
@@ -231,8 +230,8 @@ export function createDropdown(props: {
|
|
|
231
230
|
style={props.style}
|
|
232
231
|
class={[
|
|
233
232
|
props.class,
|
|
234
|
-
|
|
235
|
-
map(props.expansion, v => v &&
|
|
233
|
+
styles.dropdown,
|
|
234
|
+
map(props.expansion, v => v && styles.expansion),
|
|
236
235
|
]}
|
|
237
236
|
role="listbox"
|
|
238
237
|
tabindex="0"
|
|
@@ -247,7 +246,7 @@ export function createDropdown(props: {
|
|
|
247
246
|
}
|
|
248
247
|
}}
|
|
249
248
|
>
|
|
250
|
-
<div class={
|
|
249
|
+
<div class={styles.scroll_area}>
|
|
251
250
|
{content}
|
|
252
251
|
</div>
|
|
253
252
|
</div> as HTMLElement;
|
package/src/components/error.tsx
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { THEME } from "../common/theme.js";
|
|
2
1
|
import { Text } from "./text.js";
|
|
2
|
+
import styles from "@rvx/ui/theme/components/error.module.css";
|
|
3
3
|
|
|
4
4
|
export function ErrorMessage(props: {
|
|
5
5
|
children: unknown;
|
|
6
6
|
}): unknown {
|
|
7
|
-
|
|
8
|
-
return <Text class={theme?.error_message}>
|
|
7
|
+
return <Text class={styles.message}>
|
|
9
8
|
{props.children}
|
|
10
9
|
</Text>;
|
|
11
10
|
}
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/flex-space.module.css";
|
|
1
2
|
import { Expression, get } from "rvx";
|
|
2
|
-
import { THEME } from "../common/theme.js";
|
|
3
3
|
|
|
4
4
|
export function FlexSpace(props: {
|
|
5
5
|
grow?: Expression<number | undefined>;
|
|
6
6
|
}): unknown {
|
|
7
|
-
const theme = THEME.current;
|
|
8
7
|
return <div
|
|
9
|
-
class={
|
|
8
|
+
class={styles.flex_space}
|
|
10
9
|
style={{
|
|
11
|
-
"flex-grow": () =>
|
|
10
|
+
"flex-grow": () => get(props.grow) ?? 1,
|
|
12
11
|
}}
|
|
13
12
|
/>;
|
|
14
13
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ClassValue, Expression, StyleValue } from "rvx";
|
|
2
|
-
import
|
|
2
|
+
import styles from "@rvx/ui/theme/components/heading.module.css";
|
|
3
3
|
|
|
4
4
|
export type HeadingLevel = "1" | "2" | "3" | "4" | "5" | "6";
|
|
5
5
|
|
|
@@ -10,10 +10,9 @@ export function Heading(props: {
|
|
|
10
10
|
id?: Expression<string | undefined>;
|
|
11
11
|
children?: unknown;
|
|
12
12
|
}): unknown {
|
|
13
|
-
const theme = THEME.current;
|
|
14
13
|
const Tag = `h${props.level}`;
|
|
15
14
|
return <Tag
|
|
16
|
-
class={[
|
|
15
|
+
class={[styles.heading, props.class]}
|
|
17
16
|
style={props.style}
|
|
18
17
|
id={props.id}
|
|
19
18
|
>
|
package/src/components/label.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/label.module.css";
|
|
1
2
|
import { ClassValue, Expression, StyleValue } from "rvx";
|
|
2
3
|
import { ID_PAIR } from "../common/id-pairs.js";
|
|
3
|
-
import { THEME } from "../common/theme.js";
|
|
4
4
|
|
|
5
5
|
export function Label(props: {
|
|
6
6
|
class?: ClassValue;
|
|
@@ -9,11 +9,10 @@ export function Label(props: {
|
|
|
9
9
|
id?: Expression<string | undefined>;
|
|
10
10
|
children?: unknown;
|
|
11
11
|
}): unknown {
|
|
12
|
-
const theme = THEME.current;
|
|
13
12
|
const idFor = props.for ?? ID_PAIR.current.prefix();
|
|
14
13
|
return <label
|
|
15
14
|
class={[
|
|
16
|
-
|
|
15
|
+
styles.label,
|
|
17
16
|
props.class,
|
|
18
17
|
]}
|
|
19
18
|
style={props.style}
|
package/src/components/link.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/link.module.css";
|
|
1
2
|
import { ClassValue, Expression, get, map, StyleValue } from "rvx";
|
|
2
3
|
import { isPending } from "rvx/async";
|
|
3
4
|
import { optionalString, separated } from "rvx/convert";
|
|
4
5
|
import { Action, handleActionEvent, isKey } from "../common/events.js";
|
|
5
|
-
import { THEME } from "../common/theme.js";
|
|
6
6
|
|
|
7
7
|
export type LinkReferrerPolicy = "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
|
8
8
|
|
|
@@ -71,7 +71,6 @@ export function Link(props: {
|
|
|
71
71
|
|
|
72
72
|
children?: unknown;
|
|
73
73
|
}): unknown {
|
|
74
|
-
const theme = THEME.current;
|
|
75
74
|
const disabled = () => isPending() || get(props.disabled);
|
|
76
75
|
|
|
77
76
|
function action(event: Event) {
|
|
@@ -84,7 +83,7 @@ export function Link(props: {
|
|
|
84
83
|
return <a
|
|
85
84
|
disabled={disabled}
|
|
86
85
|
class={[
|
|
87
|
-
|
|
86
|
+
styles.link,
|
|
88
87
|
props.class,
|
|
89
88
|
]}
|
|
90
89
|
style={props.style}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/nav-list.module.css";
|
|
1
2
|
import { ClassValue, Expression, get, map, StyleValue } from "rvx";
|
|
2
3
|
import { isPending } from "rvx/async";
|
|
3
4
|
import { optionalString } from "rvx/convert";
|
|
4
5
|
import { Action, handleActionEvent, isKey } from "../common/events.js";
|
|
5
|
-
import { THEME } from "../common/theme.js";
|
|
6
6
|
|
|
7
7
|
export function NavList(props: {
|
|
8
8
|
/**
|
|
@@ -17,10 +17,9 @@ export function NavList(props: {
|
|
|
17
17
|
id?: Expression<string | undefined>;
|
|
18
18
|
children?: unknown;
|
|
19
19
|
}): unknown {
|
|
20
|
-
const theme = THEME.current;
|
|
21
20
|
return <div
|
|
22
21
|
class={[
|
|
23
|
-
|
|
22
|
+
styles.nav_list,
|
|
24
23
|
props.class,
|
|
25
24
|
]}
|
|
26
25
|
style={[
|
|
@@ -47,7 +46,6 @@ export function NavListButton(props: {
|
|
|
47
46
|
action?: Action;
|
|
48
47
|
children?: unknown;
|
|
49
48
|
}): unknown {
|
|
50
|
-
const theme = THEME.current;
|
|
51
49
|
const disabled = () => isPending() || get(props.disabled);
|
|
52
50
|
|
|
53
51
|
function action(event: Event) {
|
|
@@ -61,8 +59,8 @@ export function NavListButton(props: {
|
|
|
61
59
|
type="button"
|
|
62
60
|
disabled={disabled}
|
|
63
61
|
class={[
|
|
64
|
-
|
|
65
|
-
map(props.current, current => current &&
|
|
62
|
+
styles.item,
|
|
63
|
+
map(props.current, current => current && styles.item_current),
|
|
66
64
|
props.class,
|
|
67
65
|
]}
|
|
68
66
|
style={props.style}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/notifications.module.css";
|
|
1
2
|
import { $, captureSelf, Component, For, movable, render, teardown, uncapture, View } from "rvx";
|
|
2
3
|
import { useTimeout } from "rvx/async";
|
|
3
4
|
import { inOverlayContext } from "../common/context.js";
|
|
4
|
-
import {
|
|
5
|
+
import { SizeContext } from "../common/types.js";
|
|
6
|
+
import { Card, CardVariant } from "./card.js";
|
|
5
7
|
import { Collapse } from "./collapse.js";
|
|
6
8
|
import { Column } from "./column.js";
|
|
7
9
|
import { TopLayer } from "./layer.js";
|
|
8
10
|
|
|
9
|
-
export type NotificationVariant =
|
|
11
|
+
export type NotificationVariant = CardVariant;
|
|
10
12
|
|
|
11
13
|
export interface Notification {
|
|
12
14
|
dispose(): void;
|
|
@@ -16,6 +18,7 @@ export interface NotificationOptions {
|
|
|
16
18
|
variant?: NotificationVariant;
|
|
17
19
|
timeout?: number;
|
|
18
20
|
raw?: boolean;
|
|
21
|
+
size?: SizeContext;
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
export interface NotificationHostOptions {
|
|
@@ -31,17 +34,16 @@ const instances = $<Component[]>([]);
|
|
|
31
34
|
|
|
32
35
|
export function showNotification(content: Component<Notification>, options?: NotificationOptions): Notification {
|
|
33
36
|
return inOverlayContext(() => {
|
|
34
|
-
const theme = THEME.current;
|
|
35
37
|
if (!host) {
|
|
36
38
|
uncapture(() => {
|
|
37
39
|
host = render(<TopLayer>
|
|
38
40
|
{() => <div
|
|
39
|
-
class={
|
|
41
|
+
class={styles.host}
|
|
40
42
|
style={{
|
|
41
43
|
"--notification-inline-size": () => NOTIFICATIONS.value.inlineSize,
|
|
42
44
|
}}
|
|
43
45
|
>
|
|
44
|
-
<Column class={
|
|
46
|
+
<Column class={styles.area} size="group">
|
|
45
47
|
<For each={instances}>
|
|
46
48
|
{instance => instance()}
|
|
47
49
|
</For>
|
|
@@ -58,18 +60,14 @@ export function showNotification(content: Component<Notification>, options?: Not
|
|
|
58
60
|
const visible = $(true);
|
|
59
61
|
|
|
60
62
|
const instance = movable(<Collapse fadein visible={visible}>
|
|
61
|
-
<
|
|
62
|
-
|
|
63
|
-
options?.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
{content(handle)}
|
|
70
|
-
</Column>
|
|
71
|
-
}
|
|
72
|
-
</div>
|
|
63
|
+
<Card
|
|
64
|
+
class={styles.notification}
|
|
65
|
+
variant={options?.variant}
|
|
66
|
+
raw={options?.raw}
|
|
67
|
+
size={options?.size}
|
|
68
|
+
>
|
|
69
|
+
{content(handle)}
|
|
70
|
+
</Card>
|
|
73
71
|
</Collapse>).move;
|
|
74
72
|
|
|
75
73
|
instances.update(instances => {
|
package/src/components/page.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/page.module.css";
|
|
1
2
|
import { ClassValue, Expression, map, StyleValue } from "rvx";
|
|
2
|
-
import { THEME } from "../common/theme.js";
|
|
3
3
|
import { Column } from "./column.js";
|
|
4
4
|
|
|
5
5
|
export function Page(props: {
|
|
@@ -11,14 +11,13 @@ export function Page(props: {
|
|
|
11
11
|
style?: StyleValue;
|
|
12
12
|
children?: unknown;
|
|
13
13
|
}): unknown {
|
|
14
|
-
const theme = THEME.current;
|
|
15
14
|
return <div
|
|
16
15
|
role={props.role}
|
|
17
16
|
id={props.id}
|
|
18
17
|
class={[
|
|
19
18
|
props.class,
|
|
20
|
-
|
|
21
|
-
map(props.centerBlock, v => v ?
|
|
19
|
+
styles.page,
|
|
20
|
+
map(props.centerBlock, v => v ? styles.center_block : undefined),
|
|
22
21
|
]}
|
|
23
22
|
style={[
|
|
24
23
|
props.style,
|
|
@@ -27,9 +26,9 @@ export function Page(props: {
|
|
|
27
26
|
},
|
|
28
27
|
]}
|
|
29
28
|
>
|
|
30
|
-
<div class={
|
|
31
|
-
<div class={
|
|
32
|
-
<Column class={
|
|
29
|
+
<div class={styles.scrollbar_comp} />
|
|
30
|
+
<div class={styles.content_col}>
|
|
31
|
+
<Column class={styles.content}>
|
|
33
32
|
{props.children}
|
|
34
33
|
</Column>
|
|
35
34
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Attach, ClassValue, Component, Context, Expression, map, StyleValue } from "rvx";
|
|
2
2
|
import { trackLoading } from "../common/tasks.js";
|
|
3
|
-
import
|
|
3
|
+
import styles from "@rvx/ui/theme/components/placeholder.module.css";
|
|
4
4
|
|
|
5
5
|
export const PLACEHOLDER = new Context<Component | undefined>();
|
|
6
6
|
|
|
@@ -11,7 +11,6 @@ export function Placeholder(props: {
|
|
|
11
11
|
active?: Expression<boolean | undefined>;
|
|
12
12
|
message?: Component;
|
|
13
13
|
}) {
|
|
14
|
-
const theme = THEME.current;
|
|
15
14
|
const active = props.active === undefined
|
|
16
15
|
? trackLoading()
|
|
17
16
|
: map(props.active, v => v ?? true);
|
|
@@ -19,18 +18,18 @@ export function Placeholder(props: {
|
|
|
19
18
|
return <div
|
|
20
19
|
class={[
|
|
21
20
|
props.class,
|
|
22
|
-
|
|
21
|
+
styles.area
|
|
23
22
|
]}
|
|
24
23
|
style={props.style}
|
|
25
24
|
>
|
|
26
25
|
<Attach when={active}>
|
|
27
|
-
<div class={
|
|
28
|
-
<div class={
|
|
26
|
+
<div class={styles.placeholder}>
|
|
27
|
+
<div class={styles.message}>
|
|
29
28
|
{(props.message ?? PLACEHOLDER.current)?.()}
|
|
30
29
|
</div>
|
|
31
30
|
</div>
|
|
32
31
|
</Attach>
|
|
33
|
-
<div class={
|
|
32
|
+
<div class={styles.content} inert={active}>
|
|
34
33
|
{props.children}
|
|
35
34
|
</div>
|
|
36
35
|
</div>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import columnStyles from "@rvx/ui/theme/components/column.module.css";
|
|
2
|
+
import styles from "@rvx/ui/theme/components/popover.module.css";
|
|
1
3
|
import { $, ClassValue, Expression, get, Inject, map, render, StyleValue, SVG, uniqueId, View, watch, XMLNS } from "rvx";
|
|
2
4
|
import { Action } from "../common/events.js";
|
|
3
|
-
import { THEME } from "../common/theme.js";
|
|
4
5
|
import { DOWN, getSize, getXY, LEFT, RIGHT, UP } from "../common/writing-mode.js";
|
|
5
6
|
import { DialogRole } from "./dialog.js";
|
|
6
7
|
import { LAYER } from "./layer.js";
|
|
@@ -76,7 +77,6 @@ export function createPopover(props: {
|
|
|
76
77
|
placement: map(props.placement, v => v ?? "block"),
|
|
77
78
|
alignment: map(props.alignment, v => v ?? "center"),
|
|
78
79
|
content: ({ popout, onPlacement, placement, setSizeReference }) => {
|
|
79
|
-
const theme = THEME.current;
|
|
80
80
|
const layer = LAYER.current!;
|
|
81
81
|
const spikeTransform = $("");
|
|
82
82
|
|
|
@@ -111,8 +111,8 @@ export function createPopover(props: {
|
|
|
111
111
|
}
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
const spikeArea = <div class={
|
|
115
|
-
<div class={
|
|
114
|
+
const spikeArea = <div class={styles.spike_area}>
|
|
115
|
+
<div class={styles.spike} style={{ transform: spikeTransform }}>
|
|
116
116
|
<Inject context={XMLNS} value={SVG}>
|
|
117
117
|
{() => {
|
|
118
118
|
return <svg viewBox="0 0 16 16" preserveAspectRatio="none">
|
|
@@ -124,10 +124,10 @@ export function createPopover(props: {
|
|
|
124
124
|
</div> as HTMLElement;
|
|
125
125
|
|
|
126
126
|
const content = <div class={[
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
map(props.raw, raw => raw ?
|
|
127
|
+
columnStyles.column,
|
|
128
|
+
columnStyles.content,
|
|
129
|
+
styles.content,
|
|
130
|
+
map(props.raw, raw => raw ? styles.raw : undefined),
|
|
131
131
|
]}>
|
|
132
132
|
{props.content({ popout })}
|
|
133
133
|
</div> as HTMLElement;
|
|
@@ -138,7 +138,7 @@ export function createPopover(props: {
|
|
|
138
138
|
role={map(props.role, v => v ?? "dialog")}
|
|
139
139
|
id={props.id}
|
|
140
140
|
class={[
|
|
141
|
-
|
|
141
|
+
styles.popover,
|
|
142
142
|
props.class,
|
|
143
143
|
]}
|
|
144
144
|
style={[
|
|
@@ -155,7 +155,7 @@ export function createPopover(props: {
|
|
|
155
155
|
aria-describedby={props["aria-describedby"]}
|
|
156
156
|
>
|
|
157
157
|
{spikeArea}
|
|
158
|
-
<div class={
|
|
158
|
+
<div class={styles.scroll_area}>
|
|
159
159
|
{content}
|
|
160
160
|
</div>
|
|
161
161
|
</div> as HTMLElement;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/radio-buttons.module.css";
|
|
1
2
|
import { ClassValue, Expression, For, get, map, Signal, StyleValue, uniqueId } from "rvx";
|
|
2
3
|
import { isPending } from "rvx/async";
|
|
3
4
|
import { optionalString, string } from "rvx/convert";
|
|
4
5
|
import { ID_PAIR } from "../common/id-pairs.js";
|
|
5
|
-
import { THEME } from "../common/theme.js";
|
|
6
6
|
import { Text } from "./text.js";
|
|
7
7
|
import { closestValidator } from "./validation.js";
|
|
8
8
|
|
|
@@ -28,7 +28,6 @@ export function RadioButtons<T>(props: {
|
|
|
28
28
|
}): unknown {
|
|
29
29
|
const id = props.id ?? ID_PAIR.current.consume();
|
|
30
30
|
const group = uniqueId();
|
|
31
|
-
const theme = THEME.current;
|
|
32
31
|
|
|
33
32
|
const disabled = props.value instanceof Signal
|
|
34
33
|
? () => isPending() || get(props.disabled)
|
|
@@ -40,7 +39,7 @@ export function RadioButtons<T>(props: {
|
|
|
40
39
|
role="radiogroup"
|
|
41
40
|
id={props.id}
|
|
42
41
|
class={[
|
|
43
|
-
|
|
42
|
+
styles.radio_buttons,
|
|
44
43
|
props.class,
|
|
45
44
|
]}
|
|
46
45
|
style={props.style}
|
|
@@ -56,7 +55,7 @@ export function RadioButtons<T>(props: {
|
|
|
56
55
|
const input = <input
|
|
57
56
|
id={id}
|
|
58
57
|
type="radio"
|
|
59
|
-
class={
|
|
58
|
+
class={styles.radio_button_input}
|
|
60
59
|
name={group}
|
|
61
60
|
value={id}
|
|
62
61
|
disabled={disabled}
|
|
@@ -71,10 +70,10 @@ export function RadioButtons<T>(props: {
|
|
|
71
70
|
|
|
72
71
|
return <label
|
|
73
72
|
for={id}
|
|
74
|
-
class={
|
|
73
|
+
class={styles.radio_button_label}
|
|
75
74
|
>
|
|
76
|
-
|
|
77
|
-
<Text class={
|
|
75
|
+
<div class={styles.radio_button_padding}>{input}</div>
|
|
76
|
+
<Text class={styles.radio_button_content}>
|
|
78
77
|
{option.label}
|
|
79
78
|
</Text>
|
|
80
79
|
</label>;
|
package/src/components/row.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import styles from "@rvx/ui/theme/components/row.module.css";
|
|
1
2
|
import { ClassValue, Expression, get, map, StyleValue } from "rvx";
|
|
2
|
-
import { THEME } from "../common/theme.js";
|
|
3
3
|
import { SizeContext } from "../common/types.js";
|
|
4
4
|
|
|
5
5
|
export type RowAlignment = "top" | "center" | "bottom";
|
|
@@ -13,13 +13,12 @@ export function Row(props: {
|
|
|
13
13
|
id?: Expression<string | undefined>;
|
|
14
14
|
children?: unknown;
|
|
15
15
|
}): unknown {
|
|
16
|
-
const theme = THEME.current;
|
|
17
16
|
return <div
|
|
18
17
|
id={props.id}
|
|
19
18
|
class={[
|
|
20
|
-
|
|
21
|
-
() =>
|
|
22
|
-
map(props.padded, padded => padded ?
|
|
19
|
+
styles.row,
|
|
20
|
+
() => styles[get(props.size) ?? "control"],
|
|
21
|
+
map(props.padded, padded => padded ? styles.padded : undefined),
|
|
23
22
|
props.class,
|
|
24
23
|
]}
|
|
25
24
|
style={[
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { $, ClassValue, StyleValue, teardown } from "rvx";
|
|
2
2
|
import { debounceEvent } from "../common/events.js";
|
|
3
|
-
import
|
|
3
|
+
import styles from "@rvx/ui/theme/components/scroll-view.module.css";
|
|
4
4
|
import { axisEquals, DOWN, getBlockStart, getSize, RIGHT, UP, WritingMode } from "../common/writing-mode.js";
|
|
5
5
|
|
|
6
6
|
const DEBOUNCE_DELAY = 100;
|
|
@@ -13,13 +13,12 @@ export function ScrollView(props: {
|
|
|
13
13
|
children?: unknown;
|
|
14
14
|
scrollbarComp?: boolean;
|
|
15
15
|
}): unknown {
|
|
16
|
-
const theme = THEME.current;
|
|
17
16
|
const vertical = $<boolean | undefined>(undefined);
|
|
18
17
|
const scrollbarComp = props.scrollbarComp ? $(0) : undefined;
|
|
19
18
|
const startIndicator = $(false);
|
|
20
19
|
const endIndicator = $(false);
|
|
21
20
|
|
|
22
|
-
const content = <div class={
|
|
21
|
+
const content = <div class={styles.content}>
|
|
23
22
|
{props.children}
|
|
24
23
|
</div> as HTMLElement;
|
|
25
24
|
|
|
@@ -45,7 +44,7 @@ export function ScrollView(props: {
|
|
|
45
44
|
const area = <div
|
|
46
45
|
class={[
|
|
47
46
|
props.contentClass,
|
|
48
|
-
|
|
47
|
+
styles.area,
|
|
49
48
|
]}
|
|
50
49
|
style={[
|
|
51
50
|
props.contentStyle,
|
|
@@ -62,7 +61,7 @@ export function ScrollView(props: {
|
|
|
62
61
|
const root = <div
|
|
63
62
|
class={[
|
|
64
63
|
props.class,
|
|
65
|
-
|
|
64
|
+
styles.scroll_view,
|
|
66
65
|
]}
|
|
67
66
|
style={[
|
|
68
67
|
props.style,
|
|
@@ -73,12 +72,12 @@ export function ScrollView(props: {
|
|
|
73
72
|
>
|
|
74
73
|
{area}
|
|
75
74
|
<div class={[
|
|
76
|
-
|
|
77
|
-
() => startIndicator.value &&
|
|
75
|
+
styles.indicator_start,
|
|
76
|
+
() => startIndicator.value && styles.indicator_visible,
|
|
78
77
|
]} />
|
|
79
78
|
<div class={[
|
|
80
|
-
|
|
81
|
-
() => endIndicator.value &&
|
|
79
|
+
styles.indicator_end,
|
|
80
|
+
() => endIndicator.value && styles.indicator_visible,
|
|
82
81
|
]} />
|
|
83
82
|
</div> as HTMLElement;
|
|
84
83
|
|