@rvx/ui 0.3.7 → 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.
Files changed (219) hide show
  1. package/dist/common/events.d.ts +0 -40
  2. package/dist/common/events.d.ts.map +1 -1
  3. package/dist/common/theme.d.ts +3 -134
  4. package/dist/common/theme.d.ts.map +1 -1
  5. package/dist/common/theme.js +25 -2
  6. package/dist/common/theme.js.map +1 -1
  7. package/dist/common/writing-mode.d.ts +0 -58
  8. package/dist/common/writing-mode.d.ts.map +1 -1
  9. package/dist/components/breadcrumbs.d.ts.map +1 -1
  10. package/dist/components/breadcrumbs.js +3 -4
  11. package/dist/components/breadcrumbs.js.map +1 -1
  12. package/dist/components/button.d.ts +0 -18
  13. package/dist/components/button.d.ts.map +1 -1
  14. package/dist/components/button.js +3 -4
  15. package/dist/components/button.js.map +1 -1
  16. package/dist/components/card.d.ts +1 -1
  17. package/dist/components/card.d.ts.map +1 -1
  18. package/dist/components/card.js +4 -5
  19. package/dist/components/card.js.map +1 -1
  20. package/dist/components/checkbox.d.ts.map +1 -1
  21. package/dist/components/checkbox.js +4 -5
  22. package/dist/components/checkbox.js.map +1 -1
  23. package/dist/components/collapse.d.ts.map +1 -1
  24. package/dist/components/collapse.js +22 -10
  25. package/dist/components/collapse.js.map +1 -1
  26. package/dist/components/column.d.ts +0 -6
  27. package/dist/components/column.d.ts.map +1 -1
  28. package/dist/components/column.js +4 -5
  29. package/dist/components/column.js.map +1 -1
  30. package/dist/components/control-group.d.ts.map +1 -1
  31. package/dist/components/control-group.js +3 -4
  32. package/dist/components/control-group.js.map +1 -1
  33. package/dist/components/dialog.d.ts +1 -1
  34. package/dist/components/dialog.d.ts.map +1 -1
  35. package/dist/components/dialog.js +14 -10
  36. package/dist/components/dialog.js.map +1 -1
  37. package/dist/components/dropdown-input.d.ts +1 -1
  38. package/dist/components/dropdown-input.d.ts.map +1 -1
  39. package/dist/components/dropdown.d.ts +0 -88
  40. package/dist/components/dropdown.d.ts.map +1 -1
  41. package/dist/components/dropdown.js +7 -8
  42. package/dist/components/dropdown.js.map +1 -1
  43. package/dist/components/error.d.ts.map +1 -1
  44. package/dist/components/error.js +2 -3
  45. package/dist/components/error.js.map +1 -1
  46. package/dist/components/flex-space.d.ts.map +1 -1
  47. package/dist/components/flex-space.js +3 -4
  48. package/dist/components/flex-space.js.map +1 -1
  49. package/dist/components/heading.d.ts +0 -3
  50. package/dist/components/heading.d.ts.map +1 -1
  51. package/dist/components/heading.js +2 -3
  52. package/dist/components/heading.js.map +1 -1
  53. package/dist/components/label.d.ts.map +1 -1
  54. package/dist/components/label.js +2 -3
  55. package/dist/components/label.js.map +1 -1
  56. package/dist/components/layer.d.ts +0 -63
  57. package/dist/components/layer.d.ts.map +1 -1
  58. package/dist/components/link.d.ts +0 -33
  59. package/dist/components/link.d.ts.map +1 -1
  60. package/dist/components/link.js +2 -3
  61. package/dist/components/link.js.map +1 -1
  62. package/dist/components/nav-list.d.ts +0 -8
  63. package/dist/components/nav-list.d.ts.map +1 -1
  64. package/dist/components/nav-list.js +4 -6
  65. package/dist/components/nav-list.js.map +1 -1
  66. package/dist/components/notifications.d.ts +4 -1
  67. package/dist/components/notifications.d.ts.map +1 -1
  68. package/dist/components/notifications.js +5 -11
  69. package/dist/components/notifications.js.map +1 -1
  70. package/dist/components/page.d.ts.map +1 -1
  71. package/dist/components/page.js +4 -5
  72. package/dist/components/page.js.map +1 -1
  73. package/dist/components/placeholder.d.ts.map +1 -1
  74. package/dist/components/placeholder.js +3 -4
  75. package/dist/components/placeholder.js.map +1 -1
  76. package/dist/components/popout.d.ts +0 -96
  77. package/dist/components/popout.d.ts.map +1 -1
  78. package/dist/components/popover.d.ts +0 -88
  79. package/dist/components/popover.d.ts.map +1 -1
  80. package/dist/components/popover.js +9 -9
  81. package/dist/components/popover.js.map +1 -1
  82. package/dist/components/radio-buttons.d.ts.map +1 -1
  83. package/dist/components/radio-buttons.js +4 -5
  84. package/dist/components/radio-buttons.js.map +1 -1
  85. package/dist/components/row.d.ts.map +1 -1
  86. package/dist/components/row.js +4 -5
  87. package/dist/components/row.js.map +1 -1
  88. package/dist/components/scroll-view.d.ts.map +1 -1
  89. package/dist/components/scroll-view.js +8 -9
  90. package/dist/components/scroll-view.js.map +1 -1
  91. package/dist/components/secondary.d.ts.map +1 -1
  92. package/dist/components/secondary.js +2 -3
  93. package/dist/components/secondary.js.map +1 -1
  94. package/dist/components/separated.d.ts.map +1 -1
  95. package/dist/components/separated.js +2 -3
  96. package/dist/components/separated.js.map +1 -1
  97. package/dist/components/slider.d.ts.map +1 -1
  98. package/dist/components/slider.js +2 -3
  99. package/dist/components/slider.js.map +1 -1
  100. package/dist/components/tabs.d.ts.map +1 -1
  101. package/dist/components/tabs.js +8 -9
  102. package/dist/components/tabs.js.map +1 -1
  103. package/dist/components/text-input.d.ts +0 -31
  104. package/dist/components/text-input.d.ts.map +1 -1
  105. package/dist/components/text-input.js +2 -3
  106. package/dist/components/text-input.js.map +1 -1
  107. package/dist/components/text.d.ts.map +1 -1
  108. package/dist/components/text.js +2 -3
  109. package/dist/components/text.js.map +1 -1
  110. package/dist/components/validation-rules.d.ts +0 -2
  111. package/dist/components/validation-rules.d.ts.map +1 -1
  112. package/dist/components/validation.d.ts +0 -49
  113. package/dist/components/validation.d.ts.map +1 -1
  114. package/dist/components/value.d.ts.map +1 -1
  115. package/dist/components/value.js +2 -3
  116. package/dist/components/value.js.map +1 -1
  117. package/dist/index.d.ts +1 -0
  118. package/dist/index.d.ts.map +1 -1
  119. package/dist/index.js +1 -0
  120. package/dist/index.js.map +1 -1
  121. package/package.json +12 -7
  122. package/src/common/theme.tsx +28 -163
  123. package/src/components/breadcrumbs.tsx +4 -5
  124. package/src/components/button.tsx +3 -4
  125. package/src/components/card.tsx +5 -6
  126. package/src/components/checkbox.tsx +5 -7
  127. package/src/components/collapse.tsx +25 -13
  128. package/src/components/column.tsx +4 -5
  129. package/src/components/control-group.tsx +3 -4
  130. package/src/components/dialog.tsx +14 -11
  131. package/src/components/dropdown-input.tsx +1 -1
  132. package/src/components/dropdown.tsx +7 -8
  133. package/src/components/error.tsx +2 -3
  134. package/src/components/flex-space.tsx +3 -4
  135. package/src/components/heading.tsx +2 -3
  136. package/src/components/label.tsx +2 -3
  137. package/src/components/link.tsx +2 -3
  138. package/src/components/nav-list.tsx +4 -6
  139. package/src/components/notifications.tsx +15 -17
  140. package/src/components/page.tsx +6 -7
  141. package/src/components/placeholder.tsx +5 -6
  142. package/src/components/popover.tsx +10 -10
  143. package/src/components/radio-buttons.tsx +6 -7
  144. package/src/components/row.tsx +4 -5
  145. package/src/components/scroll-view.tsx +8 -9
  146. package/src/components/secondary.tsx +2 -3
  147. package/src/components/separated.tsx +2 -3
  148. package/src/components/slider.tsx +2 -5
  149. package/src/components/tabs.tsx +8 -9
  150. package/src/components/text-input.tsx +2 -3
  151. package/src/components/text.tsx +2 -3
  152. package/src/components/value.tsx +2 -3
  153. package/src/index.tsx +2 -0
  154. package/src/types.d.ts +5 -0
  155. package/{src/theme/components/breadcrumbs.scss → theme/components/breadcrumbs.module.css} +12 -12
  156. package/theme/components/button.module.css +168 -0
  157. package/theme/components/card.module.css +50 -0
  158. package/{src/theme/components/checkbox.scss → theme/components/checkbox.module.css} +5 -5
  159. package/{src/theme/components/collapse.scss → theme/components/collapse.module.css} +19 -19
  160. package/{src/theme/components/column.scss → theme/components/column.module.css} +32 -10
  161. package/{src/theme/components/control-group.scss → theme/components/control-group.module.css} +2 -2
  162. package/theme/components/dialog.module.css +63 -0
  163. package/{src/theme/components/dropdown.scss → theme/components/dropdown.module.css} +9 -9
  164. package/theme/components/error.module.css +4 -0
  165. package/{src/theme/components/heading.scss → theme/components/heading.module.css} +8 -8
  166. package/{src/theme/components/label.scss → theme/components/label.module.css} +2 -10
  167. package/{src/theme/components/link.scss → theme/components/link.module.css} +0 -1
  168. package/theme/components/nav-list.module.css +76 -0
  169. package/theme/components/notifications.module.css +31 -0
  170. package/{src/theme/components/page.scss → theme/components/page.module.css} +6 -10
  171. package/{src/theme/components/placeholder.scss → theme/components/placeholder.module.css} +3 -3
  172. package/{src/theme/components/popover.scss → theme/components/popover.module.css} +9 -9
  173. package/theme/components/row.module.css +36 -0
  174. package/{src/theme/components/scroll-view.scss → theme/components/scroll-view.module.css} +19 -21
  175. package/theme/components/secondary.module.css +4 -0
  176. package/{src/theme/components/separated.scss → theme/components/separated.module.css} +2 -2
  177. package/{src/theme/components/slider.scss → theme/components/slider.module.css} +2 -1
  178. package/theme/components/tabs.module.css +71 -0
  179. package/theme/components/text-input.module.css +45 -0
  180. package/theme/global.css +118 -0
  181. package/dist/common/theme-test.d.ts +0 -8
  182. package/dist/common/theme-test.d.ts.map +0 -1
  183. package/dist/common/theme-test.js +0 -13
  184. package/dist/common/theme-test.js.map +0 -1
  185. package/dist/components/checkbox-test.d.ts +0 -4
  186. package/dist/components/checkbox-test.d.ts.map +0 -1
  187. package/dist/components/checkbox-test.js +0 -31
  188. package/dist/components/checkbox-test.js.map +0 -1
  189. package/dist/components/collapse-test.d.ts +0 -9
  190. package/dist/components/collapse-test.d.ts.map +0 -1
  191. package/dist/components/collapse-test.js +0 -15
  192. package/dist/components/collapse-test.js.map +0 -1
  193. package/dist/test.d.ts +0 -4
  194. package/dist/test.d.ts.map +0 -1
  195. package/dist/test.js +0 -4
  196. package/dist/test.js.map +0 -1
  197. package/dist/theme.module.css +0 -1290
  198. package/dist/theme.module.css.map +0 -1
  199. package/src/common/theme-test.tsx +0 -18
  200. package/src/components/checkbox-test.tsx +0 -35
  201. package/src/components/collapse-test.tsx +0 -23
  202. package/src/test.tsx +0 -3
  203. package/src/theme/base.scss +0 -121
  204. package/src/theme/common.scss +0 -42
  205. package/src/theme/components/button.scss +0 -164
  206. package/src/theme/components/card.scss +0 -41
  207. package/src/theme/components/dialog.scss +0 -65
  208. package/src/theme/components/error.scss +0 -12
  209. package/src/theme/components/nav-list.scss +0 -91
  210. package/src/theme/components/notifications.scss +0 -61
  211. package/src/theme/components/row.scss +0 -22
  212. package/src/theme/components/secondary.scss +0 -4
  213. package/src/theme/components/tabs.scss +0 -90
  214. package/src/theme/components/text-input.scss +0 -50
  215. package/src/theme/theme.scss +0 -31
  216. /package/{src/theme/components/flex-space.scss → theme/components/flex-space.module.css} +0 -0
  217. /package/{src/theme/components/radio-buttons.scss → theme/components/radio-buttons.module.css} +0 -0
  218. /package/{src/theme/components/text.scss → theme/components/text.module.css} +0 -0
  219. /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
