@itcase/storybook-config 1.3.21 → 1.3.22

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 (36) hide show
  1. package/dist/addons/print/constants.d.ts +3 -0
  2. package/dist/addons/print/constants.js +3 -0
  3. package/dist/addons/print/manager.d.ts +1 -0
  4. package/dist/addons/print/manager.js +43 -0
  5. package/dist/addons/print/preview.d.ts +1 -0
  6. package/dist/addons/print/preview.js +1 -0
  7. package/dist/addons/print/print.css +13 -0
  8. package/dist/addons/variants/VariantsCanvas.d.ts +4 -0
  9. package/dist/addons/variants/VariantsCanvas.js +137 -0
  10. package/dist/addons/variants/VariantsControl.d.ts +3 -0
  11. package/dist/addons/variants/VariantsControl.js +51 -0
  12. package/dist/addons/variants/constants.d.ts +6 -0
  13. package/dist/addons/variants/constants.js +6 -0
  14. package/dist/addons/variants/manager.d.ts +1 -0
  15. package/dist/addons/variants/manager.js +117 -0
  16. package/dist/addons/variants/preview.d.ts +11 -0
  17. package/dist/addons/variants/preview.js +41 -0
  18. package/dist/addons/variants/variants.helpers.d.ts +13 -0
  19. package/dist/addons/variants/variants.helpers.js +145 -0
  20. package/dist/addons/variants/variants.interface.d.ts +42 -0
  21. package/dist/addons/variants/variants.interface.js +1 -0
  22. package/dist/cjs/decorators/withA4PaperDecorator.js +52 -0
  23. package/dist/cjs/decorators.js +2 -0
  24. package/dist/config/addons/addonPrint.d.ts +2 -0
  25. package/dist/config/addons/addonPrint.js +2 -0
  26. package/dist/config/addons/addonVariants.d.ts +2 -0
  27. package/dist/config/addons/addonVariants.js +2 -0
  28. package/dist/config/addons/withLocalAddons.js +4 -0
  29. package/dist/config/main/index.d.ts +3 -1
  30. package/dist/config/main/index.js +3 -1
  31. package/dist/decorators/index.d.ts +2 -1
  32. package/dist/decorators/index.js +2 -1
  33. package/dist/decorators/withA4PaperDecorator.d.ts +3 -0
  34. package/dist/decorators/withA4PaperDecorator.js +50 -0
  35. package/dist/decorators.js +1 -0
  36. package/package.json +53 -33
