@latte-macchiat-io/latte-vanilla-components 0.0.527 → 0.0.528

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.
Files changed (32) hide show
  1. package/package.json +1 -1
  2. package/src/components/Actions/styles.css.ts +1 -1
  3. package/src/components/Box/Alert/styles.css.ts +1 -1
  4. package/src/components/Box/styles.css.ts +1 -1
  5. package/src/components/Button/styles.css.ts +1 -1
  6. package/src/components/Carousel/styles.css.ts +1 -2
  7. package/src/components/Columns/styles.css.ts +1 -1
  8. package/src/components/ConsentCookie/styles.css.ts +1 -1
  9. package/src/components/ExpandCollapse/Item/styles.css.ts +1 -1
  10. package/src/components/ExpandCollapse/styles.css.ts +1 -1
  11. package/src/components/Footer/styles.css.ts +1 -1
  12. package/src/components/Form/Row/styles.css.ts +1 -1
  13. package/src/components/Form/Select/styles.css.ts +1 -1
  14. package/src/components/Form/TextField/Input/styles.css.ts +1 -1
  15. package/src/components/Form/TextField/Textarea/styles.css.ts +1 -1
  16. package/src/components/Form/styles.css.ts +1 -1
  17. package/src/components/Header/styles.css.ts +1 -1
  18. package/src/components/Heading/styles.css.ts +1 -1
  19. package/src/components/KeyNumber/styles.css.ts +1 -1
  20. package/src/components/List/styles.css.ts +1 -1
  21. package/src/components/Modal/styles.css.ts +1 -1
  22. package/src/components/Nav/styles.css.ts +1 -1
  23. package/src/components/NavLegal/styles.css.ts +1 -1
  24. package/src/components/NavSocial/styles.css.ts +1 -1
  25. package/src/components/Paragraph/styles.css.ts +1 -1
  26. package/src/components/Section/styles.css.ts +1 -1
  27. package/src/components/Spacer/styles.css.ts +1 -2
  28. package/src/components/Video/styles.css.ts +1 -1
  29. package/src/styles/mediaqueries.ts +0 -2
  30. package/src/styles/types.ts +1 -0
  31. package/src/styles/utils/calcResponsiveSubtract.ts +47 -0
  32. package/src/{utils → styles/utils}/generateResponsiveMedia.ts +5 -45
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latte-macchiat-io/latte-vanilla-components",
3
- "version": "0.0.527",
3
+ "version": "0.0.528",
4
4
  "description": "Beautiful components for amazing projects, with a touch of Vanilla 🥤",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -1,7 +1,7 @@
1
1
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
2
2
 
3
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
3
4
  import { themeContract } from '../../theme/contract.css';
4
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
5
5
 
