@alveole/storybook 0.36.1 → 0.37.2

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.
@@ -1,5 +1,7 @@
1
+ import { HighlightProps } from '@alveole/components';
1
2
  export type JsonBlockProps = {
2
3
  value: unknown;
4
+ language?: HighlightProps['language'];
3
5
  };
4
- export declare const JsonBlock: ({ value }: JsonBlockProps) => import("react/jsx-runtime").JSX.Element;
6
+ export declare const JsonBlock: ({ value, language }: JsonBlockProps) => import("react/jsx-runtime").JSX.Element;
5
7
  //# sourceMappingURL=JsonBlock.d.ts.map
@@ -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,4CA0BlD,CAAC"}
1
+ {"version":3,"file":"JsonBlock.d.ts","sourceRoot":"","sources":["../../src/components/JsonBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,OAAO,CAAC;IACf,QAAQ,CAAC,EAAE,cAAc,CAAC,UAAU,CAAC,CAAC;CACvC,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,qBAA8B,cAAc,4CAMrE,CAAC"}
@@ -1,13 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Box, Typography } from '@alveole/components';
3
- import { useTheme } from '@alveole/theme';
4
- export const JsonBlock = ({ value }) => {
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', mt: '1,5V', width: '100%', children: _jsx(Typography, { style: [
7
- text['Corps de texte'].SM.Regular,
8
- {
9
- fontFamily: 'monospace',
10
- whiteSpace: 'pre-wrap',
11
- },
12
- ], children: typeof value === 'string' ? value : JSON.stringify(value, null, 2) }) }));
2
+ import { Box, Highlight } from '@alveole/components';
3
+ export const JsonBlock = ({ value, language = 'json' }) => {
4
+ return (_jsx(Box, { mt: '1,5V', width: '100%', children: _jsx(Highlight, { language: language, children: typeof value === 'string' ? value : JSON.stringify(value, null, 2) }) }));
13
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"StoryDetailScreen.d.ts","sourceRoot":"","sources":["../../src/screens/StoryDetailScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,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;AAyJF,eAAO,MAAM,iBAAiB,GAAI,4CAI/B,sBAAsB,4CAsJxB,CAAC"}
1
+ {"version":3,"file":"StoryDetailScreen.d.ts","sourceRoot":"","sources":["../../src/screens/StoryDetailScreen.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,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;AAiIF,eAAO,MAAM,iBAAiB,GAAI,4CAI/B,sBAAsB,4CAwJxB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Button, Page, Section, Typography } from '@alveole/components';
2
+ import { Box, Button, Divider, Page, Section, Typography } from '@alveole/components';
3
3
  import { useTheme } from '@alveole/theme';
4
4
  import React from 'react';
5
5
  import { Linking, ScrollView } from 'react-native';
@@ -35,10 +35,6 @@ const getStoryExampleSource = (story, exampleName) => {
35
35
  }
36
36
  return null;
37
37
  };
38
- const SourceAccordion = ({ source }) => {
39
- const [isOpen, setIsOpen] = React.useState(false);
40
- return (_jsxs(Box, { display: "flex", gap: 8, children: [_jsx(Box, { style: { alignItems: 'flex-start' }, children: _jsx(Button, { title: isOpen ? 'Masquer le code source' : 'Afficher le code source', size: "sm", variant: "secondary", endIcon: isOpen ? 'ChevronUp' : 'ChevronDown', onPress: () => setIsOpen(value => !value) }) }), isOpen ? _jsx(JsonBlock, { value: source }) : null] }));
41
- };
42
38
  const DetailTabs = ({ tabs, defaultValue }) => {
43
39
  const initialValue = defaultValue || tabs[0]?.value || '';
44
40
  const [activeValue, setActiveValue] = React.useState(initialValue);
@@ -59,7 +55,7 @@ export const StoryDetailScreen = ({ story, notFoundMessage = 'Story not found.',
59
55
  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 ? (_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: {
60
56
  backgroundColor: color.light.background['default-grey'],
61
57
  minHeight: isTemplate ? 420 : undefined,
62
- }, children: _jsx(Example, {}) }), source ? _jsx(SourceAccordion, { source: source }) : null] }, key));
58
+ }, children: _jsx(Example, {}) }), _jsx(Divider, { mt: "1W", mb: "1,5V" }), source ? _jsx(JsonBlock, { language: "tsx", value: source }) : null] }, key));
63
59
  }) }));
64
60
  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: {
65
61
  alignItems: 'flex-start',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alveole/storybook",
3
- "version": "0.36.1",
3
+ "version": "0.37.2",
4
4
  "description": "Catalog screens and helpers for Alveole stories and theme tokens.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -27,6 +27,7 @@
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@alveole/components": "*",
30
+ "@alveole/core": "*",
30
31
  "@alveole/theme": "*",
31
32
  "react": "*",
32
33
  "react-native": "*"