@alveole/storybook 1.9.0 → 2.0.0-alpha

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 (138) hide show
  1. package/dist/components/BarreDeFiltres.d.ts +20 -0
  2. package/dist/components/BarreDeFiltres.d.ts.map +1 -0
  3. package/dist/components/BarreDeFiltres.js +28 -0
  4. package/dist/components/ColorSwatch.d.ts +10 -0
  5. package/dist/components/ColorSwatch.d.ts.map +1 -0
  6. package/dist/components/ColorSwatch.js +37 -0
  7. package/dist/components/DocFooter.d.ts.map +1 -1
  8. package/dist/components/DocFooter.js +1 -1
  9. package/dist/components/EcranDeCatalogue.d.ts +18 -0
  10. package/dist/components/EcranDeCatalogue.d.ts.map +1 -0
  11. package/dist/components/EcranDeCatalogue.js +16 -0
  12. package/dist/components/EnTeteDeFiche.d.ts +10 -0
  13. package/dist/components/EnTeteDeFiche.d.ts.map +1 -0
  14. package/dist/components/EnTeteDeFiche.js +13 -0
  15. package/dist/components/ExampleBlock.d.ts +12 -0
  16. package/dist/components/ExampleBlock.d.ts.map +1 -0
  17. package/dist/components/ExampleBlock.js +69 -0
  18. package/dist/components/ExemplesDeLaStory.d.ts +10 -0
  19. package/dist/components/ExemplesDeLaStory.d.ts.map +1 -0
  20. package/dist/components/ExemplesDeLaStory.js +27 -0
  21. package/dist/components/FiltreDeroulant.d.ts +22 -0
  22. package/dist/components/FiltreDeroulant.d.ts.map +1 -0
  23. package/dist/components/FiltreDeroulant.js +10 -0
  24. package/dist/components/GrilleDeFiches.d.ts +15 -0
  25. package/dist/components/GrilleDeFiches.d.ts.map +1 -0
  26. package/dist/components/GrilleDeFiches.js +14 -0
  27. package/dist/components/MenuCard.d.ts +9 -0
  28. package/dist/components/MenuCard.d.ts.map +1 -0
  29. package/dist/components/MenuCard.js +8 -0
  30. package/dist/components/PageTitle.d.ts +19 -0
  31. package/dist/components/PageTitle.d.ts.map +1 -0
  32. package/dist/components/PageTitle.js +16 -0
  33. package/dist/components/ScreenZone.d.ts +19 -0
  34. package/dist/components/ScreenZone.d.ts.map +1 -0
  35. package/dist/components/ScreenZone.js +35 -0
  36. package/dist/components/StoryCard.d.ts.map +1 -1
  37. package/dist/components/StoryCard.js +3 -1
  38. package/dist/components/StoryLayout.d.ts +14 -0
  39. package/dist/components/StoryLayout.d.ts.map +1 -0
  40. package/dist/components/StoryLayout.js +21 -0
  41. package/dist/components/StorySummary.d.ts +7 -0
  42. package/dist/components/StorySummary.d.ts.map +1 -0
  43. package/dist/components/StorySummary.js +8 -0
  44. package/dist/components/UIKitColumn.d.ts +25 -0
  45. package/dist/components/UIKitColumn.d.ts.map +1 -0
  46. package/dist/components/UIKitColumn.js +24 -0
  47. package/dist/components/UIKitTopBar.d.ts +11 -2
  48. package/dist/components/UIKitTopBar.d.ts.map +1 -1
  49. package/dist/components/UIKitTopBar.js +84 -27
  50. package/dist/components/choixDuFiltre.d.ts +14 -0
  51. package/dist/components/choixDuFiltre.d.ts.map +1 -0
  52. package/dist/components/choixDuFiltre.js +10 -0
  53. package/dist/components/hauteurDeCarte.d.ts +6 -0
  54. package/dist/components/hauteurDeCarte.d.ts.map +1 -0
  55. package/dist/components/hauteurDeCarte.js +5 -0
  56. package/dist/index.d.ts +3 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +3 -0
  59. package/dist/navigation.d.ts +6 -0
  60. package/dist/navigation.d.ts.map +1 -0
  61. package/dist/navigation.js +3 -0
  62. package/dist/pages/InstallationPage.d.ts +8 -0
  63. package/dist/pages/InstallationPage.d.ts.map +1 -0
  64. package/dist/pages/InstallationPage.js +13 -0
  65. package/dist/pages/PhilosophyPage.d.ts +2 -1
  66. package/dist/pages/PhilosophyPage.d.ts.map +1 -1
  67. package/dist/pages/PhilosophyPage.js +7 -7
  68. package/dist/pages/UIKitHomePage.d.ts.map +1 -1
  69. package/dist/pages/UIKitHomePage.js +3 -7
  70. package/dist/pages/UIKitPage.d.ts +3 -4
  71. package/dist/pages/UIKitPage.d.ts.map +1 -1
  72. package/dist/pages/UIKitPage.js +59 -36
  73. package/dist/pages/UIKitThemePage.d.ts +6 -1
  74. package/dist/pages/UIKitThemePage.d.ts.map +1 -1
  75. package/dist/pages/UIKitThemePage.js +4 -8
  76. package/dist/pages/ecransDuKit.d.ts +18 -0
  77. package/dist/pages/ecransDuKit.d.ts.map +1 -0
  78. package/dist/pages/ecransDuKit.js +11 -0
  79. package/dist/pages/installation.d.ts +18 -0
  80. package/dist/pages/installation.d.ts.map +1 -0
  81. package/dist/pages/installation.js +218 -0
  82. package/dist/pages/installationOutillage.d.ts +7 -0
  83. package/dist/pages/installationOutillage.d.ts.map +1 -0
  84. package/dist/pages/installationOutillage.js +152 -0
  85. package/dist/pages/philosophie.d.ts +10 -0
  86. package/dist/pages/philosophie.d.ts.map +1 -0
  87. package/dist/pages/philosophie.js +46 -0
  88. package/dist/pressePapiers.d.ts +10 -0
  89. package/dist/pressePapiers.d.ts.map +1 -0
  90. package/dist/pressePapiers.js +14 -0
  91. package/dist/screens/StoriesScreen.d.ts +2 -1
  92. package/dist/screens/StoriesScreen.d.ts.map +1 -1
  93. package/dist/screens/StoriesScreen.js +18 -35
  94. package/dist/screens/StoryDetailScreen.d.ts +2 -1
  95. package/dist/screens/StoryDetailScreen.d.ts.map +1 -1
  96. package/dist/screens/StoryDetailScreen.js +24 -74
  97. package/dist/screens/ThemeCSSVariablesScreen.d.ts +2 -1
  98. package/dist/screens/ThemeCSSVariablesScreen.d.ts.map +1 -1
  99. package/dist/screens/ThemeCSSVariablesScreen.js +7 -97
  100. package/dist/screens/ThemeConstantDetailScreen.d.ts +2 -1
  101. package/dist/screens/ThemeConstantDetailScreen.d.ts.map +1 -1
  102. package/dist/screens/ThemeConstantDetailScreen.js +4 -4
  103. package/dist/screens/ThemeConstantsScreen.d.ts +2 -1
  104. package/dist/screens/ThemeConstantsScreen.d.ts.map +1 -1
  105. package/dist/screens/ThemeConstantsScreen.js +7 -8
  106. package/dist/screens/ThemePaletteScreen.d.ts +2 -1
  107. package/dist/screens/ThemePaletteScreen.d.ts.map +1 -1
  108. package/dist/screens/ThemePaletteScreen.js +11 -92
  109. package/dist/screens/ThemeTypographyScreen.d.ts +2 -1
  110. package/dist/screens/ThemeTypographyScreen.d.ts.map +1 -1
  111. package/dist/screens/ThemeTypographyScreen.js +6 -6
  112. package/dist/screens/colonnesDeFiches.d.ts +6 -0
  113. package/dist/screens/colonnesDeFiches.d.ts.map +1 -0
  114. package/dist/screens/colonnesDeFiches.js +20 -0
  115. package/dist/screens/paletteSections.d.ts +30 -0
  116. package/dist/screens/paletteSections.d.ts.map +1 -0
  117. package/dist/screens/paletteSections.js +76 -0
  118. package/dist/screens/sourcesDExemples.d.ts +17 -0
  119. package/dist/screens/sourcesDExemples.d.ts.map +1 -0
  120. package/dist/screens/sourcesDExemples.js +27 -0
  121. package/dist/screens/variablesCSSDuTheme.d.ts +12 -0
  122. package/dist/screens/variablesCSSDuTheme.d.ts.map +1 -0
  123. package/dist/screens/variablesCSSDuTheme.js +77 -0
  124. package/dist/screens/variablesDeTypographie.d.ts +8 -0
  125. package/dist/screens/variablesDeTypographie.d.ts.map +1 -0
  126. package/dist/screens/variablesDeTypographie.js +23 -0
  127. package/dist/storySource.d.ts +7 -0
  128. package/dist/storySource.d.ts.map +1 -0
  129. package/dist/storySource.js +7 -0
  130. package/dist/types.d.ts +2 -1
  131. package/dist/types.d.ts.map +1 -1
  132. package/dist/utils.d.ts +11 -3
  133. package/dist/utils.d.ts.map +1 -1
  134. package/dist/utils.js +20 -4
  135. package/package.json +19 -9
  136. package/dist/styles.d.ts +0 -7
  137. package/dist/styles.d.ts.map +0 -1
  138. package/dist/styles.js +0 -6
