aidos-ui 4.0.2 → 4.0.4

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 (86) hide show
  1. package/dist/BaseButton.js +1 -1
  2. package/dist/BaseButton.js.map +1 -1
  3. package/dist/BaseView.js +4 -4
  4. package/dist/BaseView.js.map +1 -1
  5. package/dist/Calendar.js +22 -22
  6. package/dist/Calendar.js.map +1 -1
  7. package/dist/Card.js +1 -1
  8. package/dist/Card.js.map +1 -1
  9. package/dist/DateInput.d.ts +1 -1
  10. package/dist/DatePicker.js +2 -2
  11. package/dist/DatePicker.js.map +1 -1
  12. package/dist/DatetimeInput.js +2 -2
  13. package/dist/DatetimeInput.js.map +1 -1
  14. package/dist/Dialog.js +3 -3
  15. package/dist/Dialog.js.map +1 -1
  16. package/dist/Dropdown.d.ts +1 -1
  17. package/dist/Dropdown.js +8 -7
  18. package/dist/Dropdown.js.map +1 -1
  19. package/dist/Icon.js +9 -9
  20. package/dist/Icon.js.map +1 -1
  21. package/dist/IconButton.d.ts +2 -0
  22. package/dist/IconButton.js +7 -4
  23. package/dist/IconButton.js.map +1 -1
  24. package/dist/Interactable.js +10 -10
  25. package/dist/Interactable.js.map +1 -1
  26. package/dist/JSSComment.d.ts +10 -0
  27. package/dist/JSSComment.js +52 -0
  28. package/dist/JSSComment.js.map +1 -0
  29. package/dist/ListDivider.js +2 -2
  30. package/dist/ListDivider.js.map +1 -1
  31. package/dist/ListSpacer.js +2 -2
  32. package/dist/ListSpacer.js.map +1 -1
  33. package/dist/NextJSRouter.js +3 -3
  34. package/dist/NextJSRouter.js.map +1 -1
  35. package/dist/Popover.js +2 -2
  36. package/dist/Popover.js.map +1 -1
  37. package/dist/ProgressBar.js +3 -3
  38. package/dist/ProgressBar.js.map +1 -1
  39. package/dist/StaticCheckbox.js +2 -2
  40. package/dist/StaticCheckbox.js.map +1 -1
  41. package/dist/Storage.js +1 -3
  42. package/dist/Storage.js.map +1 -1
  43. package/dist/Tooltip.js +2 -2
  44. package/dist/Tooltip.js.map +1 -1
  45. package/dist/jss.d.ts +1 -1
  46. package/dist/jss.js +21 -11
  47. package/dist/jss.js.map +1 -1
  48. package/dist/jsx-dev-runtime.d.ts +2 -0
  49. package/dist/jsx-dev-runtime.js +48 -0
  50. package/dist/jsx-dev-runtime.js.map +1 -0
  51. package/dist/jsx-runtime.d.ts +1 -0
  52. package/dist/jsx-runtime.js +3 -0
  53. package/dist/jsx-runtime.js.map +1 -0
  54. package/dist/vite-plugin-jss-debug.d.ts +37 -0
  55. package/dist/vite-plugin-jss-debug.js +76 -0
  56. package/dist/vite-plugin-jss-debug.js.map +1 -0
  57. package/jss-debug-loader.mjs +44 -0
  58. package/next.config.js +12 -1
  59. package/package.json +19 -1
  60. package/src/BaseButton.tsx +1 -0
  61. package/src/BaseView.tsx +4 -4
  62. package/src/Calendar.tsx +27 -29
  63. package/src/Card.tsx +1 -1
  64. package/src/DateInput.tsx +1 -1
  65. package/src/DatePicker.tsx +2 -2
  66. package/src/DatetimeInput.tsx +3 -3
  67. package/src/Dialog.tsx +5 -5
  68. package/src/Dropdown.tsx +9 -8
  69. package/src/Icon.tsx +9 -9
  70. package/src/IconButton.tsx +25 -2
  71. package/src/Interactable.tsx +10 -10
  72. package/src/JSSComment.tsx +56 -0
  73. package/src/ListDivider.tsx +2 -2
  74. package/src/ListSpacer.tsx +2 -2
  75. package/src/NextJSRouter.tsx +8 -10
  76. package/src/Popover.tsx +2 -2
  77. package/src/ProgressBar.tsx +3 -3
  78. package/src/StaticCheckbox.tsx +3 -3
  79. package/src/Storage.tsx +1 -3
  80. package/src/Tooltip.tsx +2 -2
  81. package/src/jss.tsx +27 -14
  82. package/src/jsx-dev-runtime.ts +74 -0
  83. package/src/jsx-runtime.ts +2 -0
  84. package/src/vite-plugin-jss-debug.ts +77 -0
  85. package/tsconfig.json +6 -0
  86. package/.claude/settings.local.json +0 -21
