@tosui/react 0.1.3 → 0.1.5
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 +106 -60
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/Alert.js.map +1 -1
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js.map +1 -1
- package/dist/components/Box/Box.d.ts +2 -7
- package/dist/components/Box/Box.d.ts.map +1 -1
- package/dist/components/Box/Box.js +1 -1
- package/dist/components/Box/Box.js.map +1 -1
- package/dist/components/Box/borders/borders.d.ts +11 -13
- package/dist/components/Box/borders/borders.d.ts.map +1 -1
- package/dist/components/Box/borders/borders.js +29 -62
- package/dist/components/Box/borders/borders.js.map +1 -1
- package/dist/components/Box/borders/borders.module.css +936 -40
- package/dist/components/Box/borders/borders.module.css.js +600 -40
- package/dist/components/Box/borders/borders.module.css.js.map +1 -1
- package/dist/components/Box/colors/colors.d.ts +6 -8
- package/dist/components/Box/colors/colors.d.ts.map +1 -1
- package/dist/components/Box/colors/colors.js +20 -30
- package/dist/components/Box/colors/colors.js.map +1 -1
- package/dist/components/Box/colors/colors.module.css +2537 -108
- package/dist/components/Box/colors/colors.module.css.js +1620 -108
- package/dist/components/Box/colors/colors.module.css.js.map +1 -1
- package/dist/components/Box/display/display.d.ts +2 -8
- package/dist/components/Box/display/display.d.ts.map +1 -1
- package/dist/components/Box/display/display.js +10 -33
- package/dist/components/Box/display/display.js.map +1 -1
- package/dist/components/Box/flexbox/flexbox.d.ts +12 -14
- package/dist/components/Box/flexbox/flexbox.d.ts.map +1 -1
- package/dist/components/Box/flexbox/flexbox.js +39 -102
- package/dist/components/Box/flexbox/flexbox.js.map +1 -1
- package/dist/components/Box/flexbox/flexbox.module.css +1210 -56
- package/dist/components/Box/flexbox/flexbox.module.css.js +727 -55
- package/dist/components/Box/flexbox/flexbox.module.css.js.map +1 -1
- package/dist/components/Box/grid/grid.d.ts +3 -2
- package/dist/components/Box/grid/grid.d.ts.map +1 -1
- package/dist/components/Box/grid/grid.js +24 -15
- package/dist/components/Box/grid/grid.js.map +1 -1
- package/dist/components/Box/grid/grid.module.css +68 -18
- package/dist/components/Box/grid/grid.module.css.js +14 -14
- package/dist/components/Box/inset/inset.d.ts.map +1 -1
- package/dist/components/Box/inset/inset.js +8 -52
- package/dist/components/Box/inset/inset.js.map +1 -1
- package/dist/components/Box/inset/inset.module.css +120 -120
- package/dist/components/Box/inset/inset.module.css.js +21 -161
- package/dist/components/Box/inset/inset.module.css.js.map +1 -1
- package/dist/components/Box/interactions/interactions.d.ts +6 -8
- package/dist/components/Box/interactions/interactions.d.ts.map +1 -1
- package/dist/components/Box/interactions/interactions.js +20 -30
- package/dist/components/Box/interactions/interactions.js.map +1 -1
- package/dist/components/Box/interactions/interactions.module.css +891 -38
- package/dist/components/Box/interactions/interactions.module.css.js +570 -38
- package/dist/components/Box/interactions/interactions.module.css.js.map +1 -1
- package/dist/components/Box/margin/margin.d.ts.map +1 -1
- package/dist/components/Box/margin/margin.js +8 -52
- package/dist/components/Box/margin/margin.js.map +1 -1
- package/dist/components/Box/margin/margin.module.css +120 -120
- package/dist/components/Box/margin/margin.module.css.js +21 -161
- package/dist/components/Box/margin/margin.module.css.js.map +1 -1
- package/dist/components/Box/opacity/opacity.d.ts +2 -8
- package/dist/components/Box/opacity/opacity.d.ts.map +1 -1
- package/dist/components/Box/opacity/opacity.js +10 -33
- package/dist/components/Box/opacity/opacity.js.map +1 -1
- package/dist/components/Box/overflow/overflow.d.ts +2 -8
- package/dist/components/Box/overflow/overflow.d.ts.map +1 -1
- package/dist/components/Box/overflow/overflow.js +24 -29
- package/dist/components/Box/overflow/overflow.js.map +1 -1
- package/dist/components/Box/padding/padding.d.ts.map +1 -1
- package/dist/components/Box/padding/padding.js +8 -52
- package/dist/components/Box/padding/padding.js.map +1 -1
- package/dist/components/Box/padding/padding.module.css +120 -120
- package/dist/components/Box/padding/padding.module.css.js +21 -161
- package/dist/components/Box/padding/padding.module.css.js.map +1 -1
- package/dist/components/Box/position/position.d.ts +2 -8
- package/dist/components/Box/position/position.d.ts.map +1 -1
- package/dist/components/Box/position/position.js +10 -33
- package/dist/components/Box/position/position.js.map +1 -1
- package/dist/components/Box/roundness/roundness.d.ts +12 -14
- package/dist/components/Box/roundness/roundness.d.ts.map +1 -1
- package/dist/components/Box/roundness/roundness.js +26 -62
- package/dist/components/Box/roundness/roundness.js.map +1 -1
- package/dist/components/Box/roundness/roundness.module.css +937 -40
- package/dist/components/Box/roundness/roundness.module.css.js +600 -40
- package/dist/components/Box/roundness/roundness.module.css.js.map +1 -1
- package/dist/components/Box/shadows/shadows.d.ts +2 -8
- package/dist/components/Box/shadows/shadows.d.ts.map +1 -1
- package/dist/components/Box/shadows/shadows.js +10 -33
- package/dist/components/Box/shadows/shadows.js.map +1 -1
- package/dist/components/Box/shared/index.d.ts +1 -0
- package/dist/components/Box/shared/index.d.ts.map +1 -1
- package/dist/components/Box/shared/responsive.d.ts +36 -0
- package/dist/components/Box/shared/responsive.d.ts.map +1 -0
- package/dist/components/Box/shared/responsive.js +65 -0
- package/dist/components/Box/shared/responsive.js.map +1 -0
- package/dist/components/Box/shared/types.d.ts +6 -0
- package/dist/components/Box/shared/types.d.ts.map +1 -1
- package/dist/components/Box/sizing/sizing.d.ts.map +1 -1
- package/dist/components/Box/sizing/sizing.js +5 -37
- package/dist/components/Box/sizing/sizing.js.map +1 -1
- package/dist/components/Box/sizing/sizing.module.css +175 -183
- package/dist/components/Box/sizing/sizing.module.css.js +31 -241
- package/dist/components/Box/sizing/sizing.module.css.js.map +1 -1
- package/dist/components/Box/text/text.d.ts +6 -8
- package/dist/components/Box/text/text.d.ts.map +1 -1
- package/dist/components/Box/text/text.js +24 -30
- package/dist/components/Box/text/text.js.map +1 -1
- package/dist/components/Box/text/text.module.css +562 -24
- package/dist/components/Box/text/text.module.css.js +360 -24
- package/dist/components/Box/text/text.module.css.js.map +1 -1
- package/dist/components/Box/typography/typography.d.ts +7 -9
- package/dist/components/Box/typography/typography.d.ts.map +1 -1
- package/dist/components/Box/typography/typography.js +33 -19
- package/dist/components/Box/typography/typography.js.map +1 -1
- package/dist/components/Box/typography/typography.module.css +890 -19
- package/dist/components/Box/typography/typography.module.css.js +570 -19
- package/dist/components/Box/typography/typography.module.css.js.map +1 -1
- package/dist/components/Box/zIndex/zIndex.d.ts +2 -8
- package/dist/components/Box/zIndex/zIndex.d.ts.map +1 -1
- package/dist/components/Box/zIndex/zIndex.js +10 -33
- package/dist/components/Box/zIndex/zIndex.js.map +1 -1
- package/dist/components/Flex/Flex.d.ts +5 -6
- package/dist/components/Flex/Flex.d.ts.map +1 -1
- package/dist/components/Flex/Flex.js +0 -1
- package/dist/components/Flex/Flex.js.map +1 -1
- package/dist/components/Grid/Grid.d.ts +8 -7
- package/dist/components/Grid/Grid.d.ts.map +1 -1
- package/dist/components/Grid/Grid.js.map +1 -1
- package/dist/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/IconButton/IconButton.js.map +1 -1
- package/dist/components/Menu/Menu.d.ts.map +1 -1
- package/dist/components/Menu/Menu.js +5 -5
- package/dist/components/Menu/Menu.js.map +1 -1
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/Popover/Popover.js +9 -9
- package/dist/components/Popover/Popover.js.map +1 -1
- package/dist/components/Progress/Progress.d.ts.map +1 -1
- package/dist/components/Progress/Progress.js.map +1 -1
- package/dist/components/Stack/Stack.d.ts +2 -1
- package/dist/components/Stack/Stack.d.ts.map +1 -1
- package/dist/components/Stack/Stack.js.map +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +5 -5
- package/dist/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/index.css +9313 -1632
- package/dist/styles/styles.css +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,73 +1,119 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @tosui/react
|
|
2
2
|
|
|
3
|
-
|
|
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
|
-
|
|
5
|
+
## Installation
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
59
|
+
4px base unit with multipliers 0–32:
|
|
11
60
|
|
|
12
|
-
|
|
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
|
-
|
|
69
|
+
Mobile-first breakpoints — `base` (0), `sm` (640px), `md` (768px), `lg` (1024px), `xl` (1280px), `2xl` (1536px):
|
|
15
70
|
|
|
16
|
-
|
|
71
|
+
```tsx
|
|
72
|
+
<Box p={{ base: 2, md: 4, lg: 6 }} />
|
|
73
|
+
<Box display={{ base: "none", md: "block" }} />
|
|
74
|
+
```
|
|
17
75
|
|
|
18
|
-
|
|
19
|
-
export default defineConfig([
|
|
20
|
-
globalIgnores(['dist']),
|
|
21
|
-
{
|
|
22
|
-
files: ['**/*.{ts,tsx}'],
|
|
23
|
-
extends: [
|
|
24
|
-
// Other configs...
|
|
76
|
+
### Color Tokens
|
|
25
77
|
|
|
26
|
-
|
|
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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/components/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Alert.d.ts","sourceRoot":"","sources":["../../../src/components/Alert/Alert.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAYvC,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AAEnE,MAAM,MAAM,UAAU,GAAG;IACvB,gDAAgD;IAChD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,iDAAiD;IACjD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,0BAA0B;IAC1B,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,sDAAsD;IACtD,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,wEAAwE;IACxE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AA+DF;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,EACpB,MAAe,EACf,KAAK,EACL,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,SAAS,GACV,EAAE,UAAU,2CA4DZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.js","sources":["../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport clsx from \"clsx\";\nimport { Box } from \"@/components/Box/Box\";\nimport { HStack } from \"@/components/HStack/HStack\";\nimport { VStack } from \"@/components/VStack/VStack\";\nimport styles from \"./alert.module.css\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type AlertStatus = \"success\" | \"warning\" | \"error\" | \"info\";\n\nexport type AlertProps = {\n /** Status determines colors and default icon */\n status?: AlertStatus;\n /** Optional title displayed above description */\n title?: ReactNode;\n /** Description content */\n children?: ReactNode;\n /** Custom icon (overrides default per-status icon) */\n icon?: ReactNode;\n /** Callback when close button is clicked (omit to hide close button) */\n onClose?: () => void;\n /** Additional class name */\n className?: string;\n};\n\n// ============================================================================\n// Default icons per status (simple SVG)\n// ============================================================================\n\nconst defaultIcons: Record<AlertStatus, ReactNode> = {\n success: (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <path\n fillRule=\"evenodd\"\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\"\n clipRule=\"evenodd\"\n />\n </svg>\n ),\n warning: (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <path\n fillRule=\"evenodd\"\n d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\"\n clipRule=\"evenodd\"\n />\n </svg>\n ),\n error: (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <path\n fillRule=\"evenodd\"\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\"\n clipRule=\"evenodd\"\n />\n </svg>\n ),\n info: (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <path\n fillRule=\"evenodd\"\n d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\"\n clipRule=\"evenodd\"\n />\n </svg>\n ),\n};\n\n// ============================================================================\n// Close button icon\n// ============================================================================\n\nconst CloseIcon = (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path\n fillRule=\"evenodd\"\n d=\"M4.293 4.293a1 1 0 011.414 0L8 6.586l2.293-2.293a1 1 0 111.414 1.414L9.414 8l2.293 2.293a1 1 0 01-1.414 1.414L8 9.414l-2.293 2.293a1 1 0 01-1.414-1.414L6.586 8 4.293 5.707a1 1 0 010-1.414z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Alert - Status notification banner\n *\n * A contextual feedback component that provides:\n * - Four status variants: success, warning, error, info\n * - Optional title and description\n * - Default icons per status (customizable)\n * - Optional close button\n * - Accessible with role=\"alert\"\n */\nexport function Alert({\n status = \"info\",\n title,\n children,\n icon,\n onClose,\n className,\n}: AlertProps) {\n const displayIcon = icon ?? defaultIcons[status];\n\n return (\n <Box\n role=\"alert\"\n p={4}\n rounded=\"md\"\n bg={`${status}-subtle` as
|
|
1
|
+
{"version":3,"file":"Alert.js","sources":["../../../src/components/Alert/Alert.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport type { BackgroundColorValue, ColorValue } from \"@/components/Box/colors/colors\";\nimport clsx from \"clsx\";\nimport { Box } from \"@/components/Box/Box\";\nimport { HStack } from \"@/components/HStack/HStack\";\nimport { VStack } from \"@/components/VStack/VStack\";\nimport styles from \"./alert.module.css\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type AlertStatus = \"success\" | \"warning\" | \"error\" | \"info\";\n\nexport type AlertProps = {\n /** Status determines colors and default icon */\n status?: AlertStatus;\n /** Optional title displayed above description */\n title?: ReactNode;\n /** Description content */\n children?: ReactNode;\n /** Custom icon (overrides default per-status icon) */\n icon?: ReactNode;\n /** Callback when close button is clicked (omit to hide close button) */\n onClose?: () => void;\n /** Additional class name */\n className?: string;\n};\n\n// ============================================================================\n// Default icons per status (simple SVG)\n// ============================================================================\n\nconst defaultIcons: Record<AlertStatus, ReactNode> = {\n success: (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <path\n fillRule=\"evenodd\"\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z\"\n clipRule=\"evenodd\"\n />\n </svg>\n ),\n warning: (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <path\n fillRule=\"evenodd\"\n d=\"M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z\"\n clipRule=\"evenodd\"\n />\n </svg>\n ),\n error: (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <path\n fillRule=\"evenodd\"\n d=\"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z\"\n clipRule=\"evenodd\"\n />\n </svg>\n ),\n info: (\n <svg width=\"20\" height=\"20\" viewBox=\"0 0 20 20\" fill=\"currentColor\">\n <path\n fillRule=\"evenodd\"\n d=\"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z\"\n clipRule=\"evenodd\"\n />\n </svg>\n ),\n};\n\n// ============================================================================\n// Close button icon\n// ============================================================================\n\nconst CloseIcon = (\n <svg width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"currentColor\">\n <path\n fillRule=\"evenodd\"\n d=\"M4.293 4.293a1 1 0 011.414 0L8 6.586l2.293-2.293a1 1 0 111.414 1.414L9.414 8l2.293 2.293a1 1 0 01-1.414 1.414L8 9.414l-2.293 2.293a1 1 0 01-1.414-1.414L6.586 8 4.293 5.707a1 1 0 010-1.414z\"\n clipRule=\"evenodd\"\n />\n </svg>\n);\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Alert - Status notification banner\n *\n * A contextual feedback component that provides:\n * - Four status variants: success, warning, error, info\n * - Optional title and description\n * - Default icons per status (customizable)\n * - Optional close button\n * - Accessible with role=\"alert\"\n */\nexport function Alert({\n status = \"info\",\n title,\n children,\n icon,\n onClose,\n className,\n}: AlertProps) {\n const displayIcon = icon ?? defaultIcons[status];\n\n return (\n <Box\n role=\"alert\"\n p={4}\n rounded=\"md\"\n bg={`${status}-subtle` as BackgroundColorValue}\n className={clsx(styles.alert, styles[status], className)}\n >\n <HStack gap={3} align=\"start\">\n {/* Icon */}\n <Box\n as=\"span\"\n display=\"inline-flex\"\n alignItems=\"center\"\n flexShrink={0}\n color={status as ColorValue}\n aria-hidden=\"true\"\n >\n {displayIcon}\n </Box>\n\n {/* Content */}\n <VStack gap={1} flexGrow={1}>\n {title && (\n <Box as=\"span\" fontWeight=\"semibold\" color=\"foreground\">\n {title}\n </Box>\n )}\n {children && (\n <Box as=\"span\" color=\"foreground-muted\" fontSize=\"sm\">\n {children}\n </Box>\n )}\n </VStack>\n\n {/* Close button */}\n {onClose && (\n <Box\n as=\"button\"\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n p={1}\n rounded=\"sm\"\n bg=\"transparent\"\n color=\"foreground-muted\"\n cursor=\"pointer\"\n className={styles.closeButton}\n onClick={onClose}\n aria-label=\"Dismiss\"\n >\n {CloseIcon}\n </Box>\n )}\n </HStack>\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;;;AAiCA,MAAM,eAA+C;AAAA,EACnD,SACE,oBAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,gBACnD,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAS;AAAA,MACT,GAAE;AAAA,MACF,UAAS;AAAA,IAAA;AAAA,EAAA,GAEb;AAAA,EAEF,SACE,oBAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,gBACnD,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAS;AAAA,MACT,GAAE;AAAA,MACF,UAAS;AAAA,IAAA;AAAA,EAAA,GAEb;AAAA,EAEF,OACE,oBAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,gBACnD,UAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,UAAS;AAAA,MACT,GAAE;AAAA,MACF,UAAS;AAAA,IAAA;AAAA,EAAA,GAEb;AAAA,EAEF,MACE,oBAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,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AAAA,YACX,gBAAe;AAAA,YACf,GAAG;AAAA,YACH,SAAQ;AAAA,YACR,IAAG;AAAA,YACH,OAAM;AAAA,YACN,QAAO;AAAA,YACP,WAAW,OAAO;AAAA,YAClB,SAAS;AAAA,YACT,cAAW;AAAA,YAEV,UAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACH,EAAA,CAEJ;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Badge.d.ts","sourceRoot":"","sources":["../../../src/components/Badge/Badge.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAUvC,MAAM,MAAM,gBAAgB,GACxB,SAAS,GACT,QAAQ,GACR,SAAS,GACT,SAAS,GACT,OAAO,GACP,MAAM,GACN,MAAM,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,CAAC;AAC9C,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpC,MAAM,MAAM,UAAU,GAAG;IACvB,mBAAmB;IACnB,WAAW,CAAC,EAAE,gBAAgB,CAAC;IAC/B,qBAAqB;IACrB,OAAO,CAAC,EAAE,YAAY,CAAC;IACvB,WAAW;IACX,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,oBAAoB;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAuDF;;;;;;;;;;;;;GAaG;AACH,wBAAgB,KAAK,CAAC,EACpB,WAAoB,EACpB,OAAkB,EAClB,IAAW,EACX,QAAQ,EACR,SAAS,GACV,EAAE,UAAU,2CAuBZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport clsx from \"clsx\";\nimport { Box } from \"@/components/Box/Box\";\nimport styles from \"./badge.module.css\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type BadgeColorScheme =\n | \"primary\"\n | \"accent\"\n | \"success\"\n | \"warning\"\n | \"error\"\n | \"info\"\n | \"gray\";\n\nexport type BadgeVariant = \"solid\" | \"subtle\";\nexport type BadgeSize = \"sm\" | \"md\";\n\nexport type BadgeProps = {\n /** Color scheme */\n colorScheme?: BadgeColorScheme;\n /** Visual variant */\n variant?: BadgeVariant;\n /** Size */\n size?: BadgeSize;\n /** Badge content */\n children?: ReactNode;\n /** Additional class name */\n className?: string;\n};\n\n// ============================================================================\n// Size configurations\n// ============================================================================\n\nconst sizeConfig = {\n sm: { fontSize: \"xs\", px: 1.5, py: 0.5 },\n md: { fontSize: \"sm\", px: 2, py: 0.5 },\n} as const;\n\n// ============================================================================\n// Color configurations\n// ============================================================================\n\ntype ColorConfig = {\n bg: string;\n color: string;\n};\n\nfunction getColorConfig(\n variant: BadgeVariant,\n colorScheme: BadgeColorScheme\n): ColorConfig {\n // Handle \"gray\" colorScheme specially since it uses different token names\n if (colorScheme === \"gray\") {\n if (variant === \"solid\") {\n return {\n bg: \"foreground\",\n color: \"foreground-inverted\",\n };\n }\n return {\n bg: \"surface\",\n color: \"foreground-muted\",\n };\n }\n\n if (variant === \"solid\") {\n return {\n bg: `${colorScheme}-default`,\n color: \"foreground-inverted\",\n };\n }\n\n return {\n bg: `${colorScheme}-subtle`,\n color: colorScheme,\n };\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Badge - Small status indicator\n *\n * A compact label component for displaying:\n * - Counts and numbers\n * - Status indicators\n * - Categories and tags\n *\n * Features:\n * - 7 color schemes: primary, accent, success, warning, error, info, gray\n * - 2 variants: solid (bold) and subtle (muted)\n * - 2 sizes: sm and md\n * - Pill shape (fully rounded)\n */\nexport function Badge({\n colorScheme = \"gray\",\n variant = \"subtle\",\n size = \"md\",\n children,\n className,\n}: BadgeProps) {\n const colorConfig = getColorConfig(variant, colorScheme);\n const sizeProps = sizeConfig[size];\n\n return (\n <Box\n as=\"span\"\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n px={sizeProps.px}\n py={sizeProps.py}\n fontSize={sizeProps.fontSize}\n fontWeight=\"medium\"\n lineHeight=\"tight\"\n rounded=\"full\"\n bg={colorConfig.bg as
|
|
1
|
+
{"version":3,"file":"Badge.js","sources":["../../../src/components/Badge/Badge.tsx"],"sourcesContent":["import { type ReactNode } from \"react\";\nimport type { BackgroundColorValue, ColorValue } from \"@/components/Box/colors/colors\";\nimport clsx from \"clsx\";\nimport { Box } from \"@/components/Box/Box\";\nimport styles from \"./badge.module.css\";\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport type BadgeColorScheme =\n | \"primary\"\n | \"accent\"\n | \"success\"\n | \"warning\"\n | \"error\"\n | \"info\"\n | \"gray\";\n\nexport type BadgeVariant = \"solid\" | \"subtle\";\nexport type BadgeSize = \"sm\" | \"md\";\n\nexport type BadgeProps = {\n /** Color scheme */\n colorScheme?: BadgeColorScheme;\n /** Visual variant */\n variant?: BadgeVariant;\n /** Size */\n size?: BadgeSize;\n /** Badge content */\n children?: ReactNode;\n /** Additional class name */\n className?: string;\n};\n\n// ============================================================================\n// Size configurations\n// ============================================================================\n\nconst sizeConfig = {\n sm: { fontSize: \"xs\", px: 1.5, py: 0.5 },\n md: { fontSize: \"sm\", px: 2, py: 0.5 },\n} as const;\n\n// ============================================================================\n// Color configurations\n// ============================================================================\n\ntype ColorConfig = {\n bg: string;\n color: string;\n};\n\nfunction getColorConfig(\n variant: BadgeVariant,\n colorScheme: BadgeColorScheme\n): ColorConfig {\n // Handle \"gray\" colorScheme specially since it uses different token names\n if (colorScheme === \"gray\") {\n if (variant === \"solid\") {\n return {\n bg: \"foreground\",\n color: \"foreground-inverted\",\n };\n }\n return {\n bg: \"surface\",\n color: \"foreground-muted\",\n };\n }\n\n if (variant === \"solid\") {\n return {\n bg: `${colorScheme}-default`,\n color: \"foreground-inverted\",\n };\n }\n\n return {\n bg: `${colorScheme}-subtle`,\n color: colorScheme,\n };\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Badge - Small status indicator\n *\n * A compact label component for displaying:\n * - Counts and numbers\n * - Status indicators\n * - Categories and tags\n *\n * Features:\n * - 7 color schemes: primary, accent, success, warning, error, info, gray\n * - 2 variants: solid (bold) and subtle (muted)\n * - 2 sizes: sm and md\n * - Pill shape (fully rounded)\n */\nexport function Badge({\n colorScheme = \"gray\",\n variant = \"subtle\",\n size = \"md\",\n children,\n className,\n}: BadgeProps) {\n const colorConfig = getColorConfig(variant, colorScheme);\n const sizeProps = sizeConfig[size];\n\n return (\n <Box\n as=\"span\"\n display=\"inline-flex\"\n alignItems=\"center\"\n justifyContent=\"center\"\n px={sizeProps.px}\n py={sizeProps.py}\n fontSize={sizeProps.fontSize}\n fontWeight=\"medium\"\n lineHeight=\"tight\"\n rounded=\"full\"\n bg={colorConfig.bg as BackgroundColorValue}\n color={colorConfig.color as ColorValue}\n className={clsx(styles.badge, className)}\n >\n {children}\n </Box>\n );\n}\n"],"names":[],"mappings":";;;;;AAuCA,MAAM,aAAa;AAAA,EACjB,IAAI,EAAE,UAAU,MAAM,IAAI,KAAK,IAAI,IAAA;AAAA,EACnC,IAAI,EAAE,UAAU,MAAM,IAAI,GAAG,IAAI,IAAA;AACnC;AAWA,SAAS,eACP,SACA,aACa;AAEb,MAAI,gBAAgB,QAAQ;AAC1B,QAAI,YAAY,SAAS;AACvB,aAAO;AAAA,QACL,IAAI;AAAA,QACJ,OAAO;AAAA,MAAA;AAAA,IAEX;AACA,WAAO;AAAA,MACL,IAAI;AAAA,MACJ,OAAO;AAAA,IAAA;AAAA,EAEX;AAEA,MAAI,YAAY,SAAS;AACvB,WAAO;AAAA,MACL,IAAI,GAAG,WAAW;AAAA,MAClB,OAAO;AAAA,IAAA;AAAA,EAEX;AAEA,SAAO;AAAA,IACL,IAAI,GAAG,WAAW;AAAA,IAClB,OAAO;AAAA,EAAA;AAEX;AAoBO,SAAS,MAAM;AAAA,EACpB,cAAc;AAAA,EACd,UAAU;AAAA,EACV,OAAO;AAAA,EACP;AAAA,EACA;AACF,GAAe;AACb,QAAM,cAAc,eAAe,SAAS,WAAW;AACvD,QAAM,YAAY,WAAW,IAAI;AAEjC,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,IAAG;AAAA,MACH,SAAQ;AAAA,MACR,YAAW;AAAA,MACX,gBAAe;AAAA,MACf,IAAI,UAAU;AAAA,MACd,IAAI,UAAU;AAAA,MACd,UAAU,UAAU;AAAA,MACpB,YAAW;AAAA,MACX,YAAW;AAAA,MACX,SAAQ;AAAA,MACR,IAAI,YAAY;AAAA,MAChB,OAAO,YAAY;AAAA,MACnB,WAAW,KAAK,OAAO,OAAO,SAAS;AAAA,MAEtC;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ElementType, ReactNode } from 'react';
|
|
2
2
|
import { Polymorphic } from '../../types/Polymorphic';
|
|
3
|
+
import { StateProps } from './shared';
|
|
3
4
|
import { MarginProps } from './margin/margin';
|
|
4
5
|
import { PaddingProps } from './padding/padding';
|
|
5
6
|
import { SizingProps } from './sizing/sizing';
|
|
@@ -19,13 +20,7 @@ import { RoundnessProps } from './roundness/roundness';
|
|
|
19
20
|
import { FlexboxProps } from './flexbox/flexbox';
|
|
20
21
|
import { GridProps } from './grid/grid';
|
|
21
22
|
type StateStyleProps = MarginProps & PaddingProps & SizingProps & InsetProps & DisplayProps & PositionProps & OverflowProps & ZIndexProps & ShadowProps & OpacityProps & InteractionProps & TextStyleProps & TypographyProps & ColorProps & BorderProps & RoundnessProps & FlexboxProps & GridProps;
|
|
22
|
-
type
|
|
23
|
-
_hover?: StateStyleProps;
|
|
24
|
-
_focus?: StateStyleProps;
|
|
25
|
-
_active?: StateStyleProps;
|
|
26
|
-
_disabled?: StateStyleProps;
|
|
27
|
-
};
|
|
28
|
-
export type BoxOwnProps = MarginProps & PaddingProps & SizingProps & InsetProps & DisplayProps & PositionProps & OverflowProps & ZIndexProps & ShadowProps & OpacityProps & InteractionProps & TextStyleProps & TypographyProps & ColorProps & BorderProps & RoundnessProps & FlexboxProps & GridProps & StateProps & {
|
|
23
|
+
export type BoxOwnProps = MarginProps & PaddingProps & SizingProps & InsetProps & DisplayProps & PositionProps & OverflowProps & ZIndexProps & ShadowProps & OpacityProps & InteractionProps & TextStyleProps & TypographyProps & ColorProps & BorderProps & RoundnessProps & FlexboxProps & GridProps & StateProps<StateStyleProps> & {
|
|
29
24
|
className?: string;
|
|
30
25
|
children?: ReactNode;
|
|
31
26
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAsB,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,SAAS,EAAsB,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAE3C,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAmB,KAAK,WAAW,EAAE,MAAM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ACT,QAAQ,EACR,GAAG,EACH,MAAM,EACN,SAAS,EACT,IAAI,EACJ,QAAQ,EACR,UAAU,EACV,SAAS,EAET,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAEhB,MAAM,EACN,MAAM,EACN,OAAO,EACP,SAAS,EACT,GAAG,IAAI,EACR,EAAE,QAAQ,CAAC,CAAC,CAAC,2CA8Eb"}
|
|
@@ -151,7 +151,7 @@ function Box({
|
|
|
151
151
|
getOpacityStyles({ opacity, ...stateProps }),
|
|
152
152
|
getInteractionStyles({ cursor, pointerEvents, userSelect, ...stateProps }),
|
|
153
153
|
getTextStyles({ textAlign, whiteSpace, textDecoration, ...stateProps }),
|
|
154
|
-
getTypographyStyles({ fontSize, fontFamily, fontWeight, lineHeight }),
|
|
154
|
+
getTypographyStyles({ fontSize, fontFamily, fontWeight, lineHeight, ...stateProps }),
|
|
155
155
|
getColorStyles({ color, bg, borderColor, ...stateProps }),
|
|
156
156
|
getBorderStyles({
|
|
157
157
|
border,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Box.js","sources":["../../../src/components/Box/Box.tsx"],"sourcesContent":["import { type ElementType, type ReactNode, type CSSProperties } from \"react\";\nimport { type Polymorphic } from \"@/types/Polymorphic\";\nimport { clsx } from \"clsx\";\nimport { resetClass } from \"./reset/reset\";\nimport { getMarginStyles, type MarginProps } from \"./margin/margin\";\nimport { getPaddingStyles, type PaddingProps } from \"./padding/padding\";\nimport { getSizingStyles, type SizingProps } from \"./sizing/sizing\";\nimport { getInsetStyles, type InsetProps } from \"./inset/inset\";\nimport { getDisplayStyles, type DisplayProps } from \"./display/display\";\nimport { getPositionStyles, type PositionProps } from \"./position/position\";\nimport { getOverflowStyles, type OverflowProps } from \"./overflow/overflow\";\nimport { getZIndexStyles, type ZIndexProps } from \"./zIndex/zIndex\";\nimport { getShadowStyles, type ShadowProps } from \"./shadows/shadows\";\nimport { getOpacityStyles, type OpacityProps } from \"./opacity/opacity\";\nimport {\n getInteractionStyles,\n type InteractionProps,\n} from \"./interactions/interactions\";\nimport { getTextStyles, type TextStyleProps } from \"./text/text\";\nimport {\n getTypographyStyles,\n type TypographyProps,\n} from \"./typography/typography\";\nimport { getColorStyles, type ColorProps } from \"./colors/colors\";\nimport { getBorderStyles, type BorderProps } from \"./borders/borders\";\nimport { getRoundnessStyles, type RoundnessProps } from \"./roundness/roundness\";\nimport { getFlexboxStyles, type FlexboxProps } from \"./flexbox/flexbox\";\nimport { getGridStyles, type GridProps } from \"./grid/grid\";\n\n// Combined state props for all style parts\ntype StateStyleProps = MarginProps &\n PaddingProps &\n SizingProps &\n InsetProps &\n DisplayProps &\n PositionProps &\n OverflowProps &\n ZIndexProps &\n ShadowProps &\n OpacityProps &\n InteractionProps &\n TextStyleProps &\n TypographyProps &\n ColorProps &\n BorderProps &\n RoundnessProps &\n FlexboxProps &\n GridProps;\n\
|
|
1
|
+
{"version":3,"file":"Box.js","sources":["../../../src/components/Box/Box.tsx"],"sourcesContent":["import { type ElementType, type ReactNode, type CSSProperties } from \"react\";\nimport { type Polymorphic } from \"@/types/Polymorphic\";\nimport { clsx } from \"clsx\";\nimport { type StateProps } from \"./shared\";\nimport { resetClass } from \"./reset/reset\";\nimport { getMarginStyles, type MarginProps } from \"./margin/margin\";\nimport { getPaddingStyles, type PaddingProps } from \"./padding/padding\";\nimport { getSizingStyles, type SizingProps } from \"./sizing/sizing\";\nimport { getInsetStyles, type InsetProps } from \"./inset/inset\";\nimport { getDisplayStyles, type DisplayProps } from \"./display/display\";\nimport { getPositionStyles, type PositionProps } from \"./position/position\";\nimport { getOverflowStyles, type OverflowProps } from \"./overflow/overflow\";\nimport { getZIndexStyles, type ZIndexProps } from \"./zIndex/zIndex\";\nimport { getShadowStyles, type ShadowProps } from \"./shadows/shadows\";\nimport { getOpacityStyles, type OpacityProps } from \"./opacity/opacity\";\nimport {\n getInteractionStyles,\n type InteractionProps,\n} from \"./interactions/interactions\";\nimport { getTextStyles, type TextStyleProps } from \"./text/text\";\nimport {\n getTypographyStyles,\n type TypographyProps,\n} from \"./typography/typography\";\nimport { getColorStyles, type ColorProps } from \"./colors/colors\";\nimport { getBorderStyles, type BorderProps } from \"./borders/borders\";\nimport { getRoundnessStyles, type RoundnessProps } from \"./roundness/roundness\";\nimport { getFlexboxStyles, type FlexboxProps } from \"./flexbox/flexbox\";\nimport { getGridStyles, type GridProps } from \"./grid/grid\";\n\n// Combined state props for all style parts\ntype StateStyleProps = MarginProps &\n PaddingProps &\n SizingProps &\n InsetProps &\n DisplayProps &\n PositionProps &\n OverflowProps &\n ZIndexProps &\n ShadowProps &\n OpacityProps &\n InteractionProps &\n TextStyleProps &\n TypographyProps &\n ColorProps &\n BorderProps &\n RoundnessProps &\n FlexboxProps &\n GridProps;\n\nexport type BoxOwnProps = MarginProps &\n PaddingProps &\n SizingProps &\n InsetProps &\n DisplayProps &\n PositionProps &\n OverflowProps &\n ZIndexProps &\n ShadowProps &\n OpacityProps &\n InteractionProps &\n TextStyleProps &\n TypographyProps &\n ColorProps &\n BorderProps &\n RoundnessProps &\n FlexboxProps &\n GridProps &\n StateProps<StateStyleProps> & {\n className?: string;\n children?: ReactNode;\n };\n\nexport type BoxProps<T extends ElementType = \"div\"> = Polymorphic<\n T,\n BoxOwnProps\n>;\n\n// Helper to combine multiple style results\ntype StyleResult = {\n className?: string;\n style?: CSSProperties;\n};\n\nfunction combineStyles(...results: StyleResult[]): StyleResult {\n return {\n className: clsx(...results.map((r) => r.className)),\n style: Object.assign({}, ...results.map((r) => r.style)),\n };\n}\n\nexport function Box<T extends ElementType = \"div\">({\n as,\n children,\n className,\n style,\n // Margin props\n m,\n mt,\n mr,\n mb,\n ml,\n mx,\n my,\n // Padding props\n p,\n pt,\n pr,\n pb,\n pl,\n px,\n py,\n // Sizing props\n w,\n h,\n minW,\n maxW,\n minH,\n maxH,\n // Inset props\n inset,\n insetX,\n insetY,\n top,\n right,\n bottom,\n left,\n // Display props\n display,\n // Position props\n position,\n // Overflow props\n overflow,\n overflowX,\n overflowY,\n // ZIndex props\n zIndex,\n // Shadow props\n shadow,\n // Opacity props\n opacity,\n // Interaction props\n cursor,\n pointerEvents,\n userSelect,\n // Text style props\n textAlign,\n whiteSpace,\n textDecoration,\n // Typography props\n fontSize,\n fontFamily,\n fontWeight,\n lineHeight,\n // Color props\n color,\n bg,\n borderColor,\n // Border props\n border,\n borderX,\n borderY,\n borderTop,\n borderRight,\n borderBottom,\n borderLeft,\n borderStyle,\n // Roundness props\n rounded,\n roundedTop,\n roundedBottom,\n roundedLeft,\n roundedRight,\n roundedTopLeft,\n roundedTopRight,\n roundedBottomLeft,\n roundedBottomRight,\n // Flexbox props\n flexDirection,\n justifyContent,\n alignItems,\n alignSelf,\n flexWrap,\n gap,\n gapRow,\n gapColumn,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n // Grid props\n justifySelf,\n gridTemplateColumns,\n gridTemplateRows,\n // State props\n _hover,\n _focus,\n _active,\n _disabled,\n ...rest\n}: BoxProps<T>) {\n const Component = as || \"div\";\n\n const stateProps = { _hover, _focus, _active, _disabled };\n\n const styles = combineStyles(\n getMarginStyles({ m, mt, mr, mb, ml, mx, my, ...stateProps }),\n getPaddingStyles({ p, pt, pr, pb, pl, px, py, ...stateProps }),\n getSizingStyles({ w, h, minW, maxW, minH, maxH, ...stateProps }),\n getInsetStyles({ inset, insetX, insetY, top, right, bottom, left, ...stateProps }),\n getDisplayStyles({ display, ...stateProps }),\n getPositionStyles({ position, ...stateProps }),\n getOverflowStyles({ overflow, overflowX, overflowY, ...stateProps }),\n getZIndexStyles({ zIndex, ...stateProps }),\n getShadowStyles({ shadow, ...stateProps }),\n getOpacityStyles({ opacity, ...stateProps }),\n getInteractionStyles({ cursor, pointerEvents, userSelect, ...stateProps }),\n getTextStyles({ textAlign, whiteSpace, textDecoration, ...stateProps }),\n getTypographyStyles({ fontSize, fontFamily, fontWeight, lineHeight, ...stateProps }),\n getColorStyles({ color, bg, borderColor, ...stateProps }),\n getBorderStyles({\n border,\n borderX,\n borderY,\n borderTop,\n borderRight,\n borderBottom,\n borderLeft,\n borderStyle,\n ...stateProps,\n }),\n getRoundnessStyles({\n rounded,\n roundedTop,\n roundedBottom,\n roundedLeft,\n roundedRight,\n roundedTopLeft,\n roundedTopRight,\n roundedBottomLeft,\n roundedBottomRight,\n ...stateProps,\n }),\n getFlexboxStyles({\n flexDirection,\n justifyContent,\n alignItems,\n alignSelf,\n flexWrap,\n gap,\n gapRow,\n gapColumn,\n flex,\n flexGrow,\n flexShrink,\n flexBasis,\n ...stateProps,\n }),\n getGridStyles({\n justifySelf,\n gridTemplateColumns,\n gridTemplateRows,\n ...stateProps,\n })\n );\n\n return (\n <Component\n className={clsx(resetClass, styles.className, className)}\n style={{\n ...styles.style,\n ...style,\n }}\n {...rest}\n >\n {children}\n </Component>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAoFA,SAAS,iBAAiB,SAAqC;AAC7D,SAAO;AAAA,IACL,WAAW,KAAK,GAAG,QAAQ,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC;AAAA,IAClD,OAAO,OAAO,OAAO,IAAI,GAAG,QAAQ,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC;AAAA,EAAA;AAE3D;AAEO,SAAS,IAAmC;AAAA,EACjD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,E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siveValue } from '../../../utils/breakpoints';
|
|
2
|
+
import { StateProps, StyleResult } from '../shared';
|
|
2
3
|
export type BorderWidthValue = "none" | "thin" | "medium" | "thick";
|
|
3
4
|
export type BorderStyleValue = "none" | "solid" | "dashed" | "dotted";
|
|
4
5
|
export type BorderProps = {
|
|
5
|
-
border?: BorderWidthValue
|
|
6
|
-
borderX?: BorderWidthValue
|
|
7
|
-
borderY?: BorderWidthValue
|
|
8
|
-
borderTop?: BorderWidthValue
|
|
9
|
-
borderRight?: BorderWidthValue
|
|
10
|
-
borderBottom?: BorderWidthValue
|
|
11
|
-
borderLeft?: BorderWidthValue
|
|
12
|
-
borderStyle?: BorderStyleValue
|
|
6
|
+
border?: ResponsiveValue<BorderWidthValue>;
|
|
7
|
+
borderX?: ResponsiveValue<BorderWidthValue>;
|
|
8
|
+
borderY?: ResponsiveValue<BorderWidthValue>;
|
|
9
|
+
borderTop?: ResponsiveValue<BorderWidthValue>;
|
|
10
|
+
borderRight?: ResponsiveValue<BorderWidthValue>;
|
|
11
|
+
borderBottom?: ResponsiveValue<BorderWidthValue>;
|
|
12
|
+
borderLeft?: ResponsiveValue<BorderWidthValue>;
|
|
13
|
+
borderStyle?: ResponsiveValue<BorderStyleValue>;
|
|
13
14
|
};
|
|
14
|
-
export
|
|
15
|
-
_hover?: BorderProps;
|
|
16
|
-
};
|
|
17
|
-
export declare function getBorderStyles(props: BorderProps & BorderStateProps): StyleResult;
|
|
15
|
+
export declare function getBorderStyles(props: BorderProps & StateProps<BorderProps>): StyleResult;
|
|
18
16
|
//# sourceMappingURL=borders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"borders.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/borders/borders.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"borders.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/borders/borders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,WAAW,EAEjB,MAAM,WAAW,CAAC;AAInB,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;AACpE,MAAM,MAAM,gBAAgB,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG;IACxB,MAAM,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAChD,YAAY,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IACjD,UAAU,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;IAC/C,WAAW,CAAC,EAAE,eAAe,CAAC,gBAAgB,CAAC,CAAC;CACjD,CAAC;AA8CF,wBAAgB,eAAe,CAC7B,KAAK,EAAE,WAAW,GAAG,UAAU,CAAC,WAAW,CAAC,GAC3C,WAAW,CAmBb"}
|
|
@@ -1,26 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { getEnumResponsiveStyles } from "../shared/responsive.js";
|
|
2
2
|
import styles from "./borders.module.css.js";
|
|
3
3
|
import clsx from "clsx";
|
|
4
|
-
function getBorderTopClass(value, state) {
|
|
5
|
-
const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
|
|
6
|
-
return stateClassSuffix ? styles[`border-top-${value}${stateClassSuffix}`] : styles[`border-top-${value}`];
|
|
7
|
-
}
|
|
8
|
-
function getBorderRightClass(value, state) {
|
|
9
|
-
const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
|
|
10
|
-
return stateClassSuffix ? styles[`border-right-${value}${stateClassSuffix}`] : styles[`border-right-${value}`];
|
|
11
|
-
}
|
|
12
|
-
function getBorderBottomClass(value, state) {
|
|
13
|
-
const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
|
|
14
|
-
return stateClassSuffix ? styles[`border-bottom-${value}${stateClassSuffix}`] : styles[`border-bottom-${value}`];
|
|
15
|
-
}
|
|
16
|
-
function getBorderLeftClass(value, state) {
|
|
17
|
-
const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
|
|
18
|
-
return stateClassSuffix ? styles[`border-left-${value}${stateClassSuffix}`] : styles[`border-left-${value}`];
|
|
19
|
-
}
|
|
20
|
-
function getBorderStyleClass(value, state) {
|
|
21
|
-
const stateClassSuffix = STATE_CLASS_SUFFIXES[state];
|
|
22
|
-
return stateClassSuffix ? styles[`border-style-${value}${stateClassSuffix}`] : styles[`border-style-${value}`];
|
|
23
|
-
}
|
|
24
4
|
function getBorderStylesForState(props, state) {
|
|
25
5
|
if (!props) return { className: "", style: {} };
|
|
26
6
|
const {
|
|
@@ -33,55 +13,42 @@ function getBorderStylesForState(props, state) {
|
|
|
33
13
|
borderLeft,
|
|
34
14
|
borderStyle
|
|
35
15
|
} = props;
|
|
36
|
-
const classes = [];
|
|
37
16
|
const topWidth = borderTop ?? borderY ?? border;
|
|
38
17
|
const rightWidth = borderRight ?? borderX ?? border;
|
|
39
18
|
const bottomWidth = borderBottom ?? borderY ?? border;
|
|
40
19
|
const leftWidth = borderLeft ?? borderX ?? border;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
if (borderStyle) {
|
|
58
|
-
const cls = getBorderStyleClass(borderStyle, state);
|
|
59
|
-
if (cls) classes.push(cls);
|
|
60
|
-
} else if (topWidth || rightWidth || bottomWidth || leftWidth) {
|
|
61
|
-
const cls = getBorderStyleClass("solid", state);
|
|
62
|
-
if (cls) classes.push(cls);
|
|
63
|
-
}
|
|
64
|
-
return { className: clsx(...classes), style: {} };
|
|
20
|
+
const topResult = getEnumResponsiveStyles(styles, "border-top", topWidth, state);
|
|
21
|
+
const rightResult = getEnumResponsiveStyles(styles, "border-right", rightWidth, state);
|
|
22
|
+
const bottomResult = getEnumResponsiveStyles(styles, "border-bottom", bottomWidth, state);
|
|
23
|
+
const leftResult = getEnumResponsiveStyles(styles, "border-left", leftWidth, state);
|
|
24
|
+
const resolvedStyle = borderStyle ?? (topWidth || rightWidth || bottomWidth || leftWidth ? "solid" : void 0);
|
|
25
|
+
const styleResult = getEnumResponsiveStyles(styles, "border-style", resolvedStyle, state);
|
|
26
|
+
return {
|
|
27
|
+
className: clsx(
|
|
28
|
+
topResult.className,
|
|
29
|
+
rightResult.className,
|
|
30
|
+
bottomResult.className,
|
|
31
|
+
leftResult.className,
|
|
32
|
+
styleResult.className
|
|
33
|
+
),
|
|
34
|
+
style: {}
|
|
35
|
+
};
|
|
65
36
|
}
|
|
66
37
|
function getBorderStyles(props) {
|
|
67
|
-
const {
|
|
68
|
-
|
|
69
|
-
borderX,
|
|
70
|
-
borderY,
|
|
71
|
-
borderTop,
|
|
72
|
-
borderRight,
|
|
73
|
-
borderBottom,
|
|
74
|
-
borderLeft,
|
|
75
|
-
borderStyle,
|
|
76
|
-
_hover
|
|
77
|
-
} = props;
|
|
78
|
-
const baseStyles = getBorderStylesForState(
|
|
79
|
-
{ border, borderX, borderY, borderTop, borderRight, borderBottom, borderLeft, borderStyle },
|
|
80
|
-
"base"
|
|
81
|
-
);
|
|
38
|
+
const { _hover, _focus, _active, _disabled, ...baseProps } = props;
|
|
39
|
+
const baseStyles = getBorderStylesForState(baseProps, "base");
|
|
82
40
|
const hoverStyles = getBorderStylesForState(_hover, "hover");
|
|
41
|
+
const focusStyles = getBorderStylesForState(_focus, "focus");
|
|
42
|
+
const activeStyles = getBorderStylesForState(_active, "active");
|
|
43
|
+
const disabledStyles = getBorderStylesForState(_disabled, "disabled");
|
|
83
44
|
return {
|
|
84
|
-
className: clsx(
|
|
45
|
+
className: clsx(
|
|
46
|
+
baseStyles.className,
|
|
47
|
+
hoverStyles.className,
|
|
48
|
+
focusStyles.className,
|
|
49
|
+
activeStyles.className,
|
|
50
|
+
disabledStyles.className
|
|
51
|
+
),
|
|
85
52
|
style: {}
|
|
86
53
|
};
|
|
87
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"borders.js","sources":["../../../../src/components/Box/borders/borders.ts"],"sourcesContent":["import {\n
|
|
1
|
+
{"version":3,"file":"borders.js","sources":["../../../../src/components/Box/borders/borders.ts"],"sourcesContent":["import type { ResponsiveValue } from \"@/utils/breakpoints\";\nimport {\n type StateKey,\n type StateProps,\n type StyleResult,\n getEnumResponsiveStyles,\n} from \"../shared\";\nimport styles from \"./borders.module.css\";\nimport clsx from \"clsx\";\n\nexport type BorderWidthValue = \"none\" | \"thin\" | \"medium\" | \"thick\";\nexport type BorderStyleValue = \"none\" | \"solid\" | \"dashed\" | \"dotted\";\n\nexport type BorderProps = {\n border?: ResponsiveValue<BorderWidthValue>;\n borderX?: ResponsiveValue<BorderWidthValue>;\n borderY?: ResponsiveValue<BorderWidthValue>;\n borderTop?: ResponsiveValue<BorderWidthValue>;\n borderRight?: ResponsiveValue<BorderWidthValue>;\n borderBottom?: ResponsiveValue<BorderWidthValue>;\n borderLeft?: ResponsiveValue<BorderWidthValue>;\n borderStyle?: ResponsiveValue<BorderStyleValue>;\n};\n\nfunction getBorderStylesForState(\n props: BorderProps | undefined,\n state: StateKey\n): StyleResult {\n if (!props) return { className: \"\", style: {} };\n\n const {\n border,\n borderX,\n borderY,\n borderTop,\n borderRight,\n borderBottom,\n borderLeft,\n borderStyle,\n } = props;\n\n // Cascading specificity: individual > axis > all\n const topWidth = borderTop ?? borderY ?? border;\n const rightWidth = borderRight ?? borderX ?? border;\n const bottomWidth = borderBottom ?? borderY ?? border;\n const leftWidth = borderLeft ?? borderX ?? border;\n\n const topResult = getEnumResponsiveStyles(styles, \"border-top\", topWidth, state);\n const rightResult = getEnumResponsiveStyles(styles, \"border-right\", rightWidth, state);\n const bottomResult = getEnumResponsiveStyles(styles, \"border-bottom\", bottomWidth, state);\n const leftResult = getEnumResponsiveStyles(styles, \"border-left\", leftWidth, state);\n\n // Apply borderStyle, default to solid if any width is set\n const resolvedStyle = borderStyle ?? (topWidth || rightWidth || bottomWidth || leftWidth ? \"solid\" as const : undefined);\n const styleResult = getEnumResponsiveStyles(styles, \"border-style\", resolvedStyle, state);\n\n return {\n className: clsx(\n topResult.className,\n rightResult.className,\n bottomResult.className,\n leftResult.className,\n styleResult.className\n ),\n style: {},\n };\n}\n\nexport function getBorderStyles(\n props: BorderProps & StateProps<BorderProps>\n): StyleResult {\n const { _hover, _focus, _active, _disabled, ...baseProps } = props;\n\n const baseStyles = getBorderStylesForState(baseProps, \"base\");\n const hoverStyles = getBorderStylesForState(_hover, \"hover\");\n const focusStyles = getBorderStylesForState(_focus, \"focus\");\n const activeStyles = getBorderStylesForState(_active, \"active\");\n const disabledStyles = getBorderStylesForState(_disabled, \"disabled\");\n\n return {\n className: clsx(\n baseStyles.className,\n hoverStyles.className,\n focusStyles.className,\n activeStyles.className,\n disabledStyles.className\n ),\n style: {},\n };\n}\n"],"names":[],"mappings":";;;AAwBA,SAAS,wBACP,OACA,OACa;AACb,MAAI,CAAC,MAAO,QAAO,EAAE,WAAW,IAAI,OAAO,GAAC;AAE5C,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACE;AAGJ,QAAM,WAAW,aAAa,WAAW;AACzC,QAAM,aAAa,eAAe,WAAW;AAC7C,QAAM,cAAc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