@@ -4,7 +4,8 @@ export type StoryDetailScreenProps = {
4
4
  story?: StorybookModule | null;
5
5
  notFoundMessage?: string;
6
6
  beforeContent?: React.ReactNode;
7
+ sidebar?: React.ReactNode;
7
8
  footerContent?: React.ReactNode;
8
9
  };
9
- export declare const StoryDetailScreen: ({ story, notFoundMessage, beforeContent, footerContent, }: StoryDetailScreenProps) => React.JSX.Element;
10
+ export declare const StoryDetailScreen: ({ story, notFoundMessage, ...cadre }: StoryDetailScreenProps) => React.JSX.Element;
10
11
  //# sourceMappingURL=StoryDetailScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StoryDetailScreen.d.ts","sourceRoot":"","sources":["../../src/screens/StoryDetailScreen.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAG3C,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAsGF,eAAO,MAAM,iBAAiB,GAAI,2DAK/B,sBAAsB,sBA6KxB,CAAC"}
1
+ {"version":3,"file":"StoryDetailScreen.d.ts","sourceRoot":"","sources":["../../src/screens/StoryDetailScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAI3C,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAwBF,eAAO,MAAM,iBAAiB,GAAI,sCAI/B,sBAAsB,sBAgCxB,CAAC"}
@@ -1,80 +1,30 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { AnchorHeading, Box, Button, Divider, MarkdownDescription, Page, PageHeader, Section, Tag, Typography, } from '@alveole/components';
2
+ import { Box, Page, Section, Tabs, Typography } from '@alveole/components';
3
3
  import { useTheme } from '@alveole/theme';
4
- import React from 'react';
5
- import { Linking, ScrollView } from 'react-native';
4
+ import { EnTeteDeFiche } from '../components/EnTeteDeFiche';
5
+ import { ExemplesDeLaStory } from '../components/ExemplesDeLaStory';
6
6
  import { JsonBlock } from '../components/JsonBlock';
7
- import { screenContent } from '../styles';
8
- import { getStoryExamples, getStoryFlags, stripMarkdown } from '../utils';
9
- const MetaCard = ({ label, value }) => {
10
- const { color, radius, text } = useTheme();
11
- return (_jsxs(Box, { borderColor: color.light.border['default-grey'], borderRadius: radius('md'), borderWidth: 1, display: "flex", gap: 4, p: '100', style: { backgroundColor: color.light.background['alt-grey'], minWidth: 160 }, children: [_jsx(Typography, { style: text['Corps de texte'].XS.CapsBold, children: label }), _jsx(Typography, { style: text['Corps de texte'].SM.SemiBold, children: value })] }));
7
+ import { StoryLayout } from '../components/StoryLayout';
8
+ import { StorySummary } from '../components/StorySummary';
9
+ import { getStoryExamples } from '../utils';
10
+ import { resumeDeLaFiche } from './sourcesDExemples';
11
+ /** L'URL peut nommer une fiche disparue : la page se charge quand meme et le dit. */
12
+ const FicheIntrouvable = ({ message, ...cadre }) => {
13
+ const { text } = useTheme();
14
+ return (_jsx(Page, { title: "Story not found", description: message, ...cadre, children: _jsx(Section, { withPaddingY: true, children: _jsx(Typography, { style: text['Corps de texte'].MD.Regular, children: message }) }) }));
12
15
  };
13
- const getSources = (story) => story.Sources;
14
- const getStoryExampleSource = (story, exampleName) => {
15
- const sources = getSources(story);
16
- const source = sources?.storySources?.[exampleName] ?? sources?.[exampleName];
17
- if (typeof source === 'string')
18
- return source;
19
- if (typeof source === 'function') {
20
- const value = source();
21
- return typeof value === 'string' ? value : null;
22
- }
23
- return null;
24
- };
25
- const getStoryExampleDescription = (story, exampleName) => {
26
- const description = getSources(story)?.storyDescriptions?.[exampleName];
27
- return typeof description === 'string' ? description : null;
28
- };
29
- const DetailTabs = ({ tabs, defaultValue }) => {
30
- const initialValue = defaultValue || tabs[0]?.value || '';
31
- const [activeValue, setActiveValue] = React.useState(initialValue);
32
- const activeTab = tabs.find(tab => tab.value === activeValue) ?? tabs[0];
33
- return (_jsxs(Box, { display: "flex", gap: 16, children: [_jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 8, children: tabs.map(tab => (_jsx(Button, { title: tab.label, size: "sm", variant: "tertiary", selected: tab.value === activeTab?.value, onPress: () => setActiveValue(tab.value) }, tab.value))) }), activeTab?.scrollable ? (_jsx(ScrollView, { style: { flex: 1 }, contentContainerStyle: { paddingBottom: 16 }, keyboardShouldPersistTaps: "handled", showsVerticalScrollIndicator: true, children: activeTab.content })) : (activeTab?.content)] }));
34
- };
35
- export const StoryDetailScreen = ({ story, notFoundMessage = 'Story not found.', beforeContent, footerContent, }) => {
36
- const { text, color, radius } = useTheme();
37
- if (!story) {
38
- return (_jsx(Page, { title: "Story not found", description: notFoundMessage, beforeContent: beforeContent, footerContent: footerContent, children: _jsx(Section, { withPaddingY: true, children: _jsx(Typography, { style: text['Corps de texte'].MD.Regular, children: notFoundMessage }) }) }));
39
- }
16
+ /** Les onglets de la fiche. Les props n'ont d'onglet que si la fiche en declare. */
17
+ const ongletsDeLaFiche = (meta, exemples) => [
18
+ { value: 'examples', label: 'Examples', content: exemples },
19
+ { value: 'styles', label: 'Styles', content: _jsx(JsonBlock, { value: meta.styleFn() }) },
20
+ ...(meta.props != null ? [{ value: 'props', label: 'Props', content: _jsx(JsonBlock, { value: meta.props }) }] : []),
21
+ ];
22
+ export const StoryDetailScreen = ({ story, notFoundMessage = 'Story not found.', ...cadre }) => {
23
+ const { spacingValue } = useTheme();
24
+ if (!story)
25
+ return _jsx(FicheIntrouvable, { message: notFoundMessage, ...cadre });
40
26
  const meta = story.default;
41
- const flags = getStoryFlags(meta);
42
- const examples = getStoryExamples(story);
43
- const isTemplate = meta.tags.includes('Template');
44
- const examplesContent = (_jsx(Box, { display: "flex", gap: 24, mt: '1,5V', children: examples.map(([key, Example]) => {
45
- const source = getStoryExampleSource(story, key);
46
- const description = getStoryExampleDescription(story, key);
47
- return (_jsxs(Box, { borderColor: color.light.border['default-grey'], borderRadius: radius('lg'), borderWidth: 1, display: "flex", gap: 16, p: '150', style: { backgroundColor: color.light.background['alt-grey'] }, children: [!isTemplate ? (_jsxs(Box, { display: "flex", gap: 6, children: [_jsx(AnchorHeading, { style: text.Titres['H5 - XS'], children: key }), description ? _jsx(MarkdownDescription, { children: description }) : null] })) : null, _jsx(Box, { borderColor: color.light.border['default-grey'], borderWidth: 1, borderRadius: radius('md'), p: '100', style: {
48
- backgroundColor: color.light.background['default-grey'],
49
- minHeight: isTemplate ? 420 : undefined,
50
- }, children: _jsx(Example, {}) }), _jsx(Divider, { mt: "1W", mb: "1,5V" }), source ? _jsx(JsonBlock, { language: "tsx", value: source }) : null] }, key));
51
- }) }));
52
- return (_jsx(Page, { scrollable: true, title: meta.title, description: meta.shortDescription ?? stripMarkdown(meta.description), beforeContent: beforeContent, footerContent: footerContent, children: _jsxs(Box, { ...screenContent, children: [_jsx(Section, { withPaddingY: false, children: _jsx(PageHeader, { title: meta.title }) }), _jsx(Section, { withPaddingY: false, children: _jsxs(Box, { display: "flex", gap: 20, children: [_jsxs(Box, { borderColor: color.light.border['default-grey'], borderRadius: radius('lg'), borderWidth: 1, display: "flex", gap: 16, p: '150', style: { backgroundColor: color.light.background['alt-grey'] }, children: [_jsxs(Box, { display: "flex", gap: 12, style: {
53
- alignItems: 'flex-start',
54
- flexDirection: 'row',
55
- justifyContent: 'space-between',
56
- }, children: [_jsx(Box, { display: "flex", gap: 6, style: { flex: 1 }, children: _jsx(MarkdownDescription, { children: meta.description }) }), meta.figmaURL ? (_jsx(Button, { title: "Ouvrir Figma", variant: "primary", onPress: () => Linking.openURL(meta.figmaURL) })) : null] }), _jsxs(Box, { display: "flex", gap: 10, children: [_jsx(Typography, { style: text['Corps de texte'].XS.CapsBold, children: "Tags" }), _jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 8, children: meta.tags.map(tag => (_jsx(Tag, { color: "action", size: "md", children: tag }, tag))) })] }), flags.length > 0 ? (_jsxs(Box, { display: "flex", gap: 10, children: [_jsx(Typography, { style: text['Corps de texte'].XS.CapsBold, children: "Informations" }), _jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 8, children: flags.map(flag => (_jsx(Tag, { color: "default", size: "md", children: flag.label }, flag.key))) })] })) : null, _jsxs(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 12, children: [_jsx(MetaCard, { label: "Exemples", value: String(examples.length) }), _jsx(MetaCard, { label: "Styles", value: "Disponibles" }), meta.props != null ? _jsx(MetaCard, { label: "Props", value: "Document\u00E9es" }) : null] })] }), _jsx(DetailTabs, { defaultValue: "examples", tabs: [
57
- {
58
- value: 'examples',
59
- label: 'Examples',
60
- content: examplesContent,
61
- scrollable: true,
62
- },
63
- {
64
- value: 'styles',
65
- label: 'Styles',
66
- content: _jsx(JsonBlock, { value: meta.styleFn() }),
67
- scrollable: true,
68
- },
69
- ...(meta.props != null
70
- ? [
71
- {
72
- value: 'props',
73
- label: 'Props',
74
- content: _jsx(JsonBlock, { value: meta.props }),
75
- scrollable: true,
76
- },
77
- ]
78
- : []),
79
- ] })] }) })] }) }));
27
+ const exemples = getStoryExamples(story);
28
+ const gabarit = meta.tags.includes('Template');
29
+ return (_jsx(Page, { scrollable: true, title: meta.title, description: resumeDeLaFiche(meta), ...cadre, children: _jsx(StoryLayout, { sommaire: exemples.length > 0 ? _jsx(StorySummary, { entrees: exemples.map(([nom]) => nom) }) : null, children: _jsxs(Box, { display: "flex", gap: spacingValue('6W'), children: [_jsx(EnTeteDeFiche, { meta: meta }), _jsx(Tabs, { defaultValue: "examples", urlAnchorPrefix: "story", tabs: ongletsDeLaFiche(meta, _jsx(ExemplesDeLaStory, { story: story, exemples: exemples, gabarit: gabarit })) })] }) }) }));
80
30
  };
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
2
  export type ThemeCSSVariablesScreenProps = {
3
3
  beforeContent?: React.ReactNode;
4
+ sidebar?: React.ReactNode;
4
5
  footerContent?: React.ReactNode;
5
6
  };