package/package.json CHANGED
@@ -1,9 +1,27 @@
1
1
  {
2
2
  "name": "aidos-ui",
3
- "version": "4.0.2",
3
+ "version": "4.0.4",
4
4
  "description": "A simple UI framework",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ },
12
+ "./jsx-runtime": {
13
+ "types": "./dist/jsx-runtime.d.ts",
14
+ "default": "./dist/jsx-runtime.js"
15
+ },
16
+ "./jsx-dev-runtime": {
17
+ "types": "./dist/jsx-dev-runtime.d.ts",
18
+ "default": "./dist/jsx-dev-runtime.js"
19
+ },
20
+ "./vite-plugin-jss-debug": {
21
+ "types": "./dist/vite-plugin-jss-debug.d.ts",
22
+ "default": "./dist/vite-plugin-jss-debug.js"
23
+ }
24
+ },
7
25
  "scripts": {
8
26
  "embeddings": "node ./scripts/embeddings.js",
9
27
  "dev": "next dev",
@@ -32,6 +32,7 @@ export const BaseButton = React.forwardRef(
32
32
  ) => {
33
33
  return (
34
34
  <button
35
+ type="button"
35
36
  {...otherProps}
36
37
  aria-disabled={disabled ? true : undefined}
37
38
  ref={ref}
package/src/BaseView.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { JSS, toClassnames } from "./jss";
3
3
 
4
- const jsss: { [key: string]: JSS } = {
4
+ const styles: { [key: string]: JSS } = {
5
5
  relative: {
6
6
  position: "relative",
7
7
  },
@@ -44,9 +44,9 @@ export const BaseView = React.forwardRef(
44
44
  ref={ref}
45
45
  className={toClassnames([
46
46
  jss,
47
- grow && jsss.grow,
48
- shrink && jsss.shrink,
49
- relative && jsss.relative,
47
+ grow && styles.grow,
48
+ shrink && styles.shrink,
49
+ relative && styles.relative,
50
50
  ])}
51
51
  {...otherProps}
52
52
  >
package/src/Calendar.tsx CHANGED
@@ -1,4 +1,4 @@
1
- import React, { useMemo } from "react";
1
+ import React, { cloneElement, useMemo } from "react";
2
2
  import { BaseView } from "./BaseView";
3
3
  import { JSS } from "./jss";
4
4
 
@@ -78,18 +78,17 @@ export const Calendar = React.forwardRef(
78
78
  index + 1 - offset
79
79
  );
80
80
 
81
- return (
82
- <React.Fragment key={dayDate.toISOString()}>
83
- {cell({
84
- date: dayDate,
85
- today: false,
86
- top: true,
87
- left: index % 7 === 0,
88
- outOfMonth: true,
89
- right: false,
90
- bottom: false,
91
- })}
92
- </React.Fragment>
81
+ return cloneElement(
82
+ cell({
83
+ date: dayDate,
84
+ today: false,
85
+ top: true,
86
+ left: index % 7 === 0,
87
+ outOfMonth: true,
88
+ right: false,
89
+ bottom: false,
90
+ }),
91
+ { key: dayDate.toISOString() }
93
92
  );
94
93
  })}
95
94
 
@@ -101,22 +100,21 @@ export const Calendar = React.forwardRef(
101
100
  12 // If we do not add this the ISO string would be from the day before at midnight
102
101
  );
103
102
 
104
- return (
105
- <React.Fragment key={dayDate.toISOString()}>
106
- {cell({
107
- date: dayDate,
108
- top: index + offset < 7,
109
- left: (index + offset) % 7 === 0,
110
- right:
111
- (index + offset) % 7 === 7 - 1 || index === daysInMonth - 1,
112
- bottom: index > daysInMonth - 7 - 1,
113
- outOfMonth: false,
114
- today:
115
- dayDate.getDate() == new Date().getDate() &&
116
- dayDate.getMonth() == new Date().getMonth() &&
117
- dayDate.getFullYear() == new Date().getFullYear(),
118
- })}
119
- </React.Fragment>
103
+ return cloneElement(
104
+ cell({
105
+ date: dayDate,
106
+ top: index + offset < 7,
107
+ left: (index + offset) % 7 === 0,
108
+ right:
109
+ (index + offset) % 7 === 7 - 1 || index === daysInMonth - 1,
110
+ bottom: index > daysInMonth - 7 - 1,
111
+ outOfMonth: false,
112
+ today:
113
+ dayDate.getDate() == new Date().getDate() &&
114
+ dayDate.getMonth() == new Date().getMonth() &&
115
+ dayDate.getFullYear() == new Date().getFullYear(),
116
+ }),
117
+ { key: dayDate.toISOString() }
120
118
  );
121
119
  })}
122
120
  </BaseView>
package/src/Card.tsx CHANGED
@@ -19,7 +19,7 @@ export function Card({
19
19
  {
20
20
  backgroundColor: cssVar("--overlay-background"),
21
21
  borderRadius: cssVar("--border-radius-l"),
22
- boxShadow: `1px 1px 4px 1px ${cssVar("--divider")}`,
22
+ boxShadow: cssVar("--shadow-sm"),
23
23
  },
24
24
  jss,
25
25
  ]}
package/src/DateInput.tsx CHANGED
@@ -12,7 +12,7 @@ export interface DateInputProps extends BaseInputProps {
12
12
  icon?: IconType;
13
13
  addOn?: ReactNode;
14
14
  onChange?: undefined;
15
- jsss?: JSS;
15
+ jss?: JSS;
16
16
  }
17
17
 
18
18
  export const DateInput = React.forwardRef(
@@ -2,7 +2,7 @@ import React, { useRef } from "react";
2
2
  import { Text } from "./Text";
3
3
  import { TextColor, toClassnames } from "./jss";
4
4
 
5
- const jsss = {
5
+ const styles = {
6
6
  dateInput: {
7
7
  border: "1px solid var(--divider)",
8
8
  backgroundColor: "var(--primary-background)",
@@ -47,7 +47,7 @@ export function DatePicker({
47
47
  <input
48
48
  min={min}
49
49
  max={max}
50
- className={toClassnames(jsss.dateInput)}
50
+ className={toClassnames(styles.dateInput)}
51
51
  type="date"
52
52
  id={id}
53
53
  value={date.toISOString().substring(0, 10)}
@@ -15,7 +15,7 @@ export interface DatetimeInputProps extends BaseInputProps {
15
15
  jss?: JSS;
16
16
  }
17
17
 
18
- const jsss = {
18
+ const styles = {
19
19
  root: {
20
20
  backgroundColor: "var(--primary-background)",
21
21
  },
@@ -43,7 +43,7 @@ export const DatetimeInput = React.forwardRef(
43
43
  ref?: React.Ref<HTMLInputElement>
44
44
  ) => {
45
45
  return (
46
- <Row jss={jsss.root}>
46
+ <Row jss={styles.root}>
47
47
  {icon && (
48
48
  <Box padding="medium">
49
49
  <Icon size="medium" color="secondary" icon={icon} />
@@ -55,7 +55,7 @@ export const DatetimeInput = React.forwardRef(
55
55
  ref={ref}
56
56
  value={date.toISOString().substring(0, 16)}
57
57
  onChange={(e) => onDateChange(new Date(e.target.value))}
58
- jss={[jsss.input, jss]}
58
+ jss={[styles.input, jss]}
59
59
  />
60
60
  {addOn}
61
61
  </Row>
package/src/Dialog.tsx CHANGED
@@ -8,7 +8,7 @@ import { Row } from "./Row";
8
8
  import { IconButton } from "./IconButton";
9
9
  import { toClassnames } from "./jss";
10
10
 
11
- const jsss = {
11
+ const styles = {
12
12
  dialog: {
13
13
  border: "1px solid var(--divider)",
14
14
  borderRadius: "var(--border-radius-l)",
@@ -50,8 +50,8 @@ export const Dialog = ({
50
50
  close: () => void;
51
51
  }) => {
52
52
  return (
53
- <BaseView jss={jsss.root}>
54
- <Column jss={jsss.header}>
53
+ <BaseView jss={styles.root}>
54
+ <Column jss={styles.header}>
55
55
  <Row padding="medium" justify="space-between" align="center">
56
56
  <Text size="medium" color="secondary">
57
57
  {label}
@@ -67,7 +67,7 @@ export const Dialog = ({
67
67
  </Row>
68
68
  <ListDivider />
69
69
  </Column>
70
- <BaseView jss={jsss.content}>{children}</BaseView>
70
+ <BaseView jss={styles.content}>{children}</BaseView>
71
71
  </BaseView>
72
72
  );
73
73
  };
@@ -113,7 +113,7 @@ export function useDialog<Input>(
113
113
  dialogRef.current = ref;
114
114
  ref && ref.showModal();
115
115
  }}
116
- className={toClassnames(jsss.dialog)}
116
+ className={toClassnames(styles.dialog)}
117
117
  onClose={() => {
118
118
  closeRef.current();
119
119
  }}
package/src/Dropdown.tsx CHANGED
@@ -1,14 +1,13 @@
1
- import React, { useEffect, useRef, useState } from "react";
1
+ import React, { useEffect, useId, useRef, useState } from "react";
2
2
 
3
3
  import { BaseView } from "./BaseView";
4
- import { guid } from "./guid";
5
4
  import { Button } from "./Button";
6
5
  import { Column } from "./Column";
7
6
  import { useNavigation } from "./useNavigation";
8
7
  import { useRefEffect } from "./useRefEffect";
9
8
  import { Gap, JSS, Padding, Size, getBackground } from "./jss";
10
9
 
11
- const jsss: { [key: string]: JSS } = {
10
+ const styles: { [key: string]: JSS } = {
12
11
  root: {
13
12
  position: "relative",
14
13
  display: "flex",
@@ -25,12 +24,12 @@ const jsss: { [key: string]: JSS } = {
25
24
  left: 0,
26
25
  right: 0,
27
26
  borderRadius: "var(--border-radius-m)",
28
- boxShadow: "0px 1px 2px var(--divider)",
27
+ boxShadow: "var(--shadow-sm)",
29
28
  zIndex: 1,
30
29
  },
31
30
  };
32
31
  export function Dropdown<T extends string | number>({
33
- id = guid(),
32
+ id: propId,
34
33
  label,
35
34
  options,
36
35
  selection,
@@ -54,6 +53,8 @@ export function Dropdown<T extends string | number>({
54
53
  gap?: Gap;
55
54
  size?: Size;
56
55
  }) {
56
+ const hookId = useId();
57
+ const id = propId ?? hookId;
57
58
  const triggerRef = useRef(null);
58
59
  const [expanded, setExpanded] = useState(false);
59
60
  const dropdownRef = useNavigation({ autofocus: true });
@@ -75,7 +76,7 @@ export function Dropdown<T extends string | number>({
75
76
  }, [expanded]);
76
77
 
77
78
  return (
78
- <BaseView ref={rootRef} jss={[jsss.root, jss]}>
79
+ <BaseView ref={rootRef} jss={[styles.root, jss]}>
79
80
  <Button
80
81
  size={size}
81
82
  padding={padding}
@@ -86,7 +87,7 @@ export function Dropdown<T extends string | number>({
86
87
  role="combobox"
87
88
  justify="space-between"
88
89
  tabIndex={0}
89
- jss={[jsss.button, jssButton]}
90
+ jss={[styles.button, jssButton]}
90
91
  color="positive"
91
92
  icon="fa-chevron-down"
92
93
  iconPosition="right"
@@ -100,7 +101,7 @@ export function Dropdown<T extends string | number>({
100
101
  {expanded && (
101
102
  <Column
102
103
  gap={gap}
103
- jss={[jsss.dropdown, getBackground("secondary-background")]}
104
+ jss={[styles.dropdown, getBackground("secondary-background")]}
104
105
  id={id}
105
106
  role="listbox"
106
107
  aria-label={label}
package/src/Icon.tsx CHANGED
@@ -4,7 +4,7 @@ import { BaseView } from "./BaseView";
4
4
  import { IconType } from "./IconType";
5
5
  import { Size, TextColor, getTextColor } from "./jss";
6
6
 
7
- const jsss = {
7
+ const styles = {
8
8
  root: {
9
9
  display: "flex",
10
10
  justifyContent: "center",
@@ -63,14 +63,14 @@ export function Icon({
63
63
  <BaseView
64
64
  aria-label={ariaLabel}
65
65
  jss={[
66
- jsss.root,
67
- size === "xsmall" && jsss.xsmall,
68
- size === "small" && jsss.small,
69
- size === "medium" && jsss.medium,
70
- size === "large" && jsss.large,
71
- size === "xlarge" && jsss.xlarge,
72
- size === "xxlarge" && jsss.xxlarge,
73
- size === "xxxlarge" && jsss.xxxlarge,
66
+ styles.root,
67
+ size === "xsmall" && styles.xsmall,
68
+ size === "small" && styles.small,
69
+ size === "medium" && styles.medium,
70
+ size === "large" && styles.large,
71
+ size === "xlarge" && styles.xlarge,
72
+ size === "xxlarge" && styles.xxlarge,
73
+ size === "xxxlarge" && styles.xxxlarge,
74
74
  getTextColor(color),
75
75
  ]}
76
76
  >
@@ -4,28 +4,46 @@ import { Icon } from "./Icon";
4
4
  import { IconType } from "./IconType";
5
5
  import { getGlyphColor } from "./Interactable";
6
6
  import { Size } from "./jss";
7
+ import { Span } from "./Text";
7
8
 
8
- const sizes = {
9
+ const sizes: {
10
+ [key in Size]: number;
11
+ } = {
9
12
  xsmall: 20,
10
13
  small: 24,
11
14
  medium: 32,
12
15
  large: 40,
13
16
  xlarge: 48,
17
+ xxlarge: 56,
18
+ xxxlarge: 64,
14
19
  };
15
20
 
16
21
  export interface IconButtonProps extends BaseButtonProps {
17
22
  icon: IconType;
18
23
  size: Size;
24
+ label?: string;
25
+ labelSize?: Size;
19
26
  }
20
27
 
21
28
  export const IconButton = React.forwardRef(
22
29
  (
23
- { icon, size, color, bare, disabled, jss, ...buttonProps }: IconButtonProps,
30
+ {
31
+ icon,
32
+ size,
33
+ color,
34
+ bare,
35
+ disabled,
36
+ jss,
37
+ label,
38
+ labelSize = "medium",
39
+ ...buttonProps
40
+ }: IconButtonProps,
24
41
  ref?: React.Ref<HTMLButtonElement>
25
42
  ) => {
26
43
  return (
27
44
  <BaseButton
28
45
  {...buttonProps}
46
+ aria-label={buttonProps["aria-label"] ?? label}
29
47
  bare={bare}
30
48
  jss={[
31
49
  {
@@ -52,6 +70,11 @@ export const IconButton = React.forwardRef(
52
70
  icon={icon}
53
71
  color={getGlyphColor(color, disabled, bare)}
54
72
  />
73
+ {label && (
74
+ <Span size={labelSize} color={getGlyphColor(color, disabled, bare)}>
75
+ {label}
76
+ </Span>
77
+ )}
55
78
  </BaseButton>
56
79
  );
57
80
  }
@@ -7,7 +7,7 @@ export type InteractableColor =
7
7
  | "dark"
8
8
  | "light";
9
9
 
10
- const jsss = {
10
+ const styles = {
11
11
  root: {
12
12
  cursor: "pointer",
13
13
  display: "inline-flex",
@@ -94,18 +94,18 @@ export function getInteractableJSS({
94
94
  border: boolean;
95
95
  }): Array<JSS> {
96
96
  return [
97
- jsss.root,
98
- color === "dark" && jsss.dark,
99
- color === "light" && jsss.light,
100
- color === "positive" && jsss.positive,
101
- color === "primary" && jsss.primary,
102
- color === "negative" && jsss.negative,
97
+ styles.root,
98
+ color === "dark" && styles.dark,
99
+ color === "light" && styles.light,
100
+ color === "positive" && styles.positive,
101
+ color === "primary" && styles.primary,
102
+ color === "negative" && styles.negative,
103
103
  border && {
104
104
  border: `1px solid ${getCSSColor(color, disabled, bare)}`,
105
105
  },
106
- bare && jsss.bare,
107
- disabled && jsss.disabled,
108
- !bare && jsss.opacityHover,
106
+ bare && styles.bare,
107
+ disabled && styles.disabled,
108
+ !bare && styles.opacityHover,
109
109
  animateInteraction &&
110
110
  !disabled && {
111
111
  position: "relative",
@@ -0,0 +1,56 @@
1
+ import React, { useEffect, useRef } from "react";
2
+
3
+ /**
4
+ * Injects a real HTML comment node (<!-- ComponentName -->) into the DOM.
5
+ *
6
+ * Renders nothing (null). Uses the React fiber tree to locate the sibling
7
+ * component's first DOM node, then inserts a comment before it.
8
+ * Client-only — no SSR output, no hydration mismatch.
9
+ */
10
+ export function JSSComment({ name }: { name: string }) {
11
+ const fiberRef = useRef<any>(null);
12
+
13
+ // Capture our fiber during render
14
+ try {
15
+ const internals = (React as any)
16
+ .__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
17
+ fiberRef.current = internals?.ReactCurrentOwner?.current;
18
+ } catch {}
19
+
20
+ useEffect(() => {
21
+ const fiber = fiberRef.current;
22
+ if (!fiber) return;
23
+
24
+ // Our sibling in the Fragment is the actual component
25
+ const sibling = fiber.sibling;
26
+ if (!sibling) return;
27
+
28
+ // Walk down the sibling's fiber tree to find its first DOM node
29
+ const hostNode = findFirstDOMNode(sibling);
30
+ if (!hostNode?.parentNode) return;
31
+
32
+ const comment = document.createComment(` ${name} `);
33
+ hostNode.parentNode.insertBefore(comment, hostNode);
34
+
35
+ return () => {
36
+ comment.remove();
37
+ };
38
+ }, [name]);
39
+
40
+ return null;
41
+ }
42
+
43
+ function findFirstDOMNode(fiber: any): Node | null {
44
+ let current = fiber;
45
+ while (current) {
46
+ if (current.stateNode instanceof Node) {
47
+ return current.stateNode;
48
+ }
49
+ if (current.child) {
50
+ current = current.child;
51
+ continue;
52
+ }
53
+ break;
54
+ }
55
+ return null;
56
+ }
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { BaseView } from "./BaseView";
3
3
 
4
- const jsss = {
4
+ const styles = {
5
5
  root: {
6
6
  width: "100%",
7
7
  borderBottom: "1px solid var(--divider)",
@@ -9,5 +9,5 @@ const jsss = {
9
9
  };
10
10
 
11
11
  export function ListDivider() {
12
- return <BaseView jss={jsss.root} />;
12
+ return <BaseView jss={styles.root} />;
13
13
  }
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
  import { BaseView } from "./BaseView";
3
3
 
4
- const jsss = {
4
+ const styles = {
5
5
  root: {
6
6
  height: "var(--spacing-xl)",
7
7
  backgroundColor: "var(--secondary-background)",
@@ -10,5 +10,5 @@ const jsss = {
10
10
  };
11
11
 
12
12
  export function ListSpacer() {
13
- return <BaseView jss={jsss.root} />;
13
+ return <BaseView jss={styles.root} />;
14
14
  }
@@ -7,7 +7,7 @@ import { BaseView } from "./BaseView";
7
7
  import { useRouterState } from "./NextJSRouterState";
8
8
  import { JSS } from "./jss";
9
9
 
10
- const jsss: { [key: string]: JSS } = {
10
+ const styles: { [key: string]: JSS } = {
11
11
  root: {
12
12
  display: "flex",
13
13
  flexDirection: "column",
@@ -36,25 +36,23 @@ export function Router() {
36
36
  } = useRouterState();
37
37
 
38
38
  return (
39
- <BaseView jss={jsss.root}>
39
+ <BaseView jss={styles.root}>
40
40
  {navigationStack.map(({ route, routeProps }, index, list) => {
41
41
  const isTopOfStack = index === list.length - 1;
42
42
 
43
43
  return (
44
- <StackContextProvider
44
+ <Column
45
45
  key={route.title(routeProps)}
46
- isTopOfStack={isTopOfStack}
46
+ jss={[styles.route, !isTopOfStack && styles.hidden]}
47
+ aria-hidden={!isTopOfStack}
47
48
  >
48
- <Column
49
- jss={[jsss.route, !isTopOfStack && jsss.hidden]}
50
- aria-hidden={!isTopOfStack}
51
- >
49
+ <StackContextProvider isTopOfStack={isTopOfStack}>
52
50
  <ListDivider />
53
51
  <Suspense fallback={null}>
54
52
  <route.root {...routeProps} />
55
53
  </Suspense>
56
- </Column>
57
- </StackContextProvider>
54
+ </StackContextProvider>
55
+ </Column>
58
56
  );
59
57
  })}
60
58
  </BaseView>
package/src/Popover.tsx CHANGED
@@ -5,7 +5,7 @@ import { BaseView } from "./BaseView";
5
5
  import { useRefEffect } from "./useRefEffect";
6
6
  import { JSS, toClassnames } from "./jss";
7
7
 
8
- const jsss: { [key: string]: JSS } = {
8
+ const styles: { [key: string]: JSS } = {
9
9
  popover: {
10
10
  padding: 0,
11
11
  zIndex: 1,
@@ -129,7 +129,7 @@ export function PopoverTrigger<Input>({
129
129
  ref={(ref: null | HTMLDialogElement) => {
130
130
  dialogRef.current = ref;
131
131
  }}
132
- className={toClassnames([jsss.popover, jssDialog])}
132
+ className={toClassnames([styles.popover, jssDialog])}
133
133
  onClose={() => {
134
134
  setPopover(null);
135
135
  }}
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { BaseView } from "./BaseView";
3
3
  import { Color, Size, JSS, getBackground } from "./jss";
4
4
 
5
- const jsss: { [key: string]: JSS } = {
5
+ const styles: { [key: string]: JSS } = {
6
6
  root: {
7
7
  width: "100%",
8
8
  display: "flex",
@@ -45,7 +45,7 @@ export function ProgressBar({
45
45
  return (
46
46
  <BaseView
47
47
  jss={[
48
- jsss.root,
48
+ styles.root,
49
49
  {
50
50
  height: sizes[size],
51
51
  },
@@ -53,7 +53,7 @@ export function ProgressBar({
53
53
  ]}
54
54
  >
55
55
  <BaseView
56
- jss={[jsss.fill, getBackground(color)]}
56
+ jss={[styles.fill, getBackground(color)]}
57
57
  style={{
58
58
  transform: `scaleX(${progress > 1 ? 1 : progress})`,
59
59
  }}
@@ -10,7 +10,7 @@ type StaticCheckboxProps = {
10
10
  icon?: IconType;
11
11
  };
12
12
 
13
- const jsss: { [key: string]: JSS } = {
13
+ const styles: { [key: string]: JSS } = {
14
14
  border: {
15
15
  position: "absolute",
16
16
  top: "var(--spacing-xs)",
@@ -61,9 +61,9 @@ export function StaticCheckbox({
61
61
  width: sizes[size],
62
62
  }}
63
63
  >
64
- <BaseView jss={[jsss.border, checked && jsss.borderChecked]} />
64
+ <BaseView jss={[styles.border, checked && styles.borderChecked]} />
65
65
  {checked && (
66
- <BaseView jss={jsss.icon}>
66
+ <BaseView jss={styles.icon}>
67
67
  <Icon size={size} color="light" icon={icon} />
68
68
  </BaseView>
69
69
  )}
package/src/Storage.tsx CHANGED
@@ -99,9 +99,7 @@ export function createStorage<State>({
99
99
  useEffect(() => {
100
100
  return subscribe((newState) => {
101
101
  const newLocalState = selector(newState);
102
- if (newLocalState != localState) {
103
- setLocalState(selector(newState));
104
- }
102
+ setLocalState((prev) => (newLocalState != prev ? newLocalState : prev));
105
103
  });
106
104
  }, []);
107
105
 
package/src/Tooltip.tsx CHANGED
@@ -5,7 +5,7 @@ import { useRefEffect } from "./useRefEffect";
5
5
  import { Text } from "./Text";
6
6
  import { JSS, cssVar, toClassnames } from "./jss";
7
7
 
8
- const jsss: { [key: string]: JSS } = {
8
+ const styles: { [key: string]: JSS } = {
9
9
  tooltip: {
10
10
  top: "-100%",
11
11
  transform: "translateY(50%)",
@@ -67,7 +67,7 @@ export function Tooltip({ content, jss, tag, children }: TooltipProps) {
67
67
  dialogRef.current = ref;
68
68
  focusTrapRoot(ref);
69
69
  }}
70
- className={toClassnames(jsss.tooltip)}
70
+ className={toClassnames(styles.tooltip)}
71
71
  onClose={() => {
72
72
  setTooltip(null);
73
73
  }}