Skip to content

Commit 87f1b78

Browse files
authored
Merge branch 'main' into patch-1
2 parents 22dd354 + 7d49b5f commit 87f1b78

File tree

159 files changed

+3885
-5827
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+3885
-5827
lines changed

.changeset/brave-years-yell.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@strapi/design-system': patch
3+
---
4+
5+
fix: glitch of height on inputs caused by wrong padding on IconButton

.changeset/dirty-readers-listen.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@strapi/design-system': minor
3+
---
4+
5+
export Popover.Anchor

.changeset/fast-squids-hammer.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@strapi/icons': minor
3+
---
4+
5+
New icons (Files, Graph, TrendUp and Webhooks)

.changeset/pre.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"beige-rings-destroy",
1515
"blue-humans-sin",
1616
"blue-tomatoes-allow",
17+
"brave-years-yell",
1718
"bright-grapes-juggle",
1819
"brown-lamps-wink",
1920
"calm-pets-live",
@@ -29,25 +30,29 @@
2930
"cuddly-jokes-stare",
3031
"curvy-candles-fly",
3132
"dirty-pumpkins-battle",
33+
"dirty-readers-listen",
3234
"dull-ants-wash",
3335
"eight-humans-brake",
3436
"fair-swans-shake",
3537
"famous-dryers-float",
3638
"famous-elephants-confess",
3739
"famous-starfishes-marry",
3840
"famous-trainers-pretend",
41+
"fast-squids-hammer",
3942
"few-cameras-joke",
4043
"fifty-hats-itch",
4144
"fresh-turkeys-approve",
4245
"funny-bulldogs-kneel",
4346
"giant-chicken-itch",
47+
"good-badgers-brush",
4448
"gorgeous-zoos-unite",
4549
"green-ligers-rush",
4650
"green-starfishes-retire",
4751
"grumpy-peaches-design",
4852
"grumpy-seahorses-give",
4953
"happy-squids-remain",
5054
"healthy-masks-poke",
55+
"heavy-ducks-complain",
5156
"hip-roses-wash",
5257
"hip-sloths-occur",
5358
"honest-crabs-crash",
@@ -115,13 +120,15 @@
115120
"swift-garlics-cross",
116121
"tasty-suits-sit",
117122
"tender-waves-fry",
123+
"thick-chefs-return",
118124
"thirty-wasps-explode",
119125
"three-eels-clap",
120126
"tidy-eggs-sleep",
121127
"tidy-games-divide",
122128
"tidy-rats-camp",
123129
"tiny-cups-reflect",
124130
"tiny-melons-help",
131+
"tricky-plants-sip",
125132
"tricky-pumpkins-impress",
126133
"twelve-dogs-protect",
127134
"twenty-drinks-look",
@@ -131,6 +138,8 @@
131138
"weak-clouds-breathe",
132139
"weak-eels-jump",
133140
"wild-colts-return",
134-
"wild-geese-lay"
141+
"wild-geese-lay",
142+
"wise-doors-hope",
143+
"witty-tips-kick"
135144
]
136145
}

.changeset/thick-chefs-return.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@strapi/design-system': minor
3+
---
4+
5+
fix: modify the creatable ui to reflect the desired style

.changeset/thirty-tigers-fix.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@strapi/design-system': minor
3+
---
4+
5+
fix: dark mode switch in stories and colors page

.changeset/witty-tips-kick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@strapi/design-system': minor
3+
---
4+
5+
export popover arrow

.github/workflows/bundle-size.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,4 @@ jobs:
3939
uses: preactjs/compressed-size-action@v2
4040
with:
4141
pattern: '**/dist/**/*.{cjs,js,mjs,svg}'
42+
install-script: 'yarn install'