6
- export declare const ThemeCSSVariablesScreen: ({ beforeContent, footerContent }: ThemeCSSVariablesScreenProps) => React.JSX.Element;
7
+ export declare const ThemeCSSVariablesScreen: ({ beforeContent, sidebar, footerContent }: ThemeCSSVariablesScreenProps) => React.JSX.Element;
7
8
  //# sourceMappingURL=ThemeCSSVariablesScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeCSSVariablesScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeCSSVariablesScreen.tsx"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,OAAO,CAAC;AA0P1B,MAAM,MAAM,4BAA4B,GAAG;IACzC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAIF,eAAO,MAAM,uBAAuB,GAAI,kCAAkC,4BAA4B,sBA+DrG,CAAC"}
1
+ {"version":3,"file":"ThemeCSSVariablesScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeCSSVariablesScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAwI1B,MAAM,MAAM,4BAA4B,GAAG;IACzC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAIF,eAAO,MAAM,uBAAuB,GAAI,2CAA2C,4BAA4B,sBAsD9G,CAAC"}
@@ -1,100 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Accordion, Box, Page, PageHeader, Section, Typography, useToast } from '@alveole/components';
3
- import { Colors, CustomPalette, CustomTypography, Elevations, FontWeightMap, RadiusList, Spacings, sanitizeCSSKey, useTheme, } from '@alveole/theme';
2
+ import { Accordion, Box, Typography, useToast } from '@alveole/components';
3
+ import { useTheme } from '@alveole/theme';
4
4
  import React from 'react';