@@ -0,0 +1,3 @@
1
+ declare const PRINT_ADDON_ID = "print";
2
+ declare const PRINT_TOOL_ID = "print/tool";
3
+ export { PRINT_ADDON_ID, PRINT_TOOL_ID };
@@ -0,0 +1,3 @@
1
+ const PRINT_ADDON_ID = 'print';
2
+ const PRINT_TOOL_ID = 'print/tool';
3
+ export { PRINT_ADDON_ID, PRINT_TOOL_ID };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { PrintIcon } from '@storybook/icons';
3
+ import { Button } from 'storybook/internal/components';
4
+ import { addons, types, useGlobals } from 'storybook/manager-api';
5
+ import { PRINT_ADDON_ID, PRINT_TOOL_ID } from './constants.js';
6
+ function printViewport() {
7
+ const previewFrame = document.getElementById('storybook-preview-iframe');
8
+ if (!(previewFrame instanceof HTMLIFrameElement)) {
9
+ return;
10
+ }
11
+ const previewWindow = previewFrame.contentWindow;
12
+ if (!previewWindow) {
13
+ return;
14
+ }
15
+ previewWindow.focus();
16
+ previewWindow.print();
17
+ }
18
+ function isA4Viewport(viewport) {
19
+ if (viewport === 'a4') {
20
+ return true;
21
+ }
22
+ if (typeof viewport !== 'object' ||
23
+ viewport === null ||
24
+ !('value' in viewport)) {
25
+ return false;
26
+ }
27
+ return viewport.value === 'a4';
28
+ }
29
+ function PrintTool() {
30
+ const [globals] = useGlobals();
31
+ if (!isA4Viewport(globals.viewport)) {
32
+ return null;
33
+ }
34
+ return (_jsxs(Button, { size: "small", padding: "small", "aria-label": "Print viewport", variant: "ghost", onClick: printViewport, children: [_jsx(PrintIcon, {}), "Print"] }));
35
+ }
36
+ addons.register(PRINT_ADDON_ID, () => {
37
+ addons.add(PRINT_TOOL_ID, {
38
+ type: types.TOOL,
39
+ title: 'Print',
40
+ match: ({ viewMode }) => viewMode === 'story',
41
+ render: PrintTool,
42
+ });
43
+ });
@@ -0,0 +1 @@
1
+ import './print.css';
@@ -0,0 +1 @@
1
+ import './print.css';
@@ -0,0 +1,13 @@
1
+ /* Viewport and #storybook-root clip the iframe. Print needs the full story. */
2
+ @media print {
3
+ html,
4
+ body.sb-show-main,
5
+ #storybook-root {
6
+ height: auto !important;
7
+ min-height: 0 !important;
8
+ max-height: none !important;
9
+ background: white !important;
10
+ overflow: visible !important;
11
+ transform: none !important;
12
+ }
13
+ }
@@ -0,0 +1,4 @@
1
+ import type { VariantsPropertyListProps } from './variants.interface.js';
2
+ declare function VariantsSwitchList(props: VariantsPropertyListProps): import("react/jsx-runtime").JSX.Element;
3
+ declare function VariantsCanvas(props: VariantsPropertyListProps): import("react/jsx-runtime").JSX.Element;
4
+ export { VariantsCanvas, VariantsSwitchList };
@@ -0,0 +1,137 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { ChevronSmallDownIcon } from '@storybook/icons';
4
+ import { Badge } from 'storybook/internal/components';
5
+ import { ensure, styled, ThemeProvider, themes } from 'storybook/theming';
6
+ import { findVariant, getPropertyControl, getPropertyNames, getPropertyOptions, getPropertyValue, } from './variants.helpers.js';
7
+ const theme = ensure(themes.light);
8
+ const Panel = styled.div(({ theme: storybookTheme }) => ({
9
+ width: 280,
10
+ flexDirection: 'column',
11
+ border: `1px solid ${storybookTheme.appBorderColor}`,
12
+ borderRadius: storybookTheme.appBorderRadius,
13
+ overflow: 'hidden',
14
+ display: 'flex',
15
+ background: storybookTheme.background.content,
16
+ }));
17
+ const Header = styled.button(({ theme: storybookTheme }) => ({
18
+ width: '100%',
19
+ minHeight: 32,
20
+ justifyContent: 'space-between',
21
+ alignItems: 'center',
22
+ border: 0,
23
+ padding: '0 12px',
24
+ gap: 8,
25
+ color: storybookTheme.color.defaultText,
26
+ fontSize: storybookTheme.typography.size.s2,
27
+ fontWeight: storybookTheme.typography.weight.bold,
28
+ display: 'flex',
29
+ cursor: 'pointer',
30
+ background: storybookTheme.background.app,
31
+ }));
32
+ const HeaderTitle = styled.span({
33
+ alignItems: 'center',
34
+ gap: 8,
35
+ display: 'flex',
36
+ });
37
+ const Chevron = styled(ChevronSmallDownIcon)(({ theme: storybookTheme }) => ({
38
+ color: storybookTheme.color.mediumdark,
39
+ }));
40
+ const bodyStyle = {
41
+ flexDirection: 'column',
42
+ padding: '8px 16px',
43
+ display: 'flex',
44
+ };
45
+ const rowStyle = {
46
+ minHeight: 40,
47
+ justifyContent: 'space-between',
48
+ alignItems: 'center',
49
+ padding: '0 4px',
50
+ gap: 16,
51
+ display: 'flex',
52
+ };
53
+ const labelStyle = {
54
+ color: '#2c2c2c',
55
+ font: '400 13px/20px "Inter", "Nunito Sans", sans-serif',
56
+ };
57
+ const selectStyle = {
58
+ width: 148,
59
+ height: 32,
60
+ border: '1px solid #e6e6e6',
61
+ borderRadius: 6,
62
+ padding: '0 8px',
63
+ color: '#2c2c2c',
64
+ font: '400 13px/20px "Inter", "Nunito Sans", sans-serif',
65
+ background: '#ffffff',
66
+ };
67
+ function getChevronStyle(isOpen) {
68
+ return {
69
+ transform: isOpen ? 'rotate(0deg)' : 'rotate(-90deg)',
70
+ };
71
+ }
72
+ function getSwitchTrackStyle(isChecked) {
73
+ return {
74
+ width: 40,
75
+ height: 22,
76
+ flexShrink: 0,
77
+ position: 'relative',
78
+ border: 0,
79
+ borderRadius: 11,
80
+ padding: 0,
81
+ cursor: 'pointer',
82
+ background: isChecked ? '#0d99ff' : '#e6e6e6',
83
+ };
84
+ }
85
+ function getSwitchKnobStyle(isChecked) {
86
+ return {
87
+ width: 18,
88
+ height: 18,
89
+ position: 'absolute',
90
+ top: 2,
91
+ left: isChecked ? 20 : 2,
92
+ borderRadius: 9,
93
+ background: '#ffffff',
94
+ boxShadow: '0 1px 2px rgba(0, 0, 0, 0.2)',
95
+ };
96
+ }
97
+ function formatLabel(value) {
98
+ if (!value) {
99
+ return value;
100
+ }
101
+ return value.charAt(0).toUpperCase() + value.slice(1);
102
+ }
103
+ function VariantSwitch(props) {
104
+ const { checked, onToggle } = props;
105
+ return (_jsx("button", { type: "button", "aria-checked": checked, role: "switch", style: getSwitchTrackStyle(checked), onClick: onToggle, children: _jsx("span", { style: getSwitchKnobStyle(checked) }) }));
106
+ }
107
+ function VariantsSwitchList(props) {
108
+ const { selectedProperties, variants, onChange } = props;
109
+ const selectedVariant = findVariant(variants, selectedProperties);
110
+ const propertyNames = getPropertyNames(variants);
111
+ return (_jsx("div", { style: bodyStyle, children: propertyNames.map((propertyName) => {
112
+ const options = getPropertyOptions(variants, propertyName);
113
+ const control = getPropertyControl(variants, propertyName, options);
114
+ const value = getPropertyValue(selectedVariant, propertyName) ?? options[0];
115
+ if (control === 'switch') {
116
+ return options.map((option) => {
117
+ const isChecked = value === option;
118
+ return (_jsxs("div", { style: rowStyle, children: [_jsx("span", { style: labelStyle, children: formatLabel(option) }), _jsx(VariantSwitch, { checked: isChecked, onToggle: () => {
119
+ if (!isChecked) {
120
+ onChange(propertyName, option);
121
+ }
122
+ } })] }, `${propertyName}-${option}`));
123
+ });
124
+ }
125
+ return (_jsxs("div", { style: rowStyle, children: [_jsx("span", { style: labelStyle, children: formatLabel(propertyName) }), _jsx("select", { style: selectStyle, value: value, onChange: (event) => {
126
+ onChange(propertyName, event.currentTarget.value);
127
+ }, children: options.map((option) => (_jsx("option", { value: option, children: option }, option))) })] }, propertyName));
128
+ }) }));
129
+ }
130
+ function VariantsCanvas(props) {
131
+ const { variants } = props;
132
+ const [isOpen, setIsOpen] = useState(true);
133
+ return (_jsx(ThemeProvider, { theme: theme, children: _jsxs(Panel, { children: [_jsxs(Header, { type: "button", "aria-expanded": isOpen, onClick: () => {
134
+ setIsOpen((open) => !open);
135
+ }, children: [_jsxs(HeaderTitle, { children: ["Variants", _jsx(Badge, { status: "active", compact: true, children: variants.length })] }), _jsx(Chevron, { style: getChevronStyle(isOpen) })] }), isOpen && _jsx(VariantsSwitchList, { ...props })] }) }));
136
+ }
137
+ export { VariantsCanvas, VariantsSwitchList };
@@ -0,0 +1,3 @@
1
+ import type { VariantsPropertyListProps } from './variants.interface.js';
2
+ declare function VariantsPropertyList(props: VariantsPropertyListProps): import("react/jsx-runtime").JSX.Element;
3
+ export { VariantsPropertyList };
@@ -0,0 +1,51 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BooleanControl, OptionsControl } from '@storybook/addon-docs/blocks';
3
+ import { ensure, ThemeProvider, themes } from 'storybook/theming';
4
+ import { findVariant, getPropertyControl, getPropertyNames, getPropertyOptions, getPropertyValue, } from './variants.helpers.js';
5
+ const listStyle = {
6
+ width: '100%',
7
+ flexDirection: 'column',
8
+ gap: 8,
9
+ display: 'flex',
10
+ };
11
+ const rowStyle = {
12
+ minHeight: 32,
13
+ justifyContent: 'start',
14
+ alignItems: 'center',
15
+ gap: 16,
16
+ display: 'grid',
17
+ gridTemplateColumns: '25% auto',
18
+ };
19
+ function formatLabel(value) {
20
+ if (!value) {
21
+ return value;
22
+ }
23
+ return value.charAt(0).toUpperCase() + value.slice(1);
24
+ }
25
+ function VariantsPropertyList(props) {
26
+ const { selectedProperties, variants, onChange } = props;
27
+ const selectedVariant = findVariant(variants, selectedProperties);
28
+ const propertyNames = getPropertyNames(variants);
29
+ return (_jsx(ThemeProvider, { theme: ensure(themes.light), children: _jsx("div", { style: listStyle, children: propertyNames.map((propertyName) => {
30
+ const options = getPropertyOptions(variants, propertyName);
31
+ const control = getPropertyControl(variants, propertyName, options);
32
+ const value = getPropertyValue(selectedVariant, propertyName) ?? options[0];
33
+ if (control === 'switch') {
34
+ return options.map((option) => {
35
+ const isChecked = value === option;
36
+ return (_jsxs("div", { style: rowStyle, children: [_jsx("span", { children: formatLabel(option) }), _jsx(BooleanControl, { name: `${propertyName}-${option}`, value: isChecked, onChange: (nextValue) => {
37
+ if (nextValue) {
38
+ onChange(propertyName, option);
39
+ }
40
+ } })] }, `${propertyName}-${option}`));
41
+ });
42
+ }
43
+ return (_jsxs("div", { style: rowStyle, children: [_jsx("span", { children: formatLabel(propertyName) }), _jsx(OptionsControl, { type: control === 'radio' ? 'radio' : 'select', name: propertyName, argType: { options: options }, value: value, onChange: (nextValue) => {
44
+ if (nextValue == null) {
45
+ return;
46
+ }
47
+ onChange(propertyName, String(nextValue));
48
+ } })] }, propertyName));
49
+ }) }) }));
50
+ }
51
+ export { VariantsPropertyList };
@@ -0,0 +1,6 @@
1
+ declare const VARIANTS_ADDON_ID = "variants";
2
+ declare const VARIANTS_GLOBAL_KEY = "variants";
3
+ declare const VARIANTS_PANEL_ID = "variants/panel";
4
+ declare const VARIANTS_PARAMETER_KEY = "variants";
5
+ declare const VARIANTS_TOOL_ID = "variants/tool";
6
+ export { VARIANTS_ADDON_ID, VARIANTS_GLOBAL_KEY, VARIANTS_PANEL_ID, VARIANTS_PARAMETER_KEY, VARIANTS_TOOL_ID, };
@@ -0,0 +1,6 @@
1
+ const VARIANTS_ADDON_ID = 'variants';
2
+ const VARIANTS_GLOBAL_KEY = 'variants';
3
+ const VARIANTS_PANEL_ID = 'variants/panel';
4
+ const VARIANTS_PARAMETER_KEY = 'variants';
5
+ const VARIANTS_TOOL_ID = 'variants/tool';
6
+ export { VARIANTS_ADDON_ID, VARIANTS_GLOBAL_KEY, VARIANTS_PANEL_ID, VARIANTS_PARAMETER_KEY, VARIANTS_TOOL_ID, };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,117 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ControlsIcon } from '@storybook/icons';
3
+ import { AddonPanel, Badge, Button, Placeholder, WithTooltip, } from 'storybook/internal/components';
4
+ import { addons, types, useArgs, useGlobals, useParameter, useStorybookApi, useStorybookState, } from 'storybook/manager-api';
5
+ import { VARIANTS_ADDON_ID, VARIANTS_GLOBAL_KEY, VARIANTS_PANEL_ID, VARIANTS_PARAMETER_KEY, VARIANTS_TOOL_ID, } from './constants.js';
6
+ import { findVariant, getSelectedProperties, isStoryVariantList, replacePropertyValue, } from './variants.helpers.js';
7
+ import { VariantsSwitchList } from './VariantsCanvas.js';
8
+ import { VariantsPropertyList } from './VariantsControl.js';
9
+ function useVariantsState() {
10
+ const variants = useParameter(VARIANTS_PARAMETER_KEY, []);
11
+ const [args] = useArgs();
12
+ const [globals, updateGlobals] = useGlobals();
13
+ const state = useStorybookState();
14
+ const storyId = state.storyId;
15
+ const hasVariants = isStoryVariantList(variants) && variants.length > 0 && Boolean(storyId);
16
+ const selectedProperties = hasVariants
17
+ ? getSelectedProperties({
18
+ args: args,
19
+ globalValue: globals[VARIANTS_GLOBAL_KEY],
20
+ storyId: storyId,
21
+ variants: variants,
22
+ })
23
+ : [];
24
+ const selectedVariant = hasVariants
25
+ ? findVariant(variants, selectedProperties)
26
+ : undefined;
27
+ function selectProperties(properties) {
28
+ if (!storyId) {
29
+ return;
30
+ }
31
+ updateGlobals({
32
+ [VARIANTS_GLOBAL_KEY]: {
33
+ properties: properties,
34
+ storyId: storyId,
35
+ },
36
+ });
37
+ }
38
+ return {
39
+ hasVariants: hasVariants,
40
+ selectedProperties: selectedProperties,
41
+ selectedVariant: selectedVariant,
42
+ selectProperties: selectProperties,
43
+ variants: hasVariants ? variants : [],
44
+ };
45
+ }
46
+ function VariantsControls() {
47
+ const { selectedProperties, selectedVariant, selectProperties, variants } = useVariantsState();
48
+ if (!selectedVariant) {
49
+ return null;
50
+ }
51
+ return (_jsx(VariantsPropertyList, { selectedProperties: selectedProperties, variants: variants, onChange: (propertyName, nextValue) => {
52
+ const nextProperties = replacePropertyValue(selectedVariant.properties, propertyName, nextValue);
53
+ const nextVariant = findVariant(variants, nextProperties);
54
+ selectProperties(nextVariant.properties);
55
+ } }));
56
+ }
57
+ const panelStyle = {
58
+ justifyContent: 'center',
59
+ padding: 16,
60
+ display: 'flex',
61
+ };
62
+ const panelInnerStyle = {
63
+ width: '100%',
64
+ maxWidth: 360,
65
+ };
66
+ const titleStyle = {
67
+ alignItems: 'center',
68
+ gap: 6,
69
+ display: 'flex',
70
+ };
71
+ const tooltipStyle = {
72
+ width: 280,
73
+ padding: '4px 8px',
74
+ };
75
+ function VariantsPanel() {
76
+ const { hasVariants } = useVariantsState();
77
+ if (!hasVariants) {
78
+ return _jsx(Placeholder, { children: "No variants for this story" });
79
+ }
80
+ return (_jsx("div", { style: panelStyle, children: _jsx("div", { style: panelInnerStyle, children: _jsx(VariantsControls, {}) }) }));
81
+ }
82
+ function VariantsPanelTitle() {
83
+ const api = useStorybookApi();
84
+ const variants = useParameter(VARIANTS_PARAMETER_KEY, []);
85
+ const variantsCount = isStoryVariantList(variants) ? variants.length : 0;
86
+ const isSelected = api.getSelectedPanel() === VARIANTS_PANEL_ID;
87
+ return (_jsxs("div", { style: titleStyle, children: [_jsx("span", { children: "Variants" }), variantsCount > 0 && (_jsx(Badge, { status: isSelected ? 'active' : 'neutral', compact: true, children: variantsCount }))] }));
88
+ }
89
+ function VariantsTool() {
90
+ const { hasVariants, selectedProperties, selectedVariant, selectProperties, variants, } = useVariantsState();
91
+ if (!hasVariants || !selectedVariant) {
92
+ return null;
93
+ }
94
+ return (_jsx(WithTooltip, { placement: "bottom-end", tooltip: _jsx("div", { style: tooltipStyle, children: _jsx(VariantsSwitchList, { selectedProperties: selectedProperties, variants: variants, onChange: (propertyName, nextValue) => {
95
+ const nextProperties = replacePropertyValue(selectedVariant.properties, propertyName, nextValue);
96
+ const nextVariant = findVariant(variants, nextProperties);
97
+ selectProperties(nextVariant.properties);
98
+ } }) }), trigger: "click", closeOnOutsideClick: true, children: _jsxs(Button, { size: "small", padding: "small", "aria-label": "Variants", variant: "ghost", children: [_jsx(ControlsIcon, {}), "Variants", _jsx(Badge, { status: "neutral", compact: true, children: variants.length })] }) }));
99
+ }
100
+ function VariantsPanelContainer(props) {
101
+ const { active = false } = props;
102
+ return (_jsx(AddonPanel, { active: active, children: _jsx(VariantsPanel, {}) }));
103
+ }
104
+ addons.register(VARIANTS_ADDON_ID, () => {
105
+ addons.add(VARIANTS_TOOL_ID, {
106
+ type: types.TOOL,
107
+ title: 'Variants',
108
+ match: ({ viewMode }) => viewMode === 'story',
109
+ render: VariantsTool,
110
+ });
111
+ addons.add(VARIANTS_PANEL_ID, {
112
+ type: types.PANEL,
113
+ title: VariantsPanelTitle,
114
+ match: ({ viewMode }) => viewMode === 'story',
115
+ render: VariantsPanelContainer,
116
+ });
117
+ });
@@ -0,0 +1,11 @@
1
+ import type { Decorator } from '@storybook/react';
2
+ declare const decorators: Decorator[];
3
+ declare const globalTypes: {
4
+ variants: {
5
+ defaultValue: {
6
+ properties: any[];
7
+ storyId: string;
8
+ };
9
+ };
10
+ };
11
+ export { decorators, globalTypes };
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { withA4PaperDecorator } from '../../decorators/withA4PaperDecorator.js';
3
+ import { VARIANTS_GLOBAL_KEY, VARIANTS_PARAMETER_KEY } from './constants.js';
4
+ import { findVariant, getSelectedProperties, isStoryVariantList, } from './variants.helpers.js';
5
+ const storyStyle = {
6
+ width: '100%',
7
+ };
8
+ function withVariants(Story, context) {
9
+ const variants = context.parameters[VARIANTS_PARAMETER_KEY];
10
+ if (!isStoryVariantList(variants) || variants.length === 0) {
11
+ return _jsx(Story, {});
12
+ }
13
+ if (context.viewMode === 'docs') {
14
+ return _jsx(Story, {});
15
+ }
16
+ const selectedProperties = getSelectedProperties({
17
+ args: context.args,
18
+ globalValue: context.globals[VARIANTS_GLOBAL_KEY],
19
+ storyId: context.id,
20
+ variants: variants,
21
+ });
22
+ const selectedVariant = findVariant(variants, selectedProperties);
23
+ const selectionKey = selectedProperties
24
+ .map((property) => `${property.name}:${property.value}`)
25
+ .join('|');
26
+ const story = context.originalStoryFn(selectedVariant.args, {
27
+ ...context,
28
+ args: selectedVariant.args,
29
+ });
30
+ return withA4PaperDecorator(() => (_jsx("div", { style: storyStyle, children: story }, selectionKey)), context);
31
+ }
32
+ const decorators = [withVariants];
33
+ const globalTypes = {
34
+ [VARIANTS_GLOBAL_KEY]: {
35
+ defaultValue: {
36
+ properties: [],
37
+ storyId: '',
38
+ },
39
+ },
40
+ };
41
+ export { decorators, globalTypes };
@@ -0,0 +1,13 @@
1
+ import type { GetInitialPropertiesParams, GetSelectedPropertiesParams, StoryVariant, StoryVariantControl, StoryVariantProperty, VariantsGlobal } from './variants.interface.js';
2
+ declare function isStoryVariantList(value: unknown): value is StoryVariant[];
3
+ declare function isVariantsGlobal(value: unknown): value is VariantsGlobal;
4
+ declare function getShowCanvas(globalValue: unknown): boolean;
5
+ declare function getPropertyValue(variant: StoryVariant, propertyName: string): string;
6
+ declare function getPropertyNames(variants: StoryVariant[]): string[];
7
+ declare function getPropertyControl(variants: StoryVariant[], propertyName: string, options: string[]): StoryVariantControl;
8
+ declare function getPropertyOptions(variants: StoryVariant[], propertyName: string): string[];
9
+ declare function findVariant(variants: StoryVariant[], properties: StoryVariantProperty[]): StoryVariant;
10
+ declare function getInitialProperties(params: GetInitialPropertiesParams): StoryVariantProperty[];
11
+ declare function replacePropertyValue(properties: StoryVariantProperty[], propertyName: string, propertyValue: string): StoryVariantProperty[];
12
+ declare function getSelectedProperties(params: GetSelectedPropertiesParams): StoryVariantProperty[];
13
+ export { findVariant, getInitialProperties, getPropertyControl, getPropertyNames, getPropertyOptions, getPropertyValue, getSelectedProperties, getShowCanvas, isStoryVariantList, isVariantsGlobal, replacePropertyValue, };
@@ -0,0 +1,145 @@
1
+ function isStoryVariantArgs(value) {
2
+ return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
3
+ }
4
+ function isStoryVariantProperty(value) {
5
+ if (!value || typeof value !== 'object') {
6
+ return false;
7
+ }
8
+ if (!('name' in value) || !('value' in value)) {
9
+ return false;
10
+ }
11
+ if (typeof value.name !== 'string' || typeof value.value !== 'string') {
12
+ return false;
13
+ }
14
+ if (!('control' in value) || value.control === undefined) {
15
+ return true;
16
+ }
17
+ return (value.control === 'radio' ||
18
+ value.control === 'select' ||
19
+ value.control === 'switch');
20
+ }
21
+ function isStoryVariant(value) {
22
+ if (!value || typeof value !== 'object') {
23
+ return false;
24
+ }
25
+ if (!('properties' in value) || !('args' in value)) {
26
+ return false;
27
+ }
28
+ return (Array.isArray(value.properties) &&
29
+ value.properties.every((property) => isStoryVariantProperty(property)) &&
30
+ isStoryVariantArgs(value.args));
31
+ }
32
+ function isStoryVariantList(value) {
33
+ return (Array.isArray(value) && value.every((variant) => isStoryVariant(variant)));
34
+ }
35
+ function isVariantsGlobal(value) {
36
+ if (!value || typeof value !== 'object') {
37
+ return false;
38
+ }
39
+ if (!('properties' in value) || !('storyId' in value)) {
40
+ return false;
41
+ }
42
+ return (typeof value.storyId === 'string' &&
43
+ Array.isArray(value.properties) &&
44
+ value.properties.every((property) => isStoryVariantProperty(property)));
45
+ }
46
+ function getShowCanvas(globalValue) {
47
+ if (!isVariantsGlobal(globalValue) || globalValue.showCanvas === undefined) {
48
+ return true;
49
+ }
50
+ return globalValue.showCanvas;
51
+ }
52
+ function getPropertyValue(variant, propertyName) {
53
+ return variant.properties.find((property) => property.name === propertyName)
54
+ ?.value;
55
+ }
56
+ function getPropertyNames(variants) {
57
+ return variants.reduce((names, variant) => {
58
+ return variant.properties.reduce((result, property) => {
59
+ if (result.includes(property.name)) {
60
+ return result;
61
+ }
62
+ return [...result, property.name];
63
+ }, names);
64
+ }, []);
65
+ }
66
+ function getPropertyControl(variants, propertyName, options) {
67
+ const explicitControl = variants
68
+ .flatMap((variant) => variant.properties)
69
+ .find((property) => property.name === propertyName)?.control;
70
+ if (explicitControl === 'radio' ||
71
+ explicitControl === 'select' ||
72
+ explicitControl === 'switch') {
73
+ return explicitControl;
74
+ }
75
+ if (options.length <= 2) {
76
+ return 'switch';
77
+ }
78
+ return 'radio';
79
+ }
80
+ function getPropertyOptions(variants, propertyName) {
81
+ return variants.reduce((options, variant) => {
82
+ const propertyValue = getPropertyValue(variant, propertyName);
83
+ if (!propertyValue || options.includes(propertyValue)) {
84
+ return options;
85
+ }
86
+ return [...options, propertyValue];
87
+ }, []);
88
+ }
89
+ function findVariant(variants, properties) {
90
+ return (variants.find((variant) => {
91
+ return properties.every((property) => {
92
+ return getPropertyValue(variant, property.name) === property.value;
93
+ });
94
+ }) ?? variants[0]);
95
+ }
96
+ function argsMatchVariant(args, variant) {
97
+ if (!args || !variant.args) {
98
+ return false;
99
+ }
100
+ const variantKeys = Object.keys(variant.args);
101
+ if (variantKeys.length === 0) {
102
+ return false;
103
+ }
104
+ return variantKeys.every((key) => variant.args[key] === args[key]);
105
+ }
106
+ function getInitialProperties(params) {
107
+ const { args, variants } = params;
108
+ const argsMatch = variants.find((variant) => {
109
+ return variant.args === args || argsMatchVariant(args, variant);
110
+ });
111
+ const matchedVariant = argsMatch ?? variants[0];
112
+ if (!matchedVariant) {
113
+ return [];
114
+ }
115
+ return [...matchedVariant.properties];
116
+ }
117
+ function replacePropertyValue(properties, propertyName, propertyValue) {
118
+ return properties.map((property) => {
119
+ if (property.name !== propertyName) {
120
+ return property;
121
+ }
122
+ return {
123
+ name: property.name,
124
+ value: propertyValue,
125
+ };
126
+ });
127
+ }
128
+ function propertiesBelongToVariants(variants, properties) {
129
+ const propertyNames = getPropertyNames(variants);
130
+ return properties.every((property) => propertyNames.includes(property.name));
131
+ }
132
+ function getSelectedProperties(params) {
133
+ const { args, globalValue, storyId, variants } = params;
134
+ if (isVariantsGlobal(globalValue) &&
135
+ globalValue.storyId === storyId &&
136
+ globalValue.properties.length > 0 &&
137
+ propertiesBelongToVariants(variants, globalValue.properties)) {
138
+ return findVariant(variants, globalValue.properties).properties;
139
+ }
140
+ return getInitialProperties({
141
+ args: args,
142
+ variants: variants,
143
+ });
144
+ }
145
+ export { findVariant, getInitialProperties, getPropertyControl, getPropertyNames, getPropertyOptions, getPropertyValue, getSelectedProperties, getShowCanvas, isStoryVariantList, isVariantsGlobal, replacePropertyValue, };
@@ -0,0 +1,42 @@
1
+ type StoryVariantControl = 'radio' | 'select' | 'switch';
2
+ interface StoryVariantProperty {
3
+ control?: StoryVariantControl;
4
+ name: string;
5
+ value: string;
6
+ }
7
+ type StoryVariantArgs = Record<string, unknown>;
8
+ interface StoryVariant {
9
+ args: StoryVariantArgs;
10
+ properties: StoryVariantProperty[];
11
+ }
12
+ interface VariantsGlobal {
13
+ properties: StoryVariantProperty[];
14
+ showCanvas?: boolean;
15
+ storyId: string;
16
+ }
17
+ interface GetInitialPropertiesParams {
18
+ args: StoryVariantArgs;
19
+ variants: StoryVariant[];
20
+ }
21
+ interface GetSelectedPropertiesParams {
22
+ args: StoryVariantArgs;
23
+ globalValue: unknown;
24
+ storyId: string;
25
+ variants: StoryVariant[];
26
+ }
27
+ interface VariantsPanelContainerProps {
28
+ active?: boolean;
29
+ }
30
+ interface VariantsControlProps {
31
+ onChange: (value: string) => void;
32
+ control: StoryVariantControl;
33
+ name: string;
34
+ options: string[];
35
+ value: string;
36
+ }
37
+ interface VariantsPropertyListProps {
38
+ onChange: (propertyName: string, value: string) => void;
39
+ selectedProperties: StoryVariantProperty[];
40
+ variants: StoryVariant[];
41
+ }
42
+ export type { GetInitialPropertiesParams, GetSelectedPropertiesParams, StoryVariant, StoryVariantArgs, StoryVariantControl, StoryVariantProperty, VariantsControlProps, VariantsGlobal, VariantsPanelContainerProps, VariantsPropertyListProps, };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,52 @@
1
+ 'use strict';
2
+
3
+ var React = require('react');
4
+ var jsxRuntime = require('react/jsx-runtime');
5
+
6
+ function isA4Viewport(viewport) {
7
+ if (viewport === 'a4') {
8
+ return true;
9
+ }
10
+ if (typeof viewport !== 'object' || viewport === null || !('value' in viewport)) {
11
+ return false;
12
+ }
13
+ return viewport.value === 'a4';
14
+ }
15
+ const paperStyle = {
16
+ width: '100%',
17
+ background: '#ffffff'
18
+ };
19
+ function A4Paper(props) {
20
+ const {
21
+ storyId,
22
+ viewMode,
23
+ children
24
+ } = props;
25
+ React.useLayoutEffect(() => {
26
+ const selector = viewMode === 'docs' ? `#anchor--${storyId} .docs-story` : '.sb-show-main';
27
+ const canvas = document.querySelector(selector);
28
+ if (!(canvas instanceof HTMLElement)) {
29
+ return;
30
+ }
31
+ canvas.style.setProperty('background', '#ffffff', 'important');
32
+ return () => {
33
+ canvas.style.removeProperty('background');
34
+ };
35
+ }, [storyId, viewMode]);
36
+ return /*#__PURE__*/jsxRuntime.jsx("div", {
37
+ style: paperStyle,
38
+ children: children
39
+ });
40
+ }
41
+ function withA4PaperDecorator(Story, context) {
42
+ if (!isA4Viewport(context.globals.viewport)) {
43
+ return /*#__PURE__*/jsxRuntime.jsx(Story, {});
44
+ }
45
+ return /*#__PURE__*/jsxRuntime.jsx(A4Paper, {
46
+ storyId: context.id,
47
+ viewMode: context.viewMode,
48
+ children: /*#__PURE__*/jsxRuntime.jsx(Story, {})
49
+ });
50
+ }
51
+
52
+ exports.withA4PaperDecorator = withA4PaperDecorator;
@@ -1,5 +1,6 @@
1
1
  'use strict';