- theme?.column,
20
- map(props.size, size => theme?.[`column_${size ?? "content"}`]),
21
- map(props.padded, padded => padded ? theme?.column_padded : undefined),
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
- theme?.control_group,
13
+ styles.control_group,
15
14
  props.class,
16
- map(props.column, column => column ? theme?.control_group_column : theme?.control_group_row),
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, FlexSpace, Group, Heading, Row, Separated, Text, THEME } from "../index.js";
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
- theme?.dialog_container,
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={theme?.dialog_body}>
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 (theme?.dialog_fadein) {
128
+ if (styles.fadein) {
125
129
  body.offsetParent;
126
- body.classList.add(theme.dialog_fadein);
130
+ body.classList.add(styles.fadein);
127
131
  }
128
132
  });
129
133
 
130
134
  DIALOG_FADEOUT.current?.(tasks => {
131
- if (theme?.dialog_fadeout) {
132
- body.classList.add(theme.dialog_fadeout);
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
- theme?.dialog_footer,
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
- theme?.dropdown_content,
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
- theme?.dropdown_item,
193
- () => activeItem.value === item && theme?.dropdown_item_active,
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
- theme?.dropdown,
235
- map(props.expansion, v => v && theme?.dropdown_expansion),
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={theme?.dropdown_scroll_area}>
249
+ <div class={styles.scroll_area}>
251
250
  {content}
252
251
  </div>
253
252
  </div> as HTMLElement;
@@ -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
- const theme = THEME.current;
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={theme?.flex_space}
8
+ class={styles.flex_space}
10
9
  style={{
11
- "flex-grow": () => String(get(props.grow) ?? 1),
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 { THEME } from "../common/theme.js";
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={[theme?.heading, props.class]}
15
+ class={[styles.heading, props.class]}
17
16
  style={props.style}
18
17
  id={props.id}
19
18
  >
@@ -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
- theme?.label,
15
+ styles.label,
17
16
  props.class,
18
17
  ]}
19
18
  style={props.style}
@@ -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
- theme?.link,
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
- theme?.nav_list,
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
- theme?.nav_list_item,
65
- map(props.current, current => current && theme?.nav_list_item_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 { THEME } from "../common/theme.js";
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 = "default" | "info" | "success" | "warning" | "danger";
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={theme?.notification_host}
41
+ class={styles.host}
40
42
  style={{
41
43
  "--notification-inline-size": () => NOTIFICATIONS.value.inlineSize,
42
44
  }}
43
45
  >
44
- <Column class={theme?.notification_area} size="group">
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
- <div class={[
62
- theme?.notification,
63
- options?.raw ? theme?.notification_raw : undefined,
64
- theme?.[`notification_${options?.variant ?? "default"}`],
65
- ]}>
66
- {options?.raw
67
- ? content(handle)
68
- : <Column size="group">
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 => {
@@ -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
- theme?.page,
21
- map(props.centerBlock, v => v ? theme?.page_center_block : undefined),
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={theme?.page_scrollbar_comp} />
31
- <div class={theme?.page_content_col}>
32
- <Column class={theme?.page_content}>
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 { THEME } from "../common/theme.js";
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
- theme?.placeholder_area
21
+ styles.area
23
22
  ]}
24
23
  style={props.style}
25
24
  >
26
25
  <Attach when={active}>
27
- <div class={theme?.placeholder}>
28
- <div class={theme?.placeholder_message}>
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={theme?.placeholder_content} inert={active}>
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={theme?.popover_spike_area}>
115
- <div class={theme?.popover_spike} style={{ transform: spikeTransform }}>
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
- theme?.column,
128
- theme?.column_content,
129
- theme?.popover_content,
130
- map(props.raw, raw => raw ? theme?.popover_raw : undefined),
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
- theme?.popover,
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={theme?.popover_scroll_area}>
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
- theme?.radio_buttons,
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={theme?.radio_button_input}
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={theme?.radio_button_label}
73
+ class={styles.radio_button_label}
75
74
  >
76
- {theme?.radio_button_padding ? <div class={theme.radio_button_padding}>{input}</div> : input}
77
- <Text class={theme?.radio_button_content}>
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>;
@@ -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
- theme?.row,
21
- () => theme?.[`row_${get(props.size) ?? "control"}`],
22
- map(props.padded, padded => padded ? theme?.row_padded : undefined),
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 { THEME } from "../common/theme.js";
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={theme?.scroll_view_content}>
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
- theme?.scroll_view_area,
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
- theme?.scroll_view,
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
- theme?.scroll_view_indicator_start,
77
- () => startIndicator.value && theme?.scroll_view_indicator_visible,
75
+ styles.indicator_start,
76
+ () => startIndicator.value && styles.indicator_visible,
78
77
  ]} />
79
78
  <div class={[
80
- theme?.scroll_view_indicator_end,
81
- () => endIndicator.value && theme?.scroll_view_indicator_visible,
79
+ styles.indicator_end,
80
+ () => endIndicator.value && styles.indicator_visible,
82
81
  ]} />
83
82
  </div> as HTMLElement;
84
83