6
6
  export const actionsRecipe = recipe(
7
7
  {
@@ -1,8 +1,8 @@
1
1
  import { globalStyle, style } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { generateResponsiveMedia } from '../../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../../theme/contract.css';
5
- import { generateResponsiveMedia } from '../../../utils/generateResponsiveMedia';
6
6
 
7
7
  export const alertBoxBase = style({});
8
8
 
@@ -2,7 +2,7 @@ import { style } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
3
  import { queries, themeContract } from '@latte-macchiat-io/latte-vanilla-components';
4
4
 
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
5
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
6
6
 
7
7
  export const boxBase = style({
8
8
  width: '100%',
@@ -1,8 +1,8 @@
1
1
  import { globalStyle, style } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../theme/contract.css';
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
6
6
 
7
7
  export const buttonBase = style({
8
8
  border: 'none',
@@ -3,10 +3,9 @@ import { calc } from '@vanilla-extract/css-utils';
3
3
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
4
4
 
5
5
  import { queries } from '../../styles/mediaqueries';
6
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
6
7
  import { themeContract } from '../../theme/contract.css';
7
8
 
8
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
9
-
10
9
  export const carouselRecipe = recipe(
11
10
  {
12
11
  base: {
@@ -1,8 +1,8 @@
1
1
  import { globalStyle, style } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
3
  import { queries } from '../../styles/mediaqueries';
4
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../theme/contract.css';
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
6
6
 
7
7
  export const columnsBase = style({
8
8
  display: 'grid',
@@ -1,6 +1,6 @@
1
1
  import { keyframes, style } from '@vanilla-extract/css';
2
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
2
3
  import { themeContract } from '../../theme/contract.css';
3
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
4
4
 
5
5
  const fadeIn = keyframes({
6
6
  from: { opacity: '0' },
@@ -1,7 +1,7 @@
1
1
  import { globalStyle, style } from '@vanilla-extract/css';
2
2
 
3
+ import { generateResponsiveMedia } from '../../../styles/utils/generateResponsiveMedia';
3
4
  import { themeContract } from '../../../theme/contract.css';
4
- import { generateResponsiveMedia } from '../../../utils/generateResponsiveMedia';
5
5
 
6
6
  export const collapseExpandItem = style({
7
7
  gap: 0,
@@ -1,7 +1,7 @@
1
1
  import { style } from '@vanilla-extract/css';
2
2
 
3
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
3
4
  import { themeContract } from '../../theme/contract.css';
4
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
5
5
 
6
6
  export const collapseExpand = style({
7
7
  display: 'flex',
@@ -1,7 +1,7 @@
1
1
  import { globalStyle, style } from '@vanilla-extract/css';
2
2
 
3
3
  import { themeContract } from '../..';
4
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
4
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
5
5
 
6
6
  export const footerRecipe = style([
7
7
  {
@@ -1,7 +1,7 @@
1
1
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
2
2
 
3
+ import { generateResponsiveMedia } from '../../../styles/utils/generateResponsiveMedia';
3
4
  import { themeContract } from '../../../theme/contract.css';
4
- import { generateResponsiveMedia } from '../../../utils/generateResponsiveMedia';
5
5
 
6
6
  export const rowRecipe = recipe(
7
7
  {
@@ -1,8 +1,8 @@
1
1
  import { style } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { generateResponsiveMedia } from '../../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../../theme/contract.css';
5
- import { generateResponsiveMedia } from '../../../utils/generateResponsiveMedia';
6
6
 
7
7
  export const selectRecipe = recipe(
8
8
  {
@@ -1,7 +1,7 @@
1
1
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
2
2
 
3
+ import { generateResponsiveMedia } from '../../../../styles/utils/generateResponsiveMedia';
3
4
  import { themeContract } from '../../../../theme/contract.css';
4
- import { generateResponsiveMedia } from '../../../../utils/generateResponsiveMedia';
5
5
 
6
6
  export const inputRecipe = recipe(
7
7
  {
@@ -1,7 +1,7 @@
1
1
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
2
2
 
3
+ import { generateResponsiveMedia } from '../../../../styles/utils/generateResponsiveMedia';
3
4
  import { themeContract } from '../../../../theme/contract.css';
4
- import { generateResponsiveMedia } from '../../../../utils/generateResponsiveMedia';
5
5
 
6
6
  export const textareaRecipe = recipe(
7
7
  {
@@ -1,8 +1,8 @@
1
1
  import { globalStyle, style } from '@vanilla-extract/css';
2
2
  import { recipe } from '@vanilla-extract/recipes';
3
3
 
4
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../theme/contract.css';
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
6
6
 
7
7
  const formBase = style({
8
8
  display: 'flex',
@@ -2,7 +2,7 @@ import { globalStyle, style } from '@vanilla-extract/css';
2
2
  import { recipe } from '@vanilla-extract/recipes';
3
3
 
4
4
  import { queries, themeContract } from '../..';
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
5
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
6
6
 
7
7
  export const headerBase = style({
8
8
  zIndex: 40,
@@ -1,8 +1,8 @@
1
1
  import { style } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../theme/contract.css';
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
6
6
 
7
7
  export const headingRecipe = recipe(
8
8
  {
@@ -1,7 +1,7 @@
1
1
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
2
2
 
3
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
3
4
  import { themeContract } from '../../theme/contract.css';
4
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
5
5
 
6
6
  export const keyNumberRecipe = recipe(
7
7
  {
@@ -1,8 +1,8 @@
1
1
  import { globalStyle, style } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../theme/contract.css';
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
6
6
 
7
7
  export const listBase = style(
8
8
  {
@@ -1,8 +1,8 @@
1
1
  import { style } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../theme/contract.css';
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
6
6
 
7
7
  export const modal = style(
8
8
  {
@@ -1,7 +1,7 @@
1
1
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
2
2
 
3
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
3
4
  import { themeContract } from '../../theme/contract.css';
4
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
5
5
 
6
6
  export const navRecipe = recipe(
7
7
  {
@@ -1,8 +1,8 @@
1
1
  import { style } from '@vanilla-extract/css';
2
2
  import { recipe } from '@vanilla-extract/recipes';
3
3
 
4
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../theme/contract.css';
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
6
6
 
7
7
  export const navLegalRecipe = recipe(
8
8
  {
@@ -1,8 +1,8 @@
1
1
  import { globalStyle, style } from '@vanilla-extract/css';
2
2
  import { recipe } from '@vanilla-extract/recipes';
3
3
 
4
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../theme/contract.css';
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
6
6
 
7
7
  export const navSocialRecipe = recipe(
8
8
  {
@@ -1,8 +1,8 @@
1
1
  import { globalStyle, style } from '@vanilla-extract/css';
2
2
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../theme/contract.css';
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
6
6
 
7
7
  export const paragraph = style({
8
8
  marginLeft: 'auto',
@@ -1,8 +1,8 @@
1
1
  import { style } from '@vanilla-extract/css';
2
2
  import { recipe, type RecipeVariants } from '@vanilla-extract/recipes';
3
3
 
4
+ import { calcResponsiveSubtract, generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
4
5
  import { themeContract } from '../../theme/contract.css';
5
- import { calcResponsiveSubtract, generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
6
6
 
7
7
  export const sectionRecipe = recipe(
8
8
  {
@@ -1,9 +1,8 @@
1
1
  import { style } from '@vanilla-extract/css';
2
2
 
3
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
3
4
  import { themeContract } from '../../theme/contract.css';
4
5
 
5
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
6
-
7
6
  export const spacer = style({
8
7
  border: 0,
9
8
  backgroundColor: 'transparent',
@@ -3,9 +3,9 @@ import { calc } from '@vanilla-extract/css-utils';
3
3
  import { recipe, RecipeVariants } from '@vanilla-extract/recipes';
4
4
 
5
5
  import { queries } from '../../styles/mediaqueries';
6
+ import { generateResponsiveMedia } from '../../styles/utils/generateResponsiveMedia';
6
7
  import { themeContract } from '../../theme/contract.css';
7
8
  import { addPixelsToBreakpoints } from '../../utils/addPixelsToBreakpoints';
8
- import { generateResponsiveMedia } from '../../utils/generateResponsiveMedia';
9
9
 
10
10
  export const videoRecipe = recipe(
11
11
  {
@@ -1,5 +1,3 @@
1
- export type Breakpoints = 'mobile' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
2
-
3
1
  export const breakpoints = {
4
2
  mobile: 0,
5
3
  sm: 640,
@@ -0,0 +1 @@
1
+ export type Breakpoints = 'mobile' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
@@ -0,0 +1,47 @@
1
+ import { Breakpoints } from '../types';
2
+
3
+ // A responsive value can be a string, number, or anything with a toString method
4
+ type ResponsiveValue = string | number | { toString(): string };
5
+
6
+ // Map of breakpoint keys to responsive values
7
+ type BreakpointMap = Partial<Record<Breakpoints, ResponsiveValue>>;
8
+
9
+ // Ordered list of breakpoints to iterate over
10
+ const BPS: Breakpoints[] = ['mobile', 'sm', 'md', 'lg', 'xl', '2xl'];
11
+ /**
12
+ * Generate a responsive calc() subtraction: calc(base - other).
13
+ *
14
+ * - base: static value (string/number), e.g. "100vh"
15
+ * - other: either a single value or a BreakpointMap
16
+ *
17
+ * Example:
18
+ * calcResponsiveSubtract('100vh', { mobile: '50px', md: '80px' })
19
+ *
20
+ * => {
21
+ * mobile: "calc(100vh - 50px)",
22
+ * md: "calc(100vh - 80px)"
23
+ * }
24
+ */
25
+ export function calcResponsiveSubtract(base: ResponsiveValue, other: ResponsiveValue | BreakpointMap): BreakpointMap {
26
+ const build = (otherVal: ResponsiveValue) => `calc(${String(base)} - ${String(otherVal)})`;
27
+
28
+ const out: BreakpointMap = {};
29
+
30
+ const isMapLike = other && typeof other === 'object' && !Array.isArray(other) && Object.keys(other).some((k) => BPS.includes(k as Breakpoints));
31
+
32
+ if (isMapLike) {
33
+ const map = other as BreakpointMap;
34
+ for (const bp of BPS) {
35
+ const token = map[bp];
36
+ if (token === undefined) continue;
37
+ out[bp] = build(token);
38
+ }
39
+ } else {
40
+ const token = other as ResponsiveValue;
41
+ for (const bp of BPS) {
42
+ out[bp] = build(token);
43
+ }
44
+ }
45
+
46
+ return out;
47
+ }
@@ -1,17 +1,15 @@
1
1
  // utils/generateResponsive.ts
2
- import { queries } from '../styles/mediaqueries';
3
-
4
- // Define the supported breakpoint keys
5
- type BreakpointKey = 'mobile' | 'sm' | 'md' | 'lg' | 'xl' | '2xl';
2
+ import { queries } from '../mediaqueries';
3
+ import { Breakpoints } from '../types';
6
4
 
7
5
  // A responsive value can be a string, number, or anything with a toString method
8
6
  type ResponsiveValue = string | number | { toString(): string };
9
7
 
10
8
  // Map of breakpoint keys to responsive values
11
- type BreakpointMap = Partial<Record<BreakpointKey, ResponsiveValue>>;
9
+ type BreakpointMap = Partial<Record<Breakpoints, ResponsiveValue>>;
12
10
 
13
11
  // Ordered list of breakpoints to iterate over
14
- const BPS: BreakpointKey[] = ['mobile', 'sm', 'md', 'lg', 'xl', '2xl'];
12
+ const BPS: Breakpoints[] = ['mobile', 'sm', 'md', 'lg', 'xl', '2xl'];
15
13
 
16
14
  /**
17
15
  * Generates a fully responsive CSS object for Vanilla Extract
@@ -41,7 +39,7 @@ export function generateResponsiveMedia(
41
39
  // 1️⃣ Process normal CSS properties
42
40
  for (const [cssProp, valOrMap] of Object.entries(props)) {
43
41
  const isMapLike =
44
- valOrMap && typeof valOrMap === 'object' && !Array.isArray(valOrMap) && Object.keys(valOrMap).some((k) => BPS.includes(k as BreakpointKey));
42
+ valOrMap && typeof valOrMap === 'object' && !Array.isArray(valOrMap) && Object.keys(valOrMap).some((k) => BPS.includes(k as Breakpoints));
45
43
 
46
44
  if (isMapLike) {
47
45
  // Responsive map provided
@@ -89,41 +87,3 @@ export function generateResponsiveMedia(
89
87
 
90
88
  return result;
91
89
  }
92
-
93
- /**
94
- * Generate a responsive calc() subtraction: calc(base - other).
95
- *
96
- * - base: static value (string/number), e.g. "100vh"
97
- * - other: either a single value or a BreakpointMap
98
- *
99
- * Example:
100
- * calcResponsiveSubtract('100vh', { mobile: '50px', md: '80px' })
101
- *
102
- * => {
103
- * mobile: "calc(100vh - 50px)",
104
- * md: "calc(100vh - 80px)"
105
- * }
106
- */
107
- export function calcResponsiveSubtract(base: ResponsiveValue, other: ResponsiveValue | BreakpointMap): BreakpointMap {
108
- const build = (otherVal: ResponsiveValue) => `calc(${String(base)} - ${String(otherVal)})`;
109
-
110
- const out: BreakpointMap = {};
111
-
112
- const isMapLike = other && typeof other === 'object' && !Array.isArray(other) && Object.keys(other).some((k) => BPS.includes(k as BreakpointKey));
113
-
114
- if (isMapLike) {
115
- const map = other as BreakpointMap;
116
- for (const bp of BPS) {
117
- const token = map[bp];
118
- if (token === undefined) continue;
119
- out[bp] = build(token);
120
- }
121
- } else {
122
- const token = other as ResponsiveValue;
123
- for (const bp of BPS) {
124
- out[bp] = build(token);
125
- }
126
- }
127
-
128
- return out;
129
- }