5
5
  import { Platform, Pressable } from 'react-native';
6
- import { screenContent } from '../styles';
7
- // ─── Helpers ──────────────────────────────────────────────────────────────────
8
- function collectTypographyVarNames(node, path, out) {
9
- if (typeof node.fontSize === 'number') {
10
- const prefix = `--typography-${path.map(sanitizeCSSKey).join('-')}`;
11
- out.push({ name: `${prefix}-font-size`, rawValue: `${node.fontSize}px`, preview: 'none' });
12
- out.push({ name: `${prefix}-line-height`, rawValue: `${node.lineHeight}px`, preview: 'none' });
13
- if (typeof node.fontFamily === 'string') {
14
- out.push({ name: `${prefix}-font-family`, rawValue: node.fontFamily, preview: 'none' });
15
- }
16
- if (typeof node.fontWeight === 'string') {
17
- out.push({ name: `${prefix}-font-weight`, rawValue: node.fontWeight, preview: 'none' });
18
- }
19
- return;
20
- }
21
- Object.entries(node).forEach(([key, value]) => {
22
- if (typeof value === 'object' && value !== null) {
23
- collectTypographyVarNames(value, [...path, key], out);
24
- }
25
- });
26
- }
27
- function buildGroups() {
28
- const groups = [];
29
- // Couleurs palette
30
- const paletteVars = [];
31
- Object.entries(Colors).forEach(([name, shades]) => {
32
- Object.entries(shades).forEach(([variant, value]) => {
33
- paletteVars.push({
34
- name: `--color-${name}-${variant}`,
35
- rawValue: value,
36
- preview: 'color',
37
- });
38
- });
39
- });
40
- groups.push({ title: 'Couleurs palette', vars: paletteVars });
41
- // Tokens sémantiques light
42
- const semanticCategories = ['background', 'text', 'border', 'artwork', 'system'];
43
- semanticCategories.forEach(category => {
44
- const tokens = CustomPalette.light[category];
45
- if (!tokens)
46
- return;
47
- const vars = Object.entries(tokens)
48
- .filter(([, value]) => typeof value === 'string')
49
- .map(([token, value]) => ({
50
- name: `--${category}-${token}`,
51
- rawValue: value,
52
- preview: 'color',
53
- }));
54
- if (vars.length)
55
- groups.push({ title: `Tokens — ${category}`, vars });
56
- });
57
- // Spacing
58
- groups.push({
59
- title: 'Spacing',
60
- vars: Object.entries(Spacings).map(([key, value]) => ({
61
- name: `--spacing-${sanitizeCSSKey(key)}`,
62
- rawValue: `${value}px`,
63
- preview: 'spacing',
64
- })),
65
- });
66
- // Radius
67
- groups.push({
68
- title: 'Radius',
69
- vars: Object.entries(RadiusList).map(([key, value]) => ({
70
- name: `--radius-${key}`,
71
- rawValue: `${value}px`,
72
- preview: 'radius',
73
- })),
74
- });
75
- // Elevations
76
- groups.push({
77
- title: 'Elevations',
78
- vars: Object.entries(Elevations).map(([key, value]) => ({
79
- name: `--elevation-${key}`,
80
- rawValue: value.web,
81
- preview: 'elevation',
82
- })),
83
- });
84
- // Fonts
85
- groups.push({
86
- title: 'Fonts',
87
- vars: Object.entries(FontWeightMap).flatMap(([key, { familyWithFallback, weight }]) => [
88
- { name: `--font-${key}-family`, rawValue: familyWithFallback, preview: 'none' },
89
- { name: `--font-${key}-weight`, rawValue: weight, preview: 'none' },
90
- ]),
91
- });
92
- // Typographies
93
- const typoVars = [];
94
- collectTypographyVarNames(CustomTypography, [], typoVars);
95
- groups.push({ title: 'Typographies', vars: typoVars });
96
- return groups;
97
- }
6
+ import { EcranDeCatalogue, filDuTheme } from '../components/EcranDeCatalogue';
7
+ import { buildGroups } from './variablesCSSDuTheme';
98
8
  // ─── Preview components ────────────────────────────────────────────────────────
