@dashforge/tw 0.1.0-beta → 0.2.1-beta
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/A11Y.md +130 -0
- package/CHANGELOG.md +231 -0
- package/dist/index.d.ts +1 -82
- package/dist/index.esm.js +1608 -11
- package/dist/src/components/AspectRatio/AspectRatio.d.ts +36 -0
- package/dist/src/components/AspectRatio/AspectRatio.d.ts.map +1 -0
- package/dist/src/components/AspectRatio/aspectRatio.types.d.ts +50 -0
- package/dist/src/components/AspectRatio/aspectRatio.types.d.ts.map +1 -0
- package/dist/src/components/Box/Box.d.ts +36 -0
- package/dist/src/components/Box/Box.d.ts.map +1 -0
- package/dist/src/components/Box/box.types.d.ts +54 -0
- package/dist/src/components/Box/box.types.d.ts.map +1 -0
- package/dist/src/components/Box/box.variants.d.ts +402 -0
- package/dist/src/components/Box/box.variants.d.ts.map +1 -0
- package/dist/src/components/Button/Button.d.ts.map +1 -1
- package/dist/src/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/src/components/Container/Container.d.ts +35 -0
- package/dist/src/components/Container/Container.d.ts.map +1 -0
- package/dist/src/components/Container/container.types.d.ts +41 -0
- package/dist/src/components/Container/container.types.d.ts.map +1 -0
- package/dist/src/components/Container/container.variants.d.ts +93 -0
- package/dist/src/components/Container/container.variants.d.ts.map +1 -0
- package/dist/src/components/Divider/Divider.d.ts +50 -0
- package/dist/src/components/Divider/Divider.d.ts.map +1 -0
- package/dist/src/components/Divider/divider.types.d.ts +47 -0
- package/dist/src/components/Divider/divider.types.d.ts.map +1 -0
- package/dist/src/components/Divider/divider.variants.d.ts +129 -0
- package/dist/src/components/Divider/divider.variants.d.ts.map +1 -0
- package/dist/src/components/Grid/Grid.d.ts +32 -0
- package/dist/src/components/Grid/Grid.d.ts.map +1 -0
- package/dist/src/components/Grid/grid.types.d.ts +103 -0
- package/dist/src/components/Grid/grid.types.d.ts.map +1 -0
- package/dist/src/components/Grid/grid.variants.d.ts +453 -0
- package/dist/src/components/Grid/grid.variants.d.ts.map +1 -0
- package/dist/src/components/NumberField/NumberField.d.ts.map +1 -1
- package/dist/src/components/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/src/components/Stack/Stack.d.ts +24 -0
- package/dist/src/components/Stack/Stack.d.ts.map +1 -0
- package/dist/src/components/Stack/stack.types.d.ts +61 -0
- package/dist/src/components/Stack/stack.types.d.ts.map +1 -0
- package/dist/src/components/Stack/stack.variants.d.ts +163 -0
- package/dist/src/components/Stack/stack.variants.d.ts.map +1 -0
- package/dist/src/components/Typography/Typography.d.ts +42 -0
- package/dist/src/components/Typography/Typography.d.ts.map +1 -0
- package/dist/src/components/Typography/typography.types.d.ts +61 -0
- package/dist/src/components/Typography/typography.types.d.ts.map +1 -0
- package/dist/src/components/Typography/typography.variants.d.ts +167 -0
- package/dist/src/components/Typography/typography.variants.d.ts.map +1 -0
- package/dist/src/components/VisuallyHidden/VisuallyHidden.d.ts +42 -0
- package/dist/src/components/VisuallyHidden/VisuallyHidden.d.ts.map +1 -0
- package/dist/src/components/VisuallyHidden/visuallyHidden.types.d.ts +42 -0
- package/dist/src/components/VisuallyHidden/visuallyHidden.types.d.ts.map +1 -0
- package/dist/src/index.d.ts +23 -1
- package/dist/src/index.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/components/AspectRatio/AspectRatio.test.tsx +173 -0
- package/src/components/AspectRatio/AspectRatio.tsx +73 -0
- package/src/components/AspectRatio/aspectRatio.types.ts +54 -0
- package/src/components/Box/Box.test.tsx +349 -0
- package/src/components/Box/Box.tsx +83 -0
- package/src/components/Box/box.types.ts +61 -0
- package/src/components/Box/box.variants.ts +211 -0
- package/src/components/Button/Button.tsx +11 -0
- package/src/components/Checkbox/Checkbox.tsx +26 -2
- package/src/components/Container/Container.test.tsx +209 -0
- package/src/components/Container/Container.tsx +74 -0
- package/src/components/Container/container.types.ts +45 -0
- package/src/components/Container/container.variants.ts +81 -0
- package/src/components/Divider/Divider.test.tsx +241 -0
- package/src/components/Divider/Divider.tsx +140 -0
- package/src/components/Divider/divider.types.ts +52 -0
- package/src/components/Divider/divider.variants.ts +115 -0
- package/src/components/Grid/Grid.test.tsx +321 -0
- package/src/components/Grid/Grid.tsx +148 -0
- package/src/components/Grid/grid.types.ts +112 -0
- package/src/components/Grid/grid.variants.ts +133 -0
- package/src/components/NumberField/NumberField.tsx +30 -2
- package/src/components/RadioGroup/RadioGroup.tsx +23 -1
- package/src/components/Stack/Stack.test.tsx +309 -0
- package/src/components/Stack/Stack.tsx +115 -0
- package/src/components/Stack/stack.types.ts +68 -0
- package/src/components/Stack/stack.variants.ts +80 -0
- package/src/components/Typography/Typography.test.tsx +230 -0
- package/src/components/Typography/Typography.tsx +112 -0
- package/src/components/Typography/typography.types.ts +65 -0
- package/src/components/Typography/typography.variants.ts +113 -0
- package/src/components/VisuallyHidden/VisuallyHidden.test.tsx +86 -0
- package/src/components/VisuallyHidden/VisuallyHidden.tsx +59 -0
- package/src/components/VisuallyHidden/visuallyHidden.types.ts +45 -0
- package/src/index.ts +50 -1
- package/LICENSE +0 -21
- package/dist/components/AppShell/AppShell.d.ts +0 -32
- package/dist/components/AppShell/AppShell.d.ts.map +0 -1
- package/dist/components/AppShell/appShell.types.d.ts +0 -62
- package/dist/components/AppShell/appShell.types.d.ts.map +0 -1
- package/dist/components/AppShell/appShell.variants.d.ts +0 -65
- package/dist/components/AppShell/appShell.variants.d.ts.map +0 -1
- package/dist/components/Autocomplete/Autocomplete.d.ts +0 -32
- package/dist/components/Autocomplete/Autocomplete.d.ts.map +0 -1
- package/dist/components/Autocomplete/autocomplete.types.d.ts +0 -214
- package/dist/components/Autocomplete/autocomplete.types.d.ts.map +0 -1
- package/dist/components/Autocomplete/autocomplete.variants.d.ts +0 -214
- package/dist/components/Autocomplete/autocomplete.variants.d.ts.map +0 -1
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +0 -23
- package/dist/components/Breadcrumbs/Breadcrumbs.d.ts.map +0 -1
- package/dist/components/Breadcrumbs/breadcrumbs.types.d.ts +0 -98
- package/dist/components/Breadcrumbs/breadcrumbs.types.d.ts.map +0 -1
- package/dist/components/Breadcrumbs/breadcrumbs.variants.d.ts +0 -85
- package/dist/components/Breadcrumbs/breadcrumbs.variants.d.ts.map +0 -1
- package/dist/components/Button/Button.d.ts +0 -44
- package/dist/components/Button/Button.d.ts.map +0 -1
- package/dist/components/Button/button.types.d.ts +0 -66
- package/dist/components/Button/button.types.d.ts.map +0 -1
- package/dist/components/Button/button.variants.d.ts +0 -104
- package/dist/components/Button/button.variants.d.ts.map +0 -1
- package/dist/components/Checkbox/Checkbox.d.ts +0 -31
- package/dist/components/Checkbox/Checkbox.d.ts.map +0 -1
- package/dist/components/Checkbox/checkbox.types.d.ts +0 -86
- package/dist/components/Checkbox/checkbox.types.d.ts.map +0 -1
- package/dist/components/Checkbox/checkbox.variants.d.ts +0 -109
- package/dist/components/Checkbox/checkbox.variants.d.ts.map +0 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts +0 -38
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +0 -1
- package/dist/components/ConfirmDialog/confirmDialog.types.d.ts +0 -80
- package/dist/components/ConfirmDialog/confirmDialog.types.d.ts.map +0 -1
- package/dist/components/ConfirmDialog/confirmDialog.variants.d.ts +0 -90
- package/dist/components/ConfirmDialog/confirmDialog.variants.d.ts.map +0 -1
- package/dist/components/DateTimePicker/DateTimePicker.d.ts +0 -49
- package/dist/components/DateTimePicker/DateTimePicker.d.ts.map +0 -1
- package/dist/components/DateTimePicker/dateTimePicker.types.d.ts +0 -95
- package/dist/components/DateTimePicker/dateTimePicker.types.d.ts.map +0 -1
- package/dist/components/DateTimePicker/dateTimePicker.variants.d.ts +0 -165
- package/dist/components/DateTimePicker/dateTimePicker.variants.d.ts.map +0 -1
- package/dist/components/LeftNav/LeftNav.d.ts +0 -34
- package/dist/components/LeftNav/LeftNav.d.ts.map +0 -1
- package/dist/components/LeftNav/leftNav.types.d.ts +0 -136
- package/dist/components/LeftNav/leftNav.types.d.ts.map +0 -1
- package/dist/components/LeftNav/leftNav.variants.d.ts +0 -143
- package/dist/components/LeftNav/leftNav.variants.d.ts.map +0 -1
- package/dist/components/NumberField/NumberField.d.ts +0 -18
- package/dist/components/NumberField/NumberField.d.ts.map +0 -1
- package/dist/components/NumberField/numberField.types.d.ts +0 -79
- package/dist/components/NumberField/numberField.types.d.ts.map +0 -1
- package/dist/components/NumberField/numberField.variants.d.ts +0 -169
- package/dist/components/NumberField/numberField.variants.d.ts.map +0 -1
- package/dist/components/OTPField/OTPField.d.ts +0 -25
- package/dist/components/OTPField/OTPField.d.ts.map +0 -1
- package/dist/components/OTPField/otpField.types.d.ts +0 -74
- package/dist/components/OTPField/otpField.types.d.ts.map +0 -1
- package/dist/components/OTPField/otpField.variants.d.ts +0 -105
- package/dist/components/OTPField/otpField.variants.d.ts.map +0 -1
- package/dist/components/RadioGroup/RadioGroup.d.ts +0 -35
- package/dist/components/RadioGroup/RadioGroup.d.ts.map +0 -1
- package/dist/components/RadioGroup/radioGroup.types.d.ts +0 -103
- package/dist/components/RadioGroup/radioGroup.types.d.ts.map +0 -1
- package/dist/components/RadioGroup/radioGroup.variants.d.ts +0 -166
- package/dist/components/RadioGroup/radioGroup.variants.d.ts.map +0 -1
- package/dist/components/Snackbar/Snackbar.d.ts +0 -37
- package/dist/components/Snackbar/Snackbar.d.ts.map +0 -1
- package/dist/components/Snackbar/snackbar.types.d.ts +0 -86
- package/dist/components/Snackbar/snackbar.types.d.ts.map +0 -1
- package/dist/components/Snackbar/snackbar.variants.d.ts +0 -153
- package/dist/components/Snackbar/snackbar.variants.d.ts.map +0 -1
- package/dist/components/Switch/Switch.d.ts +0 -15
- package/dist/components/Switch/Switch.d.ts.map +0 -1
- package/dist/components/Switch/switch.types.d.ts +0 -47
- package/dist/components/Switch/switch.types.d.ts.map +0 -1
- package/dist/components/Switch/switch.variants.d.ts +0 -105
- package/dist/components/Switch/switch.variants.d.ts.map +0 -1
- package/dist/components/TextField/TextField.d.ts +0 -25
- package/dist/components/TextField/TextField.d.ts.map +0 -1
- package/dist/components/TextField/textField.types.d.ts +0 -72
- package/dist/components/TextField/textField.types.d.ts.map +0 -1
- package/dist/components/TextField/textField.variants.d.ts +0 -160
- package/dist/components/TextField/textField.variants.d.ts.map +0 -1
- package/dist/components/Textarea/Textarea.d.ts +0 -16
- package/dist/components/Textarea/Textarea.d.ts.map +0 -1
- package/dist/components/Textarea/textarea.types.d.ts +0 -63
- package/dist/components/Textarea/textarea.types.d.ts.map +0 -1
- package/dist/components/Textarea/textarea.variants.d.ts +0 -197
- package/dist/components/Textarea/textarea.variants.d.ts.map +0 -1
- package/dist/components/TopBar/TopBar.d.ts +0 -33
- package/dist/components/TopBar/TopBar.d.ts.map +0 -1
- package/dist/components/TopBar/topBar.types.d.ts +0 -49
- package/dist/components/TopBar/topBar.types.d.ts.map +0 -1
- package/dist/components/TopBar/topBar.variants.d.ts +0 -79
- package/dist/components/TopBar/topBar.variants.d.ts.map +0 -1
- package/dist/components/_shared/resolveValidationState.d.ts +0 -42
- package/dist/components/_shared/resolveValidationState.d.ts.map +0 -1
- package/dist/hooks/useAccessState.d.ts +0 -37
- package/dist/hooks/useAccessState.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
- package/dist/utils/cn.d.ts +0 -26
- package/dist/utils/cn.d.ts.map +0 -1
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { AspectRatioProps } from './aspectRatio.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* `<AspectRatio>` — locks the aspect ratio of its child container,
|
|
4
|
+
* regardless of width. The classic use is responsive images and
|
|
5
|
+
* embedded media: an `<img>` that takes 100% of the available width
|
|
6
|
+
* but always renders at 16:9 (or 1:1, or whatever the source ratio is)
|
|
7
|
+
* — no jumping layouts during image load, no whitespace below the
|
|
8
|
+
* media, no JS measurement.
|
|
9
|
+
*
|
|
10
|
+
* Implementation: native CSS `aspect-ratio` property. Supported in
|
|
11
|
+
* every browser shipped from 2021 onward (Chrome 88, Firefox 89,
|
|
12
|
+
* Safari 15, Edge 88). No padding-bottom hack — that workaround
|
|
13
|
+
* predates the native property and brings ugly absolute-positioning
|
|
14
|
+
* requirements on the child.
|
|
15
|
+
*
|
|
16
|
+
* Why a component if it's "just one CSS property"?
|
|
17
|
+
* Two reasons:
|
|
18
|
+
* 1. Discoverability — `<AspectRatio ratio={16/9}>` documents the
|
|
19
|
+
* intent at the call site. `style={{ aspectRatio: '16/9' }}` is
|
|
20
|
+
* the same thing functionally, but harder to spot in a 200-line
|
|
21
|
+
* component file.
|
|
22
|
+
* 2. Composition — pairs naturally with `sx="rounded-xl overflow-hidden"`
|
|
23
|
+
* for the canonical "rounded clipped media" pattern. Forgetting
|
|
24
|
+
* the `overflow-hidden` is the #1 mistake we want to prevent
|
|
25
|
+
* through documentation (it's in this component's MDX, at the
|
|
26
|
+
* top of the Notes).
|
|
27
|
+
*
|
|
28
|
+
* Child contract:
|
|
29
|
+
* The single child is expected to fill the container — typically
|
|
30
|
+
* `<img>` / `<video>` with `className="w-full h-full object-cover"`.
|
|
31
|
+
* We don't force this via CSS (the consumer might want a centered
|
|
32
|
+
* icon instead of a filling image) — but it's the 99% case, and the
|
|
33
|
+
* docs show it first.
|
|
34
|
+
*/
|
|
35
|
+
export declare const AspectRatio: import("react").ForwardRefExoticComponent<AspectRatioProps & import("react").RefAttributes<HTMLElement>>;
|
|
36
|
+
//# sourceMappingURL=AspectRatio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AspectRatio.d.ts","sourceRoot":"","sources":["../../../../src/components/AspectRatio/AspectRatio.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE/D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,WAAW,0GAiCvB,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ElementType, HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Props for `<AspectRatio>` — content-shape primitive that locks the
|
|
4
|
+
* aspect ratio of its child regardless of width.
|
|
5
|
+
*
|
|
6
|
+
* Implementation: uses the native CSS `aspect-ratio` property
|
|
7
|
+
* (supported in all current browsers since 2021 — Chrome 88+, Firefox 89+,
|
|
8
|
+
* Safari 15+, Edge 88+). No padding-bottom hack, no JS measurement.
|
|
9
|
+
*
|
|
10
|
+
* `ratio` accepts:
|
|
11
|
+
* • A number — width / height. `16/9` is 1.7777…, `1` is square,
|
|
12
|
+
* `4/3` is 1.333…, `21/9` is ultrawide cinema.
|
|
13
|
+
* • A string with the CSS `aspect-ratio` syntax, e.g. `'16 / 9'`,
|
|
14
|
+
* `'4 / 3'`. Useful when you want the source ratio to read clearly
|
|
15
|
+
* in the JSX (`ratio="16 / 9"` is more legible than `ratio={16/9}`).
|
|
16
|
+
*
|
|
17
|
+
* The component renders a single element with `aspect-ratio: X` and
|
|
18
|
+
* `width: 100%`. The child is expected to fill it — typically an
|
|
19
|
+
* `<img>` or `<video>` with `className="w-full h-full object-cover"`.
|
|
20
|
+
*
|
|
21
|
+
* Why not a TV recipe?
|
|
22
|
+
* The ratio is arbitrary (`16/9`, `1`, `2.35`, anything). Tailwind
|
|
23
|
+
* has `aspect-square` / `aspect-video` / `aspect-[16/9]` arbitrary
|
|
24
|
+
* values, but enumerating every conceivable ratio in TV would be
|
|
25
|
+
* pointless. We set `style={{ aspectRatio }}` directly — pure CSS
|
|
26
|
+
* property, no class purge concerns.
|
|
27
|
+
*/
|
|
28
|
+
export interface AspectRatioProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className'> {
|
|
29
|
+
/**
|
|
30
|
+
* Aspect ratio as width/height. Number (`16/9`) or CSS string
|
|
31
|
+
* (`'16 / 9'`). Default `1` (square).
|
|
32
|
+
*/
|
|
33
|
+
ratio?: number | string;
|
|
34
|
+
/**
|
|
35
|
+
* The child that fills the locked-ratio container. Typically an
|
|
36
|
+
* `<img>` or `<video>` with `className="w-full h-full object-cover"`.
|
|
37
|
+
*/
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
/**
|
|
40
|
+
* Override the rendered HTML tag. Defaults to `'div'`.
|
|
41
|
+
*/
|
|
42
|
+
as?: ElementType;
|
|
43
|
+
/**
|
|
44
|
+
* Utility classes appended to the base. Resolved via `tailwind-merge`.
|
|
45
|
+
* Common overrides: `sx="rounded-xl overflow-hidden"` to clip the
|
|
46
|
+
* child's overflow (image bleeds otherwise).
|
|
47
|
+
*/
|
|
48
|
+
sx?: string;
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=aspectRatio.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aspectRatio.types.d.ts","sourceRoot":"","sources":["../../../../src/components/AspectRatio/aspectRatio.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEpE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,WAAW,CAAC;IACzD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAExB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,EAAE,CAAC,EAAE,WAAW,CAAC;IAEjB;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { BoxProps } from './box.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* `<Box>` — the surface primitive of @dashforge/tw.
|
|
4
|
+
*
|
|
5
|
+
* What it IS:
|
|
6
|
+
* A polymorphic container with typed surface variants (plain /
|
|
7
|
+
* outlined / elevated / soft / solid) × 7 intent colours, plus
|
|
8
|
+
* spacing / sizing / rounded / elevation as enumerated token-scale
|
|
9
|
+
* props. Replaces MUI's Box + Paper + Card + Surface in one component.
|
|
10
|
+
*
|
|
11
|
+
* What it is NOT (deliberate, enforced by the prop set):
|
|
12
|
+
* • Not a flex container → use <Stack>
|
|
13
|
+
* • Not a grid container → use <Grid>
|
|
14
|
+
* • Not a paragraph → use <Typography>
|
|
15
|
+
* • Not a button → use <Button>
|
|
16
|
+
*
|
|
17
|
+
* The "Box is not flex" rule is the spine of the layout layer. Without
|
|
18
|
+
* it, every `<div>` in an app gravitates back to Box and the surface
|
|
19
|
+
* vs layout distinction collapses. Box's job is the SURFACE around
|
|
20
|
+
* content; Stack/Grid's job is the ARRANGEMENT of content. Two
|
|
21
|
+
* primitives, two responsibilities.
|
|
22
|
+
*
|
|
23
|
+
* When BOTH `as` and `asChild` are passed, `asChild` wins. Same rule
|
|
24
|
+
* as Typography — documented to avoid the dimension-bloat of a
|
|
25
|
+
* discriminated union over an 11-axis props type.
|
|
26
|
+
*
|
|
27
|
+
* Layering:
|
|
28
|
+
* • Sits BENEATH every visual chrome — every card, every panel,
|
|
29
|
+
* every section background.
|
|
30
|
+
* • Composes ON TOP of @dashforge/tw-tokens (color + spacing + radius
|
|
31
|
+
* + shadow scales) via the dashforgePreset CSS variables.
|
|
32
|
+
* • Pairs with Typography for text content, Stack/Grid for layout
|
|
33
|
+
* children inside it.
|
|
34
|
+
*/
|
|
35
|
+
export declare const Box: import("react").ForwardRefExoticComponent<BoxProps & import("react").RefAttributes<HTMLElement>>;
|
|
36
|
+
//# sourceMappingURL=Box.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Box.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/Box.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,GAAG,kGAyCf,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { ElementType, HTMLAttributes } from 'react';
|
|
2
|
+
import type { BoxVariants } from './box.variants.js';
|
|
3
|
+
/**
|
|
4
|
+
* Props for `<Box>` — the surface primitive.
|
|
5
|
+
*
|
|
6
|
+
* What lives in props (typed, ergonomic):
|
|
7
|
+
* • Surface — variant, color, elevation, rounded
|
|
8
|
+
* • Spacing — p, px, py, m, mx, my (token-scale steps)
|
|
9
|
+
* • Sizing — fullWidth, fullHeight
|
|
10
|
+
* • Polymorphism — as, asChild
|
|
11
|
+
* • Override escape — sx (utility string, merged via tailwind-merge)
|
|
12
|
+
*
|
|
13
|
+
* What does NOT live here (deliberate, see Box.tsx header):
|
|
14
|
+
* • display / flex / grid / gap → use Stack or Grid
|
|
15
|
+
* • position / top / z-index → use sx
|
|
16
|
+
* • overflow / cursor → use sx
|
|
17
|
+
* • animation / transition → use sx
|
|
18
|
+
*
|
|
19
|
+
* Native attribute overrides:
|
|
20
|
+
* • `className` is omitted in favour of `sx` (string of utilities,
|
|
21
|
+
* resolved by tailwind-merge so consumer wins over variant defaults)
|
|
22
|
+
* — same convention as Button/TextField/Checkbox/Switch.
|
|
23
|
+
* • `color` is omitted: collides with the deprecated HTML4 `color`
|
|
24
|
+
* attribute. Our typed `color` (intent) is the right one.
|
|
25
|
+
*/
|
|
26
|
+
export interface BoxProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className' | 'color'>, Pick<BoxVariants, 'variant' | 'color' | 'elevation' | 'rounded' | 'p' | 'px' | 'py' | 'm' | 'mx' | 'my' | 'fullWidth' | 'fullHeight'> {
|
|
27
|
+
/**
|
|
28
|
+
* Override the rendered HTML tag. Defaults to `'div'`. Useful when
|
|
29
|
+
* the surface should also carry semantic meaning — `<Box as="section">`
|
|
30
|
+
* for a page section, `<Box as="article">` for a card-shaped article.
|
|
31
|
+
*
|
|
32
|
+
* Ignored when `asChild` is true.
|
|
33
|
+
*/
|
|
34
|
+
as?: ElementType;
|
|
35
|
+
/**
|
|
36
|
+
* Render via Radix `Slot` — the Box styles paint onto the single
|
|
37
|
+
* React child instead of wrapping it in our own element. Useful for
|
|
38
|
+
* `<Box asChild><Link>...</Link></Box>` to get a styled router link
|
|
39
|
+
* with no extra DOM wrapper.
|
|
40
|
+
*
|
|
41
|
+
* Mutually exclusive with `as` (when both are passed, `asChild` wins
|
|
42
|
+
* — see Box.tsx for the reasoning).
|
|
43
|
+
*/
|
|
44
|
+
asChild?: boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Utility classes appended to the variant chain. Resolved via
|
|
47
|
+
* `tailwind-merge` so the consumer's classes always win over the
|
|
48
|
+
* variant defaults. Use for one-off overrides AND for utility
|
|
49
|
+
* dimensions Box deliberately doesn't expose as props (overflow,
|
|
50
|
+
* position, animation, etc.).
|
|
51
|
+
*/
|
|
52
|
+
sx?: string;
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=box.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box.types.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/box.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,WAAW,QACf,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,EAC3D,IAAI,CAAC,WAAW,EACd,SAAS,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,GAC3C,GAAG,GAAG,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,GACrC,WAAW,GAAG,YAAY,CAAC;IACvC;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,WAAW,CAAC;IAEjB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb"}
|
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { type VariantProps } from 'tailwind-variants';
|
|
2
|
+
/**
|
|
3
|
+
* `boxVariants` — the surface primitive for @dashforge/tw.
|
|
4
|
+
*
|
|
5
|
+
* Architectural choice (planned with the user — F9 deep dive):
|
|
6
|
+
*
|
|
7
|
+
* Box replaces FOUR overlapping concepts from MUI in one component:
|
|
8
|
+
* • Box (typed div)
|
|
9
|
+
* • Paper (surface with elevation)
|
|
10
|
+
* • Card (Paper specialisation)
|
|
11
|
+
* • Surface (Joy UI's outlined / soft / solid / plain variants)
|
|
12
|
+
*
|
|
13
|
+
* The reason for the consolidation: in MUI you have to compose two or
|
|
14
|
+
* three of these to express even basic intent ("an outlined card with
|
|
15
|
+
* warning tone"). Here, one `<Box variant="outlined" color="warning">`
|
|
16
|
+
* says exactly that.
|
|
17
|
+
*
|
|
18
|
+
* Variant taxonomy (5 axes, intentionally non-overlapping with Stack/Grid):
|
|
19
|
+
*
|
|
20
|
+
* • plain — bare div + padding + radius. The escape hatch.
|
|
21
|
+
* • outlined — 1px border + subtle bg tint. The "card lite".
|
|
22
|
+
* • elevated — bg surface + shadow scale (0-5). The "floating panel".
|
|
23
|
+
* • soft — semi-transparent intent bg + intent text. The "callout".
|
|
24
|
+
* • solid — solid intent bg + contrasting text. The "CTA banner".
|
|
25
|
+
*
|
|
26
|
+
* `color` applies to outlined/soft/solid (each gets the 7 intent
|
|
27
|
+
* variants). `elevated` is color-agnostic (always neutral surface +
|
|
28
|
+
* shadow scale). `plain` is everything-agnostic.
|
|
29
|
+
*
|
|
30
|
+
* Spacing axes (p/px/py/m/mx/my): mapped explicitly to the 11 token
|
|
31
|
+
* steps from @dashforge/tw-tokens (0, 0.5, 1, 2, 3, 4, 6, 8, 12, 16, 24).
|
|
32
|
+
* Tailwind JIT requires literal class strings — building them dynamically
|
|
33
|
+
* with template literals would purge them. The verbosity below is the
|
|
34
|
+
* cost of keeping the bundle CSS-pure and rebuild-free.
|
|
35
|
+
*
|
|
36
|
+
* What this does NOT do (deliberate, see component docs):
|
|
37
|
+
* • No display / flex / grid props → use Stack or Grid
|
|
38
|
+
* • No position / overflow / z-index → use `sx`
|
|
39
|
+
* • No animation / transition → use `sx`
|
|
40
|
+
*
|
|
41
|
+
* The "Box is not flex" rule is the spine of the layout layer. Without
|
|
42
|
+
* it, every `<div>` in an app gravitates back to Box and the surface
|
|
43
|
+
* vs layout distinction collapses — exactly the failure mode this
|
|
44
|
+
* primitive exists to prevent.
|
|
45
|
+
*/
|
|
46
|
+
export declare const boxVariants: import("tailwind-variants").TVReturnType<{
|
|
47
|
+
variant: {
|
|
48
|
+
plain: string;
|
|
49
|
+
outlined: string;
|
|
50
|
+
elevated: string;
|
|
51
|
+
soft: string;
|
|
52
|
+
solid: string;
|
|
53
|
+
};
|
|
54
|
+
color: {
|
|
55
|
+
primary: string;
|
|
56
|
+
secondary: string;
|
|
57
|
+
success: string;
|
|
58
|
+
warning: string;
|
|
59
|
+
danger: string;
|
|
60
|
+
info: string;
|
|
61
|
+
neutral: string;
|
|
62
|
+
};
|
|
63
|
+
elevation: {
|
|
64
|
+
0: string;
|
|
65
|
+
1: string;
|
|
66
|
+
2: string;
|
|
67
|
+
3: string;
|
|
68
|
+
4: string;
|
|
69
|
+
5: string;
|
|
70
|
+
};
|
|
71
|
+
rounded: {
|
|
72
|
+
none: string;
|
|
73
|
+
sm: string;
|
|
74
|
+
md: string;
|
|
75
|
+
lg: string;
|
|
76
|
+
xl: string;
|
|
77
|
+
'2xl': string;
|
|
78
|
+
full: string;
|
|
79
|
+
};
|
|
80
|
+
p: {
|
|
81
|
+
0: string;
|
|
82
|
+
'0.5': string;
|
|
83
|
+
1: string;
|
|
84
|
+
2: string;
|
|
85
|
+
3: string;
|
|
86
|
+
4: string;
|
|
87
|
+
6: string;
|
|
88
|
+
8: string;
|
|
89
|
+
12: string;
|
|
90
|
+
16: string;
|
|
91
|
+
24: string;
|
|
92
|
+
};
|
|
93
|
+
px: {
|
|
94
|
+
0: string;
|
|
95
|
+
'0.5': string;
|
|
96
|
+
1: string;
|
|
97
|
+
2: string;
|
|
98
|
+
3: string;
|
|
99
|
+
4: string;
|
|
100
|
+
6: string;
|
|
101
|
+
8: string;
|
|
102
|
+
12: string;
|
|
103
|
+
16: string;
|
|
104
|
+
24: string;
|
|
105
|
+
};
|
|
106
|
+
py: {
|
|
107
|
+
0: string;
|
|
108
|
+
'0.5': string;
|
|
109
|
+
1: string;
|
|
110
|
+
2: string;
|
|
111
|
+
3: string;
|
|
112
|
+
4: string;
|
|
113
|
+
6: string;
|
|
114
|
+
8: string;
|
|
115
|
+
12: string;
|
|
116
|
+
16: string;
|
|
117
|
+
24: string;
|
|
118
|
+
};
|
|
119
|
+
m: {
|
|
120
|
+
0: string;
|
|
121
|
+
'0.5': string;
|
|
122
|
+
1: string;
|
|
123
|
+
2: string;
|
|
124
|
+
3: string;
|
|
125
|
+
4: string;
|
|
126
|
+
6: string;
|
|
127
|
+
8: string;
|
|
128
|
+
12: string;
|
|
129
|
+
16: string;
|
|
130
|
+
24: string;
|
|
131
|
+
};
|
|
132
|
+
mx: {
|
|
133
|
+
0: string;
|
|
134
|
+
'0.5': string;
|
|
135
|
+
1: string;
|
|
136
|
+
2: string;
|
|
137
|
+
3: string;
|
|
138
|
+
4: string;
|
|
139
|
+
6: string;
|
|
140
|
+
8: string;
|
|
141
|
+
12: string;
|
|
142
|
+
16: string;
|
|
143
|
+
24: string;
|
|
144
|
+
};
|
|
145
|
+
my: {
|
|
146
|
+
0: string;
|
|
147
|
+
'0.5': string;
|
|
148
|
+
1: string;
|
|
149
|
+
2: string;
|
|
150
|
+
3: string;
|
|
151
|
+
4: string;
|
|
152
|
+
6: string;
|
|
153
|
+
8: string;
|
|
154
|
+
12: string;
|
|
155
|
+
16: string;
|
|
156
|
+
24: string;
|
|
157
|
+
};
|
|
158
|
+
fullWidth: {
|
|
159
|
+
true: string;
|
|
160
|
+
};
|
|
161
|
+
fullHeight: {
|
|
162
|
+
true: string;
|
|
163
|
+
};
|
|
164
|
+
}, undefined, "block", {
|
|
165
|
+
variant: {
|
|
166
|
+
plain: string;
|
|
167
|
+
outlined: string;
|
|
168
|
+
elevated: string;
|
|
169
|
+
soft: string;
|
|
170
|
+
solid: string;
|
|
171
|
+
};
|
|
172
|
+
color: {
|
|
173
|
+
primary: string;
|
|
174
|
+
secondary: string;
|
|
175
|
+
success: string;
|
|
176
|
+
warning: string;
|
|
177
|
+
danger: string;
|
|
178
|
+
info: string;
|
|
179
|
+
neutral: string;
|
|
180
|
+
};
|
|
181
|
+
elevation: {
|
|
182
|
+
0: string;
|
|
183
|
+
1: string;
|
|
184
|
+
2: string;
|
|
185
|
+
3: string;
|
|
186
|
+
4: string;
|
|
187
|
+
5: string;
|
|
188
|
+
};
|
|
189
|
+
rounded: {
|
|
190
|
+
none: string;
|
|
191
|
+
sm: string;
|
|
192
|
+
md: string;
|
|
193
|
+
lg: string;
|
|
194
|
+
xl: string;
|
|
195
|
+
'2xl': string;
|
|
196
|
+
full: string;
|
|
197
|
+
};
|
|
198
|
+
p: {
|
|
199
|
+
0: string;
|
|
200
|
+
'0.5': string;
|
|
201
|
+
1: string;
|
|
202
|
+
2: string;
|
|
203
|
+
3: string;
|
|
204
|
+
4: string;
|
|
205
|
+
6: string;
|
|
206
|
+
8: string;
|
|
207
|
+
12: string;
|
|
208
|
+
16: string;
|
|
209
|
+
24: string;
|
|
210
|
+
};
|
|
211
|
+
px: {
|
|
212
|
+
0: string;
|
|
213
|
+
'0.5': string;
|
|
214
|
+
1: string;
|
|
215
|
+
2: string;
|
|
216
|
+
3: string;
|
|
217
|
+
4: string;
|
|
218
|
+
6: string;
|
|
219
|
+
8: string;
|
|
220
|
+
12: string;
|
|
221
|
+
16: string;
|
|
222
|
+
24: string;
|
|
223
|
+
};
|
|
224
|
+
py: {
|
|
225
|
+
0: string;
|
|
226
|
+
'0.5': string;
|
|
227
|
+
1: string;
|
|
228
|
+
2: string;
|
|
229
|
+
3: string;
|
|
230
|
+
4: string;
|
|
231
|
+
6: string;
|
|
232
|
+
8: string;
|
|
233
|
+
12: string;
|
|
234
|
+
16: string;
|
|
235
|
+
24: string;
|
|
236
|
+
};
|
|
237
|
+
m: {
|
|
238
|
+
0: string;
|
|
239
|
+
'0.5': string;
|
|
240
|
+
1: string;
|
|
241
|
+
2: string;
|
|
242
|
+
3: string;
|
|
243
|
+
4: string;
|
|
244
|
+
6: string;
|
|
245
|
+
8: string;
|
|
246
|
+
12: string;
|
|
247
|
+
16: string;
|
|
248
|
+
24: string;
|
|
249
|
+
};
|
|
250
|
+
mx: {
|
|
251
|
+
0: string;
|
|
252
|
+
'0.5': string;
|
|
253
|
+
1: string;
|
|
254
|
+
2: string;
|
|
255
|
+
3: string;
|
|
256
|
+
4: string;
|
|
257
|
+
6: string;
|
|
258
|
+
8: string;
|
|
259
|
+
12: string;
|
|
260
|
+
16: string;
|
|
261
|
+
24: string;
|
|
262
|
+
};
|
|
263
|
+
my: {
|
|
264
|
+
0: string;
|
|
265
|
+
'0.5': string;
|
|
266
|
+
1: string;
|
|
267
|
+
2: string;
|
|
268
|
+
3: string;
|
|
269
|
+
4: string;
|
|
270
|
+
6: string;
|
|
271
|
+
8: string;
|
|
272
|
+
12: string;
|
|
273
|
+
16: string;
|
|
274
|
+
24: string;
|
|
275
|
+
};
|
|
276
|
+
fullWidth: {
|
|
277
|
+
true: string;
|
|
278
|
+
};
|
|
279
|
+
fullHeight: {
|
|
280
|
+
true: string;
|
|
281
|
+
};
|
|
282
|
+
}, undefined, import("tailwind-variants").TVReturnType<{
|
|
283
|
+
variant: {
|
|
284
|
+
plain: string;
|
|
285
|
+
outlined: string;
|
|
286
|
+
elevated: string;
|
|
287
|
+
soft: string;
|
|
288
|
+
solid: string;
|
|
289
|
+
};
|
|
290
|
+
color: {
|
|
291
|
+
primary: string;
|
|
292
|
+
secondary: string;
|
|
293
|
+
success: string;
|
|
294
|
+
warning: string;
|
|
295
|
+
danger: string;
|
|
296
|
+
info: string;
|
|
297
|
+
neutral: string;
|
|
298
|
+
};
|
|
299
|
+
elevation: {
|
|
300
|
+
0: string;
|
|
301
|
+
1: string;
|
|
302
|
+
2: string;
|
|
303
|
+
3: string;
|
|
304
|
+
4: string;
|
|
305
|
+
5: string;
|
|
306
|
+
};
|
|
307
|
+
rounded: {
|
|
308
|
+
none: string;
|
|
309
|
+
sm: string;
|
|
310
|
+
md: string;
|
|
311
|
+
lg: string;
|
|
312
|
+
xl: string;
|
|
313
|
+
'2xl': string;
|
|
314
|
+
full: string;
|
|
315
|
+
};
|
|
316
|
+
p: {
|
|
317
|
+
0: string;
|
|
318
|
+
'0.5': string;
|
|
319
|
+
1: string;
|
|
320
|
+
2: string;
|
|
321
|
+
3: string;
|
|
322
|
+
4: string;
|
|
323
|
+
6: string;
|
|
324
|
+
8: string;
|
|
325
|
+
12: string;
|
|
326
|
+
16: string;
|
|
327
|
+
24: string;
|
|
328
|
+
};
|
|
329
|
+
px: {
|
|
330
|
+
0: string;
|
|
331
|
+
'0.5': string;
|
|
332
|
+
1: string;
|
|
333
|
+
2: string;
|
|
334
|
+
3: string;
|
|
335
|
+
4: string;
|
|
336
|
+
6: string;
|
|
337
|
+
8: string;
|
|
338
|
+
12: string;
|
|
339
|
+
16: string;
|
|
340
|
+
24: string;
|
|
341
|
+
};
|
|
342
|
+
py: {
|
|
343
|
+
0: string;
|
|
344
|
+
'0.5': string;
|
|
345
|
+
1: string;
|
|
346
|
+
2: string;
|
|
347
|
+
3: string;
|
|
348
|
+
4: string;
|
|
349
|
+
6: string;
|
|
350
|
+
8: string;
|
|
351
|
+
12: string;
|
|
352
|
+
16: string;
|
|
353
|
+
24: string;
|
|
354
|
+
};
|
|
355
|
+
m: {
|
|
356
|
+
0: string;
|
|
357
|
+
'0.5': string;
|
|
358
|
+
1: string;
|
|
359
|
+
2: string;
|
|
360
|
+
3: string;
|
|
361
|
+
4: string;
|
|
362
|
+
6: string;
|
|
363
|
+
8: string;
|
|
364
|
+
12: string;
|
|
365
|
+
16: string;
|
|
366
|
+
24: string;
|
|
367
|
+
};
|
|
368
|
+
mx: {
|
|
369
|
+
0: string;
|
|
370
|
+
'0.5': string;
|
|
371
|
+
1: string;
|
|
372
|
+
2: string;
|
|
373
|
+
3: string;
|
|
374
|
+
4: string;
|
|
375
|
+
6: string;
|
|
376
|
+
8: string;
|
|
377
|
+
12: string;
|
|
378
|
+
16: string;
|
|
379
|
+
24: string;
|
|
380
|
+
};
|
|
381
|
+
my: {
|
|
382
|
+
0: string;
|
|
383
|
+
'0.5': string;
|
|
384
|
+
1: string;
|
|
385
|
+
2: string;
|
|
386
|
+
3: string;
|
|
387
|
+
4: string;
|
|
388
|
+
6: string;
|
|
389
|
+
8: string;
|
|
390
|
+
12: string;
|
|
391
|
+
16: string;
|
|
392
|
+
24: string;
|
|
393
|
+
};
|
|
394
|
+
fullWidth: {
|
|
395
|
+
true: string;
|
|
396
|
+
};
|
|
397
|
+
fullHeight: {
|
|
398
|
+
true: string;
|
|
399
|
+
};
|
|
400
|
+
}, undefined, "block", unknown, unknown, undefined>>;
|
|
401
|
+
export type BoxVariants = VariantProps<typeof boxVariants>;
|
|
402
|
+
//# sourceMappingURL=box.variants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"box.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/Box/box.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oDAkKtB,CAAC;AAEH,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA8BrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/components/Button/Button.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AA8BrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,MAAM,2GAyEjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA2BzD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"Checkbox.d.ts","sourceRoot":"","sources":["../../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AA2BzD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,kDA2L5C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ContainerProps } from './container.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* `<Container>` — centered max-width wrapper for page-level layouts.
|
|
4
|
+
*
|
|
5
|
+
* The pattern is universal: every page-root `<div>` in a non-trivial
|
|
6
|
+
* web app boils down to "mx-auto + max-w-X + responsive horizontal
|
|
7
|
+
* padding". Container collapses that into a typed prop set so the
|
|
8
|
+
* decision lives in ONE place per app section (the Container size),
|
|
9
|
+
* not scattered as utility chains across every page file.
|
|
10
|
+
*
|
|
11
|
+
* Default size is `'xl'` (1280px) — comfortable for full app shells
|
|
12
|
+
* with a left nav + main + optional right rail. Drop to `'lg'` (1024px)
|
|
13
|
+
* for content-heavy docs/marketing, jump to `'2xl'` (1536px) for wide
|
|
14
|
+
* dashboards.
|
|
15
|
+
*
|
|
16
|
+
* Composition pattern — Container at the page root, Stack/Grid inside:
|
|
17
|
+
*
|
|
18
|
+
* <Container size="lg" as="main">
|
|
19
|
+
* <Stack gap={8}>
|
|
20
|
+
* <Typography variant="h1">Page title</Typography>
|
|
21
|
+
* <Grid container spacing={6}>
|
|
22
|
+
* <Grid xs={12} md={6}>...</Grid>
|
|
23
|
+
* </Grid>
|
|
24
|
+
* </Stack>
|
|
25
|
+
* </Container>
|
|
26
|
+
*
|
|
27
|
+
* Container handles the page chrome (centered, padded, capped width);
|
|
28
|
+
* Stack/Grid handle the actual layout of children. Two concerns, two
|
|
29
|
+
* primitives.
|
|
30
|
+
*
|
|
31
|
+
* Polymorphism rule (same as Typography/Box/Stack/Grid): when both
|
|
32
|
+
* `as` and `asChild` are passed, `asChild` wins.
|
|
33
|
+
*/
|
|
34
|
+
export declare const Container: import("react").ForwardRefExoticComponent<ContainerProps & import("react").RefAttributes<HTMLElement>>;
|
|
35
|
+
//# sourceMappingURL=Container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Container.d.ts","sourceRoot":"","sources":["../../../../src/components/Container/Container.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,eAAO,MAAM,SAAS,wGAiCrB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ElementType, HTMLAttributes } from 'react';
|
|
2
|
+
import type { ContainerVariants } from './container.variants.js';
|
|
3
|
+
/**
|
|
4
|
+
* Props for `<Container>` — page-level centered max-width wrapper.
|
|
5
|
+
*
|
|
6
|
+
* Use at the page-root level (or section-root) to constrain content
|
|
7
|
+
* width and apply the canonical responsive horizontal padding ramp.
|
|
8
|
+
* Compose Stack/Grid INSIDE Container for the actual layout work.
|
|
9
|
+
*
|
|
10
|
+
* Native attribute overrides:
|
|
11
|
+
* • `className` omitted in favour of `sx` (utility string, merged
|
|
12
|
+
* via tailwind-merge — same convention as Box/Stack/Grid/Typography).
|
|
13
|
+
*/
|
|
14
|
+
export interface ContainerProps extends Omit<HTMLAttributes<HTMLDivElement>, 'className'>, Pick<ContainerVariants, 'size' | 'px' | 'centerContent'> {
|
|
15
|
+
/**
|
|
16
|
+
* Override the rendered HTML tag. Defaults to `'div'`. Use
|
|
17
|
+
* `as="main"` for the primary content region of a page,
|
|
18
|
+
* `as="section"` for a named section, `as="article"` for a
|
|
19
|
+
* self-contained article shell.
|
|
20
|
+
*
|
|
21
|
+
* Ignored when `asChild` is true.
|
|
22
|
+
*/
|
|
23
|
+
as?: ElementType;
|
|
24
|
+
/**
|
|
25
|
+
* Render via Radix `Slot` — the Container styles paint onto the
|
|
26
|
+
* single React child instead of wrapping it. Useful for letting a
|
|
27
|
+
* router `<main>` element receive the Container chrome without
|
|
28
|
+
* adding an intermediate `<div>` in the tree.
|
|
29
|
+
*
|
|
30
|
+
* Mutually exclusive with `as` (when both are passed, `asChild` wins).
|
|
31
|
+
*/
|
|
32
|
+
asChild?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Utility classes appended to the variant chain. Resolved via
|
|
35
|
+
* `tailwind-merge` so the consumer's classes always win over the
|
|
36
|
+
* variant defaults — useful for one-off vertical padding (`sx="py-8"`),
|
|
37
|
+
* custom max-width (`sx="max-w-3xl"`), etc.
|
|
38
|
+
*/
|
|
39
|
+
sx?: string;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=container.types.d.ts.map
|