@codecademy/styleguide 79.2.1-alpha.9135d1.0 → 79.2.1-alpha.aaebbc.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.
@@ -3,7 +3,7 @@ import { GamutIconProps } from '@codecademy/gamut-icons';
3
3
  import { IllustrationProps } from '@codecademy/gamut-illustrations';
4
4
  import { PatternProps } from '@codecademy/gamut-patterns';
5
5
  import { css, timingValues } from '@codecademy/gamut-styles';
6
- import { motion, AnimatePresence } from 'framer-motion';
6
+ import { motion, AnimatePresence } from 'motion/react';
7
7
  import * as React from 'react';
8
8
  import { useState } from 'react';
9
9
  import styled from '@emotion/styled';
package/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
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.1-alpha.9135d1.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.2.0...@codecademy/styleguide@79.2.1-alpha.9135d1.0) (2026-03-12)
6
+ ### [79.2.1-alpha.aaebbc.0](https://github.com/Codecademy/gamut/compare/@codecademy/styleguide@79.2.0...@codecademy/styleguide@79.2.1-alpha.aaebbc.0) (2026-03-16)
7
7
 
8
8
  **Note:** Version bump only for package @codecademy/styleguide
9
9
 
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.1-alpha.9135d1.0",
4
+ "version": "79.2.1-alpha.aaebbc.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": "e523ddaf3dad8a0af4e022007aaca3a2fd5930e4"
11
+ "gitHead": "6aa67ee39900bd188a2877c1d393605ee8995e83"
12
12
  }
@@ -5,7 +5,7 @@ import {
5
5
  FlexBox,
6
6
  } from '@codecademy/gamut';
7
7
  import type { Meta } from '@storybook/react';
8
- import { AnimatePresence } from 'framer-motion';
8
+ import { AnimatePresence } from 'motion/react';
9
9
  import { PropsWithChildren, useState } from 'react';
10
10
 