99
9
  const ColorPreview = ({ value }) => (_jsx(Box, { style: {
100
10
  width: 28,
@@ -147,7 +57,7 @@ const VarRow = ({ entry }) => {
147
57
  });
148
58
  }
149
59
  };
150
- return (_jsx(Pressable, { onPress: copy, children: ({ pressed }) => (_jsxs(Box, { style: {
60
+ return (_jsx(Pressable, { accessibilityRole: "button", onPress: copy, children: ({ pressed }) => (_jsxs(Box, { style: {
151
61
  flexDirection: 'row',
152
62
  alignItems: 'center',
153
63
  gap: 12,
@@ -168,11 +78,11 @@ const VarRow = ({ entry }) => {
168
78
  }, numberOfLines: 1, children: entry.rawValue })] }), _jsx(Typography, { style: { fontSize: 11, color: color.light.text['mention-grey'] }, children: '⎘' })] })) }));
169
79
  };
170
80
  const COLLAPSED_BY_DEFAULT = ['Typographies', 'Fonts', 'Couleurs palette'];
171
- export const ThemeCSSVariablesScreen = ({ beforeContent, footerContent }) => {
81
+ export const ThemeCSSVariablesScreen = ({ beforeContent, sidebar, footerContent }) => {
172
82
  const { color } = useTheme();
173
83
  const groups = React.useMemo(() => buildGroups(), []);
174
84
  const total = groups.reduce((sum, g) => sum + g.vars.length, 0);
175
85
  const initialOpen = React.useMemo(() => groups.filter(g => !COLLAPSED_BY_DEFAULT.some(prefix => g.title.startsWith(prefix))).map(g => g.title), [groups]);
176
86
  const [openGroups, setOpenGroups] = React.useState(initialOpen);
177
- return (_jsx(Page, { scrollable: true, title: "Variables CSS", description: "Toutes les variables CSS inject\u00E9es par le ThemeProvider", beforeContent: beforeContent, footerContent: footerContent, children: _jsxs(Box, { ...screenContent, children: [_jsx(Section, { withPaddingY: false, children: _jsx(PageHeader, { title: "Variables CSS", breadcrumbsProps: { getHref: (segment, _index, path) => (segment === 'theme' ? null : path) } }) }), _jsxs(Section, { withPaddingY: false, children: [_jsxs(Typography, { style: { fontSize: 14, color: color.light.text['mention-grey'], marginBottom: 8 }, children: [`${total} variables injectées dans `, _jsx(Typography, { style: { fontSize: 14, fontFamily: 'monospace', color: color.light.text['default-grey'] }, children: ':root' }), ' par le ThemeProvider sur web. Cliquez sur une ligne pour copier le nom de la variable.'] }), _jsx(Typography, { style: { fontSize: 13, color: color.light.text['mention-grey'], marginBottom: 24, fontFamily: 'monospace' }, children: 'color: var(--background-action-high-primary);' }), _jsx(Accordion, { type: "multiple", value: openGroups, onValueChange: setOpenGroups, children: groups.map(g => (_jsx(Accordion.Item, { value: g.title, label: g.title, variant: "alt", labelChildren: _jsx(Typography, { style: { fontSize: 11, color: color.light.text['mention-grey'] }, children: `${g.vars.length} var${g.vars.length > 1 ? 's' : ''}` }), noPadding: true, children: g.vars.map(v => (_jsx(VarRow, { entry: v }, v.name))) }, g.title))) })] })] }) }));
87
+ return (_jsxs(EcranDeCatalogue, { title: "Variables CSS", description: "Toutes les variables CSS inject\u00E9es par le ThemeProvider", sidebar: sidebar, beforeContent: beforeContent, footerContent: footerContent, breadcrumbsProps: filDuTheme, children: [_jsxs(Typography, { style: { fontSize: 14, color: color.light.text['mention-grey'], marginBottom: 8 }, children: [`${total} variables injectées dans `, _jsx(Typography, { style: { fontSize: 14, fontFamily: 'monospace', color: color.light.text['default-grey'] }, children: ':root' }), ' par le ThemeProvider sur web. Cliquez sur une ligne pour copier le nom de la variable.'] }), _jsx(Typography, { style: { fontSize: 13, color: color.light.text['mention-grey'], marginBottom: 24, fontFamily: 'monospace' }, children: 'color: var(--background-action-high-primary);' }), _jsx(Accordion, { type: "multiple", value: openGroups, onValueChange: setOpenGroups, children: groups.map(g => (_jsx(Accordion.Item, { value: g.title, label: g.title, variant: "alt", labelChildren: _jsx(Typography, { style: { fontSize: 11, color: color.light.text['mention-grey'] }, children: `${g.vars.length} var${g.vars.length > 1 ? 's' : ''}` }), noPadding: true, children: g.vars.map(v => (_jsx(VarRow, { entry: v }, v.name))) }, g.title))) })] }));
178
88
  };
@@ -3,7 +3,8 @@ export type ThemeConstantDetailScreenProps = {
3
3
  name: string;
4
4
  value: unknown;
5
5
  beforeContent?: React.ReactNode;
6
+ sidebar?: React.ReactNode;
6
7
  footerContent?: React.ReactNode;
7
8
  };
8
- export declare const ThemeConstantDetailScreen: ({ name, value, beforeContent, footerContent, }: ThemeConstantDetailScreenProps) => React.JSX.Element;
9
+ export declare const ThemeConstantDetailScreen: ({ name, value, beforeContent, sidebar, footerContent, }: ThemeConstantDetailScreenProps) => React.JSX.Element;
9
10
  //# sourceMappingURL=ThemeConstantDetailScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeConstantDetailScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeConstantDetailScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,gDAKvC,8BAA8B,sBA2BhC,CAAC"}
1
+ {"version":3,"file":"ThemeConstantDetailScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeConstantDetailScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,yDAMvC,8BAA8B,sBA0BhC,CAAC"}
@@ -1,10 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Page, PageHeader, Section, Typography } from '@alveole/components';
2
+ import { Box, Typography } from '@alveole/components';
3
3
  import { useTheme } from '@alveole/theme';
4
+ import { EcranDeCatalogue } from '../components/EcranDeCatalogue';
4
5
  import { JsonBlock } from '../components/JsonBlock';
5
- import { screenContent } from '../styles';
6
- export const ThemeConstantDetailScreen = ({ name, value, beforeContent, footerContent, }) => {
6
+ export const ThemeConstantDetailScreen = ({ name, value, beforeContent, sidebar, footerContent, }) => {
7
7
  const { text } = useTheme();
8
8
  const entries = typeof value === 'object' && value != null ? Object.entries(value) : [];
9
- return (_jsx(Page, { scrollable: true, title: name, description: name, beforeContent: beforeContent, footerContent: footerContent, children: _jsxs(Box, { ...screenContent, children: [_jsx(Section, { withPaddingY: false, children: _jsx(PageHeader, { title: name }) }), _jsx(Section, { withPaddingY: false, children: _jsx(Box, { display: "flex", gap: 16, children: entries.length === 0 ? (_jsx(JsonBlock, { value: value })) : (entries.map(([entryName, entryValue]) => (_jsxs(Box, { display: "flex", gap: 8, children: [_jsx(Typography, { style: text.Titres['H6 - XXS'], children: entryName }), _jsx(JsonBlock, { value: entryValue })] }, entryName)))) }) })] }) }));
9
+ return (_jsx(EcranDeCatalogue, { title: name, description: name, sidebar: sidebar, beforeContent: beforeContent, footerContent: footerContent, children: _jsx(Box, { display: "flex", gap: 16, children: entries.length === 0 ? (_jsx(JsonBlock, { value: value })) : (entries.map(([entryName, entryValue]) => (_jsxs(Box, { display: "flex", gap: 8, children: [_jsx(Typography, { style: text.Titres['H6 - XXS'], children: entryName }), _jsx(JsonBlock, { value: entryValue })] }, entryName)))) }) }));
10
10
  };
@@ -4,11 +4,12 @@ export type ThemeConstantsScreenProps = {
4
4
  title?: string;
5
5
  description?: string;
6
6
  beforeContent?: React.ReactNode;
7
+ sidebar?: React.ReactNode;
7
8
  footerContent?: React.ReactNode;
8
9
  onSelectConstant?: (entry: {
9
10
  name: string;
10
11
  value: unknown;
11
12
  }) => void;
12
13
  };
13
- export declare const ThemeConstantsScreen: ({ constants, title, description, beforeContent, footerContent, onSelectConstant, }: ThemeConstantsScreenProps) => React.JSX.Element;
14
+ export declare const ThemeConstantsScreen: ({ constants, title, description, beforeContent, sidebar, footerContent, onSelectConstant, }: ThemeConstantsScreenProps) => React.JSX.Element;
14
15
  //# sourceMappingURL=ThemeConstantsScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeConstantsScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeConstantsScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CACtE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,oFAOlC,yBAAyB,sBA2C3B,CAAC"}
1
+ {"version":3,"file":"ThemeConstantsScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeConstantsScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,yBAAyB,GAAG;IACtC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;CACtE,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,6FAQlC,yBAAyB,sBAiC3B,CAAC"}
@@ -1,15 +1,14 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Card, Page, PageHeader, Section, Typography } from '@alveole/components';
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Box, Card, Typography } from '@alveole/components';
3
3
  import { useTheme } from '@alveole/theme';
4
4
  import React from 'react';
5
5
  import { Pressable, useWindowDimensions } from 'react-native';
6
- import { screenContent } from '../styles';
7
- export const ThemeConstantsScreen = ({ constants, title = 'UI Kit - Constants', description = 'Theme constants', beforeContent, footerContent, onSelectConstant, }) => {
6
+ import { EcranDeCatalogue } from '../components/EcranDeCatalogue';
7
+ import { getConstantEntries } from '../utils';
8
+ export const ThemeConstantsScreen = ({ constants, title = 'UI Kit - Constants', description = 'Theme constants', beforeContent, sidebar, footerContent, onSelectConstant, }) => {
8
9
  const { text } = useTheme();
9
10
  const { width } = useWindowDimensions();
10
11
  const columns = width >= 1200 ? 3 : width >= 768 ? 2 : 1;
11
- const entries = React.useMemo(() => Object.entries(constants)
12
- .filter(([, value]) => typeof value === 'object' && value != null)
13
- .sort((left, right) => left[0].localeCompare(right[0])), [constants]);
14
- return (_jsx(Page, { scrollable: true, title: title, description: description, beforeContent: beforeContent, footerContent: footerContent, children: _jsxs(Box, { ...screenContent, children: [_jsx(Section, { withPaddingY: false, children: _jsx(PageHeader, { title: title }) }), _jsx(Section, { withPaddingY: false, children: _jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 16, children: entries.map(([name, value]) => (_jsx(Box, { width: columns === 1 ? '100%' : columns === 2 ? '48%' : '31%', children: _jsx(Pressable, { onPress: onSelectConstant ? () => onSelectConstant({ name, value }) : undefined, children: _jsx(Card, { children: _jsx(Box, { p: '100', children: _jsx(Typography, { style: text.Titres['H5 - XS'], children: name }) }) }) }) }, name))) }) })] }) }));
12
+ const entries = React.useMemo(() => getConstantEntries(constants), [constants]);
13
+ return (_jsx(EcranDeCatalogue, { title: title, description: description, sidebar: sidebar, beforeContent: beforeContent, footerContent: footerContent, children: _jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 16, children: entries.map(([name, value]) => (_jsx(Box, { width: columns === 1 ? '100%' : columns === 2 ? '48%' : '31%', children: _jsx(Pressable, { accessibilityRole: "button", onPress: onSelectConstant ? () => onSelectConstant({ name, value }) : undefined, children: _jsx(Card, { children: _jsx(Box, { p: '100', children: _jsx(Typography, { style: text.Titres['H5 - XS'], children: name }) }) }) }) }, name))) }) }));
15
14
  };
