@alveole/storybook 2.0.0-alpha.10 → 2.0.0-alpha.11
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/dist/components/BarreDeFiltres.d.ts.map +1 -1
- package/dist/components/BarreDeFiltres.js +7 -1
- package/dist/components/ExampleBlock.d.ts.map +1 -1
- package/dist/components/ExampleBlock.js +4 -3
- package/dist/components/ExemplesDeLaStory.d.ts.map +1 -1
- package/dist/components/ExemplesDeLaStory.js +3 -4
- package/dist/components/UIKitTopBar.d.ts +2 -1
- package/dist/components/UIKitTopBar.d.ts.map +1 -1
- package/dist/components/UIKitTopBar.js +25 -39
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarreDeFiltres.d.ts","sourceRoot":"","sources":["../../src/components/BarreDeFiltres.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"BarreDeFiltres.d.ts","sourceRoot":"","sources":["../../src/components/BarreDeFiltres.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAKzC,MAAM,MAAM,mBAAmB,GAAG;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IACpC,gBAAgB,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;IAC9C,YAAY,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;CACjE,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,GAAI,qFAQ5B,mBAAmB,sBAiDrB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Box } from '@alveole/components';
|
|
3
|
+
import { useTheme } from '@alveole/theme';
|
|
3
4
|
import React from 'react';
|
|
4
5
|
import { Platform, ScrollView } from 'react-native';
|
|
5
6
|
import { ALL_STORY_FLAGS } from '../utils';
|
|
@@ -13,12 +14,17 @@ import { SearchField } from './SearchField';
|
|
|
13
14
|
* l'ecran n'a besoin de savoir quel menu est ouvert.
|
|
14
15
|
*/
|
|
15
16
|
export const BarreDeFiltres = ({ recherche, onRecherche, tags, tagChoisi, onTag, indicateurChoisi, onIndicateur, }) => {
|
|
17
|
+
const { isVariant, spacingValue } = useTheme();
|
|
18
|
+
const marge = isVariant('mobile') ? spacingValue('3W') : 0;
|
|
16
19
|
const [menuOuvert, setMenuOuvert] = React.useState(null);
|
|
17
20
|
const deroule = (menu) => ({
|
|
18
21
|
ouvert: menuOuvert === menu,
|
|
19
22
|
onOuvrir: (ouvert) => setMenuOuvert(ouvert ? menu : null),
|
|
20
23
|
});
|
|
21
|
-
return (_jsxs(ScrollView, { horizontal: true, nestedScrollEnabled: true, directionalLockEnabled: Platform.OS === 'ios', showsHorizontalScrollIndicator: false,
|
|
24
|
+
return (_jsxs(ScrollView, { horizontal: true, nestedScrollEnabled: true, directionalLockEnabled: Platform.OS === 'ios', showsHorizontalScrollIndicator: false,
|
|
25
|
+
// La zone défile jusqu'aux bords ; seuls le premier et le dernier contrôle
|
|
26
|
+
// gardent la marge de ScreenZone, à l'intérieur du contenu défilant.
|
|
27
|
+
style: { marginHorizontal: -marge, flexGrow: 0, flexShrink: 0 }, contentInsetAdjustmentBehavior: "never", contentContainerStyle: { flexDirection: 'row', gap: 8, alignItems: 'center', paddingHorizontal: marge }, children: [_jsx(Box, { style: { minWidth: 200 }, children: _jsx(SearchField, { placeholder: "Button, Tabs, Card...", value: recherche, onChangeText: onRecherche, size: "sm" }) }), _jsx(FiltreDeroulant, { libelle: "Tags", options: tags.map(tag => ({ key: tag, label: tag })), choisi: tagChoisi, onChoisir: tag => {
|
|
22
28
|
onTag(tag);
|
|
23
29
|
setMenuOuvert(null);
|
|
24
30
|
}, ...deroule('tags') }), _jsx(FiltreDeroulant, { libelle: "Indicateurs", options: ALL_STORY_FLAGS, choisi: indicateurChoisi, onChoisir: indicateur => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleBlock.d.ts","sourceRoot":"","sources":["../../src/components/ExampleBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ExampleBlock.d.ts","sourceRoot":"","sources":["../../src/components/ExampleBlock.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AA8F1B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,0FAA0F;IAC1F,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,2FAA2F;IAC3F,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,8EAA8E;AAC9E,eAAO,MAAM,YAAY,GAAI,kCAA0C,iBAAiB,sBAkCvF,CAAC"}
|
|
@@ -2,6 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
2
2
|
import { Box, Button, Highlight, Typography } from '@alveole/components';
|
|
3
3
|
import { useTheme } from '@alveole/theme';
|
|
4
4
|
import React from 'react';
|
|
5
|
+
import { Platform } from 'react-native';
|
|
5
6
|
import { decouperSource } from '../storySource';
|
|
6
7
|
/** Au delà, la source prend plus de place que ce qu'elle documente. */
|
|
7
8
|
const LIGNES_VISIBLES = 12;
|
|
@@ -16,7 +17,7 @@ const PAS_DE_LA_TRAME = 16;
|
|
|
16
17
|
*/
|
|
17
18
|
const Scene = ({ children, pleinEcran }) => {
|
|
18
19
|
const { color } = useTheme();
|
|
19
|
-
return (_jsx(Box, { p: '
|
|
20
|
+
return (_jsx(Box, { p: Platform.OS === 'web' ? '3W' : '1W', style: {
|
|
20
21
|
backgroundColor: color.light.background['default-grey'],
|
|
21
22
|
backgroundImage: `radial-gradient(circle, ${color.light.border['default-grey']} 1px, transparent 1px)`,
|
|
22
23
|
backgroundSize: `${PAS_DE_LA_TRAME}px ${PAS_DE_LA_TRAME}px`,
|
|
@@ -40,8 +41,8 @@ const BarreDeSource = ({ onCopier }) => {
|
|
|
40
41
|
justifyContent: 'space-between',
|
|
41
42
|
// Les côtés s'alignent sur la colonne du code, qui est le contenu principal du bas
|
|
42
43
|
// du bloc ; la hauteur reste au plus juste de ce que la barre porte.
|
|
43
|
-
paddingLeft: spacingValue('2W'),
|
|
44
|
-
paddingRight: spacingValue('2W'),
|
|
44
|
+
paddingLeft: spacingValue(Platform.OS === 'web' ? '2W' : '1W'),
|
|
45
|
+
paddingRight: spacingValue(Platform.OS === 'web' ? '2W' : '1W'),
|
|
45
46
|
paddingTop: spacingValue('1W'),
|
|
46
47
|
paddingBottom: spacingValue('1W'),
|
|
47
48
|
}, children: [_jsx(Typography, { style: { ...text['Corps de texte'].XS.CapsBold, color: color.light.text['mention-grey'] }, children: "tsx" }), _jsx(Button, { title: "Copier", size: "sm", variant: "tertiary", leading: "Copy", onPress: onCopier })] }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExemplesDeLaStory.d.ts","sourceRoot":"","sources":["../../src/components/ExemplesDeLaStory.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAiB,eAAe,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"ExemplesDeLaStory.d.ts","sourceRoot":"","sources":["../../src/components/ExemplesDeLaStory.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAiB,eAAe,EAAE,MAAM,UAAU,CAAC;AAiEnE,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,eAAe,CAAC;IACvB,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,8FAA8F;IAC9F,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,GAAI,8BAA8B,sBAAsB,gCAUrF,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { AnchorHeading, Box, MarkdownDescription, Tag, Typography } from '@alveole/components';
|
|
3
|
-
import {
|
|
2
|
+
import { A, AnchorHeading, Box, MarkdownDescription, Tag, Typography } from '@alveole/components';
|
|
3
|
+
import { useTheme } from '@alveole/theme';
|
|
4
4
|
import { descriptionDeLExemple, sourceDeLExemple } from '../screens/sourcesDExemples';
|
|
5
5
|
import { getStoryFlags } from '../utils';
|
|
6
6
|
import { ExampleBlock } from './ExampleBlock';
|
|
7
|
-
import { styleDuLienBrut } from './styleDuLienBrut';
|
|
8
7
|
/**
|
|
9
8
|
* Une demonstration. Le titre et la description appartiennent au document : ils restent dans le
|
|
10
9
|
* flux de la page, hors de tout cadre, pour pouvoir etre ancres et repris dans un sommaire. Le
|
|
@@ -22,7 +21,7 @@ const UnExemple = ({ story, nom, Rendu, gabarit }) => {
|
|
|
22
21
|
*/
|
|
23
22
|
const StatutDeLaFiche = ({ meta }) => {
|
|
24
23
|
const { color, text } = useTheme();
|
|
25
|
-
return (_jsxs(Box, { display: "flex", flexDirection: "row", style: { alignItems: 'center', justifyContent: 'space-between' }, children: [_jsxs(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 8, children: [meta.tags.map(tag => (_jsx(Tag, { size: "md", children: tag }, tag))), getStoryFlags(meta).map(flag => (_jsx(Tag, { size: "md", children: flag.label }, flag.key)))] }), meta.figmaURL ? (_jsx(
|
|
24
|
+
return (_jsxs(Box, { display: "flex", flexDirection: "row", style: { alignItems: 'center', justifyContent: 'space-between' }, children: [_jsxs(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 8, children: [meta.tags.map(tag => (_jsx(Tag, { size: "md", children: tag }, tag))), getStoryFlags(meta).map(flag => (_jsx(Tag, { size: "md", children: flag.label }, flag.key)))] }), meta.figmaURL ? (_jsx(A, { href: meta.figmaURL, target: "_blank", children: _jsx(Typography, { style: { ...text['Corps de texte'].SM.Bold, color: color.light.text['action-high-primary'] }, children: "Ouvrir Figma" }) })) : null] }));
|
|
26
25
|
};
|
|
27
26
|
/** Les demonstrations d'une fiche, les unes sous les autres, sous le statut de la fiche. */
|
|
28
27
|
export const ExemplesDeLaStory = ({ story, exemples, gabarit }) => (_jsxs(Box, { display: "flex", gap: 40, mt: '5W', children: [_jsx(StatutDeLaFiche, { meta: story.default }), exemples.map(([nom, Rendu]) => (_jsx(UnExemple, { story: story, nom: nom, Rendu: Rendu, gabarit: gabarit }, nom)))] }));
|
|
@@ -10,6 +10,7 @@ export type UIKitTopBarItem = {
|
|
|
10
10
|
export type UIKitTopBarProps = {
|
|
11
11
|
activeKey: string;
|
|
12
12
|
items: UIKitTopBarItem[];
|
|
13
|
+
logo?: React.ReactNode;
|
|
13
14
|
/**
|
|
14
15
|
* Niveau 2 de la rubrique courante. Sur desktop il est rendu par la colonne ; sous 992px
|
|
15
16
|
* la colonne se replie et son contenu descend ici, pour que le menu de la barre reste la
|
|
@@ -17,5 +18,5 @@ export type UIKitTopBarProps = {
|
|
|
17
18
|
*/
|
|
18
19
|
columnGroups?: UIKitColumnGroup[];
|
|
19
20
|
};
|
|
20
|
-
export declare const UIKitTopBar: ({ activeKey, items, columnGroups }: UIKitTopBarProps) => React.JSX.Element;
|
|
21
|
+
export declare const UIKitTopBar: ({ activeKey, items, columnGroups, logo }: UIKitTopBarProps) => React.JSX.Element;
|
|
21
22
|
//# sourceMappingURL=UIKitTopBar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UIKitTopBar.d.ts","sourceRoot":"","sources":["../../src/components/UIKitTopBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAA2E,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"UIKitTopBar.d.ts","sourceRoot":"","sources":["../../src/components/UIKitTopBar.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAA2E,MAAM,qBAAqB,CAAC;AAGjH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,8DAA8D;IAC9D,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;CAC9C,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,eAAe,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;;OAIG;IACH,YAAY,CAAC,EAAE,gBAAgB,EAAE,CAAC;CACnC,CAAC;AAsJF,eAAO,MAAM,WAAW,GAAI,0CAAsD,gBAAgB,sBAkBjG,CAAC"}
|
|
@@ -1,20 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { A, Box, Divider, Header, LucideIcon, SidebarGroup, SidebarItem, Typography } from '@alveole/components';
|
|
3
3
|
import { makeStyles, useTheme } from '@alveole/theme';
|
|
4
|
+
import { usePathname } from 'expo-router';
|
|
4
5
|
import React from 'react';
|
|
5
|
-
import { Pressable } from 'react-native';
|
|
6
|
-
|
|
7
|
-
const { color, radius, text } = useTheme();
|
|
8
|
-
return (_jsx(Box, { style: {
|
|
9
|
-
width: 32,
|
|
10
|
-
height: 32,
|
|
11
|
-
borderRadius: radius('md'),
|
|
12
|
-
backgroundColor: color.light.background['action-high-primary'],
|
|
13
|
-
display: 'flex',
|
|
14
|
-
alignItems: 'center',
|
|
15
|
-
justifyContent: 'center',
|
|
16
|
-
}, children: _jsx(Typography, { style: { ...text['Corps de texte'].XS.Bold, color: '#fff' }, children: "A" }) }));
|
|
17
|
-
};
|
|
6
|
+
import { Platform, Pressable, ScrollView, useWindowDimensions } from 'react-native';
|
|
7
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
18
8
|
const useNavItemStyles = makeStyles(({ color, radius, spacingValue, text }) => {
|
|
19
9
|
const activeLabelTypography = text['Corps de texte'].MD.Medium;
|
|
20
10
|
return {
|
|
@@ -62,41 +52,37 @@ const NavItem = ({ label, href, current, block = false }) => {
|
|
|
62
52
|
const styles = useNavItemStyles();
|
|
63
53
|
return (_jsxs(A, { href: href, direction: "replace", ariaCurrent: current ? 'page' : undefined, style: { ...styles.container, alignItems: block ? 'flex-start' : 'center' }, backgroundColor: { hover: styles.containerHover.backgroundColor }, children: [_jsx(Typography, { style: current ? styles.labelCurrent : styles.label, children: label }), _jsx(Box, { "aria-hidden": true, children: _jsx(Typography, { style: styles.labelGhost, children: label }) })] }));
|
|
64
54
|
};
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
const {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
return (_jsxs(_Fragment, { children: [_jsx(
|
|
78
|
-
position: 'sticky',
|
|
79
|
-
top: 64,
|
|
55
|
+
const MobileMenuItems = ({ activeKey, items, columnGroups }) => (_jsxs(_Fragment, { children: [items.map(({ key, ...item }) => (_jsx(NavItem, { ...item, current: activeKey === key, block: true }, key))), columnGroups.length > 0 && _jsx(Divider, {}), columnGroups.map(group => (_jsx(SidebarGroup, { title: group.title, children: group.items.map(item => (_jsx(SidebarItem, { title: item.title, href: item.href }, item.key))) }, group.title)))] }));
|
|
56
|
+
/** La barre mobile garde sa commande visible et fait défiler le menu sous celle-ci. */
|
|
57
|
+
const BarreMobile = ({ activeKey, items, columnGroups, logo }) => {
|
|
58
|
+
const { color, spacingValue } = useTheme();
|
|
59
|
+
const { height } = useWindowDimensions();
|
|
60
|
+
const { top, bottom } = useSafeAreaInsets();
|
|
61
|
+
const [barHeight, setBarHeight] = React.useState(0);
|
|
62
|
+
const [menuOpen, setMenuOpen] = React.useState(false);
|
|
63
|
+
const toggleMenu = () => setMenuOpen(open => !open);
|
|
64
|
+
// En natif, le menu remplit le bas de l'écran, zone de l'indicateur d'accueil comprise.
|
|
65
|
+
const menuHeight = Math.max(0, height - top - barHeight - (Platform.OS === 'web' ? bottom : 0));
|
|
66
|
+
const header = (_jsx(Header, { logo: logo, right: _jsx(Pressable, { accessibilityRole: "button", accessibilityLabel: menuOpen ? 'Fermer le menu' : 'Ouvrir le menu', accessibilityState: { expanded: menuOpen }, onPress: toggleMenu, style: { padding: 8 }, children: _jsx(LucideIcon, { name: menuOpen ? 'X' : 'Menu', size: "md", color: color.light.text['title-grey'] }) }) }));
|
|
67
|
+
return (_jsxs(_Fragment, { children: [_jsx(Box, { style: { position: Platform.OS === 'web' ? 'sticky' : 'relative', top: 0, zIndex: 100, flexShrink: 0 }, onLayout: event => setBarHeight(event.nativeEvent.layout.height), children: header }), menuOpen && (_jsx(Box, { style: {
|
|
68
|
+
position: Platform.OS === 'web' ? 'sticky' : 'relative',
|
|
69
|
+
top: Platform.OS === 'web' ? 64 : 0,
|
|
80
70
|
left: 0,
|
|
81
71
|
right: 0,
|
|
82
72
|
zIndex: 99,
|
|
83
73
|
backgroundColor: color.light.background['default-grey'],
|
|
84
74
|
borderBottomWidth: 1,
|
|
85
75
|
borderBottomColor: color.light.border['default-grey'],
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
paddingLeft: spacing('2W'),
|
|
89
|
-
paddingRight: spacing('2W'),
|
|
90
|
-
display: 'flex',
|
|
91
|
-
flexDirection: 'column',
|
|
92
|
-
gap: spacing('050'),
|
|
93
|
-
}, children: [items.map(({ key, ...item }) => (_jsx(NavItem, { ...item, current: activeKey === key, block: true }, key))), columnGroups.length > 0 && _jsx(Divider, {}), columnGroups.map(group => (_jsx(SidebarGroup, { title: group.title, children: group.items.map(item => (_jsx(SidebarItem, { title: item.title, href: item.href }, item.key))) }, group.title)))] }))] }));
|
|
76
|
+
flexShrink: 0,
|
|
77
|
+
}, children: _jsx(ScrollView, { style: { ...(Platform.OS === 'web' ? { maxHeight: menuHeight } : { height: menuHeight }), flexGrow: 0 }, contentContainerStyle: { padding: spacingValue('2W'), gap: spacingValue('050') }, keyboardShouldPersistTaps: "handled", children: _jsx(MobileMenuItems, { activeKey: activeKey, items: items, columnGroups: columnGroups }) }) }))] }));
|
|
94
78
|
};
|
|
95
|
-
export const UIKitTopBar = ({ activeKey, items, columnGroups = [] }) => {
|
|
79
|
+
export const UIKitTopBar = ({ activeKey, items, columnGroups = [], logo = null }) => {
|
|
96
80
|
const { isVariant } = useTheme();
|
|
81
|
+
const pathname = usePathname();
|
|
97
82
|
if (isVariant('mobile')) {
|
|
98
|
-
|
|
83
|
+
// Toute nouvelle fiche repart avec un menu fermé, y compris dans la même rubrique.
|
|
84
|
+
return _jsx(BarreMobile, { activeKey: activeKey, items: items, columnGroups: columnGroups, logo: logo }, pathname);
|
|
99
85
|
}
|
|
100
86
|
const right = (_jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 8, children: items.map(({ key, ...item }) => (_jsx(NavItem, { ...item, current: activeKey === key }, key))) }));
|
|
101
|
-
return _jsx(Header, { logo:
|
|
87
|
+
return _jsx(Header, { logo: logo, title: "Alveole UI Kit", right: right });
|
|
102
88
|
};
|