2
2
 
3
+ var withA4PaperDecorator = require('./decorators/withA4PaperDecorator.js');
3
4
  var withClearStoresDecorator = require('./decorators/withClearStoresDecorator.js');
4
5
  var withExtraProviders = require('./decorators/withExtraProviders.js');
5
6
  var withFigmaSourceLink = require('./decorators/withFigmaSourceLink.js');
@@ -20,6 +21,7 @@ require('@itcase/ui-web/components/Notification');
20
21
 
21
22
 
22
23
 
24
+ exports.withA4PaperDecorator = withA4PaperDecorator.withA4PaperDecorator;
23
25
  exports.withClearStoresDecorator = withClearStoresDecorator.withClearStoresDecorator;
24
26
  exports.withExtraProviders = withExtraProviders.withExtraProviders;
25
27
  exports.withFigmaSourceLink = withFigmaSourceLink.withFigmaSourceLink;
@@ -0,0 +1,2 @@
1
+ declare const ADDON_PRINT = "@itcase/storybook-config/addons/print";
2
+ export { ADDON_PRINT };
@@ -0,0 +1,2 @@
1
+ const ADDON_PRINT = '@itcase/storybook-config/addons/print';
2
+ export { ADDON_PRINT };
@@ -0,0 +1,2 @@
1
+ declare const ADDON_VARIANTS = "@itcase/storybook-config/addons/variants";
2
+ export { ADDON_VARIANTS };
@@ -0,0 +1,2 @@
1
+ const ADDON_VARIANTS = '@itcase/storybook-config/addons/variants';
2
+ export { ADDON_VARIANTS };
@@ -1,9 +1,13 @@
1
1
  import { fileURLToPath } from 'node:url';
