@uni-design-system/uni-react 1.0.0 → 2.0.1
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/.storybook/main.ts +12 -12
- package/.storybook/manager.ts +13 -0
- package/.storybook/preview.ts +2 -2
- package/.turbo/turbo-build.log +4 -4
- package/CHANGELOG.md +20 -0
- package/dist/components/button/button.component.d.ts.map +1 -1
- package/dist/components/card/card.component.d.ts.map +1 -1
- package/dist/components/draggable/SortableList/components/SortableItem/sortableItem.component.d.ts.map +1 -1
- package/dist/components/draggable/SortableList/sortableList.stories.d.ts.map +1 -1
- package/dist/components/draggable/utilities/index.d.ts.map +1 -1
- package/dist/components/forms/utils/validations.d.ts.map +1 -1
- package/dist/components/grainy-gradient-background/grainy-gradient-background.component.stories.d.ts.map +1 -1
- package/dist/components/icon-text-row/icon-text-row.component.d.ts.map +1 -1
- package/dist/components/modal/modal.component.d.ts.map +1 -1
- package/dist/components/switch/switch.component.d.ts.map +1 -1
- package/dist/components/switch/switch.config.d.ts +2 -2
- package/dist/components/switch/switch.config.d.ts.map +1 -1
- package/dist/core/border/border.style.d.ts +2 -2
- package/dist/core/border/border.style.d.ts.map +1 -1
- package/dist/core/icon/icon.component.d.ts.map +1 -1
- package/dist/core/icon/icon.stories.d.ts.map +1 -1
- package/dist/core/icon/index.d.ts +1 -1
- package/dist/core/icon/index.d.ts.map +1 -1
- package/dist/core/image/image.component.d.ts.map +1 -1
- package/dist/core/layout/layout.provider.d.ts.map +1 -1
- package/dist/core/overlay/overlay.config.d.ts +2 -2
- package/dist/core/overlay/overlay.config.d.ts.map +1 -1
- package/dist/core/padding/padding.style.d.ts.map +1 -1
- package/dist/core/text/text.component.d.ts.map +1 -1
- package/dist/core/text/text.stories.d.ts.map +1 -1
- package/dist/core/theme/theming.d.ts +4 -4
- package/dist/core/theme/theming.d.ts.map +1 -1
- package/dist/core/transition/collapse/collapse.component.d.ts.map +1 -1
- package/dist/core/transition/fade/fade.component.d.ts.map +1 -1
- package/dist/core/transition/slide/slide.component.d.ts.map +1 -1
- package/dist/core/transition/transition.utils.d.ts.map +1 -1
- package/dist/index.js +2668 -2442
- package/dist/tools/color-picker/color-picker.component.d.ts +1 -1
- package/dist/tools/color-picker/color-picker.component.d.ts.map +1 -1
- package/dist/tools/color-picker/color-picker.stories.d.ts +1 -1
- package/dist/tools/color-swatch/color-swatch.component.d.ts +1 -1
- package/dist/tools/color-swatch/color-swatch.component.d.ts.map +1 -1
- package/dist/utils/storage-manager.d.ts.map +1 -1
- package/package.json +11 -11
- package/src/components/button/button.component.tsx +18 -5
- package/src/components/card/card.component.tsx +6 -1
- package/src/components/draggable/SortableList/components/SortableItem/sortableItem.component.tsx +10 -2
- package/src/components/draggable/SortableList/sortableList.component.tsx +1 -1
- package/src/components/draggable/SortableList/sortableList.stories.tsx +8 -4
- package/src/components/draggable/utilities/index.ts +1 -1
- package/src/components/forms/utils/validations.ts +2 -1
- package/src/components/grainy-gradient-background/grainy-gradient-background.component.stories.tsx +4 -1
- package/src/components/icon-text-row/icon-text-row.component.tsx +6 -1
- package/src/components/modal/modal.component.tsx +6 -1
- package/src/components/switch/switch.component.tsx +4 -1
- package/src/components/switch/switch.config.ts +1 -1
- package/src/core/border/border.style.ts +5 -4
- package/src/core/flex/flex.style.ts +17 -17
- package/src/core/hooks/use-media.ts +1 -1
- package/src/core/hooks/use-toggle.tsx +1 -1
- package/src/core/icon/icon.component.tsx +1 -1
- package/src/core/icon/icon.stories.tsx +4 -1
- package/src/core/icon/index.ts +5 -1
- package/src/core/image/image.component.tsx +12 -2
- package/src/core/layout/layout.provider.tsx +5 -10
- package/src/core/overlay/overlay.config.ts +10 -3
- package/src/core/padding/padding.style.ts +9 -10
- package/src/core/text/text.component.tsx +2 -1
- package/src/core/text/text.stories.tsx +12 -30
- package/src/core/theme/theming.tsx +8 -7
- package/src/core/transition/collapse/collapse.component.tsx +10 -2
- package/src/core/transition/fade/fade.component.tsx +16 -2
- package/src/core/transition/slide/slide.component.tsx +12 -2
- package/src/core/transition/transition.utils.ts +8 -2
- package/src/stories/Configure.mdx +31 -26
- package/src/tools/color-picker/color-picker.component.tsx +6 -1
- package/src/tools/color-swatch/color-swatch.component.tsx +8 -1
- package/src/utils/storage-manager.ts +4 -1
- package/tsconfig.json +4 -3
- package/vite.config.ts +7 -7
- package/vitest.shims.d.ts +1 -1
|
@@ -3,82 +3,64 @@ import { Text, TextProps } from './text.component';
|
|
|
3
3
|
|
|
4
4
|
export default {
|
|
5
5
|
title: 'Typography/Text',
|
|
6
|
-
component: Text
|
|
6
|
+
component: Text,
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
const baseArgs: Partial<TextProps> = {
|
|
10
10
|
text: 'UNI Design System',
|
|
11
|
-
colorToken: 'on-background'
|
|
12
|
-
}
|
|
11
|
+
colorToken: 'on-background',
|
|
12
|
+
};
|
|
13
13
|
|
|
14
14
|
export const DisplayLarge = (args: TextProps) => <Text {...args} />;
|
|
15
|
-
DisplayLarge.args = { ...baseArgs,
|
|
16
|
-
role: 'display-large'
|
|
17
|
-
}
|
|
15
|
+
DisplayLarge.args = { ...baseArgs, role: 'display-large' };
|
|
18
16
|
DisplayLarge.story = {
|
|
19
17
|
name: 'Display (large)',
|
|
20
18
|
};
|
|
21
19
|
|
|
22
20
|
export const DisplayMedium = (args: TextProps) => <Text {...args} />;
|
|
23
|
-
DisplayMedium.args = { ...baseArgs,
|
|
24
|
-
role: 'display-medium'
|
|
25
|
-
}
|
|
21
|
+
DisplayMedium.args = { ...baseArgs, role: 'display-medium' };
|
|
26
22
|
DisplayMedium.story = {
|
|
27
23
|
name: 'Display (medium)',
|
|
28
24
|
};
|
|
29
25
|
|
|
30
26
|
export const DisplaySmall = (args: TextProps) => <Text {...args} />;
|
|
31
|
-
DisplaySmall.args = { ...baseArgs,
|
|
32
|
-
role: 'display-small'
|
|
33
|
-
}
|
|
27
|
+
DisplaySmall.args = { ...baseArgs, role: 'display-small' };
|
|
34
28
|
DisplaySmall.story = {
|
|
35
29
|
name: 'Display (small)',
|
|
36
30
|
};
|
|
37
31
|
|
|
38
32
|
export const HeadlineLarge = (args: TextProps) => <Text {...args} />;
|
|
39
|
-
HeadlineLarge.args = { ...baseArgs,
|
|
40
|
-
role: 'headline-large'
|
|
41
|
-
}
|
|
33
|
+
HeadlineLarge.args = { ...baseArgs, role: 'headline-large' };
|
|
42
34
|
HeadlineLarge.story = {
|
|
43
35
|
name: 'Headline (large)',
|
|
44
36
|
};
|
|
45
37
|
|
|
46
38
|
export const HeadlineMedium = (args: TextProps) => <Text {...args} />;
|
|
47
|
-
HeadlineMedium.args = { ...baseArgs,
|
|
48
|
-
role: 'headline-medium'
|
|
49
|
-
}
|
|
39
|
+
HeadlineMedium.args = { ...baseArgs, role: 'headline-medium' };
|
|
50
40
|
HeadlineMedium.story = {
|
|
51
41
|
name: 'Headline (medium)',
|
|
52
42
|
};
|
|
53
43
|
|
|
54
44
|
export const HeadlineSmall = (args: TextProps) => <Text {...args} />;
|
|
55
|
-
HeadlineSmall.args = { ...baseArgs,
|
|
56
|
-
role: 'headline-small'
|
|
57
|
-
}
|
|
45
|
+
HeadlineSmall.args = { ...baseArgs, role: 'headline-small' };
|
|
58
46
|
HeadlineSmall.story = {
|
|
59
47
|
name: 'Headline (small)',
|
|
60
48
|
};
|
|
61
49
|
|
|
62
50
|
export const TitleLarge = (args: TextProps) => <Text {...args} />;
|
|
63
|
-
TitleLarge.args = { ...baseArgs,
|
|
64
|
-
role: 'title-large'
|
|
65
|
-
}
|
|
51
|
+
TitleLarge.args = { ...baseArgs, role: 'title-large' };
|
|
66
52
|
TitleLarge.story = {
|
|
67
53
|
name: 'Title (large)',
|
|
68
54
|
};
|
|
69
55
|
|
|
70
56
|
export const TitleMedium = (args: TextProps) => <Text {...args} />;
|
|
71
|
-
TitleMedium.args = { ...baseArgs,
|
|
72
|
-
role: 'title-medium'
|
|
73
|
-
}
|
|
57
|
+
TitleMedium.args = { ...baseArgs, role: 'title-medium' };
|
|
74
58
|
TitleMedium.story = {
|
|
75
59
|
name: 'Title (medium)',
|
|
76
60
|
};
|
|
77
61
|
|
|
78
62
|
export const TitleSmall = (args: TextProps) => <Text {...args} />;
|
|
79
|
-
TitleSmall.args = { ...baseArgs,
|
|
80
|
-
role: 'title-small'
|
|
81
|
-
}
|
|
63
|
+
TitleSmall.args = { ...baseArgs, role: 'title-small' };
|
|
82
64
|
TitleSmall.story = {
|
|
83
65
|
name: 'Title (small)',
|
|
84
66
|
};
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
import React, { createContext, useContext, useMemo } from 'react';
|
|
2
|
-
import {LightTheme, type
|
|
2
|
+
import { LightTheme, type UniTheme } from '@uni-design-system/uni-core';
|
|
3
3
|
|
|
4
4
|
const defaultTheme = LightTheme;
|
|
5
5
|
|
|
6
|
-
const ThemeContext = createContext<
|
|
6
|
+
const ThemeContext = createContext<UniTheme>(defaultTheme);
|
|
7
7
|
|
|
8
|
-
export const ThemeProvider: React.FC<{ theme?:
|
|
8
|
+
export const ThemeProvider: React.FC<{ theme?: UniTheme; children: React.ReactNode }> = ({
|
|
9
|
+
theme,
|
|
10
|
+
children,
|
|
11
|
+
}) => {
|
|
9
12
|
// Use useMemo to prevent unnecessary re-renders when the parent re-renders
|
|
10
13
|
const value = useMemo(() => theme || defaultTheme, [theme]);
|
|
11
14
|
return <ThemeContext.Provider value={value}>{children}</ThemeContext.Provider>;
|
|
12
15
|
};
|
|
13
16
|
|
|
14
|
-
|
|
15
17
|
export const useTheme = () => {
|
|
16
18
|
const context = useContext(ThemeContext);
|
|
17
|
-
if (!context) throw new Error(
|
|
19
|
+
if (!context) throw new Error('useTheme must be used within ThemeProvider');
|
|
18
20
|
return context;
|
|
19
21
|
};
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
export function withTheme<P extends { theme: Theme }>(
|
|
23
|
+
export function withTheme<P extends { theme: UniTheme }>(
|
|
23
24
|
Component: React.ComponentType<P>
|
|
24
25
|
): React.ComponentType<Omit<P, 'theme'>> {
|
|
25
26
|
return function WrappedComponent(props: any) {
|
|
@@ -1,7 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { AnimatePresence, HTMLMotionProps, motion, Variants as _Variants } from 'framer-motion';
|
|
3
3
|
import { forwardRef, useEffect, useState } from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import {
|
|
5
|
+
TRANSITION_EASINGS,
|
|
6
|
+
Variants,
|
|
7
|
+
withDelay,
|
|
8
|
+
WithTransitionConfig,
|
|
9
|
+
cx,
|
|
10
|
+
warn,
|
|
11
|
+
} from '../transition.utils';
|
|
5
12
|
|
|
6
13
|
const isNumeric = (value?: string | number) => value != null && parseInt(value.toString(), 10) > 0;
|
|
7
14
|
|
|
@@ -51,7 +58,8 @@ const variants: Variants<CollapseOptions> = {
|
|
|
51
58
|
|
|
52
59
|
export type ICollapse = CollapseProps;
|
|
53
60
|
|
|
54
|
-
export interface CollapseProps
|
|
61
|
+
export interface CollapseProps
|
|
62
|
+
extends WithTransitionConfig<HTMLMotionProps<'div'>>, CollapseOptions {}
|
|
55
63
|
|
|
56
64
|
export const Collapse = forwardRef<HTMLDivElement, CollapseProps>((props, ref) => {
|
|
57
65
|
const {
|
|
@@ -3,7 +3,12 @@ import React from 'react';
|
|
|
3
3
|
import { AnimatePresence, HTMLMotionProps, motion, Variants as _Variants } from 'framer-motion';
|
|
4
4
|
|
|
5
5
|
import { forwardRef } from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
TRANSITION_DEFAULTS,
|
|
8
|
+
Variants,
|
|
9
|
+
withDelay,
|
|
10
|
+
WithTransitionConfig,
|
|
11
|
+
} from '../transition.utils';
|
|
7
12
|
|
|
8
13
|
export interface FadeProps extends WithTransitionConfig<HTMLMotionProps<'div'>> {}
|
|
9
14
|
|
|
@@ -37,7 +42,16 @@ export const Fade = forwardRef<HTMLDivElement, FadeProps>(function Fade(props, r
|
|
|
37
42
|
|
|
38
43
|
return (
|
|
39
44
|
<AnimatePresence custom={custom}>
|
|
40
|
-
{show &&
|
|
45
|
+
{show && (
|
|
46
|
+
<motion.div
|
|
47
|
+
ref={ref}
|
|
48
|
+
className={'fade'}
|
|
49
|
+
custom={custom}
|
|
50
|
+
{...fadeConfig}
|
|
51
|
+
animate={animate}
|
|
52
|
+
{...rest}
|
|
53
|
+
/>
|
|
54
|
+
)}
|
|
41
55
|
</AnimatePresence>
|
|
42
56
|
);
|
|
43
57
|
});
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
AnimatePresence,
|
|
4
|
+
HTMLMotionProps,
|
|
5
|
+
motion,
|
|
6
|
+
MotionStyle,
|
|
7
|
+
Variants as TVariants,
|
|
8
|
+
} from 'framer-motion';
|
|
3
9
|
import { forwardRef } from 'react';
|
|
4
10
|
import {
|
|
5
11
|
SlideDirection,
|
|
@@ -71,7 +77,11 @@ export const Slide = forwardRef<HTMLDivElement, SlideProps>(function Slide(props
|
|
|
71
77
|
} = props;
|
|
72
78
|
|
|
73
79
|
const transitionStyles = getSlideTransition({ direction });
|
|
74
|
-
const computedStyle: MotionStyle = Object.assign(
|
|
80
|
+
const computedStyle: MotionStyle = Object.assign(
|
|
81
|
+
{ position: 'fixed' },
|
|
82
|
+
transitionStyles.position,
|
|
83
|
+
style
|
|
84
|
+
);
|
|
75
85
|
|
|
76
86
|
const show = unmountOnExit ? isOpen && unmountOnExit : true;
|
|
77
87
|
const animate = isOpen || unmountOnExit ? 'enter' : 'exit';
|
|
@@ -129,11 +129,17 @@ export type WithTransitionConfig<P extends object> = Omit<P, 'transition'> &
|
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
export const withDelay = {
|
|
132
|
-
enter: (
|
|
132
|
+
enter: (
|
|
133
|
+
transition: Transition,
|
|
134
|
+
delay?: number | DelayConfig
|
|
135
|
+
): Transition & { delay: number | undefined } => ({
|
|
133
136
|
...transition,
|
|
134
137
|
delay: typeof delay === 'number' ? delay : delay?.['enter'],
|
|
135
138
|
}),
|
|
136
|
-
exit: (
|
|
139
|
+
exit: (
|
|
140
|
+
transition: Transition,
|
|
141
|
+
delay?: number | DelayConfig
|
|
142
|
+
): Transition & { delay: number | undefined } => ({
|
|
137
143
|
...transition,
|
|
138
144
|
delay: typeof delay === 'number' ? delay : delay?.['exit'],
|
|
139
145
|
}),
|
|
@@ -1,35 +1,37 @@
|
|
|
1
|
-
import { Meta } from
|
|
2
|
-
|
|
3
|
-
import Github from
|
|
4
|
-
import Discord from
|
|
5
|
-
import Youtube from
|
|
6
|
-
import Tutorials from
|
|
7
|
-
import Styling from
|
|
8
|
-
import Context from
|
|
9
|
-
import Assets from
|
|
10
|
-
import Docs from
|
|
11
|
-
import Share from
|
|
12
|
-
import FigmaPlugin from
|
|
13
|
-
import Testing from
|
|
14
|
-
import Accessibility from
|
|
15
|
-
import Theming from
|
|
16
|
-
import AddonLibrary from
|
|
17
|
-
|
|
18
|
-
export const RightArrow = () =>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
import Github from './assets/github.svg';
|
|
4
|
+
import Discord from './assets/discord.svg';
|
|
5
|
+
import Youtube from './assets/youtube.svg';
|
|
6
|
+
import Tutorials from './assets/tutorials.svg';
|
|
7
|
+
import Styling from './assets/styling.png';
|
|
8
|
+
import Context from './assets/context.png';
|
|
9
|
+
import Assets from './assets/assets.png';
|
|
10
|
+
import Docs from './assets/docs.png';
|
|
11
|
+
import Share from './assets/share.png';
|
|
12
|
+
import FigmaPlugin from './assets/figma-plugin.png';
|
|
13
|
+
import Testing from './assets/testing.png';
|
|
14
|
+
import Accessibility from './assets/accessibility.png';
|
|
15
|
+
import Theming from './assets/theming.png';
|
|
16
|
+
import AddonLibrary from './assets/addon-library.png';
|
|
17
|
+
|
|
18
|
+
export const RightArrow = () => (
|
|
19
|
+
<svg
|
|
20
|
+
viewBox="0 0 14 14"
|
|
21
|
+
width="8px"
|
|
22
|
+
height="14px"
|
|
23
|
+
style={{
|
|
23
24
|
marginLeft: '4px',
|
|
24
25
|
display: 'inline-block',
|
|
25
26
|
shapeRendering: 'inherit',
|
|
26
27
|
verticalAlign: 'middle',
|
|
27
28
|
fill: 'currentColor',
|
|
28
|
-
'path fill': 'currentColor'
|
|
29
|
+
'path fill': 'currentColor',
|
|
29
30
|
}}
|
|
30
|
-
>
|
|
31
|
-
|
|
32
|
-
</svg>
|
|
31
|
+
>
|
|
32
|
+
<path d="m11.1 7.35-5.5 5.5a.5.5 0 0 1-.7-.7L10.04 7 4.9 1.85a.5.5 0 1 1 .7-.7l5.5 5.5c.2.2.2.5 0 .7Z" />
|
|
33
|
+
</svg>
|
|
34
|
+
);
|
|
33
35
|
|
|
34
36
|
<Meta title="Configure your project" />
|
|
35
37
|
|
|
@@ -38,6 +40,7 @@ export const RightArrow = () => <svg
|
|
|
38
40
|
# Configure your project
|
|
39
41
|
|
|
40
42
|
Because Storybook works separately from your app, you'll need to configure it for your specific stack and setup. Below, explore guides for configuring Storybook with popular frameworks and tools. If you get stuck, learn how you can ask for help from our community.
|
|
43
|
+
|
|
41
44
|
</div>
|
|
42
45
|
<div className="sb-section">
|
|
43
46
|
<div className="sb-section-item">
|
|
@@ -87,6 +90,7 @@ export const RightArrow = () => <svg
|
|
|
87
90
|
# Do more with Storybook
|
|
88
91
|
|
|
89
92
|
Now that you know the basics, let's explore other parts of Storybook that will improve your experience. This list is just to get you started. You can customise Storybook in many ways to fit your needs.
|
|
93
|
+
|
|
90
94
|
</div>
|
|
91
95
|
|
|
92
96
|
<div className="sb-section">
|
|
@@ -217,6 +221,7 @@ export const RightArrow = () => <svg
|
|
|
217
221
|
target="_blank"
|
|
218
222
|
>Discover tutorials<RightArrow /></a>
|
|
219
223
|
</div>
|
|
224
|
+
|
|
220
225
|
</div>
|
|
221
226
|
|
|
222
227
|
<style>
|
|
@@ -9,7 +9,12 @@ export interface ColorPickerProps {
|
|
|
9
9
|
sampleSize: number;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
export const ColorPicker = ({
|
|
12
|
+
export const ColorPicker = ({
|
|
13
|
+
imageUrl,
|
|
14
|
+
imageWidth,
|
|
15
|
+
imageHeight,
|
|
16
|
+
sampleSize = 41,
|
|
17
|
+
}: ColorPickerProps): JSX.Element => {
|
|
13
18
|
const canvasRef = useRef<HTMLCanvasElement>(null);
|
|
14
19
|
|
|
15
20
|
const [pixelColor, setPixelColor] = useState<RGBA>({ red: 0, green: 0, blue: 0, alpha: 1 });
|
|
@@ -13,7 +13,14 @@ export interface ColorSwatchProps {
|
|
|
13
13
|
height?: string | number;
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
export function ColorSwatch({
|
|
16
|
+
export function ColorSwatch({
|
|
17
|
+
rgba,
|
|
18
|
+
children,
|
|
19
|
+
cardType = 'elevated',
|
|
20
|
+
elevation,
|
|
21
|
+
width,
|
|
22
|
+
height,
|
|
23
|
+
}: ColorSwatchProps) {
|
|
17
24
|
const theme = useTheme();
|
|
18
25
|
|
|
19
26
|
const { borderRadii } = theme.containers.card;
|
|
@@ -35,7 +35,10 @@ const parseCookie = (cookie: string, key: string): string | undefined => {
|
|
|
35
35
|
|
|
36
36
|
// Usage
|
|
37
37
|
// export const cookieStorageManager = createCookieStorageManager(STORAGE_KEY);
|
|
38
|
-
export const createCookieStorageManager = (
|
|
38
|
+
export const createCookieStorageManager = (
|
|
39
|
+
key: string,
|
|
40
|
+
cookie?: string
|
|
41
|
+
): StorageManager<string> => ({
|
|
39
42
|
type: 'cookie',
|
|
40
43
|
get(init?): string | undefined {
|
|
41
44
|
if (cookie) return parseCookie(cookie, key);
|
package/tsconfig.json
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": "@uni-design-system/tsconfig/base.json",
|
|
3
3
|
"compilerOptions": {
|
|
4
|
+
"moduleResolution": "bundler",
|
|
4
5
|
"jsx": "react-jsx",
|
|
5
6
|
"lib": ["DOM", "DOM.Iterable", "ESNext"],
|
|
6
|
-
"noEmit": true,
|
|
7
|
-
"outDir": "dist",
|
|
7
|
+
"noEmit": true, // Ensures 'tsc' only checks types and doesn't write files
|
|
8
|
+
"outDir": "dist", // If you DO emit, they go here
|
|
8
9
|
"rootDir": "src"
|
|
9
10
|
},
|
|
10
11
|
"include": ["src"],
|
|
11
|
-
"exclude": ["dist", "node_modules"]
|
|
12
|
+
"exclude": ["dist", "node_modules", ".storybook"]
|
|
12
13
|
}
|
package/vite.config.ts
CHANGED
|
@@ -6,14 +6,14 @@ import { resolve } from 'path';
|
|
|
6
6
|
export default defineConfig({
|
|
7
7
|
plugins: [
|
|
8
8
|
react(),
|
|
9
|
-
dts({ insertTypesEntry: true }) // Automatically generates .d.ts files
|
|
9
|
+
dts({ insertTypesEntry: true }), // Automatically generates .d.ts files
|
|
10
10
|
],
|
|
11
11
|
build: {
|
|
12
12
|
lib: {
|
|
13
13
|
entry: resolve(__dirname, 'src/index.ts'),
|
|
14
14
|
name: 'UniReact',
|
|
15
15
|
formats: ['es'], // Modern libraries typically only need ES modules
|
|
16
|
-
fileName: 'index'
|
|
16
|
+
fileName: 'index',
|
|
17
17
|
},
|
|
18
18
|
rollupOptions: {
|
|
19
19
|
// CRITICAL: Do not bundle React or Core into your library
|
|
@@ -21,9 +21,9 @@ export default defineConfig({
|
|
|
21
21
|
output: {
|
|
22
22
|
globals: {
|
|
23
23
|
react: 'React',
|
|
24
|
-
'react-dom': 'ReactDOM'
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
24
|
+
'react-dom': 'ReactDOM',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
29
|
});
|
package/vitest.shims.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
/// <reference types="@vitest/browser-playwright" />
|
|
1
|
+
/// <reference types="@vitest/browser-playwright" />
|