@seed-design/react 0.0.4 → 0.0.6
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 +6 -6
- package/lib/components/ActionButton/ActionButton.d.ts.map +1 -1
- package/lib/components/ActionButton/ActionButton.js +6 -6
- package/lib/components/ActionChip/ActionChip.cjs +4 -4
- package/lib/components/ActionChip/ActionChip.d.ts +1 -1
- package/lib/components/ActionChip/ActionChip.d.ts.map +1 -1
- package/lib/components/ActionChip/ActionChip.js +4 -4
- package/lib/components/ActionSheet/ActionSheet.cjs +7 -7
- package/lib/components/ActionSheet/ActionSheet.d.ts +2 -2
- package/lib/components/ActionSheet/ActionSheet.d.ts.map +1 -1
- package/lib/components/ActionSheet/ActionSheet.js +7 -7
- package/lib/components/Avatar/Avatar.cjs +2 -2
- package/lib/components/Avatar/Avatar.js +2 -2
- package/lib/components/Badge/Badge.cjs +3 -3
- package/lib/components/Badge/Badge.d.ts.map +1 -1
- package/lib/components/Badge/Badge.js +3 -3
- package/lib/components/BottomSheet/BottomSheet.cjs +2 -2
- package/lib/components/BottomSheet/BottomSheet.js +2 -2
- package/lib/components/Callout/Callout.cjs +2 -2
- package/lib/components/Callout/Callout.js +2 -2
- package/lib/components/Checkbox/Checkbox.cjs +2 -2
- package/lib/components/Checkbox/Checkbox.js +2 -2
- package/lib/components/ChipTabs/ChipTabs.cjs +2 -2
- package/lib/components/ChipTabs/ChipTabs.js +2 -2
- package/lib/components/ControlChip/ControlChip.cjs +3 -3
- package/lib/components/ControlChip/ControlChip.js +3 -3
- package/lib/components/Dialog/Dialog.cjs +2 -2
- package/lib/components/Dialog/Dialog.js +2 -2
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.cjs +5 -4
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.d.ts.map +1 -1
- package/lib/components/ExtendedActionSheet/ExtendedActionSheet.js +5 -4
- package/lib/components/ExtendedFab/ExtendedFab.cjs +7 -11
- package/lib/components/ExtendedFab/ExtendedFab.d.ts.map +1 -1
- package/lib/components/ExtendedFab/ExtendedFab.js +7 -11
- package/lib/components/Fab/Fab.cjs +3 -3
- package/lib/components/Fab/Fab.d.ts.map +1 -1
- package/lib/components/Fab/Fab.js +3 -3
- package/lib/components/HelpBubble/HelpBubble.cjs +8 -3
- package/lib/components/HelpBubble/HelpBubble.d.ts.map +1 -1
- package/lib/components/HelpBubble/HelpBubble.js +8 -3
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.cjs +2 -2
- package/lib/components/IdentityPlaceholder/IdentityPlaceholder.js +2 -2
- package/lib/components/InlineBanner/InlineBanner.cjs +2 -2
- package/lib/components/InlineBanner/InlineBanner.js +2 -2
- package/lib/components/LinkContent/LinkContent.cjs +3 -4
- package/lib/components/LinkContent/LinkContent.d.ts.map +1 -1
- package/lib/components/LinkContent/LinkContent.js +3 -4
- package/lib/components/LoadingIndicator/usePendingButton.d.ts +57 -57
- package/lib/components/MannerTempBadge/MannerTempBadge.cjs +4 -7
- package/lib/components/MannerTempBadge/MannerTempBadge.d.ts +1 -1
- package/lib/components/MannerTempBadge/MannerTempBadge.d.ts.map +1 -1
- package/lib/components/MannerTempBadge/MannerTempBadge.js +4 -7
- package/lib/components/ProgressCircle/ProgressCircle.cjs +2 -2
- package/lib/components/ProgressCircle/ProgressCircle.js +2 -2
- package/lib/components/PullToRefresh/PullToRefresh.cjs +2 -2
- package/lib/components/PullToRefresh/PullToRefresh.js +2 -2
- package/lib/components/ReactionButton/ReactionButton.cjs +5 -5
- package/lib/components/ReactionButton/ReactionButton.js +5 -5
- package/lib/components/SegmentedControl/SegmentedControl.cjs +2 -2
- package/lib/components/SegmentedControl/SegmentedControl.js +2 -2
- package/lib/components/SelectBox/CheckSelectBox.cjs +8 -8
- package/lib/components/SelectBox/CheckSelectBox.d.ts.map +1 -1
- package/lib/components/SelectBox/CheckSelectBox.js +8 -8
- package/lib/components/SelectBox/RadioSelectBox.cjs +7 -7
- package/lib/components/SelectBox/RadioSelectBox.d.ts.map +1 -1
- package/lib/components/SelectBox/RadioSelectBox.js +7 -7
- package/lib/components/Skeleton/Skeleton.cjs +3 -6
- package/lib/components/Skeleton/Skeleton.d.ts.map +1 -1
- package/lib/components/Skeleton/Skeleton.js +3 -6
- package/lib/components/Snackbar/Snackbar.cjs +20 -24
- package/lib/components/Snackbar/Snackbar.d.ts +3 -3
- package/lib/components/Snackbar/Snackbar.d.ts.map +1 -1
- package/lib/components/Snackbar/Snackbar.js +21 -25
- package/lib/components/Snackbar/Snackbar.namespace.cjs +1 -1
- package/lib/components/Snackbar/Snackbar.namespace.d.ts +1 -1
- package/lib/components/Snackbar/Snackbar.namespace.d.ts.map +1 -1
- package/lib/components/Snackbar/Snackbar.namespace.js +1 -1
- package/lib/components/Snackbar/index.cjs +1 -1
- package/lib/components/Snackbar/index.d.ts +1 -1
- package/lib/components/Snackbar/index.d.ts.map +1 -1
- package/lib/components/Snackbar/index.js +1 -1
- package/lib/components/Switch/Switch.cjs +2 -2
- package/lib/components/Switch/Switch.js +2 -2
- package/lib/components/Tabs/Tabs.cjs +2 -2
- package/lib/components/Tabs/Tabs.js +2 -2
- package/lib/components/Text/Text.cjs +2 -2
- package/lib/components/Text/Text.js +2 -2
- package/lib/components/TextField/TextField.cjs +2 -2
- package/lib/components/TextField/TextField.js +2 -2
- package/lib/components/ToggleButton/ToggleButton.cjs +5 -5
- package/lib/components/ToggleButton/ToggleButton.js +5 -5
- package/lib/components/VisuallyHidden/VisuallyHidden.cjs +8 -8
- package/lib/components/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/lib/components/VisuallyHidden/VisuallyHidden.js +7 -7
- package/lib/components/index.cjs +1 -1
- package/lib/components/index.js +1 -1
- package/lib/components/private/useDismissible.d.ts +123 -123
- package/lib/index.cjs +1 -1
- package/lib/index.js +1 -1
- package/lib/utils/createRecipeContext.cjs +74 -0
- package/lib/utils/createRecipeContext.d.ts +24 -0
- package/lib/utils/createRecipeContext.d.ts.map +1 -0
- package/lib/utils/createRecipeContext.js +70 -0
- package/lib/utils/{createStyleContext.cjs → createSlotRecipeContext.cjs} +2 -2
- package/lib/utils/{createStyleContext.d.ts → createSlotRecipeContext.d.ts} +3 -3
- package/lib/utils/createSlotRecipeContext.d.ts.map +1 -0
- package/lib/utils/{createStyleContext.js → createSlotRecipeContext.js} +2 -2
- package/package.json +3 -3
- package/src/components/ActionButton/ActionButton.tsx +7 -7
- package/src/components/ActionChip/ActionChip.tsx +4 -4
- package/src/components/ActionSheet/ActionSheet.tsx +6 -6
- package/src/components/Avatar/Avatar.tsx +2 -2
- package/src/components/Badge/Badge.tsx +3 -3
- package/src/components/BottomSheet/BottomSheet.tsx +2 -2
- package/src/components/Callout/Callout.tsx +2 -2
- package/src/components/Checkbox/Checkbox.tsx +2 -2
- package/src/components/ChipTabs/ChipTabs.tsx +2 -2
- package/src/components/ControlChip/ControlChip.tsx +3 -3
- package/src/components/Dialog/Dialog.tsx +2 -2
- package/src/components/ExtendedActionSheet/ExtendedActionSheet.tsx +5 -4
- package/src/components/ExtendedFab/ExtendedFab.tsx +7 -11
- package/src/components/Fab/Fab.tsx +3 -3
- package/src/components/HelpBubble/HelpBubble.tsx +7 -4
- package/src/components/IdentityPlaceholder/IdentityPlaceholder.tsx +2 -2
- package/src/components/InlineBanner/InlineBanner.tsx +2 -2
- package/src/components/LinkContent/LinkContent.tsx +2 -4
- package/src/components/MannerTempBadge/MannerTempBadge.tsx +4 -7
- package/src/components/ProgressCircle/ProgressCircle.tsx +2 -2
- package/src/components/PullToRefresh/PullToRefresh.tsx +2 -2
- package/src/components/ReactionButton/ReactionButton.tsx +6 -6
- package/src/components/SegmentedControl/SegmentedControl.tsx +2 -2
- package/src/components/SelectBox/CheckSelectBox.tsx +7 -7
- package/src/components/SelectBox/RadioSelectBox.tsx +6 -6
- package/src/components/Skeleton/Skeleton.tsx +3 -6
- package/src/components/Snackbar/Snackbar.namespace.ts +2 -2
- package/src/components/Snackbar/Snackbar.tsx +22 -23
- package/src/components/Snackbar/index.ts +2 -2
- package/src/components/Switch/Switch.tsx +2 -2
- package/src/components/Tabs/Tabs.tsx +2 -2
- package/src/components/Text/Text.tsx +2 -2
- package/src/components/TextField/TextField.tsx +2 -2
- package/src/components/ToggleButton/ToggleButton.tsx +6 -6
- package/src/components/VisuallyHidden/VisuallyHidden.tsx +6 -8
- package/src/utils/createRecipeContext.tsx +114 -0
- package/src/utils/{createStyleContext.tsx → createSlotRecipeContext.tsx} +3 -3
- package/lib/utils/createStyleContext.d.ts.map +0 -1
package/lib/index.cjs
CHANGED
|
@@ -221,7 +221,7 @@ exports.RadioSelectBox = RadioSelectBox_namespace;
|
|
|
221
221
|
exports.Skeleton = Skeleton.Skeleton;
|
|
222
222
|
exports.SnackbarActionButton = Snackbar.SnackbarActionButton;
|
|
223
223
|
exports.SnackbarAvoidOverlap = Snackbar.SnackbarAvoidOverlap;
|
|
224
|
-
exports.
|
|
224
|
+
exports.SnackbarHiddenCloseButton = Snackbar.SnackbarHiddenCloseButton;
|
|
225
225
|
exports.SnackbarMessage = Snackbar.SnackbarMessage;
|
|
226
226
|
exports.SnackbarPrefixIcon = Snackbar.SnackbarPrefixIcon;
|
|
227
227
|
exports.SnackbarRegion = Snackbar.SnackbarRegion;
|
package/lib/index.js
CHANGED
|
@@ -65,7 +65,7 @@ export { CheckSelectBox_namespace as CheckSelectBox };
|
|
|
65
65
|
import * as RadioSelectBox_namespace from './components/SelectBox/RadioSelectBox.namespace.js';
|
|
66
66
|
export { RadioSelectBox_namespace as RadioSelectBox };
|
|
67
67
|
export { Skeleton } from './components/Skeleton/Skeleton.js';
|
|
68
|
-
export { SnackbarActionButton, SnackbarAvoidOverlap,
|
|
68
|
+
export { SnackbarActionButton, SnackbarAvoidOverlap, SnackbarHiddenCloseButton, SnackbarMessage, SnackbarPrefixIcon, SnackbarRegion, SnackbarRenderer, SnackbarRoot, SnackbarRootProvider } from './components/Snackbar/Snackbar.js';
|
|
69
69
|
export { useSnackbarContext } from '@seed-design/react-snackbar';
|
|
70
70
|
export { useSnackbarAdapter } from './components/Snackbar/useSnackbarAdapter.js';
|
|
71
71
|
import * as Snackbar_namespace from './components/Snackbar/Snackbar.namespace.js';
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
|
+
|
|
5
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
const clsx = require('clsx');
|
|
7
|
+
const React = require('react');
|
|
8
|
+
|
|
9
|
+
function createRecipeContext(recipe) {
|
|
10
|
+
const ClassNameContext = React.createContext(null);
|
|
11
|
+
const PropsContext = React.createContext(null);
|
|
12
|
+
const ClassNameProvider = ({
|
|
13
|
+
children,
|
|
14
|
+
value
|
|
15
|
+
}) => {
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ClassNameContext.Provider, { value, children });
|
|
17
|
+
};
|
|
18
|
+
const PropsProvider = ({ children, value }) => {
|
|
19
|
+
return /* @__PURE__ */ jsxRuntime.jsx(PropsContext.Provider, { value, children });
|
|
20
|
+
};
|
|
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
|
+
function useProps() {
|
|
31
|
+
return React.useContext(PropsContext);
|
|
32
|
+
}
|
|
33
|
+
const withRootProvider = (Component, options) => {
|
|
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) => {
|
|
45
|
+
const { defaultProps } = options ?? {};
|
|
46
|
+
const StyledComponent = React.forwardRef((innerProps, ref) => {
|
|
47
|
+
const props = { ...defaultProps ?? {}, ...useProps(), ...innerProps };
|
|
48
|
+
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
49
|
+
const className = recipe(variantProps);
|
|
50
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Component, { ref, ...otherProps, className: clsx(className, props.className) });
|
|
51
|
+
});
|
|
52
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
53
|
+
return StyledComponent;
|
|
54
|
+
};
|
|
55
|
+
const withContext = (Component) => {
|
|
56
|
+
const StyledComponent = React.forwardRef((props, ref) => {
|
|
57
|
+
const className = useClassName();
|
|
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
|
+
};
|
|
63
|
+
return {
|
|
64
|
+
ClassNameProvider,
|
|
65
|
+
PropsProvider,
|
|
66
|
+
useClassName,
|
|
67
|
+
useProps,
|
|
68
|
+
withRootProvider,
|
|
69
|
+
withProvider,
|
|
70
|
+
withContext
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
exports.createRecipeContext = createRecipeContext;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
type Recipe<Props extends Record<string, string | boolean | undefined>, ClassName extends string> = ((props?: Props) => ClassName) & {
|
|
2
|
+
splitVariantProps: <T extends Props>(props: T) => [Props, Omit<T, keyof Props>];
|
|
3
|
+
};
|
|
4
|
+
export declare function createRecipeContext<Props extends Record<string, string | boolean | undefined>, ClassName extends string>(recipe: Recipe<Props, ClassName>): {
|
|
5
|
+
ClassNameProvider: ({ children, value, }: {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
value: ClassName;
|
|
8
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
PropsProvider: ({ children, value }: {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
value: Props;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
useClassName: () => ClassName;
|
|
14
|
+
useProps: () => Props | null;
|
|
15
|
+
withRootProvider: <P>(Component: React.ElementType<any>, options?: {
|
|
16
|
+
defaultProps?: Partial<P>;
|
|
17
|
+
}) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P>>;
|
|
18
|
+
withProvider: <T, P>(Component: React.ElementType<any>, options?: {
|
|
19
|
+
defaultProps?: Partial<P>;
|
|
20
|
+
}) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
|
|
21
|
+
withContext: <T, P>(Component: React.ElementType<any>) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=createRecipeContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRecipeContext.d.ts","sourceRoot":"","sources":["../../src/utils/createRecipeContext.tsx"],"names":[],"mappings":"AAGA,KAAK,MAAM,CACT,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,EAC1D,SAAS,SAAS,MAAM,IACtB,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,SAAS,CAAC,GAAG;IACnC,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,CACjC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,EAC1D,SAAS,SAAS,MAAM,EACxB,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,SAAS,CAAC;8CAO7B;QACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAC1B,KAAK,EAAE,SAAS,CAAC;KAClB;yCAI2C;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE;;;uBAkB7D,CAAC,aACd,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,CAAC;mBAoBtC,CAAC,EAAE,CAAC,aACb,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;kBAgBhE,CAAC,EAAE,CAAC,aACZ,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,KAChC,KAAK,CAAC,yBAAyB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;EAoBtF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { createContext, forwardRef, useContext } from 'react';
|
|
4
|
+
|
|
5
|
+
function createRecipeContext(recipe) {
|
|
6
|
+
const ClassNameContext = createContext(null);
|
|
7
|
+
const PropsContext = createContext(null);
|
|
8
|
+
const ClassNameProvider = ({
|
|
9
|
+
children,
|
|
10
|
+
value
|
|
11
|
+
}) => {
|
|
12
|
+
return /* @__PURE__ */ jsx(ClassNameContext.Provider, { value, children });
|
|
13
|
+
};
|
|
14
|
+
const PropsProvider = ({ children, value }) => {
|
|
15
|
+
return /* @__PURE__ */ jsx(PropsContext.Provider, { value, children });
|
|
16
|
+
};
|
|
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
|
+
function useProps() {
|
|
27
|
+
return useContext(PropsContext);
|
|
28
|
+
}
|
|
29
|
+
const withRootProvider = (Component, options) => {
|
|
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) => {
|
|
41
|
+
const { defaultProps } = options ?? {};
|
|
42
|
+
const StyledComponent = forwardRef((innerProps, ref) => {
|
|
43
|
+
const props = { ...defaultProps ?? {}, ...useProps(), ...innerProps };
|
|
44
|
+
const [variantProps, otherProps] = recipe.splitVariantProps(props);
|
|
45
|
+
const className = recipe(variantProps);
|
|
46
|
+
return /* @__PURE__ */ jsx(Component, { ref, ...otherProps, className: clsx(className, props.className) });
|
|
47
|
+
});
|
|
48
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
49
|
+
return StyledComponent;
|
|
50
|
+
};
|
|
51
|
+
const withContext = (Component) => {
|
|
52
|
+
const StyledComponent = forwardRef((props, ref) => {
|
|
53
|
+
const className = useClassName();
|
|
54
|
+
return /* @__PURE__ */ jsx(Component, { ref, ...props, className: clsx(className, props.className) });
|
|
55
|
+
});
|
|
56
|
+
StyledComponent.displayName = Component.displayName || Component.name;
|
|
57
|
+
return StyledComponent;
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
ClassNameProvider,
|
|
61
|
+
PropsProvider,
|
|
62
|
+
useClassName,
|
|
63
|
+
useProps,
|
|
64
|
+
withRootProvider,
|
|
65
|
+
withProvider,
|
|
66
|
+
withContext
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export { createRecipeContext };
|
|
@@ -6,7 +6,7 @@ const jsxRuntime = require('react/jsx-runtime');
|
|
|
6
6
|
const clsx = require('clsx');
|
|
7
7
|
const React = require('react');
|
|
8
8
|
|
|
9
|
-
function
|
|
9
|
+
function createSlotRecipeContext(recipe) {
|
|
10
10
|
const ClassNamesContext = React.createContext(null);
|
|
11
11
|
const PropsContext = React.createContext(null);
|
|
12
12
|
const ClassNamesProvider = ({
|
|
@@ -73,4 +73,4 @@ function createStyleContext(recipe) {
|
|
|
73
73
|
};
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
exports.
|
|
76
|
+
exports.createSlotRecipeContext = createSlotRecipeContext;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
type
|
|
1
|
+
type SlotRecipe<Props extends Record<string, string | boolean | undefined>, Classnames extends Record<string, string>> = ((props?: Props) => Classnames) & {
|
|
2
2
|
splitVariantProps: <T extends Props>(props: T) => [Props, Omit<T, keyof Props>];
|
|
3
3
|
};
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function createSlotRecipeContext<Props extends Record<string, string | boolean | undefined>, Classnames extends Record<string, string>>(recipe: SlotRecipe<Props, Classnames>): {
|
|
5
5
|
ClassNamesProvider: ({ children, value, }: {
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
value: Classnames;
|
|
@@ -21,4 +21,4 @@ export declare function createStyleContext<Props extends Record<string, string |
|
|
|
21
21
|
withContext: <T, P>(Component: React.ElementType<any>, slot?: keyof Classnames) => React.ForwardRefExoticComponent<React.PropsWithoutRef<P> & React.RefAttributes<T>>;
|
|
22
22
|
};
|
|
23
23
|
export {};
|
|
24
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=createSlotRecipeContext.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSlotRecipeContext.d.ts","sourceRoot":"","sources":["../../src/utils/createSlotRecipeContext.tsx"],"names":[],"mappings":"AAGA,KAAK,UAAU,CACb,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,EAC1D,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IACvC,CAAC,CAAC,KAAK,CAAC,EAAE,KAAK,KAAK,UAAU,CAAC,GAAG;IACpC,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,uBAAuB,CACrC,KAAK,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAAC,EAC1D,UAAU,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACzC,MAAM,EAAE,UAAU,CAAC,KAAK,EAAE,UAAU,CAAC;+CAOlC;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAAC,KAAK,EAAE,UAAU,CAAA;KAAE;yCAIP;QAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;QAAC,KAAK,EAAE,KAAK,CAAA;KAAE;;;uBAmB7D,CAAC,aACd,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,CAAC;mBAsBtC,CAAC,EAAE,CAAC,aACb,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,QAC3B,MAAM,UAAU,YACZ;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;kBAuBhE,CAAC,EAAE,CAAC,aACZ,KAAK,CAAC,WAAW,CAAC,GAAG,CAAC,SAC1B,MAAM,UAAU,KACtB,KAAK,CAAC,yBAAyB,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;EAsBtF"}
|
|
@@ -2,7 +2,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import { createContext, forwardRef, useContext } from 'react';
|
|
4
4
|
|
|
5
|
-
function
|
|
5
|
+
function createSlotRecipeContext(recipe) {
|
|
6
6
|
const ClassNamesContext = createContext(null);
|
|
7
7
|
const PropsContext = createContext(null);
|
|
8
8
|
const ClassNamesProvider = ({
|
|
@@ -69,4 +69,4 @@ function createStyleContext(recipe) {
|
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
export {
|
|
72
|
+
export { createSlotRecipeContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seed-design/react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
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.6",
|
|
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.6",
|
|
64
64
|
"globby": "^14.1.0",
|
|
65
65
|
"vite": "^6.1.1",
|
|
66
66
|
"vite-plugin-dts": "^4.5.0"
|
|
@@ -5,15 +5,15 @@ 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 {
|
|
8
|
+
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
9
|
+
import { IconRequired } from "../Icon/Icon";
|
|
9
10
|
import {
|
|
10
11
|
PendingButtonProvider,
|
|
11
12
|
usePendingButton,
|
|
12
13
|
type UsePendingButtonProps,
|
|
13
14
|
} from "../LoadingIndicator/usePendingButton";
|
|
14
|
-
import { IconRequired } from "../Icon/Icon";
|
|
15
15
|
|
|
16
|
-
const {
|
|
16
|
+
const { ClassNameProvider } = createRecipeContext(actionButton);
|
|
17
17
|
|
|
18
18
|
export interface ActionButtonProps
|
|
19
19
|
extends ActionButtonVariantProps,
|
|
@@ -26,7 +26,7 @@ export const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProp
|
|
|
26
26
|
{ variant, size, loading = false, layout = "withText", className, children, ...otherProps },
|
|
27
27
|
ref,
|
|
28
28
|
) => {
|
|
29
|
-
const
|
|
29
|
+
const recipeClassName = actionButton({ variant, layout, size });
|
|
30
30
|
const api = usePendingButton({ loading, disabled: otherProps.disabled });
|
|
31
31
|
|
|
32
32
|
if (layout === "iconOnly" && !(otherProps["aria-label"] || otherProps["aria-labelledby"])) {
|
|
@@ -36,12 +36,12 @@ export const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProp
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
return (
|
|
39
|
-
<
|
|
39
|
+
<ClassNameProvider value={recipeClassName}>
|
|
40
40
|
<PendingButtonProvider value={api}>
|
|
41
41
|
<IconRequired enabled={layout === "iconOnly"}>
|
|
42
42
|
<Primitive.button
|
|
43
43
|
ref={ref}
|
|
44
|
-
className={clsx(
|
|
44
|
+
className={clsx(recipeClassName, className)}
|
|
45
45
|
{...api.stateProps}
|
|
46
46
|
{...otherProps}
|
|
47
47
|
>
|
|
@@ -49,7 +49,7 @@ export const ActionButton = React.forwardRef<HTMLButtonElement, ActionButtonProp
|
|
|
49
49
|
</Primitive.button>
|
|
50
50
|
</IconRequired>
|
|
51
51
|
</PendingButtonProvider>
|
|
52
|
-
</
|
|
52
|
+
</ClassNameProvider>
|
|
53
53
|
);
|
|
54
54
|
},
|
|
55
55
|
);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
2
1
|
import { actionChip, type ActionChipVariantProps } from "@seed-design/css/recipes/action-chip";
|
|
2
|
+
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
3
3
|
import type * as React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
5
5
|
import { withIconRequired } from "../Icon/Icon";
|
|
6
6
|
|
|
7
|
-
const { withProvider } =
|
|
7
|
+
const { withProvider } = 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
|
-
withProvider<HTMLButtonElement, ActionChipProps>(Primitive.button
|
|
15
|
+
withProvider<HTMLButtonElement, ActionChipProps>(Primitive.button),
|
|
16
16
|
(props: ActionChipProps) => props.layout === "iconOnly",
|
|
17
17
|
);
|
|
18
18
|
ActionChip.displayName = "ActionChip";
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { Dialog as DialogPrimitive, useDialogContext } from "@seed-design/react-dialog";
|
|
2
|
-
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
3
1
|
import { actionSheet, type ActionSheetVariantProps } from "@seed-design/css/recipes/action-sheet";
|
|
4
2
|
import {
|
|
5
3
|
actionSheetItem,
|
|
6
4
|
type ActionSheetItemVariantProps,
|
|
7
5
|
} from "@seed-design/css/recipes/action-sheet-item";
|
|
6
|
+
import { Dialog as DialogPrimitive, useDialogContext } from "@seed-design/react-dialog";
|
|
7
|
+
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
8
8
|
import type * as React from "react";
|
|
9
|
-
import {
|
|
9
|
+
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
10
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
10
11
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
11
12
|
|
|
12
|
-
const { withRootProvider, withContext } =
|
|
13
|
-
const { withProvider: withItemProvider } =
|
|
13
|
+
const { withRootProvider, withContext } = createSlotRecipeContext(actionSheet);
|
|
14
|
+
const { withProvider: withItemProvider } = createRecipeContext(actionSheetItem);
|
|
14
15
|
const withStateProps = createWithStateProps([useDialogContext]);
|
|
15
16
|
|
|
16
17
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -104,7 +105,6 @@ export interface ActionSheetItemProps
|
|
|
104
105
|
|
|
105
106
|
export const ActionSheetItem = withItemProvider<HTMLButtonElement, ActionSheetItemProps>(
|
|
106
107
|
withStateProps(Primitive.button),
|
|
107
|
-
"root",
|
|
108
108
|
);
|
|
109
109
|
|
|
110
110
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -5,9 +5,9 @@ import { avatarStack, type AvatarStackVariantProps } from "@seed-design/css/reci
|
|
|
5
5
|
import clsx from "clsx";
|
|
6
6
|
import * as React from "react";
|
|
7
7
|
import { useMemo } from "react";
|
|
8
|
-
import {
|
|
8
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
9
9
|
|
|
10
|
-
const { PropsProvider, withProvider, withContext } =
|
|
10
|
+
const { PropsProvider, withProvider, withContext } = createSlotRecipeContext(avatar);
|
|
11
11
|
|
|
12
12
|
////////////////////////////////////////////////////////////////////////////////////
|
|
13
13
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
2
2
|
import { badge, type BadgeVariantProps } from "@seed-design/css/recipes/badge";
|
|
3
3
|
import type * as React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
5
5
|
|
|
6
|
-
const { withProvider } =
|
|
6
|
+
const { withProvider } = 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 = withProvider<HTMLSpanElement, BadgeProps>(Primitive.span
|
|
15
|
+
export const Badge = withProvider<HTMLSpanElement, BadgeProps>(Primitive.span);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Dialog as DialogPrimitive, useDialogContext } from "@seed-design/react-dialog";
|
|
2
2
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
3
3
|
import { bottomSheet, type BottomSheetVariantProps } from "@seed-design/css/recipes/bottom-sheet";
|
|
4
|
-
import {
|
|
4
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
5
5
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
6
6
|
import { withStyleProps, type StyleProps } from "../../utils/styled";
|
|
7
7
|
|
|
8
|
-
const { withRootProvider, withContext } =
|
|
8
|
+
const { withRootProvider, withContext } = createSlotRecipeContext(bottomSheet);
|
|
9
9
|
const withStateProps = createWithStateProps([useDialogContext]);
|
|
10
10
|
|
|
11
11
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -2,14 +2,14 @@ import type * as React from "react";
|
|
|
2
2
|
|
|
3
3
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
4
4
|
import { callout, type CalloutVariantProps } from "@seed-design/css/recipes/callout";
|
|
5
|
-
import {
|
|
5
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
6
6
|
import {
|
|
7
7
|
DismissibleCloseButton,
|
|
8
8
|
DismissibleRoot,
|
|
9
9
|
type DismissibleRootProps,
|
|
10
10
|
} from "../private/useDismissible";
|
|
11
11
|
|
|
12
|
-
const { withContext, withProvider } =
|
|
12
|
+
const { withContext, withProvider } = createSlotRecipeContext(callout);
|
|
13
13
|
|
|
14
14
|
export interface CalloutRootProps extends CalloutVariantProps, DismissibleRootProps {}
|
|
15
15
|
|
|
@@ -3,11 +3,11 @@ import { Checkbox as CheckboxPrimitive, useCheckboxContext } from "@seed-design/
|
|
|
3
3
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
4
4
|
import { checkbox, type CheckboxVariantProps } from "@seed-design/css/recipes/checkbox";
|
|
5
5
|
import { forwardRef } from "react";
|
|
6
|
-
import {
|
|
6
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
7
7
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
8
8
|
import { InternalIcon } from "../private/Icon";
|
|
9
9
|
|
|
10
|
-
const { withProvider, withContext, useClassNames } =
|
|
10
|
+
const { withProvider, withContext, useClassNames } = createSlotRecipeContext(checkbox);
|
|
11
11
|
const withStateProps = createWithStateProps([useCheckboxContext]);
|
|
12
12
|
|
|
13
13
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { chipTabs, type ChipTabsVariantProps } from "@seed-design/css/recipes/chip-tabs";
|
|
2
2
|
import { Tabs as TabsPrimitive } from "@seed-design/react-tabs";
|
|
3
|
-
import {
|
|
3
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
4
4
|
|
|
5
|
-
const { withProvider, withContext } =
|
|
5
|
+
const { withProvider, withContext } = createSlotRecipeContext(chipTabs);
|
|
6
6
|
|
|
7
7
|
////////////////////////////////////////////////////////////////////////////////////
|
|
8
8
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { controlChip, type ControlChipVariantProps } from "@seed-design/css/recipes/control-chip";
|
|
2
2
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
3
3
|
import type * as React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
5
5
|
import { withIconRequired } from "../Icon/Icon";
|
|
6
6
|
|
|
7
|
-
const { withProvider } =
|
|
7
|
+
const { withProvider } = 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
|
-
withProvider<HTMLButtonElement, ControlChipProps>(Primitive.button
|
|
16
|
+
withProvider<HTMLButtonElement, ControlChipProps>(Primitive.button),
|
|
17
17
|
(props: ControlChipProps) => props.layout === "iconOnly",
|
|
18
18
|
);
|
|
@@ -2,10 +2,10 @@ import { Dialog as DialogPrimitive, useDialogContext } from "@seed-design/react-
|
|
|
2
2
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
3
3
|
import { dialog, type DialogVariantProps } from "@seed-design/css/recipes/dialog";
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
6
6
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
7
7
|
|
|
8
|
-
const { withRootProvider, withContext } =
|
|
8
|
+
const { withRootProvider, withContext } = createSlotRecipeContext(dialog);
|
|
9
9
|
const withStateProps = createWithStateProps([useDialogContext]);
|
|
10
10
|
|
|
11
11
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -9,11 +9,12 @@ import {
|
|
|
9
9
|
type ExtendedActionSheetItemVariantProps,
|
|
10
10
|
} from "@seed-design/css/recipes/extended-action-sheet-item";
|
|
11
11
|
import type * as React from "react";
|
|
12
|
-
import {
|
|
12
|
+
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
13
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
13
14
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
14
15
|
|
|
15
|
-
const { withRootProvider, withContext } =
|
|
16
|
-
const { withProvider: withItemProvider } =
|
|
16
|
+
const { withRootProvider, withContext } = createSlotRecipeContext(extendedActionSheet);
|
|
17
|
+
const { withProvider: withItemProvider } = createRecipeContext(extendedActionSheetItem);
|
|
17
18
|
const withStateProps = createWithStateProps([useDialogContext]);
|
|
18
19
|
|
|
19
20
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -115,7 +116,7 @@ export interface ExtendedActionSheetItemProps
|
|
|
115
116
|
export const ExtendedActionSheetItem = withItemProvider<
|
|
116
117
|
HTMLButtonElement,
|
|
117
118
|
ExtendedActionSheetItemProps
|
|
118
|
-
>(withStateProps(Primitive.button)
|
|
119
|
+
>(withStateProps(Primitive.button));
|
|
119
120
|
|
|
120
121
|
////////////////////////////////////////////////////////////////////////////////////
|
|
121
122
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
2
2
|
import { extendedFab, type ExtendedFabVariantProps } from "@seed-design/css/recipes/extended-fab";
|
|
3
|
-
import {
|
|
3
|
+
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
4
4
|
|
|
5
|
-
const { withProvider } =
|
|
5
|
+
const { withProvider } = createRecipeContext(extendedFab);
|
|
6
6
|
|
|
7
7
|
////////////////////////////////////////////////////////////////////////////////////
|
|
8
8
|
|
|
@@ -11,13 +11,9 @@ export interface ExtendedFabProps
|
|
|
11
11
|
PrimitiveProps,
|
|
12
12
|
React.ButtonHTMLAttributes<HTMLButtonElement> {}
|
|
13
13
|
|
|
14
|
-
export const ExtendedFab = withProvider<HTMLButtonElement, ExtendedFabProps>(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
defaultProps: {
|
|
19
|
-
variant: "neutralSolid",
|
|
20
|
-
size: "medium",
|
|
21
|
-
},
|
|
14
|
+
export const ExtendedFab = withProvider<HTMLButtonElement, ExtendedFabProps>(Primitive.button, {
|
|
15
|
+
defaultProps: {
|
|
16
|
+
variant: "neutralSolid",
|
|
17
|
+
size: "medium",
|
|
22
18
|
},
|
|
23
|
-
);
|
|
19
|
+
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
2
2
|
import { fab, type FabVariantProps } from "@seed-design/css/recipes/fab";
|
|
3
3
|
import type * as React from "react";
|
|
4
|
-
import {
|
|
4
|
+
import { createRecipeContext } from "../../utils/createRecipeContext";
|
|
5
5
|
|
|
6
|
-
const { withProvider } =
|
|
6
|
+
const { withProvider } = 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 = withProvider<HTMLButtonElement, FabProps>(Primitive.button
|
|
15
|
+
export const Fab = withProvider<HTMLButtonElement, FabProps>(Primitive.button);
|
|
@@ -2,11 +2,11 @@ import { Popover as PopoverPrimitive, usePopoverContext } from "@seed-design/rea
|
|
|
2
2
|
import { Primitive, type PrimitiveProps } from "@seed-design/react-primitive";
|
|
3
3
|
import { helpBubble, type HelpBubbleVariantProps } from "@seed-design/css/recipes/help-bubble";
|
|
4
4
|
import { forwardRef } from "react";
|
|
5
|
-
import {
|
|
5
|
+
import { createSlotRecipeContext } from "../../utils/createSlotRecipeContext";
|
|
6
6
|
import { createWithStateProps } from "../../utils/createWithStateProps";
|
|
7
7
|
import { withStyleProps, type StyleProps } from "../../utils/styled";
|
|
8
8
|
|
|
9
|
-
const { withRootProvider, withContext } =
|
|
9
|
+
const { withRootProvider, withContext } = createSlotRecipeContext(helpBubble);
|
|
10
10
|
const withStateProps = createWithStateProps([usePopoverContext]);
|
|
11
11
|
|
|
12
12
|
////////////////////////////////////////////////////////////////////////////////////
|
|
@@ -16,7 +16,7 @@ export interface HelpBubbleRootProps extends HelpBubbleVariantProps, PopoverPrim
|
|
|
16
16
|
export const HelpBubbleRoot = withRootProvider<HelpBubbleRootProps>(PopoverPrimitive.Root, {
|
|
17
17
|
defaultProps: {
|
|
18
18
|
placement: "top",
|
|
19
|
-
gutter: 4,
|
|
19
|
+
gutter: 4, // TODO: get value from rootage spec
|
|
20
20
|
overflowPadding: 16,
|
|
21
21
|
arrowPadding: 14,
|
|
22
22
|
flip: true,
|
|
@@ -90,7 +90,10 @@ export interface HelpBubbleArrowTipProps extends React.SVGProps<SVGSVGElement> {
|
|
|
90
90
|
|
|
91
91
|
export const HelpBubbleArrowTip = forwardRef<SVGSVGElement, HelpBubbleArrowTipProps>(
|
|
92
92
|
(props, ref) => {
|
|
93
|
-
const {
|
|
93
|
+
const {
|
|
94
|
+
tipRadius = 2, // TODO: get value from rootage spec
|
|
95
|
+
...otherProps
|
|
96
|
+
} = props;
|
|
94
97
|
const api = usePopoverContext();
|
|
95
98
|
const width = api.rects.arrow?.width || 0;
|
|
96
99
|
const height = api.rects.arrow?.height || 0;
|