cherry-styled-components 0.2.21 → 0.2.22

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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  "use client";
3
- import { darkFilledTextRule, filledTextColor } from "./utils/mixins.js";
3
+ import { darkFilledTextRule, filledTextColor, primaryFillColor } from "./utils/mixins.js";
4
4
  import { renderIcon } from "./icon.js";
5
5
  import { jsx } from "react/jsx-runtime";
6
6
  import { forwardRef } from "react";
@@ -22,7 +22,7 @@ var avatarSizes = {
22
22
  }
23
23
  };
24
24
  var avatarColors = {
25
- primary: (theme) => theme.colors.primary,
25
+ primary: (theme) => primaryFillColor(theme),
26
26
  secondary: (theme) => theme.colors.secondary,
27
27
  tertiary: (theme) => theme.colors.tertiary,
28
28
  gray: (theme) => theme.colors.grayDark
@@ -32,7 +32,7 @@ function toInitials(name) {
32
32
  }
33
33
  var StyledAvatar = styled.span.withConfig({
34
34
  displayName: "avatar__StyledAvatar",
35
- componentId: "sc-5bf22726-0"
35
+ componentId: "sc-616c0fb2-0"
36
36
  })([``, `;`], ({ theme, $size = "default", $color = "primary" }) => {
37
37
  const { box } = avatarSizes[$size];
38
38
  const fill = $color === "primary" ? "primary" : "other";
package/dist/button.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  "use client";
3
- import { darkFilledTextRule, filledTextColor, formElementHeightStyles, resetButton, shade, tint } from "./utils/mixins.js";
3
+ import { darkFilledTextRule, filledTextColor, formElementHeightStyles, primaryFillColor, primaryFillHoverColor, 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";
@@ -29,7 +29,7 @@ var buttonStyles = (theme, $variant, $size, $outline, $fullWidth, $error, disabl
29
29
  `;}&:focus{box-shadow:0 0 0 4px `,
30
30
  `;}&:active{box-shadow:0 0 0 2px `,
31
31
  `;}`
32
- ], $outline ? theme.colors.primary : filledTextColor(theme, "primary"), !$outline && darkFilledTextRule(theme, "primary"), $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([
32
+ ], $outline ? theme.colors.primary : filledTextColor(theme, "primary"), !$outline && darkFilledTextRule(theme, "primary"), $outline ? "transparent" : primaryFillColor(theme), $outline ? theme.colors.primary : primaryFillColor(theme), theme.colors.primary, $outline ? "transparent" : primaryFillHoverColor(theme), $outline ? theme.colors.primaryDark : primaryFillHoverColor(theme), $outline && `color: ${theme.colors.primaryDark}`, theme.colors.primaryLight, theme.colors.primaryLight), !disabled && $variant === "secondary" && css([
33
33
  `color:`,
34
34
  `;`,
35
35
  ` background:`,
@@ -80,7 +80,7 @@ var buttonStyles = (theme, $variant, $size, $outline, $fullWidth, $error, disabl
80
80
  `, $fullWidth && `width: 100%;`);
81
81
  var StyledButton = styled.button.withConfig({
82
82
  displayName: "button__StyledButton",
83
- componentId: "sc-75947fe4-0"
83
+ componentId: "sc-577b793f-0"
84
84
  })([``, ``], ({ theme, $variant, $error, $size, $outline, $fullWidth, disabled }) => buttonStyles(theme, $variant, $size, $outline, $fullWidth, $error, disabled));
85
85
  function LocalButton({ $variant = "primary", ...props }, ref) {
86
86
  return /*#__PURE__*/ jsxs(StyledButton, {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  "use client";
3
3
  import { mq } from "./utils/theme.js";
4
- import { darkFilledTextRule, filledTextColor } from "./utils/mixins.js";
4
+ import { darkFilledTextRule, filledTextColor, primaryFillColor } from "./utils/mixins.js";
5
5
  import { jsx, jsxs } from "react/jsx-runtime";
6
6
  import { forwardRef } from "react";
7
7
  import styled, { css } from "styled-components";
@@ -19,7 +19,7 @@ import styled, { css } from "styled-components";
19
19
  ], theme.fontSizes.text.xs, theme.lineHeights.text.xs, mq("lg"), theme.fontSizes.small.lg, theme.lineHeights.small.lg);
20
20
  var StyledChatMessage = styled.div.withConfig({
21
21
  displayName: "chat-message__StyledChatMessage",
22
- componentId: "sc-3bca3977-0"
22
+ componentId: "sc-7327cbb7-0"
23
23
  })([
24
24
  `display:flex;align-items:flex-end;gap:10px;width:100%;& .chat-message-avatar{flex-shrink:0;display:flex;align-items:center;height:calc( `,
25
25
  ` * `,
@@ -36,7 +36,7 @@ var StyledChatMessage = styled.div.withConfig({
36
36
  `;color:`,
37
37
  `;`,
38
38
  `;padding:9px 14px;border-radius:16px 16px 4px 16px;margin-left:auto;width:fit-content;max-width:min(560px,88%);font-weight:500;white-space:pre-wrap;overflow-wrap:anywhere;}`
39
- ], theme.colors.primary, filledTextColor(theme, "primary"), darkFilledTextRule(theme, "primary")) : css([`& .chat-message-content{color:`, `;width:100%;}& .chat-message-avatar{position:sticky;bottom:0;}`], theme.colors.dark));
39
+ ], primaryFillColor(theme), filledTextColor(theme, "primary"), darkFilledTextRule(theme, "primary")) : css([`& .chat-message-content{color:`, `;width:100%;}& .chat-message-avatar{position:sticky;bottom:0;}`], theme.colors.dark));
40
40
  function LocalChatMessage({ children, $role = "assistant", $avatar, ...props }, ref) {
41
41
  return /*#__PURE__*/ jsxs(StyledChatMessage, {
42
42
  $role,
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 { alpha, darkFilledTextRule, errorInteractiveStyles, filledTextColor, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, resetButton, resetInput, shade, statusBorderStyles, thinScrollbar, tint } from "./utils/mixins.js";
3
+ import { alpha, darkFilledTextRule, errorInteractiveStyles, filledTextColor, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, primaryFillColor, primaryFillHoverColor, resetButton, resetInput, shade, statusBorderStyles, thinScrollbar, 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 { useLockBodyScroll } from "./utils/use-lock-body-scroll.js";
6
6
  import { useBelowBreakpoint, useMediaQuery } from "./utils/use-media-query.js";
@@ -44,4 +44,4 @@ import { Textarea } from "./textarea.js";
44
44
  import { ThemeToggle } from "./theme-toggle.js";
45
45
  import { StyledNotificationItem, StyledNotifications, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, useToastNotifications } from "./toast.js";
46
46
  import { Toggle } from "./toggle.js";
47
- export { Accordion, Avatar, AvatarDropzone, Box, Button, Callout, ChatContext, ChatInput, ChatLauncher, ChatMessage, ChatMessageList, ChatPanel, ChatProvider, ChatSource, ChatSources, ChatTyping, CherryThemeProvider, ClientThemeProvider, Col, Container, Dropzone, Flex, GlobalStyles, Grid, Icon, IconButton, Input, MaxWidth, Modal, Password, Prose, Range, Select, Space, Spinner, StyledIconWrapper, StyledInputWrapper, StyledLabel, StyledNotificationItem, StyledNotifications, TabContent, Tabs, Textarea, ThemeContext, ThemeToggle, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, Toggle, alpha, breakpoints, buttonStyles, chatTextStyles, colors, colorsDark, createThemeInitScript, createTypographyStyle, darkFilledTextRule, errorInteractiveStyles, filledTextColor, fontSizes, fonts, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, iconButtonStyles, interactiveStyles, lineHeights, matchesAccept, mq, proseStyles, renderIcon, resetButton, resetInput, resolveShowcaseCommand, resolveTheme, shade, shadows, shadowsDark, showcaseCommands, spacing, statusBorderStyles, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText, theme, themeDark, themeInitScript, thinScrollbar, tint, useBelowBreakpoint, useChat, useLockBodyScroll, useMediaQuery, useModalLayer, useOnClickOutside, useToastNotifications };
47
+ export { Accordion, Avatar, AvatarDropzone, Box, Button, Callout, ChatContext, ChatInput, ChatLauncher, ChatMessage, ChatMessageList, ChatPanel, ChatProvider, ChatSource, ChatSources, ChatTyping, CherryThemeProvider, ClientThemeProvider, Col, Container, Dropzone, Flex, GlobalStyles, Grid, Icon, IconButton, Input, MaxWidth, Modal, Password, Prose, Range, Select, Space, Spinner, StyledIconWrapper, StyledInputWrapper, StyledLabel, StyledNotificationItem, StyledNotifications, TabContent, Tabs, Textarea, ThemeContext, ThemeToggle, ToastNotifications, ToastNotificationsContext, ToastNotificationsProvider, Toggle, alpha, breakpoints, buttonStyles, chatTextStyles, colors, colorsDark, createThemeInitScript, createTypographyStyle, darkFilledTextRule, errorInteractiveStyles, filledTextColor, fontSizes, fonts, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, iconButtonStyles, interactiveStyles, lineHeights, matchesAccept, mq, primaryFillColor, primaryFillHoverColor, proseStyles, renderIcon, resetButton, resetInput, resolveShowcaseCommand, resolveTheme, shade, shadows, shadowsDark, showcaseCommands, spacing, statusBorderStyles, styledBlockquote, styledButton, styledButtonBig, styledCode, styledH1, styledH2, styledH3, styledH4, styledH5, styledH6, styledHero1, styledHero2, styledHero3, styledInput, styledInputBig, styledSmall, styledStrong, styledText, theme, themeDark, themeInitScript, thinScrollbar, tint, useBelowBreakpoint, useChat, useLockBodyScroll, useMediaQuery, useModalLayer, useOnClickOutside, useToastNotifications };
@@ -10,6 +10,10 @@ export declare const shade: (color: string, percent: number) => string;
10
10
  /** Lightens a color by mixing it toward white. See `alpha` for why it is CSS. */
11
11
  export declare const tint: (color: string, percent: number) => string;
12
12
  /** Which fill a label sits on, so a theme's `onPrimary` can answer for its own. */
13
+ /** The solid primary fill: the theme's `primaryFill`, else `primary`. */
14
+ export declare const primaryFillColor: (theme: Theme) => string;
15
+ /** The solid primary fill on hover: a shade of `primaryFill`, else `primaryDark`. */
16
+ export declare const primaryFillHoverColor: (theme: Theme) => string;
13
17
  export type FilledTextFill = "primary" | "other";
14
18
  /**
15
19
  * Text color for a label sitting on a brand-colored fill: the theme's
@@ -10,6 +10,8 @@ import { css } from "styled-components";
10
10
  */ var alpha = (color, percent) => `color-mix(in srgb, ${color} ${percent}%, transparent)`;
11
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
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
+ /** Which fill a label sits on, so a theme's `onPrimary` can answer for its own. */ /** The solid primary fill: the theme's `primaryFill`, else `primary`. */ var primaryFillColor = (theme) => theme.colors.primaryFill ?? theme.colors.primary;
14
+ /** The solid primary fill on hover: a shade of `primaryFill`, else `primaryDark`. */ var primaryFillHoverColor = (theme) => theme.colors.primaryFill ? shade(theme.colors.primaryFill, 10) : theme.colors.primaryDark;
13
15
  /**
14
16
  * Text color for a label sitting on a brand-colored fill: the theme's
15
17
  * `onPrimary` on a primary fill when it sets one, else the palette's
@@ -108,4 +110,4 @@ var generateDirectionStyles = (size, direction) => css([
108
110
  `;}`
109
111
  ], mq(size), direction && `${direction}`);
110
112
  //#endregion
111
- export { alpha, darkFilledTextRule, errorInteractiveStyles, filledTextColor, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, resetButton, resetInput, shade, statusBorderStyles, thinScrollbar, tint };
113
+ export { alpha, darkFilledTextRule, errorInteractiveStyles, filledTextColor, formElementHeightStyles, fullWidthStyles, generateAlignContentStyles, generateAlignItemsStyles, generateColSpanStyles, generateColsStyles, generateDirectionStyles, generateGapStyles, generateJustifyContentStyles, generatePaddingStyles, interactiveStyles, primaryFillColor, primaryFillHoverColor, resetButton, resetInput, shade, statusBorderStyles, thinScrollbar, tint };
@@ -65,6 +65,14 @@ export interface Colors<TString = string> {
65
65
  * contrasting end, as `filledTextColor` describes.
66
66
  */
67
67
  onPrimary?: TString;
68
+ /**
69
+ * Optional fill for the solid primary surfaces (the primary button, the
70
+ * sent chat bubble, the primary avatar), whose label is `onPrimary`. Set it
71
+ * when the theme's `primary` is too bright to carry a label but still right
72
+ * for accents (links, rings, outlines): the fills take this deeper shade
73
+ * and the accents keep `primary`. Without it the fills use `primary`.
74
+ */
75
+ primaryFill?: TString;
68
76
  }
69
77
  export interface Shadows<TString = string> {
70
78
  xs: TString;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cherry-styled-components",
3
- "version": "0.2.21",
3
+ "version": "0.2.22",
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",