aidos-ui 3.0.31 → 4.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +2 -2
- 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 +2 -2
- package/dist/DateInput.d.ts +2 -2
- package/dist/DatetimeInput.d.ts +2 -2
- package/dist/Dropdown.d.ts +3 -3
- package/dist/Dropdown.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/Popover.d.ts +4 -4
- 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.js +2 -2
- package/dist/Providers.js.map +1 -1
- package/dist/RangeInput.d.ts +2 -2
- package/dist/RangeInput.js +2 -2
- package/dist/RangeInput.js.map +1 -1
- package/dist/Select.d.ts +2 -2
- package/dist/Select.js.map +1 -1
- package/dist/StaticCheckbox.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/TextArea.d.ts +2 -2
- package/dist/TextArea.js.map +1 -1
- package/dist/TextInput.d.ts +2 -2
- package/dist/TextInput.js +2 -2
- package/dist/TextInput.js.map +1 -1
- package/dist/TextPairing.d.ts +2 -2
- package/dist/Tooltip.d.ts +2 -2
- package/dist/Tooltip.js.map +1 -1
- package/dist/jss.d.ts +15 -15
- package/dist/jss.js +4 -4
- package/dist/jss.js.map +1 -1
- package/package.json +1 -1
- 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 +2 -2
- package/src/BaseView.tsx +3 -3
- package/src/Calendar.tsx +2 -2
- package/src/DateInput.tsx +2 -2
- package/src/DatetimeInput.tsx +2 -2
- package/src/Dropdown.tsx +4 -4
- 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 +6 -6
- package/src/ProgressBar.tsx +3 -3
- package/src/Providers.tsx +3 -3
- package/src/RangeInput.tsx +4 -4
- package/src/Select.tsx +2 -2
- package/src/StaticCheckbox.tsx +2 -2
- 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 +4 -4
- package/src/TextPairing.tsx +2 -2
- package/src/Tooltip.tsx +3 -3
- package/src/jss.tsx +15 -15
- package/src/pages/_app.tsx +1 -1
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/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/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,
|
|
@@ -77,8 +77,8 @@ export function Popover({ children, close }) {
|
|
|
77
77
|
|
|
78
78
|
interface PopoverTriggerProps<Input> {
|
|
79
79
|
PopoverComponent: (props: { close: () => void } & Input) => JSX.Element;
|
|
80
|
-
jss?:
|
|
81
|
-
|
|
80
|
+
jss?: JSS;
|
|
81
|
+
jssDialog?: JSS;
|
|
82
82
|
className?: undefined;
|
|
83
83
|
grow?: boolean;
|
|
84
84
|
shrink?: boolean;
|
|
@@ -89,7 +89,7 @@ interface PopoverTriggerProps<Input> {
|
|
|
89
89
|
export function PopoverTrigger<Input>({
|
|
90
90
|
PopoverComponent,
|
|
91
91
|
jss,
|
|
92
|
-
|
|
92
|
+
jssDialog,
|
|
93
93
|
grow,
|
|
94
94
|
shrink,
|
|
95
95
|
tag,
|
|
@@ -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,7 +3,7 @@ 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,
|
|
@@ -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,12 +1,12 @@
|
|
|
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;
|
|
@@ -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/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,12 +1,12 @@
|
|
|
1
1
|
import React, { ReactNode } from "react";
|
|
2
2
|
import { BaseInput, BaseInputProps } from "./BaseInput";
|
|
3
3
|
import { Row } from "./Row";
|
|
4
|
-
import { Gap,
|
|
4
|
+
import { Gap, JSS, Padding, cssVar, getPadding } from "./jss";
|
|
5
5
|
import { Column } from "./Column";
|
|
6
6
|
|
|
7
7
|
export interface TextInputProps extends BaseInputProps {
|
|
8
8
|
onValueChange?: (value: string) => void;
|
|
9
|
-
|
|
9
|
+
jssRoot?: JSS;
|
|
10
10
|
addOn?: ReactNode;
|
|
11
11
|
addOnPosition?: "start" | "end";
|
|
12
12
|
gap?: Gap;
|
|
@@ -20,7 +20,7 @@ export const TextInput = React.forwardRef(
|
|
|
20
20
|
{
|
|
21
21
|
value,
|
|
22
22
|
onValueChange,
|
|
23
|
-
|
|
23
|
+
jssRoot,
|
|
24
24
|
jss,
|
|
25
25
|
addOn,
|
|
26
26
|
gap = "small",
|
|
@@ -54,7 +54,7 @@ export const TextInput = React.forwardRef(
|
|
|
54
54
|
outlineOffset: -2,
|
|
55
55
|
},
|
|
56
56
|
},
|
|
57
|
-
|
|
57
|
+
jssRoot,
|
|
58
58
|
]}
|
|
59
59
|
>
|
|
60
60
|
{addOnPosition === "start" && addOn && (
|
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({
|
package/src/Tooltip.tsx
CHANGED
|
@@ -3,9 +3,9 @@ import React, { useRef, useState } from "react";
|
|
|
3
3
|
import { BaseView } from "./BaseView";
|
|
4
4
|
import { useRefEffect } from "./useRefEffect";
|
|
5
5
|
import { Text } from "./Text";
|
|
6
|
-
import {
|
|
6
|
+
import { JSS, cssVar, toClassnames } from "./jss";
|
|
7
7
|
|
|
8
|
-
const jsss: { [key: string]:
|
|
8
|
+
const jsss: { [key: string]: JSS } = {
|
|
9
9
|
tooltip: {
|
|
10
10
|
top: "-100%",
|
|
11
11
|
transform: "translateY(50%)",
|
|
@@ -20,7 +20,7 @@ const jsss: { [key: string]: JSStyle } = {
|
|
|
20
20
|
|
|
21
21
|
interface TooltipProps {
|
|
22
22
|
content: string;
|
|
23
|
-
jss?:
|
|
23
|
+
jss?: JSS;
|
|
24
24
|
className?: undefined;
|
|
25
25
|
tag?: keyof HTMLElementTagNameMap;
|
|
26
26
|
children: JSX.Element;
|
package/src/jss.tsx
CHANGED
|
@@ -11,13 +11,13 @@ export type Styles = CSS.Properties<
|
|
|
11
11
|
string | number | CSS.Properties<string | number>
|
|
12
12
|
>;
|
|
13
13
|
|
|
14
|
-
export type
|
|
14
|
+
export type JSS =
|
|
15
15
|
| Styles
|
|
16
16
|
| null
|
|
17
17
|
| false
|
|
18
18
|
| undefined
|
|
19
19
|
| { [key: string]: Styles }
|
|
20
|
-
| Array<
|
|
20
|
+
| Array<JSS>;
|
|
21
21
|
|
|
22
22
|
const aliases: {
|
|
23
23
|
[alias: string]: (value: StylesValueType) => [string, StylesValueType][];
|
|
@@ -137,21 +137,21 @@ const getCSS = (key: string, value): [string, string] => {
|
|
|
137
137
|
return [cssProp, cssValue];
|
|
138
138
|
};
|
|
139
139
|
|
|
140
|
-
const
|
|
140
|
+
const flattenJSS = (jss: JSS): Styles => {
|
|
141
141
|
if (!jss) {
|
|
142
142
|
return {};
|
|
143
143
|
} else if (Array.isArray(jss)) {
|
|
144
144
|
// @ts-ignore
|
|
145
|
-
return jss.reduce((acc: Styles, jss:
|
|
146
|
-
return { ...acc, ...
|
|
145
|
+
return jss.reduce((acc: Styles, jss: JSS) => {
|
|
146
|
+
return { ...acc, ...flattenJSS(jss) };
|
|
147
147
|
}, {});
|
|
148
148
|
} else {
|
|
149
149
|
return jss;
|
|
150
150
|
}
|
|
151
151
|
};
|
|
152
152
|
|
|
153
|
-
export const toClassnames = (jss:
|
|
154
|
-
jss =
|
|
153
|
+
export const toClassnames = (jss: JSS): string => {
|
|
154
|
+
jss = flattenJSS(jss);
|
|
155
155
|
|
|
156
156
|
const stylesStack = Object.entries(jss);
|
|
157
157
|
const classNames = [];
|
|
@@ -205,7 +205,7 @@ export const toClassnames = (jss: JSStyle): string => {
|
|
|
205
205
|
|
|
206
206
|
const serverStyles = [];
|
|
207
207
|
|
|
208
|
-
export function
|
|
208
|
+
export function JSSProvider({
|
|
209
209
|
themes,
|
|
210
210
|
children,
|
|
211
211
|
}: {
|
|
@@ -324,7 +324,7 @@ export function getSpacing(spacing: Spacing): string {
|
|
|
324
324
|
}
|
|
325
325
|
}
|
|
326
326
|
|
|
327
|
-
export function getPadding(padding: Padding):
|
|
327
|
+
export function getPadding(padding: Padding): JSS {
|
|
328
328
|
if (Array.isArray(padding)) {
|
|
329
329
|
const [vertical, horizontal] = padding;
|
|
330
330
|
return {
|
|
@@ -340,7 +340,7 @@ export function getPadding(padding: Padding): JSStyle {
|
|
|
340
340
|
}
|
|
341
341
|
}
|
|
342
342
|
|
|
343
|
-
export function getMargin(margin: Margin):
|
|
343
|
+
export function getMargin(margin: Margin): JSS {
|
|
344
344
|
if (Array.isArray(margin)) {
|
|
345
345
|
const [vertical, horizontal] = margin;
|
|
346
346
|
return {
|
|
@@ -559,7 +559,7 @@ const backgroundStyles = {
|
|
|
559
559
|
},
|
|
560
560
|
};
|
|
561
561
|
|
|
562
|
-
export const getBackground = (color: Color):
|
|
562
|
+
export const getBackground = (color: Color): JSS => {
|
|
563
563
|
return backgroundStyles[color];
|
|
564
564
|
};
|
|
565
565
|
|
|
@@ -572,25 +572,25 @@ export const TABLET_MEDIA = `@media (min-width: ${MOBILE}px) and (max-width: ${T
|
|
|
572
572
|
export const LAPTOP_MEDIA = `@media (min-width: ${TABLET}px) and (max-width: ${LAPTOP}px)`;
|
|
573
573
|
export const DESKTOP_MEDIA = `@media (min-width: ${LAPTOP}px)`;
|
|
574
574
|
|
|
575
|
-
export function mobile(jss:
|
|
575
|
+
export function mobile(jss: JSS): { [key: string]: JSS } {
|
|
576
576
|
return {
|
|
577
577
|
[MOBILE_MEDIA]: jss,
|
|
578
578
|
};
|
|
579
579
|
}
|
|
580
580
|
|
|
581
|
-
export function tablet(jss:
|
|
581
|
+
export function tablet(jss: JSS): { [key: string]: JSS } {
|
|
582
582
|
return {
|
|
583
583
|
[TABLET_MEDIA]: jss,
|
|
584
584
|
};
|
|
585
585
|
}
|
|
586
586
|
|
|
587
|
-
export function laptop(jss:
|
|
587
|
+
export function laptop(jss: JSS): { [key: string]: JSS } {
|
|
588
588
|
return {
|
|
589
589
|
[LAPTOP_MEDIA]: jss,
|
|
590
590
|
};
|
|
591
591
|
}
|
|
592
592
|
|
|
593
|
-
export function desktop(jss:
|
|
593
|
+
export function desktop(jss: JSS): { [key: string]: JSS } {
|
|
594
594
|
return {
|
|
595
595
|
[DESKTOP_MEDIA]: jss,
|
|
596
596
|
};
|
package/src/pages/_app.tsx
CHANGED