@codecademy/styleguide 79.2.0-alpha.f66feb.0 → 79.2.0-alpha.f9ca97.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.
- package/.storybook/components/Scales/ColorScale.tsx +1 -1
- package/CHANGELOG.md +6 -2
- package/package.json +2 -2
- package/src/lib/Foundations/Layout.mdx +1 -1
- package/src/lib/Foundations/System/Props/Positioning.mdx +7 -2
- package/src/lib/Foundations/System/Props/Positioning.stories.tsx +32 -0
- package/src/lib/Meta/Logical and physical CSS properties.mdx +24 -8
- package/src/lib/Molecules/Tips/InfoTip/InfoTip.stories.tsx +2 -2
- package/src/lib/Typography/Text/Text.stories.tsx +4 -4
- package/src/lib/Typography/Text/tables.tsx +2 -2
- package/src/lib/UX Writing/Component guidelines/Alerts.mdx +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { themed } from '@codecademy/gamut-styles';
|
|
3
3
|
import styled from '@emotion/styled';
|
|
4
|
-
import { Box, GridBox } from '@codecademy/gamut';
|
|
4
|
+
import { Box, GridBox } from '@codecademy/gamut/src';
|
|
5
5
|
|
|
6
6
|
const HexCode = styled.span`
|
|
7
7
|
font-family: ${themed('fontFamily.monospace')};
|
package/CHANGELOG.md
CHANGED
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
## [79.2.0-alpha.
|
|
6
|
+
## [79.2.0-alpha.f9ca97.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.1...@codecademy/styleguide@79.2.0-alpha.f9ca97.0) (2026-02-13)
|
|
7
7
|
|
|
8
8
|
### Features
|
|
9
9
|
|
|
10
|
-
-
|
|
10
|
+
- Updates to ThemeProvider, tokens, and transform to allow Logical vs Physical prop resolution ([#3234](https://github.com/Codecademy/gamut/issues/3234)) ([7efbb9a](https://github.com/Codecademy/gamut/commit/7efbb9aabcd07dc6429432d007eaa5603ac1d70c))
|
|
11
11
|
- Updates to ThemeProvider, tokens, and transform to allow Logical vs Physical prop resolution ([#3234](https://github.com/Codecademy/gamut/issues/3234)) ([567a6ae](https://github.com/Codecademy/gamut/commit/567a6aeffb3e8628db4b5c9a37dab965b716d969))
|
|
12
12
|
|
|
13
|
+
### [79.1.1](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.1.0...@codecademy/styleguide@79.1.1) (2026-02-11)
|
|
14
|
+
|
|
15
|
+
**Note:** Version bump only for package @codecademy/styleguide
|
|
16
|
+
|
|
13
17
|
## [79.1.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.0.0...@codecademy/styleguide@79.1.0) (2026-02-09)
|
|
14
18
|
|
|
15
19
|
### Features
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codecademy/styleguide",
|
|
3
3
|
"description": "Styleguide & Component library for codecademy.com",
|
|
4
|
-
"version": "79.2.0-alpha.
|
|
4
|
+
"version": "79.2.0-alpha.f9ca97.0",
|
|
5
5
|
"author": "Codecademy Engineering",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
10
10
|
"repository": "git@github.com:Codecademy/gamut.git",
|
|
11
|
-
"gitHead": "
|
|
11
|
+
"gitHead": "d73668577cae898037fa05bed7b91cc4c7312a9d"
|
|
12
12
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
1
|
+
import { Canvas, Meta } from '@storybook/blocks';
|
|
2
2
|
|
|
3
3
|
import { AboutHeader, TokenTable } from '~styleguide/blocks';
|
|
4
4
|
|
|
5
5
|
import { defaultColumns, getPropRows } from '../../shared/elements';
|
|
6
|
+
import * as PositioningStories from './Positioning.stories';
|
|
6
7
|
|
|
7
8
|
export const parameters = {
|
|
8
9
|
title: 'Positioning',
|
|
@@ -11,7 +12,7 @@ export const parameters = {
|
|
|
11
12
|
status: 'updating',
|
|
12
13
|
};
|
|
13
14
|
|
|
14
|
-
<Meta title="Foundations/System/Props/Positioning" />
|
|
15
|
+
<Meta title="Foundations/System/Props/Positioning" of={PositioningStories} />
|
|
15
16
|
|
|
16
17
|
<AboutHeader {...parameters} />
|
|
17
18
|
|
|
@@ -26,4 +27,8 @@ const PositioningExample = styled.div(system.positioning);
|
|
|
26
27
|
<PositioningExample position="absolute" zIndex={2} top="0" left="0" />;
|
|
27
28
|
```
|
|
28
29
|
|
|
30
|
+
These positioning 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.
|
|
31
|
+
|
|
32
|
+
<Canvas of={PositioningStories.PositionExample} />
|
|
33
|
+
|
|
29
34
|
<TokenTable rows={getPropRows('positioning')} columns={defaultColumns} />
|
|
@@ -0,0 +1,32 @@
|
|
|
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/Positioning',
|
|
6
|
+
component: Box,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof Box>;
|
|
11
|
+
|
|
12
|
+
export const PositionExample: Story = {
|
|
13
|
+
render: () => (
|
|
14
|
+
<Box bg="background-selected" height="150px" position="relative">
|
|
15
|
+
<Box
|
|
16
|
+
bg="primary"
|
|
17
|
+
color="background-contrast"
|
|
18
|
+
left={16}
|
|
19
|
+
p={16}
|
|
20
|
+
position="absolute"
|
|
21
|
+
top={16}
|
|
22
|
+
>
|
|
23
|
+
This box has{' '}
|
|
24
|
+
<Markdown text="`position='absolute'`, `top={16}`, and `left={16}`." />{' '}
|
|
25
|
+
Inspect the example to see what CSS properties are rendered. You can
|
|
26
|
+
also change the value of{' '}
|
|
27
|
+
<Markdown text="`useLogicalProperties` and `direction`" /> in the
|
|
28
|
+
toolbar to see how the box renders differently.
|
|
29
|
+
</Box>
|
|
30
|
+
</Box>
|
|
31
|
+
),
|
|
32
|
+
};
|
|
@@ -22,7 +22,7 @@ export const parameters = {
|
|
|
22
22
|
|
|
23
23
|
## What are CSS logical properties?
|
|
24
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)
|
|
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
26
|
|
|
27
27
|
### Physical Properties (Traditional)
|
|
28
28
|
|
|
@@ -46,7 +46,9 @@ Gamut supports both physical and logical CSS properties through the `useLogicalP
|
|
|
46
46
|
|
|
47
47
|
### Affected Props
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
When `useLogicalProperties` is enabled, Gamut replaces physical CSS properties with their logical equivalents. This applies to both **base properties** (like `marginLeft`, `width`) and **shorthand props** (like `mx`, `py`).
|
|
50
|
+
|
|
51
|
+
The table below shows a few examples — this is not a comprehensive list.
|
|
50
52
|
|
|
51
53
|
<TokenTable
|
|
52
54
|
idKey="prop"
|
|
@@ -59,7 +61,7 @@ Here are some examples of how physical and logical properties are affected by th
|
|
|
59
61
|
},
|
|
60
62
|
{
|
|
61
63
|
key: 'physical',
|
|
62
|
-
name: 'Physical',
|
|
64
|
+
name: 'Physical CSS',
|
|
63
65
|
size: 'xl',
|
|
64
66
|
render: ({ physical }) =>
|
|
65
67
|
physical.map((p) => (
|
|
@@ -70,7 +72,7 @@ Here are some examples of how physical and logical properties are affected by th
|
|
|
70
72
|
},
|
|
71
73
|
{
|
|
72
74
|
key: 'logical',
|
|
73
|
-
name: 'Logical',
|
|
75
|
+
name: 'Logical CSS',
|
|
74
76
|
size: 'xl',
|
|
75
77
|
render: ({ logical }) =>
|
|
76
78
|
logical.map((l) => (
|
|
@@ -81,21 +83,35 @@ Here are some examples of how physical and logical properties are affected by th
|
|
|
81
83
|
},
|
|
82
84
|
]}
|
|
83
85
|
rows={[
|
|
86
|
+
{
|
|
87
|
+
prop: 'marginLeft',
|
|
88
|
+
physical: ['margin-left'],
|
|
89
|
+
logical: ['margin-inline-start'],
|
|
90
|
+
},
|
|
84
91
|
{
|
|
85
92
|
prop: 'mx',
|
|
86
93
|
physical: ['margin-left', 'margin-right'],
|
|
87
94
|
logical: ['margin-inline-start', 'margin-inline-end'],
|
|
88
95
|
},
|
|
89
|
-
{
|
|
96
|
+
{
|
|
97
|
+
prop: 'paddingTop',
|
|
98
|
+
physical: ['padding-top'],
|
|
99
|
+
logical: ['padding-block-start'],
|
|
100
|
+
},
|
|
90
101
|
{
|
|
91
102
|
prop: 'py',
|
|
92
103
|
physical: ['padding-top', 'padding-bottom'],
|
|
93
104
|
logical: ['padding-block-start', 'padding-block-end'],
|
|
94
105
|
},
|
|
95
106
|
{
|
|
96
|
-
prop: '
|
|
97
|
-
physical: ['
|
|
98
|
-
logical: ['
|
|
107
|
+
prop: 'width',
|
|
108
|
+
physical: ['width'],
|
|
109
|
+
logical: ['inline-size'],
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
prop: 'height',
|
|
113
|
+
physical: ['height'],
|
|
114
|
+
logical: ['block-size'],
|
|
99
115
|
},
|
|
100
116
|
]}
|
|
101
117
|
/>
|
|
@@ -296,14 +296,14 @@ export const ZIndex: Story = {
|
|
|
296
296
|
},
|
|
297
297
|
render: (args) => (
|
|
298
298
|
<FlexBox center flexDirection="column" m={24} py={64}>
|
|
299
|
-
<Box bg="
|
|
299
|
+
<Box bg="background-primary" zIndex={3}>
|
|
300
300
|
I will not be behind the infotip, sad + unreadable
|
|
301
301
|
</Box>
|
|
302
302
|
<InfoTip
|
|
303
303
|
ariaLabel="z-index example without override"
|
|
304
304
|
info="I am inline, cool"
|
|
305
305
|
/>
|
|
306
|
-
<Box bg="
|
|
306
|
+
<Box bg="background-primary" zIndex={3}>
|
|
307
307
|
I will be behind the infotip, nice + great
|
|
308
308
|
</Box>
|
|
309
309
|
<InfoTip {...args} ariaLabel="z-index example with override" />
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { Box, Column, LayoutGrid, Text } from '@codecademy/gamut';
|
|
2
|
-
|
|
3
|
-
import { Fragment } from 'react';
|
|
4
|
-
|
|
2
|
+
// eslint-disable-next-line gamut/import-paths
|
|
5
3
|
import {
|
|
6
4
|
typographyElementVariants,
|
|
7
5
|
typographyStyleVariants,
|
|
8
6
|
typographyUtilities,
|
|
9
|
-
} from '
|
|
7
|
+
} from '@codecademy/gamut/src/Typography/variants';
|
|
8
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
9
|
+
import { Fragment } from 'react';
|
|
10
10
|
|
|
11
11
|
const meta: Meta<typeof Text> = {
|
|
12
12
|
component: Text,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Column, LayoutGrid, Text } from '@codecademy/gamut';
|
|
2
|
+
// eslint-disable-next-line gamut/import-paths
|
|
3
|
+
import { typographyElementVariants } from '@codecademy/gamut/src/Typography/variants';
|
|
2
4
|
import { Fragment } from 'react';
|
|
3
5
|
|
|
4
|
-
import { typographyElementVariants } from '../../../../../gamut/src/Typography/variants';
|
|
5
|
-
|
|
6
6
|
export const Elements: React.FC = () => (
|
|
7
7
|
<LayoutGrid gap={32} my={48}>
|
|
8
8
|
{Object.keys(typographyElementVariants).map((tag) => (
|