@codecademy/styleguide 79.1.0-alpha.8bbf79.0 → 79.1.0-alpha.e84769.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/preview.ts +0 -12
- package/.storybook/theming/GamutThemeProvider.tsx +0 -4
- package/CHANGELOG.md +2 -1
- package/package.json +2 -2
- package/src/lib/Foundations/System/Props/Border.mdx +23 -3
- package/src/lib/Foundations/System/Props/Border.stories.tsx +138 -0
- package/src/lib/Foundations/System/Props/Color.mdx +17 -3
- package/src/lib/Foundations/System/Props/Color.stories.tsx +47 -0
- package/src/lib/Meta/Logical and physical CSS properties.mdx +8 -24
package/.storybook/preview.ts
CHANGED
|
@@ -177,18 +177,6 @@ export const globalTypes = {
|
|
|
177
177
|
showName: true,
|
|
178
178
|
},
|
|
179
179
|
},
|
|
180
|
-
direction: {
|
|
181
|
-
name: 'Direction',
|
|
182
|
-
description: 'Text direction for the page',
|
|
183
|
-
defaultValue: 'ltr',
|
|
184
|
-
toolbar: {
|
|
185
|
-
items: [
|
|
186
|
-
{ value: 'ltr', icon: 'arrowright', title: 'Left-To-Right' },
|
|
187
|
-
{ value: 'rtl', icon: 'arrowleft', title: 'Right-To-Left' },
|
|
188
|
-
],
|
|
189
|
-
showName: true,
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
180
|
};
|
|
193
181
|
|
|
194
182
|
export const decorators = [withEmotion];
|
|
@@ -35,7 +35,6 @@ type GlobalsContext = {
|
|
|
35
35
|
colorMode: 'light' | 'dark';
|
|
36
36
|
theme: keyof typeof themeMap;
|
|
37
37
|
logicalProps: 'true' | 'false';
|
|
38
|
-
direction: 'ltr' | 'rtl';
|
|
39
38
|
};
|
|
40
39
|
};
|
|
41
40
|
|
|
@@ -43,7 +42,6 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
|
43
42
|
const colorMode = context.globals.colorMode ?? 'light';
|
|
44
43
|
const selectedTheme = context.globals.theme;
|
|
45
44
|
const useLogicalProperties = context.globals.logicalProps !== 'false';
|
|
46
|
-
const direction = context.globals.direction ?? 'ltr';
|
|
47
45
|
const background = corePalette[themeBackground[colorMode]];
|
|
48
46
|
const storyRef = useRef<HTMLDivElement>(null);
|
|
49
47
|
const currentTheme = themeMap[selectedTheme];
|
|
@@ -68,7 +66,6 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
|
68
66
|
alwaysSetVariables
|
|
69
67
|
bg={themeBackground[colorMode]}
|
|
70
68
|
ref={storyRef}
|
|
71
|
-
dir={direction}
|
|
72
69
|
>
|
|
73
70
|
{Story()}
|
|
74
71
|
</Background>
|
|
@@ -86,7 +83,6 @@ export const withEmotion = (Story: any, context: GlobalsContext) => {
|
|
|
86
83
|
alwaysSetVariables
|
|
87
84
|
bg={themeBackground[colorMode]}
|
|
88
85
|
ref={storyRef}
|
|
89
|
-
dir={direction}
|
|
90
86
|
>
|
|
91
87
|
{Story()}
|
|
92
88
|
</Background>
|
package/CHANGELOG.md
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
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.1.0-alpha.
|
|
6
|
+
## [79.1.0-alpha.e84769.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.0.0...@codecademy/styleguide@79.1.0-alpha.e84769.0) (2026-02-06)
|
|
7
7
|
|
|
8
8
|
### Features
|
|
9
9
|
|
|
10
|
+
- Add border related logical props ([#3257](https://github.com/Codecademy/gamut/issues/3257)) ([e852afa](https://github.com/Codecademy/gamut/commit/e852afa6b0f70eb0e3a696c2b0fde7be0047bd5b))
|
|
10
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))
|
|
11
12
|
|
|
12
13
|
## [79.0.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@78.5.5...@codecademy/styleguide@79.0.0) (2026-01-29)
|
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.1.0-alpha.
|
|
4
|
+
"version": "79.1.0-alpha.e84769.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": "744d95e322f1e323af94678988aecf562dfacfe8"
|
|
12
12
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
1
|
+
import { Canvas, Meta } from '@storybook/blocks';
|
|
2
2
|
|
|
3
|
-
import { AboutHeader, TokenTable } from '~styleguide/blocks';
|
|
3
|
+
import { AboutHeader, Callout, TokenTable } from '~styleguide/blocks';
|
|
4
4
|
|
|
5
5
|
import { defaultColumns, getPropRows } from '../../shared/elements';
|
|
6
|
+
import * as BorderStories from './Border.stories';
|
|
6
7
|
|
|
7
8
|
export const parameters = {
|
|
8
9
|
title: 'Border',
|
|
@@ -10,7 +11,7 @@ export const parameters = {
|
|
|
10
11
|
status: 'updating',
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
<Meta title="Foundations/System/Props/Border" />
|
|
14
|
+
<Meta of={BorderStories} title="Foundations/System/Props/Border" />
|
|
14
15
|
|
|
15
16
|
<AboutHeader {...parameters} />
|
|
16
17
|
|
|
@@ -30,4 +31,23 @@ const BorderExample = styled.div(system.border);
|
|
|
30
31
|
/>;
|
|
31
32
|
```
|
|
32
33
|
|
|
34
|
+
These border 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.
|
|
35
|
+
|
|
36
|
+
<Callout
|
|
37
|
+
text={
|
|
38
|
+
<>
|
|
39
|
+
You can use the <strong>LogicalProps</strong> button in the toolbar to
|
|
40
|
+
switch between modes.
|
|
41
|
+
</>
|
|
42
|
+
}
|
|
43
|
+
/>
|
|
44
|
+
|
|
45
|
+
<Canvas of={BorderStories.DirectionalBorderExample} />
|
|
46
|
+
|
|
47
|
+
<Canvas of={BorderStories.BorderWidthExample} />
|
|
48
|
+
|
|
49
|
+
<Canvas of={BorderStories.BorderRadiusExample} />
|
|
50
|
+
|
|
51
|
+
<Canvas of={BorderStories.BorderStyleExample} />
|
|
52
|
+
|
|
33
53
|
<TokenTable rows={getPropRows('border')} columns={defaultColumns} />
|
|
@@ -0,0 +1,138 @@
|
|
|
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/Border',
|
|
6
|
+
component: Box,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default meta;
|
|
10
|
+
type Story = StoryObj<typeof Box>;
|
|
11
|
+
|
|
12
|
+
export const DirectionalBorderExample: Story = {
|
|
13
|
+
render: () => (
|
|
14
|
+
<FlexBox gap={16} row>
|
|
15
|
+
<Box
|
|
16
|
+
bg="background-selected"
|
|
17
|
+
borderX={2}
|
|
18
|
+
borderY={1}
|
|
19
|
+
p={16}
|
|
20
|
+
textAlign="center"
|
|
21
|
+
>
|
|
22
|
+
This box has <Markdown text="`borderX={2}`, `borderY={1}`." /> Inspect
|
|
23
|
+
the example to see what CSS properties are rendered based on the logical
|
|
24
|
+
properties mode.
|
|
25
|
+
</Box>
|
|
26
|
+
<Box
|
|
27
|
+
bg="background-selected"
|
|
28
|
+
borderLeft={2}
|
|
29
|
+
borderRight={1}
|
|
30
|
+
p={16}
|
|
31
|
+
textAlign="center"
|
|
32
|
+
>
|
|
33
|
+
This box has <Markdown text="`borderLeft={2}`, `borderRight={1}`." />{' '}
|
|
34
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
35
|
+
logical properties mode.
|
|
36
|
+
</Box>
|
|
37
|
+
</FlexBox>
|
|
38
|
+
),
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const BorderWidthExample: Story = {
|
|
42
|
+
render: () => (
|
|
43
|
+
<FlexBox gap={16} row>
|
|
44
|
+
<Box
|
|
45
|
+
bg="background-selected"
|
|
46
|
+
border={1}
|
|
47
|
+
borderWidthX="4px"
|
|
48
|
+
borderWidthY="10px"
|
|
49
|
+
p={16}
|
|
50
|
+
textAlign="center"
|
|
51
|
+
>
|
|
52
|
+
This box has{' '}
|
|
53
|
+
<Markdown text="`borderWidthX='4px'` and `borderWidthY='10px'`." />{' '}
|
|
54
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
55
|
+
logical properties mode.
|
|
56
|
+
</Box>
|
|
57
|
+
<Box
|
|
58
|
+
bg="background-selected"
|
|
59
|
+
border={1}
|
|
60
|
+
borderWidthRight="10px"
|
|
61
|
+
borderWidthTop="4px"
|
|
62
|
+
p={16}
|
|
63
|
+
textAlign="center"
|
|
64
|
+
>
|
|
65
|
+
This box has{' '}
|
|
66
|
+
<Markdown text="`borderWidthTop='4px'` and `borderWidthRight='10px'`." />{' '}
|
|
67
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
68
|
+
logical properties mode.
|
|
69
|
+
</Box>
|
|
70
|
+
</FlexBox>
|
|
71
|
+
),
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const BorderRadiusExample: Story = {
|
|
75
|
+
render: () => (
|
|
76
|
+
<FlexBox gap={16} row>
|
|
77
|
+
<Box
|
|
78
|
+
bg="background-selected"
|
|
79
|
+
border={1}
|
|
80
|
+
borderRadiusLeft="lg"
|
|
81
|
+
borderRadiusRight="none"
|
|
82
|
+
p={16}
|
|
83
|
+
textAlign="center"
|
|
84
|
+
>
|
|
85
|
+
This box has{' '}
|
|
86
|
+
<Markdown text="`borderRadiusLeft='lg'` and `borderRadiusRight='none'`." />{' '}
|
|
87
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
88
|
+
logical properties mode.
|
|
89
|
+
</Box>
|
|
90
|
+
<Box
|
|
91
|
+
bg="background-selected"
|
|
92
|
+
border={1}
|
|
93
|
+
borderRadiusBottomLeft="xl"
|
|
94
|
+
borderRadiusTopRight="xl"
|
|
95
|
+
p={16}
|
|
96
|
+
textAlign="center"
|
|
97
|
+
>
|
|
98
|
+
This box has{' '}
|
|
99
|
+
<Markdown text="`borderRadiusTopRight='xl'` and `borderRadiusBottomLeft='xl'`." />{' '}
|
|
100
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
101
|
+
logical properties mode.
|
|
102
|
+
</Box>
|
|
103
|
+
</FlexBox>
|
|
104
|
+
),
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const BorderStyleExample: Story = {
|
|
108
|
+
render: () => (
|
|
109
|
+
<FlexBox gap={16} row>
|
|
110
|
+
<Box
|
|
111
|
+
bg="background-selected"
|
|
112
|
+
border={1}
|
|
113
|
+
borderStyleX="dashed"
|
|
114
|
+
borderStyleY="dotted"
|
|
115
|
+
p={16}
|
|
116
|
+
textAlign="center"
|
|
117
|
+
>
|
|
118
|
+
This box has{' '}
|
|
119
|
+
<Markdown text="`borderStyleX='dashed'` and `borderStyleY='dotted'`." />{' '}
|
|
120
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
121
|
+
logical properties mode.
|
|
122
|
+
</Box>
|
|
123
|
+
<Box
|
|
124
|
+
bg="background-selected"
|
|
125
|
+
border={1}
|
|
126
|
+
borderStyleBottom="dotted"
|
|
127
|
+
borderStyleLeft="dashed"
|
|
128
|
+
p={16}
|
|
129
|
+
textAlign="center"
|
|
130
|
+
>
|
|
131
|
+
This box has{' '}
|
|
132
|
+
<Markdown text="`borderStyleBottom='dotted'` and `borderStyleLeft='dashed'`." />{' '}
|
|
133
|
+
Inspect the example to see what CSS properties are rendered based on the
|
|
134
|
+
logical properties mode.
|
|
135
|
+
</Box>
|
|
136
|
+
</FlexBox>
|
|
137
|
+
),
|
|
138
|
+
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { Meta } from '@storybook/blocks';
|
|
1
|
+
import { Canvas, Meta } from '@storybook/blocks';
|
|
2
2
|
|
|
3
|
-
import { AboutHeader, TokenTable } from '~styleguide/blocks';
|
|
3
|
+
import { AboutHeader, Callout, TokenTable } from '~styleguide/blocks';
|
|
4
4
|
|
|
5
5
|
import { defaultColumns, getPropRows } from '../../shared/elements';
|
|
6
|
+
import * as ColorStories from './Color.stories';
|
|
6
7
|
|
|
7
8
|
export const parameters = {
|
|
8
9
|
title: 'Color',
|
|
@@ -10,7 +11,7 @@ export const parameters = {
|
|
|
10
11
|
status: 'current',
|
|
11
12
|
};
|
|
12
13
|
|
|
13
|
-
<Meta title="Foundations/System/Props/Color" />
|
|
14
|
+
<Meta of={ColorStories} title="Foundations/System/Props/Color" />
|
|
14
15
|
|
|
15
16
|
<AboutHeader {...parameters} />
|
|
16
17
|
|
|
@@ -25,4 +26,17 @@ const ColorExample = styled.div(system.color);
|
|
|
25
26
|
<ColorExample bg="navy" textColor="gray-100" borderColor="blue" />;
|
|
26
27
|
```
|
|
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
|
+
|
|
28
42
|
<TokenTable rows={getPropRows('color')} columns={defaultColumns} />
|
|
@@ -0,0 +1,47 @@
|
|
|
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
|
+
};
|
|
@@ -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
|
|
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,9 +46,7 @@ Gamut supports both physical and logical CSS properties through the `useLogicalP
|
|
|
46
46
|
|
|
47
47
|
### Affected Props
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
The table below shows a few examples — this is not a comprehensive list.
|
|
49
|
+
Here are some examples of how physical and logical properties are affected by the `useLogicalProperties` prop:
|
|
52
50
|
|
|
53
51
|
<TokenTable
|
|
54
52
|
idKey="prop"
|
|
@@ -61,7 +59,7 @@ The table below shows a few examples — this is not a comprehensive list.
|
|
|
61
59
|
},
|
|
62
60
|
{
|
|
63
61
|
key: 'physical',
|
|
64
|
-
name: 'Physical
|
|
62
|
+
name: 'Physical',
|
|
65
63
|
size: 'xl',
|
|
66
64
|
render: ({ physical }) =>
|
|
67
65
|
physical.map((p) => (
|
|
@@ -72,7 +70,7 @@ The table below shows a few examples — this is not a comprehensive list.
|
|
|
72
70
|
},
|
|
73
71
|
{
|
|
74
72
|
key: 'logical',
|
|
75
|
-
name: 'Logical
|
|
73
|
+
name: 'Logical',
|
|
76
74
|
size: 'xl',
|
|
77
75
|
render: ({ logical }) =>
|
|
78
76
|
logical.map((l) => (
|
|
@@ -83,35 +81,21 @@ The table below shows a few examples — this is not a comprehensive list.
|
|
|
83
81
|
},
|
|
84
82
|
]}
|
|
85
83
|
rows={[
|
|
86
|
-
{
|
|
87
|
-
prop: 'marginLeft',
|
|
88
|
-
physical: ['margin-left'],
|
|
89
|
-
logical: ['margin-inline-start'],
|
|
90
|
-
},
|
|
91
84
|
{
|
|
92
85
|
prop: 'mx',
|
|
93
86
|
physical: ['margin-left', 'margin-right'],
|
|
94
87
|
logical: ['margin-inline-start', 'margin-inline-end'],
|
|
95
88
|
},
|
|
96
|
-
{
|
|
97
|
-
prop: 'paddingTop',
|
|
98
|
-
physical: ['padding-top'],
|
|
99
|
-
logical: ['padding-block-start'],
|
|
100
|
-
},
|
|
89
|
+
{ prop: 'mt', physical: ['margin-top'], logical: ['margin-block-start'] },
|
|
101
90
|
{
|
|
102
91
|
prop: 'py',
|
|
103
92
|
physical: ['padding-top', 'padding-bottom'],
|
|
104
93
|
logical: ['padding-block-start', 'padding-block-end'],
|
|
105
94
|
},
|
|
106
95
|
{
|
|
107
|
-
prop: '
|
|
108
|
-
physical: ['
|
|
109
|
-
logical: ['
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
prop: 'height',
|
|
113
|
-
physical: ['height'],
|
|
114
|
-
logical: ['block-size'],
|
|
96
|
+
prop: 'pb',
|
|
97
|
+
physical: ['padding-bottom'],
|
|
98
|
+
logical: ['padding-block-end'],
|
|
115
99
|
},
|
|
116
100
|
]}
|
|
117
101
|
/>
|