@enadhq/enad-react-sdk 1.1.0 → 1.2.0
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/dist/client/cart/components/cart-drawer.mjs +3 -3
- package/dist/client/cart/components/cart-drawer.mjs.map +1 -1
- package/dist/client/cart/components/cart-trigger.mjs +1 -1
- package/dist/client/cart/components/cart-trigger.mjs.map +1 -1
- package/dist/client/storefront/checkout/cart-summary.mjs +1 -1
- package/dist/client/storefront/checkout/cart-summary.mjs.map +1 -1
- package/dist/client/storefront/components/language-selector.d.ts.map +1 -1
- package/dist/client/storefront/components/language-selector.mjs +1 -1
- package/dist/client/storefront/components/language-selector.mjs.map +1 -1
- package/dist/client/storefront/filters/filter-chip.mjs +1 -1
- package/dist/client/storefront/filters/filter-chip.mjs.map +1 -1
- package/dist/client/storefront/filters/filter-panel.mjs +1 -1
- package/dist/client/storefront/filters/filter-panel.mjs.map +1 -1
- package/dist/client/storefront/filters/toggle-list-view.mjs +1 -1
- package/dist/client/storefront/filters/toggle-list-view.mjs.map +1 -1
- package/dist/client/storefront/layout/promotion-bar.d.ts.map +1 -1
- package/dist/client/storefront/layout/promotion-bar.mjs +3 -3
- package/dist/client/storefront/layout/promotion-bar.mjs.map +1 -1
- package/dist/client/storefront/primitives/button.d.ts +2 -2
- package/dist/client/storefront/primitives/button.d.ts.map +1 -1
- package/dist/client/storefront/primitives/button.mjs +4 -4
- package/dist/client/storefront/primitives/button.mjs.map +1 -1
- package/dist/client/storefront/primitives/input.d.ts +1 -1
- package/dist/client/storefront/primitives/input.mjs.map +1 -1
- package/dist/client/storefront/primitives/pagination.mjs +2 -2
- package/dist/client/storefront/primitives/pagination.mjs.map +1 -1
- package/dist/client/storefront/product/quantity-picker.mjs +2 -2
- package/dist/client/storefront/product/quantity-picker.mjs.map +1 -1
- package/dist/client/storefront/types.d.ts +1 -1
- package/dist/client/storefront/types.d.ts.map +1 -1
- package/dist/client/storefront/types.mjs.map +1 -1
- package/dist/client/ui/accordion.d.ts +12 -1
- package/dist/client/ui/accordion.d.ts.map +1 -1
- package/dist/client/ui/accordion.mjs +23 -5
- package/dist/client/ui/accordion.mjs.map +1 -1
- package/dist/client/ui/alert.d.ts +16 -7
- package/dist/client/ui/alert.d.ts.map +1 -1
- package/dist/client/ui/alert.mjs +21 -8
- package/dist/client/ui/alert.mjs.map +1 -1
- package/dist/client/ui/avatar.d.ts +10 -1
- package/dist/client/ui/avatar.d.ts.map +1 -1
- package/dist/client/ui/avatar.mjs +18 -4
- package/dist/client/ui/avatar.mjs.map +1 -1
- package/dist/client/ui/breadcrumb.d.ts +13 -1
- package/dist/client/ui/breadcrumb.d.ts.map +1 -1
- package/dist/client/ui/breadcrumb.mjs +27 -7
- package/dist/client/ui/breadcrumb.mjs.map +1 -1
- package/dist/client/ui/button.d.ts +28 -10
- package/dist/client/ui/button.d.ts.map +1 -1
- package/dist/client/ui/button.mjs +45 -20
- package/dist/client/ui/button.mjs.map +1 -1
- package/dist/client/ui/card.d.ts +20 -1
- package/dist/client/ui/card.d.ts.map +1 -1
- package/dist/client/ui/card.mjs +36 -8
- package/dist/client/ui/card.mjs.map +1 -1
- package/dist/client/ui/carousel.d.ts.map +1 -1
- package/dist/client/ui/carousel.mjs +2 -2
- package/dist/client/ui/carousel.mjs.map +1 -1
- package/dist/client/ui/checkbox.d.ts +9 -1
- package/dist/client/ui/checkbox.d.ts.map +1 -1
- package/dist/client/ui/checkbox.mjs +12 -3
- package/dist/client/ui/checkbox.mjs.map +1 -1
- package/dist/client/ui/dialog.d.ts +13 -1
- package/dist/client/ui/dialog.d.ts.map +1 -1
- package/dist/client/ui/dialog.mjs +27 -7
- package/dist/client/ui/dialog.mjs.map +1 -1
- package/dist/client/ui/hover-card.d.ts +6 -1
- package/dist/client/ui/hover-card.d.ts.map +1 -1
- package/dist/client/ui/hover-card.mjs +4 -2
- package/dist/client/ui/hover-card.mjs.map +1 -1
- package/dist/client/ui/input.d.ts +20 -7
- package/dist/client/ui/input.d.ts.map +1 -1
- package/dist/client/ui/input.mjs +33 -9
- package/dist/client/ui/input.mjs.map +1 -1
- package/dist/client/ui/label.d.ts +6 -1
- package/dist/client/ui/label.d.ts.map +1 -1
- package/dist/client/ui/label.mjs +4 -2
- package/dist/client/ui/label.mjs.map +1 -1
- package/dist/client/ui/navigation-menu.d.ts +20 -3
- package/dist/client/ui/navigation-menu.d.ts.map +1 -1
- package/dist/client/ui/navigation-menu.mjs +34 -12
- package/dist/client/ui/navigation-menu.mjs.map +1 -1
- package/dist/client/ui/pagination.d.ts.map +1 -1
- package/dist/client/ui/pagination.mjs +3 -3
- package/dist/client/ui/pagination.mjs.map +1 -1
- package/dist/client/ui/popover.d.ts +11 -1
- package/dist/client/ui/popover.d.ts.map +1 -1
- package/dist/client/ui/popover.mjs +21 -5
- package/dist/client/ui/popover.mjs.map +1 -1
- package/dist/client/ui/progress.d.ts +9 -1
- package/dist/client/ui/progress.d.ts.map +1 -1
- package/dist/client/ui/progress.mjs +12 -3
- package/dist/client/ui/progress.mjs.map +1 -1
- package/dist/client/ui/select.d.ts +14 -2
- package/dist/client/ui/select.d.ts.map +1 -1
- package/dist/client/ui/select.mjs +35 -9
- package/dist/client/ui/select.mjs.map +1 -1
- package/dist/client/ui/separator.d.ts +6 -1
- package/dist/client/ui/separator.d.ts.map +1 -1
- package/dist/client/ui/separator.mjs +4 -2
- package/dist/client/ui/separator.mjs.map +1 -1
- package/dist/client/ui/sheet.d.ts +13 -1
- package/dist/client/ui/sheet.d.ts.map +1 -1
- package/dist/client/ui/sheet.mjs +35 -7
- package/dist/client/ui/sheet.mjs.map +1 -1
- package/dist/client/ui/slot-wrapper.d.ts +28 -0
- package/dist/client/ui/slot-wrapper.d.ts.map +1 -0
- package/dist/client/ui/slot-wrapper.mjs +38 -0
- package/dist/client/ui/slot-wrapper.mjs.map +1 -0
- package/dist/client/ui/tabs.d.ts +11 -1
- package/dist/client/ui/tabs.d.ts.map +1 -1
- package/dist/client/ui/tabs.mjs +21 -5
- package/dist/client/ui/tabs.mjs.map +1 -1
- package/dist/client/ui/toggle-group.d.ts +7 -4
- package/dist/client/ui/toggle-group.d.ts.map +1 -1
- package/dist/client/ui/toggle-group.mjs +4 -4
- package/dist/client/ui/toggle-group.mjs.map +1 -1
- package/dist/client/ui/toggle.d.ts +17 -8
- package/dist/client/ui/toggle.d.ts.map +1 -1
- package/dist/client/ui/toggle.mjs +11 -9
- package/dist/client/ui/toggle.mjs.map +1 -1
- package/dist/client/ui/tooltip.d.ts +6 -1
- package/dist/client/ui/tooltip.d.ts.map +1 -1
- package/dist/client/ui/tooltip.mjs +4 -2
- package/dist/client/ui/tooltip.mjs.map +1 -1
- package/dist/client/ui-resolver/button.d.ts +3 -4
- package/dist/client/ui-resolver/button.d.ts.map +1 -1
- package/dist/client/ui-resolver/button.mjs +2 -2
- package/dist/client/ui-resolver/button.mjs.map +1 -1
- package/dist/client/ui-resolver/card.d.ts +14 -1
- package/dist/client/ui-resolver/card.d.ts.map +1 -1
- package/dist/client/ui-resolver/card.mjs +3 -2
- package/dist/client/ui-resolver/card.mjs.map +1 -1
- package/dist/client/ui-resolver/context.mjs +1 -1
- package/dist/client/ui-resolver/context.mjs.map +1 -1
- package/dist/client/ui-resolver/index.d.ts +7 -4
- package/dist/client/ui-resolver/index.mjs +6 -4
- package/dist/client/ui-resolver/input.d.ts +3 -4
- package/dist/client/ui-resolver/input.d.ts.map +1 -1
- package/dist/client/ui-resolver/input.mjs +2 -2
- package/dist/client/ui-resolver/input.mjs.map +1 -1
- package/dist/client/ui-resolver/navigation-menu.d.ts +1 -2
- package/dist/client/ui-resolver/navigation-menu.d.ts.map +1 -1
- package/dist/client/ui-resolver/recipe.d.ts +95 -0
- package/dist/client/ui-resolver/recipe.d.ts.map +1 -0
- package/dist/client/ui-resolver/recipe.mjs +134 -0
- package/dist/client/ui-resolver/recipe.mjs.map +1 -0
- package/dist/client/ui-resolver/toggle.d.ts +2 -2
- package/dist/client/ui-resolver/toggle.mjs +2 -2
- package/dist/client/ui-resolver/toggle.mjs.map +1 -1
- package/dist/client/ui-resolver/types.d.ts +14 -0
- package/dist/client/ui-resolver/types.d.ts.map +1 -0
- package/dist/client/ui-resolver/types.mjs +1 -0
- package/dist/client/wishlist/wishlist-drawer.mjs +4 -4
- package/dist/client/wishlist/wishlist-drawer.mjs.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","names":[],"sources":["../../../src/client/ui-resolver/button.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"button.d.ts","names":[],"sources":["../../../src/client/ui-resolver/button.tsx"],"mappings":";;;;iBAaS,MAAA,CAAA;EAAA,GAAY;AAAA,GAAS,WAAA,GAAW,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Button as Button$1, buttonVariants } from "../ui/button.mjs";
|
|
2
|
+
import { Button as Button$1, buttonRecipe, buttonVariants } from "../ui/button.mjs";
|
|
3
3
|
import { useCustomComponent } from "./context.mjs";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -10,6 +10,6 @@ function Button({ ...props }) {
|
|
|
10
10
|
return /* @__PURE__ */ jsx(Button$1, { ...props });
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
|
-
export { Button, buttonVariants };
|
|
13
|
+
export { Button, buttonRecipe, buttonVariants };
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=button.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.mjs","names":["DefaultButton"],"sources":["../../../src/client/ui-resolver/button.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {
|
|
1
|
+
{"version":3,"file":"button.mjs","names":["DefaultButton"],"sources":["../../../src/client/ui-resolver/button.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport {\n Button as DefaultButton,\n buttonRecipe,\n buttonVariants,\n type ButtonProps,\n type ButtonVariant,\n type ButtonSize,\n} from \"../ui/button\";\nimport { useCustomComponent } from \"./context\";\n\nfunction Button({ ...props }: ButtonProps) {\n const Custom = useCustomComponent(\"button\");\n if (Custom) return <Custom {...props} />;\n return <DefaultButton {...props} />;\n}\n\nexport {\n Button,\n buttonRecipe,\n buttonVariants,\n type ButtonProps,\n type ButtonVariant,\n type ButtonSize,\n};\n"],"mappings":";;;;;;AAaA,SAAS,OAAO,EAAE,GAAG,SAAsB;CACzC,MAAM,SAAS,mBAAmB,SAAS;AAC3C,KAAI,OAAQ,QAAO,oBAAC,QAAD,EAAQ,GAAI,OAAS,CAAA;AACxC,QAAO,oBAACA,UAAD,EAAe,GAAI,OAAS,CAAA"}
|
|
@@ -12,6 +12,19 @@ declare const CardTitle: typeof CardTitle$1;
|
|
|
12
12
|
declare const CardAction: typeof CardAction$1;
|
|
13
13
|
declare const CardDescription: typeof CardDescription$1;
|
|
14
14
|
declare const CardContent: typeof CardContent$1;
|
|
15
|
+
declare const cardRecipe: (props?: ({
|
|
16
|
+
[x: string]: string | undefined;
|
|
17
|
+
} & {
|
|
18
|
+
className?: Partial<Record<"root" | "content" | "title" | "description" | "header" | "action" | "footer", string>> | undefined;
|
|
19
|
+
}) | undefined) => {
|
|
20
|
+
root: string;
|
|
21
|
+
content: string;
|
|
22
|
+
title: string;
|
|
23
|
+
description: string;
|
|
24
|
+
header: string;
|
|
25
|
+
action: string;
|
|
26
|
+
footer: string;
|
|
27
|
+
};
|
|
15
28
|
//#endregion
|
|
16
|
-
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
29
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, cardRecipe };
|
|
17
30
|
//# sourceMappingURL=card.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.d.ts","names":[],"sources":["../../../src/client/ui-resolver/card.tsx"],"mappings":";;;;;iBAMS,IAAA,CAAA;EAAA,GAAU;AAAA,GAAS,OAAA,CAAM,cAAA,QAAsB,MAAA,IAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cAMnE,UAAA,SAAU,YAAA;AAAA,cACV,UAAA,SAAU,YAAA;AAAA,cACV,SAAA,SAAS,WAAA;AAAA,cACT,UAAA,SAAU,YAAA;AAAA,cACV,eAAA,SAAe,iBAAA;AAAA,cACf,WAAA,SAAW,aAAA"}
|
|
1
|
+
{"version":3,"file":"card.d.ts","names":[],"sources":["../../../src/client/ui-resolver/card.tsx"],"mappings":";;;;;iBAMS,IAAA,CAAA;EAAA,GAAU;AAAA,GAAS,OAAA,CAAM,cAAA,QAAsB,MAAA,IAAiB,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cAMnE,UAAA,SAAU,YAAA;AAAA,cACV,UAAA,SAAU,YAAA;AAAA,cACV,SAAA,SAAS,WAAA;AAAA,cACT,UAAA,SAAU,YAAA;AAAA,cACV,eAAA,SAAe,iBAAA;AAAA,cACf,WAAA,SAAW,aAAA;AAAA,cAEX,UAAA,GAAU,KAAA;EAAA;;cAAyB,OAAA,CAAA,MAAA;AAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCustomComponent } from "./context.mjs";
|
|
3
|
-
import { Card as Card$1, CardAction as CardAction$1, CardContent as CardContent$1, CardDescription as CardDescription$1, CardFooter as CardFooter$1, CardHeader as CardHeader$1, CardTitle as CardTitle$1 } from "../ui/card.mjs";
|
|
3
|
+
import { Card as Card$1, CardAction as CardAction$1, CardContent as CardContent$1, CardDescription as CardDescription$1, CardFooter as CardFooter$1, CardHeader as CardHeader$1, CardTitle as CardTitle$1, cardRecipe as cardRecipe$1 } from "../ui/card.mjs";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/client/ui-resolver/card.tsx
|
|
@@ -15,7 +15,8 @@ const CardTitle = CardTitle$1;
|
|
|
15
15
|
const CardAction = CardAction$1;
|
|
16
16
|
const CardDescription = CardDescription$1;
|
|
17
17
|
const CardContent = CardContent$1;
|
|
18
|
+
const cardRecipe = cardRecipe$1;
|
|
18
19
|
//#endregion
|
|
19
|
-
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle };
|
|
20
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, cardRecipe };
|
|
20
21
|
|
|
21
22
|
//# sourceMappingURL=card.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card.mjs","names":["DefaultCard.Card","DefaultCard.CardHeader","DefaultCard.CardFooter","DefaultCard.CardTitle","DefaultCard.CardAction","DefaultCard.CardDescription","DefaultCard.CardContent"],"sources":["../../../src/client/ui-resolver/card.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as DefaultCard from \"../ui/card\";\nimport { useCustomComponent } from \"./context\";\n\nfunction Card({ ...props }: React.ComponentProps<typeof DefaultCard.Card>) {\n const Custom = useCustomComponent(\"card\");\n if (Custom) return <Custom {...props} />;\n return <DefaultCard.Card {...props} />;\n}\n\nconst CardHeader = DefaultCard.CardHeader;\nconst CardFooter = DefaultCard.CardFooter;\nconst CardTitle = DefaultCard.CardTitle;\nconst CardAction = DefaultCard.CardAction;\nconst CardDescription = DefaultCard.CardDescription;\nconst CardContent = DefaultCard.CardContent;\n\nexport {
|
|
1
|
+
{"version":3,"file":"card.mjs","names":["DefaultCard.Card","DefaultCard.CardHeader","DefaultCard.CardFooter","DefaultCard.CardTitle","DefaultCard.CardAction","DefaultCard.CardDescription","DefaultCard.CardContent","DefaultCard.cardRecipe"],"sources":["../../../src/client/ui-resolver/card.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport * as DefaultCard from \"../ui/card\";\nimport { useCustomComponent } from \"./context\";\n\nfunction Card({ ...props }: React.ComponentProps<typeof DefaultCard.Card>) {\n const Custom = useCustomComponent(\"card\");\n if (Custom) return <Custom {...props} />;\n return <DefaultCard.Card {...props} />;\n}\n\nconst CardHeader = DefaultCard.CardHeader;\nconst CardFooter = DefaultCard.CardFooter;\nconst CardTitle = DefaultCard.CardTitle;\nconst CardAction = DefaultCard.CardAction;\nconst CardDescription = DefaultCard.CardDescription;\nconst CardContent = DefaultCard.CardContent;\n\nconst cardRecipe = DefaultCard.cardRecipe;\n\nexport {\n Card,\n CardHeader,\n CardFooter,\n CardTitle,\n CardAction,\n CardDescription,\n CardContent,\n cardRecipe,\n};\n"],"mappings":";;;;;;AAMA,SAAS,KAAK,EAAE,GAAG,SAAwD;CACzE,MAAM,SAAS,mBAAmB,OAAO;AACzC,KAAI,OAAQ,QAAO,oBAAC,QAAD,EAAQ,GAAI,OAAS,CAAA;AACxC,QAAO,oBAACA,QAAD,EAAkB,GAAI,OAAS,CAAA;;AAGxC,MAAM,aAAaC;AACnB,MAAM,aAAaC;AACnB,MAAM,YAAYC;AAClB,MAAM,aAAaC;AACnB,MAAM,kBAAkBC;AACxB,MAAM,cAAcC;AAEpB,MAAM,aAAaC"}
|
|
@@ -47,7 +47,7 @@ function useComponentSet(component, inline) {
|
|
|
47
47
|
* in which case the component should use its own default.
|
|
48
48
|
*/
|
|
49
49
|
function useVariantDefault(component) {
|
|
50
|
-
return SET_VARIANT_DEFAULTS[useContext(ComponentSetContext).base][component];
|
|
50
|
+
return SET_VARIANT_DEFAULTS[useContext(ComponentSetContext).base]?.[component];
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Returns the custom component override for the given slot, or undefined
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.mjs","names":[],"sources":["../../../src/client/ui-resolver/context.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, useMemo } from \"react\";\n\nexport type ComponentSet = \"default\" | \"brutalist\" | \"editorial\" | \"organic\" | \"minimal\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CustomComponentMap = Partial<Record<ComponentName, React.ComponentType<any>>>;\n\nexport type ComponentName =\n | \"accordion\"\n | \"alert\"\n | \"avatar\"\n | \"breadcrumb\"\n | \"button\"\n | \"card\"\n | \"carousel\"\n | \"checkbox\"\n | \"collapsible\"\n | \"dialog\"\n | \"hover-card\"\n | \"input\"\n | \"label\"\n | \"navigation-menu\"\n | \"pagination\"\n | \"popover\"\n | \"progress\"\n | \"select\"\n | \"separator\"\n | \"sheet\"\n | \"stepper\"\n | \"tabs\"\n | \"toggle\"\n | \"toggle-group\"\n | \"tooltip\";\n\nexport type ComponentOverrides = Partial<Record<ComponentName, ComponentSet>>;\n\nexport type VariantDefaults = {\n hero?: \"overlay\" | \"split\" | \"image-only\" | \"minimal\" | \"banner\";\n productCard?: \"gallery\" | \"horizontal\" | \"minimal\" | \"list\" | \"stripped\";\n gallery?: \"grid\" | \"masonry\" | \"filmstrip\";\n};\n\nconst SET_VARIANT_DEFAULTS: Record<ComponentSet, VariantDefaults> = {\n default: {},\n brutalist: { hero: \"banner\", productCard: \"horizontal\" },\n editorial: { gallery: \"masonry\" },\n organic: {},\n minimal: { hero: \"minimal\", productCard: \"stripped\", gallery: \"filmstrip\" },\n};\n\ninterface ComponentSetConfig {\n base: ComponentSet;\n overrides: ComponentOverrides;\n}\n\nconst ComponentSetContext = createContext<ComponentSetConfig>({\n base: \"default\",\n overrides: {},\n});\n\nconst CustomComponentContext = createContext<CustomComponentMap>({});\n\nexport function ComponentSetProvider({\n value,\n overrides,\n customComponents,\n children,\n}: {\n value: ComponentSet;\n overrides?: ComponentOverrides;\n customComponents?: CustomComponentMap;\n children: React.ReactNode;\n}) {\n const config = useMemo(() => ({ base: value, overrides: overrides ?? {} }), [value, overrides]);\n const components = useMemo(() => customComponents ?? {}, [customComponents]);\n return (\n <ComponentSetContext.Provider value={config}>\n <CustomComponentContext.Provider value={components}>\n {children}\n </CustomComponentContext.Provider>\n </ComponentSetContext.Provider>\n );\n}\n\nexport function useComponentSet(component?: ComponentName, inline?: ComponentSet): ComponentSet {\n const config = useContext(ComponentSetContext);\n if (inline) return inline;\n if (component && config.overrides[component]) {\n return config.overrides[component];\n }\n return config.base;\n}\n\n/**\n * Returns the preferred variant for a given component slot based on the\n * active component set. Returns undefined if the set has no preference,\n * in which case the component should use its own default.\n */\nexport function useVariantDefault<K extends keyof VariantDefaults>(\n component: K,\n): VariantDefaults[K] | undefined {\n const config = useContext(ComponentSetContext);\n return SET_VARIANT_DEFAULTS[config.base][component];\n}\n\n/**\n * Returns the custom component override for the given slot, or undefined\n * if no override was provided via `EnadProvider`'s `components` prop.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useCustomComponent<T extends React.ComponentType<any> = React.ComponentType<any>>(\n name: ComponentName,\n): T | undefined {\n const map = useContext(CustomComponentContext);\n return map[name] as T | undefined;\n}\n"],"mappings":";;;;AA4CA,MAAM,uBAA8D;CAClE,SAAS,EAAE;CACX,WAAW;EAAE,MAAM;EAAU,aAAa;EAAc;CACxD,WAAW,EAAE,SAAS,WAAW;CACjC,SAAS,EAAE;CACX,SAAS;EAAE,MAAM;EAAW,aAAa;EAAY,SAAS;EAAa;CAC5E;AAOD,MAAM,sBAAsB,cAAkC;CAC5D,MAAM;CACN,WAAW,EAAE;CACd,CAAC;AAEF,MAAM,yBAAyB,cAAkC,EAAE,CAAC;AAEpE,SAAgB,qBAAqB,EACnC,OACA,WACA,kBACA,YAMC;CACD,MAAM,SAAS,eAAe;EAAE,MAAM;EAAO,WAAW,aAAa,EAAE;EAAE,GAAG,CAAC,OAAO,UAAU,CAAC;CAC/F,MAAM,aAAa,cAAc,oBAAoB,EAAE,EAAE,CAAC,iBAAiB,CAAC;AAC5E,QACE,oBAAC,oBAAoB,UAArB;EAA8B,OAAO;YACnC,oBAAC,uBAAuB,UAAxB;GAAiC,OAAO;GACrC;GAC+B,CAAA;EACL,CAAA;;AAInC,SAAgB,gBAAgB,WAA2B,QAAqC;CAC9F,MAAM,SAAS,WAAW,oBAAoB;AAC9C,KAAI,OAAQ,QAAO;AACnB,KAAI,aAAa,OAAO,UAAU,WAChC,QAAO,OAAO,UAAU;AAE1B,QAAO,OAAO;;;;;;;AAQhB,SAAgB,kBACd,WACgC;AAEhC,QAAO,qBADQ,WAAW,oBAAoB,CACX,
|
|
1
|
+
{"version":3,"file":"context.mjs","names":[],"sources":["../../../src/client/ui-resolver/context.tsx"],"sourcesContent":["\"use client\";\n\nimport { createContext, useContext, useMemo } from \"react\";\n\nexport type ComponentSet = \"default\" | \"brutalist\" | \"editorial\" | \"organic\" | \"minimal\";\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type CustomComponentMap = Partial<Record<ComponentName, React.ComponentType<any>>>;\n\nexport type ComponentName =\n | \"accordion\"\n | \"alert\"\n | \"avatar\"\n | \"breadcrumb\"\n | \"button\"\n | \"card\"\n | \"carousel\"\n | \"checkbox\"\n | \"collapsible\"\n | \"dialog\"\n | \"hover-card\"\n | \"input\"\n | \"label\"\n | \"navigation-menu\"\n | \"pagination\"\n | \"popover\"\n | \"progress\"\n | \"select\"\n | \"separator\"\n | \"sheet\"\n | \"stepper\"\n | \"tabs\"\n | \"toggle\"\n | \"toggle-group\"\n | \"tooltip\";\n\nexport type ComponentOverrides = Partial<Record<ComponentName, ComponentSet>>;\n\nexport type VariantDefaults = {\n hero?: \"overlay\" | \"split\" | \"image-only\" | \"minimal\" | \"banner\";\n productCard?: \"gallery\" | \"horizontal\" | \"minimal\" | \"list\" | \"stripped\";\n gallery?: \"grid\" | \"masonry\" | \"filmstrip\";\n};\n\nconst SET_VARIANT_DEFAULTS: Record<ComponentSet, VariantDefaults> = {\n default: {},\n brutalist: { hero: \"banner\", productCard: \"horizontal\" },\n editorial: { gallery: \"masonry\" },\n organic: {},\n minimal: { hero: \"minimal\", productCard: \"stripped\", gallery: \"filmstrip\" },\n};\n\ninterface ComponentSetConfig {\n base: ComponentSet;\n overrides: ComponentOverrides;\n}\n\nconst ComponentSetContext = createContext<ComponentSetConfig>({\n base: \"default\",\n overrides: {},\n});\n\nconst CustomComponentContext = createContext<CustomComponentMap>({});\n\nexport function ComponentSetProvider({\n value,\n overrides,\n customComponents,\n children,\n}: {\n value: ComponentSet;\n overrides?: ComponentOverrides;\n customComponents?: CustomComponentMap;\n children: React.ReactNode;\n}) {\n const config = useMemo(() => ({ base: value, overrides: overrides ?? {} }), [value, overrides]);\n const components = useMemo(() => customComponents ?? {}, [customComponents]);\n return (\n <ComponentSetContext.Provider value={config}>\n <CustomComponentContext.Provider value={components}>\n {children}\n </CustomComponentContext.Provider>\n </ComponentSetContext.Provider>\n );\n}\n\nexport function useComponentSet(component?: ComponentName, inline?: ComponentSet): ComponentSet {\n const config = useContext(ComponentSetContext);\n if (inline) return inline;\n if (component && config.overrides[component]) {\n return config.overrides[component];\n }\n return config.base;\n}\n\n/**\n * Returns the preferred variant for a given component slot based on the\n * active component set. Returns undefined if the set has no preference,\n * in which case the component should use its own default.\n */\nexport function useVariantDefault<K extends keyof VariantDefaults>(\n component: K,\n): VariantDefaults[K] | undefined {\n const config = useContext(ComponentSetContext);\n return SET_VARIANT_DEFAULTS[config.base]?.[component];\n}\n\n/**\n * Returns the custom component override for the given slot, or undefined\n * if no override was provided via `EnadProvider`'s `components` prop.\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function useCustomComponent<T extends React.ComponentType<any> = React.ComponentType<any>>(\n name: ComponentName,\n): T | undefined {\n const map = useContext(CustomComponentContext);\n return map[name] as T | undefined;\n}\n"],"mappings":";;;;AA4CA,MAAM,uBAA8D;CAClE,SAAS,EAAE;CACX,WAAW;EAAE,MAAM;EAAU,aAAa;EAAc;CACxD,WAAW,EAAE,SAAS,WAAW;CACjC,SAAS,EAAE;CACX,SAAS;EAAE,MAAM;EAAW,aAAa;EAAY,SAAS;EAAa;CAC5E;AAOD,MAAM,sBAAsB,cAAkC;CAC5D,MAAM;CACN,WAAW,EAAE;CACd,CAAC;AAEF,MAAM,yBAAyB,cAAkC,EAAE,CAAC;AAEpE,SAAgB,qBAAqB,EACnC,OACA,WACA,kBACA,YAMC;CACD,MAAM,SAAS,eAAe;EAAE,MAAM;EAAO,WAAW,aAAa,EAAE;EAAE,GAAG,CAAC,OAAO,UAAU,CAAC;CAC/F,MAAM,aAAa,cAAc,oBAAoB,EAAE,EAAE,CAAC,iBAAiB,CAAC;AAC5E,QACE,oBAAC,oBAAoB,UAArB;EAA8B,OAAO;YACnC,oBAAC,uBAAuB,UAAxB;GAAiC,OAAO;GACrC;GAC+B,CAAA;EACL,CAAA;;AAInC,SAAgB,gBAAgB,WAA2B,QAAqC;CAC9F,MAAM,SAAS,WAAW,oBAAoB;AAC9C,KAAI,OAAQ,QAAO;AACnB,KAAI,aAAa,OAAO,UAAU,WAChC,QAAO,OAAO,UAAU;AAE1B,QAAO,OAAO;;;;;;;AAQhB,SAAgB,kBACd,WACgC;AAEhC,QAAO,qBADQ,WAAW,oBAAoB,CACX,QAAQ;;;;;;AAQ7C,SAAgB,mBACd,MACe;AAEf,QADY,WAAW,uBAAuB,CACnC"}
|
|
@@ -3,14 +3,17 @@ import { Accordion, AccordionContent, AccordionGroup, AccordionItem, AccordionTr
|
|
|
3
3
|
import { Alert, AlertDescription, AlertTitle } from "./alert.js";
|
|
4
4
|
import { Avatar, AvatarFallback, AvatarImage } from "./avatar.js";
|
|
5
5
|
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./breadcrumb.js";
|
|
6
|
-
import {
|
|
6
|
+
import { SemanticColor, Size, Variant } from "./types.js";
|
|
7
|
+
import { ButtonProps, ButtonSize, ButtonVariant, buttonRecipe, buttonVariants } from "../ui/button.js";
|
|
7
8
|
import { Button } from "./button.js";
|
|
8
|
-
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./card.js";
|
|
9
|
+
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, cardRecipe } from "./card.js";
|
|
9
10
|
import { Carousel, CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "./carousel.js";
|
|
10
11
|
import { Checkbox } from "./checkbox.js";
|
|
11
12
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./collapsible.js";
|
|
12
13
|
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./dialog.js";
|
|
13
14
|
import { HoverCard, HoverCardContent, HoverCardTrigger } from "./hover-card.js";
|
|
15
|
+
import { defineRecipe, defineSlotRecipe } from "./recipe.js";
|
|
16
|
+
import { InputProps, inputRecipe } from "../ui/input.js";
|
|
14
17
|
import { Input } from "./input.js";
|
|
15
18
|
import { Label } from "./label.js";
|
|
16
19
|
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue } from "./select.js";
|
|
@@ -19,11 +22,11 @@ import { NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, Navigat
|
|
|
19
22
|
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./popover.js";
|
|
20
23
|
import { Separator } from "./separator.js";
|
|
21
24
|
import { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger } from "./sheet.js";
|
|
22
|
-
import { toggleVariants } from "../ui/toggle.js";
|
|
25
|
+
import { toggleRecipe, toggleVariants } from "../ui/toggle.js";
|
|
23
26
|
import { Toggle } from "./toggle.js";
|
|
24
27
|
import { ToggleGroup, ToggleGroupItem } from "./toggle-group.js";
|
|
25
28
|
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip.js";
|
|
26
29
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./tabs.js";
|
|
27
30
|
import { Progress } from "./progress.js";
|
|
28
31
|
import { Stepper, StepperDescription, StepperItem, StepperSeparator, StepperTitle } from "./stepper.js";
|
|
29
|
-
export { Accordion, AccordionContent, AccordionGroup, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type ComponentName, type ComponentOverrides, type ComponentSet, ComponentSetProvider, type CustomComponentMap, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Stepper, StepperDescription, StepperItem, StepperSeparator, StepperTitle, Tabs, TabsContent, TabsList, TabsTrigger, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type VariantDefaults, buttonVariants, navigationMenuTriggerStyle, toggleVariants, useComponentSet, useCustomComponent, useVariantDefault };
|
|
32
|
+
export { Accordion, AccordionContent, AccordionGroup, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, type ButtonProps, type ButtonSize, type ButtonVariant, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, type CarouselApi, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, type ComponentName, type ComponentOverrides, type ComponentSet, ComponentSetProvider, type CustomComponentMap, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, HoverCard, HoverCardContent, HoverCardTrigger, Input, type InputProps, Label, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, type SemanticColor, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, type Size, Stepper, StepperDescription, StepperItem, StepperSeparator, StepperTitle, Tabs, TabsContent, TabsList, TabsTrigger, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, type Variant, type VariantDefaults, buttonRecipe, buttonVariants, cardRecipe, defineRecipe, defineSlotRecipe, inputRecipe, navigationMenuTriggerStyle, toggleRecipe, toggleVariants, useComponentSet, useCustomComponent, useVariantDefault };
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { defineRecipe, defineSlotRecipe } from "./recipe.mjs";
|
|
2
|
+
import { buttonRecipe, buttonVariants } from "../ui/button.mjs";
|
|
3
|
+
import { inputRecipe } from "../ui/input.mjs";
|
|
2
4
|
import { ComponentSetProvider, useComponentSet, useCustomComponent, useVariantDefault } from "./context.mjs";
|
|
3
5
|
import { Button } from "./button.mjs";
|
|
4
6
|
import { Input } from "./input.mjs";
|
|
@@ -8,11 +10,11 @@ import { Checkbox } from "./checkbox.mjs";
|
|
|
8
10
|
import { Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious } from "./pagination.mjs";
|
|
9
11
|
import { Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "./breadcrumb.mjs";
|
|
10
12
|
import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "./popover.mjs";
|
|
11
|
-
import { toggleVariants } from "../ui/toggle.mjs";
|
|
13
|
+
import { toggleRecipe, toggleVariants } from "../ui/toggle.mjs";
|
|
12
14
|
import { Accordion, AccordionContent, AccordionGroup, AccordionItem, AccordionTrigger } from "./accordion.mjs";
|
|
13
15
|
import { Alert, AlertDescription, AlertTitle } from "./alert.mjs";
|
|
14
16
|
import { Avatar, AvatarFallback, AvatarImage } from "./avatar.mjs";
|
|
15
|
-
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "./card.mjs";
|
|
17
|
+
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, cardRecipe } from "./card.mjs";
|
|
16
18
|
import { Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious } from "./carousel.mjs";
|
|
17
19
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger } from "./collapsible.mjs";
|
|
18
20
|
import { Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger } from "./dialog.mjs";
|
|
@@ -26,4 +28,4 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tool
|
|
|
26
28
|
import { Tabs, TabsContent, TabsList, TabsTrigger } from "./tabs.mjs";
|
|
27
29
|
import { Progress } from "./progress.mjs";
|
|
28
30
|
import { Stepper, StepperDescription, StepperItem, StepperSeparator, StepperTitle } from "./stepper.mjs";
|
|
29
|
-
export { Accordion, AccordionContent, AccordionGroup, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ComponentSetProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Stepper, StepperDescription, StepperItem, StepperSeparator, StepperTitle, Tabs, TabsContent, TabsList, TabsTrigger, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonVariants, navigationMenuTriggerStyle, toggleVariants, useComponentSet, useCustomComponent, useVariantDefault };
|
|
31
|
+
export { Accordion, AccordionContent, AccordionGroup, AccordionItem, AccordionTrigger, Alert, AlertDescription, AlertTitle, Avatar, AvatarFallback, AvatarImage, Breadcrumb, BreadcrumbEllipsis, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator, Button, Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, Carousel, CarouselContent, CarouselItem, CarouselNext, CarouselPrevious, Checkbox, Collapsible, CollapsibleContent, CollapsibleTrigger, ComponentSetProvider, Dialog, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogOverlay, DialogPortal, DialogTitle, DialogTrigger, HoverCard, HoverCardContent, HoverCardTrigger, Input, Label, NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, Pagination, PaginationContent, PaginationEllipsis, PaginationItem, PaginationLink, PaginationNext, PaginationPrevious, Popover, PopoverAnchor, PopoverContent, PopoverTrigger, Progress, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue, Separator, Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetTitle, SheetTrigger, Stepper, StepperDescription, StepperItem, StepperSeparator, StepperTitle, Tabs, TabsContent, TabsList, TabsTrigger, Toggle, ToggleGroup, ToggleGroupItem, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, buttonRecipe, buttonVariants, cardRecipe, defineRecipe, defineSlotRecipe, inputRecipe, navigationMenuTriggerStyle, toggleRecipe, toggleVariants, useComponentSet, useCustomComponent, useVariantDefault };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as React$1 from "react";
|
|
1
|
+
import { InputProps, inputRecipe } from "../ui/input.js";
|
|
3
2
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
3
|
|
|
5
4
|
//#region src/client/ui-resolver/input.d.ts
|
|
6
5
|
declare function Input({
|
|
7
6
|
...props
|
|
8
|
-
}:
|
|
7
|
+
}: InputProps): react_jsx_runtime0.JSX.Element;
|
|
9
8
|
//#endregion
|
|
10
|
-
export { Input };
|
|
9
|
+
export { Input, type InputProps, inputRecipe };
|
|
11
10
|
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","names":[],"sources":["../../../src/client/ui-resolver/input.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"input.d.ts","names":[],"sources":["../../../src/client/ui-resolver/input.tsx"],"mappings":";;;;iBAMS,KAAA,CAAA;EAAA,GAAW;AAAA,GAAS,UAAA,GAAU,kBAAA,CAAA,GAAA,CAAA,OAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { Input as Input$1 } from "../ui/input.mjs";
|
|
2
|
+
import { Input as Input$1, inputRecipe } from "../ui/input.mjs";
|
|
3
3
|
import { useCustomComponent } from "./context.mjs";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
@@ -10,6 +10,6 @@ function Input({ ...props }) {
|
|
|
10
10
|
return /* @__PURE__ */ jsx(Input$1, { ...props });
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
|
-
export { Input };
|
|
13
|
+
export { Input, inputRecipe };
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=input.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.mjs","names":["DefaultInput"],"sources":["../../../src/client/ui-resolver/input.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Input as DefaultInput } from \"../ui/input\";\nimport { useCustomComponent } from \"./context\";\n\nfunction Input({ ...props }:
|
|
1
|
+
{"version":3,"file":"input.mjs","names":["DefaultInput"],"sources":["../../../src/client/ui-resolver/input.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Input as DefaultInput, inputRecipe, type InputProps } from \"../ui/input\";\nimport { useCustomComponent } from \"./context\";\n\nfunction Input({ ...props }: InputProps) {\n const Custom = useCustomComponent(\"input\");\n if (Custom) return <Custom {...props} />;\n return <DefaultInput {...props} />;\n}\n\nexport { Input, inputRecipe, type InputProps };\n"],"mappings":";;;;;;AAMA,SAAS,MAAM,EAAE,GAAG,SAAqB;CACvC,MAAM,SAAS,mBAAmB,QAAQ;AAC1C,KAAI,OAAQ,QAAO,oBAAC,QAAD,EAAQ,GAAI,OAAS,CAAA;AACxC,QAAO,oBAACA,SAAD,EAAc,GAAI,OAAS,CAAA"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { NavigationMenu as NavigationMenu$1, NavigationMenuContent as NavigationMenuContent$1, NavigationMenuIndicator as NavigationMenuIndicator$1, NavigationMenuItem as NavigationMenuItem$1, NavigationMenuLink as NavigationMenuLink$1, NavigationMenuList as NavigationMenuList$1, NavigationMenuTrigger as NavigationMenuTrigger$1, NavigationMenuViewport as NavigationMenuViewport$1 } from "../ui/navigation-menu.js";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
|
-
import * as class_variance_authority_types0 from "class-variance-authority/types";
|
|
5
4
|
|
|
6
5
|
//#region src/client/ui-resolver/navigation-menu.d.ts
|
|
7
6
|
declare function NavigationMenu({
|
|
@@ -14,7 +13,7 @@ declare const NavigationMenuTrigger: typeof NavigationMenuTrigger$1;
|
|
|
14
13
|
declare const NavigationMenuLink: typeof NavigationMenuLink$1;
|
|
15
14
|
declare const NavigationMenuIndicator: typeof NavigationMenuIndicator$1;
|
|
16
15
|
declare const NavigationMenuViewport: typeof NavigationMenuViewport$1;
|
|
17
|
-
declare const navigationMenuTriggerStyle: (
|
|
16
|
+
declare const navigationMenuTriggerStyle: () => string;
|
|
18
17
|
//#endregion
|
|
19
18
|
export { NavigationMenu, NavigationMenuContent, NavigationMenuIndicator, NavigationMenuItem, NavigationMenuLink, NavigationMenuList, NavigationMenuTrigger, NavigationMenuViewport, navigationMenuTriggerStyle };
|
|
20
19
|
//# sourceMappingURL=navigation-menu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"navigation-menu.d.ts","names":[],"sources":["../../../src/client/ui-resolver/navigation-menu.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"navigation-menu.d.ts","names":[],"sources":["../../../src/client/ui-resolver/navigation-menu.tsx"],"mappings":";;;;;iBAMS,cAAA,CAAA;EAAA,GAAoB;AAAA,GAAS,OAAA,CAAM,cAAA,QAAsB,gBAAA,IAA0B,kBAAA,CAAA,GAAA,CAAA,OAAA;AAAA,cAMtF,kBAAA,SAAkB,oBAAA;AAAA,cAClB,kBAAA,SAAkB,oBAAA;AAAA,cAClB,qBAAA,SAAqB,uBAAA;AAAA,cACrB,qBAAA,SAAqB,uBAAA;AAAA,cACrB,kBAAA,SAAkB,oBAAA;AAAA,cAClB,uBAAA,SAAuB,yBAAA;AAAA,cACvB,sBAAA,SAAsB,wBAAA;AAAA,cACtB,0BAAA"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
//#region src/client/ui-resolver/recipe.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Tailwind-native slot recipe system for compound components.
|
|
4
|
+
*
|
|
5
|
+
* Slot recipes coordinate variant styles across multiple parts of a compound
|
|
6
|
+
* component. Each slot gets its own class string, and variants can target
|
|
7
|
+
* specific slots or all slots at once.
|
|
8
|
+
*
|
|
9
|
+
* CSS variable contract:
|
|
10
|
+
* instance style → [data-component-set] CSS → :root token → hardcoded fallback
|
|
11
|
+
*
|
|
12
|
+
* Component sets override CSS variables in their [data-component-set="..."]
|
|
13
|
+
* blocks. Recipes consume those variables via Tailwind arbitrary values
|
|
14
|
+
* (e.g. h-[var(--enad-button-height)]), so changing the set changes the
|
|
15
|
+
* component's dimensions without touching JS.
|
|
16
|
+
*/
|
|
17
|
+
type SlotClassMap<S extends string> = Partial<Record<S, string>>;
|
|
18
|
+
interface SlotRecipeConfig<S extends string, V extends Record<string, Record<string, SlotClassMap<S>>>> {
|
|
19
|
+
slots: readonly S[];
|
|
20
|
+
base: SlotClassMap<S>;
|
|
21
|
+
variants?: V;
|
|
22
|
+
defaultVariants?: { [K in keyof V]?: keyof V[K] };
|
|
23
|
+
compoundVariants?: Array<{ [K in keyof V]?: keyof V[K] | Array<keyof V[K]> } & {
|
|
24
|
+
css: SlotClassMap<S>;
|
|
25
|
+
}>;
|
|
26
|
+
}
|
|
27
|
+
type VariantProps<V extends Record<string, Record<string, unknown>>> = { [K in keyof V]?: keyof V[K] };
|
|
28
|
+
type SlotRecipeResult<S extends string> = Record<S, string>;
|
|
29
|
+
interface RecipeConfig<V extends Record<string, Record<string, string>>> {
|
|
30
|
+
base?: string;
|
|
31
|
+
variants?: V;
|
|
32
|
+
defaultVariants?: { [K in keyof V]?: keyof V[K] };
|
|
33
|
+
compoundVariants?: Array<{ [K in keyof V]?: keyof V[K] | Array<keyof V[K]> } & {
|
|
34
|
+
css: string;
|
|
35
|
+
}>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Creates a slot recipe for compound components.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* const cardRecipe = defineSlotRecipe({
|
|
43
|
+
* slots: ["root", "header", "content", "footer"] as const,
|
|
44
|
+
* base: {
|
|
45
|
+
* root: "flex flex-col rounded-lg border",
|
|
46
|
+
* header: "grid items-start",
|
|
47
|
+
* content: "px-6",
|
|
48
|
+
* footer: "flex items-center px-6",
|
|
49
|
+
* },
|
|
50
|
+
* variants: {
|
|
51
|
+
* size: {
|
|
52
|
+
* sm: { root: "text-sm", content: "px-4" },
|
|
53
|
+
* md: { root: "text-base" },
|
|
54
|
+
* lg: { root: "text-lg", content: "px-8" },
|
|
55
|
+
* },
|
|
56
|
+
* },
|
|
57
|
+
* defaultVariants: { size: "md" },
|
|
58
|
+
* });
|
|
59
|
+
*
|
|
60
|
+
* const classes = cardRecipe({ size: "sm" });
|
|
61
|
+
* // classes.root → "flex flex-col rounded-lg border text-sm"
|
|
62
|
+
* // classes.content → "px-4" (merged via tailwind-merge)
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
declare function defineSlotRecipe<S extends string, V extends Record<string, Record<string, SlotClassMap<S>>>>(config: SlotRecipeConfig<S, V>): (props?: VariantProps<V> & {
|
|
66
|
+
className?: SlotClassMap<S>;
|
|
67
|
+
}) => SlotRecipeResult<S>;
|
|
68
|
+
/**
|
|
69
|
+
* Creates a single-slot recipe for simple components.
|
|
70
|
+
* Thin wrapper around defineSlotRecipe with a single "root" slot.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```ts
|
|
74
|
+
* const badgeRecipe = defineRecipe({
|
|
75
|
+
* base: "inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold",
|
|
76
|
+
* variants: {
|
|
77
|
+
* variant: {
|
|
78
|
+
* solid: "bg-primary text-primary-foreground",
|
|
79
|
+
* soft: "bg-primary/10 text-primary",
|
|
80
|
+
* outlined: "border border-current",
|
|
81
|
+
* },
|
|
82
|
+
* },
|
|
83
|
+
* defaultVariants: { variant: "solid" },
|
|
84
|
+
* });
|
|
85
|
+
*
|
|
86
|
+
* const classes = badgeRecipe({ variant: "soft" });
|
|
87
|
+
* // → "inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold bg-primary/10 text-primary"
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
declare function defineRecipe<V extends Record<string, Record<string, string>>>(config: RecipeConfig<V>): (props?: VariantProps<V> & {
|
|
91
|
+
className?: string;
|
|
92
|
+
}) => string;
|
|
93
|
+
//#endregion
|
|
94
|
+
export { defineRecipe, defineSlotRecipe };
|
|
95
|
+
//# sourceMappingURL=recipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe.d.ts","names":[],"sources":["../../../src/client/ui-resolver/recipe.ts"],"mappings":";;;;;;;;;;;;;;;;KAsBK,YAAA,qBAAiC,OAAA,CAAQ,MAAA,CAAO,CAAA;AAAA,UAE3C,gBAAA,6BAEE,MAAA,SAAe,MAAA,SAAe,YAAA,CAAa,CAAA;EAErD,KAAA,WAAgB,CAAA;EAChB,IAAA,EAAM,YAAA,CAAa,CAAA;EACnB,QAAA,GAAW,CAAA;EACX,eAAA,iBACc,CAAA,UAAW,CAAA,CAAE,CAAA;EAE3B,gBAAA,GAAmB,KAAA,eAEH,CAAA,UAAW,CAAA,CAAE,CAAA,IAAK,KAAA,OAAY,CAAA,CAAE,CAAA;IAE5C,GAAA,EAAK,YAAA,CAAa,CAAA;EAAA;AAAA;AAAA,KAKnB,YAAA,WAAuB,MAAA,SAAe,MAAA,oCAC7B,CAAA,UAAW,CAAA,CAAE,CAAA;AAAA,KAGtB,gBAAA,qBAAqC,MAAA,CAAO,CAAA;AAAA,UAEvC,YAAA,WAAuB,MAAA,SAAe,MAAA;EAC9C,IAAA;EACA,QAAA,GAAW,CAAA;EACX,eAAA,iBACc,CAAA,UAAW,CAAA,CAAE,CAAA;EAE3B,gBAAA,GAAmB,KAAA,eAEH,CAAA,UAAW,CAAA,CAAE,CAAA,IAAK,KAAA,OAAY,CAAA,CAAE,CAAA;IAE5C,GAAA;EAAA;AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;AArBmB;iBA+ET,gBAAA,6BAEJ,MAAA,SAAe,MAAA,SAAe,YAAA,CAAa,CAAA,IAAA,CACrD,MAAA,EAAQ,gBAAA,CAAiB,CAAA,EAAG,CAAA,KAI1B,KAAA,GAAQ,YAAA,CAAa,CAAA;EAAO,SAAA,GAAY,YAAA,CAAa,CAAA;AAAA,MACpD,gBAAA,CAAiB,CAAA;;;;;;;;;;;;;;;;AAjFM;;;;;;;iBAuKZ,YAAA,WAAuB,MAAA,SAAe,MAAA,kBAAA,CACpD,MAAA,EAAQ,YAAA,CAAa,CAAA,KAIQ,KAAA,GAAQ,YAAA,CAAa,CAAA;EAAO,SAAA;AAAA"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { cn } from "../ui/utils.mjs";
|
|
2
|
+
//#region src/client/ui-resolver/recipe.ts
|
|
3
|
+
/**
|
|
4
|
+
* Tailwind-native slot recipe system for compound components.
|
|
5
|
+
*
|
|
6
|
+
* Slot recipes coordinate variant styles across multiple parts of a compound
|
|
7
|
+
* component. Each slot gets its own class string, and variants can target
|
|
8
|
+
* specific slots or all slots at once.
|
|
9
|
+
*
|
|
10
|
+
* CSS variable contract:
|
|
11
|
+
* instance style → [data-component-set] CSS → :root token → hardcoded fallback
|
|
12
|
+
*
|
|
13
|
+
* Component sets override CSS variables in their [data-component-set="..."]
|
|
14
|
+
* blocks. Recipes consume those variables via Tailwind arbitrary values
|
|
15
|
+
* (e.g. h-[var(--enad-button-height)]), so changing the set changes the
|
|
16
|
+
* component's dimensions without touching JS.
|
|
17
|
+
*/
|
|
18
|
+
function matchesCompoundCondition(condition, resolved) {
|
|
19
|
+
for (const key of Object.keys(condition)) {
|
|
20
|
+
if (key === "css") continue;
|
|
21
|
+
const expected = condition[key];
|
|
22
|
+
const actual = resolved[key];
|
|
23
|
+
if (Array.isArray(expected)) {
|
|
24
|
+
if (!expected.includes(actual)) return false;
|
|
25
|
+
} else if (actual !== expected) return false;
|
|
26
|
+
}
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Creates a slot recipe for compound components.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const cardRecipe = defineSlotRecipe({
|
|
35
|
+
* slots: ["root", "header", "content", "footer"] as const,
|
|
36
|
+
* base: {
|
|
37
|
+
* root: "flex flex-col rounded-lg border",
|
|
38
|
+
* header: "grid items-start",
|
|
39
|
+
* content: "px-6",
|
|
40
|
+
* footer: "flex items-center px-6",
|
|
41
|
+
* },
|
|
42
|
+
* variants: {
|
|
43
|
+
* size: {
|
|
44
|
+
* sm: { root: "text-sm", content: "px-4" },
|
|
45
|
+
* md: { root: "text-base" },
|
|
46
|
+
* lg: { root: "text-lg", content: "px-8" },
|
|
47
|
+
* },
|
|
48
|
+
* },
|
|
49
|
+
* defaultVariants: { size: "md" },
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* const classes = cardRecipe({ size: "sm" });
|
|
53
|
+
* // classes.root → "flex flex-col rounded-lg border text-sm"
|
|
54
|
+
* // classes.content → "px-4" (merged via tailwind-merge)
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
function defineSlotRecipe(config) {
|
|
58
|
+
const { slots, base, variants, defaultVariants, compoundVariants } = config;
|
|
59
|
+
return function slotRecipe(props) {
|
|
60
|
+
const resolved = {};
|
|
61
|
+
if (variants) for (const variantKey of Object.keys(variants)) {
|
|
62
|
+
const fromProps = props?.[variantKey];
|
|
63
|
+
const fromDefaults = defaultVariants?.[variantKey];
|
|
64
|
+
resolved[variantKey] = fromProps ?? fromDefaults;
|
|
65
|
+
}
|
|
66
|
+
const result = {};
|
|
67
|
+
for (const slot of slots) {
|
|
68
|
+
const parts = [];
|
|
69
|
+
if (base[slot]) parts.push(base[slot]);
|
|
70
|
+
if (variants) for (const [variantKey, variantValues] of Object.entries(variants)) {
|
|
71
|
+
const value = resolved[variantKey];
|
|
72
|
+
if (value != null && variantValues[value]) {
|
|
73
|
+
const slotClasses = variantValues[value][slot];
|
|
74
|
+
if (slotClasses) parts.push(slotClasses);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (compoundVariants) {
|
|
78
|
+
for (const compound of compoundVariants) if (matchesCompoundCondition(compound, resolved)) {
|
|
79
|
+
const slotClasses = compound.css[slot];
|
|
80
|
+
if (slotClasses) parts.push(slotClasses);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (props?.className?.[slot]) parts.push(props.className[slot]);
|
|
84
|
+
result[slot] = cn(...parts);
|
|
85
|
+
}
|
|
86
|
+
return result;
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Creates a single-slot recipe for simple components.
|
|
91
|
+
* Thin wrapper around defineSlotRecipe with a single "root" slot.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* const badgeRecipe = defineRecipe({
|
|
96
|
+
* base: "inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold",
|
|
97
|
+
* variants: {
|
|
98
|
+
* variant: {
|
|
99
|
+
* solid: "bg-primary text-primary-foreground",
|
|
100
|
+
* soft: "bg-primary/10 text-primary",
|
|
101
|
+
* outlined: "border border-current",
|
|
102
|
+
* },
|
|
103
|
+
* },
|
|
104
|
+
* defaultVariants: { variant: "solid" },
|
|
105
|
+
* });
|
|
106
|
+
*
|
|
107
|
+
* const classes = badgeRecipe({ variant: "soft" });
|
|
108
|
+
* // → "inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold bg-primary/10 text-primary"
|
|
109
|
+
* ```
|
|
110
|
+
*/
|
|
111
|
+
function defineRecipe(config) {
|
|
112
|
+
const { base, variants, defaultVariants, compoundVariants } = config;
|
|
113
|
+
return function singleRecipe(props) {
|
|
114
|
+
const resolved = {};
|
|
115
|
+
const parts = [];
|
|
116
|
+
if (base) parts.push(base);
|
|
117
|
+
if (variants) for (const variantKey of Object.keys(variants)) {
|
|
118
|
+
const fromProps = props?.[variantKey];
|
|
119
|
+
const fromDefaults = defaultVariants?.[variantKey];
|
|
120
|
+
resolved[variantKey] = fromProps ?? fromDefaults;
|
|
121
|
+
const value = resolved[variantKey];
|
|
122
|
+
if (value != null && variants[variantKey]?.[value]) parts.push(variants[variantKey][value]);
|
|
123
|
+
}
|
|
124
|
+
if (compoundVariants) {
|
|
125
|
+
for (const compound of compoundVariants) if (matchesCompoundCondition(compound, resolved)) parts.push(compound.css);
|
|
126
|
+
}
|
|
127
|
+
if (props?.className) parts.push(props.className);
|
|
128
|
+
return cn(...parts);
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { defineRecipe, defineSlotRecipe };
|
|
133
|
+
|
|
134
|
+
//# sourceMappingURL=recipe.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recipe.mjs","names":[],"sources":["../../../src/client/ui-resolver/recipe.ts"],"sourcesContent":["/**\n * Tailwind-native slot recipe system for compound components.\n *\n * Slot recipes coordinate variant styles across multiple parts of a compound\n * component. Each slot gets its own class string, and variants can target\n * specific slots or all slots at once.\n *\n * CSS variable contract:\n * instance style → [data-component-set] CSS → :root token → hardcoded fallback\n *\n * Component sets override CSS variables in their [data-component-set=\"...\"]\n * blocks. Recipes consume those variables via Tailwind arbitrary values\n * (e.g. h-[var(--enad-button-height)]), so changing the set changes the\n * component's dimensions without touching JS.\n */\n\nimport { cn } from \"../ui/utils\";\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\ntype SlotClassMap<S extends string> = Partial<Record<S, string>>;\n\ninterface SlotRecipeConfig<\n S extends string,\n V extends Record<string, Record<string, SlotClassMap<S>>>,\n> {\n slots: readonly S[];\n base: SlotClassMap<S>;\n variants?: V;\n defaultVariants?: {\n [K in keyof V]?: keyof V[K];\n };\n compoundVariants?: Array<\n {\n [K in keyof V]?: keyof V[K] | Array<keyof V[K]>;\n } & {\n css: SlotClassMap<S>;\n }\n >;\n}\n\ntype VariantProps<V extends Record<string, Record<string, unknown>>> = {\n [K in keyof V]?: keyof V[K];\n};\n\ntype SlotRecipeResult<S extends string> = Record<S, string>;\n\ninterface RecipeConfig<V extends Record<string, Record<string, string>>> {\n base?: string;\n variants?: V;\n defaultVariants?: {\n [K in keyof V]?: keyof V[K];\n };\n compoundVariants?: Array<\n {\n [K in keyof V]?: keyof V[K] | Array<keyof V[K]>;\n } & {\n css: string;\n }\n >;\n}\n\n// ---------------------------------------------------------------------------\n// Compound variant matching\n// ---------------------------------------------------------------------------\n\nfunction matchesCompoundCondition(\n condition: Record<string, unknown>,\n resolved: Record<string, unknown>,\n): boolean {\n for (const key of Object.keys(condition)) {\n if (key === \"css\") continue;\n const expected = condition[key];\n const actual = resolved[key];\n if (Array.isArray(expected)) {\n if (!expected.includes(actual as never)) return false;\n } else if (actual !== expected) {\n return false;\n }\n }\n return true;\n}\n\n// ---------------------------------------------------------------------------\n// defineSlotRecipe\n// ---------------------------------------------------------------------------\n\n/**\n * Creates a slot recipe for compound components.\n *\n * @example\n * ```ts\n * const cardRecipe = defineSlotRecipe({\n * slots: [\"root\", \"header\", \"content\", \"footer\"] as const,\n * base: {\n * root: \"flex flex-col rounded-lg border\",\n * header: \"grid items-start\",\n * content: \"px-6\",\n * footer: \"flex items-center px-6\",\n * },\n * variants: {\n * size: {\n * sm: { root: \"text-sm\", content: \"px-4\" },\n * md: { root: \"text-base\" },\n * lg: { root: \"text-lg\", content: \"px-8\" },\n * },\n * },\n * defaultVariants: { size: \"md\" },\n * });\n *\n * const classes = cardRecipe({ size: \"sm\" });\n * // classes.root → \"flex flex-col rounded-lg border text-sm\"\n * // classes.content → \"px-4\" (merged via tailwind-merge)\n * ```\n */\nexport function defineSlotRecipe<\n S extends string,\n V extends Record<string, Record<string, SlotClassMap<S>>>,\n>(config: SlotRecipeConfig<S, V>) {\n const { slots, base, variants, defaultVariants, compoundVariants } = config;\n\n return function slotRecipe(\n props?: VariantProps<V> & { className?: SlotClassMap<S> },\n ): SlotRecipeResult<S> {\n const resolved: Record<string, unknown> = {};\n\n // Resolve variant values: props override defaults\n if (variants) {\n for (const variantKey of Object.keys(variants)) {\n const fromProps = props?.[variantKey as keyof typeof props];\n const fromDefaults = defaultVariants?.[variantKey as keyof typeof defaultVariants];\n resolved[variantKey] = fromProps ?? fromDefaults;\n }\n }\n\n // Build class string for each slot\n const result = {} as Record<S, string>;\n\n for (const slot of slots) {\n const parts: string[] = [];\n\n // Base classes for this slot\n if (base[slot]) {\n parts.push(base[slot]);\n }\n\n // Variant classes for this slot\n if (variants) {\n for (const [variantKey, variantValues] of Object.entries(variants)) {\n const value = resolved[variantKey] as string | undefined;\n if (value != null && variantValues[value]) {\n const slotClasses = variantValues[value][slot];\n if (slotClasses) {\n parts.push(slotClasses);\n }\n }\n }\n }\n\n // Compound variant classes for this slot\n if (compoundVariants) {\n for (const compound of compoundVariants) {\n if (matchesCompoundCondition(compound, resolved)) {\n const slotClasses = compound.css[slot];\n if (slotClasses) {\n parts.push(slotClasses);\n }\n }\n }\n }\n\n // Per-slot className overrides from props\n if (props?.className?.[slot]) {\n parts.push(props.className[slot]);\n }\n\n result[slot] = cn(...parts);\n }\n\n return result;\n };\n}\n\n// ---------------------------------------------------------------------------\n// defineRecipe\n// ---------------------------------------------------------------------------\n\n/**\n * Creates a single-slot recipe for simple components.\n * Thin wrapper around defineSlotRecipe with a single \"root\" slot.\n *\n * @example\n * ```ts\n * const badgeRecipe = defineRecipe({\n * base: \"inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold\",\n * variants: {\n * variant: {\n * solid: \"bg-primary text-primary-foreground\",\n * soft: \"bg-primary/10 text-primary\",\n * outlined: \"border border-current\",\n * },\n * },\n * defaultVariants: { variant: \"solid\" },\n * });\n *\n * const classes = badgeRecipe({ variant: \"soft\" });\n * // → \"inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-semibold bg-primary/10 text-primary\"\n * ```\n */\nexport function defineRecipe<V extends Record<string, Record<string, string>>>(\n config: RecipeConfig<V>,\n) {\n const { base, variants, defaultVariants, compoundVariants } = config;\n\n return function singleRecipe(props?: VariantProps<V> & { className?: string }): string {\n const resolved: Record<string, unknown> = {};\n const parts: string[] = [];\n\n if (base) {\n parts.push(base);\n }\n\n // Resolve variant values: props override defaults\n if (variants) {\n for (const variantKey of Object.keys(variants)) {\n const fromProps = props?.[variantKey as keyof typeof props];\n const fromDefaults = defaultVariants?.[variantKey as keyof typeof defaultVariants];\n resolved[variantKey] = fromProps ?? fromDefaults;\n\n const value = resolved[variantKey] as string | undefined;\n if (value != null && variants[variantKey]?.[value]) {\n parts.push(variants[variantKey][value]);\n }\n }\n }\n\n // Compound variants\n if (compoundVariants) {\n for (const compound of compoundVariants) {\n if (matchesCompoundCondition(compound, resolved)) {\n parts.push(compound.css);\n }\n }\n }\n\n // className override from props\n if (props?.className) {\n parts.push(props.className);\n }\n\n return cn(...parts);\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAoEA,SAAS,yBACP,WACA,UACS;AACT,MAAK,MAAM,OAAO,OAAO,KAAK,UAAU,EAAE;AACxC,MAAI,QAAQ,MAAO;EACnB,MAAM,WAAW,UAAU;EAC3B,MAAM,SAAS,SAAS;AACxB,MAAI,MAAM,QAAQ,SAAS;OACrB,CAAC,SAAS,SAAS,OAAgB,CAAE,QAAO;aACvC,WAAW,SACpB,QAAO;;AAGX,QAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCT,SAAgB,iBAGd,QAAgC;CAChC,MAAM,EAAE,OAAO,MAAM,UAAU,iBAAiB,qBAAqB;AAErE,QAAO,SAAS,WACd,OACqB;EACrB,MAAM,WAAoC,EAAE;AAG5C,MAAI,SACF,MAAK,MAAM,cAAc,OAAO,KAAK,SAAS,EAAE;GAC9C,MAAM,YAAY,QAAQ;GAC1B,MAAM,eAAe,kBAAkB;AACvC,YAAS,cAAc,aAAa;;EAKxC,MAAM,SAAS,EAAE;AAEjB,OAAK,MAAM,QAAQ,OAAO;GACxB,MAAM,QAAkB,EAAE;AAG1B,OAAI,KAAK,MACP,OAAM,KAAK,KAAK,MAAM;AAIxB,OAAI,SACF,MAAK,MAAM,CAAC,YAAY,kBAAkB,OAAO,QAAQ,SAAS,EAAE;IAClE,MAAM,QAAQ,SAAS;AACvB,QAAI,SAAS,QAAQ,cAAc,QAAQ;KACzC,MAAM,cAAc,cAAc,OAAO;AACzC,SAAI,YACF,OAAM,KAAK,YAAY;;;AAO/B,OAAI;SACG,MAAM,YAAY,iBACrB,KAAI,yBAAyB,UAAU,SAAS,EAAE;KAChD,MAAM,cAAc,SAAS,IAAI;AACjC,SAAI,YACF,OAAM,KAAK,YAAY;;;AAO/B,OAAI,OAAO,YAAY,MACrB,OAAM,KAAK,MAAM,UAAU,MAAM;AAGnC,UAAO,QAAQ,GAAG,GAAG,MAAM;;AAG7B,SAAO;;;;;;;;;;;;;;;;;;;;;;;;;AA8BX,SAAgB,aACd,QACA;CACA,MAAM,EAAE,MAAM,UAAU,iBAAiB,qBAAqB;AAE9D,QAAO,SAAS,aAAa,OAA0D;EACrF,MAAM,WAAoC,EAAE;EAC5C,MAAM,QAAkB,EAAE;AAE1B,MAAI,KACF,OAAM,KAAK,KAAK;AAIlB,MAAI,SACF,MAAK,MAAM,cAAc,OAAO,KAAK,SAAS,EAAE;GAC9C,MAAM,YAAY,QAAQ;GAC1B,MAAM,eAAe,kBAAkB;AACvC,YAAS,cAAc,aAAa;GAEpC,MAAM,QAAQ,SAAS;AACvB,OAAI,SAAS,QAAQ,SAAS,cAAc,OAC1C,OAAM,KAAK,SAAS,YAAY,OAAO;;AAM7C,MAAI;QACG,MAAM,YAAY,iBACrB,KAAI,yBAAyB,UAAU,SAAS,CAC9C,OAAM,KAAK,SAAS,IAAI;;AAM9B,MAAI,OAAO,UACT,OAAM,KAAK,MAAM,UAAU;AAG7B,SAAO,GAAG,GAAG,MAAM"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Toggle as Toggle$1, toggleVariants } from "../ui/toggle.js";
|
|
1
|
+
import { Toggle as Toggle$1, toggleRecipe, toggleVariants } from "../ui/toggle.js";
|
|
2
2
|
import * as React$1 from "react";
|
|
3
3
|
import * as react_jsx_runtime0 from "react/jsx-runtime";
|
|
4
4
|
|
|
@@ -7,5 +7,5 @@ declare function Toggle({
|
|
|
7
7
|
...props
|
|
8
8
|
}: React$1.ComponentProps<typeof Toggle$1>): react_jsx_runtime0.JSX.Element;
|
|
9
9
|
//#endregion
|
|
10
|
-
export { Toggle, toggleVariants };
|
|
10
|
+
export { Toggle, toggleRecipe, toggleVariants };
|
|
11
11
|
//# sourceMappingURL=toggle.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCustomComponent } from "./context.mjs";
|
|
3
|
-
import { Toggle as Toggle$1, toggleVariants } from "../ui/toggle.mjs";
|
|
3
|
+
import { Toggle as Toggle$1, toggleRecipe, toggleVariants } from "../ui/toggle.mjs";
|
|
4
4
|
import "react";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/client/ui-resolver/toggle.tsx
|
|
@@ -10,6 +10,6 @@ function Toggle({ ...props }) {
|
|
|
10
10
|
return /* @__PURE__ */ jsx(Toggle$1, { ...props });
|
|
11
11
|
}
|
|
12
12
|
//#endregion
|
|
13
|
-
export { Toggle, toggleVariants };
|
|
13
|
+
export { Toggle, toggleRecipe, toggleVariants };
|
|
14
14
|
|
|
15
15
|
//# sourceMappingURL=toggle.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toggle.mjs","names":["DefaultToggle"],"sources":["../../../src/client/ui-resolver/toggle.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Toggle as DefaultToggle, toggleVariants } from \"../ui/toggle\";\nimport { useCustomComponent } from \"./context\";\n\nfunction Toggle({ ...props }: React.ComponentProps<typeof DefaultToggle>) {\n const Custom = useCustomComponent(\"toggle\");\n if (Custom) return <Custom {...props} />;\n return <DefaultToggle {...props} />;\n}\n\nexport { Toggle, toggleVariants };\n"],"mappings":";;;;;;AAMA,SAAS,OAAO,EAAE,GAAG,SAAqD;CACxE,MAAM,SAAS,mBAAmB,SAAS;AAC3C,KAAI,OAAQ,QAAO,oBAAC,QAAD,EAAQ,GAAI,OAAS,CAAA;AACxC,QAAO,oBAACA,UAAD,EAAe,GAAI,OAAS,CAAA"}
|
|
1
|
+
{"version":3,"file":"toggle.mjs","names":["DefaultToggle"],"sources":["../../../src/client/ui-resolver/toggle.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Toggle as DefaultToggle, toggleRecipe, toggleVariants } from \"../ui/toggle\";\nimport { useCustomComponent } from \"./context\";\n\nfunction Toggle({ ...props }: React.ComponentProps<typeof DefaultToggle>) {\n const Custom = useCustomComponent(\"toggle\");\n if (Custom) return <Custom {...props} />;\n return <DefaultToggle {...props} />;\n}\n\nexport { Toggle, toggleRecipe, toggleVariants };\n"],"mappings":";;;;;;AAMA,SAAS,OAAO,EAAE,GAAG,SAAqD;CACxE,MAAM,SAAS,mBAAmB,SAAS;AAC3C,KAAI,OAAQ,QAAO,oBAAC,QAAD,EAAQ,GAAI,OAAS,CAAA;AACxC,QAAO,oBAACA,UAAD,EAAe,GAAI,OAAS,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region src/client/ui-resolver/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Global variant vocabulary for the SDK component system.
|
|
4
|
+
*
|
|
5
|
+
* Surface variants control visual treatment (fill, outline, etc.).
|
|
6
|
+
* Semantic colors communicate intent (primary action, error, etc.).
|
|
7
|
+
* Sizes follow a consistent t-shirt scale across all components.
|
|
8
|
+
*/
|
|
9
|
+
type Variant = "solid" | "soft" | "outlined" | "plain";
|
|
10
|
+
type SemanticColor = "primary" | "neutral" | "danger" | "success";
|
|
11
|
+
type Size = "xs" | "sm" | "md" | "lg" | "xl";
|
|
12
|
+
//#endregion
|
|
13
|
+
export { SemanticColor, Size, Variant };
|
|
14
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../../../src/client/ui-resolver/types.ts"],"mappings":";;AAQA;;;;;AAEA;KAFY,OAAA;AAAA,KAEA,aAAA;AAAA,KAEA,IAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -22,12 +22,12 @@ function WishlistItemActions({ productId, productName, onMoveToCart, onRemove, i
|
|
|
22
22
|
return /* @__PURE__ */ jsxs("div", {
|
|
23
23
|
className: "flex items-center gap-2 mt-2",
|
|
24
24
|
children: [onMoveToCart && productId && /* @__PURE__ */ jsx(Button, {
|
|
25
|
-
variant: "
|
|
25
|
+
variant: "outlined",
|
|
26
26
|
size: "sm",
|
|
27
27
|
onClick: () => onMoveToCart(productId),
|
|
28
28
|
children: moveToCartLabel
|
|
29
29
|
}), /* @__PURE__ */ jsx(Button, {
|
|
30
|
-
variant: "
|
|
30
|
+
variant: "plain",
|
|
31
31
|
size: "icon",
|
|
32
32
|
className: "flex-shrink-0",
|
|
33
33
|
onClick: () => productId && onRemove(productId),
|
|
@@ -98,7 +98,7 @@ function WishlistEmptyState({ emptyTitle, emptyDescription, continueShoppingLabe
|
|
|
98
98
|
}),
|
|
99
99
|
/* @__PURE__ */ jsx(Button, {
|
|
100
100
|
onClick: onClose,
|
|
101
|
-
variant: "
|
|
101
|
+
variant: "outlined",
|
|
102
102
|
children: continueShoppingLabel
|
|
103
103
|
})
|
|
104
104
|
]
|
|
@@ -155,7 +155,7 @@ function WishlistDrawer({ isOpen, onClose, wishlistId, onMoveToCart, className,
|
|
|
155
155
|
showClose: false,
|
|
156
156
|
children: title
|
|
157
157
|
}), /* @__PURE__ */ jsx(Button, {
|
|
158
|
-
variant: "
|
|
158
|
+
variant: "plain",
|
|
159
159
|
size: "icon",
|
|
160
160
|
onClick: onClose,
|
|
161
161
|
"aria-label": "Close wishlist",
|