cherry-styled-components 0.2.11 → 0.2.12
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/dist/avatar-dropzone.js +8 -8
- package/dist/button.js +17 -12
- package/dist/dropzone.js +14 -14
- package/dist/icon-button.js +7 -7
- package/dist/index.js +2 -2
- package/dist/input.js +6 -6
- package/dist/modal.js +6 -6
- package/dist/styled-components/client-theme-provider.js +12 -2
- package/dist/tabs.js +6 -7
- package/dist/theme-toggle.js +5 -5
- package/dist/utils/mixins.d.ts +10 -0
- package/dist/utils/mixins.js +9 -3
- package/package.json +11 -12
package/dist/avatar-dropzone.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { resetButton } from "./utils/mixins.js";
|
|
3
|
+
import { alpha, resetButton } from "./utils/mixins.js";
|
|
4
4
|
import { Icon } from "./icon.js";
|
|
5
5
|
import { matchesAccept } from "./dropzone.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
8
8
|
import styled, { css } from "styled-components";
|
|
9
|
-
import { rgba } from "polished";
|
|
10
9
|
//#region src/lib/avatar-dropzone.tsx
|
|
11
10
|
var avatarSizes = {
|
|
12
11
|
small: {
|
|
@@ -115,7 +114,7 @@ function LocalAvatarDropzone({ $size, $icon = "User", $maxBytes, "aria-label": a
|
|
|
115
114
|
var AvatarDropzone = /*#__PURE__*/ forwardRef(LocalAvatarDropzone);
|
|
116
115
|
var StyledAvatarDropzoneWrapper = styled.span.withConfig({
|
|
117
116
|
displayName: "avatar-dropzone__StyledAvatarDropzoneWrapper",
|
|
118
|
-
componentId: "sc-
|
|
117
|
+
componentId: "sc-758cb640-0"
|
|
119
118
|
})([
|
|
120
119
|
`position:relative;display:inline-flex;width:`,
|
|
121
120
|
`px;height:`,
|
|
@@ -123,7 +122,7 @@ var StyledAvatarDropzoneWrapper = styled.span.withConfig({
|
|
|
123
122
|
], ({ $size }) => avatarSizes[$size ?? "default"].box, ({ $size }) => avatarSizes[$size ?? "default"].box);
|
|
124
123
|
var StyledAvatarDropzone = styled.button.withConfig({
|
|
125
124
|
displayName: "avatar-dropzone__StyledAvatarDropzone",
|
|
126
|
-
componentId: "sc-
|
|
125
|
+
componentId: "sc-758cb640-1"
|
|
127
126
|
})([
|
|
128
127
|
``,
|
|
129
128
|
`;font-family:inherit;display:inline-flex;align-items:center;justify-content:center;width:100%;height:100%;border-radius:50%;overflow:hidden;border:2px `,
|
|
@@ -142,16 +141,17 @@ var StyledAvatarDropzone = styled.button.withConfig({
|
|
|
142
141
|
], resetButton, ({ $hasImage }) => $hasImage ? "solid" : "dashed", ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayDark, ({ $size }) => avatarSizes[$size ?? "default"].icon, ({ $size }) => avatarSizes[$size ?? "default"].icon, ({ theme }) => theme.colors.primary, ({ theme, $dragOver }) => $dragOver && css([
|
|
143
142
|
`border-color:`,
|
|
144
143
|
`;background:`,
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
`;:root.dark &{background:`,
|
|
145
|
+
`;}`
|
|
146
|
+
], theme.colors.primary, alpha(theme.colors.primary, theme.isDark ? 12 : 5), alpha(theme.colors.primary, 12)), ({ theme }) => theme.colors.primary, ({ theme }) => alpha(theme.colors.primary, theme.isDark ? 10 : 4), ({ theme }) => theme.colors.primary, ({ theme }) => theme.colors.primaryLight);
|
|
147
147
|
var StyledAvatarRemove = styled.button.withConfig({
|
|
148
148
|
displayName: "avatar-dropzone__StyledAvatarRemove",
|
|
149
|
-
componentId: "sc-
|
|
149
|
+
componentId: "sc-758cb640-2"
|
|
150
150
|
})([
|
|
151
151
|
``,
|
|
152
152
|
`;position:absolute;top:0;right:0;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;color:#ffffff;background:`,
|
|
153
153
|
`;transition:background 0.3s ease;& svg{width:14px;height:14px;}&:hover:not(:disabled){background:`,
|
|
154
154
|
`;}&:disabled{cursor:not-allowed;opacity:0.6;}`
|
|
155
|
-
], resetButton, ({ theme }) =>
|
|
155
|
+
], resetButton, ({ theme }) => alpha(theme.colors.dark, 60), ({ theme }) => theme.colors.error);
|
|
156
156
|
//#endregion
|
|
157
157
|
export { AvatarDropzone };
|
package/dist/button.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { formElementHeightStyles, resetButton } from "./utils/mixins.js";
|
|
3
|
+
import { formElementHeightStyles, resetButton, shade, tint } from "./utils/mixins.js";
|
|
4
4
|
import { jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { forwardRef } from "react";
|
|
6
6
|
import styled, { css } from "styled-components";
|
|
7
|
-
import { darken, lighten } from "polished";
|
|
8
7
|
//#region src/lib/button.tsx
|
|
8
|
+
var filledText = (theme) => theme.isDark ? theme.colors.dark : theme.colors.light;
|
|
9
|
+
var darkFilledText = (theme) => `:root.dark & { color: ${theme.colors.dark}; }`;
|
|
9
10
|
var buttonStyles = (theme, $variant, $size, $outline, $fullWidth, $error, disabled) => css([
|
|
10
11
|
``,
|
|
11
12
|
`;font-family:inherit;display:inline-flex;padding:15px 30px;border-radius:100px;font-weight:600;white-space:nowrap;hyphens:auto;color:`,
|
|
@@ -18,9 +19,10 @@ var buttonStyles = (theme, $variant, $size, $outline, $fullWidth, $error, disabl
|
|
|
18
19
|
` `,
|
|
19
20
|
` `,
|
|
20
21
|
``
|
|
21
|
-
], resetButton, theme
|
|
22
|
+
], resetButton, filledText(theme), !disabled && $variant === "primary" && css([
|
|
22
23
|
`color:`,
|
|
23
|
-
|
|
24
|
+
`;`,
|
|
25
|
+
` background:`,
|
|
24
26
|
`;border:solid 2px `,
|
|
25
27
|
`;box-shadow:0 0 0 0px `,
|
|
26
28
|
`;&:hover{background:`,
|
|
@@ -29,9 +31,10 @@ var buttonStyles = (theme, $variant, $size, $outline, $fullWidth, $error, disabl
|
|
|
29
31
|
`;}&:focus{box-shadow:0 0 0 4px `,
|
|
30
32
|
`;}&:active{box-shadow:0 0 0 2px `,
|
|
31
33
|
`;}`
|
|
32
|
-
], $outline ? theme.colors.primary : theme
|
|
34
|
+
], $outline ? theme.colors.primary : filledText(theme), !$outline && darkFilledText(theme), $outline ? "transparent" : theme.colors.primary, theme.colors.primary, theme.colors.primary, $outline ? "transparent" : theme.colors.primaryDark, theme.colors.primaryDark, $outline && `color: ${theme.colors.primaryDark}`, theme.colors.primaryLight, theme.colors.primaryLight), !disabled && $variant === "secondary" && css([
|
|
33
35
|
`color:`,
|
|
34
|
-
|
|
36
|
+
`;`,
|
|
37
|
+
` background:`,
|
|
35
38
|
`;border:solid 2px `,
|
|
36
39
|
`;box-shadow:0 0 0 0px `,
|
|
37
40
|
`;&:hover{background:`,
|
|
@@ -40,9 +43,10 @@ var buttonStyles = (theme, $variant, $size, $outline, $fullWidth, $error, disabl
|
|
|
40
43
|
`;}&:focus{box-shadow:0 0 0 4px `,
|
|
41
44
|
`;}&:active{box-shadow:0 0 0 2px `,
|
|
42
45
|
`;}`
|
|
43
|
-
], $outline ? theme.colors.secondary : theme
|
|
46
|
+
], $outline ? theme.colors.secondary : filledText(theme), !$outline && darkFilledText(theme), $outline ? "transparent" : theme.colors.secondary, theme.colors.secondary, theme.colors.secondary, $outline ? "transparent" : theme.colors.secondaryDark, theme.colors.secondaryDark, $outline && `color: ${theme.colors.secondaryDark}`, theme.colors.secondaryLight, theme.colors.secondaryLight), !disabled && $variant === "tertiary" && css([
|
|
44
47
|
`color:`,
|
|
45
|
-
|
|
48
|
+
`;`,
|
|
49
|
+
` background:`,
|
|
46
50
|
`;border:solid 2px `,
|
|
47
51
|
`;box-shadow:0 0 0 0px `,
|
|
48
52
|
`;&:hover{background:`,
|
|
@@ -51,9 +55,10 @@ var buttonStyles = (theme, $variant, $size, $outline, $fullWidth, $error, disabl
|
|
|
51
55
|
`;}&:focus{box-shadow:0 0 0 4px `,
|
|
52
56
|
`;}&:active{box-shadow:0 0 0 2px `,
|
|
53
57
|
`;}`
|
|
54
|
-
], $outline ? theme.colors.tertiary : theme
|
|
58
|
+
], $outline ? theme.colors.tertiary : filledText(theme), !$outline && darkFilledText(theme), $outline ? "transparent" : theme.colors.tertiary, theme.colors.tertiary, theme.colors.tertiary, $outline ? "transparent" : theme.colors.tertiaryDark, theme.colors.tertiaryDark, $outline && `color: ${theme.colors.tertiaryDark}`, theme.colors.tertiaryLight, theme.colors.tertiaryLight), !disabled && $error && css([
|
|
55
59
|
`color:`,
|
|
56
|
-
|
|
60
|
+
`;`,
|
|
61
|
+
` background:`,
|
|
57
62
|
`;border:solid 2px `,
|
|
58
63
|
`;box-shadow:0 0 0 0px `,
|
|
59
64
|
`;&:hover{background:`,
|
|
@@ -62,7 +67,7 @@ var buttonStyles = (theme, $variant, $size, $outline, $fullWidth, $error, disabl
|
|
|
62
67
|
`;}&:focus{box-shadow:0 0 0 4px `,
|
|
63
68
|
`;}&:active{box-shadow:0 0 0 2px `,
|
|
64
69
|
`;}`
|
|
65
|
-
], $outline ? theme.colors.error : theme
|
|
70
|
+
], $outline ? theme.colors.error : filledText(theme), !$outline && darkFilledText(theme), $outline ? "transparent" : theme.colors.error, theme.colors.error, theme.colors.error, $outline ? "transparent" : shade(theme.colors.error, 10), shade(theme.colors.error, 10), $outline && `color: ${shade(theme.colors.error, 10)}`, tint(theme.colors.error, 10), tint(theme.colors.error, 10)), formElementHeightStyles($size), $size === "big" ? `font-size: ${theme.fontSizes.buttonBig.lg};
|
|
66
71
|
line-height: ${theme.lineHeights.buttonBig.lg};
|
|
67
72
|
padding: 18px 30px;
|
|
68
73
|
` : $size === "small" ? `font-size: ${theme.fontSizes.buttonSmall.lg};
|
|
@@ -77,7 +82,7 @@ var buttonStyles = (theme, $variant, $size, $outline, $fullWidth, $error, disabl
|
|
|
77
82
|
`, $fullWidth && `width: 100%;`);
|
|
78
83
|
var StyledButton = styled.button.withConfig({
|
|
79
84
|
displayName: "button__StyledButton",
|
|
80
|
-
componentId: "sc-
|
|
85
|
+
componentId: "sc-7cf4a3b1-0"
|
|
81
86
|
})([``, ``], ({ theme, $variant, $error, $size, $outline, $fullWidth, disabled }) => buttonStyles(theme, $variant, $size, $outline, $fullWidth, $error, disabled));
|
|
82
87
|
function LocalButton({ $variant = "primary", ...props }, ref) {
|
|
83
88
|
return /*#__PURE__*/ jsxs(StyledButton, {
|
package/dist/dropzone.js
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { mq } from "./utils/theme.js";
|
|
4
|
-
import { resetButton } from "./utils/mixins.js";
|
|
4
|
+
import { alpha, resetButton } from "./utils/mixins.js";
|
|
5
5
|
import { Icon } from "./icon.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
8
8
|
import styled, { css } from "styled-components";
|
|
9
|
-
import { rgba } from "polished";
|
|
10
9
|
//#region src/lib/dropzone.tsx
|
|
11
10
|
/** Matches a file against an `accept` string (".pdf,image/*,text/plain"),
|
|
12
11
|
mirroring the native file-picker filter for dropped files. */ var matchesAccept = (file, accept) => {
|
|
@@ -155,11 +154,11 @@ function LocalDropzone({ $prompt = "Drag & drop files here", $browse, $hint, $ic
|
|
|
155
154
|
var Dropzone = /*#__PURE__*/ forwardRef(LocalDropzone);
|
|
156
155
|
var StyledDropzoneWrapper = styled.div.withConfig({
|
|
157
156
|
displayName: "dropzone__StyledDropzoneWrapper",
|
|
158
|
-
componentId: "sc-
|
|
157
|
+
componentId: "sc-a5a0875f-0"
|
|
159
158
|
})([`display:flex;flex-direction:column;gap:12px;width:100%;`]);
|
|
160
159
|
var StyledDropzone = styled.button.withConfig({
|
|
161
160
|
displayName: "dropzone__StyledDropzone",
|
|
162
|
-
componentId: "sc-
|
|
161
|
+
componentId: "sc-a5a0875f-1"
|
|
163
162
|
})([
|
|
164
163
|
``,
|
|
165
164
|
`;font-family:inherit;display:flex;flex-direction:`,
|
|
@@ -179,11 +178,12 @@ var StyledDropzone = styled.button.withConfig({
|
|
|
179
178
|
], resetButton, ({ $inline }) => $inline ? "row" : "column", ({ $inline }) => $inline ? "10px" : "8px", ({ $inline }) => $inline ? "10px 14px" : "24px 20px", ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.colors.grayLight, ({ theme, $inline }) => $inline ? "transparent" : theme.colors.light, ({ theme }) => theme.colors.grayDark, ({ $inline }) => $inline ? "left" : "center", ({ theme, $dragOver }) => $dragOver && css([
|
|
180
179
|
`border-color:`,
|
|
181
180
|
`;background:`,
|
|
182
|
-
|
|
183
|
-
|
|
181
|
+
`;:root.dark &{background:`,
|
|
182
|
+
`;}`
|
|
183
|
+
], theme.colors.primary, alpha(theme.colors.primary, theme.isDark ? 12 : 5), alpha(theme.colors.primary, 12)), ({ theme }) => theme.colors.primary, ({ theme }) => alpha(theme.colors.primary, theme.isDark ? 10 : 4), ({ theme }) => theme.colors.primary, ({ theme }) => theme.colors.primaryLight);
|
|
184
184
|
var StyledDropIcon = styled.span.withConfig({
|
|
185
185
|
displayName: "dropzone__StyledDropIcon",
|
|
186
|
-
componentId: "sc-
|
|
186
|
+
componentId: "sc-a5a0875f-2"
|
|
187
187
|
})([
|
|
188
188
|
`display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:`,
|
|
189
189
|
`;height:`,
|
|
@@ -197,7 +197,7 @@ var StyledDropIcon = styled.span.withConfig({
|
|
|
197
197
|
], ({ $inline }) => $inline ? "32px" : "44px", ({ $inline }) => $inline ? "32px" : "44px", ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.primary, ({ $inline }) => $inline ? "18px" : "22px", ({ $inline }) => $inline ? "18px" : "22px");
|
|
198
198
|
var StyledDropPrompt = styled.span.withConfig({
|
|
199
199
|
displayName: "dropzone__StyledDropPrompt",
|
|
200
|
-
componentId: "sc-
|
|
200
|
+
componentId: "sc-a5a0875f-3"
|
|
201
201
|
})([
|
|
202
202
|
`display:flex;flex-direction:`,
|
|
203
203
|
`;flex-wrap:wrap;align-items:baseline;gap:`,
|
|
@@ -209,7 +209,7 @@ var StyledDropPrompt = styled.span.withConfig({
|
|
|
209
209
|
], ({ $inline }) => $inline ? "row" : "column", ({ $inline }) => $inline ? "0 6px" : "2px", ({ theme }) => theme.fontSizes.text.xs, ({ theme }) => theme.lineHeights.text.xs, ({ theme }) => theme.colors.dark, ({ theme }) => theme.colors.grayDark);
|
|
210
210
|
var StyledDropHint = styled.span.withConfig({
|
|
211
211
|
displayName: "dropzone__StyledDropHint",
|
|
212
|
-
componentId: "sc-
|
|
212
|
+
componentId: "sc-a5a0875f-4"
|
|
213
213
|
})([
|
|
214
214
|
`font-family:inherit;font-size:`,
|
|
215
215
|
`;line-height:`,
|
|
@@ -219,11 +219,11 @@ var StyledDropHint = styled.span.withConfig({
|
|
|
219
219
|
], ({ theme }) => theme.fontSizes.small.xs, ({ theme }) => theme.lineHeights.small.xs, ({ theme }) => theme.colors.gray, ({ $inline }) => $inline && css([`margin-left:auto;`]));
|
|
220
220
|
var StyledThumbs = styled.div.withConfig({
|
|
221
221
|
displayName: "dropzone__StyledThumbs",
|
|
222
|
-
componentId: "sc-
|
|
222
|
+
componentId: "sc-a5a0875f-5"
|
|
223
223
|
})([`display:grid;grid-template-columns:repeat(auto-fill,72px);gap:10px;`, `{grid-template-columns:repeat(auto-fill,84px);}`], mq("sm"));
|
|
224
224
|
var StyledThumb = styled.div.withConfig({
|
|
225
225
|
displayName: "dropzone__StyledThumb",
|
|
226
|
-
componentId: "sc-
|
|
226
|
+
componentId: "sc-a5a0875f-6"
|
|
227
227
|
})([
|
|
228
228
|
`position:relative;width:72px;height:72px;border-radius:`,
|
|
229
229
|
`;overflow:hidden;border:solid 1px `,
|
|
@@ -233,7 +233,7 @@ var StyledThumb = styled.div.withConfig({
|
|
|
233
233
|
], ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.light, mq("sm"));
|
|
234
234
|
var StyledThumbFile = styled.span.withConfig({
|
|
235
235
|
displayName: "dropzone__StyledThumbFile",
|
|
236
|
-
componentId: "sc-
|
|
236
|
+
componentId: "sc-a5a0875f-7"
|
|
237
237
|
})([
|
|
238
238
|
`display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;width:100%;height:100%;padding:6px;color:`,
|
|
239
239
|
`;& svg{width:20px;height:20px;color:`,
|
|
@@ -241,12 +241,12 @@ var StyledThumbFile = styled.span.withConfig({
|
|
|
241
241
|
], ({ theme }) => theme.colors.grayDark, ({ theme }) => theme.colors.primary);
|
|
242
242
|
var StyledThumbRemove = styled.button.withConfig({
|
|
243
243
|
displayName: "dropzone__StyledThumbRemove",
|
|
244
|
-
componentId: "sc-
|
|
244
|
+
componentId: "sc-a5a0875f-8"
|
|
245
245
|
})([
|
|
246
246
|
``,
|
|
247
247
|
`;position:absolute;top:4px;right:4px;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;border-radius:50%;color:#ffffff;background:`,
|
|
248
248
|
`;transition:background 0.3s ease;& svg{width:14px;height:14px;}&:hover:not(:disabled){background:`,
|
|
249
249
|
`;}&:disabled{cursor:not-allowed;opacity:0.6;}`
|
|
250
|
-
], resetButton, ({ theme }) =>
|
|
250
|
+
], resetButton, ({ theme }) => alpha(theme.colors.dark, 60), ({ theme }) => theme.colors.error);
|
|
251
251
|
//#endregion
|
|
252
252
|
export { Dropzone, matchesAccept };
|
package/dist/icon-button.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { resetButton } from "./utils/mixins.js";
|
|
3
|
+
import { alpha, resetButton, shade, tint } from "./utils/mixins.js";
|
|
4
4
|
import { jsx } from "react/jsx-runtime";
|
|
5
5
|
import { forwardRef } from "react";
|
|
6
6
|
import styled, { css } from "styled-components";
|
|
7
|
-
import { darken, lighten, rgba } from "polished";
|
|
8
7
|
//#region src/lib/icon-button.tsx
|
|
9
8
|
var iconButtonSizes = {
|
|
10
9
|
small: {
|
|
@@ -36,14 +35,14 @@ var iconButtonStyles = (theme, $size, $error, disabled, $active) => {
|
|
|
36
35
|
` `,
|
|
37
36
|
` `,
|
|
38
37
|
``
|
|
39
|
-
], resetButton, box, box, theme.colors.light, theme.colors.grayLight, $error ? theme.colors.error : theme.colors.grayDark, $error ?
|
|
38
|
+
], resetButton, box, box, theme.colors.light, theme.colors.grayLight, $error ? theme.colors.error : theme.colors.grayDark, $error ? tint(theme.colors.error, 10) : theme.colors.primaryLight, icon, icon, !disabled && ($error ? css([
|
|
40
39
|
`border-color:`,
|
|
41
40
|
`;&:hover{border-color:`,
|
|
42
41
|
`;color:`,
|
|
43
42
|
`;}&:focus{box-shadow:0 0 0 4px `,
|
|
44
43
|
`;}&:active{box-shadow:0 0 0 2px `,
|
|
45
44
|
`;}`
|
|
46
|
-
], theme.colors.error,
|
|
45
|
+
], theme.colors.error, shade(theme.colors.error, 10), shade(theme.colors.error, 10), tint(theme.colors.error, 10), tint(theme.colors.error, 10)) : css([
|
|
47
46
|
`&:hover{border-color:`,
|
|
48
47
|
`;color:`,
|
|
49
48
|
`;}&:focus{box-shadow:0 0 0 4px `,
|
|
@@ -54,8 +53,9 @@ var iconButtonStyles = (theme, $size, $error, disabled, $active) => {
|
|
|
54
53
|
`border-color:`,
|
|
55
54
|
`;background:`,
|
|
56
55
|
`;color:`,
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
`;:root.dark &{background:`,
|
|
57
|
+
`;}`
|
|
58
|
+
], theme.colors.primary, alpha(theme.colors.primary, theme.isDark ? 18 : 10), theme.colors.primary, alpha(theme.colors.primary, 18)), disabled && css([
|
|
59
59
|
`cursor:not-allowed;background:`,
|
|
60
60
|
`;border-color:`,
|
|
61
61
|
`;color:`,
|
|
@@ -64,7 +64,7 @@ var iconButtonStyles = (theme, $size, $error, disabled, $active) => {
|
|
|
64
64
|
};
|
|
65
65
|
var StyledIconButton = styled.button.withConfig({
|
|
66
66
|
displayName: "icon-button__StyledIconButton",
|
|
67
|
-
componentId: "sc-
|
|
67
|
+
componentId: "sc-3df98d32-0"
|
|
68
68
|
})([``, ``], ({ theme, $size, $error, disabled, $active }) => iconButtonStyles(theme, $size, $error, disabled, $active));
|
|
69
69
|
function LocalIconButton({ ...props }, ref) {
|
|
70
70
|
return /*#__PURE__*/ jsx(StyledIconButton, {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlobalStyles } from "./utils/global.js";
|
|
2
2
|
import { breakpoints, colors, colorsDark, fontSizes, fonts, lineHeights, mq, shadows, shadowsDark, spacing, theme, themeDark } from "./utils/theme.js";
|
|
3
|
-
import { errorInteractiveStyles, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, resetButton, resetInput, statusBorderStyles } from "./utils/mixins.js";
|
|
3
|
+
import { alpha, errorInteractiveStyles, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, resetButton, resetInput, shade, statusBorderStyles, tint } from "./utils/mixins.js";
|
|
4
4
|
import { createTypographyStyle, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText } from "./utils/typography.js";
|
|
5
5
|
import { useOnClickOutside } from "./utils/use-on-click-outside.js";
|
|
6
6
|
import { CherryThemeProvider, ThemeContext } from "./styled-components/theme-provider.js";
|
|
@@ -30,4 +30,4 @@ import { Textarea } from "./textarea.js";
|
|
|
30
30
|
import { ThemeToggle } from "./theme-toggle.js";
|
|
31
31
|
import { StyledNotificationItem, StyledNotifications, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, useToastNotifications } from "./toast.js";
|
|
32
32
|
import { Toggle } from "./toggle.js";
|
|
33
|
-
export { Accordion, AvatarDropzone, Box, Button, CherryThemeProvider, ClientThemeProvider, Col, Container, Dropzone, Flex, GlobalStyles, Grid, Icon, IconButton, Input, MaxWidth, Modal, Password, Range, Select, Space, StyledComponentsRegistry, StyledIconWrapper, StyledInputWrapper, StyledLabel, StyledNotificationItem, StyledNotifications, TabContent, Tabs, Textarea, ThemeContext, ThemeToggle, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, Toggle, breakpoints, buttonStyles, colors, colorsDark, createThemeInitScript, createTypographyStyle, errorInteractiveStyles, fontSizes, fonts, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, iconButtonStyles, interactiveStyles, lineHeights, matchesAccept, mq, resetButton, resetInput, resolveTheme, shadows, shadowsDark, spacing, statusBorderStyles, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText, theme, themeDark, themeInitScript, useOnClickOutside, useToastNotifications };
|
|
33
|
+
export { Accordion, AvatarDropzone, Box, Button, CherryThemeProvider, ClientThemeProvider, Col, Container, Dropzone, Flex, GlobalStyles, Grid, Icon, IconButton, Input, MaxWidth, Modal, Password, Range, Select, Space, StyledComponentsRegistry, StyledIconWrapper, StyledInputWrapper, StyledLabel, StyledNotificationItem, StyledNotifications, TabContent, Tabs, Textarea, ThemeContext, ThemeToggle, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, Toggle, alpha, breakpoints, buttonStyles, colors, colorsDark, createThemeInitScript, createTypographyStyle, errorInteractiveStyles, fontSizes, fonts, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, iconButtonStyles, interactiveStyles, lineHeights, matchesAccept, mq, resetButton, resetInput, resolveTheme, shade, shadows, shadowsDark, spacing, statusBorderStyles, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText, theme, themeDark, themeInitScript, tint, useOnClickOutside, useToastNotifications };
|
package/dist/input.js
CHANGED
|
@@ -8,7 +8,7 @@ import styled, { css } from "styled-components";
|
|
|
8
8
|
//#region src/lib/input.tsx
|
|
9
9
|
var StyledInputWrapper = styled.span.withConfig({
|
|
10
10
|
displayName: "input__StyledInputWrapper",
|
|
11
|
-
componentId: "sc-
|
|
11
|
+
componentId: "sc-5352dea9-0"
|
|
12
12
|
})([
|
|
13
13
|
`display:inline-flex;flex-wrap:`,
|
|
14
14
|
`;align-items:center;`,
|
|
@@ -20,7 +20,7 @@ var StyledInputWrapper = styled.span.withConfig({
|
|
|
20
20
|
], ({ type }) => type === "checkbox" || type === "radio" ? "nowrap" : "wrap", ({ $label }) => $label && css([`gap:5px;align-items:flex-start;align-content:flex-start;`]), ({ $size }) => $size === "small" ? "14px" : "17px", ({ $size }) => $size === "small" ? "18px" : "24px", ({ $size }) => $size === "small" ? "18px" : "24px", ({ $fullWidth }) => fullWidthStyles($fullWidth));
|
|
21
21
|
var StyledLabel = styled.label.withConfig({
|
|
22
22
|
displayName: "input__StyledLabel",
|
|
23
|
-
componentId: "sc-
|
|
23
|
+
componentId: "sc-5352dea9-1"
|
|
24
24
|
})([
|
|
25
25
|
`display:inline-block;color:`,
|
|
26
26
|
`;font-size:`,
|
|
@@ -29,7 +29,7 @@ var StyledLabel = styled.label.withConfig({
|
|
|
29
29
|
], ({ theme }) => theme.colors.grayDark, ({ theme }) => theme.fontSizes.small.lg, ({ theme }) => theme.lineHeights.small.lg);
|
|
30
30
|
var StyledInput = styled.input.withConfig({
|
|
31
31
|
displayName: "input__StyledInput",
|
|
32
|
-
componentId: "sc-
|
|
32
|
+
componentId: "sc-5352dea9-2"
|
|
33
33
|
})([
|
|
34
34
|
``,
|
|
35
35
|
`;`,
|
|
@@ -85,7 +85,7 @@ var StyledInput = styled.input.withConfig({
|
|
|
85
85
|
`, ({ $fullWidth }) => fullWidthStyles($fullWidth));
|
|
86
86
|
var StyledIconWrapper = styled.span.withConfig({
|
|
87
87
|
displayName: "input__StyledIconWrapper",
|
|
88
|
-
componentId: "sc-
|
|
88
|
+
componentId: "sc-5352dea9-3"
|
|
89
89
|
})([
|
|
90
90
|
`display:inline-flex;position:relative;line-height:0;min-width:fit-content;& em{display:block;border-radius:50%;background:`,
|
|
91
91
|
`;}& svg,& em{object-fit:contain;position:absolute;top:50%;left:50%;color:`,
|
|
@@ -93,7 +93,7 @@ var StyledIconWrapper = styled.span.withConfig({
|
|
|
93
93
|
], ({ theme }) => theme.colors.primary, ({ theme }) => theme.colors.primary);
|
|
94
94
|
var StyledRadioCheckboxInput = styled.input.withConfig({
|
|
95
95
|
displayName: "input__StyledRadioCheckboxInput",
|
|
96
|
-
componentId: "sc-
|
|
96
|
+
componentId: "sc-5352dea9-4"
|
|
97
97
|
})([
|
|
98
98
|
``,
|
|
99
99
|
`;display:inline-block;background:`,
|
|
@@ -178,7 +178,7 @@ var StyledRadioCheckboxInput = styled.input.withConfig({
|
|
|
178
178
|
});
|
|
179
179
|
var StyledCustomIconWrapper = styled.span.withConfig({
|
|
180
180
|
displayName: "input__StyledCustomIconWrapper",
|
|
181
|
-
componentId: "sc-
|
|
181
|
+
componentId: "sc-5352dea9-5"
|
|
182
182
|
})([
|
|
183
183
|
`position:relative;`,
|
|
184
184
|
`;& svg{position:absolute;top:50%;transform:translateY(-50%);pointer-events:none;width:24px;height:24px;object-fit:contain;color:`,
|
package/dist/modal.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { mq } from "./utils/theme.js";
|
|
4
|
+
import { alpha } from "./utils/mixins.js";
|
|
4
5
|
import { styledH5, styledText } from "./utils/typography.js";
|
|
5
6
|
import { useOnClickOutside } from "./utils/use-on-click-outside.js";
|
|
6
7
|
import { Icon } from "./icon.js";
|
|
@@ -8,7 +9,6 @@ import { IconButton } from "./icon-button.js";
|
|
|
8
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
10
11
|
import styled, { css, keyframes } from "styled-components";
|
|
11
|
-
import { rgba } from "polished";
|
|
12
12
|
import { createPortal } from "react-dom";
|
|
13
13
|
//#region src/lib/modal.tsx
|
|
14
14
|
var emptySubscribe = () => () => {};
|
|
@@ -21,7 +21,7 @@ var innerRiseIn = keyframes([`from{transform:translateY(40px);}to{transform:tran
|
|
|
21
21
|
var innerSinkOut = keyframes([`from{transform:translateY(0);}to{transform:translateY(40px);}`]);
|
|
22
22
|
var StyledModal = styled.div.withConfig({
|
|
23
23
|
displayName: "modal__StyledModal",
|
|
24
|
-
componentId: "sc-
|
|
24
|
+
componentId: "sc-1bbfce8-0"
|
|
25
25
|
})([
|
|
26
26
|
`position:fixed;top:0;left:0;width:100%;height:100%;background:`,
|
|
27
27
|
`;display:flex;justify-content:center;align-items:center;z-index:1010;animation:`,
|
|
@@ -32,14 +32,14 @@ var StyledModal = styled.div.withConfig({
|
|
|
32
32
|
` 0.3s ease both;`,
|
|
33
33
|
`{max-width:500px;`,
|
|
34
34
|
`}}`
|
|
35
|
-
], ({ theme }) =>
|
|
35
|
+
], ({ theme }) => alpha(theme.colors.primary, 50), ({ $isClosing }) => $isClosing ? overlayFadeOut : overlayFadeIn, ({ $isClosing }) => $isClosing && css([`pointer-events:none;`]), ({ theme }) => theme.colors.light, ({ theme }) => theme.spacing.radius.lg, ({ $isClosing }) => $isClosing ? innerSinkOut : innerRiseIn, mq("lg"), ({ $width }) => $width && css([`max-width:`, `px;`], $width));
|
|
36
36
|
var StyledModalClose = styled(IconButton).withConfig({
|
|
37
37
|
displayName: "modal__StyledModalClose",
|
|
38
|
-
componentId: "sc-
|
|
38
|
+
componentId: "sc-1bbfce8-1"
|
|
39
39
|
})([`position:absolute;top:20px;right:20px;z-index:10;`]);
|
|
40
40
|
var StyledModalTitle = styled.h2.withConfig({
|
|
41
41
|
displayName: "modal__StyledModalTitle",
|
|
42
|
-
componentId: "sc-
|
|
42
|
+
componentId: "sc-1bbfce8-2"
|
|
43
43
|
})([
|
|
44
44
|
`--divider-color:`,
|
|
45
45
|
`;margin:0 0 15px 0;padding:0 0 15px 0;color:`,
|
|
@@ -48,7 +48,7 @@ var StyledModalTitle = styled.h2.withConfig({
|
|
|
48
48
|
], ({ theme }) => theme.colors.grayLight, ({ theme }) => theme.colors.dark, ({ theme }) => styledH5(theme));
|
|
49
49
|
var StyledModalContent = styled.div.withConfig({
|
|
50
50
|
displayName: "modal__StyledModalContent",
|
|
51
|
-
componentId: "sc-
|
|
51
|
+
componentId: "sc-1bbfce8-3"
|
|
52
52
|
})([
|
|
53
53
|
`max-height:calc(100svh - 200px);overflow-y:auto;padding:5px;margin:-5px;--divider-color:`,
|
|
54
54
|
`;`,
|
|
@@ -22,6 +22,11 @@ function removeThemeInitStyle() {
|
|
|
22
22
|
const el = document.getElementById("__theme-init");
|
|
23
23
|
if (el) el.remove();
|
|
24
24
|
}
|
|
25
|
+
function resolveColor(value) {
|
|
26
|
+
const match = /^var\(\s*(--[^,)\s]+)\s*(?:,([^)]*))?\)$/.exec(value.trim());
|
|
27
|
+
if (!match) return value;
|
|
28
|
+
return getComputedStyle(document.documentElement).getPropertyValue(match[1]).trim() || match[2]?.trim() || value;
|
|
29
|
+
}
|
|
25
30
|
/**
|
|
26
31
|
* SSR-aware theme provider. Renders with the server-resolved theme on the
|
|
27
32
|
* first paint (no dark-mode flash), reconciles it against the `theme` cookie
|
|
@@ -32,9 +37,11 @@ function removeThemeInitStyle() {
|
|
|
32
37
|
*/ function ClientThemeProvider({ children, theme, themeDark, $initial = "light", $themeColor = "light", $globalStyles = true }) {
|
|
33
38
|
const initialTheme = $initial === "dark" && themeDark ? themeDark : theme;
|
|
34
39
|
const [overrideTheme, setOverrideTheme] = useState(null);
|
|
40
|
+
const [reconciled, setReconciled] = useState(false);
|
|
35
41
|
const effectiveTheme = useMemo(() => overrideTheme ?? initialTheme, [overrideTheme, initialTheme]);
|
|
36
42
|
useEffect(() => {
|
|
37
43
|
if (!themeDark) {
|
|
44
|
+
setReconciled(true);
|
|
38
45
|
removeThemeInitStyle();
|
|
39
46
|
return;
|
|
40
47
|
}
|
|
@@ -54,20 +61,23 @@ function removeThemeInitStyle() {
|
|
|
54
61
|
const wantDark = cookieValue === "dark";
|
|
55
62
|
if (initialTheme.isDark !== wantDark) {
|
|
56
63
|
setOverrideTheme(wantDark ? themeDark : theme);
|
|
64
|
+
setReconciled(true);
|
|
57
65
|
return;
|
|
58
66
|
}
|
|
59
67
|
} catch {}
|
|
68
|
+
setReconciled(true);
|
|
60
69
|
removeThemeInitStyle();
|
|
61
70
|
}, []);
|
|
62
71
|
useEffect(() => {
|
|
63
72
|
if (overrideTheme) removeThemeInitStyle();
|
|
64
73
|
}, [overrideTheme]);
|
|
65
74
|
useEffect(() => {
|
|
75
|
+
if (!reconciled) return;
|
|
66
76
|
document.documentElement.classList.toggle("dark", effectiveTheme.isDark);
|
|
67
|
-
}, [effectiveTheme.isDark]);
|
|
77
|
+
}, [effectiveTheme.isDark, reconciled]);
|
|
68
78
|
useEffect(() => {
|
|
69
79
|
if (!$themeColor) return;
|
|
70
|
-
const background = effectiveTheme.colors[$themeColor];
|
|
80
|
+
const background = resolveColor(effectiveTheme.colors[$themeColor]);
|
|
71
81
|
let meta = document.querySelector("meta[name=\"theme-color\"]");
|
|
72
82
|
if (!meta) {
|
|
73
83
|
meta = document.createElement("meta");
|
package/dist/tabs.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { resetButton } from "./utils/mixins.js";
|
|
3
|
+
import { alpha, resetButton } from "./utils/mixins.js";
|
|
4
4
|
import { styledText } from "./utils/typography.js";
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import React, { useId, useRef, useState } from "react";
|
|
7
7
|
import styled, { css } from "styled-components";
|
|
8
|
-
import { rgba } from "polished";
|
|
9
8
|
//#region src/lib/tabs.tsx
|
|
10
9
|
var StyledTabs = styled.div.withConfig({
|
|
11
10
|
displayName: "tabs__StyledTabs",
|
|
12
|
-
componentId: "sc-
|
|
11
|
+
componentId: "sc-60ef8245-0"
|
|
13
12
|
})([`width:100%;`]);
|
|
14
13
|
var StyledTabsList = styled.div.withConfig({
|
|
15
14
|
displayName: "tabs__StyledTabsList",
|
|
16
|
-
componentId: "sc-
|
|
15
|
+
componentId: "sc-60ef8245-1"
|
|
17
16
|
})([
|
|
18
17
|
`display:flex;overflow-x:auto;border-radius:`,
|
|
19
18
|
` `,
|
|
@@ -23,7 +22,7 @@ var StyledTabsList = styled.div.withConfig({
|
|
|
23
22
|
], ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.spacing.radius.lg, ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayLight);
|
|
24
23
|
var StyledTabButton = styled.button.withConfig({
|
|
25
24
|
displayName: "tabs__StyledTabButton",
|
|
26
|
-
componentId: "sc-
|
|
25
|
+
componentId: "sc-60ef8245-2"
|
|
27
26
|
})([
|
|
28
27
|
``,
|
|
29
28
|
`;flex:1;min-width:fit-content;padding:12px 20px;`,
|
|
@@ -41,10 +40,10 @@ var StyledTabButton = styled.button.withConfig({
|
|
|
41
40
|
`&:hover{color:`,
|
|
42
41
|
`;background:`,
|
|
43
42
|
`;}`
|
|
44
|
-
], theme.colors.primary,
|
|
43
|
+
], theme.colors.primary, alpha(theme.colors.primaryLight, 10)));
|
|
45
44
|
var StyledTabPanel = styled.div.withConfig({
|
|
46
45
|
displayName: "tabs__StyledTabPanel",
|
|
47
|
-
componentId: "sc-
|
|
46
|
+
componentId: "sc-60ef8245-3"
|
|
48
47
|
})([
|
|
49
48
|
``,
|
|
50
49
|
`;color:`,
|
package/dist/theme-toggle.js
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
|
-
import { interactiveStyles, resetButton } from "./utils/mixins.js";
|
|
3
|
+
import { alpha, interactiveStyles, resetButton } from "./utils/mixins.js";
|
|
4
4
|
import { ThemeContext } from "./styled-components/theme-provider.js";
|
|
5
5
|
import { Icon } from "./icon.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { forwardRef, useContext, useEffect } from "react";
|
|
8
8
|
import styled, { css } from "styled-components";
|
|
9
|
-
import { rgba } from "polished";
|
|
10
9
|
//#region src/lib/theme-toggle.tsx
|
|
11
10
|
var StyledThemeToggle = styled.button.withConfig({
|
|
12
11
|
displayName: "theme-toggle__StyledThemeToggle",
|
|
13
|
-
componentId: "sc-
|
|
12
|
+
componentId: "sc-f8700a2a-0"
|
|
14
13
|
})([
|
|
15
14
|
``,
|
|
16
15
|
` `,
|
|
@@ -18,11 +17,12 @@ var StyledThemeToggle = styled.button.withConfig({
|
|
|
18
17
|
`;border-color:`,
|
|
19
18
|
`;&::after{content:"";position:absolute;top:2px;left:2px;width:24px;height:24px;border-radius:50%;background:`,
|
|
20
19
|
`;transition:all 0.3s ease;z-index:1;`,
|
|
21
|
-
`}`,
|
|
20
|
+
`}:root.dark &::after{transform:translateX(26px);}`,
|
|
22
21
|
` & svg{width:16px;height:16px;object-fit:contain;transition:all 0.3s ease;position:relative;z-index:2;}& svg[stroke]{stroke:`,
|
|
23
22
|
`;}&:hover svg[stroke]{stroke:`,
|
|
23
|
+
`;}:root.dark &:hover svg[stroke]{stroke:`,
|
|
24
24
|
`;}`
|
|
25
|
-
], resetButton, interactiveStyles, ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayLight, ({ theme }) =>
|
|
25
|
+
], resetButton, interactiveStyles, ({ theme }) => theme.colors.light, ({ theme }) => theme.colors.grayLight, ({ theme }) => alpha(theme.colors.primaryLight, 20), ({ theme }) => theme.isDark && css([`transform:translateX(26px);`]), ({ $hidden }) => $hidden && css([`display:none;`]), ({ theme }) => theme.colors.primary, ({ theme }) => theme.isDark ? theme.colors.primaryLight : theme.colors.primaryDark, ({ theme }) => theme.colors.primaryLight);
|
|
26
26
|
function LocalThemeToggle({ onClick, $shortcut = false, ...props }, ref) {
|
|
27
27
|
const { toggleTheme } = useContext(ThemeContext);
|
|
28
28
|
useEffect(() => {
|
package/dist/utils/mixins.d.ts
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import { Breakpoints, Theme } from './theme';
|
|
2
|
+
/**
|
|
3
|
+
* Fades a color toward transparent. Native CSS rather than a JS color library
|
|
4
|
+
* so the input can be any valid CSS color value, including a `var(--token)`
|
|
5
|
+
* reference that only the browser can resolve.
|
|
6
|
+
*/
|
|
7
|
+
export declare const alpha: (color: string, percent: number) => string;
|
|
8
|
+
/** Darkens a color by mixing it toward black. See `alpha` for why it is CSS. */
|
|
9
|
+
export declare const shade: (color: string, percent: number) => string;
|
|
10
|
+
/** Lightens a color by mixing it toward white. See `alpha` for why it is CSS. */
|
|
11
|
+
export declare const tint: (color: string, percent: number) => string;
|
|
2
12
|
/**
|
|
3
13
|
* Hover/focus/active affordance for interactive surfaces (cards, tiles,
|
|
4
14
|
* links-as-blocks): a transparent 1px border that picks up the primary color
|
package/dist/utils/mixins.js
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
import { mq } from "./theme.js";
|
|
4
4
|
import { css } from "styled-components";
|
|
5
|
-
import { rgba } from "polished";
|
|
6
5
|
//#region src/lib/utils/mixins.tsx
|
|
7
6
|
/**
|
|
7
|
+
* Fades a color toward transparent. Native CSS rather than a JS color library
|
|
8
|
+
* so the input can be any valid CSS color value, including a `var(--token)`
|
|
9
|
+
* reference that only the browser can resolve.
|
|
10
|
+
*/ var alpha = (color, percent) => `color-mix(in srgb, ${color} ${percent}%, transparent)`;
|
|
11
|
+
/** Darkens a color by mixing it toward black. See `alpha` for why it is CSS. */ var shade = (color, percent) => `color-mix(in srgb, ${color} ${100 - percent}%, black)`;
|
|
12
|
+
/** Lightens a color by mixing it toward white. See `alpha` for why it is CSS. */ var tint = (color, percent) => `color-mix(in srgb, ${color} ${100 - percent}%, white)`;
|
|
13
|
+
/**
|
|
8
14
|
* Hover/focus/active affordance for interactive surfaces (cards, tiles,
|
|
9
15
|
* links-as-blocks): a transparent 1px border that picks up the primary color
|
|
10
16
|
* on hover, with a soft focus ring. Pair with resetButton for clickable
|
|
@@ -28,7 +34,7 @@ import { rgba } from "polished";
|
|
|
28
34
|
`;box-shadow:0 0 0 4px `,
|
|
29
35
|
`;}&:active{box-shadow:0 0 0 2px `,
|
|
30
36
|
`;}`
|
|
31
|
-
], ({ theme }) => theme.colors.error, ({ theme }) => theme.colors.error, ({ theme }) => theme.colors.error, ({ theme }) =>
|
|
37
|
+
], ({ theme }) => theme.colors.error, ({ theme }) => theme.colors.error, ({ theme }) => theme.colors.error, ({ theme }) => alpha(theme.colors.error, 30), ({ theme }) => alpha(theme.colors.error, 30));
|
|
32
38
|
var resetButton = css([`box-sizing:border-box;appearance:none;border:none;background:none;padding:0;margin:0;cursor:pointer;outline:none;`]);
|
|
33
39
|
var resetInput = css([`cursor:text;min-width:100px;`]);
|
|
34
40
|
var fullWidthStyles = (fullWidth) => {
|
|
@@ -84,4 +90,4 @@ var generateDirectionStyles = (size, direction) => css([
|
|
|
84
90
|
`;}`
|
|
85
91
|
], mq(size), direction && `${direction}`);
|
|
86
92
|
//#endregion
|
|
87
|
-
export { errorInteractiveStyles, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, resetButton, resetInput, statusBorderStyles };
|
|
93
|
+
export { alpha, errorInteractiveStyles, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, resetButton, resetInput, shade, statusBorderStyles, tint };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cherry-styled-components",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "Cherry is a design system for the modern web. Designed in Figma, built in React using Typescript.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -43,8 +43,7 @@
|
|
|
43
43
|
"screenshots": "node scripts/screenshot-previews.cjs"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"lucide-react": "^1.
|
|
47
|
-
"polished": "^4.3.1"
|
|
46
|
+
"lucide-react": "^1.28.0"
|
|
48
47
|
},
|
|
49
48
|
"peerDependencies": {
|
|
50
49
|
"react": "^18.0.0 || ^19.0.0",
|
|
@@ -53,23 +52,23 @@
|
|
|
53
52
|
},
|
|
54
53
|
"devDependencies": {
|
|
55
54
|
"@swc/plugin-styled-components": "^12.15.0",
|
|
56
|
-
"@types/node": "^26.1.
|
|
55
|
+
"@types/node": "^26.1.2",
|
|
57
56
|
"@types/react": "^19.2.17",
|
|
58
57
|
"@types/react-dom": "^19.2.3",
|
|
59
58
|
"@typescript/typescript6": "^6.0.2",
|
|
60
|
-
"@vitejs/plugin-react-swc": "^4.3.
|
|
59
|
+
"@vitejs/plugin-react-swc": "^4.3.3",
|
|
61
60
|
"eslint-plugin-react-hooks": "^7.1.1",
|
|
62
61
|
"eslint-plugin-react-refresh": "^0.5.3",
|
|
63
|
-
"next": "^16.2.
|
|
64
|
-
"playwright-core": "^1.
|
|
65
|
-
"prettier": "^3.9.
|
|
66
|
-
"react": "^19.2.
|
|
67
|
-
"react-dom": "^19.2.
|
|
62
|
+
"next": "^16.2.12",
|
|
63
|
+
"playwright-core": "^1.62.0",
|
|
64
|
+
"prettier": "^3.9.6",
|
|
65
|
+
"react": "^19.2.8",
|
|
66
|
+
"react-dom": "^19.2.8",
|
|
68
67
|
"rollup-plugin-preserve-directives": "^0.4.0",
|
|
69
68
|
"sharp": "^0.35.3",
|
|
70
|
-
"styled-components": "^6.4.
|
|
69
|
+
"styled-components": "^6.4.4",
|
|
71
70
|
"typescript": "^7.0.2",
|
|
72
|
-
"vite": "^8.1.
|
|
71
|
+
"vite": "^8.1.5",
|
|
73
72
|
"vite-plugin-dts": "^5.0.3"
|
|
74
73
|
}
|
|
75
74
|
}
|