11
11
  const meta: Meta<typeof ExpandInCollapseOut> = {
@@ -1,6 +1,6 @@
1
1
  import { Box, FadeInSlideOut, FillButton, FlexBox } from '@codecademy/gamut';
2
2
  import type { Meta } from '@storybook/react';
3
- import { AnimatePresence } from 'framer-motion';
3
+ import { AnimatePresence } from 'motion/react';
4
4
  import { useState } from 'react';
5
5
 
6
6
  const meta: Meta<typeof FadeInSlideOut> = {
@@ -79,7 +79,7 @@ const ExpandableContainer = styled.Box(
79
79
 
80
80
  #### Disabling the rule
81
81
 
82
- For third-party components or edge cases where inline styles are necessary (e.g., framer-motion animations), you can disable the rule:
82
+ For third-party components or edge cases where inline styles are necessary (e.g., motion animations), you can disable the rule:
83
83
 
84
84
  ```tsx
85
85
  // eslint-disable-next-line gamut/no-inline-style
@@ -39,21 +39,44 @@ yarn add @codecademy/gamut-kit @emotion/react @emotion/styled
39
39
 
40
40
  3. Wrap your application root with `GamutProvider` and give it the theme you would like to use for your app.
41
41
 
42
+ **React 19:**
43
+
42
44
  ```tsx
43
45
  import React from 'react';
44
- import { render } from 'react-dom';
46
+ import { createRoot } from 'react-dom/client';
45
47
  import { GamutProvider, theme } from '@codecademy/gamut-styles';
46
48
 
47
49
  import { App } from './App';
48
50
 
49
51
  const rootElement = document.getElementById('root');
52
+ if (rootElement) {
53
+ const root = createRoot(rootElement);
54
+ root.render(
55
+ <GamutProvider>
56
+ <App />
57
+ </GamutProvider>
58
+ );
59
+ }
60
+ ```
50
61
 
51
- render(
52
- <GamutProvider>
53
- <App />
54
- </GamutProvider>,
55
- rootElement
56
- );
62
+ **React 18:**
63
+
64
+ ```tsx
65
+ import React from 'react';
66
+ import { render } from 'react-dom';
67
+ import { GamutProvider, theme } from '@codecademy/gamut-styles';
68
+
69
+ import { App } from './App';
70
+
71
+ const rootElement = document.getElementById('root');
72
+ if (rootElement) {
73
+ render(
74
+ <GamutProvider>
75
+ <App />
76
+ </GamutProvider>,
77
+ rootElement
78
+ );
79
+ }
57
80
  ```
58
81
 
59
82
  GamutProvider handles a few critical tasks that need to happen in order for components to work.
@@ -1,26 +0,0 @@
1
- import { Canvas, Controls, Meta } from '@storybook/blocks';
2
-
3
- import { ComponentHeader } from '~styleguide/blocks';
4
-
5
- import * as CalendarStories from './Calendar.stories';
6
-
7
- export const parameters = {
8
- title: 'DatePicker/Calendar',
9
- subtitle: `Calendar grid with header (month/year + prev/next), body (day grid), and footer (Clear, Today, quick actions). Used inside DatePickerCalendar.`,
10
- status: 'current',
11
- source: {
12
- repo: 'gamut',
13
- githubLink:
14
- 'https://github.com/Codecademy/gamut/blob/main/packages/gamut/src/DatePicker/Calendar',
15
- },
16
- };
17
-
18
- <Meta of={CalendarStories} />
19
-
20
- <ComponentHeader {...parameters} />
21
-
22
- ## Playground
23
-
24
- <Canvas sourceState="shown" of={CalendarStories.Default} />
25
-
26
- <Controls />
@@ -1,53 +0,0 @@
1
- import {
2
- Calendar,
3
- CalendarBody,
4
- CalendarFooter,
5
- CalendarHeader,
6
- } from '@codecademy/gamut';
7
- import type { Meta, StoryObj } from '@storybook/react';
8
- import { useId, useState } from 'react';
9
-
10
- const meta: Meta<typeof Calendar> = {
11
- component: Calendar,
12
- title: 'Molecules/DatePicker/Calendar',
13
- };
14
-
15
- export default meta;
16
-
17
- type Story = StoryObj<typeof Calendar>;
18
-
19
- export const Default: Story = {
20
- render: function CalendarStory() {
21
- const headingId = useId();
22
- const [visibleDate, setVisibleDate] = useState(() => new Date());
23
- const [selectedDate, setSelectedDate] = useState<Date | null>(null);
24
- const [focusedDate, setFocusedDate] = useState<Date | null>(
25
- () => new Date()
26
- );
27
-
28
- return (
29
- <Calendar>
30
- <CalendarHeader
31
- currentMonthYear={visibleDate}
32
- headingId={headingId}
33
- locale="en-US"
34
- onCurrentMonthYearChange={setVisibleDate}
35
- />
36
- <CalendarBody
37
- focusedDate={focusedDate}
38
- labelledById={headingId}
39
- locale="en-US"
40
- selectedDate={selectedDate}
41
- visibleDate={visibleDate}
42
- onDateSelect={setSelectedDate}
43
- onFocusedDateChange={setFocusedDate}
44
- onVisibleDateChange={setVisibleDate}
45
- />
46
- <CalendarFooter
47
- onCurrentMonthYearChange={setVisibleDate}
48
- onSelectedDateChange={setSelectedDate}
49
- />
50
- </Calendar>
51
- );
52
- },
53
- };
@@ -1,124 +0,0 @@
1
- import {
2
- Box,
3
- DatePicker,
4
- DatePickerCalendar,
5
- DatePickerInput,
6
- PopoverContainer,
7
- useDatePicker,
8
- } from '@codecademy/gamut';
9
- import type { Meta, StoryObj } from '@storybook/react';
10
- import { useRef, useState } from 'react';
11
-
12
- const meta: Meta<typeof DatePicker> = {
13
- component: DatePicker,
14
- title: 'Molecules/DatePicker/DatePicker',
15
- };
16
-
17
- export default meta;
18
-
19
- type Story = StoryObj<typeof DatePicker>;
20
-
21
- export const Default: Story = {
22
- render: function DatePickerStory() {
23
- const [selectedDate, setSelectedDate] = useState<Date | null>(null);
24
- return (
25
- <Box p={32}>
26
- <DatePicker
27
- label="Date"
28
- locale="de-DE"
29
- placeholder="MM/DD/YYYY"
30
- selectedDate={selectedDate}
31
- setSelectedDate={setSelectedDate}
32
- />
33
- </Box>
34
- );
35
- },
36
- };
37
-
38
- export const WithInitialDate: Story = {
39
- render: function DatePickerStory() {
40
- const [selectedDate, setSelectedDate] = useState<Date | null>(
41
- () => new Date(2026, 1, 15)
42
- );
43
- return (
44
- <DatePicker
45
- label="Date"
46
- placeholder="MM/DD/YYYY"
47
- selectedDate={selectedDate}
48
- setSelectedDate={setSelectedDate}
49
- />
50
- );
51
- },
52
- };
53
-
54
- /** Range mode: two inputs for start and end date. First calendar click sets start, second sets end. */
55
- export const Range: Story = {
56
- render: function DatePickerStory() {
57
- const [startDate, setStartDate] = useState<Date | null>(null);
58
- const [endDate, setEndDate] = useState<Date | null>(null);
59
- return (
60
- <Box p={32}>
61
- <DatePicker
62
- endDate={endDate}
63
- endLabel="End date"
64
- mode="range"
65
- setEndDate={setEndDate}
66
- setStartDate={setStartDate}
67
- startDate={startDate}
68
- startLabel="Start date"
69
- />
70
- </Box>
71
- );
72
- },
73
- };
74
-
75
- /**
76
- * Composed usage: DatePicker with children provides shared state via context.
77
- * The child uses useDatePicker() to get open/close and inputRef, then composes
78
- * DatePickerInput and DatePickerCalendar with a custom PopoverContainer layout.
79
- */
80
- export const ComposedWithContext: Story = {
81
- render: function DatePickerStory() {
82
- const [selectedDate, setSelectedDate] = useState<Date | null>(null);
83
- return (
84
- <Box p={32}>
85
- <DatePicker
86
- label="Start date"
87
- placeholder="MM/DD/YYYY"
88
- selectedDate={selectedDate}
89
- setSelectedDate={setSelectedDate}
90
- >
91
- <ComposedDatePickerLayout />
92
- </DatePicker>
93
- </Box>
94
- );
95
- },
96
- };
97
-
98
- function ComposedDatePickerLayout() {
99
- const { isCalendarOpen, openCalendar, closeCalendar, calendarDialogId } =
100
- useDatePicker();
101
- const inputRef = useRef<HTMLInputElement | null>(null);
102
-
103
- return (
104
- <>
105
- <Box width="fit-content" onClick={openCalendar}>
106
- <DatePickerInput ref={inputRef} />
107
- </Box>
108
- <PopoverContainer
109
- alignment="bottom-left"
110
- allowPageInteraction
111
- focusOnProps={{ autoFocus: false, focusLock: false }}
112
- invertAxis="x"
113
- isOpen={isCalendarOpen}
114
- offset={10}
115
- targetRef={inputRef}
116
- onRequestClose={closeCalendar}
117
- >
118
- <div aria-label="Choose date" id={calendarDialogId} role="dialog">
119
- <DatePickerCalendar dialogId={calendarDialogId} />
120
- </div>
121
- </PopoverContainer>
122
- </>
123
- );
124
- }