@tosui/react 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,73 +1,119 @@
1
- # React + TypeScript + Vite
1
+ # @tosui/react
2
2
 
3
- This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
3
+ A themable, orderly, simple UI component library for React. 40 components with CSS Modules styling, responsive props, TypeScript-first types, and constraint-driven design.
4
4
 
5
- Currently, two official plugins are available:
5
+ ## Installation
6
6
 
7
- - [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) (or [oxc](https://oxc.rs) when used in [rolldown-vite](https://vite.dev/guide/rolldown)) for Fast Refresh
8
- - [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
7
+ ```bash
8
+ npm install @tosui/react
9
+ # or
10
+ pnpm add @tosui/react
11
+ ```
12
+
13
+ ## Setup
14
+
15
+ ```tsx
16
+ // Import base styles in your entry point (required)
17
+ import "@tosui/react/styles.css";
18
+
19
+ // Optionally import IBM Plex fonts
20
+ import "@tosui/react/fonts.css";
21
+ ```
22
+
23
+ ## Usage
24
+
25
+ ```tsx
26
+ import { Box, Text, Heading, Button } from "@tosui/react";
27
+
28
+ function App() {
29
+ return (
30
+ <Box p={6}>
31
+ <Heading size="3xl" weight="semibold">
32
+ Welcome
33
+ </Heading>
34
+ <Text color="foreground-muted">
35
+ A constraint-driven design system for React
36
+ </Text>
37
+ <Button>Get Started</Button>
38
+ </Box>
39
+ );
40
+ }
41
+ ```
42
+
43
+ ## Components
44
+
45
+ | Category | Components |
46
+ |----------|------------|
47
+ | **Primitives** | Box, Text, Heading |
48
+ | **Layout** | Stack, HStack, VStack, Flex, Grid, Container, Divider, Spacer |
49
+ | **Forms** | Button, IconButton, Input, Select, Textarea, Checkbox, Radio, Switch, FormField, Label |
50
+ | **Navigation** | Link, Tabs, Breadcrumb, Menu, Pagination |
51
+ | **Feedback** | Alert, Badge, Progress, Skeleton, Spinner |
52
+ | **Data Display** | Avatar, Card, Image, List, Code |
53
+ | **Overlays** | Modal, Tooltip, Popover, Accordion |
54
+
55
+ ## Key Concepts
56
+
57
+ ### Spacing
9
58
 
10
- ## React Compiler
59
+ 4px base unit with multipliers 0–32:
11
60
 
12
- The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
61
+ ```tsx
62
+ <Box p={4} /> // 16px padding
63
+ <Box m={8} /> // 32px margin
64
+ <Box gap={2} /> // 8px gap
65
+ ```
66
+
67
+ ### Responsive Props
13
68
 
14
- ## Expanding the ESLint configuration
69
+ Mobile-first breakpoints `base` (0), `sm` (640px), `md` (768px), `lg` (1024px), `xl` (1280px), `2xl` (1536px):
15
70
 
16
- If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
71
+ ```tsx
72
+ <Box p={{ base: 2, md: 4, lg: 6 }} />
73
+ <Box display={{ base: "none", md: "block" }} />
74
+ ```
17
75
 
18
- ```js
19
- export default defineConfig([
20
- globalIgnores(['dist']),
21
- {
22
- files: ['**/*.{ts,tsx}'],
23
- extends: [
24
- // Other configs...
76
+ ### Color Tokens
25
77
 
26
- // Remove tseslint.configs.recommended and replace with this
27
- tseslint.configs.recommendedTypeChecked,
28
- // Alternatively, use this for stricter rules
29
- tseslint.configs.strictTypeChecked,
30
- // Optionally, add this for stylistic rules
31
- tseslint.configs.stylisticTypeChecked,
78
+ Semantic names that adapt to light/dark mode:
32
79
 
33
- // Other configs...
34
- ],
35
- languageOptions: {
36
- parserOptions: {
37
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
38
- tsconfigRootDir: import.meta.dirname,
39
- },
40
- // other options...
41
- },
42
- },
43
- ])
80
+ ```tsx
81
+ <Box bg="surface" color="foreground" />
82
+ <Box bg="primary-default" color="foreground-inverted" />
83
+ <Text color="foreground-muted">Secondary text</Text>
84
+ <Box bg="error-subtle" color="error-default">Error message</Box>
44
85
  ```
45
86
 
46
- You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
47
-
48
- ```js
49
- // eslint.config.js
50
- import reactX from 'eslint-plugin-react-x'
51
- import reactDom from 'eslint-plugin-react-dom'
52
-
53
- export default defineConfig([
54
- globalIgnores(['dist']),
55
- {
56
- files: ['**/*.{ts,tsx}'],
57
- extends: [
58
- // Other configs...
59
- // Enable lint rules for React
60
- reactX.configs['recommended-typescript'],
61
- // Enable lint rules for React DOM
62
- reactDom.configs.recommended,
63
- ],
64
- languageOptions: {
65
- parserOptions: {
66
- project: ['./tsconfig.node.json', './tsconfig.app.json'],
67
- tsconfigRootDir: import.meta.dirname,
68
- },
69
- // other options...
70
- },
71
- },
72
- ])
87
+ **Surface & Text**: `foreground`, `foreground-muted`, `foreground-subtle`, `foreground-inverted`, `background`, `surface`
88
+ **Border**: `border`, `border-muted`
89
+ **Brand**: `primary-default`, `primary-emphasis`, `primary-subtle`, `accent-default`, `accent-emphasis`, `accent-subtle`
90
+ **Feedback**: `success-*`, `warning-*`, `error-*`, `info-*` (each with `-default`, `-emphasis`, `-subtle`)
91
+
92
+ ### Polymorphic Components
93
+
94
+ ```tsx
95
+ <Box as="section" />
96
+ <Text as="label" />
97
+ <Heading as="h1" />
98
+ <Button as="a" href="/signup">Sign Up</Button>
73
99
  ```
100
+
101
+ ### Theming
102
+
103
+ Override CSS variables to customize:
104
+
105
+ ```css
106
+ :root {
107
+ --t-light-primary-default: #your-brand-color;
108
+ --t-dark-primary-default: #your-dark-brand-color;
109
+ --t-spacing-unit: 8px;
110
+ }
111
+ ```
112
+
113
+ ## Documentation
114
+
115
+ Full documentation with interactive examples: [https://dgca.github.io/tosui/](https://dgca.github.io/tosui/)
116
+
117
+ ## License
118
+
119
+ MIT
@@ -1,9 +1,10 @@
1
+ import { ResponsiveValue } from '../../../utils/breakpoints';
1
2
  import { StyleResult } from '../shared';
2
3
  export type JustifySelfValue = "auto" | "start" | "end" | "center" | "stretch";
3
4
  export type GridProps = {
4
5
  justifySelf?: JustifySelfValue;
5
- gridTemplateColumns?: string;
6
- gridTemplateRows?: string;
6
+ gridTemplateColumns?: ResponsiveValue<string>;
7
+ gridTemplateRows?: ResponsiveValue<string>;
7
8
  };
8
9
  export type GridStateProps = {
9
10
  _hover?: GridProps;
@@ -1 +1 @@
1
- {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/grid/grid.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE/E,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AA+CF,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,GAAG,cAAc,GAChC,WAAW,CAab"}
1
+ {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/grid/grid.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,CAAC;AAI/E,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,mBAAmB,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC9C,gBAAgB,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;CAC5C,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB,CAAC;AAoFF,wBAAgB,aAAa,CAC3B,KAAK,EAAE,SAAS,GAAG,cAAc,GAChC,WAAW,CAab"}
@@ -1,34 +1,54 @@
1
- import { STATE_SUFFIXES, STATE_CLASS_SUFFIXES } from "../shared/constants.js";
1
+ import { STATE_CLASS_SUFFIXES, STATE_SUFFIXES, RESPONSIVE_KEYS } from "../shared/constants.js";
2
2
  import styles from "./grid.module.css.js";
3
3
  import clsx from "clsx";
4
4
  function getJustifySelfClass(value, state) {
5
5
  const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
6
6
  return stateClassSuffix ? styles[`justify-self-${value}${stateClassSuffix}`] : styles[`justify-self-${value}`];
7
7
  }
8
+ function getGridTemplateProp(key, varPrefix, value, state = "base") {
9
+ const result = { className: "", style: {} };
10
+ if (value === void 0) return result;
11
+ const stateSuffix = STATE_SUFFIXES[state];
12
+ const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
13
+ if (typeof value !== "object") {
14
+ const className = stateClassSuffix ? styles[`${key}${stateClassSuffix}`] : styles[key];
15
+ result.className = className || "";
16
+ result.style[`--t-${varPrefix}${stateSuffix}`] = value;
17
+ return result;
18
+ }
19
+ for (const responsiveKey of RESPONSIVE_KEYS) {
20
+ const val = value[responsiveKey];
21
+ if (val === void 0) continue;
22
+ let className;
23
+ let varName;
24
+ if (responsiveKey === "base") {
25
+ className = stateClassSuffix ? styles[`${key}${stateClassSuffix}`] : styles[key];
26
+ varName = `--t-${varPrefix}${stateSuffix}`;
27
+ } else {
28
+ className = stateClassSuffix ? styles[`${key}_${responsiveKey}${stateClassSuffix}`] : styles[`${key}_${responsiveKey}`];
29
+ varName = `--t-${varPrefix}_${responsiveKey}${stateSuffix}`;
30
+ }
31
+ if (className) {
32
+ result.className = clsx(result.className, className);
33
+ }
34
+ result.style[varName] = val;
35
+ }
36
+ return result;
37
+ }
8
38
  function getGridStylesForState(props, state) {
9
39
  if (!props) return { className: "", style: {} };
10
40
  const { justifySelf, gridTemplateColumns, gridTemplateRows } = props;
11
41
  const classes = [];
12
42
  const style = {};
13
- const stateVarSuffix = STATE_SUFFIXES[state];
14
- const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
15
43
  if (justifySelf) {
16
44
  const cls = getJustifySelfClass(justifySelf, state);
17
45
  if (cls) classes.push(cls);
18
46
  }
19
- if (gridTemplateColumns !== void 0) {
20
- const gridColsClass = stateClassSuffix ? styles[`grid-cols${stateClassSuffix}`] : styles["grid-cols"];
21
- if (gridColsClass) classes.push(gridColsClass);
22
- style[`--t-grid-cols${stateVarSuffix}`] = gridTemplateColumns;
23
- }
24
- if (gridTemplateRows !== void 0) {
25
- const gridRowsClass = stateClassSuffix ? styles[`grid-rows${stateClassSuffix}`] : styles["grid-rows"];
26
- if (gridRowsClass) classes.push(gridRowsClass);
27
- style[`--t-grid-rows${stateVarSuffix}`] = gridTemplateRows;
28
- }
47
+ const colsResult = getGridTemplateProp("grid-cols", "grid-cols", gridTemplateColumns, state);
48
+ const rowsResult = getGridTemplateProp("grid-rows", "grid-rows", gridTemplateRows, state);
29
49
  return {
30
- className: clsx(...classes),
31
- style
50
+ className: clsx(...classes, colsResult.className, rowsResult.className),
51
+ style: { ...style, ...colsResult.style, ...rowsResult.style }
32
52
  };
33
53
  }
34
54
  function getGridStyles(props) {
@@ -1 +1 @@
1
- {"version":3,"file":"grid.js","sources":["../../../../src/components/Box/grid/grid.ts"],"sourcesContent":["import {\n STATE_SUFFIXES,\n STATE_CLASS_SUFFIXES,\n type StateKey,\n type StyleResult,\n} from \"../shared\";\nimport styles from \"./grid.module.css\";\nimport clsx from \"clsx\";\n\nexport type JustifySelfValue = \"auto\" | \"start\" | \"end\" | \"center\" | \"stretch\";\n\nexport type GridProps = {\n justifySelf?: JustifySelfValue;\n gridTemplateColumns?: string;\n gridTemplateRows?: string;\n};\n\nexport type GridStateProps = {\n _hover?: GridProps;\n};\n\nfunction getJustifySelfClass(value: JustifySelfValue, state: StateKey): string | undefined {\n const stateClassSuffix = STATE_CLASS_SUFFIXES[state];\n return stateClassSuffix\n ? styles[`justify-self-${value}${stateClassSuffix}`]\n : styles[`justify-self-${value}`];\n}\n\nfunction getGridStylesForState(\n props: GridProps | undefined,\n state: StateKey\n): StyleResult {\n if (!props) return { className: \"\", style: {} };\n\n const { justifySelf, gridTemplateColumns, gridTemplateRows } = props;\n\n const classes: string[] = [];\n const style: Record<string, string> = {};\n const stateVarSuffix = STATE_SUFFIXES[state];\n const stateClassSuffix = STATE_CLASS_SUFFIXES[state];\n\n // Enumerated prop\n if (justifySelf) {\n const cls = getJustifySelfClass(justifySelf, state);\n if (cls) classes.push(cls);\n }\n\n // Variable-based props\n if (gridTemplateColumns !== undefined) {\n const gridColsClass = stateClassSuffix ? styles[`grid-cols${stateClassSuffix}`] : styles[\"grid-cols\"];\n if (gridColsClass) classes.push(gridColsClass);\n style[`--t-grid-cols${stateVarSuffix}`] = gridTemplateColumns;\n }\n\n if (gridTemplateRows !== undefined) {\n const gridRowsClass = stateClassSuffix ? styles[`grid-rows${stateClassSuffix}`] : styles[\"grid-rows\"];\n if (gridRowsClass) classes.push(gridRowsClass);\n style[`--t-grid-rows${stateVarSuffix}`] = gridTemplateRows;\n }\n\n return {\n className: clsx(...classes),\n style,\n };\n}\n\nexport function getGridStyles(\n props: GridProps & GridStateProps\n): StyleResult {\n const { justifySelf, gridTemplateColumns, gridTemplateRows, _hover } = props;\n\n const baseStyles = getGridStylesForState(\n { justifySelf, gridTemplateColumns, gridTemplateRows },\n \"base\"\n );\n const hoverStyles = getGridStylesForState(_hover, \"hover\");\n\n return {\n className: clsx(baseStyles.className, hoverStyles.className),\n style: { ...baseStyles.style, ...hoverStyles.style } as Record<string, string>,\n };\n}\n"],"names":[],"mappings":";;;AAqBA,SAAS,oBAAoB,OAAyB,OAAqC;AACzF,QAAM,mBAAmB,qBAAqB,KAAK;AACnD,SAAO,mBACH,OAAO,gBAAgB,KAAK,GAAG,gBAAgB,EAAE,IACjD,OAAO,gBAAgB,KAAK,EAAE;AACpC;AAEA,SAAS,sBACP,OACA,OACa;AACb,MAAI,CAAC,MAAO,QAAO,EAAE,WAAW,IAAI,OAAO,GAAC;AAE5C,QAAM,EAAE,aAAa,qBAAqB,iBAAA,IAAqB;AAE/D,QAAM,UAAoB,CAAA;AAC1B,QAAM,QAAgC,CAAA;AACtC,QAAM,iBAAiB,eAAe,KAAK;AAC3C,QAAM,mBAAmB,qBAAqB,KAAK;AAGnD,MAAI,aAAa;AACf,UAAM,MAAM,oBAAoB,aAAa,KAAK;AAClD,QAAI,IAAK,SAAQ,KAAK,GAAG;AAAA,EAC3B;AAGA,MAAI,wBAAwB,QAAW;AACrC,UAAM,gBAAgB,mBAAmB,OAAO,YAAY,gBAAgB,EAAE,IAAI,OAAO,WAAW;AACpG,QAAI,cAAe,SAAQ,KAAK,aAAa;AAC7C,UAAM,gBAAgB,cAAc,EAAE,IAAI;AAAA,EAC5C;AAEA,MAAI,qBAAqB,QAAW;AAClC,UAAM,gBAAgB,mBAAmB,OAAO,YAAY,gBAAgB,EAAE,IAAI,OAAO,WAAW;AACpG,QAAI,cAAe,SAAQ,KAAK,aAAa;AAC7C,UAAM,gBAAgB,cAAc,EAAE,IAAI;AAAA,EAC5C;AAEA,SAAO;AAAA,IACL,WAAW,KAAK,GAAG,OAAO;AAAA,IAC1B;AAAA,EAAA;AAEJ;AAEO,SAAS,cACd,OACa;AACb,QAAM,EAAE,aAAa,qBAAqB,kBAAkB,WAAW;AAEvE,QAAM,aAAa;AAAA,IACjB,EAAE,aAAa,qBAAqB,iBAAA;AAAA,IACpC;AAAA,EAAA;AAEF,QAAM,cAAc,sBAAsB,QAAQ,OAAO;AAEzD,SAAO;AAAA,IACL,WAAW,KAAK,WAAW,WAAW,YAAY,SAAS;AAAA,IAC3D,OAAO,EAAE,GAAG,WAAW,OAAO,GAAG,YAAY,MAAA;AAAA,EAAM;AAEvD;"}
1
+ {"version":3,"file":"grid.js","sources":["../../../../src/components/Box/grid/grid.ts"],"sourcesContent":["import type { ResponsiveValue } from \"@/utils/breakpoints\";\nimport {\n RESPONSIVE_KEYS,\n STATE_SUFFIXES,\n STATE_CLASS_SUFFIXES,\n type StateKey,\n type StyleResult,\n} from \"../shared\";\nimport styles from \"./grid.module.css\";\nimport clsx from \"clsx\";\n\nexport type JustifySelfValue = \"auto\" | \"start\" | \"end\" | \"center\" | \"stretch\";\n\ntype GridTemplateKey = \"grid-cols\" | \"grid-rows\";\n\nexport type GridProps = {\n justifySelf?: JustifySelfValue;\n gridTemplateColumns?: ResponsiveValue<string>;\n gridTemplateRows?: ResponsiveValue<string>;\n};\n\nexport type GridStateProps = {\n _hover?: GridProps;\n};\n\nfunction getJustifySelfClass(value: JustifySelfValue, state: StateKey): string | undefined {\n const stateClassSuffix = STATE_CLASS_SUFFIXES[state];\n return stateClassSuffix\n ? styles[`justify-self-${value}${stateClassSuffix}`]\n : styles[`justify-self-${value}`];\n}\n\nfunction getGridTemplateProp(\n key: GridTemplateKey,\n varPrefix: string,\n value: ResponsiveValue<string> | undefined,\n state: StateKey = \"base\"\n): StyleResult {\n const result: StyleResult = { className: \"\", style: {} };\n\n if (value === undefined) return result;\n\n const stateSuffix = STATE_SUFFIXES[state];\n const stateClassSuffix = STATE_CLASS_SUFFIXES[state];\n\n if (typeof value !== \"object\") {\n const className = stateClassSuffix\n ? styles[`${key}${stateClassSuffix}`]\n : styles[key];\n result.className = className || \"\";\n result.style[`--t-${varPrefix}${stateSuffix}`] = value;\n return result;\n }\n\n for (const responsiveKey of RESPONSIVE_KEYS) {\n const val = value[responsiveKey];\n if (val === undefined) continue;\n\n let className: string | undefined;\n let varName: string;\n\n if (responsiveKey === \"base\") {\n className = stateClassSuffix\n ? styles[`${key}${stateClassSuffix}`]\n : styles[key];\n varName = `--t-${varPrefix}${stateSuffix}`;\n } else {\n className = stateClassSuffix\n ? styles[`${key}_${responsiveKey}${stateClassSuffix}`]\n : styles[`${key}_${responsiveKey}`];\n varName = `--t-${varPrefix}_${responsiveKey}${stateSuffix}`;\n }\n\n if (className) {\n result.className = clsx(result.className, className);\n }\n result.style[varName] = val;\n }\n\n return result;\n}\n\nfunction getGridStylesForState(\n props: GridProps | undefined,\n state: StateKey\n): StyleResult {\n if (!props) return { className: \"\", style: {} };\n\n const { justifySelf, gridTemplateColumns, gridTemplateRows } = props;\n\n const classes: string[] = [];\n const style: Record<string, string> = {};\n\n if (justifySelf) {\n const cls = getJustifySelfClass(justifySelf, state);\n if (cls) classes.push(cls);\n }\n\n const colsResult = getGridTemplateProp(\"grid-cols\", \"grid-cols\", gridTemplateColumns, state);\n const rowsResult = getGridTemplateProp(\"grid-rows\", \"grid-rows\", gridTemplateRows, state);\n\n return {\n className: clsx(...classes, colsResult.className, rowsResult.className),\n style: { ...style, ...colsResult.style, ...rowsResult.style },\n };\n}\n\nexport function getGridStyles(\n props: GridProps & GridStateProps\n): StyleResult {\n const { justifySelf, gridTemplateColumns, gridTemplateRows, _hover } = props;\n\n const baseStyles = getGridStylesForState(\n { justifySelf, gridTemplateColumns, gridTemplateRows },\n \"base\"\n );\n const hoverStyles = getGridStylesForState(_hover, \"hover\");\n\n return {\n className: clsx(baseStyles.className, hoverStyles.className),\n style: { ...baseStyles.style, ...hoverStyles.style } as Record<string, string>,\n };\n}\n"],"names":[],"mappings":";;;AAyBA,SAAS,oBAAoB,OAAyB,OAAqC;AACzF,QAAM,mBAAmB,qBAAqB,KAAK;AACnD,SAAO,mBACH,OAAO,gBAAgB,KAAK,GAAG,gBAAgB,EAAE,IACjD,OAAO,gBAAgB,KAAK,EAAE;AACpC;AAEA,SAAS,oBACP,KACA,WACA,OACA,QAAkB,QACL;AACb,QAAM,SAAsB,EAAE,WAAW,IAAI,OAAO,CAAA,EAAC;AAErD,MAAI,UAAU,OAAW,QAAO;AAEhC,QAAM,cAAc,eAAe,KAAK;AACxC,QAAM,mBAAmB,qBAAqB,KAAK;AAEnD,MAAI,OAAO,UAAU,UAAU;AAC7B,UAAM,YAAY,mBACd,OAAO,GAAG,GAAG,GAAG,gBAAgB,EAAE,IAClC,OAAO,GAAG;AACd,WAAO,YAAY,aAAa;AAChC,WAAO,MAAM,OAAO,SAAS,GAAG,WAAW,EAAE,IAAI;AACjD,WAAO;AAAA,EACT;AAEA,aAAW,iBAAiB,iBAAiB;AAC3C,UAAM,MAAM,MAAM,aAAa;AAC/B,QAAI,QAAQ,OAAW;AAEvB,QAAI;AACJ,QAAI;AAEJ,QAAI,kBAAkB,QAAQ;AAC5B,kBAAY,mBACR,OAAO,GAAG,GAAG,GAAG,gBAAgB,EAAE,IAClC,OAAO,GAAG;AACd,gBAAU,OAAO,SAAS,GAAG,WAAW;AAAA,IAC1C,OAAO;AACL,kBAAY,mBACR,OAAO,GAAG,GAAG,IAAI,aAAa,GAAG,gBAAgB,EAAE,IACnD,OAAO,GAAG,GAAG,IAAI,aAAa,EAAE;AACpC,gBAAU,OAAO,SAAS,IAAI,aAAa,GAAG,WAAW;AAAA,IAC3D;AAEA,QAAI,WAAW;AACb,aAAO,YAAY,KAAK,OAAO,WAAW,SAAS;AAAA,IACrD;AACA,WAAO,MAAM,OAAO,IAAI;AAAA,EAC1B;AAEA,SAAO;AACT;AAEA,SAAS,sBACP,OACA,OACa;AACb,MAAI,CAAC,MAAO,QAAO,EAAE,WAAW,IAAI,OAAO,GAAC;AAE5C,QAAM,EAAE,aAAa,qBAAqB,iBAAA,IAAqB;AAE/D,QAAM,UAAoB,CAAA;AAC1B,QAAM,QAAgC,CAAA;AAEtC,MAAI,aAAa;AACf,UAAM,MAAM,oBAAoB,aAAa,KAAK;AAClD,QAAI,IAAK,SAAQ,KAAK,GAAG;AAAA,EAC3B;AAEA,QAAM,aAAa,oBAAoB,aAAa,aAAa,qBAAqB,KAAK;AAC3F,QAAM,aAAa,oBAAoB,aAAa,aAAa,kBAAkB,KAAK;AAExF,SAAO;AAAA,IACL,WAAW,KAAK,GAAG,SAAS,WAAW,WAAW,WAAW,SAAS;AAAA,IACtE,OAAO,EAAE,GAAG,OAAO,GAAG,WAAW,OAAO,GAAG,WAAW,MAAA;AAAA,EAAM;AAEhE;AAEO,SAAS,cACd,OACa;AACb,QAAM,EAAE,aAAa,qBAAqB,kBAAkB,WAAW;AAEvE,QAAM,aAAa;AAAA,IACjB,EAAE,aAAa,qBAAqB,iBAAA;AAAA,IACpC;AAAA,EAAA;AAEF,QAAM,cAAc,sBAAsB,QAAQ,OAAO;AAEzD,SAAO;AAAA,IACL,WAAW,KAAK,WAAW,WAAW,YAAY,SAAS;AAAA,IAC3D,OAAO,EAAE,GAAG,WAAW,OAAO,GAAG,YAAY,MAAA;AAAA,EAAM;AAEvD;"}
@@ -1,19 +1,69 @@
1
1
  /* justifySelf */
2
- ._justify-self-auto_1s4ho_2 { justify-self: auto; }
3
- ._justify-self-auto\:h_1s4ho_3:hover { justify-self: auto; }
4
- ._justify-self-start_1s4ho_4 { justify-self: start; }
5
- ._justify-self-start\:h_1s4ho_5:hover { justify-self: start; }
6
- ._justify-self-end_1s4ho_6 { justify-self: end; }
7
- ._justify-self-end\:h_1s4ho_7:hover { justify-self: end; }
8
- ._justify-self-center_1s4ho_8 { justify-self: center; }
9
- ._justify-self-center\:h_1s4ho_9:hover { justify-self: center; }
10
- ._justify-self-stretch_1s4ho_10 { justify-self: stretch; }
11
- ._justify-self-stretch\:h_1s4ho_11:hover { justify-self: stretch; }
2
+ ._justify-self-auto_hzpp0_2 { justify-self: auto; }
3
+ ._justify-self-auto\:h_hzpp0_3:hover { justify-self: auto; }
4
+ ._justify-self-start_hzpp0_4 { justify-self: start; }
5
+ ._justify-self-start\:h_hzpp0_5:hover { justify-self: start; }
6
+ ._justify-self-end_hzpp0_6 { justify-self: end; }
7
+ ._justify-self-end\:h_hzpp0_7:hover { justify-self: end; }
8
+ ._justify-self-center_hzpp0_8 { justify-self: center; }
9
+ ._justify-self-center\:h_hzpp0_9:hover { justify-self: center; }
10
+ ._justify-self-stretch_hzpp0_10 { justify-self: stretch; }
11
+ ._justify-self-stretch\:h_hzpp0_11:hover { justify-self: stretch; }
12
12
 
13
13
  /* gridTemplateColumns (variable-based) */
14
- ._grid-cols_1s4ho_14 { grid-template-columns: var(--t-grid-cols); }
15
- ._grid-cols\:h_1s4ho_15:hover { grid-template-columns: var(--t-grid-cols-h); }
14
+ ._grid-cols_hzpp0_14 { grid-template-columns: var(--t-grid-cols); }
15
+ ._grid-cols\:h_hzpp0_15:hover { grid-template-columns: var(--t-grid-cols-h); }
16
+
17
+ @media (min-width: 640px) {
18
+ ._grid-cols_sm_hzpp0_18 { grid-template-columns: var(--t-grid-cols_sm); }
19
+ ._grid-cols_sm\:h_hzpp0_19:hover { grid-template-columns: var(--t-grid-cols_sm-h); }
20
+ }
21
+
22
+ @media (min-width: 768px) {
23
+ ._grid-cols_md_hzpp0_23 { grid-template-columns: var(--t-grid-cols_md); }
24
+ ._grid-cols_md\:h_hzpp0_24:hover { grid-template-columns: var(--t-grid-cols_md-h); }
25
+ }
26
+
27
+ @media (min-width: 1024px) {
28
+ ._grid-cols_lg_hzpp0_28 { grid-template-columns: var(--t-grid-cols_lg); }
29
+ ._grid-cols_lg\:h_hzpp0_29:hover { grid-template-columns: var(--t-grid-cols_lg-h); }
30
+ }
31
+
32
+ @media (min-width: 1280px) {
33
+ ._grid-cols_xl_hzpp0_33 { grid-template-columns: var(--t-grid-cols_xl); }
34
+ ._grid-cols_xl\:h_hzpp0_34:hover { grid-template-columns: var(--t-grid-cols_xl-h); }
35
+ }
36
+
37
+ @media (min-width: 1536px) {
38
+ ._grid-cols_2xl_hzpp0_38 { grid-template-columns: var(--t-grid-cols_2xl); }
39
+ ._grid-cols_2xl\:h_hzpp0_39:hover { grid-template-columns: var(--t-grid-cols_2xl-h); }
40
+ }
16
41
 
17
42
  /* gridTemplateRows (variable-based) */
18
- ._grid-rows_1s4ho_18 { grid-template-rows: var(--t-grid-rows); }
19
- ._grid-rows\:h_1s4ho_19:hover { grid-template-rows: var(--t-grid-rows-h); }
43
+ ._grid-rows_hzpp0_43 { grid-template-rows: var(--t-grid-rows); }
44
+ ._grid-rows\:h_hzpp0_44:hover { grid-template-rows: var(--t-grid-rows-h); }
45
+
46
+ @media (min-width: 640px) {
47
+ ._grid-rows_sm_hzpp0_47 { grid-template-rows: var(--t-grid-rows_sm); }
48
+ ._grid-rows_sm\:h_hzpp0_48:hover { grid-template-rows: var(--t-grid-rows_sm-h); }
49
+ }
50
+
51
+ @media (min-width: 768px) {
52
+ ._grid-rows_md_hzpp0_52 { grid-template-rows: var(--t-grid-rows_md); }
53
+ ._grid-rows_md\:h_hzpp0_53:hover { grid-template-rows: var(--t-grid-rows_md-h); }
54
+ }
55
+
56
+ @media (min-width: 1024px) {
57
+ ._grid-rows_lg_hzpp0_57 { grid-template-rows: var(--t-grid-rows_lg); }
58
+ ._grid-rows_lg\:h_hzpp0_58:hover { grid-template-rows: var(--t-grid-rows_lg-h); }
59
+ }
60
+
61
+ @media (min-width: 1280px) {
62
+ ._grid-rows_xl_hzpp0_62 { grid-template-rows: var(--t-grid-rows_xl); }
63
+ ._grid-rows_xl\:h_hzpp0_63:hover { grid-template-rows: var(--t-grid-rows_xl-h); }
64
+ }
65
+
66
+ @media (min-width: 1536px) {
67
+ ._grid-rows_2xl_hzpp0_67 { grid-template-rows: var(--t-grid-rows_2xl); }
68
+ ._grid-rows_2xl\:h_hzpp0_68:hover { grid-template-rows: var(--t-grid-rows_2xl-h); }
69
+ }
@@ -1,18 +1,38 @@
1
1
  const styles = {
2
- "justify-self-auto": "_justify-self-auto_1s4ho_2",
3
- "justify-self-auto:h": "_justify-self-auto:h_1s4ho_3",
4
- "justify-self-start": "_justify-self-start_1s4ho_4",
5
- "justify-self-start:h": "_justify-self-start:h_1s4ho_5",
6
- "justify-self-end": "_justify-self-end_1s4ho_6",
7
- "justify-self-end:h": "_justify-self-end:h_1s4ho_7",
8
- "justify-self-center": "_justify-self-center_1s4ho_8",
9
- "justify-self-center:h": "_justify-self-center:h_1s4ho_9",
10
- "justify-self-stretch": "_justify-self-stretch_1s4ho_10",
11
- "justify-self-stretch:h": "_justify-self-stretch:h_1s4ho_11",
12
- "grid-cols": "_grid-cols_1s4ho_14",
13
- "grid-cols:h": "_grid-cols:h_1s4ho_15",
14
- "grid-rows": "_grid-rows_1s4ho_18",
15
- "grid-rows:h": "_grid-rows:h_1s4ho_19"
2
+ "justify-self-auto": "_justify-self-auto_hzpp0_2",
3
+ "justify-self-auto:h": "_justify-self-auto:h_hzpp0_3",
4
+ "justify-self-start": "_justify-self-start_hzpp0_4",
5
+ "justify-self-start:h": "_justify-self-start:h_hzpp0_5",
6
+ "justify-self-end": "_justify-self-end_hzpp0_6",
7
+ "justify-self-end:h": "_justify-self-end:h_hzpp0_7",
8
+ "justify-self-center": "_justify-self-center_hzpp0_8",
9
+ "justify-self-center:h": "_justify-self-center:h_hzpp0_9",
10
+ "justify-self-stretch": "_justify-self-stretch_hzpp0_10",
11
+ "justify-self-stretch:h": "_justify-self-stretch:h_hzpp0_11",
12
+ "grid-cols": "_grid-cols_hzpp0_14",
13
+ "grid-cols:h": "_grid-cols:h_hzpp0_15",
14
+ "grid-cols_sm": "_grid-cols_sm_hzpp0_18",
15
+ "grid-cols_sm:h": "_grid-cols_sm:h_hzpp0_19",
16
+ "grid-cols_md": "_grid-cols_md_hzpp0_23",
17
+ "grid-cols_md:h": "_grid-cols_md:h_hzpp0_24",
18
+ "grid-cols_lg": "_grid-cols_lg_hzpp0_28",
19
+ "grid-cols_lg:h": "_grid-cols_lg:h_hzpp0_29",
20
+ "grid-cols_xl": "_grid-cols_xl_hzpp0_33",
21
+ "grid-cols_xl:h": "_grid-cols_xl:h_hzpp0_34",
22
+ "grid-cols_2xl": "_grid-cols_2xl_hzpp0_38",
23
+ "grid-cols_2xl:h": "_grid-cols_2xl:h_hzpp0_39",
24
+ "grid-rows": "_grid-rows_hzpp0_43",
25
+ "grid-rows:h": "_grid-rows:h_hzpp0_44",
26
+ "grid-rows_sm": "_grid-rows_sm_hzpp0_47",
27
+ "grid-rows_sm:h": "_grid-rows_sm:h_hzpp0_48",
28
+ "grid-rows_md": "_grid-rows_md_hzpp0_52",
29
+ "grid-rows_md:h": "_grid-rows_md:h_hzpp0_53",
30
+ "grid-rows_lg": "_grid-rows_lg_hzpp0_57",
31
+ "grid-rows_lg:h": "_grid-rows_lg:h_hzpp0_58",
32
+ "grid-rows_xl": "_grid-rows_xl_hzpp0_62",
33
+ "grid-rows_xl:h": "_grid-rows_xl:h_hzpp0_63",
34
+ "grid-rows_2xl": "_grid-rows_2xl_hzpp0_67",
35
+ "grid-rows_2xl:h": "_grid-rows_2xl:h_hzpp0_68"
16
36
  };
17
37
  export {
18
38
  styles as default
@@ -1 +1 @@
1
- {"version":3,"file":"grid.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"grid.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,12 +1,13 @@
1
1
  import { ElementType } from 'react';
2
2
  import { Polymorphic } from '../../types/Polymorphic';
3
+ import { ResponsiveValue } from '../../utils/breakpoints';
3
4
  import { BoxOwnProps } from '../Box/Box';
4
5
  import { JustifyContentValue, AlignItemsValue, SpacingValue } from '../Box/flexbox/flexbox';
5
6
  export type GridOwnProps = Omit<BoxOwnProps, "display" | "gridTemplateColumns" | "gridTemplateRows" | "gap" | "gapRow" | "gapColumn" | "justifyContent" | "alignItems"> & {
6
- /** Grid template columns (CSS value) */
7
- columns?: string;
8
- /** Grid template rows (CSS value) */
9
- rows?: string;
7
+ /** Grid template columns CSS value or responsive object */
8
+ columns?: ResponsiveValue<string>;
9
+ /** Grid template rows CSS value or responsive object */
10
+ rows?: ResponsiveValue<string>;
10
11
  /** Gap between grid items (0-32 spacing multiplier or string) */
11
12
  gap?: SpacingValue;
12
13
  /** Row gap between grid items (0-32 spacing multiplier or string) */
@@ -1 +1 @@
1
- {"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../src/components/Grid/Grid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAO,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,YAAY,EACb,MAAM,kCAAkC,CAAC;AAM1C,MAAM,MAAM,YAAY,GAAG,IAAI,CAC7B,WAAW,EACT,SAAS,GACT,qBAAqB,GACrB,kBAAkB,GAClB,KAAK,GACL,QAAQ,GACR,WAAW,GACX,gBAAgB,GAChB,YAAY,CACf,GAAG;IACF,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,qCAAqC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iEAAiE;IACjE,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,qEAAqE;IACrE,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,wEAAwE;IACxE,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,gDAAgD;IAChD,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,gDAAgD;IAChD,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,wCAAwC;IACxC,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,yCAAyC;IACzC,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,WAAW,CAChE,CAAC,EACD,YAAY,CACb,CAAC;AAMF;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,EAClD,EAAE,EACF,OAAO,EACP,IAAI,EACJ,GAAG,EACH,MAAM,EACN,SAAS,EACT,OAAO,EACP,KAAK,EACL,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,SAAS,CAAC,CAAC,CAAC,2CAkBd"}
1
+ {"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../src/components/Grid/Grid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,OAAO,CAAC;AACzC,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAO,KAAK,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EACV,mBAAmB,EACnB,eAAe,EACf,YAAY,EACb,MAAM,kCAAkC,CAAC;AAM1C,MAAM,MAAM,YAAY,GAAG,IAAI,CAC7B,WAAW,EACT,SAAS,GACT,qBAAqB,GACrB,kBAAkB,GAClB,KAAK,GACL,QAAQ,GACR,WAAW,GACX,gBAAgB,GAChB,YAAY,CACf,GAAG;IACF,6DAA6D;IAC7D,OAAO,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAClC,0DAA0D;IAC1D,IAAI,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,iEAAiE;IACjE,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,qEAAqE;IACrE,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,wEAAwE;IACxE,SAAS,CAAC,EAAE,YAAY,CAAC;IACzB,gDAAgD;IAChD,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B,gDAAgD;IAChD,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB,wCAAwC;IACxC,cAAc,CAAC,EAAE,mBAAmB,CAAC;IACrC,yCAAyC;IACzC,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,IAAI,WAAW,CAChE,CAAC,EACD,YAAY,CACb,CAAC;AAMF;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,WAAW,GAAG,KAAK,EAAE,EAClD,EAAE,EACF,OAAO,EACP,IAAI,EACJ,GAAG,EACH,MAAM,EACN,SAAS,EACT,OAAO,EACP,KAAK,EACL,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,SAAS,CAAC,CAAC,CAAC,2CAkBd"}
@@ -1 +1 @@
1
- {"version":3,"file":"Grid.js","sources":["../../../src/components/Grid/Grid.tsx"],"sourcesContent":["import { type ElementType } from \"react\";\nimport { type Polymorphic } from \"@/types/Polymorphic\";\nimport { Box, type BoxOwnProps } from \"@/components/Box/Box\";\nimport type {\n JustifyContentValue,\n AlignItemsValue,\n SpacingValue,\n} from \"@/components/Box/flexbox/flexbox\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type GridOwnProps = Omit<\n BoxOwnProps,\n | \"display\"\n | \"gridTemplateColumns\"\n | \"gridTemplateRows\"\n | \"gap\"\n | \"gapRow\"\n | \"gapColumn\"\n | \"justifyContent\"\n | \"alignItems\"\n> & {\n /** Grid template columns (CSS value) */\n columns?: string;\n /** Grid template rows (CSS value) */\n rows?: string;\n /** Gap between grid items (0-32 spacing multiplier or string) */\n gap?: SpacingValue;\n /** Row gap between grid items (0-32 spacing multiplier or string) */\n gapRow?: SpacingValue;\n /** Column gap between grid items (0-32 spacing multiplier or string) */\n gapColumn?: SpacingValue;\n /** Justify items along the inline (row) axis */\n justify?: JustifyContentValue;\n /** Align items along the block (column) axis */\n align?: AlignItemsValue;\n /** Justify content (distribute rows) */\n justifyContent?: JustifyContentValue;\n /** Align content (distribute columns) */\n alignContent?: JustifyContentValue;\n};\n\nexport type GridProps<T extends ElementType = \"div\"> = Polymorphic<\n T,\n GridOwnProps\n>;\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Grid - Explicit CSS Grid layout component\n *\n * A polymorphic grid container with shorthand props:\n * - Default element: <div>\n * - Always renders with display=\"grid\"\n * - columns -> gridTemplateColumns\n * - rows -> gridTemplateRows\n * - gap, gapRow, gapColumn\n * - justify -> justifyItems (alignment within cells)\n * - align -> alignItems (alignment within cells)\n * - justifyContent, alignContent (distribution of grid tracks)\n */\nexport function Grid<T extends ElementType = \"div\">({\n as,\n columns,\n rows,\n gap,\n gapRow,\n gapColumn,\n justify,\n align,\n justifyContent,\n alignContent,\n children,\n ...rest\n}: GridProps<T>) {\n return (\n // @ts-expect-error - Polymorphic component type forwarding\n <Box\n as={as || \"div\"}\n display=\"grid\"\n gridTemplateColumns={columns}\n gridTemplateRows={rows}\n gap={gap}\n gapRow={gapRow}\n gapColumn={gapColumn}\n justifyContent={justify ?? justifyContent}\n alignItems={align ?? alignContent}\n {...rest}\n >\n {children}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;AAkEO,SAAS,KAAoC;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAiB;AACf;AAAA;AAAA,IAEE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAI,MAAM;AAAA,QACV,SAAQ;AAAA,QACR,qBAAqB;AAAA,QACrB,kBAAkB;AAAA,QAClB;AAAA,QACA;AAAA,QACA;AAAA,QACA,gBAAgB,WAAW;AAAA,QAC3B,YAAY,SAAS;AAAA,QACpB,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA;AAGP;"}
1
+ {"version":3,"file":"Grid.js","sources":["../../../src/components/Grid/Grid.tsx"],"sourcesContent":["import { type ElementType } from \"react\";\nimport { type Polymorphic } from \"@/types/Polymorphic\";\nimport type { ResponsiveValue } from \"@/utils/breakpoints\";\nimport { Box, type BoxOwnProps } from \"@/components/Box/Box\";\nimport type {\n JustifyContentValue,\n AlignItemsValue,\n SpacingValue,\n} from \"@/components/Box/flexbox/flexbox\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type GridOwnProps = Omit<\n BoxOwnProps,\n | \"display\"\n | \"gridTemplateColumns\"\n | \"gridTemplateRows\"\n | \"gap\"\n | \"gapRow\"\n | \"gapColumn\"\n | \"justifyContent\"\n | \"alignItems\"\n> & {\n /** Grid template columns CSS value or responsive object */\n columns?: ResponsiveValue<string>;\n /** Grid template rows CSS value or responsive object */\n rows?: ResponsiveValue<string>;\n /** Gap between grid items (0-32 spacing multiplier or string) */\n gap?: SpacingValue;\n /** Row gap between grid items (0-32 spacing multiplier or string) */\n gapRow?: SpacingValue;\n /** Column gap between grid items (0-32 spacing multiplier or string) */\n gapColumn?: SpacingValue;\n /** Justify items along the inline (row) axis */\n justify?: JustifyContentValue;\n /** Align items along the block (column) axis */\n align?: AlignItemsValue;\n /** Justify content (distribute rows) */\n justifyContent?: JustifyContentValue;\n /** Align content (distribute columns) */\n alignContent?: JustifyContentValue;\n};\n\nexport type GridProps<T extends ElementType = \"div\"> = Polymorphic<\n T,\n GridOwnProps\n>;\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Grid - Explicit CSS Grid layout component\n *\n * A polymorphic grid container with shorthand props:\n * - Default element: <div>\n * - Always renders with display=\"grid\"\n * - columns -> gridTemplateColumns\n * - rows -> gridTemplateRows\n * - gap, gapRow, gapColumn\n * - justify -> justifyItems (alignment within cells)\n * - align -> alignItems (alignment within cells)\n * - justifyContent, alignContent (distribution of grid tracks)\n */\nexport function Grid<T extends ElementType = \"div\">({\n as,\n columns,\n rows,\n gap,\n gapRow,\n gapColumn,\n justify,\n align,\n justifyContent,\n alignContent,\n children,\n ...rest\n}: GridProps<T>) {\n return (\n // @ts-expect-error - Polymorphic component type forwarding\n <Box\n as={as || \"div\"}\n display=\"grid\"\n gridTemplateColumns={columns}\n gridTemplateRows={rows}\n gap={gap}\n gapRow={gapRow}\n gapColumn={gapColumn}\n justifyContent={justify ?? justifyContent}\n alignItems={align ?? alignContent}\n {...rest}\n >\n {children}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;AAmEO,SAAS,KAAoC;AAAA,EAClD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAiB;AACf;AAAA;AAAA,IAEE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAI,MAAM;AAAA,QACV,SAAQ;AAAA,QACR,qBAAqB;AAAA,QACrB,kBAAkB;AAAA,QAClB;AAAA,QACA;AAAA,QACA;AAAA,QACA,gBAAgB,WAAW;AAAA,QAC3B,YAAY,SAAS;AAAA,QACpB,GAAG;AAAA,QAEH;AAAA,MAAA;AAAA,IAAA;AAAA;AAGP;"}