docs/.storybook/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ const config: StorybookConfig = {
55
stories: ['../stories/**/*.mdx', '../stories/**/*.stories.tsx'],
66

77
addons: [
8-
getAbsolutePath('@storybook/addon-essentials'),
9-
getAbsolutePath('storybook-dark-mode'),
108
getAbsolutePath('@chromatic-com/storybook'),
119
getAbsolutePath('@storybook/addon-a11y'),
10+
getAbsolutePath('@storybook/addon-designs'),
11+
getAbsolutePath('@storybook/addon-docs'),
12+
getAbsolutePath('@vueless/storybook-dark-mode'),
1213
],
1314

1415
staticDirs: ['../public'],

docs/.storybook/preview.tsx

Lines changed: 89 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import * as React from 'react';
2-
import { Preview } from '@storybook/react';
3-
import { useDarkMode } from 'storybook-dark-mode';
2+
import { Preview } from '@storybook/react-vite';
3+
import { useDarkMode } from '@vueless/storybook-dark-mode';
44
import { parse } from 'qs';
55

66
import { DesignSystemProvider, Box, darkTheme, lightTheme, type BoxProps } from '@strapi/design-system';
77

8-
import { DocsContainer, Unstyled } from '@storybook/blocks';
8+
import { DocsContainer, Unstyled } from '@storybook/addon-docs/blocks';
99
import { styled, DefaultTheme } from 'styled-components';
1010
import { MARKDOWN_OVERRIDES } from '../components/Markdown';
1111

@@ -45,15 +45,87 @@ const createCustomTheme = (theme: DefaultTheme, base: 'light' | 'dark' = 'light'
4545

4646
const themeQueryURL = parse(document.location.search).theme;
4747

48-
const Theme = ({ children, ...props }: BoxProps) => {
49-
const isDarkAddon = useDarkMode();
50-
const [isDark, setIsDark] = React.useState(themeQueryURL || isDarkAddon);
48+
// Reusable hook to get dark mode state from localStorage
49+
export const useLocalStorageDarkMode = () => {
50+
const [isDark, setIsDark] = React.useState(() => {
51+
if (themeQueryURL) return themeQueryURL;
52+
53+
const themeParameters = localStorage.getItem('sb-addon-themes-3');
54+
let theme = 'light';
55+
try {
56+
theme = JSON.parse(themeParameters || '{}').current;
57+
} catch (error) {
58+
console.error(error);
59+
}
60+
return theme === 'dark';
61+
});
5162

5263
React.useEffect(() => {
53-
if (!themeQueryURL && isDarkAddon !== isDark) {
54-
setIsDark(isDarkAddon);
64+
const handleStorageChange = () => {
65+
const themeParameters = localStorage.getItem('sb-addon-themes-3');
66+
let theme = 'light';
67+
try {
68+
theme = JSON.parse(themeParameters || '{}').current;
69+
} catch (error) {
70+
console.error(error);
71+
}
72+
setIsDark(theme === 'dark');
73+
};
74+
75+
window.addEventListener('storage', handleStorageChange);
76+
return () => window.removeEventListener('storage', handleStorageChange);
77+
}, []);
78+
79+
return isDark;
80+
};
81+
82+
// Safe hook that tries useDarkMode first, then falls back to localStorage
83+
export const useSafeDarkMode = () => {
84+
try {
85+
return useDarkMode();
86+
} catch (error) {
87+
return useLocalStorageDarkMode();
88+
}
89+
};
90+
91+
const Theme = ({ children, isDarkMode, ...props }: BoxProps & { isDarkMode?: boolean }) => {
92+
const [isDark, setIsDark] = React.useState(() => {
93+
if (themeQueryURL) return themeQueryURL;
94+
if (isDarkMode !== undefined) return isDarkMode;
95+
96+
const themeParameters = localStorage.getItem('sb-addon-themes-3');
97+
let theme = 'light';
98+
try {
99+
theme = JSON.parse(themeParameters || '{}').current;
100+
} catch (error) {
101+
console.error(error);
55102
}
56-
}, [isDarkAddon, isDark]);
103+
return theme === 'dark';
104+
});
105+
106+
React.useEffect(() => {
107+
if (!themeQueryURL && isDarkMode !== undefined && isDarkMode !== isDark) {
108+
setIsDark(isDarkMode);
109+
}
110+
}, [isDarkMode, isDark]);
111+
112+
// Listen for theme changes in localStorage for docs
113+
React.useEffect(() => {
114+
if (isDarkMode === undefined) {
115+
const handleStorageChange = () => {
116+
const themeParameters = localStorage.getItem('sb-addon-themes-3');
117+
let theme = 'light';
118+
try {
119+
theme = JSON.parse(themeParameters || '{}').current;
120+
} catch (error) {
121+
console.error(error);
122+
}
123+
setIsDark(theme === 'dark');
124+
};
125+
window.addEventListener('storage', handleStorageChange);
126+
return () => window.removeEventListener('storage', handleStorageChange);
127+
}
128+
}, [isDarkMode]);
57129

58130
return (
59131
<DesignSystemProvider locale="en" theme={isDark ? darkTheme : lightTheme}>
@@ -109,11 +181,14 @@ const Main = styled(Box)`
109181

110182
const preview: Preview = {
111183
decorators: [
112-
(Story) => (
113-
<Theme>
114-
<Story />
115-
</Theme>
116-
),
184+
(Story) => {
185+
const isDarkMode = useDarkMode();
186+
return (
187+
<Theme isDarkMode={isDarkMode}>
188+
<Story />
189+
</Theme>
190+
);
191+
},
117192
],
118193

119194
parameters: {

0 commit comments

Comments
 (0)