@rvx/ui 0.1.26 → 0.1.28
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/theme.d.ts +5 -2
- package/dist/common/theme.d.ts.map +1 -1
- package/dist/components/card.js +1 -1
- package/dist/components/card.js.map +1 -1
- package/dist/components/column.d.ts +1 -1
- package/dist/components/column.d.ts.map +1 -1
- package/dist/components/dialog.d.ts +2 -3
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/dialog.js +8 -13
- package/dist/components/dialog.js.map +1 -1
- package/dist/components/popover.d.ts +2 -0
- package/dist/components/popover.d.ts.map +1 -1
- package/dist/components/popover.js +2 -0
- package/dist/components/popover.js.map +1 -1
- package/dist/components/row.d.ts +2 -0
- package/dist/components/row.d.ts.map +1 -1
- package/dist/components/row.js +3 -2
- package/dist/components/row.js.map +1 -1
- package/dist/components/scroll-view.d.ts.map +1 -1
- package/dist/components/scroll-view.js +6 -4
- package/dist/components/scroll-view.js.map +1 -1
- package/dist/components/separated.d.ts +9 -0
- package/dist/components/separated.d.ts.map +1 -0
- package/dist/components/separated.js +11 -0
- package/dist/components/separated.js.map +1 -0
- package/dist/components/tabs.d.ts +25 -1
- package/dist/components/tabs.d.ts.map +1 -1
- package/dist/components/tabs.js +32 -16
- package/dist/components/tabs.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/dist/theme.module.css +91 -46
- package/dist/theme.module.css.map +1 -1
- package/package.json +1 -1
- package/src/common/theme.tsx +6 -2
- package/src/components/card.tsx +1 -1
- package/src/components/column.tsx +1 -1
- package/src/components/dialog.tsx +24 -34
- package/src/components/popover.tsx +5 -0
- package/src/components/row.tsx +5 -1
- package/src/components/scroll-view.tsx +7 -4
- package/src/components/separated.tsx +22 -0
- package/src/components/tabs.tsx +76 -41
- package/src/index.tsx +1 -0
- package/src/theme/base.scss +5 -5
- package/src/theme/common.scss +7 -16
- package/src/theme/components/button.scss +1 -1
- package/src/theme/components/card.scss +1 -1
- package/src/theme/components/checkbox.scss +2 -2
- package/src/theme/components/column.scss +1 -1
- package/src/theme/components/dialog.scss +1 -2
- package/src/theme/components/dropdown.scss +2 -1
- package/src/theme/components/nav-list.scss +2 -2
- package/src/theme/components/notifications.scss +1 -1
- package/src/theme/components/popover.scss +4 -1
- package/src/theme/components/radio-buttons.scss +2 -2
- package/src/theme/components/row.scss +5 -0
- package/src/theme/components/separated.scss +24 -0
- package/src/theme/components/tabs.scss +17 -5
- package/src/theme/components/text-input.scss +1 -1
- package/src/theme/theme.scss +1 -0
package/src/components/tabs.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $, Component, Expression, For, get, map, Show, Signal, uniqueIdFor, watch } from "rvx";
|
|
1
|
+
import { $, ClassValue, Component, Expression, For, get, map, Show, Signal, StyleValue, uniqueIdFor, watch } from "rvx";
|
|
2
2
|
import { string } from "rvx/convert";
|
|
3
3
|
import { THEME } from "../common/theme.js";
|
|
4
4
|
|
|
@@ -10,58 +10,93 @@ export interface Tab {
|
|
|
10
10
|
export function Tabs(props: {
|
|
11
11
|
tabs: Expression<Iterable<Tab>>;
|
|
12
12
|
selected?: Signal<Tab | undefined>;
|
|
13
|
-
|
|
13
|
+
class?: ClassValue;
|
|
14
|
+
style?: StyleValue;
|
|
15
|
+
list?: Component<{ tabs: Expression<Iterable<Tab>>, selected: Signal<Tab | undefined> }>;
|
|
16
|
+
panel?: Component<{ tab: Expression<Tab | undefined>, content?: Component<Component> }>;
|
|
17
|
+
content?: Component<Component>;
|
|
14
18
|
}) {
|
|
15
|
-
const theme = THEME.current;
|
|
16
19
|
const selected = props.selected ?? $(undefined);
|
|
20
|
+
const List = props.list ?? TabList;
|
|
21
|
+
const Panel = props.panel ?? TabPanel;
|
|
22
|
+
selectFallbackTab(props.tabs, selected);
|
|
23
|
+
return <>
|
|
24
|
+
<List tabs={props.tabs} selected={selected} />
|
|
25
|
+
<Panel tab={selected} content={props.content} />
|
|
26
|
+
</>;
|
|
27
|
+
}
|
|
17
28
|
|
|
29
|
+
export function selectFallbackTab(tabs: Expression<Iterable<Tab>>, selected: Signal<Tab | undefined>) {
|
|
18
30
|
watch(selected, current => {
|
|
19
31
|
if (current === undefined) {
|
|
20
|
-
for (const tab of get(
|
|
32
|
+
for (const tab of get(tabs)) {
|
|
21
33
|
selected.value = tab;
|
|
22
34
|
break;
|
|
23
35
|
}
|
|
24
36
|
}
|
|
25
37
|
});
|
|
38
|
+
}
|
|
26
39
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}}
|
|
49
|
-
>
|
|
50
|
-
{tab.label()}
|
|
51
|
-
</button>}
|
|
52
|
-
</For>
|
|
53
|
-
</div>
|
|
54
|
-
<Show when={selected}>
|
|
55
|
-
{tab => <div
|
|
56
|
-
role="tabpanel"
|
|
57
|
-
id={uniqueIdFor(tab)}
|
|
40
|
+
export function TabList(props: {
|
|
41
|
+
tabs: Expression<Iterable<Tab>>;
|
|
42
|
+
selected: Signal<Tab | undefined>;
|
|
43
|
+
padded?: Expression<boolean | undefined>;
|
|
44
|
+
class?: ClassValue;
|
|
45
|
+
style?: StyleValue;
|
|
46
|
+
}) {
|
|
47
|
+
const theme = THEME.current;
|
|
48
|
+
return <div
|
|
49
|
+
role="tablist"
|
|
50
|
+
class={[
|
|
51
|
+
theme?.tab_list,
|
|
52
|
+
theme?.has_separator,
|
|
53
|
+
map(props.padded, padded => padded ? theme?.tab_list_padded : undefined),
|
|
54
|
+
props.class,
|
|
55
|
+
]}
|
|
56
|
+
style={props.style}
|
|
57
|
+
>
|
|
58
|
+
<For each={props.tabs}>
|
|
59
|
+
{tab => <button
|
|
60
|
+
role="tab"
|
|
58
61
|
class={[
|
|
59
|
-
theme?.
|
|
60
|
-
|
|
62
|
+
theme?.tab_handle,
|
|
63
|
+
() => props.selected.value === tab ? theme?.tab_handle_current : undefined,
|
|
61
64
|
]}
|
|
65
|
+
aria-selected={string(() => props.selected.value === tab)}
|
|
66
|
+
aria-controls={uniqueIdFor(tab)}
|
|
67
|
+
on:click={event => {
|
|
68
|
+
event.stopImmediatePropagation();
|
|
69
|
+
event.preventDefault();
|
|
70
|
+
props.selected.value = tab;
|
|
71
|
+
}}
|
|
62
72
|
>
|
|
63
|
-
{tab.
|
|
64
|
-
</
|
|
65
|
-
</
|
|
66
|
-
|
|
73
|
+
{tab.label()}
|
|
74
|
+
</button>}
|
|
75
|
+
</For>
|
|
76
|
+
</div>;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export function TabPanel(props: {
|
|
80
|
+
tab?: Expression<Tab | undefined>;
|
|
81
|
+
class?: ClassValue;
|
|
82
|
+
style?: StyleValue;
|
|
83
|
+
content?: Component<Component>;
|
|
84
|
+
}) {
|
|
85
|
+
const theme = THEME.current;
|
|
86
|
+
return <Show when={props.tab}>
|
|
87
|
+
{tab => <div
|
|
88
|
+
role="tabpanel"
|
|
89
|
+
id={uniqueIdFor(tab)}
|
|
90
|
+
class={[
|
|
91
|
+
theme?.tab_panel,
|
|
92
|
+
props.class,
|
|
93
|
+
]}
|
|
94
|
+
style={props.style}
|
|
95
|
+
>
|
|
96
|
+
{props.content
|
|
97
|
+
? props.content(tab.content)
|
|
98
|
+
: tab.content()
|
|
99
|
+
}
|
|
100
|
+
</div>}
|
|
101
|
+
</Show>;
|
|
67
102
|
}
|
package/src/index.tsx
CHANGED
|
@@ -26,6 +26,7 @@ export * from "./components/popover.js";
|
|
|
26
26
|
export * from "./components/radio-buttons.js";
|
|
27
27
|
export * from "./components/row.js";
|
|
28
28
|
export * from "./components/scroll-view.js";
|
|
29
|
+
export * from "./components/separated.js";
|
|
29
30
|
export * from "./components/slider.js";
|
|
30
31
|
export * from "./components/tabs.js";
|
|
31
32
|
export * from "./components/text-input.js";
|
package/src/theme/base.scss
CHANGED
|
@@ -20,20 +20,20 @@ $root-size: 14px;
|
|
|
20
20
|
--content-row-gap: #{px(24)};
|
|
21
21
|
--content-radius: #{px(8)};
|
|
22
22
|
--content-border: #{px(2)};
|
|
23
|
-
@include common.define-quad(content-pad, px(
|
|
23
|
+
@include common.define-quad(content-pad, px(16), px(16));
|
|
24
24
|
|
|
25
25
|
--group-column-gap: #{px(16)};
|
|
26
26
|
--group-row-gap: #{px(16)};
|
|
27
|
-
@include common.define-quad(group-pad, px(
|
|
27
|
+
@include common.define-quad(group-pad, px(16), px(16));
|
|
28
28
|
|
|
29
29
|
--control-column-gap: #{px(8)};
|
|
30
30
|
--control-row-gap: #{px(8)};
|
|
31
31
|
--control-radius: #{px(5)};
|
|
32
32
|
--control-border: #{px(2)};
|
|
33
33
|
--control-disabled: opacity(.5);
|
|
34
|
-
@include common.define-quad(control-pad, px(
|
|
34
|
+
@include common.define-quad(control-pad, px(7), px(8));
|
|
35
35
|
|
|
36
|
-
--input-
|
|
36
|
+
--input-extension: #{px(4)};
|
|
37
37
|
|
|
38
38
|
--separator: #{px(1)};
|
|
39
39
|
|
|
@@ -72,7 +72,7 @@ $root-size: 14px;
|
|
|
72
72
|
light: var(--control-border) dashed var(--accent),
|
|
73
73
|
),
|
|
74
74
|
separator-color: (
|
|
75
|
-
dark: rgb(
|
|
75
|
+
dark: rgb(42, 42, 42),
|
|
76
76
|
light: rgb(220, 220, 220),
|
|
77
77
|
),
|
|
78
78
|
selection-bg: (
|
package/src/theme/common.scss
CHANGED
|
@@ -32,20 +32,11 @@
|
|
|
32
32
|
--#{$name}-inline-end: #{$inline-end};
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
@mixin padding($name
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
calc(var(--#{$name}-inline-end) - $subtract);
|
|
43
|
-
} @else {
|
|
44
|
-
padding-block:
|
|
45
|
-
var(--#{$name}-block-start)
|
|
46
|
-
var(--#{$name}-block-end);
|
|
47
|
-
padding-inline:
|
|
48
|
-
var(--#{$name}-inline-start)
|
|
49
|
-
var(--#{$name}-inline-end);
|
|
50
|
-
}
|
|
35
|
+
@mixin padding($name) {
|
|
36
|
+
padding-block:
|
|
37
|
+
var(--#{$name}-block-start)
|
|
38
|
+
var(--#{$name}-block-end);
|
|
39
|
+
padding-inline:
|
|
40
|
+
var(--#{$name}-inline-start)
|
|
41
|
+
var(--#{$name}-inline-end);
|
|
51
42
|
}
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
cursor: pointer;
|
|
130
130
|
|
|
131
131
|
outline: none;
|
|
132
|
-
@include common.padding(control-pad
|
|
132
|
+
@include common.padding(control-pad);
|
|
133
133
|
|
|
134
134
|
border-radius: var(--control-radius);
|
|
135
135
|
transition: var(--color-transition) background-color,
|
|
@@ -48,7 +48,6 @@
|
|
|
48
48
|
box-shadow: var(--overlay-shadow);
|
|
49
49
|
border-radius: var(--content-radius);
|
|
50
50
|
border: var(--content-border) solid var(--overlay-border);
|
|
51
|
-
@include common.padding(content-pad, var(--content-border));
|
|
52
51
|
}
|
|
53
52
|
|
|
54
53
|
.dialog_scroll_view {
|
|
@@ -59,5 +58,5 @@
|
|
|
59
58
|
}
|
|
60
59
|
|
|
61
60
|
.dialog_scroll_view_content {
|
|
62
|
-
@include common.padding(content-pad
|
|
61
|
+
@include common.padding(content-pad);
|
|
63
62
|
}
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
|
|
35
35
|
.dropdown_item {
|
|
36
36
|
cursor: pointer;
|
|
37
|
-
@include common.padding(control-pad
|
|
37
|
+
@include common.padding(control-pad);
|
|
38
|
+
border: transparent solid var(--control-border);
|
|
38
39
|
|
|
39
40
|
&.dropdown_item_active {
|
|
40
41
|
background-color: var(--dropdown-item-active-bg);
|
|
@@ -56,13 +56,13 @@
|
|
|
56
56
|
background-color: var(--nav-list-item-bg);
|
|
57
57
|
color: var(--nav-list-item-fg);
|
|
58
58
|
border: var(--nav-list-item-border) solid var(--control-border);
|
|
59
|
+
border-radius: var(--control-radius);
|
|
59
60
|
|
|
60
61
|
cursor: pointer;
|
|
61
62
|
|
|
62
63
|
outline: none;
|
|
63
|
-
@include common.padding(control-pad
|
|
64
|
+
@include common.padding(control-pad);
|
|
64
65
|
|
|
65
|
-
border-radius: var(--control-radius);
|
|
66
66
|
transition: var(--color-transition) background-color,
|
|
67
67
|
var(--color-transition) border-color;
|
|
68
68
|
|
|
@@ -42,5 +42,8 @@
|
|
|
42
42
|
.popover_content {
|
|
43
43
|
border-radius: var(--content-radius);
|
|
44
44
|
border: var(--content-border) solid var(--overlay-border);
|
|
45
|
-
|
|
45
|
+
|
|
46
|
+
&:not(.popover_raw) {
|
|
47
|
+
@include common.padding(content-pad);
|
|
48
|
+
}
|
|
46
49
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
.separated_column {
|
|
3
|
+
display: flex;
|
|
4
|
+
flex-direction: column;
|
|
5
|
+
|
|
6
|
+
& > * {
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
}
|
|
9
|
+
& > :not(.has_separator) + :not(.has_separator) {
|
|
10
|
+
border-block-start: calc(var(--separator) * var(--space-scale)) solid var(--separator-color);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.separated_row {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: row;
|
|
17
|
+
|
|
18
|
+
& > * {
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
}
|
|
21
|
+
& > :not(.has_separator) + :not(.has_separator) {
|
|
22
|
+
border-inline-start: calc(var(--separator) * var(--space-scale)) solid var(--separator-color);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -33,6 +33,12 @@
|
|
|
33
33
|
border-bottom: var(--separator) solid var(--separator-color);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
+
.tab_list_padded {
|
|
37
|
+
padding-inline:
|
|
38
|
+
calc(var(--content-pad-inline-start) - var(--control-pad-inline-start))
|
|
39
|
+
calc(var(--content-pad-inline-end) - var(--control-pad-inline-end));
|
|
40
|
+
}
|
|
41
|
+
|
|
36
42
|
.tab_handle {
|
|
37
43
|
font-family: inherit;
|
|
38
44
|
font-size: inherit;
|
|
@@ -43,11 +49,11 @@
|
|
|
43
49
|
outline: none;
|
|
44
50
|
|
|
45
51
|
padding-block:
|
|
46
|
-
var(--control-pad-block-start)
|
|
47
|
-
|
|
52
|
+
calc(var(--control-pad-block-start) + var(--control-border))
|
|
53
|
+
var(--control-pad-block-end);
|
|
48
54
|
padding-inline:
|
|
49
|
-
var(--control-pad-inline-start)
|
|
50
|
-
var(--control-pad-inline-end);
|
|
55
|
+
calc(var(--control-pad-inline-start) + var(--control-border))
|
|
56
|
+
calc(var(--control-pad-inline-end) + var(--control-border));
|
|
51
57
|
|
|
52
58
|
background-color: transparent;
|
|
53
59
|
color: var(--tab-handle-fg);
|
|
@@ -73,6 +79,12 @@
|
|
|
73
79
|
color: var(--tab-handle-fg-current);
|
|
74
80
|
}
|
|
75
81
|
|
|
82
|
+
.tab_panel {
|
|
83
|
+
flex-grow: 1;
|
|
84
|
+
display: flex;
|
|
85
|
+
flex-direction: column;
|
|
86
|
+
}
|
|
87
|
+
|
|
76
88
|
.tab_panel_padded {
|
|
77
|
-
@include common.padding(content-pad
|
|
89
|
+
@include common.padding(content-pad);
|
|
78
90
|
}
|
package/src/theme/theme.scss
CHANGED