aidos-ui 3.0.31 → 4.0.1
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/.claude/settings.local.json +14 -1
- package/CLAUDE.md +72 -0
- package/README.md +43 -29
- package/dist/Badge.d.ts +2 -2
- package/dist/Badge.js.map +1 -1
- package/dist/BaseButton.d.ts +2 -2
- package/dist/BaseButton.js +2 -2
- package/dist/BaseButton.js.map +1 -1
- package/dist/BaseInput.d.ts +2 -2
- package/dist/BaseInput.js.map +1 -1
- package/dist/BaseLink.d.ts +2 -2
- package/dist/BaseLink.js +2 -2
- package/dist/BaseLink.js.map +1 -1
- package/dist/BaseListItem.d.ts +3 -3
- package/dist/BaseListItem.js.map +1 -1
- package/dist/BaseView.d.ts +2 -2
- package/dist/BaseView.js.map +1 -1
- package/dist/Calendar.d.ts +4 -4
- package/dist/DarkMode.js.map +1 -1
- package/dist/DateInput.d.ts +2 -2
- package/dist/DatePicker.js.map +1 -1
- package/dist/DatetimeInput.d.ts +2 -2
- package/dist/Dialog.d.ts +3 -3
- package/dist/Dialog.js.map +1 -1
- package/dist/Dropdown.d.ts +3 -3
- package/dist/Dropdown.js.map +1 -1
- package/dist/Icon.d.ts +3 -3
- package/dist/Icon.js +2 -21
- package/dist/Icon.js.map +1 -1
- package/dist/IconLink.js +2 -1
- package/dist/IconLink.js.map +1 -1
- package/dist/Interactable.d.ts +4 -4
- package/dist/Interactable.js +2 -2
- package/dist/Interactable.js.map +1 -1
- package/dist/ListButtonItem.js +2 -2
- package/dist/ListButtonItem.js.map +1 -1
- package/dist/ListLinkItem.js +2 -2
- package/dist/ListLinkItem.js.map +1 -1
- package/dist/MenuIcon.js.map +1 -1
- package/dist/NextJSRouter.js.map +1 -1
- package/dist/NextJSRouterState.js.map +1 -1
- package/dist/OnVisible.d.ts +1 -1
- package/dist/OnVisible.js.map +1 -1
- package/dist/Popover.d.ts +7 -7
- package/dist/Popover.js +2 -2
- package/dist/Popover.js.map +1 -1
- package/dist/ProgressBar.d.ts +2 -2
- package/dist/ProgressBar.js.map +1 -1
- package/dist/Providers.d.ts +2 -2
- package/dist/Providers.js +2 -2
- package/dist/Providers.js.map +1 -1
- package/dist/RangeInput.d.ts +3 -3
- package/dist/RangeInput.js +2 -2
- package/dist/RangeInput.js.map +1 -1
- package/dist/RootView.js.map +1 -1
- package/dist/Select.d.ts +2 -3
- package/dist/Select.js.map +1 -1
- package/dist/StaticCheckbox.js.map +1 -1
- package/dist/Storage.d.ts +2 -1
- package/dist/Storage.js.map +1 -1
- package/dist/Stream.js.map +1 -1
- package/dist/Sublist.d.ts +2 -2
- package/dist/Tabs.d.ts +4 -4
- package/dist/Tabs.js +2 -4
- package/dist/Tabs.js.map +1 -1
- package/dist/Text.d.ts +2 -2
- package/dist/Text.js.map +1 -1
- package/dist/TextArea.d.ts +2 -2
- package/dist/TextArea.js.map +1 -1
- package/dist/TextInput.d.ts +4 -3
- package/dist/TextInput.js +14 -5
- package/dist/TextInput.js.map +1 -1
- package/dist/TextPairing.d.ts +2 -2
- package/dist/TextPairing.js.map +1 -1
- package/dist/Tooltip.d.ts +4 -4
- package/dist/Tooltip.js.map +1 -1
- package/dist/aria.js.map +1 -1
- package/dist/hash.js.map +1 -1
- package/dist/jss.d.ts +21 -21
- package/dist/jss.js +6 -6
- package/dist/jss.js.map +1 -1
- package/dist/numberToBase.js.map +1 -1
- package/dist/stateMachineContextFactory.js.map +1 -1
- package/dist/useCookie.js.map +1 -1
- package/dist/useKeyboard.js.map +1 -1
- package/dist/useNavigation.js.map +1 -1
- package/dist/useRefEffect.js.map +1 -1
- package/next-env.d.ts +2 -1
- package/next.config.js +2 -1
- package/package.json +27 -20
- package/src/Badge.tsx +2 -2
- package/src/BaseButton.tsx +4 -4
- package/src/BaseInput.tsx +2 -2
- package/src/BaseLink.tsx +4 -4
- package/src/BaseListItem.tsx +3 -3
- package/src/BaseView.tsx +3 -3
- package/src/Calendar.tsx +4 -4
- package/src/DateInput.tsx +2 -2
- package/src/DatetimeInput.tsx +2 -2
- package/src/Dialog.tsx +3 -3
- package/src/Dropdown.tsx +4 -4
- package/src/Icon.tsx +4 -30
- package/src/IconLink.tsx +2 -1
- package/src/Interactable.tsx +4 -4
- package/src/ListButtonItem.tsx +2 -2
- package/src/ListLinkItem.tsx +2 -2
- package/src/MenuIcon.tsx +2 -2
- package/src/NextJSRouter.tsx +2 -2
- package/src/Popover.tsx +9 -9
- package/src/ProgressBar.tsx +3 -3
- package/src/Providers.tsx +4 -4
- package/src/RangeInput.tsx +5 -5
- package/src/Select.tsx +2 -2
- package/src/StaticCheckbox.tsx +2 -2
- package/src/Storage.tsx +1 -1
- package/src/Sublist.tsx +2 -2
- package/src/Tabs.tsx +4 -6
- package/src/Text.tsx +2 -2
- package/src/TextArea.tsx +2 -2
- package/src/TextInput.tsx +20 -8
- package/src/TextPairing.tsx +2 -2
- package/src/Tooltip.tsx +5 -5
- package/src/docs/mdx.tsx +40 -0
- package/src/docs/searchIndex.ts +1 -1
- package/src/jss.tsx +18 -18
- package/src/pages/Badge.mdx +136 -14
- package/src/pages/Button.mdx +121 -63
- package/src/pages/Calendar.mdx +196 -2
- package/src/pages/Card.mdx +123 -47
- package/src/pages/Checkbox.mdx +103 -28
- package/src/pages/Dialog.mdx +172 -7
- package/src/pages/FlexLayout.mdx +185 -51
- package/src/pages/Hashing.mdx +199 -8
- package/src/pages/Icon.mdx +150 -42
- package/src/pages/IconButton.mdx +127 -116
- package/src/pages/Link.mdx +118 -47
- package/src/pages/List.mdx +167 -283
- package/src/pages/ListHeader.mdx +157 -27
- package/src/pages/Popover.mdx +177 -55
- package/src/pages/ProgressBar.mdx +186 -6
- package/src/pages/ProgressCircle.mdx +196 -13
- package/src/pages/RangeInput.mdx +189 -61
- package/src/pages/Tabs.mdx +202 -346
- package/src/pages/Text.mdx +102 -81
- package/src/pages/TextInput.mdx +169 -44
- package/src/pages/TextPairing.mdx +164 -115
- package/src/pages/TimeInput.mdx +142 -37
- package/src/pages/Tooltip.mdx +99 -12
- package/src/pages/_app.tsx +14 -4
- package/src/pages/css-in-js.mdx +196 -83
- package/src/pages/navigation.mdx +122 -20
- package/src/pages/useCookie.mdx +168 -7
- package/src/pages/useKeyboard.mdx +242 -5
- package/src/pages/useNavigation.mdx +244 -16
- package/src/pages/usePromise.mdx +271 -6
- package/src/pages/useRefEffect.mdx +230 -28
- package/tsconfig.json +13 -4
package/src/Calendar.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useMemo } from "react";
|
|
2
2
|
import { BaseView } from "./BaseView";
|
|
3
|
-
import {
|
|
3
|
+
import { JSS } from "./jss";
|
|
4
4
|
|
|
5
5
|
const dateFormatter = Intl.DateTimeFormat("en-UK", {
|
|
6
6
|
weekday: "short",
|
|
@@ -23,8 +23,8 @@ export const Calendar = React.forwardRef(
|
|
|
23
23
|
jss,
|
|
24
24
|
}: {
|
|
25
25
|
date: Date;
|
|
26
|
-
header: (props: { weekday: string }) => JSX.Element;
|
|
27
|
-
jss?:
|
|
26
|
+
header: (props: { weekday: string }) => React.JSX.Element;
|
|
27
|
+
jss?: JSS;
|
|
28
28
|
cell: (props: {
|
|
29
29
|
today?: boolean;
|
|
30
30
|
date: Date;
|
|
@@ -33,7 +33,7 @@ export const Calendar = React.forwardRef(
|
|
|
33
33
|
left: boolean;
|
|
34
34
|
right: boolean;
|
|
35
35
|
bottom: boolean;
|
|
36
|
-
}) => JSX.Element;
|
|
36
|
+
}) => React.JSX.Element;
|
|
37
37
|
},
|
|
38
38
|
ref?: React.Ref<HTMLElement>
|
|
39
39
|
) => {
|
package/src/DateInput.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { Box } from "./Box";
|
|
|
4
4
|
import { Icon } from "./Icon";
|
|
5
5
|
import { IconType } from "./IconType";
|
|
6
6
|
import { Row } from "./Row";
|
|
7
|
-
import {
|
|
7
|
+
import { JSS } from "./jss";
|
|
8
8
|
|
|
9
9
|
export interface DateInputProps extends BaseInputProps {
|
|
10
10
|
onDateChange: (date: Date) => void;
|
|
@@ -12,7 +12,7 @@ export interface DateInputProps extends BaseInputProps {
|
|
|
12
12
|
icon?: IconType;
|
|
13
13
|
addOn?: ReactNode;
|
|
14
14
|
onChange?: undefined;
|
|
15
|
-
jsss?:
|
|
15
|
+
jsss?: JSS;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
export const DateInput = React.forwardRef(
|
package/src/DatetimeInput.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { Box } from "./Box";
|
|
|
4
4
|
import { Icon } from "./Icon";
|
|
5
5
|
import { IconType } from "./IconType";
|
|
6
6
|
import { Row } from "./Row";
|
|
7
|
-
import {
|
|
7
|
+
import { JSS } from "./jss";
|
|
8
8
|
|
|
9
9
|
export interface DatetimeInputProps extends BaseInputProps {
|
|
10
10
|
onDateChange: (date: Date) => void;
|
|
@@ -12,7 +12,7 @@ export interface DatetimeInputProps extends BaseInputProps {
|
|
|
12
12
|
icon?: IconType;
|
|
13
13
|
addOn?: ReactNode;
|
|
14
14
|
onChange?: undefined;
|
|
15
|
-
jss?:
|
|
15
|
+
jss?: JSS;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
const jsss = {
|
package/src/Dialog.tsx
CHANGED
|
@@ -40,7 +40,7 @@ export const Dialog = ({
|
|
|
40
40
|
close,
|
|
41
41
|
}: {
|
|
42
42
|
label: string;
|
|
43
|
-
children: JSX.Element;
|
|
43
|
+
children: React.JSX.Element;
|
|
44
44
|
close: () => void;
|
|
45
45
|
}) => {
|
|
46
46
|
return (
|
|
@@ -71,7 +71,7 @@ const DialogContext = React.createContext<{ setDialog: React.Dispatch<any> }>({
|
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
export function DialogProvider({ children }) {
|
|
74
|
-
const [dialog, setDialog] = useState<JSX.Element>(null);
|
|
74
|
+
const [dialog, setDialog] = useState<React.JSX.Element>(null);
|
|
75
75
|
const value = useMemo(() => ({ setDialog }), []);
|
|
76
76
|
|
|
77
77
|
return (
|
|
@@ -83,7 +83,7 @@ export function DialogProvider({ children }) {
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
export function useDialog<Input>(
|
|
86
|
-
DialogComponent: (props: { close: () => void } & Input) => JSX.Element,
|
|
86
|
+
DialogComponent: (props: { close: () => void } & Input) => React.JSX.Element,
|
|
87
87
|
options: { closeOnOutsideClick: boolean }
|
|
88
88
|
) {
|
|
89
89
|
const { setDialog } = useContext(DialogContext);
|
package/src/Dropdown.tsx
CHANGED
|
@@ -6,9 +6,9 @@ import { Button } from "./Button";
|
|
|
6
6
|
import { Column } from "./Column";
|
|
7
7
|
import { useNavigation } from "./useNavigation";
|
|
8
8
|
import { useRefEffect } from "./useRefEffect";
|
|
9
|
-
import { Gap,
|
|
9
|
+
import { Gap, JSS, Padding, Size, getBackground } from "./jss";
|
|
10
10
|
|
|
11
|
-
const jsss: { [key: string]:
|
|
11
|
+
const jsss: { [key: string]: JSS } = {
|
|
12
12
|
root: {
|
|
13
13
|
position: "relative",
|
|
14
14
|
display: "flex",
|
|
@@ -47,8 +47,8 @@ export function Dropdown<T extends string | number>({
|
|
|
47
47
|
options: Set<T>;
|
|
48
48
|
setSelection: (selection: T) => void;
|
|
49
49
|
selection: T;
|
|
50
|
-
jss?:
|
|
51
|
-
jssButton?:
|
|
50
|
+
jss?: JSS;
|
|
51
|
+
jssButton?: JSS;
|
|
52
52
|
optionLabel: (option: T) => string;
|
|
53
53
|
padding?: Padding;
|
|
54
54
|
gap?: Gap;
|
package/src/Icon.tsx
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import React
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Icon as IconifyIcon } from "@iconify/react";
|
|
2
3
|
import { BaseView } from "./BaseView";
|
|
3
4
|
import { IconType } from "./IconType";
|
|
4
5
|
import { Size, TextColor, getTextColor } from "./jss";
|
|
@@ -43,33 +44,7 @@ const jsss = {
|
|
|
43
44
|
},
|
|
44
45
|
};
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
const initializeIcons = () => {
|
|
49
|
-
if (initialized) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const hasIconify = document.getElementById("iconify");
|
|
54
|
-
|
|
55
|
-
if (hasIconify) {
|
|
56
|
-
initialized = true;
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const script = document.createElement("script");
|
|
61
|
-
script.src = "https://code.iconify.design/3/3.1.1/iconify.min.js";
|
|
62
|
-
script.id = "iconify";
|
|
63
|
-
document.head.appendChild(script);
|
|
64
|
-
|
|
65
|
-
initialized = true;
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export function IconProvider({ children }: { children: JSX.Element }) {
|
|
69
|
-
useEffect(() => {
|
|
70
|
-
initializeIcons();
|
|
71
|
-
}, []);
|
|
72
|
-
|
|
47
|
+
export function IconProvider({ children }: { children: React.JSX.Element }) {
|
|
73
48
|
return children;
|
|
74
49
|
}
|
|
75
50
|
|
|
@@ -86,7 +61,6 @@ export function Icon({
|
|
|
86
61
|
}) {
|
|
87
62
|
return (
|
|
88
63
|
<BaseView
|
|
89
|
-
key={icon}
|
|
90
64
|
aria-label={ariaLabel}
|
|
91
65
|
jss={[
|
|
92
66
|
jsss.root,
|
|
@@ -100,7 +74,7 @@ export function Icon({
|
|
|
100
74
|
getTextColor(color),
|
|
101
75
|
]}
|
|
102
76
|
>
|
|
103
|
-
<
|
|
77
|
+
<IconifyIcon icon={icon} width="100%" height="100%" />
|
|
104
78
|
</BaseView>
|
|
105
79
|
);
|
|
106
80
|
}
|
package/src/IconLink.tsx
CHANGED
|
@@ -20,7 +20,7 @@ export interface IconLinkProps extends BaseLinkProps {
|
|
|
20
20
|
|
|
21
21
|
export const IconLink = React.forwardRef(
|
|
22
22
|
(
|
|
23
|
-
{ icon, size, color, bare, disabled, ...otherProps }: IconLinkProps,
|
|
23
|
+
{ icon, size, color, bare, disabled, jss, ...otherProps }: IconLinkProps,
|
|
24
24
|
ref?: React.Ref<HTMLAnchorElement>
|
|
25
25
|
) => {
|
|
26
26
|
return (
|
|
@@ -42,6 +42,7 @@ export const IconLink = React.forwardRef(
|
|
|
42
42
|
transform: "scale(0.92)",
|
|
43
43
|
},
|
|
44
44
|
},
|
|
45
|
+
jss,
|
|
45
46
|
]}
|
|
46
47
|
color={color}
|
|
47
48
|
ref={ref}
|
package/src/Interactable.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { JSS, Padding, TextColor, cssVar, getPadding } from "./jss";
|
|
2
2
|
|
|
3
3
|
export type InteractableColor =
|
|
4
4
|
| "positive"
|
|
@@ -78,7 +78,7 @@ const jsss = {
|
|
|
78
78
|
colorHover: {},
|
|
79
79
|
};
|
|
80
80
|
|
|
81
|
-
export function
|
|
81
|
+
export function getInteractableJSS({
|
|
82
82
|
color,
|
|
83
83
|
bare,
|
|
84
84
|
disabled,
|
|
@@ -92,7 +92,7 @@ export function getInteractableJSStyles({
|
|
|
92
92
|
animateInteraction: boolean;
|
|
93
93
|
padding: Padding;
|
|
94
94
|
border: boolean;
|
|
95
|
-
}): Array<
|
|
95
|
+
}): Array<JSS> {
|
|
96
96
|
return [
|
|
97
97
|
jsss.root,
|
|
98
98
|
color === "dark" && jsss.dark,
|
|
@@ -168,7 +168,7 @@ export const getCSSColor = (
|
|
|
168
168
|
}
|
|
169
169
|
};
|
|
170
170
|
|
|
171
|
-
export const
|
|
171
|
+
export const getInteractableListItemJSS = ({
|
|
172
172
|
bare,
|
|
173
173
|
selected,
|
|
174
174
|
}: {
|
package/src/ListButtonItem.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { BaseListItem, BaseListItemProps } from "./BaseListItem";
|
|
|
4
4
|
import {
|
|
5
5
|
InteractableColor,
|
|
6
6
|
getGlyphColor,
|
|
7
|
-
|
|
7
|
+
getInteractableListItemJSS,
|
|
8
8
|
} from "./Interactable";
|
|
9
9
|
import { BaseButton } from "./BaseButton";
|
|
10
10
|
import { useListContext } from "./List";
|
|
@@ -57,7 +57,7 @@ export const ListButtonItem = React.forwardRef(
|
|
|
57
57
|
bare={true}
|
|
58
58
|
color={bare ? "primary" : color}
|
|
59
59
|
ref={ref}
|
|
60
|
-
jss={
|
|
60
|
+
jss={getInteractableListItemJSS({ bare, selected })}
|
|
61
61
|
onClick={onClick}
|
|
62
62
|
>
|
|
63
63
|
{content}
|
package/src/ListLinkItem.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { BaseListItem, BaseListItemProps } from "./BaseListItem";
|
|
|
4
4
|
import {
|
|
5
5
|
InteractableColor,
|
|
6
6
|
getGlyphColor,
|
|
7
|
-
|
|
7
|
+
getInteractableListItemJSS,
|
|
8
8
|
} from "./Interactable";
|
|
9
9
|
import { BaseLink } from "./BaseLink";
|
|
10
10
|
import { useListContext } from "./List";
|
|
@@ -64,7 +64,7 @@ export const ListLinkItem = React.forwardRef(
|
|
|
64
64
|
color={color}
|
|
65
65
|
href={href}
|
|
66
66
|
ref={ref}
|
|
67
|
-
jss={
|
|
67
|
+
jss={getInteractableListItemJSS({ bare, selected })}
|
|
68
68
|
onClick={onClick}
|
|
69
69
|
>
|
|
70
70
|
{content}
|
package/src/MenuIcon.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseView } from "./BaseView";
|
|
2
2
|
import { Column } from "./Column";
|
|
3
|
-
import { Color,
|
|
3
|
+
import { Color, JSS, getBackground } from "./jss";
|
|
4
4
|
|
|
5
5
|
export function MenuIcon({ open, color }: { open: boolean; color: Color }) {
|
|
6
6
|
return (
|
|
@@ -31,7 +31,7 @@ export function MenuIcon({ open, color }: { open: boolean; color: Color }) {
|
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function Bar({ jss, color }: { jss:
|
|
34
|
+
function Bar({ jss, color }: { jss: JSS; color: Color }) {
|
|
35
35
|
return (
|
|
36
36
|
<BaseView
|
|
37
37
|
jss={[
|
package/src/NextJSRouter.tsx
CHANGED
|
@@ -5,9 +5,9 @@ import { Column } from "./Column";
|
|
|
5
5
|
import { ListDivider } from "./ListDivider";
|
|
6
6
|
import { BaseView } from "./BaseView";
|
|
7
7
|
import { useRouterState } from "./NextJSRouterState";
|
|
8
|
-
import {
|
|
8
|
+
import { JSS } from "./jss";
|
|
9
9
|
|
|
10
|
-
const jsss: { [key: string]:
|
|
10
|
+
const jsss: { [key: string]: JSS } = {
|
|
11
11
|
root: {
|
|
12
12
|
display: "flex",
|
|
13
13
|
flexDirection: "column",
|
package/src/Popover.tsx
CHANGED
|
@@ -3,9 +3,9 @@ import { queryFocusables } from "./aria";
|
|
|
3
3
|
|
|
4
4
|
import { BaseView } from "./BaseView";
|
|
5
5
|
import { useRefEffect } from "./useRefEffect";
|
|
6
|
-
import {
|
|
6
|
+
import { JSS, toClassnames } from "./jss";
|
|
7
7
|
|
|
8
|
-
const jsss: { [key: string]:
|
|
8
|
+
const jsss: { [key: string]: JSS } = {
|
|
9
9
|
popover: {
|
|
10
10
|
padding: 0,
|
|
11
11
|
zIndex: 1,
|
|
@@ -76,26 +76,26 @@ export function Popover({ children, close }) {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
interface PopoverTriggerProps<Input> {
|
|
79
|
-
PopoverComponent: (props: { close: () => void } & Input) => JSX.Element;
|
|
80
|
-
jss?:
|
|
81
|
-
|
|
79
|
+
PopoverComponent: (props: { close: () => void } & Input) => React.JSX.Element;
|
|
80
|
+
jss?: JSS;
|
|
81
|
+
jssDialog?: JSS;
|
|
82
82
|
className?: undefined;
|
|
83
83
|
grow?: boolean;
|
|
84
84
|
shrink?: boolean;
|
|
85
85
|
tag?: keyof HTMLElementTagNameMap;
|
|
86
|
-
children: (props: { toggle: (input: Input) => void }) => JSX.Element;
|
|
86
|
+
children: (props: { toggle: (input: Input) => void }) => React.JSX.Element;
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
export function PopoverTrigger<Input>({
|
|
90
90
|
PopoverComponent,
|
|
91
91
|
jss,
|
|
92
|
-
|
|
92
|
+
jssDialog,
|
|
93
93
|
grow,
|
|
94
94
|
shrink,
|
|
95
95
|
tag,
|
|
96
96
|
children,
|
|
97
97
|
}: PopoverTriggerProps<Input>) {
|
|
98
|
-
const [popover, setPopover] = useState<JSX.Element>(null);
|
|
98
|
+
const [popover, setPopover] = useState<React.JSX.Element>(null);
|
|
99
99
|
const dialogRef = useRef<null | HTMLDialogElement>(null);
|
|
100
100
|
|
|
101
101
|
const toggle = (input: Input) => {
|
|
@@ -127,7 +127,7 @@ export function PopoverTrigger<Input>({
|
|
|
127
127
|
ref={(ref: null | HTMLDialogElement) => {
|
|
128
128
|
dialogRef.current = ref;
|
|
129
129
|
}}
|
|
130
|
-
className={toClassnames([jsss.popover,
|
|
130
|
+
className={toClassnames([jsss.popover, jssDialog])}
|
|
131
131
|
onClose={() => {
|
|
132
132
|
setPopover(null);
|
|
133
133
|
}}
|
package/src/ProgressBar.tsx
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BaseView } from "./BaseView";
|
|
3
|
-
import { Color, Size,
|
|
3
|
+
import { Color, Size, JSS, getBackground } from "./jss";
|
|
4
4
|
|
|
5
|
-
const jsss: { [key: string]:
|
|
5
|
+
const jsss: { [key: string]: JSS } = {
|
|
6
6
|
root: {
|
|
7
7
|
width: "100%",
|
|
8
8
|
display: "flex",
|
|
@@ -40,7 +40,7 @@ export function ProgressBar({
|
|
|
40
40
|
progress: number;
|
|
41
41
|
color: Color;
|
|
42
42
|
size: Size;
|
|
43
|
-
jss?:
|
|
43
|
+
jss?: JSS;
|
|
44
44
|
}) {
|
|
45
45
|
return (
|
|
46
46
|
<BaseView
|
package/src/Providers.tsx
CHANGED
|
@@ -3,13 +3,13 @@ import { DarkModeProvider } from "./DarkMode";
|
|
|
3
3
|
import { DialogProvider } from "./Dialog";
|
|
4
4
|
import { IconProvider } from "./Icon";
|
|
5
5
|
import { useCookie } from "./useCookie";
|
|
6
|
-
import {
|
|
6
|
+
import { JSSProvider, Theme } from "./jss";
|
|
7
7
|
|
|
8
8
|
export function Providers({
|
|
9
9
|
children,
|
|
10
10
|
themes,
|
|
11
11
|
}: {
|
|
12
|
-
children: JSX.Element;
|
|
12
|
+
children: React.JSX.Element;
|
|
13
13
|
themes: { light: Theme; dark: Theme };
|
|
14
14
|
}) {
|
|
15
15
|
const [darkModeEnabled, setDarkModeEnabled] = useCookie("dark-mode", {
|
|
@@ -22,12 +22,12 @@ export function Providers({
|
|
|
22
22
|
);
|
|
23
23
|
|
|
24
24
|
return (
|
|
25
|
-
<
|
|
25
|
+
<JSSProvider themes={themes}>
|
|
26
26
|
<IconProvider>
|
|
27
27
|
<DarkModeProvider enabled={darkModeEnabled} toggle={toggleDarkMode}>
|
|
28
28
|
<DialogProvider>{children}</DialogProvider>
|
|
29
29
|
</DarkModeProvider>
|
|
30
30
|
</IconProvider>
|
|
31
|
-
</
|
|
31
|
+
</JSSProvider>
|
|
32
32
|
);
|
|
33
33
|
}
|
package/src/RangeInput.tsx
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BaseInput, BaseInputProps } from "./BaseInput";
|
|
3
3
|
import { Row } from "./Row";
|
|
4
|
-
import { Gap,
|
|
4
|
+
import { Gap, JSS, Padding, cssVar } from "./jss";
|
|
5
5
|
|
|
6
6
|
export interface RangeInputProps extends BaseInputProps {
|
|
7
7
|
onValueChange: (value: number) => void;
|
|
8
8
|
value: number;
|
|
9
|
-
|
|
9
|
+
jssRoot?: JSS;
|
|
10
10
|
onChange?: undefined;
|
|
11
11
|
padding?: Padding;
|
|
12
12
|
gap?: Gap;
|
|
13
|
-
addOn?: JSX.Element;
|
|
13
|
+
addOn?: React.JSX.Element;
|
|
14
14
|
addOnPosition?: "start" | "end";
|
|
15
15
|
}
|
|
16
16
|
|
|
@@ -19,7 +19,7 @@ export const RangeInput = React.forwardRef(
|
|
|
19
19
|
{
|
|
20
20
|
value,
|
|
21
21
|
onValueChange,
|
|
22
|
-
|
|
22
|
+
jssRoot,
|
|
23
23
|
jss,
|
|
24
24
|
gap = "medium",
|
|
25
25
|
padding = "none",
|
|
@@ -45,7 +45,7 @@ export const RangeInput = React.forwardRef(
|
|
|
45
45
|
backgroundColor: cssVar("--light-highlight"),
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
|
-
|
|
48
|
+
jssRoot,
|
|
49
49
|
]}
|
|
50
50
|
>
|
|
51
51
|
{addOnPosition === "start" && addOn}
|
package/src/Select.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { forwardRef } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { JSS, cssVar, toClassnames } from "./jss";
|
|
3
3
|
|
|
4
4
|
export interface SelectProps extends React.HTMLAttributes<HTMLSelectElement> {
|
|
5
5
|
value: string;
|
|
6
6
|
onValueChange: (value: string) => void;
|
|
7
|
-
jss?:
|
|
7
|
+
jss?: JSS;
|
|
8
8
|
ref?: React.Ref<HTMLSelectElement>;
|
|
9
9
|
className?: undefined;
|
|
10
10
|
}
|
package/src/StaticCheckbox.tsx
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { BaseView } from "./BaseView";
|
|
3
3
|
import { Icon } from "./Icon";
|
|
4
|
-
import {
|
|
4
|
+
import { JSS, Size, cssVar } from "./jss";
|
|
5
5
|
import { IconType } from "./IconType";
|
|
6
6
|
|
|
7
7
|
type StaticCheckboxProps = {
|
|
@@ -10,7 +10,7 @@ type StaticCheckboxProps = {
|
|
|
10
10
|
icon?: IconType;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
const jsss: { [key: string]:
|
|
13
|
+
const jsss: { [key: string]: JSS } = {
|
|
14
14
|
border: {
|
|
15
15
|
position: "absolute",
|
|
16
16
|
top: "var(--spacing-xs)",
|
package/src/Storage.tsx
CHANGED
|
@@ -36,7 +36,7 @@ export function createStorage<State>({
|
|
|
36
36
|
|
|
37
37
|
const state = { current: initialState };
|
|
38
38
|
|
|
39
|
-
function Storage({ children }: { children: ReactNode }): JSX.Element {
|
|
39
|
+
function Storage({ children }: { children: ReactNode }): React.JSX.Element {
|
|
40
40
|
const emitterRef = useRef(createEmitter<State>());
|
|
41
41
|
|
|
42
42
|
const subscribe = useCallback((callback: Callback<State>) => {
|
package/src/Sublist.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { ListButtonItem } from "./ListButtonItem";
|
|
|
3
3
|
import { Icon } from "./Icon";
|
|
4
4
|
import { Box } from "./Box";
|
|
5
5
|
import { Row } from "./Row";
|
|
6
|
-
import {
|
|
6
|
+
import { JSS } from "./jss";
|
|
7
7
|
|
|
8
8
|
export function Sublist({
|
|
9
9
|
children,
|
|
@@ -19,7 +19,7 @@ export function Sublist({
|
|
|
19
19
|
initialState?: {
|
|
20
20
|
collapsed: boolean;
|
|
21
21
|
};
|
|
22
|
-
jss?:
|
|
22
|
+
jss?: JSS;
|
|
23
23
|
secondaryAddOn?: ReactNode;
|
|
24
24
|
}) {
|
|
25
25
|
const [collapsed, setCollapsed] = React.useState(initialState.collapsed);
|
package/src/Tabs.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseLink } from "./BaseLink";
|
|
2
2
|
import { Row, RowProps } from "./Row";
|
|
3
|
-
import {
|
|
3
|
+
import { JSS, Padding, Size, cssVar, getPadding } from "./jss";
|
|
4
4
|
import { useNavigation } from "./useNavigation";
|
|
5
5
|
import { Text } from "./Text";
|
|
6
6
|
import { ReactNode } from "react";
|
|
@@ -21,7 +21,7 @@ export interface TabsProps extends RowProps {
|
|
|
21
21
|
labelSize?: Size;
|
|
22
22
|
bare?: boolean;
|
|
23
23
|
tabPadding?: Padding;
|
|
24
|
-
|
|
24
|
+
jssTab?: JSS | ((data: { selected: boolean }) => JSS);
|
|
25
25
|
labelRenderer?: (label: string) => ReactNode;
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -32,7 +32,7 @@ export function Tabs({
|
|
|
32
32
|
tabPadding = "medium",
|
|
33
33
|
labelSize = "large",
|
|
34
34
|
jss,
|
|
35
|
-
|
|
35
|
+
jssTab,
|
|
36
36
|
labelRenderer,
|
|
37
37
|
["aria-controls"]: ariaControls,
|
|
38
38
|
...otherProps
|
|
@@ -93,9 +93,7 @@ export function Tabs({
|
|
|
93
93
|
},
|
|
94
94
|
},
|
|
95
95
|
getPadding(tabPadding),
|
|
96
|
-
typeof
|
|
97
|
-
? tabJSStyle({ selected })
|
|
98
|
-
: tabJSStyle,
|
|
96
|
+
typeof jssTab === "function" ? jssTab({ selected }) : jssTab,
|
|
99
97
|
]}
|
|
100
98
|
>
|
|
101
99
|
{addOnPosition === "start" && addOn}
|
package/src/Text.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
JSS,
|
|
4
4
|
Size,
|
|
5
5
|
TextColor,
|
|
6
6
|
cssVar,
|
|
@@ -29,7 +29,7 @@ export interface TextProps {
|
|
|
29
29
|
align?: "center" | "none";
|
|
30
30
|
type?: TextType;
|
|
31
31
|
grow?: boolean;
|
|
32
|
-
jss?:
|
|
32
|
+
jss?: JSS;
|
|
33
33
|
id?: string;
|
|
34
34
|
htmlFor?: string;
|
|
35
35
|
}
|
package/src/TextArea.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { JSS, Padding, cssVar, getPadding, toClassnames } from "./jss";
|
|
3
3
|
|
|
4
4
|
export interface TextAreaProps
|
|
5
5
|
extends React.InputHTMLAttributes<HTMLTextAreaElement> {
|
|
6
|
-
jss?:
|
|
6
|
+
jss?: JSS;
|
|
7
7
|
onValueChange?: (value: string) => void;
|
|
8
8
|
value?: string;
|
|
9
9
|
className?: undefined;
|
package/src/TextInput.tsx
CHANGED
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import { BaseInput, BaseInputProps } from "./BaseInput";
|
|
3
|
-
import { Row } from "./Row";
|
|
4
|
-
import { Gap, JSStyle, Padding, cssVar, getPadding } from "./jss";
|
|
5
3
|
import { Column } from "./Column";
|
|
4
|
+
import { Row } from "./Row";
|
|
5
|
+
import { Gap, JSS, Padding, Size, cssVar, getPadding } from "./jss";
|
|
6
|
+
|
|
7
|
+
const fontSize = {
|
|
8
|
+
xsmall: cssVar("--font-xsmall"),
|
|
9
|
+
small: cssVar("--font-small"),
|
|
10
|
+
medium: cssVar("--font-medium"),
|
|
11
|
+
large: cssVar("--font-large"),
|
|
12
|
+
xlarge: cssVar("--font-xlarge"),
|
|
13
|
+
xxlarge: cssVar("--font-xxlarge"),
|
|
14
|
+
xxxlarge: cssVar("--font-xxxlarge"),
|
|
15
|
+
};
|
|
6
16
|
|
|
7
|
-
export interface TextInputProps extends BaseInputProps {
|
|
17
|
+
export interface TextInputProps extends Omit<BaseInputProps, "size"> {
|
|
8
18
|
onValueChange?: (value: string) => void;
|
|
9
|
-
|
|
19
|
+
jssRoot?: JSS;
|
|
10
20
|
addOn?: ReactNode;
|
|
11
21
|
addOnPosition?: "start" | "end";
|
|
12
22
|
gap?: Gap;
|
|
13
23
|
onChange?: undefined;
|
|
14
24
|
padding?: Padding;
|
|
15
25
|
bare?: boolean;
|
|
26
|
+
size?: Size;
|
|
16
27
|
}
|
|
17
28
|
|
|
18
29
|
export const TextInput = React.forwardRef(
|
|
@@ -20,13 +31,14 @@ export const TextInput = React.forwardRef(
|
|
|
20
31
|
{
|
|
21
32
|
value,
|
|
22
33
|
onValueChange,
|
|
23
|
-
|
|
34
|
+
jssRoot,
|
|
24
35
|
jss,
|
|
25
36
|
addOn,
|
|
26
37
|
gap = "small",
|
|
27
38
|
addOnPosition = "start",
|
|
28
39
|
padding = "medium",
|
|
29
40
|
bare,
|
|
41
|
+
size = "medium",
|
|
30
42
|
...inputProps
|
|
31
43
|
}: TextInputProps,
|
|
32
44
|
ref?: React.Ref<HTMLInputElement>
|
|
@@ -54,7 +66,7 @@ export const TextInput = React.forwardRef(
|
|
|
54
66
|
outlineOffset: -2,
|
|
55
67
|
},
|
|
56
68
|
},
|
|
57
|
-
|
|
69
|
+
jssRoot,
|
|
58
70
|
]}
|
|
59
71
|
>
|
|
60
72
|
{addOnPosition === "start" && addOn && (
|
|
@@ -81,8 +93,8 @@ export const TextInput = React.forwardRef(
|
|
|
81
93
|
color: cssVar("--primary-text"),
|
|
82
94
|
outline: "none",
|
|
83
95
|
border: "none",
|
|
84
|
-
fontSize:
|
|
85
|
-
lineHeight:
|
|
96
|
+
fontSize: fontSize[size],
|
|
97
|
+
lineHeight: 1.2,
|
|
86
98
|
"::placeholder": {
|
|
87
99
|
color: cssVar("--subtle-text"),
|
|
88
100
|
},
|
package/src/TextPairing.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
Padding,
|
|
13
13
|
Align,
|
|
14
14
|
cssVar,
|
|
15
|
-
|
|
15
|
+
JSS,
|
|
16
16
|
} from "./jss";
|
|
17
17
|
|
|
18
18
|
export interface TextPairingProps {
|
|
@@ -31,7 +31,7 @@ export interface TextPairingProps {
|
|
|
31
31
|
grow?: boolean;
|
|
32
32
|
shrink?: boolean;
|
|
33
33
|
headlineBold?: boolean;
|
|
34
|
-
jss?:
|
|
34
|
+
jss?: JSS;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
export function TextPairing({
|