@@ -4,7 +4,8 @@ export type ThemePaletteScreenProps = {
4
4
  title?: string;
5
5
  description?: string;
6
6
  beforeContent?: React.ReactNode;
7
+ sidebar?: React.ReactNode;
7
8
  footerContent?: React.ReactNode;
8
9
  };
9
- export declare const ThemePaletteScreen: ({ palette, title, description, beforeContent, footerContent, }: ThemePaletteScreenProps) => React.JSX.Element;
10
+ export declare const ThemePaletteScreen: ({ palette, title, description, beforeContent, sidebar, footerContent, }: ThemePaletteScreenProps) => React.JSX.Element;
10
11
  //# sourceMappingURL=ThemePaletteScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemePaletteScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemePaletteScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AA8H1B,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,gEAMhC,uBAAuB,sBAoDzB,CAAC"}
1
+ {"version":3,"file":"ThemePaletteScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemePaletteScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AA2BF,eAAO,MAAM,kBAAkB,GAAI,yEAOhC,uBAAuB,sBAyBzB,CAAC"}
@@ -1,99 +1,18 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Accordion, Box, Page, PageHeader, Section, Typography, useToast } from '@alveole/components';
2
+ import { Accordion, Box, Typography } from '@alveole/components';
3
3
  import { useTheme } from '@alveole/theme';
4
4
  import React from 'react';
