@seed-design/react 0.0.7 → 0.0.9
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/lib/components/ActionButton/ActionButton.cjs +2 -4
- package/lib/components/ActionButton/ActionButton.d.ts.map +1 -1
- package/lib/components/ActionButton/ActionButton.js +2 -4
- package/lib/components/ActionChip/ActionChip.cjs +2 -2
- package/lib/components/ActionChip/ActionChip.js +2 -2
- package/lib/components/ActionSheet/ActionSheet.cjs +2 -2
- package/lib/components/ActionSheet/ActionSheet.js +2 -2
- package/lib/components/Badge/Badge.cjs +2 -2
- package/lib/components/Badge/Badge.d.ts.map +1 -1
- package/lib/components/Badge/Badge.js +2 -2
- package/lib/components/ControlChip/ControlChip.cjs +2 -2
- package/lib/components/ControlChip/ControlChip.js +2 -2
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.cjs +2 -2
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.js +2 -2
- package/lib/components/ExtendedFab/ExtendedFab.cjs +2 -2
- package/lib/components/ExtendedFab/ExtendedFab.js +2 -2
- package/lib/components/Fab/Fab.cjs +2 -2
- package/lib/components/Fab/Fab.d.ts.map +1 -1
- package/lib/components/Fab/Fab.js +2 -2
- package/lib/components/LinkContent/LinkContent.cjs +2 -2
- package/lib/components/LinkContent/LinkContent.js +2 -2
- package/lib/components/MannerTemp/MannerTemp.cjs +19 -0
- package/lib/components/MannerTemp/MannerTemp.d.ts +7 -0
- package/lib/components/MannerTemp/MannerTemp.d.ts.map +1 -0
- package/lib/components/MannerTemp/MannerTemp.js +15 -0
- package/lib/components/MannerTemp/MannerTempEmote.cjs +632 -0
- package/lib/components/MannerTemp/MannerTempEmote.d.ts +7 -0
- package/lib/components/MannerTemp/MannerTempEmote.d.ts.map +1 -0
- package/lib/components/MannerTemp/MannerTempEmote.js +627 -0
- package/lib/components/MannerTemp/index.cjs +11 -0
- package/lib/components/MannerTemp/index.d.ts +3 -0
- package/lib/components/MannerTemp/index.d.ts.map +1 -0
- package/lib/components/MannerTemp/index.js +2 -0
- package/lib/components/MannerTempBadge/MannerTempBadge.cjs +2 -2
- package/lib/components/MannerTempBadge/MannerTempBadge.d.ts.map +1 -1
- package/lib/components/MannerTempBadge/MannerTempBadge.js +2 -2
- package/lib/components/NotificationBadge/NotificationBadge.cjs +43 -0
- package/lib/components/NotificationBadge/NotificationBadge.d.ts +11 -0
- package/lib/components/NotificationBadge/NotificationBadge.d.ts.map +1 -0
- package/lib/components/NotificationBadge/NotificationBadge.js +20 -0
- package/lib/components/NotificationBadge/index.cjs +10 -0
- package/lib/components/NotificationBadge/index.d.ts +2 -0
- package/lib/components/NotificationBadge/index.d.ts.map +1 -0
- package/lib/components/NotificationBadge/index.js +1 -0
- package/lib/components/ReactionButton/ReactionButton.cjs +2 -4
- package/lib/components/ReactionButton/ReactionButton.d.ts.map +1 -1
- package/lib/components/ReactionButton/ReactionButton.js +2 -4
- package/lib/components/SelectBox/CheckSelectBox.cjs +3 -3
- package/lib/components/SelectBox/CheckSelectBox.js +3 -3
- package/lib/components/SelectBox/RadioSelectBox.cjs +3 -3
- package/lib/components/SelectBox/RadioSelectBox.js +3 -3
- package/lib/components/Skeleton/Skeleton.cjs +2 -2
- package/lib/components/Skeleton/Skeleton.d.ts.map +1 -1
- package/lib/components/Skeleton/Skeleton.js +2 -2
- package/lib/components/Snackbar/Snackbar.cjs +2 -2
- package/lib/components/Snackbar/Snackbar.js +2 -2
- package/lib/components/Tabs/Tabs.cjs +1 -11
- package/lib/components/Tabs/Tabs.d.ts +9 -13
- package/lib/components/Tabs/Tabs.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.js +2 -11
- package/lib/components/Tabs/Tabs.namespace.cjs +0 -1
- package/lib/components/Tabs/Tabs.namespace.d.ts +1 -1
- package/lib/components/Tabs/Tabs.namespace.d.ts.map +1 -1
- package/lib/components/Tabs/Tabs.namespace.js +1 -1
- package/lib/components/Tabs/index.cjs +0 -1
- package/lib/components/Tabs/index.d.ts +1 -1
- package/lib/components/Tabs/index.d.ts.map +1 -1
- package/lib/components/Tabs/index.js +1 -1
- package/lib/components/ToggleButton/ToggleButton.cjs +3 -5
- package/lib/components/ToggleButton/ToggleButton.d.ts +1 -1
- package/lib/components/ToggleButton/ToggleButton.d.ts.map +1 -1
- package/lib/components/ToggleButton/ToggleButton.js +3 -5
- package/lib/components/index.cjs +7 -1
- package/lib/components/index.d.ts +2 -0
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/index.js +4 -1
- package/lib/index.cjs +7 -1
- package/lib/index.js +4 -1
- package/lib/utils/createRecipeContext.cjs +6 -41
- package/lib/utils/createRecipeContext.d.ts +4 -12
- package/lib/utils/createRecipeContext.d.ts.map +1 -1
- package/lib/utils/createRecipeContext.js +6 -41
- package/lib/utils/createWithStateProps.cjs +1 -1
- package/lib/utils/createWithStateProps.js +1 -1
- package/package.json +3 -3
- package/src/components/ActionButton/ActionButton.tsx +12 -17
- package/src/components/ActionChip/ActionChip.tsx +2 -2
- package/src/components/ActionSheet/ActionSheet.tsx +2 -2
- package/src/components/Badge/Badge.tsx +2 -2
- package/src/components/ControlChip/ControlChip.tsx +2 -2
- package/src/components/ExtendedActionSheet/ExtendedActionSheet.tsx +2 -2
- package/src/components/ExtendedFab/ExtendedFab.tsx +2 -2
- package/src/components/Fab/Fab.tsx +2 -2
- package/src/components/LinkContent/LinkContent.tsx +2 -2
- package/src/components/MannerTemp/MannerTemp.tsx +25 -0
- package/src/components/MannerTemp/MannerTempEmote.tsx +464 -0
- package/src/components/MannerTemp/index.ts +2 -0
- package/src/components/MannerTempBadge/MannerTempBadge.tsx +2 -2
- package/src/components/NotificationBadge/NotificationBadge.tsx +47 -0
- package/src/components/NotificationBadge/index.ts +6 -0
- package/src/components/ReactionButton/ReactionButton.tsx +8 -13
- package/src/components/SelectBox/CheckSelectBox.tsx +3 -3
- package/src/components/SelectBox/RadioSelectBox.tsx +3 -3
- package/src/components/Skeleton/Skeleton.tsx +2 -2
- package/src/components/Snackbar/Snackbar.tsx +2 -2
- package/src/components/Tabs/Tabs.namespace.ts +0 -2
- package/src/components/Tabs/Tabs.tsx +1 -22
- package/src/components/Tabs/index.ts +0 -2
- package/src/components/ToggleButton/ToggleButton.tsx +9 -14
- package/src/components/index.ts +2 -0
- package/src/utils/createRecipeContext.tsx +12 -72
package/lib/components/index.js
CHANGED
|
@@ -47,7 +47,10 @@ import * as InlineBanner_namespace from './InlineBanner/InlineBanner.namespace.j
|
|
|
47
47
|
export { InlineBanner_namespace as InlineBanner };
|
|
48
48
|
export { LinkContent } from './LinkContent/LinkContent.js';
|
|
49
49
|
export { LoadingIndicator } from './LoadingIndicator/LoadingIndicator.js';
|
|
50
|
+
export { MannerTemp } from './MannerTemp/MannerTemp.js';
|
|
51
|
+
export { MannerTempEmote } from './MannerTemp/MannerTempEmote.js';
|
|
50
52
|
export { MannerTempBadge } from './MannerTempBadge/MannerTempBadge.js';
|
|
53
|
+
export { NotificationBadge, NotificationBadgePositioner } from './NotificationBadge/NotificationBadge.js';
|
|
51
54
|
export { ProgressCircleRange, ProgressCircleRoot, ProgressCircleTrack } from './ProgressCircle/ProgressCircle.js';
|
|
52
55
|
import * as ProgressCircle_namespace from './ProgressCircle/ProgressCircle.namespace.js';
|
|
53
56
|
export { ProgressCircle_namespace as ProgressCircle };
|
|
@@ -74,7 +77,7 @@ export { Stack } from './Stack/Stack.js';
|
|
|
74
77
|
export { SwitchControl, SwitchHiddenInput, SwitchLabel, SwitchRoot, SwitchThumb } from './Switch/Switch.js';
|
|
75
78
|
import * as Switch_namespace from './Switch/Switch.namespace.js';
|
|
76
79
|
export { Switch_namespace as Switch };
|
|
77
|
-
export { TabsCarousel, TabsCarouselCamera, TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger
|
|
80
|
+
export { TabsCarousel, TabsCarouselCamera, TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger } from './Tabs/Tabs.js';
|
|
78
81
|
import * as Tabs_namespace from './Tabs/Tabs.namespace.js';
|
|
79
82
|
export { Tabs_namespace as Tabs };
|
|
80
83
|
export { Text } from './Text/Text.js';
|
package/lib/index.cjs
CHANGED
|
@@ -40,7 +40,10 @@ const InlineBanner = require('./components/InlineBanner/InlineBanner.cjs');
|
|
|
40
40
|
const InlineBanner_namespace = require('./components/InlineBanner/InlineBanner.namespace.cjs');
|
|
41
41
|
const LinkContent = require('./components/LinkContent/LinkContent.cjs');
|
|
42
42
|
const LoadingIndicator = require('./components/LoadingIndicator/LoadingIndicator.cjs');
|
|
43
|
+
const MannerTemp = require('./components/MannerTemp/MannerTemp.cjs');
|
|
44
|
+
const MannerTempEmote = require('./components/MannerTemp/MannerTempEmote.cjs');
|
|
43
45
|
const MannerTempBadge = require('./components/MannerTempBadge/MannerTempBadge.cjs');
|
|
46
|
+
const NotificationBadge = require('./components/NotificationBadge/NotificationBadge.cjs');
|
|
44
47
|
const ProgressCircle = require('./components/ProgressCircle/ProgressCircle.cjs');
|
|
45
48
|
const ProgressCircle_namespace = require('./components/ProgressCircle/ProgressCircle.namespace.cjs');
|
|
46
49
|
const PullToRefresh = require('./components/PullToRefresh/PullToRefresh.cjs');
|
|
@@ -185,7 +188,11 @@ exports.InlineBannerTitle = InlineBanner.InlineBannerTitle;
|
|
|
185
188
|
exports.InlineBanner = InlineBanner_namespace;
|
|
186
189
|
exports.LinkContent = LinkContent.LinkContent;
|
|
187
190
|
exports.LoadingIndicator = LoadingIndicator.LoadingIndicator;
|
|
191
|
+
exports.MannerTemp = MannerTemp.MannerTemp;
|
|
192
|
+
exports.MannerTempEmote = MannerTempEmote.MannerTempEmote;
|
|
188
193
|
exports.MannerTempBadge = MannerTempBadge.MannerTempBadge;
|
|
194
|
+
exports.NotificationBadge = NotificationBadge.NotificationBadge;
|
|
195
|
+
exports.NotificationBadgePositioner = NotificationBadge.NotificationBadgePositioner;
|
|
189
196
|
exports.ProgressCircleRange = ProgressCircle.ProgressCircleRange;
|
|
190
197
|
exports.ProgressCircleRoot = ProgressCircle.ProgressCircleRoot;
|
|
191
198
|
exports.ProgressCircleTrack = ProgressCircle.ProgressCircleTrack;
|
|
@@ -248,7 +255,6 @@ exports.TabsIndicator = Tabs.TabsIndicator;
|
|
|
248
255
|
exports.TabsList = Tabs.TabsList;
|
|
249
256
|
exports.TabsRoot = Tabs.TabsRoot;
|
|
250
257
|
exports.TabsTrigger = Tabs.TabsTrigger;
|
|
251
|
-
exports.TabsTriggerNotification = Tabs.TabsTriggerNotification;
|
|
252
258
|
exports.Tabs = Tabs_namespace;
|
|
253
259
|
exports.Text = Text.Text;
|
|
254
260
|
exports.TextFieldCharacterCount = TextField.TextFieldCharacterCount;
|
package/lib/index.js
CHANGED
|
@@ -47,7 +47,10 @@ import * as InlineBanner_namespace from './components/InlineBanner/InlineBanner.
|
|
|
47
47
|
export { InlineBanner_namespace as InlineBanner };
|
|
48
48
|
export { LinkContent } from './components/LinkContent/LinkContent.js';
|
|
49
49
|
export { LoadingIndicator } from './components/LoadingIndicator/LoadingIndicator.js';
|
|
50
|
+
export { MannerTemp } from './components/MannerTemp/MannerTemp.js';
|
|
51
|
+
export { MannerTempEmote } from './components/MannerTemp/MannerTempEmote.js';
|
|
50
52
|
export { MannerTempBadge } from './components/MannerTempBadge/MannerTempBadge.js';
|
|
53
|
+
export { NotificationBadge, NotificationBadgePositioner } from './components/NotificationBadge/NotificationBadge.js';
|
|
51
54
|
export { ProgressCircleRange, ProgressCircleRoot, ProgressCircleTrack } from './components/ProgressCircle/ProgressCircle.js';
|
|
52
55
|
import * as ProgressCircle_namespace from './components/ProgressCircle/ProgressCircle.namespace.js';
|
|
53
56
|
export { ProgressCircle_namespace as ProgressCircle };
|
|
@@ -74,7 +77,7 @@ export { Stack } from './components/Stack/Stack.js';
|
|
|
74
77
|
export { SwitchControl, SwitchHiddenInput, SwitchLabel, SwitchRoot, SwitchThumb } from './components/Switch/Switch.js';
|
|
75
78
|
import * as Switch_namespace from './components/Switch/Switch.namespace.js';
|
|
76
79
|
export { Switch_namespace as Switch };
|
|
77
|
-
export { TabsCarousel, TabsCarouselCamera, TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger
|
|
80
|
+
export { TabsCarousel, TabsCarouselCamera, TabsContent, TabsIndicator, TabsList, TabsRoot, TabsTrigger } from './components/Tabs/Tabs.js';
|
|
78
81
|
import * as Tabs_namespace from './components/Tabs/Tabs.namespace.js';
|
|
79
82
|
export { Tabs_namespace as Tabs };
|
|
80
83
|
export { Text } from './components/Text/Text.js';
|
|
@@ -7,41 +7,14 @@ const clsx = require('clsx');
|
|
|
7
7
|
const React = require('react');
|
|
8
8
|
|
|
9
9
|
function createRecipeContext(recipe) {
|
|
10
|
-
const ClassNameContext = React.createContext(null);
|
|
11
10
|
const PropsContext = React.createContext(null);
|
|
12
|
-
const ClassNameProvider = ({
|
|
13
|
-
children,
|
|
14
|
-
value
|
|
15
|
-
}) => {
|
|
16
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ClassNameContext.Provider, { value, children });
|
|
17
|
-
};
|
|
18
11
|
const PropsProvider = ({ children, value }) => {
|
|
19
12
|
return /* @__PURE__ */ jsxRuntime.jsx(PropsContext.Provider, { value, children });
|
|
20
13
|
};
|
|
21
|
-
function useClassName() {
|
|
22
|
-
const context = React.useContext(ClassNameContext);
|
|
23
|
-
if (context === null) {
|
|
24
|
-
throw new Error(
|
|
25
|
-
"useClassName must be used within a ClassNameProvider. Did you forget to wrap your component in a ClassNameProvider?"
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
return context;
|
|
29
|
-
}
|
|
30
14
|
function useProps() {
|
|
31
15
|
return React.useContext(PropsContext);
|
|
32
16
|
}
|
|
33
|
-
const
|
|
34
|
-
const { defaultProps } = options ?? {};
|
|
35
|
-
const StyledComponent = (innerProps) => {
|
|
36
|
-
const props = { ...defaultProps ?? {}, ...useProps(), ...innerProps };
|
|
37
|
-
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
38
|
-
const className = recipe(variantProps);
|
|
39
|
-
return /* @__PURE__ */ jsxRuntime.jsx(ClassNameProvider, { value: className, children: /* @__PURE__ */ jsxRuntime.jsx(Component, { ...otherProps, className: clsx(className, props.className) }) });
|
|
40
|
-
};
|
|
41
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
42
|
-
return StyledComponent;
|
|
43
|
-
};
|
|
44
|
-
const withProvider = (Component, options) => {
|
|
17
|
+
const withContext = (Component, options) => {
|
|
45
18
|
const { defaultProps } = options ?? {};
|
|
46
19
|
const StyledComponent = React.forwardRef((innerProps, ref) => {
|
|
47
20
|
const props = { ...defaultProps ?? {}, ...useProps(), ...innerProps };
|
|
@@ -52,22 +25,14 @@ function createRecipeContext(recipe) {
|
|
|
52
25
|
StyledComponent.displayName = Component.displayName || Component.name;
|
|
53
26
|
return StyledComponent;
|
|
54
27
|
};
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, ...props, className: clsx(className, props.className) });
|
|
59
|
-
});
|
|
60
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
61
|
-
return StyledComponent;
|
|
62
|
-
};
|
|
28
|
+
function withPropsProvider() {
|
|
29
|
+
return PropsProvider;
|
|
30
|
+
}
|
|
63
31
|
return {
|
|
64
|
-
ClassNameProvider,
|
|
65
32
|
PropsProvider,
|
|
66
|
-
useClassName,
|
|
67
33
|
useProps,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
withContext
|
|
34
|
+
withContext,
|
|
35
|
+
withPropsProvider
|
|
71
36
|
};
|
|
72
37
|
}
|
|
73
38
|
|
|
@@ -1,24 +1,16 @@
|
|
|
1
|
-
type Recipe<Props extends Record<string, string | boolean | undefined
|
|
1
|
+
type Recipe<Props extends Record<string, string | boolean | undefined>> = ((props?: Props) => string) & {
|
|
2
2
|
splitVariantProps: <T extends Props>(props: T) => [Props, Omit<T, keyof Props>];
|
|
3
3
|
};
|
|
4
|
-
export declare function createRecipeContext<Props extends Record<string, string | boolean | undefined
|
|
5
|
-
ClassNameProvider: ({ children, value, }: {
|
|
6
|
-
children: React.ReactNode;
|
|
7
|
-
value: ClassName;
|
|
8
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export declare function createRecipeContext<Props extends Record<string, string | boolean | undefined>>(recipe: Recipe<Props>): {
|
|
9
5
|
PropsProvider: ({ children, value }: {
|
|
10
6
|
children: React.ReactNode;
|
|
11
7
|
value: Props;
|
|
12
8
|
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
-
useClassName: () => ClassName;
|
|
14
9
|
useProps: () => Props | null;
|
|
15
|
-
|
|
16
|
-
defaultProps?: Partial<P>;
|
|
17
|
-
}) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P>>;
|
|
18
|
-
withProvider: <T, P>(Component: React.ElementType<any>, options?: {
|
|
10
|
+
withContext: <T, P>(Component: React.ElementType<any>, options?: {
|
|
19
11
|
defaultProps?: Partial<P>;
|
|
20
12
|
}) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
|
|
21
|
-
|
|
13
|
+
withPropsProvider: <P>() => React.Provider<Partial<P>>;
|
|
22
14
|
};
|
|
23
15
|
export {};
|
|
24
16
|
//# sourceMappingURL=createRecipeContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRecipeContext.d.ts","sourceRoot":"","sources":["../../src/utils/createRecipeContext.tsx"],"names":[],"mappings":"AAGA,KAAK,MAAM,
|
|
1
|
+
{"version":3,"file":"createRecipeContext.d.ts","sourceRoot":"","sources":["../../src/utils/createRecipeContext.tsx"],"names":[],"mappings":"AAGA,KAAK,MAAM,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,CACzE,KAAK,CAAC,EAAE,KAAK,KACV,MAAM,CAAC,GAAG;IACb,iBAAiB,EAAE,CAAC,CAAC,SAAS,KAAK,EAAE,KAAK,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,MAAM,KAAK,CAAC,CAAC,CAAC;CACjF,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,EAC5F,MAAM,EAAE,MAAM,CAAC,KAAK,CAAC;yCAIuB;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE;;kBAQlE,CAAC,EAAE,CAAC,aACZ,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,YACvB;QACR,YAAY,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;KAC3B,KACA,KAAK,CAAC,yBAAyB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;wBAgB1D,CAAC,OAAK,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;EAU5D"}
|
|
@@ -3,41 +3,14 @@ import clsx from 'clsx';
|
|
|
3
3
|
import { createContext, forwardRef, useContext } from 'react';
|
|
4
4
|
|
|
5
5
|
function createRecipeContext(recipe) {
|
|
6
|
-
const ClassNameContext = createContext(null);
|
|
7
6
|
const PropsContext = createContext(null);
|
|
8
|
-
const ClassNameProvider = ({
|
|
9
|
-
children,
|
|
10
|
-
value
|
|
11
|
-
}) => {
|
|
12
|
-
return /* @__PURE__ */ jsx(ClassNameContext.Provider, { value, children });
|
|
13
|
-
};
|
|
14
7
|
const PropsProvider = ({ children, value }) => {
|
|
15
8
|
return /* @__PURE__ */ jsx(PropsContext.Provider, { value, children });
|
|
16
9
|
};
|
|
17
|
-
function useClassName() {
|
|
18
|
-
const context = useContext(ClassNameContext);
|
|
19
|
-
if (context === null) {
|
|
20
|
-
throw new Error(
|
|
21
|
-
"useClassName must be used within a ClassNameProvider. Did you forget to wrap your component in a ClassNameProvider?"
|
|
22
|
-
);
|
|
23
|
-
}
|
|
24
|
-
return context;
|
|
25
|
-
}
|
|
26
10
|
function useProps() {
|
|
27
11
|
return useContext(PropsContext);
|
|
28
12
|
}
|
|
29
|
-
const
|
|
30
|
-
const { defaultProps } = options ?? {};
|
|
31
|
-
const StyledComponent = (innerProps) => {
|
|
32
|
-
const props = { ...defaultProps ?? {}, ...useProps(), ...innerProps };
|
|
33
|
-
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
34
|
-
const className = recipe(variantProps);
|
|
35
|
-
return /* @__PURE__ */ jsx(ClassNameProvider, { value: className, children: /* @__PURE__ */ jsx(Component, { ...otherProps, className: clsx(className, props.className) }) });
|
|
36
|
-
};
|
|
37
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
38
|
-
return StyledComponent;
|
|
39
|
-
};
|
|
40
|
-
const withProvider = (Component, options) => {
|
|
13
|
+
const withContext = (Component, options) => {
|
|
41
14
|
const { defaultProps } = options ?? {};
|
|
42
15
|
const StyledComponent = forwardRef((innerProps, ref) => {
|
|
43
16
|
const props = { ...defaultProps ?? {}, ...useProps(), ...innerProps };
|
|
@@ -48,22 +21,14 @@ function createRecipeContext(recipe) {
|
|
|
48
21
|
StyledComponent.displayName = Component.displayName || Component.name;
|
|
49
22
|
return StyledComponent;
|
|
50
23
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
return /* @__PURE__ */ jsx(Component, { ref, ...props, className: clsx(className, props.className) });
|
|
55
|
-
});
|
|
56
|
-
StyledComponent.displayName = Component.displayName || Component.name;
|
|
57
|
-
return StyledComponent;
|
|
58
|
-
};
|
|
24
|
+
function withPropsProvider() {
|
|
25
|
+
return PropsProvider;
|
|
26
|
+
}
|
|
59
27
|
return {
|
|
60
|
-
ClassNameProvider,
|
|
61
28
|
PropsProvider,
|
|
62
|
-
useClassName,
|
|
63
29
|
useProps,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
withContext
|
|
30
|
+
withContext,
|
|
31
|
+
withPropsProvider
|
|
67
32
|
};
|
|
68
33
|
}
|
|
69
34
|
|
|
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
const React = require('react');
|
|
7
7
|
|
|
8
8
|
function createWithStateProps(useContexts, options) {
|
|
9
|
-
const strict =
|
|
9
|
+
const strict = true;
|
|
10
10
|
return function withStateProps(Component) {
|
|
11
11
|
const Node = React.forwardRef((props, ref) => {
|
|
12
12
|
const stateProps = {};
|
|
@@ -2,7 +2,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
|
|
4
4
|
function createWithStateProps(useContexts, options) {
|
|
5
|
-
const strict =
|
|
5
|
+
const strict = true;
|
|
6
6
|
return function withStateProps(Component) {
|
|
7
7
|
const Node = forwardRef((props, ref) => {
|
|
8
8
|
const stateProps = {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/daangn/seed-design.git",
|
|
@@ -55,12 +55,12 @@
|
|
|
55
55
|
"clsx": "^2.1.1"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@seed-design/css": "0.0.
|
|
58
|
+
"@seed-design/css": "0.0.9",
|
|
59
59
|
"react": ">=18.0.0",
|
|
60
60
|
"react-dom": ">=18.0.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@seed-design/css": "0.0.
|
|
63
|
+
"@seed-design/css": "0.0.9",
|
|
64
64
|
"globby": "^14.1.0",
|
|
65
65
|
"vite": "^6.1.1",
|
|
66
66
|
"vite-plugin-dts": "^4.5.0"
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
6
6
|
import clsx from "clsx";
|
|
7
7
|
import * as React from "react";
|
|
8
|
-
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
9
8
|
import { IconRequired } from "../Icon/Icon";
|
|
10
9
|
import {
|
|
11
10
|
PendingButtonProvider,
|
|
@@ -13,8 +12,6 @@ import {
|
|
|
13
12
|
type UsePendingButtonProps,
|
|
14
13
|
} from "../LoadingIndicator/usePendingButton";
|
|
15
14
|
|
|
16
|
-
const { ClassNameProvider } = createRecipeContext(actionButton);
|
|
17
|
-
|
|
18
15
|
export interface ActionButtonProps
|
|
19
16
|
extends ActionButtonVariantProps,
|
|
20
17
|
UsePendingButtonProps,
|
|
@@ -36,20 +33,18 @@ export const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProp
|
|
|
36
33
|
}
|
|
37
34
|
|
|
38
35
|
return (
|
|
39
|
-
<
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
</PendingButtonProvider>
|
|
52
|
-
</ClassNameProvider>
|
|
36
|
+
<PendingButtonProvider value={api}>
|
|
37
|
+
<IconRequired enabled={layout === "iconOnly"}>
|
|
38
|
+
<Primitive.button
|
|
39
|
+
ref={ref}
|
|
40
|
+
className={clsx(recipeClassName, className)}
|
|
41
|
+
{...api.stateProps}
|
|
42
|
+
{...otherProps}
|
|
43
|
+
>
|
|
44
|
+
{children}
|
|
45
|
+
</Primitive.button>
|
|
46
|
+
</IconRequired>
|
|
47
|
+
</PendingButtonProvider>
|
|
53
48
|
);
|
|
54
49
|
},
|
|
55
50
|
);
|
|
@@ -4,7 +4,7 @@ import type * as React from "react";
|
|
|
4
4
|
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
5
5
|
import { withIconRequired } from "../Icon/Icon";
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { withContext } = createRecipeContext(actionChip);
|
|
8
8
|
|
|
9
9
|
export interface ActionChipProps
|
|
10
10
|
extends ActionChipVariantProps,
|
|
@@ -12,7 +12,7 @@ export interface ActionChipProps
|
|
|
12
12
|
React.ButtonHTMLAttributes<HTMLButtonElement> {}
|
|
13
13
|
|
|
14
14
|
export const ActionChip = withIconRequired(
|
|
15
|
-
|
|
15
|
+
withContext<HTMLButtonElement, ActionChipProps>(Primitive.button),
|
|
16
16
|
(props: ActionChipProps) => props.layout === "iconOnly",
|
|
17
17
|
);
|
|
18
18
|
ActionChip.displayName = "ActionChip";
|
|
@@ -11,7 +11,7 @@ import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
|
11
11
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
12
12
|
|
|
13
13
|
const { withRootProvider, withContext } = createSlotRecipeContext(actionSheet);
|
|
14
|
-
const {
|
|
14
|
+
const { withContext: withItemContext } = createRecipeContext(actionSheetItem);
|
|
15
15
|
const withStateProps = createWithStateProps([useDialogContext]);
|
|
16
16
|
|
|
17
17
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -103,7 +103,7 @@ export interface ActionSheetItemProps
|
|
|
103
103
|
ActionSheetItemVariantProps,
|
|
104
104
|
React.HTMLAttributes<HTMLButtonElement> {}
|
|
105
105
|
|
|
106
|
-
export const ActionSheetItem =
|
|
106
|
+
export const ActionSheetItem = withItemContext<HTMLButtonElement, ActionSheetItemProps>(
|
|
107
107
|
withStateProps(Primitive.button),
|
|
108
108
|
);
|
|
109
109
|
|
|
@@ -3,7 +3,7 @@ import { badge, type BadgeVariantProps } from "@seed-design/css/recipes/badge";
|
|
|
3
3
|
import type * as React from "react";
|
|
4
4
|
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const { withContext } = createRecipeContext(badge);
|
|
7
7
|
|
|
8
8
|
////////////////////////////////////////////////////////////////////////////////////
|
|
9
9
|
|
|
@@ -12,4 +12,4 @@ export interface BadgeProps
|
|
|
12
12
|
PrimitiveProps,
|
|
13
13
|
React.HTMLAttributes<HTMLSpanElement> {}
|
|
14
14
|
|
|
15
|
-
export const Badge =
|
|
15
|
+
export const Badge = withContext<HTMLSpanElement, BadgeProps>(Primitive.span);
|
|
@@ -4,7 +4,7 @@ import type * as React from "react";
|
|
|
4
4
|
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
5
5
|
import { withIconRequired } from "../Icon/Icon";
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { withContext } = createRecipeContext(controlChip);
|
|
8
8
|
|
|
9
9
|
export interface ControlChipBaseProps extends PrimitiveProps, ControlChipVariantProps {}
|
|
10
10
|
|
|
@@ -13,6 +13,6 @@ export interface ControlChipProps
|
|
|
13
13
|
React.HTMLAttributes<HTMLButtonElement> {}
|
|
14
14
|
|
|
15
15
|
export const ControlChip = withIconRequired(
|
|
16
|
-
|
|
16
|
+
withContext<HTMLButtonElement, ControlChipProps>(Primitive.button),
|
|
17
17
|
(props: ControlChipProps) => props.layout === "iconOnly",
|
|
18
18
|
);
|
|
@@ -14,7 +14,7 @@ import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
|
14
14
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
15
15
|
|
|
16
16
|
const { withRootProvider, withContext } = createSlotRecipeContext(extendedActionSheet);
|
|
17
|
-
const {
|
|
17
|
+
const { withContext: withItemContext } = createRecipeContext(extendedActionSheetItem);
|
|
18
18
|
const withStateProps = createWithStateProps([useDialogContext]);
|
|
19
19
|
|
|
20
20
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -113,7 +113,7 @@ export interface ExtendedActionSheetItemProps
|
|
|
113
113
|
ExtendedActionSheetItemVariantProps,
|
|
114
114
|
React.HTMLAttributes<HTMLButtonElement> {}
|
|
115
115
|
|
|
116
|
-
export const ExtendedActionSheetItem =
|
|
116
|
+
export const ExtendedActionSheetItem = withItemContext<
|
|
117
117
|
HTMLButtonElement,
|
|
118
118
|
ExtendedActionSheetItemProps
|
|
119
119
|
>(withStateProps(Primitive.button));
|
|
@@ -2,7 +2,7 @@ import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
|
2
2
|
import { extendedFab, type ExtendedFabVariantProps } from "@seed-design/css/recipes/extended-fab";
|
|
3
3
|
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
4
4
|
|
|
5
|
-
const {
|
|
5
|
+
const { withContext } = createRecipeContext(extendedFab);
|
|
6
6
|
|
|
7
7
|
////////////////////////////////////////////////////////////////////////////////////
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ export interface ExtendedFabProps
|
|
|
11
11
|
PrimitiveProps,
|
|
12
12
|
React.ButtonHTMLAttributes<HTMLButtonElement> {}
|
|
13
13
|
|
|
14
|
-
export const ExtendedFab =
|
|
14
|
+
export const ExtendedFab = withContext<HTMLButtonElement, ExtendedFabProps>(Primitive.button, {
|
|
15
15
|
defaultProps: {
|
|
16
16
|
variant: "neutralSolid",
|
|
17
17
|
size: "medium",
|
|
@@ -3,7 +3,7 @@ import { fab, type FabVariantProps } from "@seed-design/css/recipes/fab";
|
|
|
3
3
|
import type * as React from "react";
|
|
4
4
|
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const { withContext } = createRecipeContext(fab);
|
|
7
7
|
|
|
8
8
|
////////////////////////////////////////////////////////////////////////////////////
|
|
9
9
|
|
|
@@ -12,4 +12,4 @@ export interface FabProps
|
|
|
12
12
|
PrimitiveProps,
|
|
13
13
|
React.ButtonHTMLAttributes<HTMLButtonElement> {}
|
|
14
14
|
|
|
15
|
-
export const Fab =
|
|
15
|
+
export const Fab = withContext<HTMLButtonElement, FabProps>(Primitive.button);
|
|
@@ -4,7 +4,7 @@ import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
|
4
4
|
import type * as React from "react";
|
|
5
5
|
import { withStyleProps, type StyleProps } from "../../utils/styled";
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { withContext } = createRecipeContext(linkContent);
|
|
8
8
|
|
|
9
9
|
export interface LinkContentProps
|
|
10
10
|
extends LinkContentVariantProps,
|
|
@@ -12,6 +12,6 @@ export interface LinkContentProps
|
|
|
12
12
|
Pick<StyleProps, "color">,
|
|
13
13
|
Omit<React.HTMLAttributes<HTMLSpanElement>, "color"> {}
|
|
14
14
|
|
|
15
|
-
export const LinkContent =
|
|
15
|
+
export const LinkContent = withContext<HTMLButtonElement, LinkContentProps>(
|
|
16
16
|
withStyleProps(Primitive.span),
|
|
17
17
|
);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { mannerTemp, type MannerTempVariantProps } from "@seed-design/css/recipes/manner-temp";
|
|
2
|
+
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
3
|
+
import type * as React from "react";
|
|
4
|
+
import { forwardRef, useMemo } from "react";
|
|
5
|
+
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
6
|
+
import { MannerTempEmotePropsProvider } from "./MannerTempEmote";
|
|
7
|
+
|
|
8
|
+
const { withContext } = createRecipeContext(mannerTemp);
|
|
9
|
+
|
|
10
|
+
export interface MannerTempProps
|
|
11
|
+
extends MannerTempVariantProps,
|
|
12
|
+
PrimitiveProps,
|
|
13
|
+
React.HTMLAttributes<HTMLSpanElement> {}
|
|
14
|
+
|
|
15
|
+
const MannerTempBase = withContext<HTMLSpanElement, MannerTempProps>(Primitive.span);
|
|
16
|
+
|
|
17
|
+
export const MannerTemp = forwardRef<HTMLSpanElement, MannerTempProps>((props, ref) => {
|
|
18
|
+
const emoteProps = useMemo(() => ({ level: props.level }), [props.level]);
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
<MannerTempEmotePropsProvider value={emoteProps}>
|
|
22
|
+
<MannerTempBase {...props} ref={ref} />
|
|
23
|
+
</MannerTempEmotePropsProvider>
|
|
24
|
+
);
|
|
25
|
+
});
|