@codecademy/styleguide 79.0.1-alpha.4aeb6d.0 → 79.0.1-alpha.5950e5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/.storybook/components/Elements/DocsContainer.tsx +0 -4
  2. package/.storybook/components/Elements/Markdown.tsx +1 -0
  3. package/.storybook/preview.ts +0 -14
  4. package/.storybook/theming/GamutThemeProvider.tsx +1 -7
  5. package/CHANGELOG.md +1 -1
  6. package/package.json +2 -2
  7. package/src/lib/Foundations/System/About.mdx +1 -1
  8. package/src/lib/Foundations/System/Props.mdx +230 -0
  9. package/src/lib/Foundations/System/ResponsiveProperties/ResponsiveProperties.mdx +3 -3
  10. package/src/lib/Foundations/System/ResponsiveProperties/ResponsiveProperties.stories.tsx +0 -1
  11. package/src/lib/Foundations/shared/elements.tsx +19 -69
  12. package/src/lib/Meta/About.mdx +1 -3
  13. package/src/lib/Meta/Usage Guide.mdx +1 -6
  14. package/src/lib/Molecules/Tips/InfoTip/InfoTip.mdx +1 -1
  15. package/src/lib/Organisms/BarChart/BarChart.mdx +414 -0
  16. package/src/lib/Organisms/BarChart/BarChart.stories.tsx +378 -0
  17. package/src/static/meta/toolbar.png +0 -0
  18. package/src/lib/Foundations/System/Props/About.mdx +0 -81
  19. package/src/lib/Foundations/System/Props/Background.mdx +0 -30
  20. package/src/lib/Foundations/System/Props/Border.mdx +0 -53
  21. package/src/lib/Foundations/System/Props/Border.stories.tsx +0 -138
  22. package/src/lib/Foundations/System/Props/Color.mdx +0 -42
  23. package/src/lib/Foundations/System/Props/Color.stories.tsx +0 -47
  24. package/src/lib/Foundations/System/Props/Flex.mdx +0 -28
  25. package/src/lib/Foundations/System/Props/Grid.mdx +0 -31
  26. package/src/lib/Foundations/System/Props/Layout.mdx +0 -34
  27. package/src/lib/Foundations/System/Props/List.mdx +0 -38
  28. package/src/lib/Foundations/System/Props/Positioning.mdx +0 -29
  29. package/src/lib/Foundations/System/Props/Shadow.mdx +0 -31
  30. package/src/lib/Foundations/System/Props/Space.mdx +0 -44
  31. package/src/lib/Foundations/System/Props/Space.stories.tsx +0 -48
  32. package/src/lib/Foundations/System/Props/Typography.mdx +0 -28
  33. package/src/lib/Meta/Logical and physical CSS properties.mdx +0 -123