5
- import { Pressable } from 'react-native';
6
- import { screenContent } from '../styles';
7
- function flattenColors(obj, prefix = '') {
8
- const entries = [];
9
- for (const [key, val] of Object.entries(obj)) {
10
- const path = prefix ? `${prefix}.${key}` : key;
11
- if (typeof val === 'string') {
12
- entries.push({ path, value: val });
13
- }
14
- else if (val && typeof val === 'object') {
15
- entries.push(...flattenColors(val, path));
16
- }
17
- }
18
- return entries;
19
- }
20
- const DEPRECATED_KEYS = [
21
- 'primary',
22
- 'transparent',
23
- 'danger',
24
- 'info',
25
- 'success',
26
- 'warning',
27
- 'link',
28
- 'text',
29
- 'border',
30
- 'background',
31
- 'system',
32
- ];
33
- function buildSections(palette) {
34
- const sections = [];
35
- for (const [modeKey, modeVal] of Object.entries(palette)) {
36
- if (modeKey === 'light') {
37
- if (modeVal && typeof modeVal === 'object') {
38
- for (const [groupKey, groupVal] of Object.entries(modeVal)) {
39
- const entries = flattenColors({ [groupKey]: groupVal }, modeKey);
40
- if (entries.length > 0) {
41
- sections.push({ title: `${modeKey} / ${groupKey}`, entries });
42
- }
43
- }
44
- }
45
- }
46
- }
47
- const deprecatedEntries = [];
48
- for (const key of DEPRECATED_KEYS) {
49
- const val = palette[key];
50
- if (val !== undefined) {
51
- if (typeof val === 'string') {
52
- deprecatedEntries.push({ path: key, value: val });
53
- }
54
- else if (val && typeof val === 'object') {
55
- deprecatedEntries.push(...flattenColors(val, key));
56
- }
57
- }
58
- }
59
- if (deprecatedEntries.length > 0) {
60
- sections.push({ title: 'Deprecated', entries: deprecatedEntries, deprecated: true });
61
- }
62
- return sections;
63
- }
64
- const ColorSwatch = ({ entry }) => {
65
- const toast = useToast();
66
- const { color, radius } = useTheme();
67
- const tokenName = entry.path.split('.').pop() ?? entry.path;
68
- const handleCopy = () => {
69
- if (typeof navigator !== 'undefined' && navigator.clipboard) {
70
- navigator.clipboard.writeText(entry.value).then(() => {
71
- toast.present('Copié !', entry.value, { variant: 'success', duration: 1500 });
72
- });
73
- }
74
- };
75
- return (_jsx(Pressable, { onPress: handleCopy, style: { width: 120, marginBottom: 8 }, children: ({ pressed }) => (_jsxs(Box, { style: {
76
- borderRadius: radius('md'),
77
- overflow: 'hidden',
78
- opacity: pressed ? 0.8 : 1,
79
- borderWidth: 1,
80
- borderColor: color.light.border['default-grey'],
81
- }, children: [_jsx(Box, { style: { height: 56, backgroundColor: entry.value } }), _jsxs(Box, { style: {
82
- paddingHorizontal: 8,
83
- paddingVertical: 6,
84
- backgroundColor: color.light.background['default-grey'],
85
- }, children: [_jsx(Typography, { style: { fontSize: 11, fontWeight: '600', color: color.light.text['title-grey'], lineHeight: 14 }, numberOfLines: 1, children: tokenName }), _jsx(Typography, { style: {
86
- fontSize: 10,
87
- color: color.light.text['mention-grey'],
88
- fontFamily: 'monospace',
89
- lineHeight: 14,
90
- marginTop: 2,
91
- }, numberOfLines: 1, children: entry.value })] })] })) }));
5
+ import { ColorSwatch } from '../components/ColorSwatch';
6
+ import { EcranDeCatalogue, filDuTheme } from '../components/EcranDeCatalogue';
7
+ import { buildSections, compteDeJetons, sectionsOuvertesAuDepart } from './paletteSections';
8
+ /** Une famille de couleurs, depliable, avec le nombre de jetons qu'elle contient. */
9
+ const SectionDeCouleurs = ({ section }) => {
10
+ const { color } = useTheme();
11
+ return (_jsx(Accordion.Item, { value: section.title, label: section.title, variant: "alt", labelChildren: _jsx(Typography, { style: { fontSize: 11, color: color.light.text['mention-grey'] }, children: compteDeJetons(section) }), noPadding: true, children: _jsx(Box, { style: { flexDirection: 'row', flexWrap: 'wrap', gap: 8, padding: 8 }, children: section.entries.map(entry => (_jsx(ColorSwatch, { entry: entry }, entry.path))) }) }));
92
12
  };
93
- export const ThemePaletteScreen = ({ palette, title = 'UI Kit - Couleurs du thème', description = 'Palette et couleurs du thème', beforeContent, footerContent, }) => {
13
+ export const ThemePaletteScreen = ({ palette, title = 'UI Kit - Couleurs du thème', description = 'Palette et couleurs du thème', beforeContent, sidebar, footerContent, }) => {
94
14
  const { color } = useTheme();
95
15
  const sections = React.useMemo(() => buildSections(palette), [palette]);
96
- const initialOpen = React.useMemo(() => sections.filter(s => !s.deprecated).map(s => s.title), [sections]);
97
- const [openSections, setOpenSections] = React.useState(initialOpen);
98
- return (_jsx(Page, { scrollable: true, title: title, description: description, beforeContent: beforeContent, footerContent: footerContent, children: _jsxs(Box, { ...screenContent, children: [_jsx(Section, { withPaddingY: false, children: _jsx(PageHeader, { title: title, breadcrumbsProps: { getHref: (segment, _index, path) => (segment === 'theme' ? null : path) } }) }), _jsxs(Section, { withPaddingY: false, children: [_jsx(Typography, { style: { fontSize: 14, color: color.light.text['mention-grey'], marginBottom: 24 }, children: 'Cliquez sur un swatch pour copier sa valeur dans le presse-papiers.' }), _jsx(Accordion, { type: "multiple", value: openSections, onValueChange: setOpenSections, children: sections.map(section => (_jsx(Accordion.Item, { value: section.title, label: section.title, variant: "alt", labelChildren: _jsx(Typography, { style: { fontSize: 11, color: color.light.text['mention-grey'] }, children: `${section.entries.length} token${section.entries.length > 1 ? 's' : ''}` }), noPadding: true, children: _jsx(Box, { style: { flexDirection: 'row', flexWrap: 'wrap', gap: 8, padding: 8 }, children: section.entries.map(entry => (_jsx(ColorSwatch, { entry: entry }, entry.path))) }) }, section.title))) })] })] }) }));
16
+ const [openSections, setOpenSections] = React.useState(() => sectionsOuvertesAuDepart(sections));
17
+ return (_jsxs(EcranDeCatalogue, { title: title, description: description, sidebar: sidebar, beforeContent: beforeContent, footerContent: footerContent, breadcrumbsProps: filDuTheme, children: [_jsx(Typography, { style: { fontSize: 14, color: color.light.text['mention-grey'], marginBottom: 24 }, children: 'Cliquez sur un swatch pour copier sa valeur dans le presse-papiers.' }), _jsx(Accordion, { type: "multiple", value: openSections, onValueChange: setOpenSections, children: sections.map(section => (_jsx(SectionDeCouleurs, { section: section }, section.title))) })] }));
99
18
  };
@@ -3,7 +3,8 @@ export type ThemeTypographyScreenProps = {
3
3
  title?: string;
4
4
  description?: string;
5
5
  beforeContent?: React.ReactNode;
6
+ sidebar?: React.ReactNode;
6
7
  footerContent?: React.ReactNode;
7
8
  };
8
- export declare const ThemeTypographyScreen: ({ typography, title, description, beforeContent, footerContent, }: ThemeTypographyScreenProps) => import("react").JSX.Element;
9
+ export declare const ThemeTypographyScreen: ({ typography, title, description, beforeContent, sidebar, footerContent, }: ThemeTypographyScreenProps) => import("react").JSX.Element;
9
10
  //# sourceMappingURL=ThemeTypographyScreen.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeTypographyScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeTypographyScreen.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAwGF,eAAO,MAAM,qBAAqB,GAAI,mEAMnC,0BAA0B,gCA8C5B,CAAC"}
1
+ {"version":3,"file":"ThemeTypographyScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeTypographyScreen.tsx"],"names":[],"mappings":"AAKA,MAAM,MAAM,0BAA0B,GAAG;IACvC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAwGF,eAAO,MAAM,qBAAqB,GAAI,4EAOnC,0BAA0B,gCAqC5B,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Card, Page, PageHeader, Section, Typography } from '@alveole/components';
2
+ import { Box, Card, Typography } from '@alveole/components';
3
3
  import { useTheme } from '@alveole/theme';
4
4
  import { View } from 'react-native';
5
- import { screenContent } from '../styles';
6
- const isLeafStyle = (value) => typeof value === 'object' && value !== null && typeof value.fontSize === 'number';
5
+ import { EcranDeCatalogue, filDuTheme } from '../components/EcranDeCatalogue';
6
+ const isLeafStyle = (value) => typeof value === 'object' && value !== null && 'fontSize' in value && typeof value.fontSize === 'number';
7
7
  const flattenStyles = (value, prefix = '') => {
8
8
  if (isLeafStyle(value)) {
9
9
  return prefix ? [{ label: prefix, style: value }] : [];
@@ -20,7 +20,7 @@ const flattenStyles = (value, prefix = '') => {
20
20
  };
21
21
  const getFontInfo = (style) => {
22
22
  const fontFamily = style.fontFamily ?? '';
23
- const fontWeight = style.fontWeight ?? '';
23
+ const fontWeight = String(style.fontWeight ?? '');
24
24
  if (fontFamily.includes(',')) {
25
25
  const family = fontFamily.split(',')[0]?.trim() ?? '';
26
26
  const weightLabels = {
@@ -43,7 +43,7 @@ const TableRow = ({ entry, valueStyle }) => {
43
43
  const { family, weight } = getFontInfo(entry.style);
44
44
  return (_jsxs(Box, { display: "flex", gap: 0, children: [_jsxs(Box, { display: "flex", flexDirection: "row", style: { paddingVertical: 12, alignItems: 'center' }, children: [_jsx(Box, { style: { width: PREVIEW_WIDTH }, children: _jsx(Typography, { style: entry.style, children: "Aa" }) }), _jsx(Box, { style: { flex: 2 }, children: _jsx(Typography, { style: valueStyle, children: entry.label }) }), _jsx(Box, { style: { flex: 1 }, children: _jsx(Typography, { style: [valueStyle, { color: MUTED_COLOR }], children: family }) }), _jsx(Box, { style: { flex: 1 }, children: _jsx(Typography, { style: [valueStyle, { color: MUTED_COLOR }], children: weight }) }), _jsx(Box, { style: { flex: 1 }, children: _jsxs(Typography, { style: [valueStyle, { color: MUTED_COLOR }], children: [entry.style.fontSize, "px"] }) }), _jsx(Box, { style: { flex: 1 }, children: _jsxs(Typography, { style: [valueStyle, { color: MUTED_COLOR }], children: [entry.style.lineHeight, "px"] }) })] }), _jsx(View, { style: { height: 1, backgroundColor: DIVIDER_COLOR } })] }));
45
45
  };
46
- export const ThemeTypographyScreen = ({ typography, title = 'UI Kit - Theme typography', description = 'Theme text styles', beforeContent, footerContent, }) => {
46
+ export const ThemeTypographyScreen = ({ typography, title = 'UI Kit - Theme typography', description = 'Theme text styles', beforeContent, sidebar, footerContent, }) => {
47
47
  const { text } = useTheme();
48
48
  const labelStyle = text['Corps de texte'].XS.SemiBold;
49
49
  const valueStyle = text['Corps de texte'].SM.Regular;
@@ -51,5 +51,5 @@ export const ThemeTypographyScreen = ({ typography, title = 'UI Kit - Theme typo
51
51
  key,
52
52
  entries: flattenStyles(value),
53
53
  }));
54
- return (_jsx(Page, { scrollable: true, title: title, description: description, beforeContent: beforeContent, footerContent: footerContent, children: _jsxs(Box, { ...screenContent, children: [_jsx(Section, { withPaddingY: false, children: _jsx(PageHeader, { title: title, breadcrumbsProps: { getHref: (segment, _index, path) => (segment === 'theme' ? null : path) } }) }), _jsx(Section, { withPaddingY: false, children: _jsx(Box, { display: "flex", gap: 16, children: categories.map(({ key, entries }) => (_jsx(Card, { children: _jsxs(Box, { display: "flex", gap: 16, p: "150", children: [_jsx(Typography, { style: text.Titres['H4 - SM'], children: key }), _jsxs(Box, { display: "flex", gap: 0, children: [_jsx(TableHeader, { labelStyle: labelStyle }), entries.map(entry => (_jsx(TableRow, { entry: entry, valueStyle: valueStyle }, entry.label)))] })] }) }, key))) }) })] }) }));
54
+ return (_jsx(EcranDeCatalogue, { title: title, description: description, sidebar: sidebar, beforeContent: beforeContent, footerContent: footerContent, breadcrumbsProps: filDuTheme, children: _jsx(Box, { display: "flex", gap: 16, children: categories.map(({ key, entries }) => (_jsx(Card, { children: _jsxs(Box, { display: "flex", gap: 16, p: "150", children: [_jsx(Typography, { style: text.Titres['H4 - SM'], children: key }), _jsxs(Box, { display: "flex", gap: 0, children: [_jsx(TableHeader, { labelStyle: labelStyle }), entries.map(entry => (_jsx(TableRow, { entry: entry, valueStyle: valueStyle }, entry.label)))] })] }) }, key))) }) }));
55
55
  };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * La largeur d'une carte, en CSS. Une seule colonne prend toute la place ; au-dela, la rangee
3
+ * retranche les gouttieres avant de partager, et il y en a une de moins que de colonnes.
4
+ */
5
+ export declare const largeurDeColonne: (largeurDeFenetre: number) => string;
6
+ //# sourceMappingURL=colonnesDeFiches.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colonnesDeFiches.d.ts","sourceRoot":"","sources":["../../src/screens/colonnesDeFiches.ts"],"names":[],"mappings":"AAYA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,kBAAkB,MAAM,KAAG,MAM3D,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Les paliers de la grille de fiches. Ils sont exprimes en largeur minimale : la premiere
3
+ * entree qui tient decide du nombre de colonnes.
4
+ */
5
+ const PALIERS = [
6
+ { aPartirDe: 1200, colonnes: 3 },
7
+ { aPartirDe: 768, colonnes: 2 },
8
+ ];
9
+ /** L'espace entre deux colonnes, en pixels. Il vaut le `gap` de la rangee de cartes. */
10
+ const GOUTTIERE = 16;
11
+ /**
12
+ * La largeur d'une carte, en CSS. Une seule colonne prend toute la place ; au-dela, la rangee
13
+ * retranche les gouttieres avant de partager, et il y en a une de moins que de colonnes.
14
+ */
15
+ export const largeurDeColonne = (largeurDeFenetre) => {
16
+ const { colonnes } = PALIERS.find(palier => largeurDeFenetre >= palier.aPartirDe) ?? { colonnes: 1 };
17
+ if (colonnes === 1)
18
+ return '100%';
19
+ return `calc((100% - ${GOUTTIERE * (colonnes - 1)}px) / ${colonnes})`;
20
+ };