@commercetools/nimbus 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1412 -0
- package/dist/index.js +11183 -0
- package/dist/index.js.map +1 -0
- package/dist/index.umd.cjs +27 -0
- package/dist/index.umd.cjs.map +1 -0
- package/package.json +63 -39
- package/.storybook/apca-check/index.ts +0 -150
- package/.storybook/main.ts +0 -64
- package/.storybook/preview.tsx +0 -92
- package/.storybook/vitest.setup.ts +0 -13
- package/docs/architecture-decisions/adr-0001-consumer-component-apis.md +0 -177
- package/docs/architecture-decisions/adr-0002-compound-component-extraction.md +0 -82
- package/src/components/accordion/accordion-context.tsx +0 -17
- package/src/components/accordion/accordion.mdx +0 -172
- package/src/components/accordion/accordion.recipe.tsx +0 -98
- package/src/components/accordion/accordion.slots.tsx +0 -39
- package/src/components/accordion/accordion.stories.tsx +0 -188
- package/src/components/accordion/accordion.tsx +0 -16
- package/src/components/accordion/accordion.types.tsx +0 -54
- package/src/components/accordion/components/accordion-content.tsx +0 -28
- package/src/components/accordion/components/accordion-group.tsx +0 -27
- package/src/components/accordion/components/accordion-header.tsx +0 -63
- package/src/components/accordion/components/accordion-item.tsx +0 -87
- package/src/components/accordion/index.ts +0 -2
- package/src/components/alert/alert.mdx +0 -92
- package/src/components/alert/alert.recipe.tsx +0 -65
- package/src/components/alert/alert.slots.tsx +0 -46
- package/src/components/alert/alert.stories.tsx +0 -308
- package/src/components/alert/alert.tsx +0 -18
- package/src/components/alert/alert.types.tsx +0 -70
- package/src/components/alert/components/alert.actions.tsx +0 -27
- package/src/components/alert/components/alert.description.tsx +0 -27
- package/src/components/alert/components/alert.dismiss-button.tsx +0 -41
- package/src/components/alert/components/alert.root.tsx +0 -92
- package/src/components/alert/components/alert.title.tsx +0 -29
- package/src/components/alert/index.ts +0 -2
- package/src/components/avatar/avatar.mdx +0 -80
- package/src/components/avatar/avatar.recipe.tsx +0 -36
- package/src/components/avatar/avatar.slots.tsx +0 -16
- package/src/components/avatar/avatar.stories.tsx +0 -136
- package/src/components/avatar/avatar.tsx +0 -34
- package/src/components/avatar/avatar.types.ts +0 -33
- package/src/components/avatar/index.ts +0 -2
- package/src/components/badge/badge.mdx +0 -91
- package/src/components/badge/badge.recipe.tsx +0 -72
- package/src/components/badge/badge.slots.tsx +0 -8
- package/src/components/badge/badge.stories.tsx +0 -124
- package/src/components/badge/badge.tsx +0 -35
- package/src/components/badge/badge.types.tsx +0 -40
- package/src/components/badge/index.ts +0 -2
- package/src/components/bleed/bleed.tsx +0 -1
- package/src/components/bleed/index.ts +0 -1
- package/src/components/box/box.mdx +0 -115
- package/src/components/box/box.stories.tsx +0 -71
- package/src/components/box/box.tsx +0 -11
- package/src/components/box/index.ts +0 -1
- package/src/components/button/button.mdx +0 -169
- package/src/components/button/button.recipe.ts +0 -185
- package/src/components/button/button.slots.tsx +0 -45
- package/src/components/button/button.stories.tsx +0 -369
- package/src/components/button/button.tsx +0 -37
- package/src/components/button/button.types.ts +0 -14
- package/src/components/button/index.ts +0 -2
- package/src/components/card/card.mdx +0 -92
- package/src/components/card/card.recipe.tsx +0 -71
- package/src/components/card/card.slots.tsx +0 -50
- package/src/components/card/card.stories.tsx +0 -175
- package/src/components/card/card.tsx +0 -9
- package/src/components/card/card.types.ts +0 -22
- package/src/components/card/components/card.content.tsx +0 -29
- package/src/components/card/components/card.header.tsx +0 -28
- package/src/components/card/components/card.root.tsx +0 -62
- package/src/components/card/index.ts +0 -2
- package/src/components/checkbox/checkbox.mdx +0 -78
- package/src/components/checkbox/checkbox.recipe.tsx +0 -116
- package/src/components/checkbox/checkbox.slots.tsx +0 -33
- package/src/components/checkbox/checkbox.stories.tsx +0 -200
- package/src/components/checkbox/checkbox.tsx +0 -77
- package/src/components/checkbox/checkbox.types.tsx +0 -22
- package/src/components/checkbox/index.ts +0 -2
- package/src/components/code/code.mdx +0 -17
- package/src/components/code/code.recipe.ts +0 -63
- package/src/components/code/code.tsx +0 -1
- package/src/components/code/index.ts +0 -1
- package/src/components/dialog/dialog.mdx +0 -20
- package/src/components/dialog/dialog.recipe.ts +0 -254
- package/src/components/dialog/dialog.tsx +0 -61
- package/src/components/dialog/index.ts +0 -1
- package/src/components/em/em.mdx +0 -17
- package/src/components/em/em.tsx +0 -1
- package/src/components/em/index.ts +0 -1
- package/src/components/flex/flex.mdx +0 -41
- package/src/components/flex/flex.tsx +0 -1
- package/src/components/flex/index.ts +0 -1
- package/src/components/grid/grid.mdx +0 -156
- package/src/components/grid/grid.stories.tsx +0 -151
- package/src/components/grid/grid.tsx +0 -29
- package/src/components/grid/index.ts +0 -1
- package/src/components/heading/heading.mdx +0 -23
- package/src/components/heading/heading.recipe.ts +0 -49
- package/src/components/heading/heading.tsx +0 -1
- package/src/components/heading/index.ts +0 -1
- package/src/components/highlight/highlight.mdx +0 -18
- package/src/components/highlight/highlight.tsx +0 -1
- package/src/components/highlight/index.ts +0 -1
- package/src/components/icon-button/icon-button.mdx +0 -98
- package/src/components/icon-button/icon-button.stories.tsx +0 -188
- package/src/components/icon-button/icon-button.tsx +0 -21
- package/src/components/icon-button/icon-button.types.tsx +0 -10
- package/src/components/icon-button/index.ts +0 -2
- package/src/components/index.ts +0 -33
- package/src/components/input/index.ts +0 -1
- package/src/components/input/input.mdx +0 -20
- package/src/components/input/input.recipe.ts +0 -95
- package/src/components/input/input.tsx +0 -1
- package/src/components/input-group/index.ts +0 -1
- package/src/components/input-group/input-group.mdx +0 -20
- package/src/components/input-group/input-group.tsx +0 -44
- package/src/components/kbd/index.ts +0 -1
- package/src/components/kbd/kbd.mdx +0 -18
- package/src/components/kbd/kbd.recipe.ts +0 -57
- package/src/components/kbd/kbd.tsx +0 -1
- package/src/components/link/index.ts +0 -2
- package/src/components/link/link.mdx +0 -77
- package/src/components/link/link.recipe.ts +0 -52
- package/src/components/link/link.slots.tsx +0 -29
- package/src/components/link/link.stories.tsx +0 -204
- package/src/components/link/link.tsx +0 -38
- package/src/components/link/link.types.tsx +0 -26
- package/src/components/list/index.ts +0 -1
- package/src/components/list/list.mdx +0 -18
- package/src/components/list/list.recipe.ts +0 -68
- package/src/components/list/list.tsx +0 -9
- package/src/components/loading-spinner/index.ts +0 -2
- package/src/components/loading-spinner/loading-spinner.mdx +0 -92
- package/src/components/loading-spinner/loading-spinner.recipe.tsx +0 -70
- package/src/components/loading-spinner/loading-spinner.slots.tsx +0 -38
- package/src/components/loading-spinner/loading-spinner.stories.tsx +0 -97
- package/src/components/loading-spinner/loading-spinner.tsx +0 -50
- package/src/components/loading-spinner/loading-spinner.types.tsx +0 -21
- package/src/components/nimbus-provider/color-mode.tsx +0 -32
- package/src/components/nimbus-provider/index.ts +0 -2
- package/src/components/nimbus-provider/nimbus-provider.mdx +0 -21
- package/src/components/nimbus-provider/nimbus-provider.tsx +0 -51
- package/src/components/select/components/select.clear-button.tsx +0 -31
- package/src/components/select/components/select.option-group.tsx +0 -48
- package/src/components/select/components/select.option.tsx +0 -21
- package/src/components/select/components/select.options.tsx +0 -23
- package/src/components/select/components/select.root.tsx +0 -81
- package/src/components/select/index.ts +0 -2
- package/src/components/select/select.mdx +0 -170
- package/src/components/select/select.recipe.tsx +0 -216
- package/src/components/select/select.slots.tsx +0 -58
- package/src/components/select/select.stories.tsx +0 -841
- package/src/components/select/select.tsx +0 -18
- package/src/components/select/select.types.tsx +0 -37
- package/src/components/simple-grid/index.ts +0 -1
- package/src/components/simple-grid/simple-grid.mdx +0 -133
- package/src/components/simple-grid/simple-grid.stories.tsx +0 -143
- package/src/components/simple-grid/simple-grid.tsx +0 -31
- package/src/components/stack/index.ts +0 -1
- package/src/components/stack/stack.mdx +0 -88
- package/src/components/stack/stack.stories.tsx +0 -82
- package/src/components/stack/stack.tsx +0 -15
- package/src/components/table/index.ts +0 -1
- package/src/components/table/table.mdx +0 -23
- package/src/components/table/table.recipe.ts +0 -170
- package/src/components/table/table.tsx +0 -43
- package/src/components/text/index.ts +0 -1
- package/src/components/text/text.mdx +0 -244
- package/src/components/text/text.tsx +0 -23
- package/src/components/text-input/index.ts +0 -2
- package/src/components/text-input/text-input.mdx +0 -118
- package/src/components/text-input/text-input.recipe.tsx +0 -68
- package/src/components/text-input/text-input.slots.tsx +0 -24
- package/src/components/text-input/text-input.stories.tsx +0 -282
- package/src/components/text-input/text-input.tsx +0 -39
- package/src/components/text-input/text-input.types.ts +0 -7
- package/src/components/toggle-button-group/components/toggle-button-group.button.tsx +0 -14
- package/src/components/toggle-button-group/components/toggle-button-group.root.tsx +0 -15
- package/src/components/toggle-button-group/index.ts +0 -2
- package/src/components/toggle-button-group/toggle-button-group.mdx +0 -94
- package/src/components/toggle-button-group/toggle-button-group.recipe.tsx +0 -64
- package/src/components/toggle-button-group/toggle-button-group.slots.tsx +0 -26
- package/src/components/toggle-button-group/toggle-button-group.stories.tsx +0 -311
- package/src/components/toggle-button-group/toggle-button-group.tsx +0 -12
- package/src/components/toggle-button-group/toggle-button-group.types.tsx +0 -62
- package/src/components/tooltip/index.ts +0 -4
- package/src/components/tooltip/make-element-focusable.stories.tsx +0 -56
- package/src/components/tooltip/make-element-focusable.tsx +0 -57
- package/src/components/tooltip/tooltip-trigger.stories.tsx +0 -157
- package/src/components/tooltip/tooltip-trigger.tsx +0 -15
- package/src/components/tooltip/tooltip.mdx +0 -48
- package/src/components/tooltip/tooltip.recipe.ts +0 -26
- package/src/components/tooltip/tooltip.slots.ts +0 -35
- package/src/components/tooltip/tooltip.stories.tsx +0 -139
- package/src/components/tooltip/tooltip.tsx +0 -31
- package/src/components/tooltip/tooltip.types.ts +0 -44
- package/src/components/visually-hidden/index.ts +0 -1
- package/src/components/visually-hidden/visually-hidden.mdx +0 -61
- package/src/components/visually-hidden/visually-hidden.stories.tsx +0 -124
- package/src/components/visually-hidden/visually-hidden.tsx +0 -18
- package/src/docs/accessibility.mdx +0 -21
- package/src/docs/background.mdx +0 -154
- package/src/docs/border.mdx +0 -226
- package/src/docs/changelog.mdx +0 -17
- package/src/docs/components-layout.mdx +0 -22
- package/src/docs/components.mdx +0 -17
- package/src/docs/data-display.mdx +0 -23
- package/src/docs/display.mdx +0 -55
- package/src/docs/effects.mdx +0 -73
- package/src/docs/feedback.mdx +0 -22
- package/src/docs/filters.mdx +0 -268
- package/src/docs/flex-and-grid.mdx +0 -445
- package/src/docs/forms.mdx +0 -22
- package/src/docs/generated/index.mdx +0 -16
- package/src/docs/getting-started.mdx +0 -17
- package/src/docs/home.mdx +0 -56
- package/src/docs/hooks.mdx +0 -16
- package/src/docs/inputs.mdx +0 -21
- package/src/docs/installation.mdx +0 -60
- package/src/docs/interactivity.mdx +0 -278
- package/src/docs/known-issues.mdx +0 -19
- package/src/docs/layout.mdx +0 -301
- package/src/docs/list.mdx +0 -82
- package/src/docs/markdown.mdx +0 -234
- package/src/docs/media.mdx +0 -22
- package/src/docs/naivgation.mdx +0 -22
- package/src/docs/playground.mdx +0 -16
- package/src/docs/rfcs-component-structure-rfcs.mdx +0 -17
- package/src/docs/rfcs-component-structure.mdx +0 -74
- package/src/docs/rfcs-hook-structure.mdx +0 -59
- package/src/docs/sizing.mdx +0 -210
- package/src/docs/spacing.mdx +0 -193
- package/src/docs/style-props-typography.mdx +0 -373
- package/src/docs/style-props.mdx +0 -15
- package/src/docs/svg.mdx +0 -58
- package/src/docs/tables.mdx +0 -95
- package/src/docs/toc.mdx +0 -39
- package/src/docs/tokens/animations.mdx +0 -68
- package/src/docs/tokens/aspect-ratios.mdx +0 -21
- package/src/docs/tokens/blurs.mdx +0 -20
- package/src/docs/tokens/borders.mdx +0 -25
- package/src/docs/tokens/breakpoints.mdx +0 -35
- package/src/docs/tokens/colors.mdx +0 -86
- package/src/docs/tokens/cursors.mdx +0 -21
- package/src/docs/tokens/radii.mdx +0 -23
- package/src/docs/tokens/shadows.mdx +0 -21
- package/src/docs/tokens/sizes.mdx +0 -54
- package/src/docs/tokens/spacing.mdx +0 -35
- package/src/docs/tokens/typography.mdx +0 -61
- package/src/docs/tokens/z-indices.mdx +0 -23
- package/src/docs/tokens-other.mdx +0 -17
- package/src/docs/tokens.mdx +0 -16
- package/src/docs/transforms.mdx +0 -150
- package/src/docs/transitions.mdx +0 -164
- package/src/docs/typography.mdx +0 -17
- package/src/docs/utilities.mdx +0 -17
- package/src/hooks/index.ts +0 -2
- package/src/hooks/use-copy-to-clipboard/use-copy-to-clipboard.mdx +0 -54
- package/src/hooks/use-copy-to-clipboard/use-copy-to-clipboard.ts +0 -1
- package/src/hooks/use-hotkeys/use-hotkeys.mdx +0 -48
- package/src/hooks/use-hotkeys/use-hotkeys.stories.tsx +0 -69
- package/src/hooks/use-hotkeys/use-hotkeys.ts +0 -1
- package/src/index.ts +0 -3
- package/src/test/utils.tsx +0 -20
- package/src/theme/animation-styles.ts +0 -52
- package/src/theme/breakpoints.ts +0 -32
- package/src/theme/global-css.ts +0 -53
- package/src/theme/index.ts +0 -35
- package/src/theme/keyframes.ts +0 -192
- package/src/theme/layer-styles.ts +0 -12
- package/src/theme/recipes/index.ts +0 -21
- package/src/theme/semantic-tokens/colors.ts +0 -55
- package/src/theme/semantic-tokens/index.ts +0 -9
- package/src/theme/semantic-tokens/radii.ts +0 -3
- package/src/theme/semantic-tokens/shadows.ts +0 -4
- package/src/theme/slot-recipes/index.ts +0 -15
- package/src/theme/text-styles.ts +0 -8
- package/src/theme/tokens/animations.ts +0 -4
- package/src/theme/tokens/aspect-ratios.ts +0 -5
- package/src/theme/tokens/blurs.ts +0 -5
- package/src/theme/tokens/borders.ts +0 -4
- package/src/theme/tokens/colors.ts +0 -8
- package/src/theme/tokens/cursor.ts +0 -4
- package/src/theme/tokens/durations.ts +0 -4
- package/src/theme/tokens/easings.ts +0 -4
- package/src/theme/tokens/font-sizes.ts +0 -4
- package/src/theme/tokens/font-weights.ts +0 -4
- package/src/theme/tokens/fonts.ts +0 -4
- package/src/theme/tokens/index.ts +0 -57
- package/src/theme/tokens/letter-spacings.ts +0 -24
- package/src/theme/tokens/line-heights.ts +0 -4
- package/src/theme/tokens/radii.ts +0 -4
- package/src/theme/tokens/sizes.ts +0 -120
- package/src/theme/tokens/spacing.ts +0 -4
- package/src/theme/tokens/z-index.ts +0 -4
- package/src/utils/extractStyleProps.ts +0 -26
- package/src/utils/fixedForwardRef.ts +0 -17
- package/tsconfig.json +0 -38
- package/vite.config.ts +0 -54
- package/vitest.config.ts +0 -50
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { Dialog as ChakraDialog, Portal } from "@chakra-ui/react";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
|
-
import { Button } from "../button";
|
|
4
|
-
|
|
5
|
-
interface DialogContentProps extends ChakraDialog.ContentProps {
|
|
6
|
-
portalled?: boolean;
|
|
7
|
-
portalRef?: React.RefObject<HTMLElement>;
|
|
8
|
-
backdrop?: boolean;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const DialogContent = forwardRef<HTMLDivElement, DialogContentProps>(
|
|
12
|
-
function DialogContent(props, ref) {
|
|
13
|
-
const {
|
|
14
|
-
children,
|
|
15
|
-
portalled = true,
|
|
16
|
-
portalRef,
|
|
17
|
-
backdrop = true,
|
|
18
|
-
...rest
|
|
19
|
-
} = props;
|
|
20
|
-
|
|
21
|
-
return (
|
|
22
|
-
<Portal disabled={!portalled} container={portalRef}>
|
|
23
|
-
{backdrop && <ChakraDialog.Backdrop />}
|
|
24
|
-
<ChakraDialog.Positioner>
|
|
25
|
-
<ChakraDialog.Content ref={ref} {...rest} asChild={false}>
|
|
26
|
-
{children}
|
|
27
|
-
</ChakraDialog.Content>
|
|
28
|
-
</ChakraDialog.Positioner>
|
|
29
|
-
</Portal>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
|
|
34
|
-
export const DialogCloseTrigger = forwardRef<
|
|
35
|
-
HTMLButtonElement,
|
|
36
|
-
ChakraDialog.CloseTriggerProps
|
|
37
|
-
>(function DialogCloseTrigger(props, ref) {
|
|
38
|
-
return (
|
|
39
|
-
<ChakraDialog.CloseTrigger
|
|
40
|
-
position="absolute"
|
|
41
|
-
top="2"
|
|
42
|
-
insetEnd="2"
|
|
43
|
-
{...props}
|
|
44
|
-
asChild
|
|
45
|
-
>
|
|
46
|
-
<Button size="xs" ref={ref}>
|
|
47
|
-
{props.children}
|
|
48
|
-
</Button>
|
|
49
|
-
</ChakraDialog.CloseTrigger>
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
export const DialogRoot = ChakraDialog.Root;
|
|
54
|
-
export const DialogFooter = ChakraDialog.Footer;
|
|
55
|
-
export const DialogHeader = ChakraDialog.Header;
|
|
56
|
-
export const DialogBody = ChakraDialog.Body;
|
|
57
|
-
export const DialogBackdrop = ChakraDialog.Backdrop;
|
|
58
|
-
export const DialogTitle = ChakraDialog.Title;
|
|
59
|
-
export const DialogDescription = ChakraDialog.Description;
|
|
60
|
-
export const DialogTrigger = ChakraDialog.Trigger;
|
|
61
|
-
export const DialogActionTrigger = ChakraDialog.ActionTrigger;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./dialog.tsx";
|
package/src/components/em/em.mdx
DELETED
package/src/components/em/em.tsx
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Em } from "@chakra-ui/react";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./em.tsx";
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: Flex
|
|
3
|
-
title: Flex
|
|
4
|
-
description:
|
|
5
|
-
the Flex component is used to create layouts based on css display flex
|
|
6
|
-
documentState: InitialDraft
|
|
7
|
-
order: 999
|
|
8
|
-
menu:
|
|
9
|
-
- Components
|
|
10
|
-
- Layout
|
|
11
|
-
- Flex
|
|
12
|
-
tags:
|
|
13
|
-
- flex
|
|
14
|
-
- flexbox
|
|
15
|
-
- layout
|
|
16
|
-
- container
|
|
17
|
-
- div
|
|
18
|
-
- low level
|
|
19
|
-
---
|
|
20
|
-
|
|
21
|
-
# Flex
|
|
22
|
-
|
|
23
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec
|
|
24
|
-
nunc tincidunt tincidunt. Nullam nec pur
|
|
25
|
-
|
|
26
|
-
## Usage
|
|
27
|
-
|
|
28
|
-
```jsx
|
|
29
|
-
import { Flex } from "@commercetools/nimbus";
|
|
30
|
-
|
|
31
|
-
const Component = () => (
|
|
32
|
-
<Flex>
|
|
33
|
-
<p>Content</p>
|
|
34
|
-
</Flex>
|
|
35
|
-
);
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
## Second Subheading
|
|
39
|
-
|
|
40
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam nec purus nec
|
|
41
|
-
nunc tincidunt tincidunt. Nullam nec pur
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Flex } from "@chakra-ui/react";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./flex.tsx";
|
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: Components-Grid
|
|
3
|
-
title: Grid
|
|
4
|
-
description:
|
|
5
|
-
An easily customizable Grid component, re-exported from Chakra UI, that
|
|
6
|
-
provides a consistent layout structure across different products.
|
|
7
|
-
documentState: InitialDraft
|
|
8
|
-
order: 999
|
|
9
|
-
menu:
|
|
10
|
-
- Components
|
|
11
|
-
- Layout
|
|
12
|
-
- Grid
|
|
13
|
-
tags:
|
|
14
|
-
- component
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# Grid
|
|
18
|
-
|
|
19
|
-
The Grid Layout Component provides a flexible and responsive way to structure
|
|
20
|
-
content using a two-dimensional grid system. It allows elements to be arranged
|
|
21
|
-
in rows and columns, enabling dynamic and efficient layouts for different screen
|
|
22
|
-
sizes.
|
|
23
|
-
|
|
24
|
-
The component accepts all the chakra supported properties and `Grid.Item` as
|
|
25
|
-
children elements
|
|
26
|
-
|
|
27
|
-
## Basic Usage
|
|
28
|
-
|
|
29
|
-
Use Grid → When you need fine control over layout, spanning, and custom grid
|
|
30
|
-
behaviors.
|
|
31
|
-
|
|
32
|
-
```jsx
|
|
33
|
-
import { Grid } from "@commercetools/nimbus";
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
To use the Grid layout, ensure to wrap the individual grid items inside of the
|
|
37
|
-
`<Grid.Item>` component
|
|
38
|
-
|
|
39
|
-
```jsx-live
|
|
40
|
-
const App = () => (
|
|
41
|
-
<Grid gap="100">
|
|
42
|
-
<Grid.Item>
|
|
43
|
-
<Box key="1" p="400" bg="neutral.7">
|
|
44
|
-
Item 1
|
|
45
|
-
</Box>
|
|
46
|
-
</Grid.Item>
|
|
47
|
-
<Grid.Item>
|
|
48
|
-
<Box key="1" p="400" bg="neutral.7">
|
|
49
|
-
Item 2
|
|
50
|
-
</Box>
|
|
51
|
-
</Grid.Item>
|
|
52
|
-
</Grid>
|
|
53
|
-
)
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
### With Columns
|
|
57
|
-
|
|
58
|
-
```jsx-live
|
|
59
|
-
const App = () => (
|
|
60
|
-
<Grid gap="100" templateColumns="repeat(2, 1fr)">
|
|
61
|
-
<Grid.Item>
|
|
62
|
-
<Box key="1" p="400" bg="neutral.7">
|
|
63
|
-
Item 1
|
|
64
|
-
</Box>
|
|
65
|
-
</Grid.Item>
|
|
66
|
-
<Grid.Item>
|
|
67
|
-
<Box key="1" p="400" bg="neutral.7">
|
|
68
|
-
Item 2
|
|
69
|
-
</Box>
|
|
70
|
-
</Grid.Item>
|
|
71
|
-
</Grid>
|
|
72
|
-
)
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
### With Varrying Layout
|
|
76
|
-
|
|
77
|
-
Showcases how elements can span multiple rows and columns within a structured
|
|
78
|
-
grid. This layout is useful for dashboards, content cards, or complex UI
|
|
79
|
-
components where elements need different sizes while maintaining alignment.
|
|
80
|
-
|
|
81
|
-
```jsx-live
|
|
82
|
-
const App = () => (
|
|
83
|
-
<Grid
|
|
84
|
-
h="200px"
|
|
85
|
-
templateRows="repeat(2, 1fr)"
|
|
86
|
-
templateColumns="repeat(5, 1fr)"
|
|
87
|
-
gap={4}
|
|
88
|
-
>
|
|
89
|
-
<Grid.Item rowSpan={2} colSpan={1}>
|
|
90
|
-
<Box p="400" bg="neutral.7">
|
|
91
|
-
colSpan=1
|
|
92
|
-
</Box>
|
|
93
|
-
</Grid.Item>
|
|
94
|
-
<Grid.Item colSpan={2}>
|
|
95
|
-
<Box p="400" bg="neutral.7">
|
|
96
|
-
colSpan=2
|
|
97
|
-
</Box>
|
|
98
|
-
</Grid.Item>
|
|
99
|
-
<Grid.Item colSpan={2}>
|
|
100
|
-
<Box p="400" bg="neutral.7">
|
|
101
|
-
colSpan=2
|
|
102
|
-
</Box>
|
|
103
|
-
</Grid.Item>
|
|
104
|
-
<Grid.Item colSpan={4}>
|
|
105
|
-
<Box p="400" bg="neutral.7">
|
|
106
|
-
colSpan=4
|
|
107
|
-
</Box>
|
|
108
|
-
</Grid.Item>
|
|
109
|
-
</Grid>
|
|
110
|
-
)
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### With TemplateAreas properties
|
|
114
|
-
|
|
115
|
-
Demonstrate layout with template areas - shows how to create a common page
|
|
116
|
-
layout pattern
|
|
117
|
-
|
|
118
|
-
```jsx-live
|
|
119
|
-
const App = () => (
|
|
120
|
-
<Grid
|
|
121
|
-
h="400px"
|
|
122
|
-
templateAreas={`
|
|
123
|
-
"header header"
|
|
124
|
-
"nav main"
|
|
125
|
-
"footer footer"
|
|
126
|
-
`}
|
|
127
|
-
templateColumns="200px 1fr"
|
|
128
|
-
gap="400"
|
|
129
|
-
>
|
|
130
|
-
<Grid.Item gridArea="header">
|
|
131
|
-
<Box p="400" bg="neutral.7" h="full">
|
|
132
|
-
Header
|
|
133
|
-
</Box>
|
|
134
|
-
</Grid.Item>
|
|
135
|
-
<Grid.Item gridArea="nav">
|
|
136
|
-
<Box p="400" bg="neutral.7" h="full">
|
|
137
|
-
Navigation
|
|
138
|
-
</Box>
|
|
139
|
-
</Grid.Item>
|
|
140
|
-
<Grid.Item gridArea="main">
|
|
141
|
-
<Box p="400" bg="neutral.7" h="full">
|
|
142
|
-
Main Content
|
|
143
|
-
</Box>
|
|
144
|
-
</Grid.Item>
|
|
145
|
-
<Grid.Item gridArea="footer">
|
|
146
|
-
<Box p="400" bg="neutral.7" h="full">
|
|
147
|
-
Footer
|
|
148
|
-
</Box>
|
|
149
|
-
</Grid.Item>
|
|
150
|
-
</Grid>
|
|
151
|
-
)
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
## Props
|
|
155
|
-
|
|
156
|
-
<PropTable id="Grid" />
|
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
2
|
-
import { Box } from "../box";
|
|
3
|
-
import { Grid } from "./grid";
|
|
4
|
-
import { within, expect } from "@storybook/test";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Storybook metadata configuration
|
|
8
|
-
* - title: determines the location in the sidebar
|
|
9
|
-
* - component: references the component being documented
|
|
10
|
-
*/
|
|
11
|
-
const meta: Meta<typeof Grid> = {
|
|
12
|
-
title: "components/Grid",
|
|
13
|
-
component: Grid,
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
export default meta;
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Story type for TypeScript support
|
|
20
|
-
* StoryObj provides type checking for our story configurations
|
|
21
|
-
*/
|
|
22
|
-
type Story = StoryObj<typeof Grid>;
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Base story
|
|
26
|
-
* Demonstrates the most basic implementation
|
|
27
|
-
* Uses the args pattern for dynamic control panel inputs
|
|
28
|
-
*/
|
|
29
|
-
export const Base: Story = {
|
|
30
|
-
args: {
|
|
31
|
-
gap: "100",
|
|
32
|
-
["aria-label"]: "test-layout",
|
|
33
|
-
// @ts-expect-error - data-testid is not a valid prop
|
|
34
|
-
["data-testid"]: "test",
|
|
35
|
-
|
|
36
|
-
children: [
|
|
37
|
-
<Box key="1" p="400" bg="neutral.7">
|
|
38
|
-
Item 1
|
|
39
|
-
</Box>,
|
|
40
|
-
<Box key="2" p="400" bg="neutral.7">
|
|
41
|
-
Item 2
|
|
42
|
-
</Box>,
|
|
43
|
-
],
|
|
44
|
-
},
|
|
45
|
-
play: async ({ canvasElement, step }) => {
|
|
46
|
-
const canvas = within(canvasElement);
|
|
47
|
-
const layout = canvas.getByTestId("test");
|
|
48
|
-
|
|
49
|
-
await step("Forwards data- & aria-attributes", async () => {
|
|
50
|
-
await expect(layout).toHaveAttribute("data-testid", "test");
|
|
51
|
-
await expect(layout).toHaveAttribute("aria-label", "test-layout");
|
|
52
|
-
});
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* Showcase with simple column layout
|
|
58
|
-
*/
|
|
59
|
-
export const WithColumns: Story = {
|
|
60
|
-
args: {
|
|
61
|
-
gap: "100",
|
|
62
|
-
templateColumns: "repeat(2, 1fr)",
|
|
63
|
-
children: [
|
|
64
|
-
<Box key="1" p="400" bg="neutral.7">
|
|
65
|
-
Item 1
|
|
66
|
-
</Box>,
|
|
67
|
-
<Box key="2" p="400" bg="neutral.7">
|
|
68
|
-
Item 2
|
|
69
|
-
</Box>,
|
|
70
|
-
],
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Showcase Varrying rows or columns
|
|
76
|
-
*/
|
|
77
|
-
export const WithVarryingLayout: Story = {
|
|
78
|
-
render: () => {
|
|
79
|
-
return (
|
|
80
|
-
<Grid
|
|
81
|
-
h="200px"
|
|
82
|
-
templateRows="repeat(2, 1fr)"
|
|
83
|
-
templateColumns="repeat(5, 1fr)"
|
|
84
|
-
gap={4}
|
|
85
|
-
>
|
|
86
|
-
<Grid.Item rowSpan={2} colSpan={1}>
|
|
87
|
-
<Box p="400" bg="neutral.7">
|
|
88
|
-
colSpan=1
|
|
89
|
-
</Box>
|
|
90
|
-
</Grid.Item>
|
|
91
|
-
<Grid.Item colSpan={2}>
|
|
92
|
-
<Box p="400" bg="neutral.7">
|
|
93
|
-
colSpan=2
|
|
94
|
-
</Box>
|
|
95
|
-
</Grid.Item>
|
|
96
|
-
<Grid.Item colSpan={2}>
|
|
97
|
-
<Box p="400" bg="neutral.7">
|
|
98
|
-
colSpan=2
|
|
99
|
-
</Box>
|
|
100
|
-
</Grid.Item>
|
|
101
|
-
<Grid.Item colSpan={4}>
|
|
102
|
-
<Box p="400" bg="neutral.7">
|
|
103
|
-
colSpan=4
|
|
104
|
-
</Box>
|
|
105
|
-
</Grid.Item>
|
|
106
|
-
</Grid>
|
|
107
|
-
);
|
|
108
|
-
},
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* Demonstrate layout with template areas
|
|
113
|
-
* Shows how to create a common page layout pattern
|
|
114
|
-
*/
|
|
115
|
-
export const WithTemplateAreas: Story = {
|
|
116
|
-
render: () => {
|
|
117
|
-
return (
|
|
118
|
-
<Grid
|
|
119
|
-
h="400px"
|
|
120
|
-
templateAreas={`
|
|
121
|
-
"header header"
|
|
122
|
-
"nav main"
|
|
123
|
-
"footer footer"
|
|
124
|
-
`}
|
|
125
|
-
templateColumns="200px 1fr"
|
|
126
|
-
gap="400"
|
|
127
|
-
>
|
|
128
|
-
<Grid.Item gridArea="header">
|
|
129
|
-
<Box p="400" bg="neutral.7" h="full">
|
|
130
|
-
Header
|
|
131
|
-
</Box>
|
|
132
|
-
</Grid.Item>
|
|
133
|
-
<Grid.Item gridArea="nav">
|
|
134
|
-
<Box p="400" bg="neutral.7" h="full">
|
|
135
|
-
Navigation
|
|
136
|
-
</Box>
|
|
137
|
-
</Grid.Item>
|
|
138
|
-
<Grid.Item gridArea="main">
|
|
139
|
-
<Box p="400" bg="neutral.7" h="full">
|
|
140
|
-
Main Content
|
|
141
|
-
</Box>
|
|
142
|
-
</Grid.Item>
|
|
143
|
-
<Grid.Item gridArea="footer">
|
|
144
|
-
<Box p="400" bg="neutral.7" h="full">
|
|
145
|
-
Footer
|
|
146
|
-
</Box>
|
|
147
|
-
</Grid.Item>
|
|
148
|
-
</Grid>
|
|
149
|
-
);
|
|
150
|
-
},
|
|
151
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { forwardRef } from "react";
|
|
2
|
-
import {
|
|
3
|
-
Grid as ChakraGrid,
|
|
4
|
-
GridItem,
|
|
5
|
-
type GridProps as ChakraGridProps,
|
|
6
|
-
} from "@chakra-ui/react";
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Grid
|
|
10
|
-
* ============================================================
|
|
11
|
-
* The Grid Layout Component provides a flexible and responsive way to structure content using a two-dimensional grid system. It allows elements to be arranged in rows and columns, enabling dynamic and efficient layouts for different screen sizes.
|
|
12
|
-
*
|
|
13
|
-
* Features:
|
|
14
|
-
*
|
|
15
|
-
* - allows forwarding refs to the underlying DOM element
|
|
16
|
-
*/
|
|
17
|
-
export interface GridProps extends ChakraGridProps {
|
|
18
|
-
children?: React.ReactNode;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const GridComponent = forwardRef<HTMLDivElement, GridProps>((props, ref) => {
|
|
22
|
-
return <ChakraGrid ref={ref} {...props} />;
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
GridComponent.displayName = "Grid";
|
|
26
|
-
|
|
27
|
-
export const Grid = Object.assign(GridComponent, {
|
|
28
|
-
Item: GridItem,
|
|
29
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Grid, type GridProps } from "./grid";
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: Heading
|
|
3
|
-
title: Heading
|
|
4
|
-
description: renders a heading
|
|
5
|
-
documentState: InitialDraft
|
|
6
|
-
order: 2
|
|
7
|
-
menu:
|
|
8
|
-
- Components
|
|
9
|
-
- Typography
|
|
10
|
-
- Heading
|
|
11
|
-
tags:
|
|
12
|
-
- heading
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
# Heading
|
|
16
|
-
|
|
17
|
-
Like Text, but with predefined styles for a heading/title look and semantic
|
|
18
|
-
meaning, which makes source code easier to scan by clearly highlighting the
|
|
19
|
-
content's hierarchy and purpose.
|
|
20
|
-
|
|
21
|
-
> [!NOTE]
|
|
22
|
-
> Checkout the [Text component](/components/typography/text) for configuration
|
|
23
|
-
> options.
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { defineRecipe } from "@chakra-ui/react";
|
|
2
|
-
|
|
3
|
-
export const headingRecipe = defineRecipe({
|
|
4
|
-
className: "nimbus-heading",
|
|
5
|
-
base: {
|
|
6
|
-
fontFamily: "heading",
|
|
7
|
-
fontWeight: "600",
|
|
8
|
-
},
|
|
9
|
-
variants: {
|
|
10
|
-
size: {
|
|
11
|
-
xs: {
|
|
12
|
-
textStyle: "xs",
|
|
13
|
-
},
|
|
14
|
-
sm: {
|
|
15
|
-
textStyle: "sm",
|
|
16
|
-
},
|
|
17
|
-
md: {
|
|
18
|
-
textStyle: "md",
|
|
19
|
-
},
|
|
20
|
-
lg: {
|
|
21
|
-
textStyle: "lg",
|
|
22
|
-
},
|
|
23
|
-
xl: {
|
|
24
|
-
textStyle: "xl",
|
|
25
|
-
},
|
|
26
|
-
"2xl": {
|
|
27
|
-
textStyle: "2xl",
|
|
28
|
-
},
|
|
29
|
-
"3xl": {
|
|
30
|
-
textStyle: "3xl",
|
|
31
|
-
},
|
|
32
|
-
"4xl": {
|
|
33
|
-
textStyle: "4xl",
|
|
34
|
-
},
|
|
35
|
-
"5xl": {
|
|
36
|
-
textStyle: "5xl",
|
|
37
|
-
},
|
|
38
|
-
"6xl": {
|
|
39
|
-
textStyle: "6xl",
|
|
40
|
-
},
|
|
41
|
-
"7xl": {
|
|
42
|
-
textStyle: "7xl",
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
defaultVariants: {
|
|
47
|
-
size: "xl",
|
|
48
|
-
},
|
|
49
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Heading } from "@chakra-ui/react";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./heading.tsx";
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: Highlight
|
|
3
|
-
title: Highlight
|
|
4
|
-
description: highlights a substring in a string
|
|
5
|
-
documentState: InitialDraft
|
|
6
|
-
order: 999
|
|
7
|
-
menu:
|
|
8
|
-
- Components
|
|
9
|
-
- Typography
|
|
10
|
-
- Highlight
|
|
11
|
-
tags:
|
|
12
|
-
- highlight
|
|
13
|
-
- mark
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
# Highlight
|
|
17
|
-
|
|
18
|
-
Add description later.rr
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Highlight } from "@chakra-ui/react";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./highlight.tsx";
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
id: Components-IconButton
|
|
3
|
-
title: IconButton
|
|
4
|
-
description: displays a button with an icon only as child
|
|
5
|
-
documentState: InitialDraft
|
|
6
|
-
order: 999
|
|
7
|
-
menu:
|
|
8
|
-
- Components
|
|
9
|
-
- Inputs
|
|
10
|
-
- IconButton
|
|
11
|
-
tags:
|
|
12
|
-
- component
|
|
13
|
-
figmaLink: >-
|
|
14
|
-
https://www.figma.com/design/AvtPX6g7OGGCRvNlatGOIY/New-Design-System?node-id=58-132&m=dev
|
|
15
|
-
---
|
|
16
|
-
|
|
17
|
-
# IconButton
|
|
18
|
-
|
|
19
|
-
displays a button with an icon only as child.
|
|
20
|
-
|
|
21
|
-
## Basic Usage
|
|
22
|
-
|
|
23
|
-
If unconfigured `IconButton` will default to a neutral state. It is important to
|
|
24
|
-
configure `IconButton` properly to ensure it displays as intended.
|
|
25
|
-
|
|
26
|
-
```jsx-live
|
|
27
|
-
const App = () => <IconButton><Icons.ArrowForward/></IconButton>
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
### Sizes
|
|
31
|
-
|
|
32
|
-
Available sizes.
|
|
33
|
-
|
|
34
|
-
```jsx-live
|
|
35
|
-
const App = () => {
|
|
36
|
-
const sizes = ['md', 'xs', '2xs'];
|
|
37
|
-
|
|
38
|
-
return (
|
|
39
|
-
<Stack direction="horizontal" alignItems="center">
|
|
40
|
-
{sizes.map(size => (
|
|
41
|
-
<IconButton tone="primary" variant="solid" key={size} size={size}>
|
|
42
|
-
<Icons.AutoFixHigh/>
|
|
43
|
-
</IconButton>
|
|
44
|
-
))}
|
|
45
|
-
</Stack>
|
|
46
|
-
)
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
### Variants
|
|
51
|
-
|
|
52
|
-
Available variants.
|
|
53
|
-
|
|
54
|
-
```jsx-live
|
|
55
|
-
const App = () => {
|
|
56
|
-
|
|
57
|
-
const variants = ['solid', 'outline', 'ghost', 'link'];
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<Stack direction="horizontal">
|
|
61
|
-
{variants.map(variant => (
|
|
62
|
-
<IconButton tone="primary" key={variant} variant={variant}>
|
|
63
|
-
<Icons.AutoFixHigh/>
|
|
64
|
-
</IconButton>
|
|
65
|
-
))}
|
|
66
|
-
</Stack>
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Tones
|
|
72
|
-
|
|
73
|
-
Available tones.
|
|
74
|
-
|
|
75
|
-
```jsx-live
|
|
76
|
-
const App = () => {
|
|
77
|
-
const variants = ["solid", "outline", "ghost", "link"];
|
|
78
|
-
const colors = ["primary", "error"];
|
|
79
|
-
|
|
80
|
-
return (
|
|
81
|
-
<Stack>
|
|
82
|
-
{colors.map((color) => (
|
|
83
|
-
<Stack key={color} direction="horizontal">
|
|
84
|
-
{variants.map((variant) => (
|
|
85
|
-
<IconButton colorPalette={color} key={variant} variant={variant}>
|
|
86
|
-
<Icons.AutoFixHigh/>
|
|
87
|
-
</IconButton>
|
|
88
|
-
))}
|
|
89
|
-
</Stack>
|
|
90
|
-
))}
|
|
91
|
-
</Stack>
|
|
92
|
-
);
|
|
93
|
-
};
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Props
|
|
97
|
-
|
|
98
|
-
<PropTable id="IconButton" />
|