@@ -1,42 +0,0 @@
1
- import { Canvas, Meta } from '@storybook/blocks';
2
-
3
- import { AboutHeader, Callout, TokenTable } from '~styleguide/blocks';
4
-
5
- import { defaultColumns, getPropRows } from '../../shared/elements';
6
- import * as ColorStories from './Color.stories';
7
-
8
- export const parameters = {
9
- title: 'Color',
10
- subtitle: 'Specific color properties',
11
- status: 'current',
12
- };
13
-
14
- <Meta of={ColorStories} title="Foundations/System/Props/Color" />
15
-
16
- <AboutHeader {...parameters} />
17
-
18
- Color props control the foreground, background, and border colors of elements. All color values are restricted to your theme's color palette, ensuring consistent color usage throughout your application. The `bg` shorthand provides a convenient way to set background colors quickly.
19
-
20
- ```tsx
21
- import styled from '@emotion/styled';
22
- import { system } from '@codecademy/gamut-styles';
23
-
24
- const ColorExample = styled.div(system.color);
25
-
26
- <ColorExample bg="navy" textColor="gray-100" borderColor="blue" />;
27
- ```
28
-
29
- These color props support both physical and logical CSS properties and will render the appropriate properties based on `useLogicalProperties`'s value passed into the `<GamutProvider>` at the root of your application.
30
-
31
- <Callout
32
- text={
33
- <>
34
- You can use the <strong>LogicalProps</strong> button in the toolbar to
35
- switch between modes.
36
- </>
37
- }
38
- />
39
-
40
- <Canvas of={ColorStories.BorderColorExample} />
41
-
42
- <TokenTable rows={getPropRows('color')} columns={defaultColumns} />
@@ -1,47 +0,0 @@
1
- import { Box, FlexBox, Markdown } from '@codecademy/gamut';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
-
4
- const meta: Meta<typeof Box> = {
5
- title: 'Foundations/System/Props/Color',
6
- component: Box,
7
- };
8
-
9
- export default meta;
10
- type Story = StoryObj<typeof Box>;
11
-
12
- export const BorderColorExample: Story = {
13
- render: () => (
14
- <FlexBox gap={16} row>
15
- <Box
16
- bg="background-selected"
17
- border={1}
18
- borderColorX="feedback-success"
19
- borderColorY="feedback-error"
20
- borderWidth="4px"
21
- p={16}
22
- textAlign="center"
23
- >
24
- This box has{' '}
25
- <Markdown text="`borderColorX='feedback-success'` and `borderColorY='feedback-error'`." />{' '}
26
- Inspect the example to see what CSS properties are rendered based on the
27
- logical properties mode.
28
- </Box>
29
- <Box
30
- bg="background-selected"
31
- border={1}
32
- borderColorBottom="feedback-warning"
33
- borderColorLeft="feedback-success"
34
- borderColorRight="feedback-error"
35
- borderColorTop="interface"
36
- borderWidth="4px"
37
- p={16}
38
- textAlign="center"
39
- >
40
- This box has{' '}
41
- <Markdown text="`borderColorBottom='feedback-warning'`, `borderColorLeft='feedback-success'`, `borderColorRight='feedback-error'`, and `borderColorTop='interface'`." />{' '}
42
- Inspect the example to see what CSS properties are rendered based on the
43
- logical properties mode.
44
- </Box>
45
- </FlexBox>
46
- ),
47
- };
@@ -1,28 +0,0 @@
1
- import { Meta } from '@storybook/blocks';
2
-
3
- import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
-
5
- import { defaultColumns, getPropRows } from '../../shared/elements';
6
-
7
- export const parameters = {
8
- title: 'Flex',
9
- subtitle: 'Flex specific properties',
10
- status: 'current',
11
- };
12
-
13
- <Meta title="Foundations/System/Props/Flex" />
14
-
15
- <AboutHeader {...parameters} />
16
-
17
- Flex props provide complete control over flexbox layouts, from container behavior to individual flex item properties. These properties make it easy to create flexible, responsive layouts with proper alignment and distribution of child elements. Use these on flex containers to control their children or on flex items to control their own behavior.
18
-
19
- ```tsx
20
- import styled from '@emotion/styled';
21
- import { system } from '@codecademy/gamut-styles';
22
-
23
- const FlexExample = styled.div(system.flex);
24
-
25
- <FlexExample flex={1} justifyContent="center" alignItems="flex-start" />;
26
- ```
27
-
28
- <TokenTable rows={getPropRows('flex')} columns={defaultColumns} />
@@ -1,31 +0,0 @@
1
- import { Meta } from '@storybook/blocks';
2
-
3
- import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
-
5
- import { defaultColumns, getPropRows } from '../../shared/elements';
6
-
7
- export const parameters = {
8
- title: 'Grid',
9
- subtitle: 'Grid specific properties',
10
- status: 'current',
11
- };
12
-
13
- <Meta title="Foundations/System/Props/Grid" />
14
-
15
- <AboutHeader {...parameters} />
16
-
17
- Grid props give you powerful control over CSS Grid layouts. Define grid templates, control auto-placement behavior, and set gaps between grid items. These properties make it straightforward to create complex, responsive grid layouts with precise control over both container and item positioning.
18
-
19
- ```tsx
20
- import styled from '@emotion/styled';
21
- import { system } from '@codecademy/gamut-styles';
22
-
23
- const GridExample = styled.div(system.grid);
24
-
25
- <GridExample
26
- gridTemplateColumns="max-content 1fr max-content"
27
- columnGap={32}
28
- />;
29
- ```
30
-
31
- <TokenTable rows={getPropRows('grid')} columns={defaultColumns} />
@@ -1,34 +0,0 @@
1
- import { Meta } from '@storybook/blocks';
2
-
3
- import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
-
5
- import { defaultColumns, getPropRows } from '../../shared/elements';
6
-
7
- export const parameters = {
8
- title: 'Layout',
9
- subtitle:
10
- 'Props for handling dimensions and other layout specific properties.',
11
- status: 'updating',
12
- };
13
-
14
- <Meta title="Foundations/System/Props/Layout" />
15
-
16
- <AboutHeader {...parameters} />
17
-
18
- Layout props control the visual structure and dimensions of elements. These properties determine how components take up space, their display behavior, and how they align within their containers. Use these props to set widths, heights, overflow behavior, and container types for responsive layouts.
19
-
20
- ```tsx
21
- import styled from '@emotion/styled';
22
- import { system } from '@codecademy/gamut-styles';
23
-
24
- const LayoutExample = styled.div(system.layout);
25
-
26
- <LayoutExample
27
- display="flex"
28
- width="50%"
29
- height="300px"
30
- verticalAlign="middle"
31
- />;
32
- ```
33
-
34
- <TokenTable rows={getPropRows('layout')} columns={defaultColumns} />
@@ -1,38 +0,0 @@
1
- import { Meta } from '@storybook/blocks';
2
-
3
- import { AboutHeader, LinkTo, TokenTable } from '~styleguide/blocks';
4
-
5
- import { defaultColumns, getPropRows } from '../../shared/elements';
6
-
7
- export const parameters = {
8
- title: 'List',
9
- subtitle:
10
- 'Props for adjusting list styles when rendering a component as a `ul` or `ol`',
11
- status: 'current',
12
- };
13
-
14
- <Meta title="Foundations/System/Props/List" />
15
-
16
- <AboutHeader {...parameters} />
17
-
18
- List props control the appearance of ordered and unordered lists when components are rendered as `ul` or `ol` elements. These properties let you customize bullet styles, list positioning, and even use custom images as list markers, giving you full control over list presentation.
19
-
20
- For more advanced list features, refer to the <LinkTo id="Organisms/Lists & Tables/List">List component</LinkTo>.
21
-
22
- ```tsx
23
- import styled from '@emotion/styled';
24
- import { system } from '@codecademy/gamut-styles';
25
-
26
- const ListExample = styled.div(system.list);
27
-
28
- <ListExample
29
- as="ul"
30
- listStyleType="square"
31
- listStylePosition="inside"
32
- listStyleImage="none"
33
- >
34
- <ListExample as="li">a list item</ListExample>
35
- </ListExample>;
36
- ```
37
-
38
- <TokenTable rows={getPropRows('list')} columns={defaultColumns} />
@@ -1,29 +0,0 @@
1
- import { Meta } from '@storybook/blocks';
2
-
3
- import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
-
5
- import { defaultColumns, getPropRows } from '../../shared/elements';
6
-
7
- export const parameters = {
8
- title: 'Positioning',
9
- subtitle:
10
- 'Props that affect stacking and position contexts. Like `top`, `position` and `opacity`.',
11
- status: 'updating',
12
- };
13
-
14
- <Meta title="Foundations/System/Props/Positioning" />
15
-
16
- <AboutHeader {...parameters} />
17
-
18
- Positioning props control how elements are positioned within their parent containers and manage their stacking order. Use these properties to create fixed headers, absolute overlays, sticky navigation, and control layering with z-index. The `inset` shorthand provides a convenient way to set all four position values at once.
19
-
20
- ```tsx
21
- import styled from '@emotion/styled';
22
- import { system } from '@codecademy/gamut-styles';
23
-
24
- const PositioningExample = styled.div(system.positioning);
25
-
26
- <PositioningExample position="absolute" zIndex={2} top="0" left="0" />;
27
- ```
28
-
29
- <TokenTable rows={getPropRows('positioning')} columns={defaultColumns} />
@@ -1,31 +0,0 @@
1
- import { Meta } from '@storybook/blocks';
2
-
3
- import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
-
5
- import { defaultColumns, getPropRows } from '../../shared/elements';
6
-
7
- export const parameters = {
8
- title: 'Shadow',
9
- subtitle: 'Props for box and text shadows.',
10
- status: 'current',
11
- };
12
-
13
- <Meta title="Foundations/System/Props/Shadow" />
14
-
15
- <AboutHeader {...parameters} />
16
-
17
- Shadow props add depth and visual interest to your components through box and text shadows. These properties accept standard CSS shadow syntax, allowing you to create subtle elevation effects or dramatic visual depth. Use shadows consistently to establish visual hierarchy in your interface.
18
-
19
- ```tsx
20
- import styled from '@emotion/styled';
21
- import { system } from '@codecademy/gamut-styles';
22
-
23
- const ShadowExample = styled.div(system.shadow);
24
-
25
- <ShadowExample
26
- boxShadow="0 0 4px rgba(0, 0, 0, .15)"
27
- textShadow="0 0 4px rgba(0, 0, 0, .15)"
28
- />;
29
- ```
30
-
31
- <TokenTable rows={getPropRows('shadows')} columns={defaultColumns} />
@@ -1,44 +0,0 @@
1
- import { Canvas, Meta } from '@storybook/blocks';
2
-
3
- import { AboutHeader, Callout, TokenTable } from '~styleguide/blocks';
4
-
5
- import { defaultColumns, getPropRows } from '../../shared/elements';
6
- import * as SpaceStories from './Space.stories';
7
-
8
- export const parameters = {
9
- title: 'Space',
10
- subtitle: 'Props for maintaining specific vertical and horizontal rhythms',
11
- status: 'updating',
12
- };
13
-
14
- <Meta of={SpaceStories} title="Foundations/System/Props/Space" />
15
-
16
- <AboutHeader {...parameters} />
17
-
18
- Space props provide a consistent way to apply margin and padding throughout your application. All spacing values reference the theme's spacing scale, ensuring visual consistency and making it easy to create responsive spacing patterns using array syntax.
19
-
20
- ```tsx
21
- import styled from '@emotion/styled';
22
- import { system } from '@codecademy/gamut-styles';
23
-
24
- const SpaceExample = styled.div(system.space);
25
-
26
- <SpaceExample p={8} my={[16, 24, 32]} />;
27
- ```
28
-
29
- These space props support both physical and logical CSS properties and will render the appropriate properties based on `useLogicalProperties`'s value passed into the `<GamutProvider>` at the root of your application.
30
-
31
- <Callout
32
- text={
33
- <>
34
- You can use the <strong>LogicalProps</strong> button in the toolbar to
35
- switch between modes.
36
- </>
37
- }
38
- />
39
-
40
- <Canvas of={SpaceStories.MarginExample} />
41
-
42
- <Canvas of={SpaceStories.PaddingExample} />
43
-
44
- <TokenTable rows={getPropRows('space')} columns={defaultColumns} />
@@ -1,48 +0,0 @@
1
- import { Box, Markdown } from '@codecademy/gamut';
2
- import type { Meta, StoryObj } from '@storybook/react';
3
-
4
- const meta: Meta<typeof Box> = {
5
- title: 'Foundations/System/Props/Space',
6
- component: Box,
7
- };
8
-
9
- export default meta;
10
- type Story = StoryObj<typeof Box>;
11
-
12
- export const MarginExample: Story = {
13
- render: () => (
14
- <Box
15
- bg="primary"
16
- color="background-contrast"
17
- mb={64}
18
- ml={16}
19
- mr={32}
20
- mt={4}
21
- textAlign="center"
22
- >
23
- This box has{' '}
24
- <Markdown text="`mt={4}`, `mr={32}`, `mb={64}`, and `ml={16}`." /> Inspect
25
- the example to see what CSS properties are rendered.
26
- </Box>
27
- ),
28
- };
29
-
30
- export const PaddingExample: Story = {
31
- render: () => (
32
- <Box bg="background-selected">
33
- <Box
34
- bg="primary"
35
- color="background-contrast"
36
- pb={64}
37
- pl={16}
38
- pr={32}
39
- pt={4}
40
- textAlign="center"
41
- >
42
- This box has{' '}
43
- <Markdown text="`pt={4}`, `pr={32}`, `pb={64}`, and `pl={16}`." />{' '}
44
- Inspect the example to see what CSS properties are rendered.
45
- </Box>
46
- </Box>
47
- ),
48
- };
@@ -1,28 +0,0 @@
1
- import { Meta } from '@storybook/blocks';
2
-
3
- import { AboutHeader, TokenTable } from '~styleguide/blocks';
4
-
5
- import { defaultColumns, getPropRows } from '../../shared/elements';
6
-
7
- export const parameters = {
8
- title: 'Typography',
9
- subtitle: 'Props for text manipulation',
10
- status: 'current',
11
- };
12
-
13
- <Meta title="Foundations/System/Props/Typography" />
14
-
15
- <AboutHeader {...parameters} />
16
-
17
- Typography props give you fine-grained control over text styling and appearance. These properties connect to the theme's typography scales for font families, sizes, weights, and line heights, making it simple to maintain typographic consistency across your application while allowing for custom text transformations and decorations.
18
-
19
- ```tsx
20
- import styled from '@emotion/styled';
21
- import { system } from '@codecademy/gamut-styles';
22
-
23
- const TextExample = styled.p(system.typography);
24
-
25
- <TextExample fontSize={16} fontFamily="accent" textTransform="uppercase" />;
26
- ```
27
-
28
- <TokenTable rows={getPropRows('typography')} columns={defaultColumns} />
@@ -1,123 +0,0 @@
1
- import { Meta } from '@storybook/blocks';
2
-
3
- import {
4
- AboutHeader,
5
- Callout,
6
- Code,
7
- ImageWrapper,
8
- TokenTable,
9
- } from '~styleguide/blocks';
10
-
11
- export const parameters = {
12
- id: 'Meta/Logical and physical CSS properties',
13
- title: 'Logical and physical CSS properties',
14
- subtitle:
15
- 'Understanding CSS logical and physical properties and how Gamut supports both modes.',
16
- status: 'static',
17
- };
18
-
19
- <Meta title="Meta/Logical and physical CSS properties" />
20
-
21
- <AboutHeader {...parameters} />
22
-
23
- ## What are CSS logical properties?
24
-
25
- CSS logical properties are a modern approach to styling that adapts to the writing mode and text direction of your content, rather than being tied to physical screen directions. More information can be found on[MDN: CSS Logical Properties](https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_logical_properties_and_values)
26
-
27
- ### Physical Properties (Traditional)
28
-
29
- Physical properties reference the physical dimensions of the viewport. For example:
30
-
31
- - `margin-left`, `margin-right`, `margin-top`, `margin-bottom`
32
- - `padding-left`, `padding-right`, `padding-top`, `padding-bottom`
33
-
34
- These work well for left-to-right (LTR) languages but require manual overrides for right-to-left (RTL) languages like Arabic or Hebrew.
35
-
36
- ### Logical Properties (Modern)
37
-
38
- Logical properties reference the flow of content:
39
-
40
- - **Inline axis** (text direction): `margin-inline-start`, `margin-inline-end`
41
- - **Block axis** (reading direction): `margin-block-start`, `margin-block-end`
42
-
43
- ## Using `useLogicalProperties` in Gamut
44
-
45
- Gamut supports both physical and logical CSS properties through the `useLogicalProperties` prop on `GamutProvider`. This allows you to choose which mode your application uses. By default, `useLogicalProperties` is set to `true`, meaning Gamut will use logical CSS properties. If you want to use physical CSS properties, you have to set `useLogicalProperties` to `false`.
46
-
47
- ### Affected Props
48
-
49
- Here are some examples of how physical and logical properties are affected by the `useLogicalProperties` prop:
50
-
51
- <TokenTable
52
- idKey="prop"
53
- columns={[
54
- {
55
- key: 'prop',
56
- name: 'Prop',
57
- size: 'sm',
58
- render: ({ prop }) => <Code>{prop}</Code>,
59
- },
60
- {
61
- key: 'physical',
62
- name: 'Physical',
63
- size: 'xl',
64
- render: ({ physical }) =>
65
- physical.map((p) => (
66
- <>
67
- <Code key={p}>{p}</Code>{' '}
68
- </>
69
- )),
70
- },
71
- {
72
- key: 'logical',
73
- name: 'Logical',
74
- size: 'xl',
75
- render: ({ logical }) =>
76
- logical.map((l) => (
77
- <>
78
- <Code key={l}>{l}</Code>{' '}
79
- </>
80
- )),
81
- },
82
- ]}
83
- rows={[
84
- {
85
- prop: 'mx',
86
- physical: ['margin-left', 'margin-right'],
87
- logical: ['margin-inline-start', 'margin-inline-end'],
88
- },
89
- { prop: 'mt', physical: ['margin-top'], logical: ['margin-block-start'] },
90
- {
91
- prop: 'py',
92
- physical: ['padding-top', 'padding-bottom'],
93
- logical: ['padding-block-start', 'padding-block-end'],
94
- },
95
- {
96
- prop: 'pb',
97
- physical: ['padding-bottom'],
98
- logical: ['padding-block-end'],
99
- },
100
- ]}
101
- />
102
-
103
- <Callout
104
- text={
105
- <>
106
- Props like <code>m</code> and <code>p</code> (which set all four sides at
107
- once) are not affected by this setting, as the CSS <code>margin</code> and{' '}
108
- <code>padding</code> shorthands work identically in both modes.
109
- </>
110
- }
111
- />
112
-
113
- ## Previewing in Storybook
114
-
115
- You can toggle between logical and physical properties in Storybook using the **LogicalProps** toolbar button:
116
-
117
- <ImageWrapper
118
- src="./meta/toolbar.png"
119
- alt="The Storybook toolbar with the LogicalProps toggle highlighted."
120
- height="auto"
121
- />
122
-
123
- This allows you to preview how components render with either property mode without changing any code.