2
+ import { ADDON_PRINT } from './addonPrint.js';
2
3
  import { ADDON_TAG_BADGES_CONFIG } from './addonTagBadges.js';
3
4
  import { ADDON_TOUR } from './addonTour.js';
5
+ import { ADDON_VARIANTS } from './addonVariants.js';
4
6
  const LOCAL_ADDON_DIRS = {
7
+ [ADDON_PRINT]: fileURLToPath(new URL('../../addons/print/', import.meta.url)),
5
8
  [ADDON_TAG_BADGES_CONFIG]: fileURLToPath(new URL('../../addons/tag-badges/', import.meta.url)),
6
9
  [ADDON_TOUR]: fileURLToPath(new URL('../../addons/tour/', import.meta.url)),
10
+ [ADDON_VARIANTS]: fileURLToPath(new URL('../../addons/variants/', import.meta.url)),
7
11
  };
8
12
  function withLocalAddons(addons) {
9
13
  return addons.map((addon) => LOCAL_ADDON_DIRS[addon] ?? addon);
@@ -1,9 +1,11 @@
1
1
  import { ADDON_MCP } from '../addons/addonMcp.js';
2
+ import { ADDON_PRINT } from '../addons/addonPrint.js';
2
3
  import { ADDONS_NEXTJS } from '../addons/addonsNextJs.js';
3
4
  import { ADDONS_REACT_NATIVE } from '../addons/addonsReactNative.js';
4
5
  import { ADDONS_REACT_NATIVE_WEB } from '../addons/addonsReactNativeWeb.js';
5
6
  import { ADDONS_VITE } from '../addons/addonsVite.js';
6
7
  import { ADDONS_WEBPACK } from '../addons/addonsWebpack.js';
8
+ import { ADDON_VARIANTS } from '../addons/addonVariants.js';
7
9
  import { CODE } from '../code/code.js';
8
10
  import { MAIN_CONFIG_NEXTJS_VITE } from '../config/mainConfigNextJsVite.js';
9
11
  import { MAIN_CONFIG_REACT_NATIVE } from '../config/mainConfigReactNative.js';
@@ -24,4 +26,4 @@ import { STATIC_DIRS_VITE } from '../static/staticDirsVite.js';
24
26
  import { STATIC_DIRS_WEBPACK } from '../static/staticDirsWebpack.js';
25
27
  import { STATUS } from '../status/status.js';
26
28
  import { AUTHORIZATION } from '../users/authorization.js';
27
- export { ADDON_MCP, ADDONS_NEXTJS, ADDONS_REACT_NATIVE, ADDONS_REACT_NATIVE_WEB, ADDONS_VITE, ADDONS_WEBPACK, AUTHORIZATION, CODE, FRAMEWORK_NEXTJS, FRAMEWORK_NEXTJS_VITE, FRAMEWORK_REACT_NATIVE, FRAMEWORK_REACT_NATIVE_WEB, FRAMEWORK_VITE, FRAMEWORK_WEBPACK, MAIN_CONFIG_NEXTJS_VITE, MAIN_CONFIG_REACT_NATIVE, MAIN_CONFIG_REACT_NATIVE_WEB, MAIN_CONFIG_VITE, MAIN_CONFIG_WEBPACK, REFS, STATIC_DIRS_NEXTJS, STATIC_DIRS_REACT_NATIVE, STATIC_DIRS_REACT_NATIVE_WEB, STATIC_DIRS_VITE, STATIC_DIRS_WEBPACK, STATUS, };
29
+ export { ADDON_MCP, ADDON_PRINT, ADDON_VARIANTS, ADDONS_NEXTJS, ADDONS_REACT_NATIVE, ADDONS_REACT_NATIVE_WEB, ADDONS_VITE, ADDONS_WEBPACK, AUTHORIZATION, CODE, FRAMEWORK_NEXTJS, FRAMEWORK_NEXTJS_VITE, FRAMEWORK_REACT_NATIVE, FRAMEWORK_REACT_NATIVE_WEB, FRAMEWORK_VITE, FRAMEWORK_WEBPACK, MAIN_CONFIG_NEXTJS_VITE, MAIN_CONFIG_REACT_NATIVE, MAIN_CONFIG_REACT_NATIVE_WEB, MAIN_CONFIG_VITE, MAIN_CONFIG_WEBPACK, REFS, STATIC_DIRS_NEXTJS, STATIC_DIRS_REACT_NATIVE, STATIC_DIRS_REACT_NATIVE_WEB, STATIC_DIRS_VITE, STATIC_DIRS_WEBPACK, STATUS, };
@@ -1,9 +1,11 @@
1
1
  import { ADDON_MCP } from '../addons/addonMcp.js';
2
+ import { ADDON_PRINT } from '../addons/addonPrint.js';
2
3
  import { ADDONS_NEXTJS } from '../addons/addonsNextJs.js';
3
4
  import { ADDONS_REACT_NATIVE } from '../addons/addonsReactNative.js';
4
5
  import { ADDONS_REACT_NATIVE_WEB } from '../addons/addonsReactNativeWeb.js';
5
6
  import { ADDONS_VITE } from '../addons/addonsVite.js';
6
7
  import { ADDONS_WEBPACK } from '../addons/addonsWebpack.js';
8
+ import { ADDON_VARIANTS } from '../addons/addonVariants.js';
7
9
  import { CODE } from '../code/code.js';
8
10
  import { MAIN_CONFIG_NEXTJS_VITE } from '../config/mainConfigNextJsVite.js';
9
11
  import { MAIN_CONFIG_REACT_NATIVE } from '../config/mainConfigReactNative.js';
@@ -24,4 +26,4 @@ import { STATIC_DIRS_VITE } from '../static/staticDirsVite.js';
24
26
  import { STATIC_DIRS_WEBPACK } from '../static/staticDirsWebpack.js';
25
27
  import { STATUS } from '../status/status.js';
26
28
  import { AUTHORIZATION } from '../users/authorization.js';
27
- export { ADDON_MCP, ADDONS_NEXTJS, ADDONS_REACT_NATIVE, ADDONS_REACT_NATIVE_WEB, ADDONS_VITE, ADDONS_WEBPACK, AUTHORIZATION, CODE, FRAMEWORK_NEXTJS, FRAMEWORK_NEXTJS_VITE, FRAMEWORK_REACT_NATIVE, FRAMEWORK_REACT_NATIVE_WEB, FRAMEWORK_VITE, FRAMEWORK_WEBPACK, MAIN_CONFIG_NEXTJS_VITE, MAIN_CONFIG_REACT_NATIVE, MAIN_CONFIG_REACT_NATIVE_WEB, MAIN_CONFIG_VITE, MAIN_CONFIG_WEBPACK, REFS, STATIC_DIRS_NEXTJS, STATIC_DIRS_REACT_NATIVE, STATIC_DIRS_REACT_NATIVE_WEB, STATIC_DIRS_VITE, STATIC_DIRS_WEBPACK, STATUS, };
29
+ export { ADDON_MCP, ADDON_PRINT, ADDON_VARIANTS, ADDONS_NEXTJS, ADDONS_REACT_NATIVE, ADDONS_REACT_NATIVE_WEB, ADDONS_VITE, ADDONS_WEBPACK, AUTHORIZATION, CODE, FRAMEWORK_NEXTJS, FRAMEWORK_NEXTJS_VITE, FRAMEWORK_REACT_NATIVE, FRAMEWORK_REACT_NATIVE_WEB, FRAMEWORK_VITE, FRAMEWORK_WEBPACK, MAIN_CONFIG_NEXTJS_VITE, MAIN_CONFIG_REACT_NATIVE, MAIN_CONFIG_REACT_NATIVE_WEB, MAIN_CONFIG_VITE, MAIN_CONFIG_WEBPACK, REFS, STATIC_DIRS_NEXTJS, STATIC_DIRS_REACT_NATIVE, STATIC_DIRS_REACT_NATIVE_WEB, STATIC_DIRS_VITE, STATIC_DIRS_WEBPACK, STATUS, };
@@ -1,3 +1,4 @@
1
+ import { withA4PaperDecorator } from './withA4PaperDecorator';
1
2
  import { withClearStoresDecorator } from './withClearStoresDecorator';
2
3
  import { withExtraProviders } from './withExtraProviders';
3
4
  import { withFigmaSourceLink } from './withFigmaSourceLink';
@@ -5,4 +6,4 @@ import { withFormSubmitDecorator } from './withFormSubmitDecorator';
5
6
  import { withLayoutDecorator } from './withLayoutDecorator';
6
7
  import { withNextDecoratorFactory } from './withNextDecorator';
7
8
  import { withUiDecorator } from './withUiDecorator';
8
- export { withClearStoresDecorator, withExtraProviders, withFigmaSourceLink, withFormSubmitDecorator, withLayoutDecorator, withNextDecoratorFactory, withUiDecorator, };
9
+ export { withA4PaperDecorator, withClearStoresDecorator, withExtraProviders, withFigmaSourceLink, withFormSubmitDecorator, withLayoutDecorator, withNextDecoratorFactory, withUiDecorator, };
@@ -1,3 +1,4 @@
1
+ import { withA4PaperDecorator } from './withA4PaperDecorator';
1
2
  import { withClearStoresDecorator } from './withClearStoresDecorator';
2
3
  import { withExtraProviders } from './withExtraProviders';
3
4
  import { withFigmaSourceLink } from './withFigmaSourceLink';
@@ -5,4 +6,4 @@ import { withFormSubmitDecorator } from './withFormSubmitDecorator';
5
6
  import { withLayoutDecorator } from './withLayoutDecorator';
6
7
  import { withNextDecoratorFactory } from './withNextDecorator';
7
8
  import { withUiDecorator } from './withUiDecorator';
8
- export { withClearStoresDecorator, withExtraProviders, withFigmaSourceLink, withFormSubmitDecorator, withLayoutDecorator, withNextDecoratorFactory, withUiDecorator, };
9
+ export { withA4PaperDecorator, withClearStoresDecorator, withExtraProviders, withFigmaSourceLink, withFormSubmitDecorator, withLayoutDecorator, withNextDecoratorFactory, withUiDecorator, };
@@ -0,0 +1,3 @@
1
+ import type { Decorator } from '@storybook/react';
2
+ declare function withA4PaperDecorator(Story: Parameters<Decorator>[0], context: Parameters<Decorator>[1]): import("react/jsx-runtime").JSX.Element;
3
+ export { withA4PaperDecorator };
@@ -0,0 +1,50 @@
1
+ import { useLayoutEffect } from 'react';
2
+ import { jsx } from 'react/jsx-runtime';
3
+
4
+ function isA4Viewport(viewport) {
5
+ if (viewport === 'a4') {
6
+ return true;
7
+ }
8
+ if (typeof viewport !== 'object' || viewport === null || !('value' in viewport)) {
9
+ return false;
10
+ }
11
+ return viewport.value === 'a4';
12
+ }
13
+ const paperStyle = {
14
+ width: '100%',
15
+ background: '#ffffff'
16
+ };
17
+ function A4Paper(props) {
18
+ const {
19
+ storyId,
20
+ viewMode,
21
+ children
22
+ } = props;
23
+ useLayoutEffect(() => {
24
+ const selector = viewMode === 'docs' ? `#anchor--${storyId} .docs-story` : '.sb-show-main';
25
+ const canvas = document.querySelector(selector);
26
+ if (!(canvas instanceof HTMLElement)) {
27
+ return;
28
+ }
29
+ canvas.style.setProperty('background', '#ffffff', 'important');
30
+ return () => {
31
+ canvas.style.removeProperty('background');
32
+ };
33
+ }, [storyId, viewMode]);
34
+ return /*#__PURE__*/jsx("div", {
35
+ style: paperStyle,
36
+ children: children
37
+ });
38
+ }
39
+ function withA4PaperDecorator(Story, context) {
40
+ if (!isA4Viewport(context.globals.viewport)) {
41
+ return /*#__PURE__*/jsx(Story, {});
42
+ }
43
+ return /*#__PURE__*/jsx(A4Paper, {
44
+ storyId: context.id,
45
+ viewMode: context.viewMode,
46
+ children: /*#__PURE__*/jsx(Story, {})
47
+ });
48
+ }
49
+
50
+ export { withA4PaperDecorator };
@@ -1,3 +1,4 @@
1
+ export { withA4PaperDecorator } from './decorators/withA4PaperDecorator.js';
1
2
  export { withClearStoresDecorator } from './decorators/withClearStoresDecorator.js';
2
3
  export { withExtraProviders } from './decorators/withExtraProviders.js';
3
4
  export { withFigmaSourceLink } from './decorators/withFigmaSourceLink.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itcase/storybook-config",
3
- "version": "1.3.21",
3
+ "version": "1.3.22",
4
4
  "author": "ITCase",
5
5
  "description": "Storybook configuration package",
6
6
  "engines": {
@@ -46,6 +46,26 @@
46
46
  "import": "./dist/config/preview/index.js",
47
47
  "require": "./dist/config/preview/index.js"
48
48
  },
49
+ "./addons/print/manager": {
50
+ "types": "./dist/addons/print/manager.d.ts",
51
+ "import": "./dist/addons/print/manager.js",
52
+ "require": "./dist/addons/print/manager.js"
53
+ },
54
+ "./addons/print/preview": {
55
+ "types": "./dist/addons/print/preview.d.ts",
56
+ "import": "./dist/addons/print/preview.js",
57
+ "require": "./dist/addons/print/preview.js"
58
+ },
59
+ "./addons/variants/manager": {
60
+ "types": "./dist/addons/variants/manager.d.ts",
61
+ "import": "./dist/addons/variants/manager.js",
62
+ "require": "./dist/addons/variants/manager.js"
63
+ },
64
+ "./addons/variants/preview": {
65
+ "types": "./dist/addons/variants/preview.d.ts",
66
+ "import": "./dist/addons/variants/preview.js",
67
+ "require": "./dist/addons/variants/preview.js"
68
+ },
49
69
  "./addons/tour/manager": {
50
70
  "types": "./dist/addons/tour/manager.d.ts",
51
71
  "import": "./dist/addons/tour/manager.js",
@@ -118,57 +138,57 @@
118
138
  "@itcase/config": "^1.7.33",
119
139
  "@itcase/storybook-addon-auth": "^1.0.5",
120
140
  "@storybook/addon-designs": "^12.0.0",
121
- "@storybook/addon-docs": "^10.6.6",
122
- "@storybook/addon-links": "^10.6.6",
123
- "@storybook/addon-mcp": "^10.6.6",
141
+ "@storybook/addon-docs": "^10.6.7",
142
+ "@storybook/addon-links": "^10.6.7",
143
+ "@storybook/addon-mcp": "^10.6.7",
124
144
  "@storybook/addon-ondevice-actions": "10.7.1",
125
145
  "@storybook/addon-ondevice-backgrounds": "10.7.1",
126
146
  "@storybook/addon-ondevice-controls": "10.7.1",
127
147
  "@storybook/addon-ondevice-notes": "^10.7.1",
128
148
  "@storybook/addon-styling-webpack": "^3.0.2",
129
- "@storybook/addon-themes": "^10.6.6",
130
- "@storybook/addon-vitest": "^10.6.6",
149
+ "@storybook/addon-themes": "^10.6.7",
150
+ "@storybook/addon-vitest": "^10.6.7",
131
151
  "@storybook/addon-webpack5-compiler-swc": "^4.0.3",
132
- "@storybook/mcp": "10.6.6",
133
- "@storybook/nextjs": "^10.6.6",
134
- "@storybook/nextjs-vite": "^10.6.6",
135
- "@storybook/react": "^10.6.6",
152
+ "@storybook/mcp": "10.6.7",
153
+ "@storybook/nextjs": "^10.6.7",
154
+ "@storybook/nextjs-vite": "^10.6.7",
155
+ "@storybook/react": "^10.6.7",
136
156
  "@storybook/react-native": "10.7.1",
137
- "@storybook/react-native-web-vite": "^10.6.6",
138
- "@storybook/react-vite": "^10.6.6",
139
- "@storybook/react-webpack5": "^10.6.6",
157
+ "@storybook/react-native-web-vite": "^10.6.7",
158
+ "@storybook/react-vite": "^10.6.7",
159
+ "@storybook/react-webpack5": "^10.6.7",
140
160
  "chalk": "^6.0.1",
141
- "driver.js": "^1.10.2",
142
- "expo": "~58.0.23",
161
+ "driver.js": "^1.14.0",
162
+ "expo": "~58.0.25",
143
163
  "lodash-es": "^4.18.1",
144
- "msw": "^3.0.4",
164
+ "msw": "^3.0.6",
145
165
  "msw-storybook-addon": "^3.0.3",
146
166
  "react-native": "0.88.1",
147
167
  "react-native-svg": "^15.16.1",
148
168
  "react-native-web": "^0.21.4",
149
169
  "srvx": "^1.0.8",
150
- "storybook": "^10.6.6",
170
+ "storybook": "^10.6.7",
151
171
  "storybook-addon-source-link": "^2.0.1",
152
172
  "storybook-addon-tag-badges": "^3.1.0",
153
- "vite": "^8.3.6",
173
+ "vite": "^8.3.8",
154
174
  "vite-plugin-svgr": "^5.2.0"
155
175
  },
156
176
  "devDependencies": {
157
- "@babel/core": "^8.1.0",
177
+ "@babel/core": "^8.1.2",
158
178
  "@babel/preset-env": "^8.0.7",
159
179
  "@babel/preset-react": "^8.0.1",
160
180
  "@babel/preset-typescript": "^8.0.7",
161
- "@babel/runtime": "^8.1.0",
181
+ "@babel/runtime": "^8.1.2",
162
182
  "@commitlint/cli": "^21.2.4",
163
183
  "@commitlint/config-conventional": "^21.2.4",
164
184
  "@itcase/common": "^1.2.56",
165
- "@itcase/lint": "^1.1.131",
166
- "@itcase/ui-core": "^1.11.5",
167
- "@itcase/ui-web": "^1.11.11",
185
+ "@itcase/lint": "^1.1.137",
186
+ "@itcase/ui-core": "^1.11.12",
187
+ "@itcase/ui-web": "^1.11.12",
168
188
  "@react-native-async-storage/async-storage": "^3.1.1",
169
- "@react-native-community/cli": "20.2.0",
170
- "@react-native-community/cli-platform-android": "20.2.0",
171
- "@react-native-community/cli-platform-ios": "20.2.0",
189
+ "@react-native-community/cli": "21.0.0",
190
+ "@react-native-community/cli-platform-android": "21.0.0",
191
+ "@react-native-community/cli-platform-ios": "21.0.0",
172
192
  "@react-native/babel-preset": "0.88.1",
173
193
  "@react-native/metro-config": "0.88.1",
174
194
  "@react-native/typescript-config": "0.88.1",
@@ -183,22 +203,22 @@
183
203
  "babel-plugin-transform-inline-environment-variables": "^0.4.4",
184
204
  "conventional-changelog-conventionalcommits": "9.3.1",
185
205
  "eslint": "9.39.2",
186
- "glob": "^14.0.4",
206
+ "glob": "^14.0.6",
187
207
  "husky": "^9.1.7",
188
- "lint-staged": "^17.6.0",
189
- "next": "^16.4.5",
190
- "playwright": "^1.65.0",
191
- "prettier": "^3.9.10",
208
+ "lint-staged": "^17.6.1",
209
+ "next": "^16.4.6",
210
+ "playwright": "^1.65.1",
211
+ "prettier": "^3.10.1",
192
212
  "react": "19.3.0",
193
213
  "react-docgen-typescript": "^2.4.0",
194
214
  "react-dom": "19.3.0",
195
215
  "react-native-reanimated": "^4.7.1",
196
216
  "react-native-safe-area-context": "^5.11.1",
197
217
  "react-native-worklets": "^0.13.1",
198
- "rollup": "^4.68.0",
218
+ "rollup": "^4.68.4",
199
219
  "rollup-plugin-copy": "^3.5.0",
200
220
  "rollup-plugin-peer-deps-external": "^2.2.4",
201
- "semantic-release": "^25.0.9",
221
+ "semantic-release": "^26.0.1",
202
222
  "stylelint": "^18.0.0",
203
223
  "typescript": "^6.0.3",
204
224
  "vitest": "^5.1.0"