@seed-design/react 0.0.4 → 0.0.5
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/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 +9 -9
- package/lib/components/Snackbar/Snackbar.d.ts +1 -1
- package/lib/components/Snackbar/Snackbar.d.ts.map +1 -1
- package/lib/components/Snackbar/Snackbar.js +9 -9
- 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 +3 -6
- package/lib/components/VisuallyHidden/VisuallyHidden.d.ts.map +1 -1
- package/lib/components/VisuallyHidden/VisuallyHidden.js +3 -6
- package/lib/components/private/useDismissible.d.ts +3 -3
- 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.tsx +8 -8
- 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 +3 -6
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Snackbar.d.ts","sourceRoot":"","sources":["../../../src/components/Snackbar/Snackbar.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Snackbar.d.ts","sourceRoot":"","sources":["../../../src/components/Snackbar/Snackbar.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAY,KAAK,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAGxF,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9E,OAAO,EAAE,QAAQ,IAAI,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAK5E,OAAO,EAAgB,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AAOvE,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB,CAAC,iBAAiB;CAAG;AAEzF,eAAO,MAAM,oBAAoB,qHAAiC,CAAC;AAInE,MAAM,WAAW,mBAAoB,SAAQ,oBAAoB,EAAE,iBAAiB,CAAC,WAAW;CAAG;AAEnG,eAAO,MAAM,cAAc,gHAE1B,CAAC;AAIF,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB,EAAE,iBAAiB,CAAC,SAAS;CAAG;AAE/F,eAAO,MAAM,YAAY,8GAGxB,CAAC;AAIF,MAAM,WAAW,oBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,eAAe,CAAC;CAAG;AAE5C,eAAO,MAAM,eAAe,iHAG3B,CAAC;AAIF,MAAM,WAAW,uBAAwB,SAAQ,iBAAiB;CAAG;AAErE,eAAO,MAAM,kBAAkB,oHAG9B,CAAC;AAIF,MAAM,WAAW,yBACf,SAAQ,cAAc,EACpB,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC;CAAG;AAE9C,eAAO,MAAM,oBAAoB,yHAGhC,CAAC;AAIF,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB,CAAC,gBAAgB;CAAG;AAEvF;;GAEG;AACH,eAAO,MAAM,mBAAmB,wHAY/B,CAAC;AAIF,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB,CAAC,aAAa;CAAG;AAEjF,eAAO,MAAM,gBAAgB,wEAA6B,CAAC;AAI3D,MAAM,WAAW,yBAA0B,SAAQ,iBAAiB,CAAC,iBAAiB;CAAG;AAEzF,eAAO,MAAM,oBAAoB,wIAAiC,CAAC"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
|
-
import { Primitive } from '@seed-design/react-primitive';
|
|
3
|
-
import { Snackbar } from '@seed-design/react-snackbar';
|
|
4
2
|
import { snackbar } from '@seed-design/css/recipes/snackbar';
|
|
5
3
|
import { snackbarRegion } from '@seed-design/css/recipes/snackbar-region';
|
|
6
4
|
import { visuallyHidden } from '@seed-design/css/recipes/visually-hidden';
|
|
5
|
+
import { Primitive } from '@seed-design/react-primitive';
|
|
6
|
+
import { Snackbar } from '@seed-design/react-snackbar';
|
|
7
7
|
import clsx from 'clsx';
|
|
8
8
|
import { forwardRef, useMemo } from 'react';
|
|
9
|
-
import {
|
|
9
|
+
import { createRecipeContext } from '../../utils/createRecipeContext.js';
|
|
10
|
+
import { createSlotRecipeContext } from '../../utils/createSlotRecipeContext.js';
|
|
10
11
|
import { InternalIcon } from '../private/Icon.js';
|
|
11
12
|
|
|
12
|
-
const { withProvider: withRegionProvider } =
|
|
13
|
-
const { withProvider, withContext } =
|
|
13
|
+
const { withProvider: withRegionProvider } = createRecipeContext(snackbarRegion);
|
|
14
|
+
const { withProvider, withContext } = createSlotRecipeContext(snackbar);
|
|
14
15
|
const SnackbarRootProvider = Snackbar.RootProvider;
|
|
15
16
|
const SnackbarRegion = withRegionProvider(
|
|
16
|
-
Snackbar.Region
|
|
17
|
-
"root"
|
|
17
|
+
Snackbar.Region
|
|
18
18
|
);
|
|
19
19
|
const SnackbarRoot = withProvider(
|
|
20
20
|
Snackbar.Root,
|
|
@@ -35,12 +35,12 @@ const SnackbarActionButton = withContext(
|
|
|
35
35
|
const SnackbarCloseButton = forwardRef(
|
|
36
36
|
(props, ref) => {
|
|
37
37
|
const { className, ...otherProps } = props;
|
|
38
|
-
const
|
|
38
|
+
const visuallyHiddenClassName = useMemo(() => visuallyHidden(), []);
|
|
39
39
|
return /* @__PURE__ */ jsx(
|
|
40
40
|
Snackbar.CloseButton,
|
|
41
41
|
{
|
|
42
42
|
ref,
|
|
43
|
-
className: clsx(
|
|
43
|
+
className: clsx(visuallyHiddenClassName, className),
|
|
44
44
|
...otherProps
|
|
45
45
|
}
|
|
46
46
|
);
|
|
@@ -4,11 +4,11 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4
4
|
|
|
5
5
|
const reactSwitch = require('@seed-design/react-switch');
|
|
6
6
|
const _switch = require('@seed-design/css/recipes/switch');
|
|
7
|
-
const
|
|
7
|
+
const createSlotRecipeContext = require('../../utils/createSlotRecipeContext.cjs');
|
|
8
8
|
const reactPrimitive = require('@seed-design/react-primitive');
|
|
9
9
|
const createWithStateProps = require('../../utils/createWithStateProps.cjs');
|
|
10
10
|
|
|
11
|
-
const { withProvider, withContext } =
|
|
11
|
+
const { withProvider, withContext } = createSlotRecipeContext.createSlotRecipeContext(_switch.switchStyle);
|
|
12
12
|
const withStateProps = createWithStateProps.createWithStateProps([reactSwitch.useSwitchContext]);
|
|
13
13
|
const SwitchRoot = withProvider(
|
|
14
14
|
reactSwitch.Switch.Root,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Switch, useSwitchContext } from '@seed-design/react-switch';
|
|
2
2
|
import { switchStyle } from '@seed-design/css/recipes/switch';
|
|
3
|
-
import {
|
|
3
|
+
import { createSlotRecipeContext } from '../../utils/createSlotRecipeContext.js';
|
|
4
4
|
import { Primitive } from '@seed-design/react-primitive';
|
|
5
5
|
import { createWithStateProps } from '../../utils/createWithStateProps.js';
|
|
6
6
|
|
|
7
|
-
const { withProvider, withContext } =
|
|
7
|
+
const { withProvider, withContext } = createSlotRecipeContext(switchStyle);
|
|
8
8
|
const withStateProps = createWithStateProps([useSwitchContext]);
|
|
9
9
|
const SwitchRoot = withProvider(
|
|
10
10
|
Switch.Root,
|
|
@@ -5,10 +5,10 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
5
5
|
const reactPrimitive = require('@seed-design/react-primitive');
|
|
6
6
|
const reactTabs = require('@seed-design/react-tabs');
|
|
7
7
|
const tabs = require('@seed-design/css/recipes/tabs');
|
|
8
|
-
const
|
|
8
|
+
const createSlotRecipeContext = require('../../utils/createSlotRecipeContext.cjs');
|
|
9
9
|
const createWithStateProps = require('../../utils/createWithStateProps.cjs');
|
|
10
10
|
|
|
11
|
-
const { withProvider, withContext } =
|
|
11
|
+
const { withProvider, withContext } = createSlotRecipeContext.createSlotRecipeContext(tabs.tabs);
|
|
12
12
|
const withStateProps = createWithStateProps.createWithStateProps([reactTabs.useTabsContext, reactTabs.useTabsTriggerContext], {
|
|
13
13
|
strict: false
|
|
14
14
|
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Primitive } from '@seed-design/react-primitive';
|
|
2
2
|
import { Tabs, useTabsContext, useTabsTriggerContext } from '@seed-design/react-tabs';
|
|
3
3
|
import { tabs } from '@seed-design/css/recipes/tabs';
|
|
4
|
-
import {
|
|
4
|
+
import { createSlotRecipeContext } from '../../utils/createSlotRecipeContext.js';
|
|
5
5
|
import { createWithStateProps } from '../../utils/createWithStateProps.js';
|
|
6
6
|
|
|
7
|
-
const { withProvider, withContext } =
|
|
7
|
+
const { withProvider, withContext } = createSlotRecipeContext(tabs);
|
|
8
8
|
const withStateProps = createWithStateProps([useTabsContext, useTabsTriggerContext], {
|
|
9
9
|
strict: false
|
|
10
10
|
});
|
|
@@ -56,7 +56,7 @@ const Text = ({
|
|
|
56
56
|
...otherProps
|
|
57
57
|
}) => {
|
|
58
58
|
const Comp = as || "span";
|
|
59
|
-
const
|
|
59
|
+
const textClassName = React.useMemo(
|
|
60
60
|
() => text.text({
|
|
61
61
|
textStyle,
|
|
62
62
|
maxLines: mapMaxLines(maxLines)
|
|
@@ -66,7 +66,7 @@ const Text = ({
|
|
|
66
66
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
67
|
Comp,
|
|
68
68
|
{
|
|
69
|
-
className: clsx(
|
|
69
|
+
className: clsx(textClassName, className),
|
|
70
70
|
style: {
|
|
71
71
|
"--seed-max-lines": maxLines,
|
|
72
72
|
"--seed-text-color": handleColor(color),
|
|
@@ -52,7 +52,7 @@ const Text = ({
|
|
|
52
52
|
...otherProps
|
|
53
53
|
}) => {
|
|
54
54
|
const Comp = as || "span";
|
|
55
|
-
const
|
|
55
|
+
const textClassName = useMemo(
|
|
56
56
|
() => text({
|
|
57
57
|
textStyle,
|
|
58
58
|
maxLines: mapMaxLines(maxLines)
|
|
@@ -62,7 +62,7 @@ const Text = ({
|
|
|
62
62
|
return /* @__PURE__ */ jsx(
|
|
63
63
|
Comp,
|
|
64
64
|
{
|
|
65
|
-
className: clsx(
|
|
65
|
+
className: clsx(textClassName, className),
|
|
66
66
|
style: {
|
|
67
67
|
"--seed-max-lines": maxLines,
|
|
68
68
|
"--seed-text-color": handleColor(color),
|
|
@@ -9,12 +9,12 @@ const reactTextField = require('@seed-design/react-text-field');
|
|
|
9
9
|
const textField = require('@seed-design/css/recipes/text-field');
|
|
10
10
|
const clsx = require('clsx');
|
|
11
11
|
const React = require('react');
|
|
12
|
-
const
|
|
12
|
+
const createSlotRecipeContext = require('../../utils/createSlotRecipeContext.cjs');
|
|
13
13
|
const createWithStateProps = require('../../utils/createWithStateProps.cjs');
|
|
14
14
|
const Icon = require('../private/Icon.cjs');
|
|
15
15
|
const reactComposeRefs = require('@radix-ui/react-compose-refs');
|
|
16
16
|
|
|
17
|
-
const { withProvider, withContext, useClassNames } =
|
|
17
|
+
const { withProvider, withContext, useClassNames } = createSlotRecipeContext.createSlotRecipeContext(textField.textField);
|
|
18
18
|
const withStateProps = createWithStateProps.createWithStateProps([reactTextField.useTextFieldContext]);
|
|
19
19
|
const TextFieldRoot = withProvider(
|
|
20
20
|
reactTextField.TextField.Root,
|
|
@@ -5,12 +5,12 @@ import { TextField, useTextFieldContext } from '@seed-design/react-text-field';
|
|
|
5
5
|
import { textField } from '@seed-design/css/recipes/text-field';
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { forwardRef, useRef, useCallback } from 'react';
|
|
8
|
-
import {
|
|
8
|
+
import { createSlotRecipeContext } from '../../utils/createSlotRecipeContext.js';
|
|
9
9
|
import { createWithStateProps } from '../../utils/createWithStateProps.js';
|
|
10
10
|
import { InternalIcon } from '../private/Icon.js';
|
|
11
11
|
import { composeRefs } from '@radix-ui/react-compose-refs';
|
|
12
12
|
|
|
13
|
-
const { withProvider, withContext, useClassNames } =
|
|
13
|
+
const { withProvider, withContext, useClassNames } = createSlotRecipeContext(textField);
|
|
14
14
|
const withStateProps = createWithStateProps([useTextFieldContext]);
|
|
15
15
|
const TextFieldRoot = withProvider(
|
|
16
16
|
TextField.Root,
|
|
@@ -7,7 +7,7 @@ const reactToggle = require('@seed-design/react-toggle');
|
|
|
7
7
|
const toggleButton = require('@seed-design/css/recipes/toggle-button');
|
|
8
8
|
const clsx = require('clsx');
|
|
9
9
|
const React = require('react');
|
|
10
|
-
const
|
|
10
|
+
const createRecipeContext = require('../../utils/createRecipeContext.cjs');
|
|
11
11
|
const usePendingButton = require('../LoadingIndicator/usePendingButton.cjs');
|
|
12
12
|
|
|
13
13
|
function _interopNamespaceDefault(e) {
|
|
@@ -29,16 +29,16 @@ function _interopNamespaceDefault(e) {
|
|
|
29
29
|
|
|
30
30
|
const React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
31
31
|
|
|
32
|
-
const {
|
|
32
|
+
const { ClassNameProvider } = createRecipeContext.createRecipeContext(toggleButton.toggleButton);
|
|
33
33
|
const ToggleButton = React__namespace.forwardRef(
|
|
34
34
|
({ variant = "brandSolid", size = "small", loading = false, className, ...otherProps }, ref) => {
|
|
35
|
-
const
|
|
35
|
+
const recipeClassName = toggleButton.toggleButton({ variant, size });
|
|
36
36
|
const api = usePendingButton.usePendingButton({ loading, disabled: otherProps.disabled });
|
|
37
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
37
|
+
return /* @__PURE__ */ jsxRuntime.jsx(ClassNameProvider, { value: recipeClassName, children: /* @__PURE__ */ jsxRuntime.jsx(usePendingButton.PendingButtonProvider, { value: api, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
38
38
|
reactToggle.Toggle.Root,
|
|
39
39
|
{
|
|
40
40
|
ref,
|
|
41
|
-
className: clsx(
|
|
41
|
+
className: clsx(recipeClassName, className),
|
|
42
42
|
...api.stateProps,
|
|
43
43
|
...otherProps
|
|
44
44
|
}
|
|
@@ -3,19 +3,19 @@ import { Toggle } from '@seed-design/react-toggle';
|
|
|
3
3
|
import { toggleButton } from '@seed-design/css/recipes/toggle-button';
|
|
4
4
|
import clsx from 'clsx';
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import {
|
|
6
|
+
import { createRecipeContext } from '../../utils/createRecipeContext.js';
|
|
7
7
|
import { usePendingButton, PendingButtonProvider } from '../LoadingIndicator/usePendingButton.js';
|
|
8
8
|
|
|
9
|
-
const {
|
|
9
|
+
const { ClassNameProvider } = createRecipeContext(toggleButton);
|
|
10
10
|
const ToggleButton = React.forwardRef(
|
|
11
11
|
({ variant = "brandSolid", size = "small", loading = false, className, ...otherProps }, ref) => {
|
|
12
|
-
const
|
|
12
|
+
const recipeClassName = toggleButton({ variant, size });
|
|
13
13
|
const api = usePendingButton({ loading, disabled: otherProps.disabled });
|
|
14
|
-
return /* @__PURE__ */ jsx(
|
|
14
|
+
return /* @__PURE__ */ jsx(ClassNameProvider, { value: recipeClassName, children: /* @__PURE__ */ jsx(PendingButtonProvider, { value: api, children: /* @__PURE__ */ jsx(
|
|
15
15
|
Toggle.Root,
|
|
16
16
|
{
|
|
17
17
|
ref,
|
|
18
|
-
className: clsx(
|
|
18
|
+
className: clsx(recipeClassName, className),
|
|
19
19
|
...api.stateProps,
|
|
20
20
|
...otherProps
|
|
21
21
|
}
|
|
@@ -4,12 +4,9 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
4
4
|
|
|
5
5
|
const reactPrimitive = require('@seed-design/react-primitive');
|
|
6
6
|
const visuallyHidden = require('@seed-design/css/recipes/visually-hidden');
|
|
7
|
-
const
|
|
7
|
+
const createRecipeContext = require('../../utils/createRecipeContext.cjs');
|
|
8
8
|
|
|
9
|
-
const { withProvider } =
|
|
10
|
-
const VisuallyHidden = withProvider(
|
|
11
|
-
reactPrimitive.Primitive.div,
|
|
12
|
-
"root"
|
|
13
|
-
);
|
|
9
|
+
const { withProvider } = createRecipeContext.createRecipeContext(visuallyHidden.visuallyHidden);
|
|
10
|
+
const VisuallyHidden = withProvider(reactPrimitive.Primitive.div);
|
|
14
11
|
|
|
15
12
|
exports.VisuallyHidden = VisuallyHidden;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VisuallyHidden.d.ts","sourceRoot":"","sources":["../../../src/components/VisuallyHidden/VisuallyHidden.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAKpC,MAAM,WAAW,mBAAoB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAEpG,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"VisuallyHidden.d.ts","sourceRoot":"","sources":["../../../src/components/VisuallyHidden/VisuallyHidden.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9E,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAKpC,MAAM,WAAW,mBAAoB,SAAQ,cAAc,EAAE,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC;CAAG;AAEpG,eAAO,MAAM,cAAc,4FAAmE,CAAC"}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import { Primitive } from '@seed-design/react-primitive';
|
|
2
2
|
import { visuallyHidden } from '@seed-design/css/recipes/visually-hidden';
|
|
3
|
-
import {
|
|
3
|
+
import { createRecipeContext } from '../../utils/createRecipeContext.js';
|
|
4
4
|
|
|
5
|
-
const { withProvider } =
|
|
6
|
-
const VisuallyHidden = withProvider(
|
|
7
|
-
Primitive.div,
|
|
8
|
-
"root"
|
|
9
|
-
);
|
|
5
|
+
const { withProvider } = createRecipeContext(visuallyHidden);
|
|
6
|
+
const VisuallyHidden = withProvider(Primitive.div);
|
|
10
7
|
|
|
11
8
|
export { VisuallyHidden };
|
|
@@ -284,7 +284,6 @@ export declare function useDismissible(props: UseDismissibleProps): {
|
|
|
284
284
|
slot?: string | undefined | undefined;
|
|
285
285
|
style?: React.CSSProperties | undefined;
|
|
286
286
|
title?: string | undefined | undefined;
|
|
287
|
-
name?: string | undefined | undefined;
|
|
288
287
|
defaultChecked?: boolean | undefined | undefined;
|
|
289
288
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
290
289
|
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
@@ -553,6 +552,7 @@ export declare function useDismissible(props: UseDismissibleProps): {
|
|
|
553
552
|
formMethod?: string | undefined | undefined;
|
|
554
553
|
formNoValidate?: boolean | undefined | undefined;
|
|
555
554
|
formTarget?: string | undefined | undefined;
|
|
555
|
+
name?: string | undefined | undefined;
|
|
556
556
|
type?: "submit" | "reset" | "button" | undefined | undefined;
|
|
557
557
|
};
|
|
558
558
|
};
|
|
@@ -834,7 +834,6 @@ export declare const DismissibleProvider: React.Provider<{
|
|
|
834
834
|
slot?: string | undefined | undefined;
|
|
835
835
|
style?: React.CSSProperties | undefined;
|
|
836
836
|
title?: string | undefined | undefined;
|
|
837
|
-
name?: string | undefined | undefined;
|
|
838
837
|
defaultChecked?: boolean | undefined | undefined;
|
|
839
838
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
840
839
|
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
@@ -1103,6 +1102,7 @@ export declare const DismissibleProvider: React.Provider<{
|
|
|
1103
1102
|
formMethod?: string | undefined | undefined;
|
|
1104
1103
|
formNoValidate?: boolean | undefined | undefined;
|
|
1105
1104
|
formTarget?: string | undefined | undefined;
|
|
1105
|
+
name?: string | undefined | undefined;
|
|
1106
1106
|
type?: "submit" | "reset" | "button" | undefined | undefined;
|
|
1107
1107
|
};
|
|
1108
1108
|
} | null>;
|
|
@@ -1384,7 +1384,6 @@ export declare const useDismissibleContext: () => {
|
|
|
1384
1384
|
slot?: string | undefined | undefined;
|
|
1385
1385
|
style?: React.CSSProperties | undefined;
|
|
1386
1386
|
title?: string | undefined | undefined;
|
|
1387
|
-
name?: string | undefined | undefined;
|
|
1388
1387
|
defaultChecked?: boolean | undefined | undefined;
|
|
1389
1388
|
defaultValue?: string | number | readonly string[] | undefined;
|
|
1390
1389
|
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
@@ -1653,6 +1652,7 @@ export declare const useDismissibleContext: () => {
|
|
|
1653
1652
|
formMethod?: string | undefined | undefined;
|
|
1654
1653
|
formNoValidate?: boolean | undefined | undefined;
|
|
1655
1654
|
formTarget?: string | undefined | undefined;
|
|
1655
|
+
name?: string | undefined | undefined;
|
|
1656
1656
|
type?: "submit" | "reset" | "button" | undefined | undefined;
|
|
1657
1657
|
};
|
|
1658
1658
|
};
|
|
@@ -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.5",
|
|
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.5",
|
|
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.5",
|
|
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
|
);
|