@noya-app/noya-designsystem 0.1.31 → 0.1.32
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/.turbo/turbo-build.log +20 -12
- package/.turbo/turbo-lint.log +2 -1
- package/CHANGELOG.md +7 -0
- package/README.md +13 -1
- package/dist/index.css +1 -0
- package/dist/index.d.ts +132 -509
- package/dist/index.js +4167 -2716
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4097 -2643
- package/dist/index.mjs.map +1 -1
- package/package.json +14 -5
- package/src/components/ActivityIndicator.tsx +4 -36
- package/src/components/Avatar.tsx +63 -62
- package/src/components/Button.tsx +53 -172
- package/src/components/Chip.tsx +117 -150
- package/src/components/ContextMenu.tsx +13 -35
- package/src/components/Dialog.tsx +66 -54
- package/src/components/Divider.tsx +31 -41
- package/src/components/DraggableMenuButton.tsx +29 -30
- package/src/components/DropdownMenu.tsx +30 -40
- package/src/components/FillInputField.tsx +16 -26
- package/src/components/FillPreviewBackground.tsx +18 -22
- package/src/components/FloatingWindow.tsx +4 -7
- package/src/components/GridView.tsx +70 -200
- package/src/components/IconButton.tsx +1 -5
- package/src/components/InputField.tsx +191 -194
- package/src/components/InputFieldWithCompletions.tsx +20 -27
- package/src/components/InspectorContainer.tsx +4 -9
- package/src/components/InspectorPrimitives.tsx +135 -109
- package/src/components/Label.tsx +5 -36
- package/src/components/LabeledElementView.tsx +5 -26
- package/src/components/ListView.tsx +239 -167
- package/src/components/Popover.tsx +15 -39
- package/src/components/Progress.tsx +21 -44
- package/src/components/RadioGroup.tsx +6 -71
- package/src/components/ScrollArea.tsx +11 -39
- package/src/components/SelectMenu.tsx +31 -48
- package/src/components/Slider.tsx +7 -43
- package/src/components/Spacer.tsx +6 -18
- package/src/components/Switch.tsx +4 -42
- package/src/components/Text.tsx +31 -66
- package/src/components/TextArea.tsx +5 -31
- package/src/components/Toast.tsx +15 -57
- package/src/components/Tooltip.tsx +4 -13
- package/src/components/WorkspaceLayout.tsx +4 -14
- package/src/components/internal/Menu.tsx +37 -83
- package/src/contexts/DesignSystemConfiguration.tsx +1 -47
- package/src/contexts/DialogContext.tsx +2 -10
- package/src/hooks/useDarkMode.ts +14 -0
- package/src/index.css +108 -0
- package/src/index.tsx +3 -4
- package/src/theme/index.ts +4 -16
- package/src/utils/tailwind.ts +17 -0
- package/tailwind.config.ts +106 -166
- package/tsup.config.ts +16 -0
- package/dist/index.d.mts +0 -1443
- package/src/components/Grid.tsx +0 -54
- package/src/components/Stack.tsx +0 -164
- package/src/theme/dark.ts +0 -45
- package/src/theme/light.ts +0 -226
- package/src/utils/breakpoints.ts +0 -45
package/src/components/Grid.tsx
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components';
|
|
2
|
-
import { Colors } from '../theme';
|
|
3
|
-
|
|
4
|
-
export type GridProps = {
|
|
5
|
-
columns?: string;
|
|
6
|
-
rows?: string;
|
|
7
|
-
alignItems?: 'start' | 'center' | 'end';
|
|
8
|
-
justifyItems?: 'start' | 'center' | 'end';
|
|
9
|
-
placeItems?: 'start' | 'center' | 'end';
|
|
10
|
-
width?: number | string;
|
|
11
|
-
minWidth?: number | string;
|
|
12
|
-
maxWidth?: number | string;
|
|
13
|
-
height?: number | string;
|
|
14
|
-
minHeight?: number | string;
|
|
15
|
-
maxHeight?: number | string;
|
|
16
|
-
padding?: number | string;
|
|
17
|
-
paddingX?: number | string;
|
|
18
|
-
paddingXStart?: number | string;
|
|
19
|
-
paddingXEnd?: number | string;
|
|
20
|
-
paddingY?: number | string;
|
|
21
|
-
paddingYStart?: number | string;
|
|
22
|
-
paddingYEnd?: number | string;
|
|
23
|
-
gap?: number | string;
|
|
24
|
-
gapX?: number | string;
|
|
25
|
-
gapY?: number | string;
|
|
26
|
-
background?: keyof Colors;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const Grid = styled.div<GridProps>((props) => ({
|
|
30
|
-
display: 'grid',
|
|
31
|
-
gridTemplateColumns: props.columns,
|
|
32
|
-
gridTemplateRows: props.rows,
|
|
33
|
-
alignItems: props.alignItems,
|
|
34
|
-
justifyItems: props.justifyItems,
|
|
35
|
-
width: props.width,
|
|
36
|
-
minWidth: props.minWidth ?? 0,
|
|
37
|
-
maxWidth: props.maxWidth,
|
|
38
|
-
height: props.height,
|
|
39
|
-
minHeight: props.minHeight ?? 0,
|
|
40
|
-
maxHeight: props.maxHeight,
|
|
41
|
-
padding: props.padding,
|
|
42
|
-
paddingInline: props.paddingX,
|
|
43
|
-
paddingInlineStart: props.paddingXStart,
|
|
44
|
-
paddingInlineEnd: props.paddingXEnd,
|
|
45
|
-
paddingBlock: props.paddingY,
|
|
46
|
-
paddingBlockStart: props.paddingYStart,
|
|
47
|
-
paddingBlockEnd: props.paddingYEnd,
|
|
48
|
-
gap: props.gap,
|
|
49
|
-
gapRow: props.gapX,
|
|
50
|
-
gapColumn: props.gapY,
|
|
51
|
-
background: props.background,
|
|
52
|
-
}));
|
|
53
|
-
|
|
54
|
-
export default Grid;
|
package/src/components/Stack.tsx
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
Children,
|
|
3
|
-
CSSProperties,
|
|
4
|
-
ForwardedRef,
|
|
5
|
-
forwardRef,
|
|
6
|
-
memo,
|
|
7
|
-
ReactHTML,
|
|
8
|
-
ReactNode,
|
|
9
|
-
} from "react";
|
|
10
|
-
import styled from "styled-components";
|
|
11
|
-
import { BreakpointCollection, mergeBreakpoints } from "../utils/breakpoints";
|
|
12
|
-
import withSeparatorElements from "../utils/withSeparatorElements";
|
|
13
|
-
|
|
14
|
-
interface StyleProps {
|
|
15
|
-
display?: CSSProperties["display"];
|
|
16
|
-
visibility?: CSSProperties["visibility"];
|
|
17
|
-
position?: CSSProperties["position"];
|
|
18
|
-
zIndex?: CSSProperties["zIndex"];
|
|
19
|
-
gap?: CSSProperties["gap"];
|
|
20
|
-
inset?: CSSProperties["inset"];
|
|
21
|
-
top?: CSSProperties["top"];
|
|
22
|
-
right?: CSSProperties["right"];
|
|
23
|
-
bottom?: CSSProperties["bottom"];
|
|
24
|
-
left?: CSSProperties["left"];
|
|
25
|
-
flexDirection?: CSSProperties["flexDirection"];
|
|
26
|
-
justifyContent?: CSSProperties["justifyContent"];
|
|
27
|
-
alignItems?: CSSProperties["alignItems"];
|
|
28
|
-
alignSelf?: CSSProperties["alignSelf"];
|
|
29
|
-
flex?: CSSProperties["flex"];
|
|
30
|
-
flexWrap?: CSSProperties["flexWrap"];
|
|
31
|
-
height?: CSSProperties["height"];
|
|
32
|
-
minHeight?: CSSProperties["minHeight"];
|
|
33
|
-
maxHeight?: CSSProperties["maxHeight"];
|
|
34
|
-
width?: CSSProperties["width"];
|
|
35
|
-
minWidth?: CSSProperties["minWidth"];
|
|
36
|
-
maxWidth?: CSSProperties["maxWidth"];
|
|
37
|
-
aspectRatio?: CSSProperties["aspectRatio"];
|
|
38
|
-
padding?: CSSProperties["padding"];
|
|
39
|
-
paddingVertical?: string | number;
|
|
40
|
-
paddingHorizontal?: string | number;
|
|
41
|
-
margin?: CSSProperties["margin"];
|
|
42
|
-
background?: CSSProperties["background"];
|
|
43
|
-
backgroundSize?: CSSProperties["backgroundSize"];
|
|
44
|
-
backgroundPosition?: CSSProperties["backgroundPosition"];
|
|
45
|
-
borderRadius?: CSSProperties["borderRadius"];
|
|
46
|
-
overflowX?: CSSProperties["overflowX"];
|
|
47
|
-
overflowY?: CSSProperties["overflowY"];
|
|
48
|
-
overflow?: CSSProperties["overflow"];
|
|
49
|
-
textOverflow?: CSSProperties["textOverflow"];
|
|
50
|
-
boxShadow?: CSSProperties["boxShadow"];
|
|
51
|
-
outline?: CSSProperties["outline"];
|
|
52
|
-
border?: CSSProperties["border"];
|
|
53
|
-
borderTop?: CSSProperties["borderTop"];
|
|
54
|
-
borderRight?: CSSProperties["borderRight"];
|
|
55
|
-
borderBottom?: CSSProperties["borderBottom"];
|
|
56
|
-
borderLeft?: CSSProperties["borderLeft"];
|
|
57
|
-
cursor?: CSSProperties["cursor"];
|
|
58
|
-
userSelect?: CSSProperties["userSelect"];
|
|
59
|
-
transition?: CSSProperties["transition"];
|
|
60
|
-
opacity?: CSSProperties["opacity"];
|
|
61
|
-
filter?: CSSProperties["filter"];
|
|
62
|
-
color?: CSSProperties["color"];
|
|
63
|
-
order?: CSSProperties["order"];
|
|
64
|
-
pointerEvents?: CSSProperties["pointerEvents"];
|
|
65
|
-
lineHeight?: CSSProperties["lineHeight"];
|
|
66
|
-
isolation?: CSSProperties["isolation"];
|
|
67
|
-
backdropFilter?: CSSProperties["backdropFilter"];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export type StackBreakpointList = BreakpointCollection<StyleProps>;
|
|
71
|
-
|
|
72
|
-
interface Props extends StyleProps {
|
|
73
|
-
id?: string;
|
|
74
|
-
as?: keyof ReactHTML;
|
|
75
|
-
className?: string;
|
|
76
|
-
children?: ReactNode;
|
|
77
|
-
separator?: Parameters<typeof withSeparatorElements>[1];
|
|
78
|
-
breakpoints?: StackBreakpointList | null | false;
|
|
79
|
-
href?: string; // Shouldn't be here, ideally
|
|
80
|
-
tabIndex?: number;
|
|
81
|
-
style?: StyleProps;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
const Element = styled.div<{
|
|
85
|
-
$styleProps: StyleProps;
|
|
86
|
-
$breakpoints?: StackBreakpointList | null | false;
|
|
87
|
-
}>(({ $styleProps, $breakpoints }) => ({
|
|
88
|
-
...$styleProps,
|
|
89
|
-
...mergeBreakpoints($breakpoints || []),
|
|
90
|
-
}));
|
|
91
|
-
|
|
92
|
-
const StackBase = forwardRef(function StackBase(
|
|
93
|
-
{
|
|
94
|
-
id,
|
|
95
|
-
className,
|
|
96
|
-
as,
|
|
97
|
-
children,
|
|
98
|
-
separator,
|
|
99
|
-
breakpoints,
|
|
100
|
-
tabIndex,
|
|
101
|
-
href,
|
|
102
|
-
paddingHorizontal,
|
|
103
|
-
paddingVertical,
|
|
104
|
-
padding,
|
|
105
|
-
style,
|
|
106
|
-
...rest
|
|
107
|
-
}: Props,
|
|
108
|
-
forwardedRef: ForwardedRef<HTMLElement>
|
|
109
|
-
) {
|
|
110
|
-
const elements = separator
|
|
111
|
-
? withSeparatorElements(Children.toArray(children), separator)
|
|
112
|
-
: children;
|
|
113
|
-
|
|
114
|
-
const styleProps: StyleProps = {
|
|
115
|
-
display: "flex",
|
|
116
|
-
position: "relative",
|
|
117
|
-
alignItems: "stretch",
|
|
118
|
-
padding:
|
|
119
|
-
padding ||
|
|
120
|
-
`${paddingVertical ?? 0} ${paddingHorizontal ?? 0} ${paddingVertical ?? 0} ${paddingHorizontal ?? 0}`,
|
|
121
|
-
...rest,
|
|
122
|
-
...style,
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
return (
|
|
126
|
-
<Element
|
|
127
|
-
ref={forwardedRef as any}
|
|
128
|
-
id={id}
|
|
129
|
-
className={className}
|
|
130
|
-
as={as}
|
|
131
|
-
$styleProps={styleProps}
|
|
132
|
-
$breakpoints={breakpoints}
|
|
133
|
-
tabIndex={tabIndex}
|
|
134
|
-
{...(href && { href })}
|
|
135
|
-
>
|
|
136
|
-
{elements}
|
|
137
|
-
</Element>
|
|
138
|
-
);
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
type StackProps = Omit<Props, "flexDirection">;
|
|
142
|
-
|
|
143
|
-
const VerticalStack = memo(
|
|
144
|
-
forwardRef(function VStack(
|
|
145
|
-
props: StackProps,
|
|
146
|
-
forwardedRef: ForwardedRef<HTMLElement>
|
|
147
|
-
) {
|
|
148
|
-
return <StackBase {...props} flexDirection="column" ref={forwardedRef} />;
|
|
149
|
-
})
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
const HorizontalStack = memo(
|
|
153
|
-
forwardRef(function HStack(
|
|
154
|
-
props: StackProps,
|
|
155
|
-
forwardedRef: ForwardedRef<HTMLElement>
|
|
156
|
-
) {
|
|
157
|
-
return <StackBase {...props} flexDirection="row" ref={forwardedRef} />;
|
|
158
|
-
})
|
|
159
|
-
);
|
|
160
|
-
|
|
161
|
-
export const Stack = {
|
|
162
|
-
V: VerticalStack,
|
|
163
|
-
H: HorizontalStack,
|
|
164
|
-
};
|
package/src/theme/dark.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import produce from "immer";
|
|
2
|
-
import * as lightTheme from "./light";
|
|
3
|
-
|
|
4
|
-
export const name: string = "dark";
|
|
5
|
-
|
|
6
|
-
export const colors = produce(lightTheme.colors, (colors) => {
|
|
7
|
-
colors.logo.fill = "rgb(248,248,250)";
|
|
8
|
-
colors.logo.highlight = "rgb(248,248,250)";
|
|
9
|
-
colors.text = "rgb(248,248,250)";
|
|
10
|
-
colors.textMuted = "rgb(180,179,182)";
|
|
11
|
-
colors.textDisabled = "rgb(100,99,102)";
|
|
12
|
-
colors.inputBackground = "rgba(181,178,255,0.08)";
|
|
13
|
-
colors.inputBackgroundLight = "rgba(181,178,255,0.10)";
|
|
14
|
-
colors.codeBackground = "rgb(20,19,23)";
|
|
15
|
-
colors.dividerSubtle = "rgba(255,255,255,0.04)";
|
|
16
|
-
colors.divider = "rgba(255,255,255,0.08)";
|
|
17
|
-
colors.dividerStrong = "rgba(0,0,0,1)";
|
|
18
|
-
colors.primary = "rgb(119, 66, 255)";
|
|
19
|
-
colors.primaryLight = "rgb(134, 86, 255)";
|
|
20
|
-
colors.secondaryBright = "#36fe91";
|
|
21
|
-
colors.canvas.background = "rgb(20,19,23)";
|
|
22
|
-
colors.canvas.sliceOutline = "rgb(150,150,150)";
|
|
23
|
-
colors.canvas.grid = "rgba(0,0,0,0.1)";
|
|
24
|
-
colors.sidebar.background = "rgb(34,33,39)";
|
|
25
|
-
colors.sidebar.backgroundTransparent = "rgba(34,33,39,0.95)";
|
|
26
|
-
colors.popover.background = "rgba(34,33,39,1)";
|
|
27
|
-
colors.popover.divider = colors.divider;
|
|
28
|
-
colors.listView.raisedBackground = "rgba(181,178,255,0.1)";
|
|
29
|
-
colors.listView.editingBackground = "#000";
|
|
30
|
-
colors.slider.background = "#BBB";
|
|
31
|
-
colors.radioGroup.background = colors.inputBackground;
|
|
32
|
-
colors.mask = "rgb(102,187,106)";
|
|
33
|
-
colors.transparentChecker = "rgba(255,255,255,0.3)";
|
|
34
|
-
colors.scrollbar = "rgba(199,199,199,0.2)";
|
|
35
|
-
colors.placeholderDots = "rgba(255,255,255,0.3)";
|
|
36
|
-
colors.dragOutline = "white";
|
|
37
|
-
colors.activeBackground = "rgba(181,178,255,0.08)";
|
|
38
|
-
colors.thumbnailBackground = "#1f1d33";
|
|
39
|
-
colors.thumbnailShadow = "#1f1d3366";
|
|
40
|
-
colors.breadcrumb.text = colors.textMuted;
|
|
41
|
-
colors.breadcrumb.textHover = colors.textSubtle;
|
|
42
|
-
colors.breadcrumb.icon = colors.icon;
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
export { fonts, sizes, textStyles } from "./light";
|
package/src/theme/light.ts
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
import { CSSObject } from "styled-components";
|
|
2
|
-
import { mediaQuery } from "../mediaQuery";
|
|
3
|
-
|
|
4
|
-
export const name: string = "light";
|
|
5
|
-
|
|
6
|
-
export const colors = {
|
|
7
|
-
logo: {
|
|
8
|
-
fill: "rgb(150, 152, 172)",
|
|
9
|
-
highlight: "rgb(150, 152, 172)",
|
|
10
|
-
},
|
|
11
|
-
background: "rgb(255,255,255)",
|
|
12
|
-
text: "rgb(38, 48, 83)",
|
|
13
|
-
textMuted: "rgb(107, 113, 136)",
|
|
14
|
-
textSubtle: "rgb(117, 121, 129)",
|
|
15
|
-
textDisabled: "rgb(150, 152, 172)",
|
|
16
|
-
textDecorativeLight: "rgb(168, 185, 212)",
|
|
17
|
-
dividerSubtle: "rgba(30, 50, 100, 0.04)",
|
|
18
|
-
divider: "rgba(30, 50, 100, 0.07)",
|
|
19
|
-
dividerStrong: "rgba(30, 50, 100, 0.09)",
|
|
20
|
-
primary: "rgb(103, 70, 255)",
|
|
21
|
-
primaryLight: "rgb(147, 86, 255)",
|
|
22
|
-
primaryPastel: "rgba(234, 230, 255)",
|
|
23
|
-
secondary: "rgb(0, 151, 117)",
|
|
24
|
-
secondaryLight: "rgb(0, 160, 129)",
|
|
25
|
-
secondaryPastel: "rgb(205, 238, 231)",
|
|
26
|
-
secondaryBright: "#0ab557",
|
|
27
|
-
warning: "rgb(251, 211, 0)",
|
|
28
|
-
neutralBackground: "rgb(222,223,232)",
|
|
29
|
-
inputBackground: "rgb(240, 242, 246)",
|
|
30
|
-
inputBackgroundLight: "rgb(243, 245, 249)",
|
|
31
|
-
codeBackground: "rgb(250, 250, 250)",
|
|
32
|
-
codeBackgroundLight: "rgb(250, 250, 250)",
|
|
33
|
-
get codeBackgroundDark() {
|
|
34
|
-
return colors.text;
|
|
35
|
-
},
|
|
36
|
-
codeBackgroundDecorativeDark: "#435080",
|
|
37
|
-
selectedBackground: "rgb(242, 245, 250)",
|
|
38
|
-
transparentChecker: "rgba(255,255,255,0.8)",
|
|
39
|
-
activeBackground: "rgba(0,0,0,0.1)",
|
|
40
|
-
scrollbar: "rgba(199,199,199,0.8)",
|
|
41
|
-
placeholderDots: "rgba(0,0,0,0.3)",
|
|
42
|
-
breadcrumb: {
|
|
43
|
-
get text() {
|
|
44
|
-
return colors.textMuted;
|
|
45
|
-
},
|
|
46
|
-
get textHover() {
|
|
47
|
-
return colors.textSubtle;
|
|
48
|
-
},
|
|
49
|
-
get icon() {
|
|
50
|
-
return colors.icon;
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
listView: {
|
|
54
|
-
raisedBackground: "rgba(0,0,0,0.03)",
|
|
55
|
-
editingBackground: "#fff",
|
|
56
|
-
},
|
|
57
|
-
canvas: {
|
|
58
|
-
// background: "white",
|
|
59
|
-
background: "rgb(249,249,249)",
|
|
60
|
-
get selectionStroke() {
|
|
61
|
-
return colors.primary;
|
|
62
|
-
},
|
|
63
|
-
dragHandleStroke: "rgba(180,180,180,0.5)",
|
|
64
|
-
measurement: "rgb(207,92,42)",
|
|
65
|
-
sliceOutline: "rgb(210,210,210)",
|
|
66
|
-
grid: "rgba(0,0,0,0.05)",
|
|
67
|
-
},
|
|
68
|
-
sidebar: {
|
|
69
|
-
background: "rgb(255,255,255)",
|
|
70
|
-
backgroundTransparent: "rgba(255,255,255,0.85)",
|
|
71
|
-
},
|
|
72
|
-
popover: {
|
|
73
|
-
background: "rgb(252,252,252)",
|
|
74
|
-
divider: "transparent",
|
|
75
|
-
},
|
|
76
|
-
slider: {
|
|
77
|
-
background: "white",
|
|
78
|
-
border: "#BBB",
|
|
79
|
-
},
|
|
80
|
-
radioGroup: {
|
|
81
|
-
background: "white",
|
|
82
|
-
},
|
|
83
|
-
icon: "rgb(129, 131, 165)",
|
|
84
|
-
iconSelected: "rgb(220, 220, 220)",
|
|
85
|
-
mask: "rgb(12,193,67)",
|
|
86
|
-
imageOverlay:
|
|
87
|
-
"linear-gradient(0deg, rgba(132, 63, 255,0.55), rgba(132, 63, 255,0.55))",
|
|
88
|
-
get dragOutline() {
|
|
89
|
-
return colors.primary;
|
|
90
|
-
},
|
|
91
|
-
selection: "rgb(179,215,254)",
|
|
92
|
-
thumbnailBackground: "#f0efff",
|
|
93
|
-
thumbnailShadow: "#D3CEED66",
|
|
94
|
-
inlineCode: {
|
|
95
|
-
text: "rgb(103, 70, 255)",
|
|
96
|
-
background: "rgb(240, 242, 246)",
|
|
97
|
-
},
|
|
98
|
-
textLink: "rgb(103, 70, 255)",
|
|
99
|
-
textLinkFocused: "rgb(147, 86, 255)",
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
export const fonts = {
|
|
103
|
-
normal:
|
|
104
|
-
"'__Inter_6b0edc', '__Inter_Fallback_6b0edc', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",
|
|
105
|
-
monospace: "Menlo, Monaco, Consolas, 'Courier New', monospace",
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
// The last one, 0.85, I just eyeballed
|
|
109
|
-
const typeScale = [3.052, 2.441, 1.953, 1.563, 1.25, 1, 0.85]; // Major third
|
|
110
|
-
|
|
111
|
-
export const textStyles = {
|
|
112
|
-
title: {
|
|
113
|
-
fontFamily: fonts.normal,
|
|
114
|
-
fontSize: `${typeScale[0]}rem`,
|
|
115
|
-
fontWeight: "bold",
|
|
116
|
-
lineHeight: "1.4",
|
|
117
|
-
letterSpacing: "-0.05em",
|
|
118
|
-
[mediaQuery.small]: {
|
|
119
|
-
fontSize: "36px",
|
|
120
|
-
},
|
|
121
|
-
} as CSSObject,
|
|
122
|
-
subtitle: {
|
|
123
|
-
fontFamily: fonts.normal,
|
|
124
|
-
fontSize: `${typeScale[3]}rem`,
|
|
125
|
-
fontWeight: 500,
|
|
126
|
-
lineHeight: "1.75",
|
|
127
|
-
letterSpacing: "-0.05em",
|
|
128
|
-
[mediaQuery.small]: {
|
|
129
|
-
fontSize: "18px",
|
|
130
|
-
},
|
|
131
|
-
} as CSSObject,
|
|
132
|
-
heading1: {
|
|
133
|
-
fontFamily: fonts.normal,
|
|
134
|
-
fontSize: `${typeScale[2]}rem`,
|
|
135
|
-
fontWeight: 600,
|
|
136
|
-
lineHeight: "1.6",
|
|
137
|
-
letterSpacing: "-0.025em",
|
|
138
|
-
} as CSSObject,
|
|
139
|
-
heading2: {
|
|
140
|
-
fontFamily: fonts.normal,
|
|
141
|
-
fontSize: `${typeScale[3]}rem`,
|
|
142
|
-
fontWeight: 500,
|
|
143
|
-
lineHeight: "1.5",
|
|
144
|
-
letterSpacing: "-0.025em",
|
|
145
|
-
} as CSSObject,
|
|
146
|
-
heading3: {
|
|
147
|
-
fontFamily: fonts.normal,
|
|
148
|
-
fontSize: `${typeScale[4]}rem`,
|
|
149
|
-
fontWeight: 400,
|
|
150
|
-
lineHeight: "1.4",
|
|
151
|
-
letterSpacing: "-0.025em",
|
|
152
|
-
} as CSSObject,
|
|
153
|
-
heading4: {
|
|
154
|
-
fontFamily: fonts.normal,
|
|
155
|
-
fontSize: `${typeScale[5]}rem`,
|
|
156
|
-
fontWeight: 500,
|
|
157
|
-
lineHeight: "1.4",
|
|
158
|
-
} as CSSObject,
|
|
159
|
-
heading5: {
|
|
160
|
-
fontFamily: fonts.normal,
|
|
161
|
-
fontSize: `${typeScale[6]}rem`,
|
|
162
|
-
fontWeight: 500,
|
|
163
|
-
lineHeight: "1.4",
|
|
164
|
-
} as CSSObject,
|
|
165
|
-
body: {
|
|
166
|
-
fontFamily: fonts.normal,
|
|
167
|
-
fontSize: `${typeScale[5]}rem`,
|
|
168
|
-
fontWeight: 400,
|
|
169
|
-
lineHeight: "1.4",
|
|
170
|
-
} as CSSObject,
|
|
171
|
-
small: {
|
|
172
|
-
fontFamily: fonts.normal,
|
|
173
|
-
fontSize: `${typeScale[6]}rem`,
|
|
174
|
-
fontWeight: 400,
|
|
175
|
-
lineHeight: "19px",
|
|
176
|
-
// lineHeight: "1.4",
|
|
177
|
-
} as CSSObject,
|
|
178
|
-
button: {
|
|
179
|
-
fontFamily: fonts.normal,
|
|
180
|
-
fontSize: "0.8rem",
|
|
181
|
-
fontWeight: 500,
|
|
182
|
-
lineHeight: "1.4",
|
|
183
|
-
letterSpacing: "-0.2px",
|
|
184
|
-
} as CSSObject,
|
|
185
|
-
code: {
|
|
186
|
-
fontFamily: fonts.monospace,
|
|
187
|
-
fontSize: "90%",
|
|
188
|
-
lineHeight: "1.5",
|
|
189
|
-
} as CSSObject,
|
|
190
|
-
label: {
|
|
191
|
-
fontFamily: fonts.normal,
|
|
192
|
-
fontSize: "0.62rem",
|
|
193
|
-
fontWeight: 400,
|
|
194
|
-
lineHeight: "19px",
|
|
195
|
-
// lineHeight: "1.4",
|
|
196
|
-
textTransform: "uppercase",
|
|
197
|
-
letterSpacing: "-0.3px",
|
|
198
|
-
} as CSSObject,
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
export const sizes = {
|
|
202
|
-
inset: {
|
|
203
|
-
top: 46,
|
|
204
|
-
},
|
|
205
|
-
sidebarWidth: 260,
|
|
206
|
-
toolbar: {
|
|
207
|
-
height: 46,
|
|
208
|
-
itemSeparator: 8,
|
|
209
|
-
},
|
|
210
|
-
inspector: {
|
|
211
|
-
horizontalSeparator: 8,
|
|
212
|
-
verticalSeparator: 10,
|
|
213
|
-
},
|
|
214
|
-
spacing: {
|
|
215
|
-
nano: 2,
|
|
216
|
-
micro: 4,
|
|
217
|
-
small: 8,
|
|
218
|
-
medium: 16,
|
|
219
|
-
large: 32,
|
|
220
|
-
xlarge: 64,
|
|
221
|
-
xxlarge: 128,
|
|
222
|
-
},
|
|
223
|
-
dialog: {
|
|
224
|
-
padding: 16,
|
|
225
|
-
},
|
|
226
|
-
};
|
package/src/utils/breakpoints.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { CSSObject } from "styled-components";
|
|
2
|
-
|
|
3
|
-
type BreakpointKey = number | string;
|
|
4
|
-
|
|
5
|
-
export type Breakpoint<T extends object> = [BreakpointKey, T];
|
|
6
|
-
|
|
7
|
-
export type BreakpointCollection<T extends object> =
|
|
8
|
-
| Breakpoint<T>[]
|
|
9
|
-
| Record<BreakpointKey, T>;
|
|
10
|
-
|
|
11
|
-
export type StyleMap = Record<string, CSSObject>;
|
|
12
|
-
|
|
13
|
-
export function mergeBreakpoints(
|
|
14
|
-
breakpoints: BreakpointCollection<CSSObject>
|
|
15
|
-
): StyleMap;
|
|
16
|
-
export function mergeBreakpoints<T extends object>(
|
|
17
|
-
breakpoints: BreakpointCollection<T>,
|
|
18
|
-
transform?: (value: T) => CSSObject
|
|
19
|
-
): StyleMap;
|
|
20
|
-
export function mergeBreakpoints<T extends object>(
|
|
21
|
-
breakpoints: BreakpointCollection<T>,
|
|
22
|
-
transform?: (value: T) => CSSObject
|
|
23
|
-
): StyleMap {
|
|
24
|
-
const breakpointMap = Array.isArray(breakpoints)
|
|
25
|
-
? breakpoints.reduce(
|
|
26
|
-
(result: Record<number, T>, item: any /* TODO Fix type */) => {
|
|
27
|
-
const [key, value] = item;
|
|
28
|
-
result[key] = result[key] ? { ...result[key], ...value } : value;
|
|
29
|
-
return result;
|
|
30
|
-
},
|
|
31
|
-
{}
|
|
32
|
-
)
|
|
33
|
-
: breakpoints;
|
|
34
|
-
|
|
35
|
-
const breakpointList = Object.entries(breakpointMap) as Breakpoint<T>[];
|
|
36
|
-
|
|
37
|
-
const transformedList = breakpointList
|
|
38
|
-
.sort((a, b) => Number(b[0]) - Number(a[0]))
|
|
39
|
-
.map(([width, value]: Breakpoint<T>) => [
|
|
40
|
-
`@media (min-width: ${width}px)`,
|
|
41
|
-
transform?.(value) ?? value,
|
|
42
|
-
]);
|
|
43
|
-
|
|
44
|
-
return Object.fromEntries(transformedList);
|
|
45
|
-
}
|