@alveole/storybook 0.26.0 → 0.27.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/dist/components/FilterBadge.d.ts.map +1 -1
- package/dist/components/FilterBadge.js +17 -2
- package/dist/components/JsonBlock.d.ts.map +1 -1
- package/dist/components/JsonBlock.js +1 -1
- package/dist/components/SearchField.d.ts.map +1 -1
- package/dist/components/SearchField.js +5 -4
- package/dist/components/StoryCard.js +1 -1
- package/dist/components/UIKitTopBar.d.ts +11 -0
- package/dist/components/UIKitTopBar.d.ts.map +1 -0
- package/dist/components/UIKitTopBar.js +35 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/pages/UIKitHomePage.d.ts +9 -0
- package/dist/pages/UIKitHomePage.d.ts.map +1 -0
- package/dist/pages/UIKitHomePage.js +10 -0
- package/dist/pages/UIKitPage.d.ts +19 -0
- package/dist/pages/UIKitPage.d.ts.map +1 -0
- package/dist/pages/UIKitPage.js +65 -0
- package/dist/pages/UIKitThemePage.d.ts +8 -0
- package/dist/pages/UIKitThemePage.d.ts.map +1 -0
- package/dist/pages/UIKitThemePage.js +10 -0
- package/dist/screens/StoriesScreen.d.ts +3 -1
- package/dist/screens/StoriesScreen.d.ts.map +1 -1
- package/dist/screens/StoriesScreen.js +26 -4
- package/dist/screens/StoryDetailScreen.d.ts +2 -1
- package/dist/screens/StoryDetailScreen.d.ts.map +1 -1
- package/dist/screens/StoryDetailScreen.js +32 -6
- package/dist/screens/ThemeConstantDetailScreen.d.ts +2 -1
- package/dist/screens/ThemeConstantDetailScreen.d.ts.map +1 -1
- package/dist/screens/ThemeConstantDetailScreen.js +2 -2
- package/dist/screens/ThemeConstantsScreen.d.ts +3 -1
- package/dist/screens/ThemeConstantsScreen.d.ts.map +1 -1
- package/dist/screens/ThemeConstantsScreen.js +2 -2
- package/dist/screens/ThemePaletteScreen.d.ts +2 -1
- package/dist/screens/ThemePaletteScreen.d.ts.map +1 -1
- package/dist/screens/ThemePaletteScreen.js +2 -2
- package/dist/screens/ThemeTypographyScreen.d.ts +2 -1
- package/dist/screens/ThemeTypographyScreen.d.ts.map +1 -1
- package/dist/screens/ThemeTypographyScreen.js +2 -2
- package/dist/types.d.ts +4 -19
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +3 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +3 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilterBadge.d.ts","sourceRoot":"","sources":["../../src/components/FilterBadge.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FilterBadge.d.ts","sourceRoot":"","sources":["../../src/components/FilterBadge.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,4BAA4B,gBAAgB,4CA+BvE,CAAC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { Box, Typography } from '@alveole/components';
|
|
3
|
+
import { useTheme } from '@alveole/theme';
|
|
3
4
|
import { Pressable } from 'react-native';
|
|
4
|
-
export const FilterBadge = ({ active, label, onPress }) =>
|
|
5
|
+
export const FilterBadge = ({ active, label, onPress }) => {
|
|
6
|
+
const { color, radius, text, spacing } = useTheme();
|
|
7
|
+
return (_jsx(Pressable, { onPress: onPress, children: _jsx(Box, { borderColor: active ? color.light.border['action-low-primary'] : color.light.border['default-grey'], borderRadius: radius('full'), borderWidth: 1, p: '000', style: {
|
|
8
|
+
backgroundColor: active ? color.light.background['contrast-info'] : color.light.background['default-grey'],
|
|
9
|
+
paddingLeft: spacing('1W'),
|
|
10
|
+
paddingRight: spacing('1W'),
|
|
11
|
+
paddingTop: spacing('0,5V'),
|
|
12
|
+
paddingBottom: spacing('0,5V'),
|
|
13
|
+
}, children: _jsx(Typography, { style: [
|
|
14
|
+
text['Corps de texte'].XS.CapsBold,
|
|
15
|
+
{
|
|
16
|
+
color: active ? color.light.text['default-info'] : color.light.text['default-grey'],
|
|
17
|
+
},
|
|
18
|
+
], children: label }) }) }));
|
|
19
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"JsonBlock.d.ts","sourceRoot":"","sources":["../../src/components/JsonBlock.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,WAAW,cAAc,
|
|
1
|
+
{"version":3,"file":"JsonBlock.d.ts","sourceRoot":"","sources":["../../src/components/JsonBlock.tsx"],"names":[],"mappings":"AAGA,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,WAAW,cAAc,4CA0BlD,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { Box, Typography } from '@alveole/components';
|
|
|
3
3
|
import { useTheme } from '@alveole/theme';
|
|
4
4
|
export const JsonBlock = ({ value }) => {
|
|
5
5
|
const { text, color, radius } = useTheme();
|
|
6
|
-
return (_jsx(Box, { backgroundColor: color.light.background['alt-grey'], borderColor: color.light.border['plain-grey'], borderRadius: radius('md'), borderWidth: 1, p: '100', width: '100%', children: _jsx(Typography, { style: [
|
|
6
|
+
return (_jsx(Box, { backgroundColor: color.light.background['alt-grey'], borderColor: color.light.border['plain-grey'], borderRadius: radius('md'), borderWidth: 1, p: '100', mt: '1,5V', width: '100%', children: _jsx(Typography, { style: [
|
|
7
7
|
text['Corps de texte'].SM.Regular,
|
|
8
8
|
{
|
|
9
9
|
fontFamily: 'monospace',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SearchField.d.ts","sourceRoot":"","sources":["../../src/components/SearchField.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,6CAA6C,gBAAgB,
|
|
1
|
+
{"version":3,"file":"SearchField.d.ts","sourceRoot":"","sources":["../../src/components/SearchField.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,6CAA6C,gBAAgB,4CA0BxF,CAAC"}
|
|
@@ -4,13 +4,14 @@ import { useTheme } from '@alveole/theme';
|
|
|
4
4
|
import { TextInput } from 'react-native';
|
|
5
5
|
export const SearchField = ({ label, placeholder, value, onChangeText }) => {
|
|
6
6
|
const { text, color, radius, spacing } = useTheme();
|
|
7
|
-
return (_jsxs(Box, { display: "flex", gap: 8, children: [_jsx(Typography, { style: text['Corps de texte'].
|
|
7
|
+
return (_jsxs(Box, { display: "flex", gap: 8, children: [_jsx(Typography, { style: text['Corps de texte'].XS.CapsBold, children: label }), _jsx(TextInput, { placeholder: placeholder, value: value, onChangeText: onChangeText, placeholderTextColor: color.light.text['mention-grey'], autoCapitalize: "none", autoCorrect: false, style: {
|
|
8
8
|
borderWidth: 1,
|
|
9
|
-
borderColor: color.light.border['
|
|
9
|
+
borderColor: color.light.border['default-grey'],
|
|
10
10
|
borderRadius: radius('md'),
|
|
11
|
-
paddingVertical: spacing('
|
|
12
|
-
paddingHorizontal: spacing('
|
|
11
|
+
paddingVertical: spacing('1W'),
|
|
12
|
+
paddingHorizontal: spacing('2W'),
|
|
13
13
|
backgroundColor: color.light.background['default-grey'],
|
|
14
14
|
color: color.light.text['default-grey'],
|
|
15
|
+
...text['Corps de texte'].MD.Regular,
|
|
15
16
|
} })] }));
|
|
16
17
|
};
|
|
@@ -7,5 +7,5 @@ export const StoryCard = ({ story, onPress }) => {
|
|
|
7
7
|
const { text } = useTheme();
|
|
8
8
|
const meta = story.default;
|
|
9
9
|
const flags = getStoryFlags(meta);
|
|
10
|
-
return (_jsx(Pressable, { onPress: onPress ? () => onPress(story) : undefined, children: _jsx(Card, { height: '100%', children: _jsxs(
|
|
10
|
+
return (_jsx(Pressable, { onPress: onPress ? () => onPress(story) : undefined, style: { height: '100%' }, children: _jsx(Card, { height: '100%', children: _jsxs(Box, { display: "flex", gap: 12, p: '100', style: { height: '100%' }, children: [_jsxs(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 8, children: [meta.tags.map(tag => (_jsx(Badge, { variant: "info", size: "sm", style: { marginRight: 0 }, children: tag }, tag))), flags.map(flag => (_jsx(Badge, { variant: "default", size: "sm", style: { marginRight: 0 }, children: flag.label }, flag.key)))] }), _jsx(Typography, { style: text.Titres['H5 - XS'], children: meta.title }), _jsx(Typography, { style: text['Corps de texte'].SM.Regular, children: meta.description })] }) }) }));
|
|
11
11
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type UIKitTopBarItem = {
|
|
2
|
+
key: string;
|
|
3
|
+
label: string;
|
|
4
|
+
onPress: () => void;
|
|
5
|
+
};
|
|
6
|
+
export type UIKitTopBarProps = {
|
|
7
|
+
activeKey: string;
|
|
8
|
+
items: UIKitTopBarItem[];
|
|
9
|
+
};
|
|
10
|
+
export declare const UIKitTopBar: ({ activeKey, items }: UIKitTopBarProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=UIKitTopBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIKitTopBar.d.ts","sourceRoot":"","sources":["../../src/components/UIKitTopBar.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG;IAC5B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,eAAe,EAAE,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,sBAAsB,gBAAgB,4CA+EjE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Typography } from '@alveole/components';
|
|
3
|
+
import { useTheme } from '@alveole/theme';
|
|
4
|
+
import { Pressable, useWindowDimensions } from 'react-native';
|
|
5
|
+
export const UIKitTopBar = ({ activeKey, items }) => {
|
|
6
|
+
const { color, radius, text } = useTheme();
|
|
7
|
+
const { width } = useWindowDimensions();
|
|
8
|
+
return (_jsx(Box, { style: {
|
|
9
|
+
backgroundColor: color.light.background['default-grey'],
|
|
10
|
+
borderBottomColor: color.light.border['default-grey'],
|
|
11
|
+
borderBottomWidth: 1,
|
|
12
|
+
}, children: _jsxs(Box, { display: "flex", gap: 12, p: '150', style: {
|
|
13
|
+
alignItems: width >= 960 ? 'center' : 'flex-start',
|
|
14
|
+
flexDirection: width >= 960 ? 'row' : 'column',
|
|
15
|
+
justifyContent: 'space-between',
|
|
16
|
+
}, children: [_jsxs(Box, { display: "flex", gap: 2, children: [_jsx(Typography, { style: text['Corps de texte'].XS.CapsBold, children: "UI Kit" }), _jsx(Typography, { style: {
|
|
17
|
+
...text['Corps de texte'].XS.Regular,
|
|
18
|
+
color: color.light.text['mention-grey'],
|
|
19
|
+
}, children: "Alveole" })] }), _jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 8, children: items.map(item => {
|
|
20
|
+
const isActive = item.key === activeKey;
|
|
21
|
+
return (_jsx(Pressable, { accessibilityRole: "link", onPress: item.onPress, children: ({ pressed }) => (_jsx(Box, { borderColor: isActive ? color.light.border['action-low-primary'] : color.light.border['default-grey'], borderRadius: radius('full'), borderWidth: 1, pl: '100', pr: '100', pt: '075', pb: '075', style: {
|
|
22
|
+
backgroundColor: isActive
|
|
23
|
+
? color.light.background['action-low-primary']
|
|
24
|
+
: pressed
|
|
25
|
+
? color.light.background['alt-grey']
|
|
26
|
+
: color.light.background['default-grey'],
|
|
27
|
+
transitionDuration: '150ms',
|
|
28
|
+
transitionProperty: 'background-color, border-color, color',
|
|
29
|
+
transitionTimingFunction: 'ease',
|
|
30
|
+
}, children: _jsx(Typography, { style: {
|
|
31
|
+
...text['Corps de texte'].SM.Medium,
|
|
32
|
+
color: isActive ? color.light.text['action-high-primary'] : color.light.text['default-grey'],
|
|
33
|
+
}, children: item.label }) })) }, item.key));
|
|
34
|
+
}) })] }) }));
|
|
35
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from './components/JsonBlock';
|
|
2
|
+
export * from './components/UIKitTopBar';
|
|
3
|
+
export * from './pages/UIKitHomePage';
|
|
4
|
+
export * from './pages/UIKitPage';
|
|
5
|
+
export * from './pages/UIKitThemePage';
|
|
2
6
|
export * from './screens/StoriesScreen';
|
|
3
7
|
export * from './screens/StoryDetailScreen';
|
|
4
8
|
export * from './screens/ThemeConstantDetailScreen';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,wBAAwB,CAAC;AACvC,cAAc,0BAA0B,CAAC;AACzC,cAAc,uBAAuB,CAAC;AACtC,cAAc,mBAAmB,CAAC;AAClC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,qCAAqC,CAAC;AACpD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export * from './components/JsonBlock';
|
|
2
|
+
export * from './components/UIKitTopBar';
|
|
3
|
+
export * from './pages/UIKitHomePage';
|
|
4
|
+
export * from './pages/UIKitPage';
|
|
5
|
+
export * from './pages/UIKitThemePage';
|
|
2
6
|
export * from './screens/StoriesScreen';
|
|
3
7
|
export * from './screens/StoryDetailScreen';
|
|
4
8
|
export * from './screens/ThemeConstantDetailScreen';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type UIKitHomePageProps = {
|
|
2
|
+
title?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
onOpenComponents: () => void;
|
|
5
|
+
onOpenTheme: () => void;
|
|
6
|
+
onOpenConstants: () => void;
|
|
7
|
+
};
|
|
8
|
+
export declare const UIKitHomePage: ({ title, description, onOpenComponents, onOpenTheme, onOpenConstants, }: UIKitHomePageProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=UIKitHomePage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIKitHomePage.d.ts","sourceRoot":"","sources":["../../src/pages/UIKitHomePage.tsx"],"names":[],"mappings":"AAsBA,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,IAAI,CAAC;IAC7B,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,eAAe,EAAE,MAAM,IAAI,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,yEAM3B,kBAAkB,4CAwBpB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Card, Page, Section, Typography } from '@alveole/components';
|
|
3
|
+
import { useTheme } from '@alveole/theme';
|
|
4
|
+
const HomeCard = ({ title, description, onPress }) => {
|
|
5
|
+
const { text } = useTheme();
|
|
6
|
+
return (_jsx(Card, { onPress: onPress, children: _jsxs(Box, { display: "flex", gap: 8, p: '150', children: [_jsx(Typography, { style: text.Titres['H4 - SM'], children: title }), _jsx(Typography, { style: text['Corps de texte'].SM.Regular, children: description })] }) }));
|
|
7
|
+
};
|
|
8
|
+
export const UIKitHomePage = ({ title = 'UI Kit', description = 'Documentation du design system', onOpenComponents, onOpenTheme, onOpenConstants, }) => {
|
|
9
|
+
return (_jsx(Page, { scrollable: true, title: title, description: description, children: _jsx(Section, { withPaddingY: true, children: _jsxs(Box, { display: "flex", gap: 16, children: [_jsx(HomeCard, { title: "Composants", description: "Liste des composants disponibles pour le d\u00E9veloppement.", onPress: onOpenComponents }), _jsx(HomeCard, { title: "Th\u00E8me", description: "Th\u00E8me de l\u2019application, liste des tokens issus du design system.", onPress: onOpenTheme }), _jsx(HomeCard, { title: "Constantes", description: "Liste des constantes de th\u00E8me expos\u00E9es par la librairie.", onPress: onOpenConstants })] }) }) }));
|
|
10
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StorybookModule } from '../types';
|
|
3
|
+
type BlankPage = {
|
|
4
|
+
title?: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
render: () => React.ReactNode;
|
|
7
|
+
};
|
|
8
|
+
export type UIKitPageProps = {
|
|
9
|
+
stories: StorybookModule[];
|
|
10
|
+
constants: Record<string, unknown>;
|
|
11
|
+
palette?: Record<string, any>;
|
|
12
|
+
typography?: Record<string, unknown>;
|
|
13
|
+
title?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
blankPage?: BlankPage;
|
|
16
|
+
};
|
|
17
|
+
export declare const UIKitPage: ({ stories, constants, palette, typography, title, description, blankPage, }: UIKitPageProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=UIKitPage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIKitPage.d.ts","sourceRoot":"","sources":["../../src/pages/UIKitPage.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAO1B,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3C,KAAK,SAAS,GAAG;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,KAAK,CAAC,SAAS,CAAC;CAC/B,CAAC;AAaF,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB,CAAC;AAwGF,eAAO,MAAM,SAAS,GAAI,6EAQvB,cAAc,mDAmHhB,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Button, Card, Page, Section, Typography } from '@alveole/components';
|
|
3
|
+
import { CustomPalette, CustomTypography, useTheme } from '@alveole/theme';
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { StoriesScreen } from '../screens/StoriesScreen';
|
|
6
|
+
import { StoryDetailScreen } from '../screens/StoryDetailScreen';
|
|
7
|
+
import { ThemeConstantDetailScreen } from '../screens/ThemeConstantDetailScreen';
|
|
8
|
+
import { ThemeConstantsScreen } from '../screens/ThemeConstantsScreen';
|
|
9
|
+
import { ThemePaletteScreen } from '../screens/ThemePaletteScreen';
|
|
10
|
+
import { ThemeTypographyScreen } from '../screens/ThemeTypographyScreen';
|
|
11
|
+
const MenuCard = ({ title, description, onPress }) => {
|
|
12
|
+
const { text } = useTheme();
|
|
13
|
+
return (_jsx(Card, { onPress: onPress, children: _jsxs(Box, { display: "flex", gap: 8, p: '150', children: [_jsx(Typography, { style: text.Titres['H4 - SM'], children: title }), _jsx(Typography, { style: text['Corps de texte'].SM.Regular, children: description })] }) }));
|
|
14
|
+
};
|
|
15
|
+
const InternalHeader = ({ canGoBack, onBack }) => {
|
|
16
|
+
if (!canGoBack)
|
|
17
|
+
return null;
|
|
18
|
+
return (_jsx(Section, { withPaddingY: true, children: _jsx(Box, { children: _jsx(Button, { title: "Retour", variant: "tertiary", size: "sm", onPress: onBack }) }) }));
|
|
19
|
+
};
|
|
20
|
+
const HomeScreen = ({ title, description, blankPage, onOpenComponents, onOpenTheme, onOpenConstants, onOpenBlank, }) => {
|
|
21
|
+
return (_jsx(Page, { scrollable: true, title: title, description: description, children: _jsx(Section, { withPaddingY: true, children: _jsxs(Box, { display: "flex", gap: 16, children: [_jsx(MenuCard, { title: "Composants", description: "Catalogue des composants et de leurs variantes.", onPress: onOpenComponents }), _jsx(MenuCard, { title: "Th\u00E8me", description: "Couleurs et typographies du design system.", onPress: onOpenTheme }), _jsx(MenuCard, { title: "Constantes", description: "Constantes expos\u00E9es par le th\u00E8me.", onPress: onOpenConstants }), blankPage ? (_jsx(MenuCard, { title: blankPage.title ?? 'Page vierge', description: blankPage.description ?? 'Espace de test libre pour expérimenter.', onPress: onOpenBlank })) : null] }) }) }));
|
|
22
|
+
};
|
|
23
|
+
const ThemeHomeScreen = ({ onOpenColors, onOpenTypography, beforeContent, }) => {
|
|
24
|
+
return (_jsx(Page, { scrollable: true, title: "UI Kit - Th\u00E8me", description: "Tokens du th\u00E8me", beforeContent: beforeContent, children: _jsx(Section, { withPaddingY: true, children: _jsxs(Box, { display: "flex", gap: 16, children: [_jsx(MenuCard, { title: "Couleurs", description: "Palette et couleurs du th\u00E8me.", onPress: onOpenColors }), _jsx(MenuCard, { title: "Typographies", description: "Styles de texte et hi\u00E9rarchie typographique.", onPress: onOpenTypography })] }) }) }));
|
|
25
|
+
};
|
|
26
|
+
export const UIKitPage = ({ stories, constants, palette = CustomPalette, typography = CustomTypography, title = 'UI Kit', description = 'Documentation du design system', blankPage, }) => {
|
|
27
|
+
const [history, setHistory] = React.useState([{ name: 'home' }]);
|
|
28
|
+
const route = history[history.length - 1];
|
|
29
|
+
const canGoBack = history.length > 1;
|
|
30
|
+
const push = React.useCallback((nextRoute) => {
|
|
31
|
+
setHistory(current => [...current, nextRoute]);
|
|
32
|
+
}, []);
|
|
33
|
+
const goBack = React.useCallback(() => {
|
|
34
|
+
setHistory(current => (current.length > 1 ? current.slice(0, -1) : current));
|
|
35
|
+
}, []);
|
|
36
|
+
const beforeContent = _jsx(InternalHeader, { canGoBack: canGoBack, onBack: goBack });
|
|
37
|
+
if (route.name === 'home') {
|
|
38
|
+
return (_jsx(HomeScreen, { title: title, description: description, blankPage: blankPage, onOpenComponents: () => push({ name: 'components' }), onOpenTheme: () => push({ name: 'theme-home' }), onOpenConstants: () => push({ name: 'constants' }), onOpenBlank: () => push({ name: 'blank' }) }));
|
|
39
|
+
}
|
|
40
|
+
if (route.name === 'components') {
|
|
41
|
+
return (_jsx(StoriesScreen, { beforeContent: beforeContent, stories: stories, title: "UI Kit - Composants", description: "Catalogue des composants", createLabel: blankPage ? (blankPage.title ?? 'Page vierge') : undefined, onCreatePress: blankPage ? () => push({ name: 'blank' }) : undefined, onSelectStory: story => push({ name: 'component-detail', story }) }));
|
|
42
|
+
}
|
|
43
|
+
if (route.name === 'component-detail') {
|
|
44
|
+
return (_jsx(StoryDetailScreen, { beforeContent: beforeContent, story: route.story, notFoundMessage: "Composant introuvable" }));
|
|
45
|
+
}
|
|
46
|
+
if (route.name === 'theme-home') {
|
|
47
|
+
return (_jsx(ThemeHomeScreen, { beforeContent: beforeContent, onOpenColors: () => push({ name: 'theme-colors' }), onOpenTypography: () => push({ name: 'theme-typography' }) }));
|
|
48
|
+
}
|
|
49
|
+
if (route.name === 'theme-colors') {
|
|
50
|
+
return (_jsx(ThemePaletteScreen, { beforeContent: beforeContent, palette: palette, title: "UI Kit - Couleurs du th\u00E8me", description: "Palette et couleurs du th\u00E8me" }));
|
|
51
|
+
}
|
|
52
|
+
if (route.name === 'theme-typography') {
|
|
53
|
+
return (_jsx(ThemeTypographyScreen, { beforeContent: beforeContent, typography: typography, title: "UI Kit - Textes du th\u00E8me", description: "Styles de texte du th\u00E8me" }));
|
|
54
|
+
}
|
|
55
|
+
if (route.name === 'constants') {
|
|
56
|
+
return (_jsx(ThemeConstantsScreen, { beforeContent: beforeContent, constants: constants, title: "UI Kit - Constantes", description: "Constantes expos\u00E9es par le th\u00E8me", onSelectConstant: ({ name, value }) => push({ name: 'constant-detail', constantName: name, constantValue: value }) }));
|
|
57
|
+
}
|
|
58
|
+
if (route.name === 'constant-detail') {
|
|
59
|
+
return (_jsx(ThemeConstantDetailScreen, { beforeContent: beforeContent, name: route.constantName, value: route.constantValue }));
|
|
60
|
+
}
|
|
61
|
+
if (route.name === 'blank' && blankPage) {
|
|
62
|
+
return (_jsx(Page, { scrollable: true, title: blankPage.title ?? 'Page vierge', description: blankPage.description ?? 'Zone de test libre', beforeContent: beforeContent, children: _jsx(Section, { withPaddingY: true, children: blankPage.render() }) }));
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type UIKitThemePageProps = {
|
|
2
|
+
title?: string;
|
|
3
|
+
description?: string;
|
|
4
|
+
onOpenColors: () => void;
|
|
5
|
+
onOpenTypography: () => void;
|
|
6
|
+
};
|
|
7
|
+
export declare const UIKitThemePage: ({ title, description, onOpenColors, onOpenTypography, }: UIKitThemePageProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=UIKitThemePage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UIKitThemePage.d.ts","sourceRoot":"","sources":["../../src/pages/UIKitThemePage.tsx"],"names":[],"mappings":"AAsBA,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,gBAAgB,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,yDAK5B,mBAAmB,4CAerB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Card, Page, Section, Typography } from '@alveole/components';
|
|
3
|
+
import { useTheme } from '@alveole/theme';
|
|
4
|
+
const ThemeCard = ({ title, description, onPress }) => {
|
|
5
|
+
const { text } = useTheme();
|
|
6
|
+
return (_jsx(Card, { onPress: onPress, children: _jsxs(Box, { display: "flex", gap: 8, p: '150', children: [_jsx(Typography, { style: text.Titres['H4 - SM'], children: title }), _jsx(Typography, { style: text['Corps de texte'].SM.Regular, children: description })] }) }));
|
|
7
|
+
};
|
|
8
|
+
export const UIKitThemePage = ({ title = 'UI Kit - Thème', description = 'Tokens du thème', onOpenColors, onOpenTypography, }) => {
|
|
9
|
+
return (_jsx(Page, { scrollable: true, title: title, description: description, children: _jsx(Section, { withPaddingY: true, children: _jsxs(Box, { display: "flex", gap: 16, children: [_jsx(ThemeCard, { title: "Couleurs", description: "Palette et couleurs du th\u00E8me.", onPress: onOpenColors }), _jsx(ThemeCard, { title: "Typographies", description: "Styles de texte et hi\u00E9rarchie typographique.", onPress: onOpenTypography })] }) }) }));
|
|
10
|
+
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import { StorybookModule } from '../types';
|
|
2
3
|
export type StoriesScreenProps = {
|
|
3
4
|
stories: StorybookModule[];
|
|
4
5
|
title?: string;
|
|
5
6
|
description?: string;
|
|
6
7
|
emptyMessage?: string;
|
|
8
|
+
beforeContent?: React.ReactNode;
|
|
7
9
|
createLabel?: string;
|
|
8
10
|
onCreatePress?: () => void;
|
|
9
11
|
onSelectStory?: (story: StorybookModule) => void;
|
|
10
12
|
};
|
|
11
|
-
export declare const StoriesScreen: ({ stories, title, description, emptyMessage, createLabel, onCreatePress, onSelectStory, }: StoriesScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const StoriesScreen: ({ stories, title, description, emptyMessage, beforeContent, createLabel, onCreatePress, onSelectStory, }: StoriesScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
//# sourceMappingURL=StoriesScreen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoriesScreen.d.ts","sourceRoot":"","sources":["../../src/screens/StoriesScreen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StoriesScreen.d.ts","sourceRoot":"","sources":["../../src/screens/StoriesScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,OAAO,EAAiB,eAAe,EAAE,MAAM,UAAU,CAAC;AAW1D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;CAClD,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,0GAS3B,kBAAkB,4CAgKpB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Button, Page, Section, Typography } from '@alveole/components';
|
|
3
3
|
import { useTheme } from '@alveole/theme';
|
|
4
4
|
import React from 'react';
|
|
@@ -14,10 +14,15 @@ const AVAILABLE_FLAGS = [
|
|
|
14
14
|
{ key: 'webOnly', label: 'Web only' },
|
|
15
15
|
{ key: 'mobileOnly', label: 'Mobile only' },
|
|
16
16
|
];
|
|
17
|
-
export const StoriesScreen = ({ stories, title = 'UI Kit - Components', description = 'Shared component catalog', emptyMessage = 'No story found.', createLabel, onCreatePress, onSelectStory, }) => {
|
|
18
|
-
const { text } = useTheme();
|
|
17
|
+
export const StoriesScreen = ({ stories, title = 'UI Kit - Components', description = 'Shared component catalog', emptyMessage = 'No story found.', beforeContent, createLabel, onCreatePress, onSelectStory, }) => {
|
|
18
|
+
const { text, color, radius } = useTheme();
|
|
19
19
|
const { width } = useWindowDimensions();
|
|
20
20
|
const columns = width >= 1200 ? 3 : width >= 768 ? 2 : 1;
|
|
21
|
+
const columnStyle = columns === 1
|
|
22
|
+
? { width: '100%' }
|
|
23
|
+
: columns === 2
|
|
24
|
+
? { width: 'calc((100% - 16px) / 2)' }
|
|
25
|
+
: { width: 'calc((100% - 32px) / 3)' };
|
|
21
26
|
const [query, setQuery] = React.useState('');
|
|
22
27
|
const [selectedTag, setSelectedTag] = React.useState(null);
|
|
23
28
|
const [selectedFlag, setSelectedFlag] = React.useState(null);
|
|
@@ -29,5 +34,22 @@ export const StoriesScreen = ({ stories, title = 'UI Kit - Components', descript
|
|
|
29
34
|
selectedFlag,
|
|
30
35
|
}), [stories, query, selectedTag, selectedFlag]);
|
|
31
36
|
const groupedStories = React.useMemo(() => groupStoriesByTag(filteredStories, allTags), [filteredStories, allTags]);
|
|
32
|
-
|
|
37
|
+
const hasActiveFilters = query.trim().length > 0 || selectedTag !== null || selectedFlag !== null;
|
|
38
|
+
const activeFiltersCount = [query.trim().length > 0, selectedTag !== null, selectedFlag !== null].filter(Boolean).length;
|
|
39
|
+
return (_jsxs(Page, { scrollable: true, title: title, description: description, beforeContent: _jsxs(_Fragment, { children: [beforeContent, createLabel && onCreatePress ? (_jsx(Section, { withPaddingY: true, children: _jsx(Box, { style: { alignItems: 'flex-end' }, children: _jsx(Button, { title: createLabel, variant: "primary", onPress: onCreatePress }) }) })) : null] }), children: [_jsx(Section, { withPaddingY: true, children: _jsxs(Box, { borderColor: color.light.border['default-grey'], borderRadius: radius('lg'), borderWidth: 1, display: "flex", gap: 16, p: '150', style: {
|
|
40
|
+
backgroundColor: color.light.background['alt-grey'],
|
|
41
|
+
}, children: [_jsxs(Box, { display: "flex", gap: 12, style: {
|
|
42
|
+
alignItems: width >= 1024 ? 'center' : 'stretch',
|
|
43
|
+
flexDirection: width >= 1024 ? 'row' : 'column',
|
|
44
|
+
justifyContent: 'space-between',
|
|
45
|
+
}, children: [_jsxs(Box, { display: "flex", gap: 4, children: [_jsx(Typography, { style: text.Titres['H5 - XS'], children: "Filtres" }), _jsxs(Typography, { style: text['Corps de texte'].SM.Regular, children: [filteredStories.length, " composant", filteredStories.length > 1 ? 's' : '', hasActiveFilters
|
|
46
|
+
? `, ${activeFiltersCount} filtre${activeFiltersCount > 1 ? 's' : ''} actif${activeFiltersCount > 1 ? 's' : ''}`
|
|
47
|
+
: ''] })] }), hasActiveFilters ? (_jsx(Button, { title: "R\u00E9initialiser", variant: "tertiary", size: "sm", onPress: () => {
|
|
48
|
+
setQuery('');
|
|
49
|
+
setSelectedTag(null);
|
|
50
|
+
setSelectedFlag(null);
|
|
51
|
+
} })) : null] }), _jsx(SearchField, { label: "Recherche", placeholder: "Button, Tabs, Card...", value: query, onChangeText: setQuery }), _jsxs(Box, { display: "flex", gap: 16, style: {
|
|
52
|
+
alignItems: 'flex-start',
|
|
53
|
+
flexDirection: width >= 1024 ? 'row' : 'column',
|
|
54
|
+
}, children: [_jsxs(Box, { display: "flex", gap: 8, style: { flex: 1, width: '100%' }, children: [_jsx(Typography, { style: text['Corps de texte'].XS.CapsBold, children: "Tags" }), _jsxs(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 8, children: [_jsx(FilterBadge, { active: selectedTag === null, label: "Tous", onPress: () => setSelectedTag(null) }), allTags.map(tag => (_jsx(FilterBadge, { active: selectedTag === tag, label: tag, onPress: () => setSelectedTag(current => (current === tag ? null : tag)) }, tag)))] })] }), _jsxs(Box, { display: "flex", gap: 8, style: { flex: 1, width: '100%' }, children: [_jsx(Typography, { style: text['Corps de texte'].XS.CapsBold, children: "Indicateurs" }), _jsxs(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 8, children: [_jsx(FilterBadge, { active: selectedFlag === null, label: "Tous", onPress: () => setSelectedFlag(null) }), AVAILABLE_FLAGS.map(flag => (_jsx(FilterBadge, { active: selectedFlag === flag.key, label: flag.label, onPress: () => setSelectedFlag(current => (current === flag.key ? null : flag.key)) }, flag.key)))] })] })] })] }) }), groupedStories.length === 0 ? (_jsx(Section, { withPaddingY: true, children: _jsx(Typography, { style: text['Corps de texte'].MD.Regular, children: emptyMessage }) })) : (groupedStories.map(([tag, taggedStories]) => (_jsx(Section, { withPaddingY: true, children: _jsxs(Box, { display: "flex", gap: 16, children: [_jsx(Typography, { style: text.Titres['H4 - SM'], children: tag }), _jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 16, children: taggedStories.map(story => (_jsx(Box, { style: { alignSelf: 'stretch', width: columnStyle.width }, children: _jsx(StoryCard, { story: story, onPress: onSelectStory }) }, story.default.title))) })] }) }, tag))))] }));
|
|
33
55
|
};
|
|
@@ -2,6 +2,7 @@ import { StorybookModule } from '../types';
|
|
|
2
2
|
export type StoryDetailScreenProps = {
|
|
3
3
|
story?: StorybookModule | null;
|
|
4
4
|
notFoundMessage?: string;
|
|
5
|
+
beforeContent?: React.ReactNode;
|
|
5
6
|
};
|
|
6
|
-
export declare const StoryDetailScreen: ({ story, notFoundMessage }: StoryDetailScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const StoryDetailScreen: ({ story, notFoundMessage, beforeContent, }: StoryDetailScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
//# sourceMappingURL=StoryDetailScreen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StoryDetailScreen.d.ts","sourceRoot":"","sources":["../../src/screens/StoryDetailScreen.tsx"],"names":[],"mappings":"AAIA,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;
|
|
1
|
+
{"version":3,"file":"StoryDetailScreen.d.ts","sourceRoot":"","sources":["../../src/screens/StoryDetailScreen.tsx"],"names":[],"mappings":"AAIA,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;CACjC,CAAC;AA8DF,eAAO,MAAM,iBAAiB,GAAI,4CAI/B,sBAAsB,4CAgJxB,CAAC"}
|
|
@@ -1,20 +1,46 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Button,
|
|
2
|
+
import { Box, Button, Page, Section, Tabs, Typography } from '@alveole/components';
|
|
3
3
|
import { useTheme } from '@alveole/theme';
|
|
4
4
|
import { Linking } from 'react-native';
|
|
5
5
|
import { JsonBlock } from '../components/JsonBlock';
|
|
6
6
|
import { getStoryExamples, getStoryFlags } from '../utils';
|
|
7
|
-
|
|
8
|
-
const { text } = useTheme();
|
|
7
|
+
const DetailPill = ({ label, tone = 'info' }) => {
|
|
8
|
+
const { color, radius, text, spacing } = useTheme();
|
|
9
|
+
return (_jsx(Box, { borderColor: tone === 'tag' ? color.light.border['action-low-primary'] : color.light.border['default-grey'], borderRadius: radius('full'), borderWidth: 1, style: {
|
|
10
|
+
backgroundColor: tone === 'tag' ? color.light.background['contrast-info'] : color.light.background['default-grey'],
|
|
11
|
+
paddingLeft: spacing('1W'),
|
|
12
|
+
paddingRight: spacing('1W'),
|
|
13
|
+
paddingTop: spacing('0,5V'),
|
|
14
|
+
paddingBottom: spacing('0,5V'),
|
|
15
|
+
}, children: _jsx(Typography, { style: [
|
|
16
|
+
text['Corps de texte'].XS.CapsBold,
|
|
17
|
+
{
|
|
18
|
+
color: tone === 'tag' ? color.light.text['default-info'] : color.light.text['default-grey'],
|
|
19
|
+
},
|
|
20
|
+
], children: label }) }));
|
|
21
|
+
};
|
|
22
|
+
const MetaCard = ({ label, value }) => {
|
|
23
|
+
const { color, radius, text } = useTheme();
|
|
24
|
+
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 })] }));
|
|
25
|
+
};
|
|
26
|
+
export const StoryDetailScreen = ({ story, notFoundMessage = 'Story not found.', beforeContent, }) => {
|
|
27
|
+
const { text, color, radius } = useTheme();
|
|
9
28
|
if (!story) {
|
|
10
|
-
return (_jsx(Page, { title: "Story not found", description: notFoundMessage, children: _jsx(Section, { withPaddingY: true, children: _jsx(Typography, { style: text['Corps de texte'].MD.Regular, children: notFoundMessage }) }) }));
|
|
29
|
+
return (_jsx(Page, { title: "Story not found", description: notFoundMessage, beforeContent: beforeContent, children: _jsx(Section, { withPaddingY: true, children: _jsx(Typography, { style: text['Corps de texte'].MD.Regular, children: notFoundMessage }) }) }));
|
|
11
30
|
}
|
|
12
31
|
const meta = story.default;
|
|
13
32
|
const flags = getStoryFlags(meta);
|
|
14
33
|
const examples = getStoryExamples(story);
|
|
15
34
|
const isTemplate = meta.tags.includes('Template');
|
|
16
|
-
const examplesContent = (_jsx(Box, { display: "flex", gap:
|
|
17
|
-
|
|
35
|
+
const examplesContent = (_jsx(Box, { display: "flex", gap: 24, mt: '1,5V', children: examples.map(([key, Example]) => (_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 ? (_jsx(Box, { display: "flex", gap: 6, children: _jsx(Typography, { style: text.Titres['H5 - XS'], children: key }) })) : null, _jsx(Box, { borderColor: color.light.border['default-grey'], borderWidth: 1, borderRadius: radius('md'), p: '100', style: {
|
|
36
|
+
backgroundColor: color.light.background['default-grey'],
|
|
37
|
+
minHeight: isTemplate ? 420 : undefined,
|
|
38
|
+
}, children: _jsx(Example, {}) })] }, key))) }));
|
|
39
|
+
return (_jsx(Page, { scrollable: true, title: meta.title, description: meta.description, beforeContent: beforeContent, children: _jsx(Section, { withPaddingY: true, 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: {
|
|
40
|
+
alignItems: 'flex-start',
|
|
41
|
+
flexDirection: 'row',
|
|
42
|
+
justifyContent: 'space-between',
|
|
43
|
+
}, children: [_jsxs(Box, { display: "flex", gap: 6, style: { flex: 1 }, children: [_jsx(Typography, { style: text.Titres['H3 - MD'], children: meta.title }), _jsx(Typography, { style: text['Corps de texte'].MD.Regular, 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(DetailPill, { label: tag, tone: "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(DetailPill, { label: 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(Tabs, { defaultValue: "examples", tabs: [
|
|
18
44
|
{
|
|
19
45
|
value: 'examples',
|
|
20
46
|
label: 'Examples',
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type ThemeConstantDetailScreenProps = {
|
|
2
2
|
name: string;
|
|
3
3
|
value: unknown;
|
|
4
|
+
beforeContent?: React.ReactNode;
|
|
4
5
|
};
|
|
5
|
-
export declare const ThemeConstantDetailScreen: ({ name, value }: ThemeConstantDetailScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare const ThemeConstantDetailScreen: ({ name, value, beforeContent }: ThemeConstantDetailScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
//# sourceMappingURL=ThemeConstantDetailScreen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeConstantDetailScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeConstantDetailScreen.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemeConstantDetailScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeConstantDetailScreen.tsx"],"names":[],"mappings":"AAIA,MAAM,MAAM,8BAA8B,GAAG;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,CAAC;IACf,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,yBAAyB,GAAI,gCAAgC,8BAA8B,4CAsBvG,CAAC"}
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Box, Page, Section, Typography } from '@alveole/components';
|
|
3
3
|
import { useTheme } from '@alveole/theme';
|
|
4
4
|
import { JsonBlock } from '../components/JsonBlock';
|
|
5
|
-
export const ThemeConstantDetailScreen = ({ name, value }) => {
|
|
5
|
+
export const ThemeConstantDetailScreen = ({ name, value, beforeContent }) => {
|
|
6
6
|
const { text } = useTheme();
|
|
7
7
|
const entries = typeof value === 'object' && value != null ? Object.entries(value) : [];
|
|
8
|
-
return (_jsx(Page, { scrollable: true, title: name, description: name, children: _jsx(Section, { withPaddingY: true, 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)))) }) }) }));
|
|
8
|
+
return (_jsx(Page, { scrollable: true, title: name, description: name, beforeContent: beforeContent, children: _jsx(Section, { withPaddingY: true, 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
9
|
};
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
export type ThemeConstantsScreenProps = {
|
|
2
3
|
constants: Record<string, unknown>;
|
|
3
4
|
title?: string;
|
|
4
5
|
description?: string;
|
|
6
|
+
beforeContent?: React.ReactNode;
|
|
5
7
|
onSelectConstant?: (entry: {
|
|
6
8
|
name: string;
|
|
7
9
|
value: unknown;
|
|
8
10
|
}) => void;
|
|
9
11
|
};
|
|
10
|
-
export declare const ThemeConstantsScreen: ({ constants, title, description, onSelectConstant, }: ThemeConstantsScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare const ThemeConstantsScreen: ({ constants, title, description, beforeContent, onSelectConstant, }: ThemeConstantsScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
13
|
//# sourceMappingURL=ThemeConstantsScreen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemeConstantsScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeConstantsScreen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ThemeConstantsScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemeConstantsScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,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,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,qEAMlC,yBAAyB,4CAgC3B,CAAC"}
|
|
@@ -3,12 +3,12 @@ import { Box, Card, Page, Section, 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
|
-
export const ThemeConstantsScreen = ({ constants, title = 'UI Kit - Constants', description = 'Theme constants', onSelectConstant, }) => {
|
|
6
|
+
export const ThemeConstantsScreen = ({ constants, title = 'UI Kit - Constants', description = 'Theme constants', beforeContent, onSelectConstant, }) => {
|
|
7
7
|
const { text } = useTheme();
|
|
8
8
|
const { width } = useWindowDimensions();
|
|
9
9
|
const columns = width >= 1200 ? 3 : width >= 768 ? 2 : 1;
|
|
10
10
|
const entries = React.useMemo(() => Object.entries(constants)
|
|
11
11
|
.filter(([, value]) => typeof value === 'object' && value != null)
|
|
12
12
|
.sort((left, right) => left[0].localeCompare(right[0])), [constants]);
|
|
13
|
-
return (_jsx(Page, { scrollable: true, title: title, description: description, children: _jsx(Section, { withPaddingY: true, 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(
|
|
13
|
+
return (_jsx(Page, { scrollable: true, title: title, description: description, beforeContent: beforeContent, children: _jsx(Section, { withPaddingY: true, 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))) }) }) }));
|
|
14
14
|
};
|
|
@@ -6,7 +6,8 @@ export type ThemePaletteScreenProps = {
|
|
|
6
6
|
palette: Record<string, PaletteValue>;
|
|
7
7
|
title?: string;
|
|
8
8
|
description?: string;
|
|
9
|
+
beforeContent?: React.ReactNode;
|
|
9
10
|
};
|
|
10
|
-
export declare const ThemePaletteScreen: ({ palette, title, description, }: ThemePaletteScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const ThemePaletteScreen: ({ palette, title, description, beforeContent, }: ThemePaletteScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
12
|
export {};
|
|
12
13
|
//# sourceMappingURL=ThemePaletteScreen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThemePaletteScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemePaletteScreen.tsx"],"names":[],"mappings":"AAKA,UAAU,YAAY;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC7B;AAED,KAAK,YAAY,GAAG,MAAM,GAAG,YAAY,CAAC;AAmB1C,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ThemePaletteScreen.d.ts","sourceRoot":"","sources":["../../src/screens/ThemePaletteScreen.tsx"],"names":[],"mappings":"AAKA,UAAU,YAAY;IACpB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,CAAC;CAC7B;AAED,KAAK,YAAY,GAAG,MAAM,GAAG,YAAY,CAAC;AAmB1C,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,iDAKhC,uBAAuB,4CAuBzB,CAAC"}
|
|
@@ -9,9 +9,9 @@ const PaletteValueView = ({ label, value }) => {
|
|
|
9
9
|
? Object.entries(value).map(([childLabel, childValue]) => (_jsx(PaletteValueView, { label: childLabel, value: childValue }, childLabel)))
|
|
10
10
|
: null] }));
|
|
11
11
|
};
|
|
12
|
-
export const ThemePaletteScreen = ({ palette, title = 'UI Kit - Theme colors', description = 'Theme palette', }) => {
|
|
12
|
+
export const ThemePaletteScreen = ({ palette, title = 'UI Kit - Theme colors', description = 'Theme palette', beforeContent, }) => {
|
|
13
13
|
const { text } = useTheme();
|
|
14
14
|
const { width } = useWindowDimensions();
|
|
15
15
|
const columns = width >= 1200 ? 3 : width >= 768 ? 2 : 1;
|
|
16
|
-
return (_jsx(Page, { scrollable: true, title: title, description: description, children: _jsx(Section, { withPaddingY: true, children: _jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 16, children: Object.entries(palette).map(([key, value]) => (_jsx(Box, { width: columns === 1 ? '100%' : columns === 2 ? '48%' : '31%', children: _jsx(Card, { children: _jsxs(
|
|
16
|
+
return (_jsx(Page, { scrollable: true, title: title, description: description, beforeContent: beforeContent, children: _jsx(Section, { withPaddingY: true, children: _jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 16, children: Object.entries(palette).map(([key, value]) => (_jsx(Box, { width: columns === 1 ? '100%' : columns === 2 ? '48%' : '31%', children: _jsx(Card, { children: _jsxs(Box, { display: "flex", gap: 16, p: '100', children: [_jsx(Typography, { style: text.Titres['H5 - XS'], children: key }), _jsx(PaletteValueView, { value: value })] }) }) }, key))) }) }) }));
|
|
17
17
|
};
|
|
@@ -2,6 +2,7 @@ export type ThemeTypographyScreenProps = {
|
|
|
2
2
|
typography: Record<string, unknown>;
|
|
3
3
|
title?: string;
|
|
4
4
|
description?: string;
|
|
5
|
+
beforeContent?: React.ReactNode;
|
|
5
6
|
};
|
|
6
|
-
export declare const ThemeTypographyScreen: ({ typography, title, description, }: ThemeTypographyScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export declare const ThemeTypographyScreen: ({ typography, title, description, beforeContent, }: ThemeTypographyScreenProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
//# 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;
|
|
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;CACjC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,oDAKnC,0BAA0B,4CAgC5B,CAAC"}
|
|
@@ -3,9 +3,9 @@ import { Box, Card, Page, Section, Typography } from '@alveole/components';
|
|
|
3
3
|
import { useTheme } from '@alveole/theme';
|
|
4
4
|
import { useWindowDimensions } from 'react-native';
|
|
5
5
|
import { JsonBlock } from '../components/JsonBlock';
|
|
6
|
-
export const ThemeTypographyScreen = ({ typography, title = 'UI Kit - Theme typography', description = 'Theme text styles', }) => {
|
|
6
|
+
export const ThemeTypographyScreen = ({ typography, title = 'UI Kit - Theme typography', description = 'Theme text styles', beforeContent, }) => {
|
|
7
7
|
const { text } = useTheme();
|
|
8
8
|
const { width } = useWindowDimensions();
|
|
9
9
|
const columns = width >= 1200 ? 3 : width >= 768 ? 2 : 1;
|
|
10
|
-
return (_jsx(Page, { scrollable: true, title: title, description: description, children: _jsx(Section, { withPaddingY: true, children: _jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 16, children: Object.entries(typography).map(([key, value]) => (_jsx(Box, { width: columns === 1 ? '100%' : columns === 2 ? '48%' : '31%', children: _jsx(Card, { children: _jsxs(
|
|
10
|
+
return (_jsx(Page, { scrollable: true, title: title, description: description, beforeContent: beforeContent, children: _jsx(Section, { withPaddingY: true, children: _jsx(Box, { display: "flex", flexDirection: "row", flexWrap: "wrap", gap: 16, children: Object.entries(typography).map(([key, value]) => (_jsx(Box, { width: columns === 1 ? '100%' : columns === 2 ? '48%' : '31%', children: _jsx(Card, { children: _jsxs(Box, { display: "flex", gap: 16, p: '100', children: [_jsx(Typography, { style: text.Titres['H5 - XS'], children: key }), typeof value === 'object' && value != null ? (Object.entries(value).map(([subKey, subValue]) => (_jsxs(Box, { display: "flex", gap: 8, children: [_jsx(Typography, { style: text['Corps de texte'].XS.SemiBold, children: subKey }), _jsx(JsonBlock, { value: subValue })] }, subKey)))) : (_jsx(JsonBlock, { value: value }))] }) }) }, key))) }) }) }));
|
|
11
11
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -1,22 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type StorybookTag =
|
|
3
|
-
export type StorybookMeta =
|
|
4
|
-
|
|
5
|
-
tags: readonly StorybookTag[];
|
|
6
|
-
experimental: boolean;
|
|
7
|
-
figmaURL?: string;
|
|
8
|
-
mobileOnly?: boolean;
|
|
9
|
-
webOnly?: boolean;
|
|
10
|
-
description: string;
|
|
11
|
-
component?: React.ComponentType<any>;
|
|
12
|
-
config?: object;
|
|
13
|
-
props?: unknown;
|
|
14
|
-
styleFn: () => string | object;
|
|
15
|
-
};
|
|
16
|
-
export type StorybookExample = React.ComponentType<any>;
|
|
17
|
-
export type StorybookModule<TMeta extends StorybookMeta = StorybookMeta> = {
|
|
18
|
-
default: TMeta;
|
|
19
|
-
} & Record<string, StorybookExample | TMeta>;
|
|
1
|
+
import type { Story, StoryModule, StoryTag } from '@alveole/components';
|
|
2
|
+
export type StorybookTag = StoryTag;
|
|
3
|
+
export type StorybookMeta = Story;
|
|
4
|
+
export type StorybookModule<TMeta extends StorybookMeta = StorybookMeta> = StoryModule<TMeta>;
|
|
20
5
|
export type StorybookFlagKey = 'figma' | 'experimental' | 'props' | 'webOnly' | 'mobileOnly';
|
|
21
6
|
export type StorybookFlag = {
|
|
22
7
|
key: StorybookFlagKey;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;AAEpC,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC;AAElC,MAAM,MAAM,eAAe,CAAC,KAAK,SAAS,aAAa,GAAG,aAAa,IAAI,WAAW,CAAC,KAAK,CAAC,CAAC;AAE9F,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,cAAc,GAAG,OAAO,GAAG,SAAS,GAAG,YAAY,CAAC;AAE7F,MAAM,MAAM,aAAa,GAAG;IAC1B,GAAG,EAAE,gBAAgB,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
package/dist/utils.d.ts
CHANGED
|
@@ -11,4 +11,7 @@ export declare const filterStories: (params: {
|
|
|
11
11
|
export declare const sortStoriesByTitle: (stories: StorybookModule[]) => StorybookModule[];
|
|
12
12
|
export declare const groupStoriesByTag: (stories: StorybookModule[], tags: string[]) => (readonly [string, StorybookModule[]])[];
|
|
13
13
|
export declare const getStoryExamples: (story: StorybookModule) => [string, Exclude<StorybookModule[keyof StorybookModule], StorybookMeta>][];
|
|
14
|
+
export declare const toStoryModules: (stories: Record<string, unknown>) => StorybookModule[];
|
|
15
|
+
export declare const findStoryByTitle: (stories: StorybookModule[], title: string | undefined | null) => StorybookModule | null;
|
|
16
|
+
export declare const findConstantByName: (constants: Record<string, unknown>, name: string | undefined | null) => [string, unknown] | null;
|
|
14
17
|
//# sourceMappingURL=utils.d.ts.map
|
package/dist/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAUxE,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,WAIP,CAAC;AAErC,eAAO,MAAM,aAAa,GAAI,MAAM,aAAa,KAAG,aAAa,EAC+B,CAAC;AAEjG,eAAO,MAAM,eAAe,GAAI,SAAS,eAAe,EAAE,KAAG,MAAM,EAOlE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ;IACpC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;CAC3C,sBAoBA,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,SAAS,eAAe,EAAE,sBAC8B,CAAC;AAE5F,eAAO,MAAM,iBAAiB,GAAI,SAAS,eAAe,EAAE,EAAE,MAAM,MAAM,EAAE,6CAGd,CAAC;AAE/D,eAAO,MAAM,gBAAgB,GAAI,OAAO,eAAe,KAC+C,CAClG,MAAM,EACN,OAAO,CAAC,eAAe,CAAC,MAAM,eAAe,CAAC,EAAE,aAAa,CAAC,CAC/D,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAUxE,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,WAIP,CAAC;AAErC,eAAO,MAAM,aAAa,GAAI,MAAM,aAAa,KAAG,aAAa,EAC+B,CAAC;AAEjG,eAAO,MAAM,eAAe,GAAI,SAAS,eAAe,EAAE,KAAG,MAAM,EAOlE,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,QAAQ;IACpC,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,YAAY,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;CAC3C,sBAoBA,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,SAAS,eAAe,EAAE,sBAC8B,CAAC;AAE5F,eAAO,MAAM,iBAAiB,GAAI,SAAS,eAAe,EAAE,EAAE,MAAM,MAAM,EAAE,6CAGd,CAAC;AAE/D,eAAO,MAAM,gBAAgB,GAAI,OAAO,eAAe,KAC+C,CAClG,MAAM,EACN,OAAO,CAAC,eAAe,CAAC,MAAM,eAAe,CAAC,EAAE,aAAa,CAAC,CAC/D,EAAE,CAAC;AAEN,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAA+B,eAAe,EAAE,CAAC;AAEhH,eAAO,MAAM,gBAAgB,GAAI,SAAS,eAAe,EAAE,EAAE,OAAO,MAAM,GAAG,SAAS,GAAG,IAAI,2BAC/B,CAAC;AAE/D,eAAO,MAAM,kBAAkB,GAAI,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,GAAG,IAAI,6BACrC,CAAC"}
|
package/dist/utils.js
CHANGED
|
@@ -43,3 +43,6 @@ export const groupStoriesByTag = (stories, tags) => tags
|
|
|
43
43
|
.map(tag => [tag, stories.filter(story => story.default.tags.includes(tag))])
|
|
44
44
|
.filter(([, groupedStories]) => groupedStories.length > 0);
|
|
45
45
|
export const getStoryExamples = (story) => Object.entries(story).filter(([key, value]) => key !== 'default' && typeof value === 'function');
|
|
46
|
+
export const toStoryModules = (stories) => Object.values(stories);
|
|
47
|
+
export const findStoryByTitle = (stories, title) => stories.find(story => story.default.title === title) ?? null;
|
|
48
|
+
export const findConstantByName = (constants, name) => Object.entries(constants).find(([key]) => key === name) ?? null;
|